2014-10-10 46 views
3

當他的名字我部分記憶功能搜索,我用C-H˚F調用describe-function,進入*part-of-function-name,並創下TAB。但是我現在意識到這個搜索不區分大小寫。如何使描述功能「C-H F」不區分大小寫的默認

例如:

章˚FinfoTAB

列出了所有的功能開始info,但不包括那些開始Info,而

章˚FInfoTAB

列出了以Info開頭的所有功能,但不包括那些以info開頭的功能。

又如:

C-H˚F*nfcTAB

給我*nfc [No match],而

C-H˚F*NFCTAB

給我ucs-normalize-HFS-NFC-region

默認情況下,我如何使describe-function不區分大小寫,在我的​​文件中使用某些配置?

回答

1

(setq completion-ignore-case t)應該做你想要的,全球而不僅僅是C-h f

1

這是我用來代替describe-function的自定義函數。 它使用ido完成。

(defvar functions-cache nil) 
;;;###autoload 
(defun refresh-functions-cache() 
    (interactive) 
    (setq functions-cache nil) 
    (mapatoms (lambda (symbol) 
       (when (fboundp symbol) 
       (push (symbol-name symbol) functions-cache)))) 
    (setq functions-cache (sort functions-cache #'string<))) 

;;;###autoload 
(defun describe-function-ex (function) 
    "Display the full documentation of FUNCTION (a symbol)." 
    (interactive 
    (let ((fn (function-called-at-point)) 
     (enable-recursive-minibuffers t) 
     val) 
    (unless functions-cache 
     (refresh-functions-cache)) 
    (setq val (ido-completing-read 
       (if fn 
        (format "Describe function (default %s): " fn) 
        "Describe function: ") 
       functions-cache 
       nil t nil nil 
       (and fn (symbol-name fn)))) 
    (list (if (equal val "") 
       fn (intern val))))) 
    (if (null function) 
     (message "You didn't specify a function") 
    (help-setup-xref (list #'describe-function function) 
        (called-interactively-p 'interactive)) 
    (save-excursion 
     (with-help-window (help-buffer) 
     (prin1 function) 
     (princ " is ") 
     (describe-function-1 function) 
     (with-current-buffer standard-output 
      ;; Return the text we displayed. 
      (buffer-string)))))) 
3

添加綁定的completion-ignore-casetinteractive規範的命令。這具有以下優點:(a)僅影響describe-functionC-h f);(b)您可以輕鬆地打開/關閉它(與任何Emacs建議一樣)。

(defadvice describe-function (before ignore-case activate) 
    "Make it case-insensitive." 
    (interactive 
    (let ((completion-ignore-case  t) ; <============= ADDED BINDING 
     (fn       (function-called-at-point)) 
     (enable-recursive-minibuffers t) 
     val) 
    (setq val (completing-read 
       (if fn 
        (format "Describe function (default %s): " fn) 
        "Describe function: ") 
       obarray 'fboundp t nil nil (and fn (symbol-name fn)))) 
    (list (if (equal val "") fn (intern val))))))