commit 3fe9d865353d0b93130b2546b07337ea8d9e353f (HEAD, refs/remotes/origin/master) Author: Eli Zaretskii Date: Fri Nov 29 11:34:07 2019 +0200 Minor fix in 'vc-print-root-log's prompt for revision ID * lisp/vc/vc.el (vc-print-root-log): Remove text properties from the default revision suggestion. diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 5ac07e7889..132278e823 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2492,7 +2492,7 @@ with its diffs (if the underlying VCS supports that)." (interactive (cond ((eq current-prefix-arg 1) - (let* ((default (thing-at-point 'word)) + (let* ((default (thing-at-point 'word t)) (revision (read-string (if default (format "Revision to show (default %s): " default) commit cf715848d8dbc4474eabfa492f33065b4d6e2c71 Author: Eli Zaretskii Date: Fri Nov 29 11:30:43 2019 +0200 Support showing one revision with Bazaar * lisp/vc/vc-bzr.el (vc-bzr-print-log): Support 'with-diff' invocation of "C-1 C-x v L". diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el index 4c75eb79f1..dcf3323866 100644 --- a/lisp/vc/vc-bzr.el +++ b/lisp/vc/vc-bzr.el @@ -762,6 +762,7 @@ If LIMIT is non-nil, show no more than this many entries." ;; Is -c any different to -r in this case? "-r%s" "-r..%s") start-revision))) + (if (eq vc-log-view-type 'with-diff) (list "-p")) (when limit (list "-l" (format "%s" limit))) ;; There is no sensible way to combine --limit and --forward, ;; and it breaks the meaning of START-REVISION as the commit b20d7f2cda5257086d5bd10968d85266a3c91219 Author: Eli Zaretskii Date: Fri Nov 29 11:09:19 2019 +0200 Improve indexing of VC log commands * doc/emacs/maintaining.texi (VC Change Log): Add missing index entries. diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index 66fa54113f..4bda4c98c6 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -946,6 +946,7 @@ the file contents without distraction from the annotations. @node VC Change Log @subsection VC Change Log +@cindex VC change log @table @kbd @item C-x v l @@ -1008,6 +1009,10 @@ showing only the first line of each log entry. However, you can type @file{*vc-change-log*} buffer to reveal the entire log entry for the revision at point. A second @key{RET} hides it again. +@kindex C-x v I +@kindex C-x v O +@findex vc-log-incoming +@findex vc-log-outgoing On a decentralized version control system, the @kbd{C-x v I} (@code{vc-log-incoming}) command displays a log buffer showing the changes that will be applied, the next time you run the version @@ -1020,6 +1025,8 @@ specific repository. Similarly, @kbd{C-x v O} another repository, the next time you run the push command; with a prefix argument, it prompts for a specific destination repository. +@cindex VC log buffer, commands in +@cindex vc-log buffer In the @file{*vc-change-log*} buffer, you can use the following keys to move between the logs of revisions and of files, and to examine and compare past revisions (@pxref{Old Revisions}): commit 6e41b08ea877af91908abaf164a9a00cb82cafa9 Author: Eli Zaretskii Date: Fri Nov 29 11:03:55 2019 +0200 Improve documentation and UI of 'C-x v L' * lisp/vc/vc.el (vc-print-root-log): Improve the wording of the doc string and of the prompt for the root directory. * etc/NEWS: Improve and expand the wording of the changes in 'C-x v L'. * doc/emacs/maintaining.texi (VC Change Log): Improve and clarify wording of the 'C-x v L' description. diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index c1f7aed114..66fa54113f 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -993,8 +993,14 @@ version-controlled directory tree (RCS, SCCS, CVS, and SRC do not support this feature). With a prefix argument, the command prompts for the maximum number of revisions to display. A numeric prefix argument specifies the maximum number of revisions without prompting. -When the numeric prefix argument is @kbd{M-1}, the command prompts -for the revision ID, and displays its log entry with a diff of changes. +When the numeric prefix argument is 1, as in @w{@kbd{C-1 C-x v L}} or +@w{@kbd{C-u 1 C-x v L}}, the command prompts for the revision ID, and +displays the log entry of that revision together with the changes +(diffs) it introduced. (Some less capable version control systems, +such as RCS and CVS, don't have commands to show a revision log with +its diffs; for them the command displays only the log entry, and you +can request to show the diffs by typing @kbd{d} or @kbd{D}, see +below.) The @kbd{C-x v L} history is shown in a compact form, usually showing only the first line of each log entry. However, you can type diff --git a/etc/NEWS b/etc/NEWS index 688b3f85cb..57dbc9324a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -998,7 +998,12 @@ With a prefix argument asks for a command, so for example, just one log entry found by its revision number. +++ -*** 'C-1 C-x v L' asks for a revision and shows its log entry with diff. +*** It is now possible to display a specific revision given by its ID. +If you invoke 'C-x v L' ('vc-print-root-log') with a numeric argument +of 1, as in 'C-1 C-x v L' or 'C-u 1 C-x v L', it asks for a revision +ID, and shows its log entry together with the diffs introduced by the +revision's commit. (For some less capable VCSes, only the log entry +is shown.) *** 'C-x v =' can now mimic Magit's diff format. Set the new user option 'diff-font-lock-prettify' to t for that, see diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index d0d2c39ac3..5ac07e7889 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2481,13 +2481,14 @@ WORKING-REVISION and LIMIT." ;;;###autoload (defun vc-print-root-log (&optional limit revision) - "List the change log for the current VC controlled tree in a window. + "List the revision history for the current VC controlled tree in a window. If LIMIT is non-nil, it should be a number specifying the maximum number of revisions to show; the default is `vc-log-show-limit'. When called interactively with a prefix argument, prompt for LIMIT. When the prefix argument is a number, use it as LIMIT. -A special case is when the prefix argument is 1, in this case -it asks for the revision and shows it with its diff." +A special case is when the prefix argument is 1: in this case +the command asks for the ID of a revision, and shows that revision +with its diffs (if the underlying VCS supports that)." (interactive (cond ((eq current-prefix-arg 1) @@ -2517,7 +2518,7 @@ it asks for the revision and shows it with its diff." rootdir) (if backend (setq rootdir (vc-call-backend backend 'root default-directory)) - (setq rootdir (read-directory-name "Directory for VC root-log: ")) + (setq rootdir (read-directory-name "Directory for VC revision log: ")) (setq backend (vc-responsible-backend rootdir)) (unless backend (error "Directory is not version controlled"))) commit b2790db049da98b541d07bac21ca7d7c220d3be0 Author: Noam Postavsky Date: Sat Mar 10 18:12:55 2018 -0500 Improve errors & warnings due to fancy quoted vars (Bug#32939) Add some hints to the message for byte compiler free & unused variable warnings, and 'void-variable' errors where the variable has confusable quote characters in it. * lisp/help.el (uni-confusables), uni-confusables-regexp): New constants. (help-command-error-confusable-suggestions): New function, added to `command-error-function'. (help-uni-confusable-suggestions): New function. * lisp/emacs-lisp/bytecomp.el (byte-compile-variable-ref): * lisp/emacs-lisp/cconv.el (cconv--analyze-use): Use it. * lisp/emacs-lisp/lisp-mode.el (lisp--match-confusable-symbol-character): New function. (lisp-fdefs): Use it to fontify confusable characters with font-lock-warning-face when they occur in symbol names. * doc/lispref/modes.texi (Faces for Font Lock): * doc/lispref/objects.texi (Basic Char Syntax): Recommend backslash escaping of confusable characters, and mention new fontification. * etc/NEWS: Announce the new fontification behavior. * test/lisp/emacs-lisp/lisp-mode-tests.el (lisp-fontify-confusables): New test. diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index 7283930507..c554ccdf4a 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -3287,7 +3287,8 @@ assigned using the ordering as a guide. @table @code @item font-lock-warning-face @vindex font-lock-warning-face -for a construct that is peculiar, or that greatly changes the meaning of +for a construct that is peculiar (e.g., an unescaped confusable quote +in an Emacs Lisp symbol like @samp{‘foo}), or that greatly changes the meaning of other text, like @samp{;;;###autoload} in Emacs Lisp and @samp{#error} in C. diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi index d9971f6839..e948814d1f 100644 --- a/doc/lispref/objects.texi +++ b/doc/lispref/objects.texi @@ -424,7 +424,11 @@ without a special escape meaning; thus, @samp{?\+} is equivalent to characters. However, you must add a backslash before any of the characters @samp{()[]\;"}, and you should add a backslash before any of the characters @samp{|'`#.,} to avoid confusing the Emacs commands -for editing Lisp code. You can also add a backslash before whitespace +for editing Lisp code. You should also add a backslash before Unicode +characters which resemble the previously mentioned @acronym{ASCII} +ones, to avoid confusing people reading your code. Emacs will +highlight some non-escaped commonly confused characters such as +@samp{‘} to encourage this. You can also add a backslash before whitespace characters such as space, tab, newline and formfeed. However, it is cleaner to use one of the easily readable escape sequences, such as @samp{\t} or @samp{\s}, instead of an actual whitespace character such diff --git a/etc/NEWS b/etc/NEWS index 3a2efcfc2e..688b3f85cb 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2972,6 +2972,11 @@ and if the new behavior breaks your code please email <32252@debbugs.gnu.org>. Because '%o' and '%x' can now format signed integers, they now support the '+' and space flags. ++++ +** In Emacs Lisp mode, symbols with confusable quotes are highlighted. +For example, the first character in '‘foo' would be highlighted in +'font-lock-warning-face'. + +++ ** Omitting variables after '&optional' and '&rest' is now allowed. For example '(defun foo (&optional))' is no longer an error. This is diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 905d99a597..118356ec26 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -3428,7 +3428,10 @@ for symbols generated by the byte compiler itself." (boundp var) (memq var byte-compile-bound-variables) (memq var byte-compile-free-references)) - (byte-compile-warn "reference to free variable `%S'" var) + (let* ((varname (prin1-to-string var)) + (suggestions (help-uni-confusable-suggestions varname))) + (byte-compile-warn "reference to free variable `%s'%s" varname + (if suggestions (concat "\n " suggestions) ""))) (push var byte-compile-free-references)) (byte-compile-dynamic-variable-op 'byte-varref var)))) @@ -3444,7 +3447,10 @@ for symbols generated by the byte compiler itself." (boundp var) (memq var byte-compile-bound-variables) (memq var byte-compile-free-assignments)) - (byte-compile-warn "assignment to free variable `%s'" var) + (let* ((varname (prin1-to-string var)) + (suggestions (help-uni-confusable-suggestions varname))) + (byte-compile-warn "assignment to free variable `%s'%s" varname + (if suggestions (concat "\n " suggestions) ""))) (push var byte-compile-free-assignments)) (byte-compile-dynamic-variable-op 'byte-varset var)))) diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el index 58ca9d5f57..09af7cb910 100644 --- a/lisp/emacs-lisp/cconv.el +++ b/lisp/emacs-lisp/cconv.el @@ -591,8 +591,10 @@ FORM is the parent form that binds this var." (eq ?_ (aref (symbol-name var) 0)) ;; As a special exception, ignore "ignore". (eq var 'ignored)) - (byte-compile-warn "Unused lexical %s `%S'" - varkind var))) + (let ((suggestions (help-uni-confusable-suggestions (symbol-name var)))) + (byte-compile-warn "Unused lexical %s `%S'%s" + varkind var + (if suggestions (concat "\n " suggestions) ""))))) ;; If it's unused, there's no point converting it into a cons-cell, even if ;; it's captured and mutated. (`(,binder ,_ t t ,_) diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 5df52ebc98..56f8ef6368 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -280,6 +280,19 @@ This will generate compile-time constants from BINDINGS." `(face ,font-lock-warning-face help-echo "This \\ has no effect")))) +(defun lisp--match-confusable-symbol-character (limit) + ;; Match a confusable character within a Lisp symbol. + (catch 'matched + (while t + (if (re-search-forward uni-confusables-regexp limit t) + ;; Skip confusables which are backslash escaped, or inside + ;; strings or comments. + (save-match-data + (unless (or (eq (char-before (match-beginning 0)) ?\\) + (nth 8 (syntax-ppss))) + (throw 'matched t))) + (throw 'matched nil))))) + (let-when-compile ((lisp-fdefs '("defmacro" "defun")) (lisp-vdefs '("defvar")) @@ -463,7 +476,10 @@ This will generate compile-time constants from BINDINGS." (3 'font-lock-regexp-grouping-construct prepend)) (lisp--match-hidden-arg (0 '(face font-lock-warning-face - help-echo "Hidden behind deeper element; move to another line?"))) + help-echo "Hidden behind deeper element; move to another line?"))) + (lisp--match-confusable-symbol-character + 0 '(face font-lock-warning-face + help-echo "Confusable character")) )) "Gaudy level highlighting for Emacs Lisp mode.") diff --git a/lisp/help.el b/lisp/help.el index 604a365957..8bb942abf4 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -1507,6 +1507,55 @@ the same names as used in the original source code, when possible." (let ((print-escape-newlines t)) (help--docstring-quote (format "%S" (help--make-usage fn arglist))))) + + +;; Just some quote-like characters for now. TODO: generate this stuff +;; from official Unicode data. +(defconst uni-confusables + '((#x2018 . "'") ;; LEFT SINGLE QUOTATION MARK + (#x2019 . "'") ;; RIGHT SINGLE QUOTATION MARK + (#x201B . "'") ;; SINGLE HIGH-REVERSED-9 QUOTATION MARK + (#x201C . "\"") ;; LEFT DOUBLE QUOTATION MARK + (#x201D . "\"") ;; RIGHT DOUBLE QUOTATION MARK + (#x201F . "\"") ;; DOUBLE HIGH-REVERSED-9 QUOTATION MARK + (#x301E . "\"") ;; DOUBLE PRIME QUOTATION MARK + (#xFF02 . "'") ;; FULLWIDTH QUOTATION MARK + (#xFF07 . "'") ;; FULLWIDTH APOSTROPHE + )) + +(defconst uni-confusables-regexp + (concat "[" (mapcar #'car uni-confusables) "]")) + +(defun help-uni-confusable-suggestions (string) + "Return a message describing confusables in STRING." + (let ((i 0) + (confusables nil)) + (while (setq i (string-match uni-confusables-regexp string i)) + (let ((replacement (alist-get (aref string i) uni-confusables))) + (push (aref string i) confusables) + (setq string (replace-match replacement t t string)) + (setq i (+ i (length replacement))))) + (when confusables + (format-message + (if (> (length confusables) 1) + "Found confusable characters: %s; perhaps you meant: `%s'?" + "Found confusable character: %s, perhaps you meant: `%s'?") + (mapconcat (lambda (c) (format-message "`%c'" c)) + confusables ", ") + string)))) + +(defun help-command-error-confusable-suggestions (data _context _signal) + (pcase data + (`(void-variable ,var) + (let ((suggestions (help-uni-confusable-suggestions + (symbol-name var)))) + (when suggestions + (princ (concat "\n " suggestions) t)))) + (_ nil))) + +(add-function :after command-error-function + #'help-command-error-confusable-suggestions) + (provide 'help) diff --git a/test/lisp/emacs-lisp/lisp-mode-tests.el b/test/lisp/emacs-lisp/lisp-mode-tests.el index e4ba929ecb..c0dd68c0a0 100644 --- a/test/lisp/emacs-lisp/lisp-mode-tests.el +++ b/test/lisp/emacs-lisp/lisp-mode-tests.el @@ -20,6 +20,10 @@ (require 'ert) (require 'cl-lib) (require 'lisp-mode) +(require 'faceup) + + +;;; Indentation (defconst lisp-mode-tests--correctly-indented-sexp "\ \(a @@ -290,5 +294,27 @@ Expected initialization file: `%s'\" (insert "\"\n") (lisp-indent-region (point-min) (point-max)))) + +;;; Fontification + +(ert-deftest lisp-fontify-confusables () + "Unescaped 'smart quotes' should be fontified in `font-lock-warning-face'." + (with-temp-buffer + (dolist (ch + '(#x2018 ;; LEFT SINGLE QUOTATION MARK + #x2019 ;; RIGHT SINGLE QUOTATION MARK + #x201B ;; SINGLE HIGH-REVERSED-9 QUOTATION MARK + #x201C ;; LEFT DOUBLE QUOTATION MARK + #x201D ;; RIGHT DOUBLE QUOTATION MARK + #x201F ;; DOUBLE HIGH-REVERSED-9 QUOTATION MARK + #x301E ;; DOUBLE PRIME QUOTATION MARK + #xFF02 ;; FULLWIDTH QUOTATION MARK + #xFF07 ;; FULLWIDTH APOSTROPHE + )) + (insert (format "«w:%c»foo \\%cfoo\n" ch ch))) + (let ((faceup (buffer-string))) + (faceup-clean-buffer) + (should (faceup-test-font-lock-buffer 'emacs-lisp-mode faceup))))) + (provide 'lisp-mode-tests) ;;; lisp-mode-tests.el ends here commit 85f586f3ce5c6d9598d345440fd57e0fc9b8d98b Author: Noam Postavsky Date: Sat Mar 10 18:20:45 2018 -0500 Stop signaling an error when reading "smart quotes" in symbols Revert commits from 2018-01-28 "Fix round tripping of read->print for symbols with strange quotes", and 2017-07-22 "Signal error for symbol names with strange quotes (Bug#2967)". * etc/NEWS: Remove corresponding entries. * src/character.c (confusable_symbol_character_p): * test/src/lread-tests.el (lread-tests--old-style-backquotes): Remove. * src/lread.c (read1): Don't signal error on confusable character. * src/print.c (print_object): Don't escape confusable characters. diff --git a/etc/NEWS b/etc/NEWS index cb73e46358..3a2efcfc2e 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2972,15 +2972,6 @@ and if the new behavior breaks your code please email <32252@debbugs.gnu.org>. Because '%o' and '%x' can now format signed integers, they now support the '+' and space flags. -** To avoid confusion caused by "smart quotes", the reader signals an -error when reading Lisp symbols which begin with one of the following -quotation characters: ‘’‛“”‟〞"'. A symbol beginning with such a -character can be written by escaping the quotation character with a -backslash. For example: - - (read "‘smart") => (invalid-read-syntax "strange quote" "‘") - (read "\\‘smart") == (intern "‘smart") - +++ ** Omitting variables after '&optional' and '&rest' is now allowed. For example '(defun foo (&optional))' is no longer an error. This is diff --git a/src/character.c b/src/character.c index 708eb2f702..55ad49005a 100644 --- a/src/character.c +++ b/src/character.c @@ -1056,32 +1056,6 @@ blankp (int c) return XFIXNUM (category) == UNICODE_CATEGORY_Zs; /* separator, space */ } - -/* Return true for characters that would read as symbol characters, - but graphically may be confused with some kind of punctuation. We - require an escaping backslash, when such characters begin a - symbol. */ -bool -confusable_symbol_character_p (int ch) -{ - switch (ch) - { - case 0x2018: /* LEFT SINGLE QUOTATION MARK */ - case 0x2019: /* RIGHT SINGLE QUOTATION MARK */ - case 0x201B: /* SINGLE HIGH-REVERSED-9 QUOTATION MARK */ - case 0x201C: /* LEFT DOUBLE QUOTATION MARK */ - case 0x201D: /* RIGHT DOUBLE QUOTATION MARK */ - case 0x201F: /* DOUBLE HIGH-REVERSED-9 QUOTATION MARK */ - case 0x301E: /* DOUBLE PRIME QUOTATION MARK */ - case 0xFF02: /* FULLWIDTH QUOTATION MARK */ - case 0xFF07: /* FULLWIDTH APOSTROPHE */ - return true; - - default: - return false; - } -} - /* hexdigit[C] is one greater than C's numeric value if C is a hexadecimal digit, zero otherwise. */ signed char const hexdigit[UCHAR_MAX + 1] = diff --git a/src/character.h b/src/character.h index 230fc6eab5..3642a54044 100644 --- a/src/character.h +++ b/src/character.h @@ -684,8 +684,6 @@ extern bool graphicp (int); extern bool printablep (int); extern bool blankp (int); -extern bool confusable_symbol_character_p (int ch); - /* Return a translation table of id number ID. */ #define GET_TRANSLATION_TABLE(id) \ (XCDR (XVECTOR (Vtranslation_table_vector)->contents[(id)])) diff --git a/src/lread.c b/src/lread.c index 4ea6202972..e5a9c93c55 100644 --- a/src/lread.c +++ b/src/lread.c @@ -3571,13 +3571,6 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) if (! NILP (result) && len == nbytes) return unbind_to (count, result); } - if (!quoted && multibyte) - { - int ch = STRING_CHAR ((unsigned char *) read_buffer); - if (confusable_symbol_character_p (ch)) - xsignal2 (Qinvalid_read_syntax, build_string ("strange quote"), - CALLN (Fstring, make_fixnum (ch))); - } { Lisp_Object result; ptrdiff_t nchars diff --git a/src/print.c b/src/print.c index a2c199c14a..7105c5dbb9 100644 --- a/src/print.c +++ b/src/print.c @@ -2035,8 +2035,7 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag) || c == ',' || c == '.' || c == '`' || c == '[' || c == ']' || c == '?' || c <= 040 || c == NO_BREAK_SPACE - || confusing - || (i == 1 && confusable_symbol_character_p (c))) + || confusing) { printchar ('\\', printcharfun); confusing = false; diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el index 3a2212ef77..0c14a1afda 100644 --- a/test/src/lread-tests.el +++ b/test/src/lread-tests.el @@ -144,23 +144,6 @@ literals (Bug#20852)." "`?\\\"', `?\\(', `?\\)', `?\\;', `?\\[', `?\\]' " "expected!"))))) -(ert-deftest lread-tests--funny-quote-symbols () - "Check that `smart quotes' or similar trigger errors in symbol names." - (dolist (quote-char - '(#x2018 ;; LEFT SINGLE QUOTATION MARK - #x2019 ;; RIGHT SINGLE QUOTATION MARK - #x201B ;; SINGLE HIGH-REVERSED-9 QUOTATION MARK - #x201C ;; LEFT DOUBLE QUOTATION MARK - #x201D ;; RIGHT DOUBLE QUOTATION MARK - #x201F ;; DOUBLE HIGH-REVERSED-9 QUOTATION MARK - #x301E ;; DOUBLE PRIME QUOTATION MARK - #xFF02 ;; FULLWIDTH QUOTATION MARK - #xFF07 ;; FULLWIDTH APOSTROPHE - )) - (let ((str (format "%cfoo" quote-char))) - (should-error (read str) :type 'invalid-read-syntax) - (should (eq (read (concat "\\" str)) (intern str)))))) - (ert-deftest lread-test-bug26837 () "Test for https://debbugs.gnu.org/26837 ." (let ((load-path (cons commit 98f8c5fb07dcb4e20b8ba6648bdabf5c0d3b5145 Author: Filipp Gunbin Date: Fri Nov 29 00:54:52 2019 +0300 Do not call custom-reevaluate-setting in dired-isearch-filenames-end * lisp/dired-aux.el (dired-isearch-filenames-end) (dired-isearch-filenames, dired-isearch-filenames-regexp): Use temporary local variable for dired-isearch-filenames instead of custom-reevaluate-setting (Bug#30187). Without this fix, the value set in .emacs with plain setq would be lost after one isearch. diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 4d7abd1ef6..fb1ad6266d 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -2876,7 +2876,7 @@ Intended to be added to `isearch-mode-hook'." (dired-isearch-filenames-mode -1) (remove-hook 'isearch-mode-end-hook #'dired-isearch-filenames-end t) (unless isearch-suspended - (custom-reevaluate-setting 'dired-isearch-filenames))) + (kill-local-variable 'dired-isearch-filenames))) (defun dired-isearch-filter-filenames (beg end) "Test whether some part of the current search match is inside a file name. @@ -2889,14 +2889,14 @@ is part of a file name (i.e., has the text property `dired-filename')." (defun dired-isearch-filenames () "Search for a string using Isearch only in file names in the Dired buffer." (interactive) - (setq dired-isearch-filenames t) + (set (make-local-variable 'dired-isearch-filenames) t) (isearch-forward nil t)) ;;;###autoload (defun dired-isearch-filenames-regexp () "Search for a regexp using Isearch only in file names in the Dired buffer." (interactive) - (setq dired-isearch-filenames t) + (set (make-local-variable 'dired-isearch-filenames) t) (isearch-forward-regexp nil t)) commit af724ed5942fc7de431c8d169599e7b5456dff0b Author: Eli Zaretskii Date: Thu Nov 28 17:42:47 2019 +0200 Improve PY-b5 input methods * leim/leim-ext.el ("quail/PY-b5"): Assign key sequence for U+25CB (WHITE CIRCLE). (Bug#3179) diff --git a/leim/leim-ext.el b/leim/leim-ext.el index 8ad7e85caf..f8cb1ab08e 100644 --- a/leim/leim-ext.el +++ b/leim/leim-ext.el @@ -29,7 +29,9 @@ ;;; Code: (eval-after-load "quail/PY-b5" - '(quail-defrule "ling2" ?〇 nil t)) + '(progn + (quail-defrule "ling2" ?〇 nil t) + (quail-defrule "wan2" ?○ nil t))) ;; Enable inputting full-width space (U+3000). (eval-after-load "quail/Punct" commit 5629af9cbe91feee8fb4d896224ed62e455f951d Author: Eli Zaretskii Date: Thu Nov 28 17:00:33 2019 +0200 Allow disabling the BPA part of bidi reordering * src/xdisp.c (syms_of_xdisp): New variable 'bidi-inhibit-bpa'. * src/bidi.c (bidi_paired_bracket_type): If 'bidi-inhibit-bpa' is non-nil, return BIDI_BRACKET_NONE for all characters. * lisp/frame.el: Add 'bidi-inhibit-bpa' to the list of variables whose changes require redisplay. (Bug#38407) diff --git a/lisp/frame.el b/lisp/frame.el index 1a15a4c9f2..1d1dcab580 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -2736,7 +2736,8 @@ See also `toggle-frame-maximized'." display-fill-column-indicator-column display-fill-column-indicator-character bidi-paragraph-direction - bidi-display-reordering)) + bidi-display-reordering + bidi-inhibit-bpa)) (provide 'frame) diff --git a/src/bidi.c b/src/bidi.c index 1430d22331..cb94c4e0d7 100644 --- a/src/bidi.c +++ b/src/bidi.c @@ -404,7 +404,7 @@ bidi_mirror_char (int c) static bidi_bracket_type_t bidi_paired_bracket_type (int c) { - if (c == BIDI_EOB) + if (c == BIDI_EOB || bidi_inhibit_bpa) return BIDI_BRACKET_NONE; if (c < 0 || c > MAX_CHAR) emacs_abort (); diff --git a/src/xdisp.c b/src/xdisp.c index c4d23be4cd..2467b336f4 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -34839,6 +34839,14 @@ Intended for use during debugging and for testing bidi display; see biditest.el in the test suite. */); inhibit_bidi_mirroring = false; + DEFVAR_BOOL ("bidi-inhibit-bpa", bidi_inhibit_bpa, + doc: /* Non-nil means inhibit the Bidirectional Parentheses Algorithm. +Disabling the BPA makes redisplay faster, but might produce incorrect +display reordering of bidirectional text with embedded parentheses and +other bracket characters whose 'paired-bracket' Unicode property is +non-nil, see `get-char-code-property'. */); + bidi_inhibit_bpa = false; + #ifdef GLYPH_DEBUG DEFVAR_BOOL ("inhibit-try-window-id", inhibit_try_window_id, doc: /* Inhibit try_window_id display optimization. */);