我有一個TODO文件,我可以在90%的時間內加載emacs。當我加載emacs雖然它默認加載臨時緩衝區。我希望它最初加載TODO文件。我對Emacs非常陌生,並且嘗試過使用.emacs文件搜索方法,但目前爲止沒有任何工作。如何將文件加載到緩衝區並在Emacs啓動時切換到緩衝區
這裏是我的嘗試:
1:使用查找文件獲取文件,並切換到緩衝器將其加載到屏幕
(switch-to-buffer (find-file "c:/Users/Seb/Documents/Emacs/TODO_List.org"))
2:使用彈出到緩衝器加載該文件,而不是
(pop-to-buffer (find-file "c:/Users/Seb/Documents/Emacs/TODO_List.org"))
3:所以它加載下一次保存在桌面
(desktop-save-mode 1)
這些都不起作用。
這是我完整的.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.
; '(inhibit-startup-buffer-menu t)
'(inhibit-startup-screen t)
'(initial-buffer-choice 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.
)
;; Set the current directory to the Emacs Documents dir
(cd "C:/Users/Seb/Documents/Emacs")
;; Open TODO list on start up
(pop-to-buffer (find-file "c:/Users/Seb/Documents/Emacs/TODO_List.org"))
;; Turn off the annoying tool bar at startup - to turn back on
;; just type M-x tool-bar-mode
(tool-bar-mode -1)
;; Move the mouse when cursor is near
(mouse-avoidance-mode 'cat-and-mouse)
;; This enables saving the current desktop on shutdown.
(desktop-save-mode 1)
;; XML Pretty Print
(defun xml-pretty-print (begin end)
"Pretty format XML markup in region. You need to have nxml-mode
http://www.emacswiki.org/cgi-bin/wiki/NxmlMode installed to do
this. The function inserts linebreaks to separate tags that have
nothing but whitespace between them. It then indents the markup
by using nxml's indentation rules."
(interactive "r")
(save-excursion
(nxml-mode)
(goto-char begin)
(while (search-forward-regexp "\>[ \\t]*\<" nil t)
(backward-char) (insert "\n"))
(indent-region begin end))
(message "Ah, much better!"))
[+1]非常好的問題,它沒有得到應有的重視。歡呼聲 – rath