Char-fold quotation characters in *info* and *Help*
* lisp/info.el (Info-mode): * lisp/help-mode.el (help-mode): Use it. * lisp/isearch.el (isearch-fold-quotes-mode): New minor mode (bug#24510).
This commit is contained in:
parent
3b088bbed2
commit
16dc1d597b
4 changed files with 34 additions and 2 deletions
13
etc/NEWS
13
etc/NEWS
|
@ -136,6 +136,13 @@ of 'user-emacs-directory'.
|
|||
|
||||
* Incompatible changes in Emacs 29.1
|
||||
|
||||
---
|
||||
** Isearch in *Help* and *info* now char-folds quote characters by default.
|
||||
This means that you can say 'C-s `foo' (GRAVE ACCENT) if the buffer
|
||||
contains "‘foo" (LEFT SINGLE QUOTATION MARK) and the like. These
|
||||
quotation characters look somewhat similar in some fonts. To switch
|
||||
this off, disable the new 'isearch-fold-quotes-mode' minor mode.
|
||||
|
||||
---
|
||||
** Sorting commands no longer necessarily change modification status.
|
||||
In earlier Emacs versions, commands like 'M-x sort-lines' would always
|
||||
|
@ -1636,6 +1643,12 @@ functions.
|
|||
|
||||
* Lisp Changes in Emacs 29.1
|
||||
|
||||
---
|
||||
*** New minor mode 'isearch-fold-quotes-mode'.
|
||||
This sets up 'search-default-mode' so that quote characters are
|
||||
char-folded into each other. It is used, by default, in *Help* and
|
||||
*info* buffers.
|
||||
|
||||
+++
|
||||
** New macro 'buffer-local-set-state'.
|
||||
This is a helper macro to be used by minor modes that wish to restore
|
||||
|
|
|
@ -415,7 +415,8 @@ Commands:
|
|||
help-mode-tool-bar-map)
|
||||
(setq-local help-mode--current-data nil)
|
||||
(setq-local bookmark-make-record-function
|
||||
#'help-bookmark-make-record))
|
||||
#'help-bookmark-make-record)
|
||||
(isearch-fold-quotes-mode))
|
||||
|
||||
;;;###autoload
|
||||
(defun help-mode-setup ()
|
||||
|
|
|
@ -4490,7 +4490,8 @@ Advanced commands:
|
|||
(setq-local revert-buffer-function #'Info-revert-buffer-function)
|
||||
(setq-local font-lock-defaults '(Info-mode-font-lock-keywords t t))
|
||||
(Info-set-mode-line)
|
||||
(setq-local bookmark-make-record-function #'Info-bookmark-make-record))
|
||||
(setq-local bookmark-make-record-function #'Info-bookmark-make-record)
|
||||
(isearch-fold-quotes-mode))
|
||||
|
||||
;; When an Info buffer is killed, make sure the associated tags buffer
|
||||
;; is killed too.
|
||||
|
|
|
@ -4466,6 +4466,23 @@ CASE-FOLD non-nil means the search was case-insensitive."
|
|||
(isearch-search)
|
||||
(isearch-update))
|
||||
|
||||
|
||||
|
||||
(defvar isearch-fold-quotes-mode--state)
|
||||
(define-minor-mode isearch-fold-quotes-mode
|
||||
"Minor mode to aid searching for \\=` characters in help modes."
|
||||
:lighter ""
|
||||
(if isearch-fold-quotes-mode
|
||||
(setq-local isearch-fold-quotes-mode--state
|
||||
(buffer-local-set-state
|
||||
search-default-mode
|
||||
(lambda (string &optional _lax)
|
||||
(thread-last
|
||||
(regexp-quote string)
|
||||
(replace-regexp-in-string "`" "[`‘]")
|
||||
(replace-regexp-in-string "'" "['’]")))))
|
||||
(buffer-local-restore-state isearch-fold-quotes-mode--state)))
|
||||
|
||||
(provide 'isearch)
|
||||
|
||||
;;; isearch.el ends here
|
||||
|
|
Loading…
Add table
Reference in a new issue