2016-09-06 29 views
1

我一直在考慮在我的emacs配置文件中添加一些額外的功能。刪除尾部突出顯示[EMACS配置]

什麼我想擁有的是高亮匹配的括號,
但是使用mic-paren默認行爲只選擇光標後,關閉括號(這工作正常打開括號)。

看着this回答所需的功能幾乎可以實現,但餘輝會分散注意力。

;;; Will highlight when cursor on closing parenthesis, however leaves afterglow... 
(defadvice mic-paren-highlight (around cursorOnClosing activate) 
    "Dirty hack to highlight sexps with closing delim below cursor" 
    (if (eq (char-syntax (following-char)) ?\)) 
     (let ((paren-priority 'close)) 
     (save-excursion 
      (forward-char) 
      ad-do-it)) 
    ad-do-it)) 

任何更好的選擇,或一些更正,你可以讓我得到所需的行爲?在此先感謝

+0

'(show-paren-mode 1)'沒有做你想做的事嗎? – elethan

+0

剛剛檢查過'(show-paren-mode 1)'只有當光標位於關閉paren後面時才顯示匹配的parens,我試圖在光標位於頂端時使其工作。 – SerialDev

+1

好吧,我以爲那是你在說的,但我不確定。我可以問你爲什麼要這樣嗎?我認爲這樣做的原因是,你輸入一個關閉paren,然後你看到它匹配的開局paren。否則(除非你的父母是自動完成的 - 他們可能是),你將不得不鍵入一個關閉paren,然後向後移動光標看到行軍開幕paren。 – elethan

回答

0

對於任何人都不會遇到這一點,emacs 25.1 Released September 17, 2016

新版本從News文件:

In Show Paren Mode, a parenthesis can be highlighted when point 
stands inside it, and certain parens can be highlighted when point is 
at BOL or EOL, or in whitespace there. To enable these, customize, 
respectively, 'show-paren-when-point-inside-paren' or 
'show-paren-when-point-in-periphery'. 

所以爲了解決這個問題:

'show-paren-when-point-inside-paren'