Emacs:文件名的Tab补全会附加额外的i:\cygwin

3
我在emacs中遇到了一些奇怪的文件名自动补全行为。使用C-x C-f查找文件会在迷你缓冲区中打开i:/cygwin/home/rrajagop/StockScreener/working_copy/master_repo/stock_screener/。按下TAB键后,它变成了i:/cygwini:/cygwin/home/rrajagop/StockScreener/working_copy/master_repo/stock_screener/。我注意到了几件有趣的事情:
  1. 当迷你缓冲区打开时,i:/cygwin会变灰,路径似乎从/home开始。按下C-a(移到行首)会将我带到/home而不是i:/cygwin。因此,看起来emacs中的某些内容正在解析路径以从/home而不是i:/cygwin开始。
  2. 我检查了TAB键运行minibuffer.el中的minibuffer-complete(通过对TAB键进行describe-key),因此看起来minibuffer-complete正在为cygwin执行某些翻译并附加额外的i:/cygwin。
我该如何找出原因并解决这个问题?
编辑:额外信息 我尝试使用-Q选项打开emacs,这个问题就不会发生。所以这是我在我的.emacs中加载的某些内容。以下是我在我的.emacs中的内容:
(require 'cl)

; Needed to see how fast Emacs loads. Loading time is printed at the 
; and of the execution of .emacs file.
(defvar *emacs-load-start* (current-time))

; I really like this font. I also tried Monaco which you can
; see on lot of Railscasts but I couldn't find the one which
; supports Serbian Cyrillic and Latin letters.
(set-default-font "-outline-Courier New-normal-r-normal-normal-19-142-96-96-c-*-iso8859-1")

;; Don't show that splash screen
(setq inhibit-startup-message t)

; This should allegedly speed up Emacs starting by preventing
; some requests from the window manager back to the Emacs. Frankly
; speaking I didn't notice some speed up but I still keep it:(
(modify-frame-parameters nil '((wait-for-wm . nil)))

;Allows syntax highlighting to work, among other things
(global-font-lock-mode 1)

; Sets initial window position
(set-frame-position (selected-frame) 0 0)

; Sets initial window size to 85 columns and 47 rows
(set-frame-size (selected-frame) 88 32)

; Makes last line ends in carriage return
(setq requre-final-newline t)

; Sets Ctrl-x / key combination for easy commenting
; out of selected lines.
(global-set-key "\C-x/" 'comment-or-uncomment-region)

; Allow resizing of the mini-buffer when necessary
(setq resize-minibuffer-mode t)

; Auto magically read compressed files
(auto-compression-mode 1)

; Set standard indent to 2 rather then 4
(setq standard-indent 2)

; This tells Emacs to create backup files.
(setq make-backup-files t)

; And this will enable versioning with default values.
(setq version-control t)

; Remove annoying message about deleting excess backup of .recentf
; which is list of recent files used 
(setq delete-old-versions t)

; Finally do not spread backups all over the disk.
; Just save all backup files in this directory.
(setq backup-directory-alist (quote ((".*" . "~/.emacs_backups/"))))

;; Directory to put various el files.
(add-to-list 'load-path "~/.emacs.d/includes")

(require 'ascii-table)

;; Loading collection of generic modes for different languages
(require 'generic-x)

;; Recent files
(require 'recentf)
(recentf-mode 1)

;; Loads ruby mode when a ruby file is opened.
(autoload 'ruby-mode "ruby-mode" "Major mode for editing ruby scripts." t)
(setq auto-mode-alist (cons '(".rb$" . ruby-mode) auto-mode-alist))
(setq auto-mode-alist (cons '(".rhtml$" . html-mode) auto-mode-alist))
(setq auto-mode-alist (cons '(".html.erb$" . html-mode) auto-mode-alist))

;; Turn on ruby electric (auto completion of parenthesis, etc.)
(add-hook 'ruby-mode-hook
      (lambda()
        (add-hook 'local-write-file-hooks
              '(lambda()
             (save-excursion
               (untabify (point-min) (point-max))
               (delete-trailing-whitespace) )))
        (set (make-local-variable 'indent-tabs-mode) 'nil)
        (set (make-local-variable 'tab-width) 2)
        (imenu-add-to-menubar "IMENU")
        (define-key ruby-mode-map "\C-m" 'newline-and-indent)
        (require 'ruby-electric)
        (ruby-electric-mode t) ))

;; Ruby debugging.
(add-to-list 'load-path "~/.emacs.d/plugins/rdebug")
(autoload 'rdebug "rdebug" "Ruby debugging support." t)
(global-set-key [f9] 'gud-step)
(global-set-key [f10] 'gud-next)
(global-set-key [f11] 'gud-cont)
(global-set-key "\C-c\C-d" 'rdebug)


;; set compile command based on current major mode
(autoload 'mode-compile "mode-compile"
"Command to compile current buffer file based on the major mode" t)
(global-set-key "\C-cc" 'mode-compile)
(autoload 'mode-compile-kill "mode-compile"
"Command to kill a compilation launched by `mode-compile'" t)
(global-set-key "\C-ck" 'mode-compile-kill)

;; yasnippet - adding code snippet insertion
(add-to-list 'load-path "~/.emacs.d/plugins/yasnippet")
(require 'yasnippet) ;; not yasnippet-bundle
(yas/initialize)
(yas/load-directory "~/.emacs.d/plugins/yasnippet/snippets")

;; Use CYGWIN bash
(require 'setup-cygwin)

;; Subversion integration via psvn - not gonna use svn anymore
;; (require 'psvn)


;; add some elisp tutorials to the info directory
(let ((info-root (concat usb-drive-letter "cygwin/usr/local/bin/emacs/info/")))
  (setq Info-directory-list (list info-root 
                  (concat info-root "elisp-tutorial-2.04/") 
                  (concat info-root "emacs-lisp-intro-2.14")) ) 
)

;; Load time for .emacs - this should be the last line in .emacs for accurate load time
(message "ido and org-install took: %ds" 
     (destructuring-bind (hi lo ms) (current-time)
       (- (+ hi lo) (+ (first *emacs-load-start*) (second *emacs-load-start*)) )))

在 .emacs 文件中注释掉 (require 'setup-cygwin) 似乎可以解决这个问题。我还注意到,在此问题首次出现之前,会有一条消息“loading tramp... done”。 - Rohith
http://starks-browning.com/david/tramp/ 似乎表明 tramp 不兼容 cygwin-mount。我有 cygwin-mount。如果我必须在 tramp 和 cygwin-mount 之间选择,我会选择 cygwin-mount。所以现在我需要弄清楚是什么在加载 tramp,以及如何删除它 - 希望因为不加载 tramp 而没有出现任何故障。 - Rohith
经过更多的故障排除,我最终决定从我的计算机中彻底删除与tramp相关的el和elc文件(是的,非常激烈!),但问题仍然存在!现在我认为这是minibuffer-complete和cygwin之间某种交互的结果 - 因为没有cygwin-mount和setup-cygwin,问题似乎会消失。 - Rohith
3个回答

0

文件名影子模式会使文件名中的c:变灰......因此,当cygwin-mount-substitute-longest-mount-name运行时,它看不到c:并添加另一个

M-x查找文件

c:/home/
> a
c:/home/a            ; but the c: is greyed
> TAB   
c:c:/home/anything  

0

你可以通过改变变量tramp-mode来控制tramp。

顺便说一下,你可能会发现使用customize来自定义emacs很有用。 我使用customize-apropostramp进行了搜索,找到了tramp组。点击那里显示了所有配置tramp的方法,包括关闭它。


0

是的,这很有帮助。我最终将其缩小到文件名影子模式。禁用文件名影子模式可以解决此问题。不仅如此,我还从您和弗里德里希那里学到了一些调试未来emacs和elisp问题的技巧,因此非常感谢! - Rohith

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接