flat7th

# 古いEmacs設定

created 2014-12-20 modified 2023-12-13 

2023年12月


fedora39, emacs29.1

;; .emacs

;; emacs 29.1 の起動時Warning を消す
(setq comp-async-report-warnings-errors nil)

;; 言語、文字コード関係
(set-language-environment "Japanese")
(prefer-coding-system 'utf-8-unix)
;; mozc
;;(progn
;;  (require 'mozc)
;;  (setq default-input-method "japanese-mozc")
;;  (define-key global-map [zenkaku-hankaku] 'toggle-input-method)
;;  (define-key global-map [henkan] 'toggle-input-method)
;;  (define-key global-map [muhenkan] 'deactivate-input-method)
;;  (defadvice mozc-handle-event (around intercept-keys (event))
;;    "Intercept keys muhenkan and zenkaku-hankaku, before passing keys
;;to mozc-server (which the function mozc-handle-event does), to
;;properly disable mozc-mode."
;;    (if (member event (list 'zenkaku-hankaku 'muhenkan))
;;      (progn
;;        (mozc-clean-up-session)
;;        (toggle-input-method))
;;      (progn ;(message "%s" event) ;debug
;;        ad-do-it)))
;;  (ad-activate 'mozc-handle-event)
;;  )

;; 実行環境のパス、URLなど
(setq load-path (cons "~/.emacs.d/elisp" load-path))

(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t)
(package-initialize)


;; 見栄え
;; FONT
;;   フォント名の一覧 を知るには...
;; (dolist (x (x-list-fonts "*")) (print x))
;;   "Monospace" "Liberation Mono" "DejaVu Sans Mono"
;;   "VL Pゴシック" "VL ゴシック"
(set-face-attribute 'default nil :family "DejaVu Sans Mono" :height 102)
(set-fontset-font t 'japanese-jisx0208 (font-spec :family "VL ゴシック"))
;; 英数と漢字のバランス
;; (setq face-font-rescale-alist '(("VL ゴシック" . 1.2))) ;; 1.2 だと 英2:日1 方式になる
;; 最近は、英数5文字に日本語3文字が対応するのが流行りらしい。
;; 日本語を1.2倍すると等幅になるってことは、emacs標準でそうなってる…はずなんだけど、
;; 英字のサイズによって狂うらしく、"DejaVu Sans Mono" 110 はきれいに英5:日3になるが、それ以外だとダメポ
;; abcdeABCDEabcdeABCDE
;; あいう日本語あいう日本語
;;
;; 絵文字対策
(setq use-default-font-for-symbols nil)
;;
;; tab character
;;(standard-display-ascii ?\t "»        ")


;;;; 自分用 機能、キー設定

(progn
  (define-key global-map "\C-z" 'undo)
  (define-key global-map [C-tab] 'other-window)
  (define-key global-map "\C-\M-o" 'other-frame)
  (define-key global-map "\C-cg" 'goto-line)
  (define-key global-map "\C-s" 'isearch-forward-regexp)
  (define-key global-map "\M-o" 'ff-get-other-file)
  (define-key global-map "\M-p" 'backward-list)
  (define-key global-map "\M-n" 'forward-list)
  )
(progn
  (defun toggle-indent-tabs-mode () (interactive)
         (setq indent-tabs-mode (not indent-tabs-mode))
         (message "indent-tabs-mode is %s" indent-tabs-mode)
         )
  (defun toggle-dedicate () "toggle dedicate status" (interactive)
         (set-window-dedicated-p (selected-window) (not (window-dedicated-p)))
         (message "window-dedicated-p is %s" (window-dedicated-p))
         )
  (defun incr-tab () (interactive)
         (setq tab-width (+ tab-width 1))
         (message "tab-width = %d" tab-width)
         (redraw-frame)
         )
  (defun decr-tab () (interactive)
         (setq tab-width (- tab-width 1))
         (message "tab-width = %d" tab-width)
         (redraw-frame)
         )
  )
(progn
  (define-key global-map [f1] 'toggle-indent-tabs-mode)
  (define-key global-map [C-f1] 'toggle-truncate-lines)
  (define-key global-map [M-f1] 'toggle-dedicate)
  (define-key global-map [f6] 'bury-buffer)
  (define-key global-map [(shift f6)] 'unbury-buffer)
  (define-key global-map [f7] 'decr-tab)
  (define-key global-map [f8] 'incr-tab)
  (define-key global-map [f9] "\C-u0\C-l")
  (define-key global-map [f11] 'enlarge-window)
  (define-key global-map [C-f11] 'shrink-window)
  (define-key global-map [f12] 'enlarge-window-horizontally)
  (define-key global-map [C-f12] 'shrink-window-horizontally)
  )


;;;; モードごとのカスタマイズ

;; dired
(eval-after-load "dired"
  '(progn
     ;;(fset 'dired-find-file-eucjp "\C-x\C-mceuc-japan\C-mf")
     ;;(define-key dired-mode-map "e" 'dired-find-file-eucjp)

     ;; dired モードで 大文字S で 通常 -> .始まり隠す -> selinuxの表示 -> 通常 を切り替える
     (defun dired-toggle-dot-files () (interactive)
            (if (not (string-match "Z" dired-actual-switches))
                (if (string-match "a" dired-actual-switches)
                    (setq dired-actual-switches "-l")
                  (setq dired-actual-switches "-laZ")
                  )
              (setq dired-actual-switches dired-listing-switches) ;; "-la"
              )
            (revert-buffer)
            )
     (define-key dired-mode-map "S" 'dired-toggle-dot-files)

     (setq dired-dnd-protocol-alist
           '(("^file:///" . dnd-open-local-file)
             ("^file://"  . dnd-open-file)
             ("^file:"    . dnd-open-local-file)))
     )
  )

;; speedbar
;; インストール
;;   M-x package-install sr-speedbar
;;   ... は、版が古い。2016年で止まっている。
;; 起動
;;   M-x sr-speedbar-toggle
;; 左側にするには
;;   M-x customize-apropos で sr-speedbar-right-side を探して、nil にする
;;
(eval-after-load 'speedbar
  '(progn
     (speedbar-add-supported-extension ".rb")
     (speedbar-add-supported-extension ".src")
     (speedbar-add-supported-extension ".conf")
     (speedbar-add-supported-extension ".a")
     (speedbar-add-supported-extension ".so")
     ))
;;
;;(require 'sr-speedbar)

;; markdown
(progn
  (autoload 'markdown-mode "markdown-mode"
    "Major mode for editing Markdown files" t)
  (add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode))
  (add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
  (autoload 'gfm-mode "markdown-mode"
    "Major mode for editing GitHub Flavored Markdown files" t)
  (add-to-list 'auto-mode-alist '("README\\.md\\'" . gfm-mode))
  )

;; C言語
(defun my-c-mode-hook ()
  ;;(setq indent-tabs-mode t)
  ;;(modify-syntax-entry ?_ "w")
  (define-key c-mode-base-map "/" 'self-insert-command)
  (define-key c-mode-base-map "*" 'self-insert-command)
  )
(add-hook 'c-mode-hook 'my-c-mode-hook)

;; 定義箇所に飛ぶやつ
(eval-after-load 'xref
  '(progn
     (define-key xref--xref-buffer-mode-map
                 (kbd "RET") #'xref-quit-and-goto-xref)
     (define-key xref--button-map
                 (kbd "RET") #'xref-quit-and-goto-xref)
     ))

;; FindOtherFile  ff-find-other-file  .h と.cで切り替えるやつ

(setq cc-search-directories
      '("."
        "../include"
        "../src"
        "../include/*"
        "../src/*"
        "../../include/*"
        "../../src/*"
        "../../../include/*"
        "../../../include/*/*"
        "../../../src/*/*"
        "/usr/include"
        ))

;; ファイル名とモードの対応

(add-to-list 'auto-mode-alist '("/Makefile" . makefile-gmake-mode))
(add-to-list 'auto-mode-alist '("\\.h$" . c++-mode))

;;(load-library "bison-mode")
;;(add-to-list 'auto-mode-alist '("\\.l$" . bison-mode))
;;(add-to-list 'auto-mode-alist '("\\.y$" . bison-mode))

(add-to-list 'auto-mode-alist '("\\.php$" . php-mode))
(add-to-list 'auto-mode-alist '("\\.html$" . xml-mode))


;; emacs標準機能によるカスタマイズ

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(ansi-color-names-vector
   ["black" "red3" "green3" "yellow3" "dodger blue" "magenta3" "cyan3" "gray90"])
 '(auto-compression-mode t nil (jka-compr))
 '(auto-revert-interval 1)
 '(backup-directory-alist '((".*" . "~/.emacsbak")))
 '(c++-font-lock-extra-types
   '("\\sw+_t" "\\([iof]\\|str\\)+stream\\(buf\\)?" "ios" "string" "rope" "list" "slist" "deque" "vector" "bit_vector" "set" "multiset" "map" "multimap" "hash\\(_\\(m\\(ap\\|ulti\\(map\\|set\\)\\)\\|set\\)\\)?" "stack" "queue" "priority_queue" "type_info" "iterator" "const_iterator" "reverse_iterator" "const_reverse_iterator" "reference" "const_reference" "u_?\\(int\\|long\\|short\\|char\\)"))
 '(c-default-style
   '((c-mode . "cc-mode")
     (c++-mode . "cc-mode")
     (java-mode . "java")))
 '(c-echo-syntactic-information-p t)
 '(c-font-lock-extra-types
   '("FILE" "\\sw+_t" "Lisp_Object" "u_?\\(int\\|long\\|short\\|char\\)"))
 '(c-offsets-alist
   '((inline-open . 0)
     (member-init-cont . c-lineup-multi-inher)
     (substatement-open . +)
     (case-label . 0)))
 '(c-tab-always-indent nil)
 '(comint-scroll-to-bottom-on-input t)
 '(default-frame-alist
   '((foreground-color . "white")
     (background-color . "gray16")
     (cursor-color . "red")
     (mouse-color . "red")
     (width . 98)))
 '(dired-listing-switches "-la")
 '(fill-column 86)
 '(gdb-many-windows t)
 '(generic-define-mswindows-modes t)
 '(global-auto-revert-mode t nil (autorevert))
 '(global-whitespace-mode nil)
 '(grep-find-command
   '("find . -type d -name '.[a-z]*' -prune -o -type f -exec grep --color -nH --null -e  '{}' +" . 83))
 '(initial-buffer-choice t)
 '(initial-major-mode 'text-mode)
 '(ls-lisp-verbosity nil)
 '(package-selected-packages
   '(markdown-preview-mode php-mode web-mode markdown-mode markdonw-mode))
 '(revert-without-query '(".log$"))
 '(same-window-regexps '("*shell*" "*Buffer List*"))
 '(scroll-step 1)
 '(show-trailing-whitespace t)
 '(skk-egg-like-newline t)
 '(speedbar-show-unknown-files t)
 '(sr-speedbar-right-side nil)
 '(tab-width 4)
 '(tags-case-fold-search nil)
 '(tool-bar-mode nil)
 '(tooltip-mode nil nil (tooltip))
 '(truncate-lines t)
 '(woman-fill-frame t)
 '(x-stretch-cursor t))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(ansi-color-blue ((t (:background "royal blue" :foreground "royal blue"))))
 '(ansi-color-bright-blue ((t (:background "dodger blue" :foreground "dodger blue"))))
 '(dired-directory ((t (:foreground "SteelBlue1"))))
 '(ediff-even-diff-A ((t (:extend t :background "dim grey"))))
 '(ediff-even-diff-Ancestor ((t (:extend t :background "grey30"))))
 '(ediff-even-diff-B ((t (:extend t :background "dim grey"))))
 '(ediff-even-diff-C ((t (:extend t :background "dim grey"))))
 '(ediff-even-diff-face-Ancestor ((((class color)) (:background "Grey" :foreground "Blue"))))
 '(ediff-even-diff-face-B ((((class color)) (:background "Grey" :foreground "Blue"))))
 '(ediff-odd-diff-A ((t (:extend t :background "Grey50"))))
 '(ediff-odd-diff-B ((t (:extend t :background "Grey50"))))
 '(ediff-odd-diff-C ((t (:extend t :background "Grey50"))))
 '(ediff-odd-diff-face-A ((((class color)) (:background "Grey" :foreground "Blue"))))
 '(ediff-odd-diff-face-C ((((class color)) (:background "Grey" :foreground "Blue"))))
 '(escape-glyph ((t (:foreground "DeepSkyBlue4"))))
 '(font-lock-builtin-face ((t (:foreground "plum"))))
 '(font-lock-comment-face ((t (:foreground "medium sea green"))))
 '(font-lock-doc-face ((t (:foreground "gray"))))
 '(font-lock-function-name-face ((t (:foreground "goldenrod"))))
 '(font-lock-keyword-face ((t (:foreground "DodgerBlue"))))
 '(font-lock-string-face ((t (:foreground "peru"))))
 '(font-lock-type-face ((t (:foreground "deep sky blue"))))
 '(font-lock-variable-name-face ((t (:foreground "wheat"))))
 '(nxml-element-local-name ((t (:foreground "lightblue"))))
 '(speedbar-file-face ((t (:foreground "light gray"))))
 '(trailing-whitespace ((t (:background "dark slate gray")))))

(put 'narrow-to-region 'disabled nil)

2023年06月。


fedora38

;; Added by Package.el.  This must come before configurations of
;; installed packages.  Don't delete this line.  If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
;;(package-initialize)

(set-language-environment "Japanese")

(prefer-coding-system 'utf-8-unix)

(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t)
(package-initialize)

;;(setq load-path (cons "~/.emacs.d/elisp" load-path))

;; markdown
;;(package-install 'markdown-mode)
(autoload 'markdown-mode "markdown-mode"
  "Major mode for editing Markdown files" t)
(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
(autoload 'gfm-mode "markdown-mode"
  "Major mode for editing GitHub Flavored Markdown files" t)
(add-to-list 'auto-mode-alist '("README\\.md\\'" . gfm-mode))


(progn
  ;;  (require 'mozc)
  ;;  (setq default-input-method "japanese-mozc")
  ;;  (define-key global-map [zenkaku-hankaku] 'toggle-input-method)
  ;;  (define-key global-map [henkan] 'toggle-input-method)
  ;;  (define-key global-map [muhenkan] 'deactivate-input-method)
  ;;  (defadvice mozc-handle-event (around intercept-keys (event))
  ;;    "Intercept keys muhenkan and zenkaku-hankaku, before passing keys
  ;;to mozc-server (which the function mozc-handle-event does), to
  ;;properly disable mozc-mode."
  ;;    (if (member event (list 'zenkaku-hankaku 'muhenkan))
  ;;      (progn
  ;;        (mozc-clean-up-session)
  ;;        (toggle-input-method))
  ;;      (progn ;(message "%s" event) ;debug
  ;;        ad-do-it)))
  ;;  (ad-activate 'mozc-handle-event)
  )
(progn
  (define-key global-map "\C-z" 'undo)
  (define-key global-map "\M-o" 'other-window)
  (define-key global-map "\C-\M-o" 'other-frame)
  (define-key global-map "\C-cg" 'goto-line)
  (define-key global-map "\C-s" 'isearch-forward-regexp)
  (define-key global-map [C-tab] 'ff-get-other-file)
  (define-key global-map "\M-p" 'backward-list)
  (define-key global-map "\M-n" 'forward-list)
  )
(progn
  (defun toggle-indent-tabs-mode () (interactive)
         (setq indent-tabs-mode (not indent-tabs-mode))
         (message "indent-tabs-mode is %s" indent-tabs-mode)
         )
  (defun toggle-dedicate () "toggle dedicate status" (interactive)
         (set-window-dedicated-p (selected-window) (not (window-dedicated-p)))
         (message "window-dedicated-p is %s" (window-dedicated-p))
         )
  (defun incr-tab () (interactive)
         (setq tab-width (+ tab-width 1))
         (message "tab-width = %d" tab-width)
         (redraw-frame)
         )
  (defun decr-tab () (interactive)
         (setq tab-width (- tab-width 1))
         (message "tab-width = %d" tab-width)
         (redraw-frame)
         )
  )
(progn
  (define-key global-map [f1] 'toggle-indent-tabs-mode)
  (define-key global-map [C-f1] 'toggle-truncate-lines)
  (define-key global-map [M-f1] 'toggle-dedicate)
  (define-key global-map [f6] 'bury-buffer)
  (define-key global-map [(shift f6)] 'unbury-buffer)
  (define-key global-map [f7] 'decr-tab)
  (define-key global-map [f8] 'incr-tab)
  (define-key global-map [f9] "\C-u0\C-l")
  (define-key global-map [f11] 'enlarge-window)
  (define-key global-map [C-f11] 'shrink-window)
  (define-key global-map [f12] 'enlarge-window-horizontally)
  (define-key global-map [C-f12] 'shrink-window-horizontally)
  )

(defun my-c-mode-hook ()
  ;;(setq indent-tabs-mode t)
  ;;(modify-syntax-entry ?_ "w")
  (define-key c-mode-base-map "/" 'self-insert-command)
  (define-key c-mode-base-map "*" 'self-insert-command)
  )
(add-hook 'c-mode-hook 'my-c-mode-hook)

;;(eval-after-load 'speedbar
;;  '(progn
;;     (speedbar-add-supported-extension ".rb")
;;     (speedbar-add-supported-extension ".src")
;;     (speedbar-add-supported-extension ".conf")
;;     (speedbar-add-supported-extension ".a")
;;     (speedbar-add-supported-extension ".so")
;;     ))

(eval-after-load 'xref
  '(progn
     (define-key xref--xref-buffer-mode-map
       (kbd "RET") #'xref-quit-and-goto-xref)
     (define-key xref--button-map
       (kbd "RET") #'xref-quit-and-goto-xref)
     ))

(eval-after-load "dired"
  '(progn
     ;;(fset 'dired-find-file-eucjp "\C-x\C-mceuc-japan\C-mf")
     ;;(define-key dired-mode-map "e" 'dired-find-file-eucjp)

     (defun dired-toggle-dot-files () (interactive)
	    (if (string-match "a" dired-actual-switches)
		(setq dired-actual-switches "-l")
	      (setq dired-actual-switches dired-listing-switches)) ;; "-la"
	    (revert-buffer)
            )
     (define-key dired-mode-map "b" 'dired-toggle-dot-files)

     (setq dired-dnd-protocol-alist
           '(("^file:///" . dnd-open-local-file)
             ("^file://"  . dnd-open-file)
             ("^file:"    . dnd-open-local-file)))
     )
  )

(add-to-list 'auto-mode-alist '("/Makefile" . makefile-mode))
(add-to-list 'auto-mode-alist '("\\.h$" . c++-mode))

;;(load-library "bison-mode")
;;(add-to-list 'auto-mode-alist '("\\.l$" . bison-mode))
;;(add-to-list 'auto-mode-alist '("\\.y$" . bison-mode))

(add-to-list 'auto-mode-alist '("\\.php$" . php-mode))
(add-to-list 'auto-mode-alist '("\\.html$" . xml-mode))

;;(server-start)


;; FONT
;;   フォント名の一覧 を知るには...
;; (dolist (x (x-list-fonts "*")) (print x))
;;   "Monospace" "Liberation Mono" "DejaVu Sans Mono"
;;   "VL Pゴシック" "VL ゴシック"
(set-face-attribute 'default nil :family "DejaVu Sans Mono" :height 110)
(set-fontset-font t 'japanese-jisx0208 (font-spec :family "VL ゴシック"))
;;;; 英数と漢字のバランス

;;(setq face-font-rescale-alist '(("VL ゴシック" . 1.2))) ;; 1.2 だと 英2:日1 方式になる

;;;; 最近は、英数5文字に日本語3文字が対応するのが流行りらしい。
;;;; ていうか、日本語を1.2倍すると等幅になるってことは、emacs標準でそうなってるって話…のはずなんだけど、
;;;; 英字のサイズによってそれが狂うらしく、 "DejaVu Sans Mono" 110 だときれいに英5:日3になるが、それ以外だとダメポ
;;;;abcdeABCDEabcdeABCDE
;;;;あいう日本語あいう日本語

;; 絵文字対策
(setq use-default-font-for-symbols nil)


(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(ansi-color-names-vector
   ["black" "red3" "green3" "yellow3" "dodger blue" "magenta3" "cyan3" "gray90"])
 '(auto-compression-mode t nil (jka-compr))
 '(auto-revert-interval 1)
 '(backup-directory-alist '((".*" . "~/.emacsbak")))
 '(c++-font-lock-extra-types
   '("\\sw+_t" "\\([iof]\\|str\\)+stream\\(buf\\)?" "ios" "string" "rope" "list" "slist" "deque" "vector" "bit_vector" "set" "multiset" "map" "multimap" "hash\\(_\\(m\\(ap\\|ulti\\(map\\|set\\)\\)\\|set\\)\\)?" "stack" "queue" "priority_queue" "type_info" "iterator" "const_iterator" "reverse_iterator" "const_reverse_iterator" "reference" "const_reference" "u_?\\(int\\|long\\|short\\|char\\)"))
 '(c-default-style
   '((c-mode . "cc-mode")
     (c++-mode . "cc-mode")
     (java-mode . "java")))
 '(c-echo-syntactic-information-p t)
 '(c-font-lock-extra-types
   '("FILE" "\\sw+_t" "Lisp_Object" "u_?\\(int\\|long\\|short\\|char\\)"))
 '(c-offsets-alist
   '((inline-open . 0)
     (member-init-cont . c-lineup-multi-inher)
     (substatement-open . +)
     (case-label . 0)))
 '(c-tab-always-indent nil)
 '(comint-scroll-to-bottom-on-input t)
 '(default-frame-alist
    '((foreground-color . "white")
      (background-color . "gray16")
      (cursor-color . "red")
      (mouse-color . "red")
      (width . 98)))
 '(dired-listing-switches "-la")
 '(fill-column 86)
 '(gdb-many-windows t)
 '(generic-define-mswindows-modes t)
 '(global-auto-revert-mode t nil (autorevert))
 '(grep-find-command
   '("find . -type d -name '.[a-z]*' -prune -o -type f -exec grep --color -nH --null -e  '{}' +" . 83))
 '(initial-major-mode 'text-mode)
 '(ls-lisp-verbosity nil)
 '(package-selected-packages '(php-mode web-mode markdown-mode markdonw-mode))
 '(revert-without-query '(".log$"))
 '(same-window-regexps '("*shell*" "*Buffer List*"))
 '(scroll-step 1)
 '(skk-egg-like-newline t)
 '(speedbar-show-unknown-files t)
 '(tab-width 8)
 '(tags-case-fold-search nil)
 '(tool-bar-mode nil)
 '(tooltip-mode nil nil (tooltip))
 '(truncate-lines t)
 '(woman-fill-frame t))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(ansi-color-blue ((t (:background "royal blue" :foreground "royal blue"))))
 '(ansi-color-bright-blue ((t (:background "dodger blue" :foreground "dodger blue"))))
 '(ediff-even-diff-A ((t (:extend t :background "dim grey"))))
 '(ediff-even-diff-Ancestor ((t (:extend t :background "grey30"))))
 '(ediff-even-diff-B ((t (:extend t :background "dim grey"))))
 '(ediff-even-diff-C ((t (:extend t :background "dim grey"))))
 '(ediff-even-diff-face-Ancestor ((((class color)) (:background "Grey" :foreground "Blue"))))
 '(ediff-even-diff-face-B ((((class color)) (:background "Grey" :foreground "Blue"))))
 '(ediff-odd-diff-A ((t (:extend t :background "Grey50"))))
 '(ediff-odd-diff-B ((t (:extend t :background "Grey50"))))
 '(ediff-odd-diff-C ((t (:extend t :background "Grey50"))))
 '(ediff-odd-diff-face-A ((((class color)) (:background "Grey" :foreground "Blue"))))
 '(ediff-odd-diff-face-C ((((class color)) (:background "Grey" :foreground "Blue"))))
 '(escape-glyph ((t (:foreground "DeepSkyBlue4"))))
 '(font-lock-comment-face ((t (:foreground "chartreuse2"))))
 '(font-lock-doc-face ((t (:foreground "gray"))))
 '(font-lock-function-name-face ((nil (:foreground "lightblue"))))
 '(font-lock-keyword-face ((t (:foreground "DodgerBlue"))))
 '(font-lock-string-face ((t (:foreground "peru"))))
 '(nxml-element-local-name ((t (:foreground "lightblue")))))

(put 'narrow-to-region 'disabled nil)




Ubuntu と VcXsrv の組み合わせでウィンドウサイズが異常な件。


https://msyksphinz.hatenablog.com/entry/2018/07/19/040000

そうなんですよね。特定の GUI tool kit で emacs をビルドすると問題がでなくなる。
でも

https://w.atwiki.jp/ntemacs/pages/69.html

から頂きました。もう、自分でウィンドウサイズを変えてしまうっていう解。

(defun reset-frame-parameter (frame)
  (sleep-for 0.1)
  (set-frame-parameter frame 'height 32))
(add-hook 'after-make-frame-functions #'reset-frame-parameter)
(reset-frame-parameter (selected-frame))

これでは ediff や speedbar がおかしくなる。だけど一時的な環境ならコストと利点で妥当な策である気がする。




2023年1月。emacs 28.2, Fedora 37

;; Added by Package.el.  This must come before configurations of
;; installed packages.  Don't delete this line.  If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
;;(package-initialize)

(prefer-coding-system 'utf-8-unix)

;(require 'package)
;;(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
;;(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t)
;;(package-initialize)

;;(setq load-path (cons "~/.emacs.d/elisp" load-path))

;; markdown
;;(package-install 'markdown-mode)
(autoload 'markdown-mode "markdown-mode"
   "Major mode for editing Markdown files" t)
(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
(autoload 'gfm-mode "markdown-mode"
   "Major mode for editing GitHub Flavored Markdown files" t)
(add-to-list 'auto-mode-alist '("README\\.md\\'" . gfm-mode))


(progn
;;  (require 'mozc)
;;  (setq default-input-method "japanese-mozc")
;;  (define-key global-map [zenkaku-hankaku] 'toggle-input-method)
;;  (define-key global-map [henkan] 'toggle-input-method)
;;  (define-key global-map [muhenkan] 'deactivate-input-method)
;;  (defadvice mozc-handle-event (around intercept-keys (event))
;;    "Intercept keys muhenkan and zenkaku-hankaku, before passing keys
;;to mozc-server (which the function mozc-handle-event does), to
;;properly disable mozc-mode."
;;    (if (member event (list 'zenkaku-hankaku 'muhenkan))
;;	(progn
;;	  (mozc-clean-up-session)
;;	  (toggle-input-method))
;;      (progn ;(message "%s" event) ;debug
;;	ad-do-it)))
;;  (ad-activate 'mozc-handle-event)
  )
(progn
  (define-key global-map "\C-z" 'undo)
  (define-key global-map "\M-o" 'other-window)
  (define-key global-map "\C-\M-o" 'other-frame)
  (define-key global-map "\C-cg" 'goto-line)
  (define-key global-map "\C-s" 'isearch-forward-regexp)
  (define-key global-map [C-tab] 'ff-get-other-file)
  (define-key global-map "\M-p" 'backward-list)
  (define-key global-map "\M-n" 'forward-list)
  )
(progn
  (defun toggle-indent-tabs-mode () (interactive)
	 (setq indent-tabs-mode (not indent-tabs-mode))
	 (message "indent-tabs-mode is %s" indent-tabs-mode)
	 )
  (defun toggle-dedicate () "toggle dedicate status" (interactive)
	 (set-window-dedicated-p (selected-window) (not (window-dedicated-p)))
	 (message "window-dedicated-p is %s" (window-dedicated-p))
	 )
  (defun incr-tab () (interactive)
	 (setq tab-width (+ tab-width 1))
	 (message "tab-width = %d" tab-width)
	 (redraw-frame)
	 )
  (defun decr-tab () (interactive)
	 (setq tab-width (- tab-width 1))
	 (message "tab-width = %d" tab-width)
	 (redraw-frame)
	 )
  )
(progn
  (define-key global-map [f1] 'toggle-indent-tabs-mode)
  (define-key global-map [C-f1] 'toggle-truncate-lines)
  (define-key global-map [M-f1] 'toggle-dedicate)
  (define-key global-map [f6] 'bury-buffer)
  (define-key global-map [(shift f6)] 'unbury-buffer)
  (define-key global-map [f7] 'decr-tab)
  (define-key global-map [f8] 'incr-tab)
  (define-key global-map [f9] "\C-u0\C-l")
  (define-key global-map [f11] 'enlarge-window)
  (define-key global-map [C-f11] 'shrink-window)
  (define-key global-map [f12] 'enlarge-window-horizontally)
  (define-key global-map [C-f12] 'shrink-window-horizontally)
  )

(defun my-c-mode-hook ()
  ;;(setq indent-tabs-mode t)
  ;;(modify-syntax-entry ?_ "w")
  (define-key c-mode-base-map "/" 'self-insert-command)
  (define-key c-mode-base-map "*" 'self-insert-command)
  )
(add-hook 'c-mode-hook 'my-c-mode-hook)

;;(eval-after-load 'speedbar
;;  '(progn
;;     (speedbar-add-supported-extension ".rb")
;;     (speedbar-add-supported-extension ".src")
;;     (speedbar-add-supported-extension ".conf")
;;     (speedbar-add-supported-extension ".a")
;;     (speedbar-add-supported-extension ".so")
;;     ))

(eval-after-load 'xref
  '(progn
     (define-key xref--xref-buffer-mode-map
       (kbd "RET") #'xref-quit-and-goto-xref)
     (define-key xref--button-map
       (kbd "RET") #'xref-quit-and-goto-xref)
     ))

(eval-after-load "dired"
  '(progn
     ;;(fset 'dired-find-file-eucjp "\C-x\C-mceuc-japan\C-mf")
     ;;(define-key dired-mode-map "e" 'dired-find-file-eucjp)
     (setq dired-dnd-protocol-alist
	   '(("^file:///" . dnd-open-local-file)
	     ("^file://"  . dnd-open-file)
	     ("^file:"    . dnd-open-local-file)))
     ))

(add-to-list 'auto-mode-alist '("/Makefile" . makefile-mode))
(add-to-list 'auto-mode-alist '("\\.h$" . c++-mode))

;;(load-library "bison-mode")
;;(add-to-list 'auto-mode-alist '("\\.l$" . bison-mode))
;;(add-to-list 'auto-mode-alist '("\\.y$" . bison-mode))

(add-to-list 'auto-mode-alist '("\\.php$" . web-mode))

;;(server-start)


;; FONT
;; フォント名の一覧 ... (dolist (x (x-list-fonts "*")) (print x))
;; "Monospace" "Liberation Mono" "DejaVu Sans Mono" "Ubuntu Mono"
;; "VL Pゴシック" "VL ゴシック"
(set-face-attribute 'default nil :family "DejaVu Sans Mono" :height 105)
;;(set-face-attribute 'default nil :family "Liberation Mono" :height 105)
(set-fontset-font t 'japanese-jisx0208 (font-spec :family "VL ゴシック"))
(setq face-font-rescale-alist '(("VL ゴシック" . 1.00)))


(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(ansi-color-names-vector
   ["black" "red3" "green3" "yellow3" "dodger blue" "magenta3" "cyan3" "gray90"])
 '(auto-compression-mode t nil (jka-compr))
 '(auto-revert-interval 1)
 '(backup-directory-alist '((".*" . "~/.emacsbak")))
 '(c++-font-lock-extra-types
   '("\\sw+_t" "\\([iof]\\|str\\)+stream\\(buf\\)?" "ios" "string" "rope" "list" "slist" "deque" "vector" "bit_vector" "set" "multiset" "map" "multimap" "hash\\(_\\(m\\(ap\\|ulti\\(map\\|set\\)\\)\\|set\\)\\)?" "stack" "queue" "priority_queue" "type_info" "iterator" "const_iterator" "reverse_iterator" "const_reverse_iterator" "reference" "const_reference" "u_?\\(int\\|long\\|short\\|char\\)"))
 '(c-default-style
   '((c-mode . "cc-mode")
     (c++-mode . "cc-mode")
     (java-mode . "java")))
 '(c-echo-syntactic-information-p t)
 '(c-font-lock-extra-types
   '("FILE" "\\sw+_t" "Lisp_Object" "u_?\\(int\\|long\\|short\\|char\\)"))
 '(c-offsets-alist
   '((inline-open . 0)
     (member-init-cont . c-lineup-multi-inher)
     (substatement-open . +)
     (case-label . 0)))
 '(c-tab-always-indent nil)
 '(comint-scroll-to-bottom-on-input t)
 '(default-frame-alist
    '((foreground-color . "white")
      (background-color . "gray16")
      (cursor-color . "red")
      (mouse-color . "red")))
 '(dired-listing-switches "-al")
 '(dired-recursive-copies t)
 '(fill-column 86)
 '(gdb-many-windows t)
 '(generic-define-mswindows-modes t)
 '(global-auto-revert-mode t nil (autorevert))
 '(grep-find-command
   '("find . -type d -name '.[a-z]*' -prune -o -type f -exec grep --color -nH --null -e  '{}' +" . 83))
 '(initial-major-mode 'text-mode)
 '(ls-lisp-verbosity nil)
 '(package-selected-packages '(web-mode markdown-mode markdonw-mode))
 '(revert-without-query '(".log$"))
 '(same-window-regexps '("*shell*" "*Buffer List*"))
 '(scroll-step 1)
 '(skk-egg-like-newline t)
 '(speedbar-show-unknown-files t)
 '(tab-width 8)
 '(tags-case-fold-search nil)
 '(tool-bar-mode nil)
 '(tooltip-mode nil nil (tooltip))
 '(truncate-lines nil)
 '(woman-fill-frame t))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(ediff-even-diff-A ((t (:extend t :background "dim grey"))))
 '(ediff-even-diff-Ancestor ((t (:extend t :background "grey30"))))
 '(ediff-even-diff-B ((t (:extend t :background "dim grey"))))
 '(ediff-even-diff-C ((t (:extend t :background "dim grey"))))
 '(ediff-even-diff-face-Ancestor ((((class color)) (:background "Grey" :foreground "Blue"))))
 '(ediff-even-diff-face-B ((((class color)) (:background "Grey" :foreground "Blue"))))
 '(ediff-odd-diff-A ((t (:extend t :background "Grey50"))))
 '(ediff-odd-diff-B ((t (:extend t :background "Grey50"))))
 '(ediff-odd-diff-C ((t (:extend t :background "Grey50"))))
 '(ediff-odd-diff-face-A ((((class color)) (:background "Grey" :foreground "Blue"))))
 '(ediff-odd-diff-face-C ((((class color)) (:background "Grey" :foreground "Blue"))))
 '(escape-glyph ((t (:foreground "DeepSkyBlue4"))))
 '(font-lock-comment-face ((t (:foreground "chartreuse2"))))
 '(font-lock-doc-face ((t (:foreground "gray"))))
 '(font-lock-function-name-face ((nil (:foreground "lightblue"))))
 '(font-lock-keyword-face ((t (:foreground "DodgerBlue"))))
 '(font-lock-string-face ((t (:foreground "peru"))))
 '(nxml-element-local-name ((t (:foreground "lightblue")))))

(put 'narrow-to-region 'disabled nil)