Emacs : 시작시 마지막 세션에서 버퍼를 다시여시겠습니까?
매일 emacs를 시작하고 전날 열었던 것과 똑같은 파일을 엽니 다. 내가 마지막으로 emacs를 종료 할 때 사용했던 모든 버퍼를 다시 열 수 있도록 init.el 파일에 추가 할 수있는 것이 있습니까?
Emacs Desktop 라이브러리를 사용할 수 있습니다 .
Mx desktop-save 명령을 사용하여 데스크탑을 수동으로 저장할 수 있습니다. Emacs를 종료 할 때 데스크탑의 자동 저장을 활성화하고 Emacs가 시작될 때 마지막으로 저장된 데스크탑의 자동 복원을 활성화 할 수 있습니다. 사용자 정의 버퍼 (쉬운 사용자 정의 참조)를 사용하여 향후 세션을 위해 데스크탑 저장 모드를 t로 설정하거나 ~ / .emacs 파일의 다음 줄 :
(desktop-save-mode 1)
질문이 emacs "데스크톱"기능을 찾고 있다고 생각하지만 (위 답변 참조) Lewap의 접근 방식은 실제로 사용하는 파일 세트가 정확히 동일한 파일 세트 인 경우 유용 할 수 있습니다. 사실, 한 단계 더 나아가 정기적으로 사용되는 파일 세트가 다른 경우 '프로필'을 정의 할 수 있습니다. Quickie 예제 :
(let ((profile
(read-from-minibuffer "Choose a profile (acad,dist,lisp,comp,rpg): ")
))
(cond
((string-match "acad" profile)
(dired "/home/thomp/acad")
(dired "/home/thomp/acad/papers")
)
((string-match "lisp" profile)
(setup-slime)
(lisp-miscellany)
(open-lisp-dirs)
)
((string-match "rpg" profile)
(find-file "/home/thomp/comp/lisp/rp-geneval/README")
(dired "/home/thomp/comp/lisp/rp-geneval/rp-geneval")
... etc.
작업 할 때 정기적으로 사용되는 여러 파일 세트간에 정기적으로 전환하는 경우 Perspective를 사용 하고 각 Perspective를 정기적으로 사용되는 원하는 파일 세트로 채우는 것을 고려 하십시오.
버퍼 / 탭 (특히 elscreen 탭) 저장 / 복원 : elscreen을 사용하고 데스크톱 세션 및 elscreen 탭 구성의 저장 / 복원을 관리하는 방법은 .emacs 파일의 다음 코드입니다 (사용 된 이름은 자명합니다 저장 / 복원 기능이 emacs가 시작될 때마다 실행되지 않아야한다면 "(push # 'elscreen-store kill-emacs-hook)"및 "(elscreen-restore)") 줄을 주석 처리하면됩니다.
(defvar emacs-configuration-directory
"~/.emacs.d/"
"The directory where the emacs configuration files are stored.")
(defvar elscreen-tab-configuration-store-filename
(concat emacs-configuration-directory ".elscreen")
"The file where the elscreen tab configuration is stored.")
(defun elscreen-store ()
"Store the elscreen tab configuration."
(interactive)
(if (desktop-save emacs-configuration-directory)
(with-temp-file elscreen-tab-configuration-store-filename
(insert (prin1-to-string (elscreen-get-screen-to-name-alist))))))
(push #'elscreen-store kill-emacs-hook)
(defun elscreen-restore ()
"Restore the elscreen tab configuration."
(interactive)
(if (desktop-read)
(let ((screens (reverse
(read
(with-temp-buffer
(insert-file-contents elscreen-tab-configuration-store-filename)
(buffer-string))))))
(while screens
(setq screen (car (car screens)))
(setq buffers (split-string (cdr (car screens)) ":"))
(if (eq screen 0)
(switch-to-buffer (car buffers))
(elscreen-find-and-goto-by-buffer (car buffers) t t))
(while (cdr buffers)
(switch-to-buffer-other-window (car (cdr buffers)))
(setq buffers (cdr buffers)))
(setq screens (cdr screens))))))
(elscreen-restore)
기본 데스크탑 기능을 개선 할 수있는 유용한 기능이 있습니다. 특히 편리한 (IMO)는 세션 중에 데스크탑을 자동 저장하는 방법입니다. 그렇지 않으면 시스템이 충돌하면 해당 세션을 시작한 데스크탑 파일이 멈출 것입니다 .Emacs를 여러 번 실행하는 경향이 있다면 꽤 짜증납니다. 한 번에 며칠.
http://www.emacswiki.org/emacs/DeskTop
The wiki also has useful information about persisting data between sessions in general:
http://www.emacswiki.org/emacs/SessionManagement
For desktops specifically, I thought that Desktop Recover looked particularly promising, however I've not yet tried it out.
You can open files in your .emacs file by using the following function:
(find-file "/home/me/path-to-file")
(find-file-noselect "/my/file")
will open it silently, ie w/o raising the buffer. Just saying.
EDIT This command is not interactive ; To test it you have to evaluate the expression, for example by positioning the cursor after the last parenthesis and hitting C-x C-e
Downvoting this is not cool ; this command definitely works and is in the scope of the question.
참고URL : https://stackoverflow.com/questions/803812/emacs-reopen-buffers-from-last-session-on-startup
'Program Tip' 카테고리의 다른 글
Collections.sort는 Mergesort를 사용하지만 Arrays.sort는 사용하지 않는 이유는 무엇입니까? (0) | 2020.10.05 |
---|---|
심볼 테이블이란? (0) | 2020.10.05 |
임의의 스칼라 코드 위치 동안 인터프리터에 드롭 (0) | 2020.10.05 |
Java 용 Fake File System 프레임 워크가 있습니까? (0) | 2020.10.05 |
진행률 표시 줄의 숫자는 Spark-shell에서 무엇을 의미합니까? (0) | 2020.10.05 |