728x90
반응형

레딧을 보다가 우연히 doom-emacs 라는 것을 알게 되었다.

 

그래서 찾아보니 스샷에서 한 번은 써봐야겠다는 생각이 들었다.

 

설치하는 방법은 각 OS 별로 상세하게 돼있어 이를 따라서 해봤다.

 

맥을 사용하고 있어 해당 부분을 찾아서 따라했다.

# 필수
$ brew install git ripgrep
# 선택
$ brew install coreutils fd
# clang 설치
$ xcode-select --install

Emacs는 별도로 받아 설치하여 환경 변수는 다음과 같이 설정했다.

$ export PATH="/Applications/Emacs.app/Contents/MacOS:$PATH"

그 다음에 git으로 코드를 받아 doom을 설치했다.

$ git clone https://github.com/hlissner/doom-emacs ~/.emacs.d
$ ~/.emacs.d/bin/doom install

설치를 하고 나면 .doom.d 디렉토리에 config.el, init.el, packages.el 이 생긴다.

 

init.el을 살펴보면 다음과 같이 돼있다.

;;; init.el -*- lexical-binding: t; -*-

;; This file controls what Doom modules are enabled and what order they load
;; in. Remember to run 'doom sync' after modifying it!

;; NOTE Press 'SPC h d h' (or 'C-h d h' for non-vim users) to access Doom's
;;      documentation. There you'll find a "Module Index" link where you'll find
;;      a comprehensive list of Doom's modules and what flags they support.

;; NOTE Move your cursor over a module's name (or its flags) and press 'K' (or
;;      'C-c c k' for non-vim users) to view its documentation. This works on
;;      flags as well (those symbols that start with a plus).
;;
;;      Alternatively, press 'gd' (or 'C-c c d') on a module to browse its
;;      directory (for easy access to its source code).

