x86_64) 経由でインストールする。
rosetta2 のターミナル (uname -m の出力が x86_64 となる状態)で以下のコマンドを実行する。% arch -x86_64 /bin/zsh (x86_64)% brew install --cask emacs

/Applications/Emacs.app/Contents/MacOS/Emacs にインストールされる。

「システム環境」->「セキュリティとプライバシー」 ->「一般」の下から「ダウンロードしたアプリケーションの実行許可」 -> "Emacs.app" は開発元を確認できないため、使用がブロックされました。 -> 「このまま開く」





/usr/bin/ruby に「フルディスクアクセス権限」を与える必要がある。
macOS Mojave (10.14, 2018年9月リリース) 以降では、
プロセスが ~/Documents/ や ~/Downloads/ の下にアクセスしようとすると制限がかかる。
Emacs は ruby スクリプトから起動されるので、ruby コマンドに
~/Documents/ や ~/Downloads/ へのアクセスを許可すると、
Emacsが ~/Documents や ~/Downloads 下にアクセスできるようになる。
「システム環境」->「セキュリティとプライバシー」->「プライバシー」 ->「下の鍵のマーク」->「パスワード入力」 ->「フルディスクアクセス」を選択してから「+」 -> 「フォルダの選択肢ウィンドウ」が表示される -> 上のバーで「Macintosh HD」を選択してから、Command + Shift + "." で隠しファイルも表示する。 -> /usr/bin/ruby を選ぶ。





Command + Shift + .(dot) を同時に押すと、隠しファイルも表示されるようになるので /usr/bin/ruby を選択する。
ruby が追加される。

~/.emacs を用意する。(一例を示す)。| ~/.emacs |
(setq default-input-method "japanese")
(setq require-final-new-line t)
(setq backup-by-copying-when-linked t)
(global-set-key "\C-xG" 'goto-line)
(setq inhibit-startup-message t)
(setq initial-scratch-message "")
(cond ((eq window-system 'x)
(define-key function-key-map [delete] [8])
(put 'delete 'ascii-character 8)
(load "term/keyswap"))
(t
(keyboard-translate ?\C-h ?\C-?)))
(defun delete-other-frames ()
(interactive)
(while (not (equal (next-frame (selected-frame)) (selected-frame)))
(delete-frame (next-frame (selected-frame)))))
(global-set-key "\C-x51" 'delete-other-frames)
(defun load-safely (f)
(if (file-readable-p f) (load f)))
(load-safely (expand-file-name "~/.mew.el"))
;; package.el
(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/"))
(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/"))
(package-initialize)
(global-set-key "\C-h" 'backward-delete-char-untabify)
;(mac-add-ignore-shortcut '(ctl ? ))
(setq home-dir (concat "/Users/" (user-login-name)))
(setq abbreviated-home-dir (concat home-dir "\\(/\\|$\\)"))
(setenv "HOME" home-dir)
(cd home-dir)
(setq load-path (cons (expand-file-name "~/.emacs.d/lisp/") load-path))
;;; Helpers for building regexps.
(defmacro c-paren-re (re)
`(concat "\\(" ,re "\\)"))
(defmacro c-identifier-re (re)
`(concat "\\[^_]"))
(autoload 'csharp-mode "csharp-mode.elc" "C# mode" t)
(add-to-list 'auto-mode-alist '("\\.cs\\'" . csharp-mode))
(defun my-csharp-mode-hook ()
;; enable the stuff you want for C# here
(electric-pair-mode 1))
(add-hook 'csharp-mode-hook 'my-csharp-mode-hook)
(setq csharp-want-imenu nil)
(defun my-c-c++-mode-init() (setq c-basic-offset 2))
(add-hook 'c-mode-hook 'my-c-c++-mode-init)
(add-hook 'c++-mode-hook 'my-c-c++-mode-init)
(add-hook 'csharp-mode-hook 'my-c-c++-mode-init)
(add-hook 'python-mode-hook
(lambda ()
(setq indent-tabs-mode nil)
(setq python-indent 2)))
;; Edit with Emacs on Google Chrome
(add-to-list 'load-path "~/.emacs.d/elpa")
;(when (and (daemonp) (locate-library "edit-server"))
; (require 'edit-server nil t)
; (edit-server-start))
(when (locate-library "edit-server")
(require 'edit-server nil t)
(edit-server-start))
(put 'upcase-region 'disabled nil)
(put 'downcase-region 'disabled 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.
'(package-selected-packages (quote (csharp-mode mew edit-server))))
(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.
)
;; shell
(add-hook 'shell-mode-hook
(lambda ()
(set-buffer-process-coding-system 'utf-8-unix 'utf-8-unix)
))
(defun my-comint-init ()
(setq comint-process-echoes t))
(add-hook 'comint-mode-hook 'my-comint-init)
|
C# 用の環境を用意する。~/.emacs.d/lisp/csharp-mode{,-tests}.el{,c}