Как установить рабочий каталог по умолчанию в Emacs - устранение неполадок
Я знаю, что это было опубликовано много раз, но решения не работают для меня. Я попробовал следующие решения из этого поста (Изменение папки по умолчанию в Emacs):
Решение 1: Добавить(cd "C:/Users/Name/Desktop")
к.emacs
файлРешение 2: Добавить(setq default-directory "C:/Documents and Settings/USER NAME/Desktop/" )
к.emacs
файлРешение 3: Щелкните правой кнопкой мыши по ярлыку emacs, выберите «Свойства» и измените поле начала в желаемом каталогеи только решение 3 работает. К сожалению, мне нужно использовать решение 1 или 2.
Я считаю, что мой.emacs
файл правильный, потому что моя тема корректно загружается / выгружается при добавлении / удалении(load-theme 'light-blue t)
из.emacs
файл.
Вот мой самый последний.emacs
файл:
(message "Default Dir: %S" default-directory)
(setq-default default-directory "C:/Users/Lucas/")
(message "Default Dir: %S" default-directory)
(setq-default indent-tabs-mode nil)
(add-hook 'ruby-mode-hook
(lambda ()
(define-key ruby-mode-map "\C-c#" 'comment-or-uncomment-region)
)
)
(defadvice comment-or-uncomment-region (before slick-comment activate compile)
"When called interactively with no active region, comment a single line instead."
(interactive
(if mark-active (list (region-beginning) (region-end))
(list (line-beginning-position)
(line-beginning-position 2)))))
(load-theme 'light-blue t)
;setq default-directory "~/")
(setq-default default-directory "C:/Users/Lucas/")
(defun xp-read-file-name (prompt &optional dir default-filename mustmatch initial predicate)
(setq last-nonmenu-event nil)
(funcall (or read-file-name-function #'read-file-name-default)
prompt dir default-filename mustmatch initial predicate))
(defun xp-save-as (filename &optional confirm)
(interactive
(list (if buffer-file-name
(xp-read-file-name "Write file: " nil nil nil nil)
(xp-read-file-name "Write file: " "C:/Users/Lucas/"
(expand-file-name
(file-name-nondirectory (buffer-name))
"C:/Users/Lucas/")
nil nil))
(not current-prefix-arg)))
(or (null filename) (string-equal filename "")
(progn
(if (file-directory-p filename)
(setq filename (concat (file-name-as-directory filename)
(file-name-nondirectory
(or buffer-file-name (buffer-name))))))
(and confirm
(file-exists-p filename)
(not (and (eq (framep-on-display) 'ns)
(listp last-nonmenu-event)
use-dialog-box))
(or (y-or-n-p (format "File `%s' exists; overwrite? " filename))
(error "Canceled")))
(set-visited-file-name filename (not confirm))))
(set-buffer-modified-p t)
(and buffer-file-name
(file-writable-p buffer-file-name)
(setq buffer-read-only nil))
(save-buffer)
(vc-find-file-hook))
(defun comment-or-uncomment-region-or-line ()
"Comments or uncomments the region or the current line if there's no active region."
(interactive)
(let (beg end)
(if (region-active-p)
(setq beg (region-beginning) end (region-end))
(setq beg (line-beginning-position) end (line-end-position)))
(comment-or-uncomment-region beg end)
(next-line)))
(global-set-key (kbd "C-x C-;") 'comment-region)
(setq lazy-highlight-cleanup nil)
(message "Default Dir: %S" default-directory)
мойemacs.exe
сохраняется вC:\emacs\emacs-24.3\bin
(который также является моим каталогом по умолчанию, но я хочу изменить его наC:/Users/Lucas/
), и мой.emacs
находится под моим домом -C:\Users\Lucas
.
ОБНОВИТЬ
Я недавно узнал, что моя команда(setq-default default-directory "C:/Users/Lucas/")
, который должен установить мойdefault-directory
не выполняет. Сразу после запуска это мой*Messages*
буфер:
Default Dir: "C:\\emacs\\emacs-24.3\\bin/" [3 times]
For information about GNU Emacs and the GNU system, type C-h C-a.
Он ведет себя так, как будто я переопределяю.emacs
файл. Я дважды / трижды проверил, и я не могу найти другой.emacs
на моем пути. Кроме того, я не запускаю Emacs с ярлыка. Мы ценим любые предложения. Спасибо за всю поддержку.