(doom! :input
       ;;chinese
       ;;japanese
       ;;layout            ; auie,ctsrnm is the superior home row

       :completion
       company           ; the ultimate code completion backend
       ;;helm              ; the *other* search engine for love and life
       ;;ido               ; the other *other* search engine...
       ivy               ; a search engine for love and life

       :ui
       ;;deft              ; notational velocity for Emacs
       doom              ; what makes DOOM look the way it does
       doom-dashboard    ; a nifty splash screen for Emacs
       doom-quit         ; DOOM quit-message prompts when you quit Emacs
       ;;(emoji +unicode)  ; 🙂
       ;;fill-column       ; a `fill-column' indicator
       hl-todo           ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW
       ;;hydra
       ;;indent-guides     ; highlighted indent columns
       ;;ligatures         ; ligatures and symbols to make your code pretty again
       ;;minimap           ; show a map of the code on the side
       modeline          ; snazzy, Atom-inspired modeline, plus API
       ;;nav-flash         ; blink cursor line after big motions
       ;;neotree           ; a project drawer, like NERDTree for vim
       ophints           ; highlight the region an operation acts on
       (popup +defaults)   ; tame sudden yet inevitable temporary windows
       ;;tabs              ; a tab bar for Emacs
       ;;treemacs          ; a project drawer, like neotree but cooler
       ;;unicode           ; extended unicode support for various languages
       vc-gutter         ; vcs diff in the fringe
       vi-tilde-fringe   ; fringe tildes to mark beyond EOB
       ;;window-select     ; visually switch windows
       workspaces        ; tab emulation, persistence & separate workspaces
       ;;zen               ; distraction-free coding or writing

       :editor
       (evil +everywhere); come to the dark side, we have cookies
       file-templates    ; auto-snippets for empty files
       fold              ; (nigh) universal code folding
       ;;(format +onsave)  ; automated prettiness
       ;;god               ; run Emacs commands without modifier keys
       ;;lispy             ; vim for lisp, for people who don't like vim
       ;;multiple-cursors  ; editing in many places at once
       ;;objed             ; text object editing for the innocent
       ;;parinfer          ; turn lisp into python, sort of
       ;;rotate-text       ; cycle region at point between text candidates
       snippets          ; my elves. They type so I don't have to
       ;;word-wrap         ; soft wrapping with language-aware indent

       :emacs
       dired             ; making dired pretty [functional]
       electric          ; smarter, keyword-based electric-indent
       ;;ibuffer         ; interactive buffer management
       undo              ; persistent, smarter undo for your inevitable mistakes
       vc                ; version-control and Emacs, sitting in a tree

       :term
       ;;eshell            ; the elisp shell that works everywhere
       ;;shell             ; simple shell REPL for Emacs
       ;;term              ; basic terminal emulator for Emacs
       ;;vterm             ; the best terminal emulation in Emacs

       :checkers
       syntax              ; tasing you for every semicolon you forget
       ;;spell             ; tasing you for misspelling mispelling
       ;;grammar           ; tasing grammar mistake every you make

       :tools
       ;;ansible
       ;;debugger          ; FIXME stepping through code, to help you add bugs
       ;;direnv
       ;;docker
       ;;editorconfig      ; let someone else argue about tabs vs spaces
       ;;ein               ; tame Jupyter notebooks with emacs
       (eval +overlay)     ; run code, run (also, repls)
       ;;gist              ; interacting with github gists
       lookup              ; navigate your code and its documentation
       ;;lsp
       magit             ; a git porcelain for Emacs
       ;;make              ; run make tasks from Emacs
       ;;pass              ; password manager for nerds
       ;;pdf               ; pdf enhancements
       ;;prodigy           ; FIXME managing external services & code builders
       ;;rgb               ; creating color strings
       ;;taskrunner        ; taskrunner for all your projects
       ;;terraform         ; infrastructure as code
       ;;tmux              ; an API for interacting with tmux
       ;;upload            ; map local to remote projects via ssh/ftp

       :os
       (:if IS-MAC macos)  ; improve compatibility with macOS
       ;;tty               ; improve the terminal Emacs experience

       :lang
       ;;agda              ; types of types of types of types...
       ;;cc                ; C/C++/Obj-C madness
       ;;clojure           ; java with a lisp
       ;;common-lisp       ; if you've seen one lisp, you've seen them all
       ;;coq               ; proofs-as-programs
       ;;crystal           ; ruby at the speed of c
       ;;csharp            ; unity, .NET, and mono shenanigans
       ;;data              ; config/data formats
       ;;(dart +flutter)   ; paint ui and not much else
       ;;elixir            ; erlang done right
       ;;elm               ; care for a cup of TEA?
       emacs-lisp        ; drown in parentheses
       ;;erlang            ; an elegant language for a more civilized age
       ;;ess               ; emacs speaks statistics
       ;;faust             ; dsp, but you get to keep your soul
       ;;fsharp            ; ML stands for Microsoft's Language
       ;;fstar             ; (dependent) types and (monadic) effects and Z3
       ;;gdscript          ; the language you waited for
       ;;(go +lsp)         ; the hipster dialect
       ;;(haskell +dante)  ; a language that's lazier than I am
       ;;hy                ; readability of scheme w/ speed of python
       ;;idris             ; a language you can depend on
       ;;json              ; At least it ain't XML
       ;;(java +meghanada) ; the poster child for carpal tunnel syndrome
       ;;javascript        ; all(hope(abandon(ye(who(enter(here))))))
       ;;julia             ; a better, faster MATLAB
       ;;kotlin            ; a better, slicker Java(Script)
       ;;latex             ; writing papers in Emacs has never been so fun
       ;;lean
       ;;factor
       ;;ledger            ; an accounting system in Emacs
       ;;lua               ; one-based indices? one-based indices
       markdown          ; writing docs for people to ignore
       ;;nim               ; python + lisp at the speed of c
       ;;nix               ; I hereby declare "nix geht mehr!"
       ;;ocaml             ; an objective camel
       org               ; organize your plain life in plain text
       ;;php               ; perl's insecure younger brother
       ;;plantuml          ; diagrams for confusing people more
       ;;purescript        ; javascript, but functional
       ;;python            ; beautiful is better than ugly
       ;;qt                ; the 'cutest' gui framework ever
       ;;racket            ; a DSL for DSLs
       ;;raku              ; the artist formerly known as perl6
       ;;rest              ; Emacs as a REST client
       ;;rst               ; ReST in peace
       ;;(ruby +rails)     ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"}
       ;;rust              ; Fe2O3.unwrap().unwrap().unwrap().unwrap()
       ;;scala             ; java, but good
       ;;scheme            ; a fully conniving family of lisps
       sh                ; she sells {ba,z,fi}sh shells on the C xor
       ;;sml
       ;;solidity          ; do you need a blockchain? No.
       ;;swift             ; who asked for emoji variables?
       ;;terra             ; Earth and Moon in alignment for performance.
       ;;web               ; the tubes
       ;;yaml              ; JSON, but readable

       :email
       ;;(mu4e +gmail)
       ;;notmuch
       ;;(wanderlust +gmail)

       :app
       ;;calendar
       ;;irc               ; how neckbeards socialize
       ;;(rss +org)        ; emacs as an RSS reader
       ;;twitter           ; twitter client https://twitter.com/vnought

       :config
       ;;literate
       (default +bindings +smartparens))

이 중에서 필요한 부분의 주석을 풀고 다음과 같이 하면 설치된다.

~/.emacs.d/bin/doom sync

최초 설치한 다음 실행하면 vim-mode 로 열리는데 (evil +everywhere) 를 주석하여 비활성화할 수 있다.

 

참고 문헌

  1. github.com/hlissner/doom-emacs

  2. github.com/hlissner/doom-emacs/blob/develop/docs/getting_started.org#on-macos

반응형
728x90
반응형

Emacs에서 magit을 사용하여 github를 이용하고 있는데 github의 다른 기능들도 사용하고 싶어졌다.

 

특히 이슈를 등록하거나 보는 것을 하고 싶어 찾아보니 magithub라는 것이 있었다.

 

.authinfo.authinfo.gpg를 사용하여 인증을 하는데

 

.authinfo의 경우 평문으로 돼있어 보안을 생각하면 .authinfo.gpg를 사용하는 것이 좋다.

 

토큰은 github에서 만들고 .authinfo는 다음과 같이 만들면 된다.

machine api.github.com login YOUR_GITHUB_USERNAME^magithub password YOUR_GITHUB_TOKEN

그리고 이것을 Emacs에서 M-x > epa-encrypt-file.authinfo.gpg를 만들 수 있다.

 

macos에서 명령어가 없는 경우 brew install gpg로 설치하면 된다.

 

또는 이곳에서 운영 체제에 맞게 다운로드받아 설치하면 된다.

 

GPG key를 만들어서 github에 등록하는 것은 여기를 참고하면 된다.

 

.authinfo.gpg로 하려는 경우 다음과 같은 오류가 발생할 수 있다.

gpg: decryption failed: No secret key

이럴 때는 다음을 .emacsinit.el에 추가한 다음 eval-buffer를 하면 된다.

(setf epa-pinentry-mode 'loopback)

Gihub Enterprise에서 사용하는 것은 Github에서 하는 것과 같다.

 

그리고 각각의 클론한 디렉토리에서 다음을 입력하면 된다.

git config github.host github.enterpise.domain/api/v3

 

참고 문헌

  1. https://mrdias.com/2018/04/01/using-magit-with-github-enterprise.html

  2. https://emacs.stackexchange.com/questions/27841/unable-to-decrypt-gpg-file-using-emacs-but-command-line-gpg-works

반응형
728x90
반응형

시스템 환경설정 > 개인 정보 보호 > 전체 디스크 접근 권한에 Emacs 앱을 추가했지만

홈 디렉토리를 제외한 문서, 다운로드 등의 디렉토리 접근이 불가능했다.

 

이유는 Emacs가 ruby로 실행되기 때문이었다.

 

전체 디스크 접근 권한/usr/bin/ruby를 추가하면 모든 디렉토리에 접근할 수 있다.

Emacs is built on various versions of Mac OS X: 10.6, 10.7 and 10.9 as of this writing.
The 10.6 builds also build 32-bit and PowerPC binaries
(only Emacs 24 builds PowerPC—Emacs dropped support for it in Emacs 25).
The later OSes only build 64-bit builds.
All the binaries are combined into a single executable
and a small Ruby launcher chooses which binary to run
based on the machine's OS and architecture.

usr 디렉토리가 안보이는 경우 Command + Shift + .을 입력하면 숨겨진 디렉토리가 나온다.

 

참고 문헌

  1. https://emacs.stackexchange.com/questions/53026/how-to-restore-file-system-access-in-macos-catalina

  2. https://github.com/caldwell/build-emacs/blob/master/launch.rb

반응형
728x90
반응형

Sidecar 기능을 이용해보려고 Catalina로 업그레이드를 했다.

 

하지만 갖고 있는 기기인 iPad mini 4는 지원 대상이 아니었다.

 

그리고 Emacs도 사용하기가 살짝 까다로워졌다.

 

이유는 폴더 접근 권한 때문인데 Emacs에서 폴더 접근 권한을 줄 수 없어

 

특정 폴더의 파일들을 읽을 수 가 없었다.

 

문서 폴더에 workspace를 만들어서 사용하고 있는데 해당 폴더에 접근을 할 수 없었다.

 

이를 해결하기 위해 시스템 환경설정 > 보안 및 개인 정보 보호 > 개인 정보 보호 탭에서

 

전체 디스크 접근 권한을 허용했지만 접근을 할 수 없었다.1

 

그리고 어떤 분이 해결책이라고 올려준 fix-emacs-permissions-catalina.el를 해봤지만

 

마찬가지로 문서 폴더에 접근할 수 없었다.

 

그래서 이제 Emacs를 못쓰는 건가 하다가 XEmacs, Aquamacs를 설치해보기로 했다.

 

XEmacs는 버전이 좀 오래되기도 하고 Aquamacs가 좀더 유려해 보여 Aquamacs를 설치해보니

 

문서 폴더에도 접근이 잘 되어 Aquamacs를 사용하기로 결정했다.

 

기존에 사용하던 기능들 대부분을 쓸 수 있었지만 iedit을 더이상 쓸 수가 없었다.

 

왜냐면 iedit 기능을 시작할 때 C-;를 입력해야 하는데 해당 커맨드가

 

Option 키를 메타키로 지정/해제하는 커맨드로 돼있었기 때문이다.

 

그래서 multiple-cursors를 이용하여 iedit을 대체하여 사용하고 있다.

 

참고 문헌

  1. https://emacs.stackexchange.com/questions/53026/how-to-restore-file-system-access-in-macos-catalina

  2. https://gist.github.com/dive/f64c645a9086afce8e5dd2590071dbf9

  3. https://github.com/magnars/multiple-cursors.el

반응형

+ Recent posts