commit fba64e1697174369b87e3de0c189a0fb0963c49c (HEAD, refs/remotes/origin/master) Author: Dmitry Gutov Date: Thu Aug 19 03:57:58 2021 +0300 Fix vc-root-diff broken with Git as well * lisp/vc/vc.el (vc-root-diff): Fix similar to 35023214031e1 by avoiding the abbreviated directory name in argument (bug#39452). diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index e2b12c6cb0..b75862e8a5 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2056,7 +2056,7 @@ saving the buffer." ;; relative file names work. (let ((default-directory rootdir)) (vc-diff-internal - t (list backend (list rootdir) working-revision) nil nil + t (list backend (list (expand-file-name rootdir)) working-revision) nil nil (called-interactively-p 'interactive)))))) ;;;###autoload commit 78b427648b85d0f7e93ad5f18537ad9f2da055cb Author: Eli Zaretskii Date: Wed Aug 18 22:07:30 2021 +0300 Improve documentation of 'assoc' * doc/lispref/lists.texi (Association Lists): * src/fns.c (Fassoc): Document how TESTFN is called. (Bug#50110) diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi index ac99835f7b..bbe1dce42d 100644 --- a/doc/lispref/lists.texi +++ b/doc/lispref/lists.texi @@ -1557,10 +1557,12 @@ of property lists and association lists. @defun assoc key alist &optional testfn This function returns the first association for @var{key} in @var{alist}, comparing @var{key} against the alist elements using -@var{testfn} if it is non-@code{nil} and @code{equal} otherwise -(@pxref{Equality Predicates}). It returns @code{nil} if no -association in @var{alist} has a @sc{car} equal to @var{key}. For -example: +@var{testfn} if it is a function, and @code{equal} otherwise +(@pxref{Equality Predicates}). If @var{testfn} is a function, it is +called with two arguments: the @sc{car} of an element from @var{alist} +and @var{key}. The function returns @code{nil} if no +association in @var{alist} has a @sc{car} equal to @var{key}, as +tested by @var{testfn}. For example: @smallexample (setq trees '((pine . cones) (oak . acorns) (maple . seeds))) diff --git a/src/fns.c b/src/fns.c index 932800a3a4..5126439fd6 100644 --- a/src/fns.c +++ b/src/fns.c @@ -1755,7 +1755,8 @@ DEFUN ("assoc", Fassoc, Sassoc, 2, 3, 0, doc: /* Return non-nil if KEY is equal to the car of an element of ALIST. The value is actually the first element of ALIST whose car equals KEY. -Equality is defined by TESTFN if non-nil or by `equal' if nil. */) +Equality is defined by the function TESTFN, defaulting to `equal'. +TESTFN is called with 2 arguments: a car of an alist element and KEY. */) (Lisp_Object key, Lisp_Object alist, Lisp_Object testfn) { if (eq_comparable_value (key) && NILP (testfn)) commit 91f549becd03b1598b9d8b233f6058ba027f0a84 Author: Glenn Morris Date: Wed Aug 18 11:50:42 2021 -0700 ; Fix paren typo diff --git a/test/lisp/simple-tests.el b/test/lisp/simple-tests.el index 728911208e..3ece61290b 100644 --- a/test/lisp/simple-tests.el +++ b/test/lisp/simple-tests.el @@ -969,7 +969,7 @@ See Bug#21722." (should (= (length (delq nil (undo-make-selective-list 4 9))) 1)) ;; FIXME this is the off-by-one error case. ;;(should (= (length (delq nil (undo-make-selective-list 5 9))) 0)) - (should (= (length (delq nil (undo-make-selective-list 6 9))) 0))) + (should (= (length (delq nil (undo-make-selective-list 6 9))) 0)))) (provide 'simple-test) ;;; simple-test.el ends here commit 9b31ad36094666da6b3281025adc163829d89de8 Author: Juri Linkov Date: Wed Aug 18 20:02:39 2021 +0300 * lisp/progmodes/xref.el (xref--collect-matches): Widen temporarily. diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 69378a561e..d3780d571f 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1729,12 +1729,14 @@ Such as the current syntax table and the applied syntax properties." (if buf (with-current-buffer buf (save-excursion - (goto-char (point-min)) - (forward-line (1- line)) - (xref--collect-matches-1 regexp file line - (line-beginning-position) - (line-end-position) - syntax-needed))) + (save-restriction + (widen) + (goto-char (point-min)) + (forward-line (1- line)) + (xref--collect-matches-1 regexp file line + (line-beginning-position) + (line-end-position) + syntax-needed)))) ;; Using the temporary buffer is both a performance and a buffer ;; management optimization. (with-current-buffer tmp-buffer commit 1a4ed8ee7843b7cb929f066781a4a754bebf0f4d Author: Juri Linkov Date: Wed Aug 18 20:01:03 2021 +0300 * lisp/mouse.el: More fixes for context-menu. (context-menu-map): Remove menu title "Context Menu" (bug#50067). (context-menu-minor): Reverse sub-menus to display exactly in the same order as on the menu bar. diff --git a/etc/NEWS b/etc/NEWS index cc779b40f4..b221f13624 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -396,9 +396,8 @@ onto 'file-name-history'. *** New minor mode 'context-menu-mode' for context menus popped by 'mouse-3'. When this mode is enabled, clicking 'down-mouse-3' anywhere in the buffer pops up a menu whose contents depends on surrounding context near the -mouse click. You can customize the order of the default sub-menus in -the context menu by customizing the user option -'context-menu-functions'. +mouse click. You can change the order of the default sub-menus in the +context menu by customizing the user option 'context-menu-functions'. +++ *** The "Edit => Clear" menu item now obeys a rectangular region. diff --git a/lisp/mouse.el b/lisp/mouse.el index 5424039700..d2a5200d8d 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -304,7 +304,7 @@ the same menu with changes such as added new menu items." (defun context-menu-map () "Return composite menu map." - (let ((menu (make-sparse-keymap "Context Menu"))) + (let ((menu (make-sparse-keymap))) (run-hook-wrapped 'context-menu-functions (lambda (fun) (setq menu (funcall fun menu)) @@ -341,7 +341,7 @@ the same menu with changes such as added new menu items." "Minor modes submenus." (run-hooks 'activate-menubar-hook 'menu-bar-update-hook) (define-key-after menu [separator-minor] menu-bar-separator) - (dolist (mode (minor-mode-key-binding [menu-bar])) + (dolist (mode (reverse (minor-mode-key-binding [menu-bar]))) (when (and (consp mode) (symbol-value (car mode))) (map-keymap (lambda (key binding) (when (consp binding) commit 0d5ff75e944e765dce0e3a93ebdefa4fb6d5f356 Author: Eli Zaretskii Date: Wed Aug 18 19:10:01 2021 +0300 Improve documentation of last change. * etc/NEWS: Mention the string value of 'auto-composition-mode'. * src/composite.c (syms_of_composite) : Doc fix. diff --git a/etc/NEWS b/etc/NEWS index f77fc8243f..cc779b40f4 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -134,6 +134,15 @@ file: It used to be enabled when Emacs is started in GUI mode but not when started in text mode. The cursor still only actually blinks in GUI frames. +--- +** 'auto-composition-mode' can now be selectively disabled on some TTYs. +Some text-mode terminals produce display glitches trying to compose +characters. The 'auto-composition-mode' can now have a string value +that names a terminal type; if the value returned by the 'tty-type' +function compares equal with that string, automatic composition will +be disabled in windows shown on that terminal. The Linux terminal +sets this up by default. + +++ ** Etags now supports the Mercury programming language. See https://mercurylang.org. diff --git a/src/composite.c b/src/composite.c index 2bde14776f..e97f8e2b4c 100644 --- a/src/composite.c +++ b/src/composite.c @@ -2059,8 +2059,8 @@ The default value is the function `compose-chars-after'. */); doc: /* Non-nil if Auto-Composition mode is enabled. Use the command `auto-composition-mode' to change this variable. -If this variable is a string, `auto-composition-mode' will be disabled -in buffers that have a terminal type that equals this string.*/); +If this variable is a string, `auto-composition-mode' will be disabled in +buffers displayed on a terminal whose type compares equal to this string. */); Vauto_composition_mode = Qt; DEFVAR_LISP ("auto-composition-function", Vauto_composition_function, commit 15a8026cafad4a61a2ba5554c1a3e999244e412c Author: Lars Ingebrigtsen Date: Wed Aug 18 16:24:40 2021 +0200 Disable auto compositions on the Linux console only * lisp/term/linux.el (terminal-init-linux): Disable auto compositions on "linux" consoles (bug#21363). * src/composite.c (inhibit_auto_composition): New function to implement this. (composition_compute_stop_pos, composition_adjust_point) (Ffind_composition_internal): Use it. (syms_of_composite): Document it. * src/lisp.h: Export tty_type_name. * src/term.c (tty_type_name): Factored out. (Ftty_type): Use it. diff --git a/lisp/term/linux.el b/lisp/term/linux.el index bc61a3a7cc..6d43e477ac 100644 --- a/lisp/term/linux.el +++ b/lisp/term/linux.el @@ -13,7 +13,7 @@ (tty-no-underline) ;; Compositions confuse cursor movement. - (global-auto-composition-mode -1) + (setq-default auto-composition-mode "linux") (ignore-errors (when gpm-mouse-mode (require 't-mouse) (gpm-mouse-enable))) diff --git a/src/composite.c b/src/composite.c index 129e9d6bb2..2bde14776f 100644 --- a/src/composite.c +++ b/src/composite.c @@ -961,6 +961,23 @@ char_composable_p (int c) && (XFIXNUM (val) <= UNICODE_CATEGORY_Zs)))))); } +static inline bool +inhibit_auto_composition (void) +{ + if (NILP (Vauto_composition_mode)) + return true; + + if (STRINGP (Vauto_composition_mode)) + { + char *name = tty_type_name (Qnil); + + if (name && ! strcmp (SSDATA (Vauto_composition_mode), name)) + return true; + } + + return false; +} + /* Update cmp_it->stop_pos to the next position after CHARPOS (and BYTEPOS) where character composition may happen. If BYTEPOS is negative, compute it. ENDPOS is a limit of searching. If it is @@ -1015,7 +1032,7 @@ composition_compute_stop_pos (struct composition_it *cmp_it, ptrdiff_t charpos, cmp_it->ch = -1; } if (NILP (BVAR (current_buffer, enable_multibyte_characters)) - || NILP (Vauto_composition_mode)) + || inhibit_auto_composition ()) return; if (bytepos < 0) { @@ -1741,7 +1758,7 @@ composition_adjust_point (ptrdiff_t last_pt, ptrdiff_t new_pt) } if (NILP (BVAR (current_buffer, enable_multibyte_characters)) - || NILP (Vauto_composition_mode)) + || inhibit_auto_composition ()) return new_pt; /* Next check the automatic composition. */ @@ -1941,7 +1958,7 @@ See `find-composition' for more details. */) if (!find_composition (from, to, &start, &end, &prop, string)) { if (!NILP (BVAR (current_buffer, enable_multibyte_characters)) - && ! NILP (Vauto_composition_mode) + && ! inhibit_auto_composition () && find_automatic_composition (from, to, (ptrdiff_t) -1, &start, &end, &gstring, string)) return list3 (make_fixnum (start), make_fixnum (end), gstring); @@ -2040,7 +2057,10 @@ The default value is the function `compose-chars-after'. */); DEFVAR_LISP ("auto-composition-mode", Vauto_composition_mode, doc: /* Non-nil if Auto-Composition mode is enabled. -Use the command `auto-composition-mode' to change this variable. */); +Use the command `auto-composition-mode' to change this variable. + +If this variable is a string, `auto-composition-mode' will be disabled +in buffers that have a terminal type that equals this string.*/); Vauto_composition_mode = Qt; DEFVAR_LISP ("auto-composition-function", Vauto_composition_function, diff --git a/src/lisp.h b/src/lisp.h index 1206a0d1f6..7bfc69b647 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -4652,6 +4652,7 @@ extern AVOID fatal (const char *msgid, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2); /* Defined in terminal.c. */ extern void syms_of_terminal (void); +extern char * tty_type_name (Lisp_Object); /* Defined in font.c. */ extern void syms_of_font (void); diff --git a/src/term.c b/src/term.c index c995a4499c..6651b96792 100644 --- a/src/term.c +++ b/src/term.c @@ -2169,6 +2169,14 @@ set_tty_color_mode (struct tty_display_info *tty, struct frame *f) #endif /* !DOS_NT */ +char * +tty_type_name (Lisp_Object terminal) +{ + struct terminal *t = decode_tty_terminal (terminal); + + return t? t->display_info.tty->type: NULL; +} + DEFUN ("tty-type", Ftty_type, Stty_type, 0, 1, 0, doc: /* Return the type of the tty device that TERMINAL uses. Returns nil if TERMINAL is not on a tty device. @@ -2177,10 +2185,9 @@ TERMINAL can be a terminal object, a frame, or nil (meaning the selected frame's terminal). */) (Lisp_Object terminal) { - struct terminal *t = decode_tty_terminal (terminal); + char *name = tty_type_name (terminal); - return (t && t->display_info.tty->type - ? build_string (t->display_info.tty->type) : Qnil); + return (name? build_string (name) : Qnil); } DEFUN ("controlling-tty-p", Fcontrolling_tty_p, Scontrolling_tty_p, 0, 1, 0, commit 3a1d713c19147a0eeb4829a8d3815e3292cbf1f3 Author: Lars Ingebrigtsen Date: Wed Aug 18 15:32:19 2021 +0200 Add undo-in-region test case for bug#21523 diff --git a/test/lisp/simple-tests.el b/test/lisp/simple-tests.el index 4b153d117f..728911208e 100644 --- a/test/lisp/simple-tests.el +++ b/test/lisp/simple-tests.el @@ -959,6 +959,17 @@ See Bug#21722." (with-shell-command-dont-erase-buffer str output-buffer-is-current (should (= (point) (alist-get shell-command-dont-erase-buffer expected-point))))))) +(ert-deftest test-undo-region () + (with-temp-buffer + (insert "This is a test\n") + (goto-char (point-min)) + (setq buffer-undo-list nil) + (downcase-word 1) + (should (= (length (delq nil (undo-make-selective-list 1 9))) 2)) + (should (= (length (delq nil (undo-make-selective-list 4 9))) 1)) + ;; FIXME this is the off-by-one error case. + ;;(should (= (length (delq nil (undo-make-selective-list 5 9))) 0)) + (should (= (length (delq nil (undo-make-selective-list 6 9))) 0))) (provide 'simple-test) ;;; simple-test.el ends here commit ee812f2a987d295659c041c577aac8db93de819f Author: Eli Zaretskii Date: Wed Aug 18 16:14:29 2021 +0300 Yet another place inside redisplay_window to prevent quitting * src/xdisp.c (handle_single_display_spec): Inhibit quitting around the call to lookup_image. (Bug#44448) diff --git a/src/xdisp.c b/src/xdisp.c index ceb0fa7e64..ada9ed6c22 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -5788,8 +5788,15 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object, #ifdef HAVE_WINDOW_SYSTEM else { + ptrdiff_t count = SPECPDL_INDEX (); + it->what = IT_IMAGE; + /* Don't allow quitting from lookup_image, for when we are + displaying a non-selected window, and the buffer's point + was temporarily moved to the window-point. */ + specbind (Qinhibit_quit, Qt); it->image_id = lookup_image (it->f, value, it->face_id); + unbind_to (count, Qnil); it->position = start_pos; it->object = NILP (object) ? it->w->contents : object; it->method = GET_FROM_IMAGE; commit bf4f7388b6d0373d239b0aeedcc1a77549371320 Author: Eli Zaretskii Date: Wed Aug 18 16:01:57 2021 +0300 Fix abort when turning on Hebrew or Arabic input methods * src/xdisp.c (face_before_or_after_it_pos): Add the missing initialization of the bidi scan direction. (Bug#50107) diff --git a/src/xdisp.c b/src/xdisp.c index 3b7ed2be20..ceb0fa7e64 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -4601,6 +4601,7 @@ face_before_or_after_it_pos (struct it *it, bool before_p) SAVE_IT (it_copy, *it, it_copy_data); IT_STRING_CHARPOS (it_copy) = 0; bidi_init_it (0, 0, FRAME_WINDOW_P (it_copy.f), &it_copy.bidi_it); + it_copy.bidi_it.scan_dir = 0; do { commit fa4a63c689864a75b2439b9a5f858158fa1a7c7a Author: Peter Münster Date: Wed Aug 18 14:53:25 2021 +0200 Add menu bindings to new functions in image-dired.el * lisp/image-dired.el (image-dired--with-marked): New macro for cycling over marked thumbnails. (image-dired-tag-thumbnail, image-dired-tag-thumbnail-remove): Can handle now also all marked thumbnails. (image-dired-tag-marked-thumbnails): Remove it, because it's obsoleted by `image-dired-tag-thumbnail' now. (image-dired-delete-marked): Use new macro `image-dired--with-marked', and add command to menu (bug#50000). diff --git a/etc/NEWS b/etc/NEWS index 8b53654170..f77fc8243f 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2447,8 +2447,7 @@ This command, called interactively, toggles the local value of If non-nil (the default), use 'image-dired-thumb-mark' to say what images are marked. -*** New command 'image-dired-tag-marked-thumbnails'. - +--- *** New command 'image-dired-delete-marked'. ** Miscellaneous diff --git a/lisp/image-dired.el b/lisp/image-dired.el index 7092f758db..1e1614af9b 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el @@ -797,6 +797,22 @@ Queued items live in `image-dired-queue'." (list (list original-file thumbnail-file)))) (run-at-time 0 nil #'image-dired-thumb-queue-run)) +(defmacro image-dired--with-marked (&rest body) + "Eval BODY with point on each marked thumbnail. +If no marked file could be found, execute BODY on the current +thumbnail." + `(with-current-buffer image-dired-thumbnail-buffer + (let (found) + (save-mark-and-excursion + (goto-char (point-min)) + (while (not (eobp)) + (when (image-dired-thumb-file-marked-p) + (setq found t) + ,@body) + (forward-char))) + (unless found + ,@body)))) + ;;;###autoload (defun image-dired-dired-toggle-marked-thumbs (&optional arg) "Toggle thumbnails in front of file names in the dired buffer. @@ -1145,20 +1161,15 @@ FILE-TAGS is an alist in the following form: (cons x tag)) files)))) -(defun image-dired-tag-marked-thumbnails () - "Tag marked thumbnails." - (interactive) - (when-let ((dired-buf (image-dired-associated-dired-buffer))) - (with-current-buffer dired-buf - (image-dired-tag-files nil)))) - (defun image-dired-tag-thumbnail () - "Tag current thumbnail." + "Tag current or marked thumbnails." (interactive) (let ((tag (read-string "Tags to add (separate tags with a semicolon): "))) - (image-dired-write-tags (list (cons (image-dired-original-file-name) tag)))) - (image-dired-update-property - 'tags (image-dired-list-tags (image-dired-original-file-name)))) + (image-dired--with-marked + (image-dired-write-tags + (list (cons (image-dired-original-file-name) tag))) + (image-dired-update-property + 'tags (image-dired-list-tags (image-dired-original-file-name)))))) ;;;###autoload (defun image-dired-delete-tag (arg) @@ -1173,12 +1184,13 @@ With prefix argument ARG, remove tag from file at point." (image-dired-remove-tag files tag))) (defun image-dired-tag-thumbnail-remove () - "Remove tag from thumbnail." + "Remove tag from current or marked thumbnails." (interactive) (let ((tag (read-string "Tag to remove: "))) - (image-dired-remove-tag (image-dired-original-file-name) tag)) - (image-dired-update-property - 'tags (image-dired-list-tags (image-dired-original-file-name)))) + (image-dired--with-marked + (image-dired-remove-tag (image-dired-original-file-name) tag) + (image-dired-update-property + 'tags (image-dired-list-tags (image-dired-original-file-name)))))) (defun image-dired-original-file-name () "Get original file name for thumbnail or display image at point." @@ -1518,8 +1530,10 @@ You probably want to use this together with '("Image-Dired" ["Quit" quit-window] ["Delete thumbnail from buffer" image-dired-delete-char] - ["Remove tag from thumbnail" image-dired-tag-thumbnail-remove] - ["Tag thumbnail" image-dired-tag-thumbnail] + ["Delete marked images" image-dired-delete-marked] + ["Remove tag from current or marked thumbnails" + image-dired-tag-thumbnail-remove] + ["Tag current or marked thumbnails" image-dired-tag-thumbnail] ["Comment thumbnail" image-dired-comment-thumbnail] ["Refresh thumb" image-dired-refresh-thumb] ["Dynamic line up" image-dired-line-up-dynamic] @@ -2301,15 +2315,12 @@ non-nil." (defun image-dired-delete-marked () "Delete marked thumbnails and associated images." (interactive) - (goto-char (point-min)) - (let ((dired-buf (image-dired-associated-dired-buffer))) - (while (not (eobp)) - (if (image-dired-thumb-file-marked-p) - (image-dired-delete-char) - (forward-char))) - (image-dired--line-up-with-method) - (with-current-buffer dired-buf - (dired-do-delete)))) + (image-dired--with-marked + (image-dired-delete-char) + (backward-char)) + (image-dired--line-up-with-method) + (with-current-buffer (image-dired-associated-dired-buffer) + (dired-do-delete))) (defun image-dired-thumb-update-marks () "Update the marks in the thumbnail buffer." commit c17e03ace54b676cf3bf193153cf5e9b367cdd61 Author: João Távora Date: Wed Aug 18 11:37:55 2021 +0100 ; * etc/NEWS (Icomplete): Fix typo and remove redundant word diff --git a/etc/NEWS b/etc/NEWS index 1b4712828c..8b53654170 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -666,13 +666,12 @@ prompt prefix. +++ *** New minor modes 'icomplete-vertical-mode' and 'fido-vertical-mode' -These modes are modify Icomplete ('M-x icomplete-mode') and Fido ('M-x +These modes modify Icomplete ('M-x icomplete-mode') and Fido ('M-x fido-mode'), to display completions candidates vertically instead of horizontally. In Icomplete, completions are rotated and selection kept at the top. In Fido, completions scroll like a typical dropdown widget. Both these new minor modes will first turn on their -respective non-vertical counterparts first, if they are not on -already. +non-vertical counterparts first, if they are not on already. --- *** Default value of 'icomplete-compute-delay' has been changed to 0.15 s.