commit f028a893a552b0c38c35f949addb6a891e8586cc (HEAD, refs/remotes/origin/master) Author: Masahiro Nakamura Date: Tue Sep 15 15:35:32 2020 +0900 ; Minor fix for nsxwidget patch * lisp/xwdget.el (xwidget-webkit-download-dir) (xwidget-webkit-save-as-file): Set version to 28.1 because the patch was introduced in Emacs 28.0.50. * src/nsxwidget.m: Fix typo. diff --git a/lisp/xwidget.el b/lisp/xwidget.el index 074320855c..e5c1b47f3b 100644 --- a/lisp/xwidget.el +++ b/lisp/xwidget.el @@ -318,7 +318,7 @@ If non-nil, plugins are enabled. Otherwise, disabled.")) (defcustom xwidget-webkit-download-dir "~/Downloads/" "Directory where download file saved." - :version "27.1" + :version "28.1" :type 'file) (defun xwidget-webkit-save-as-file (url mime-type file-name) @@ -348,7 +348,7 @@ If non-nil, use a new xwidget webkit session after bookmark jump. Otherwise, it will use `xwidget-webkit-last-session'. When you set this variable to nil, consider further customization with `xwidget-webkit-last-session-buffer'." - :version "27.1" + :version "28.1" :type 'boolean) (defun xwidget-webkit-bookmark-make-record () diff --git a/src/nsxwidget.m b/src/nsxwidget.m index e81ca7fc0c..2910d97225 100644 --- a/src/nsxwidget.m +++ b/src/nsxwidget.m @@ -33,14 +33,14 @@ /* Thoughts on NS Cocoa xwidget and webkit2: Webkit2 process architecture seems to be very hostile for offscreen - rendering techniques, which is used by GTK xwiget implementation; + rendering techniques, which is used by GTK xwidget implementation; Specifically NSView level view sharing / copying is not working. *** So only one view can be associcated with a model. *** With this decision, implementation is plain and can expect best out of webkit2's rationale. But process and session structures will - diverge from GTK xwiget. Though, cosmetically similar usages can + diverge from GTK xwidget. Though, cosmetically similar usages can be presented and will be preferred, if agreeable. For other widget types, OSR seems possible, but will not care for a commit eeae97282e245c82c470557d76a252a833aed5d5 Author: Lars Ingebrigtsen Date: Tue Sep 15 18:11:28 2020 +0200 Make sgml-validate not bug out from buffers not visiting a file * lisp/textmodes/sgml-mode.el (sgml-validate): Don't bug out when running from a buffer that's not visiting a file (bug#22906). diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el index e0ef786953..f3d8695e24 100644 --- a/lisp/textmodes/sgml-mode.el +++ b/lisp/textmodes/sgml-mode.el @@ -1188,10 +1188,9 @@ and move to the line in the SGML document that caused it." (or sgml-saved-validate-command (concat sgml-validate-command " " - (shell-quote-argument - (let ((name (buffer-file-name))) - (and name - (file-name-nondirectory name))))))))) + (when-let ((name (buffer-file-name))) + (shell-quote-argument + (file-name-nondirectory name)))))))) (setq sgml-saved-validate-command command) (save-some-buffers (not compilation-ask-about-save) nil) (compilation-start command)) commit c07ec3f43ef3a43af24a48ab337341fc59f40971 Author: Eli Zaretskii Date: Tue Sep 15 19:08:55 2020 +0300 ; * etc/NEWS: Fix wording of a recently added entry. diff --git a/etc/NEWS b/etc/NEWS index 90273dd89a..e5a34a8978 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1008,8 +1008,8 @@ case going from "(5,9)" to "(L5,C9)". +++ *** New command 'submit-emacs-patch'. -This works along the lines of 'report-emacs-bug', but is more geared -towards sending a patch to the Emacs issue tracker. +This works like 'report-emacs-bug', but is more geared towards sending +patches to the Emacs issue tracker. +++ *** New minor mode 'button-mode'. commit 360145a83c847e2404a49f12c689d4c4c2e7e9ad Merge: 1b68d76dc1 5e6393fc61 Author: Eli Zaretskii Date: Tue Sep 15 19:06:23 2020 +0300 Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs commit 1b68d76dc180d7b5f816d9a8e684aae9f5d7bef9 Author: Eli Zaretskii Date: Tue Sep 15 19:05:53 2020 +0300 ; * src/font.c (syms_of_font) : Doc fix. diff --git a/src/font.c b/src/font.c index 779b852096..beaa7be98d 100644 --- a/src/font.c +++ b/src/font.c @@ -5535,7 +5535,7 @@ cause Xft crashes. Only has an effect in Xft builds. */); DEFVAR_BOOL ("query-all-font-backends", query_all_font_backends, doc: /* -If non-nil attempt to query all available font backends. +If non-nil, attempt to query all available font backends. By default Emacs will stop searching for a matching font at the first match. */); query_all_font_backends = false; commit 5e6393fc61a2a2423038fb80288aef30626bdba7 Author: Lars Ingebrigtsen Date: Tue Sep 15 18:03:50 2020 +0200 Use a square root character in calc displays * lisp/calc/calccomp.el (math-compose-sqrt): Use a square root character, if possible (bug#22919). Suggested by Zephyr Pellerin . diff --git a/lisp/calc/calccomp.el b/lisp/calc/calccomp.el index 0367c537b5..1f3ae84263 100644 --- a/lisp/calc/calccomp.el +++ b/lisp/calc/calccomp.el @@ -1018,7 +1018,8 @@ (make-string (+ w 2) ?\_)) (list 'horiz (if (= h 1) - "V" + (if (char-displayable-p ?√) + "√" "V") (append (list 'vleft (1- a)) (make-list (1- h) " |") '("\\|"))) commit f4b4166e0075943641cd75c5935959cdc157c585 Author: Eli Zaretskii Date: Tue Sep 15 18:44:01 2020 +0300 Avoid aborts in display_mode_element * src/xdisp.c (display_mode_element): Use parse_str_as_multibyte, not multibyte_chars_in_text, to determine whether mode-line spec shall be displayed as a multibyte or unibyte string. We cannot use multibyte_chars_in_text here because it aborts when it finds raw bytes in the spec string. (Bug#43409) diff --git a/src/xdisp.c b/src/xdisp.c index 10ddb53dba..615f0ca7cf 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -25641,8 +25641,10 @@ display_mode_element (struct it *it, int depth, int field_width, int precision, /* Non-ASCII characters in SPEC should cause mode-line element be displayed as a multibyte string. */ ptrdiff_t nbytes = strlen (spec); - if (multibyte_chars_in_text ((const unsigned char *)spec, - nbytes) != nbytes) + ptrdiff_t nchars, mb_nbytes; + parse_str_as_multibyte ((const unsigned char *)spec, nbytes, + &nchars, &mb_nbytes); + if (!(nbytes == nchars || nbytes != mb_nbytes)) multibyte = true; switch (mode_line_target) commit 9bb9f4370950f9e8e043aa07bab9e9a54fb9d344 Author: Robert Pluim Date: Tue Sep 15 17:35:53 2020 +0200 ; Fix grammar of previous commit * doc/lispref/modes.texi (Mode Line Variables): Fix grammar of mode-line-position-{line,column}-format descriptions. diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index 6180cb2865..b77bcdb5c1 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -2167,14 +2167,14 @@ shows the information specified by @code{global-mode-string}. @end defvar @defvar mode-line-position-line-format -The format used for display line numbers when @code{line-number-mode} +The format used to display line numbers when @code{line-number-mode} (@pxref{Optional Mode Line,,, emacs, The GNU Emacs Manual}) is switched on. @samp{%l} in the format will be replaced with the line number. @end defvar @defvar mode-line-position-column-format -The format used for display column numbers when +The format used to display column numbers when @code{column-number-mode} (@pxref{Optional Mode Line,,, emacs, The GNU Emacs Manual}) is switched on. @samp{%c} in the format will be replaced with the line number, and this is zero-based if commit 20d13e424fb2e7dcc5e6ea1848bca4376d22bab1 Author: Robert Pluim Date: Fri Sep 11 10:29:24 2020 +0200 Stop querying for fonts as soon as a match is found Scanning through fonts can be very slow, especially with the 'x' font backend, and the result is almost always not used. Stop looking for a font as soon as one is found rather than scanning all the backends. * src/font.c (font_list_entities): Stop scanning through the font backends as soon as we find a match unless 'query-all-font-backends is set (Bug#43177). (syms_of_font): New variable 'query-all-font-backends', default false. diff --git a/src/font.c b/src/font.c index 2786a772dc..779b852096 100644 --- a/src/font.c +++ b/src/font.c @@ -2810,7 +2810,13 @@ font_list_entities (struct frame *f, Lisp_Object spec) || ! NILP (Vface_ignored_fonts))) val = font_delete_unmatched (val, need_filtering ? spec : Qnil, size); if (ASIZE (val) > 0) - list = Fcons (val, list); + { + list = Fcons (val, list); + /* Querying further backends can be very slow, so we only do + it if the user has explicitly requested it (Bug#43177). */ + if (query_all_font_backends == false) + break; + } } list = Fnreverse (list); @@ -5527,6 +5533,13 @@ Non-nil means don't query fontconfig for color fonts, since they often cause Xft crashes. Only has an effect in Xft builds. */); xft_ignore_color_fonts = true; + DEFVAR_BOOL ("query-all-font-backends", query_all_font_backends, + doc: /* +If non-nil attempt to query all available font backends. +By default Emacs will stop searching for a matching font at the first +match. */); + query_all_font_backends = false; + #ifdef HAVE_WINDOW_SYSTEM #ifdef HAVE_FREETYPE syms_of_ftfont (); commit 0a7152e095e51febedf3da794eacb3a6b538e64e Author: Lars Ingebrigtsen Date: Tue Sep 15 17:36:36 2020 +0200 Fix up previous replace-in-string commit * lisp/subr.el (replace-in-string): Fix thinko in implementation. diff --git a/lisp/subr.el b/lisp/subr.el index b8331760e3..f3c1e20660 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -4430,7 +4430,11 @@ This function returns a freshly created string." (aref fromstring if))) (setq ii (1+ ii) if (1+ if))) - (when (= if (length fromstring)) + (if (not (= if (length fromstring))) + ;; We didn't have a match after all. + (setq i (1+ i)) + ;; We had one, so gather the previous part and the + ;; substition. (when (not (= start i)) (push (substring instring start i) result)) (push tostring result) diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index 8bec097aad..2adb4a62e8 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el @@ -450,7 +450,13 @@ See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19350." (should (equal (replace-in-string "zot" "bar" "barfoozot") "barfoobar")) (should (equal (replace-in-string "z" "bar" "barfoozot") - "barfoobarot"))) + "barfoobarot")) + (should (equal (replace-in-string "zot" "bar" "zat") + "zat")) + (should (equal (replace-in-string "azot" "bar" "zat") + "zat")) + (should (equal (replace-in-string "azot" "bar" "azot") + "bar"))) (provide 'subr-tests) ;;; subr-tests.el ends here commit 3beb8bc9940b1de7ecee3d58b32c888898bb3ee0 Author: Lars Ingebrigtsen Date: Tue Sep 15 17:07:31 2020 +0200 Allow controlling the look of the line/column indicators * doc/lispref/modes.texi (Mode Line Variables): Document them. * lisp/bindings.el (mode-line-position-line-format): New variable (bug#28648). (mode-line-position-column-format): Ditto. (mode-line-position): Use them. * lisp/simple.el (column-number-mode): Mention them. (line-number-mode): Ditto. diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index fa5f18e202..6180cb2865 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -2166,6 +2166,22 @@ Mode line construct for miscellaneous information. By default, this shows the information specified by @code{global-mode-string}. @end defvar +@defvar mode-line-position-line-format +The format used for display line numbers when @code{line-number-mode} +(@pxref{Optional Mode Line,,, emacs, The GNU Emacs Manual}) is +switched on. @samp{%l} in the format will be replaced with the line +number. +@end defvar + +@defvar mode-line-position-column-format +The format used for display column numbers when +@code{column-number-mode} (@pxref{Optional Mode Line,,, emacs, The GNU +Emacs Manual}) is switched on. @samp{%c} in the format will be +replaced with the line number, and this is zero-based if +@code{column-number-indicator-zero-based} is non-@code{nil}, and +one-based if @code{column-number-indicator-zero-based} is @code{nil}. +@end defvar + @defvar minor-mode-alist @anchor{Definition of minor-mode-alist} This variable holds an association list whose elements specify how the diff --git a/etc/NEWS b/etc/NEWS index c9221a2284..90273dd89a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -998,6 +998,14 @@ window after starting). This variable defaults to nil. ** Miscellaneous ++++ +*** New variables to control the look of line/column numbers in the mode line. +'mode-line-position-line-format' is the line number format (when +'line-number-mode') is on, and 'mode-line-position-column-format' is +the column number format (when 'column-number-mode') is on. These are +also used if both modes are on, which leads to the default in that +case going from "(5,9)" to "(L5,C9)". + +++ *** New command 'submit-emacs-patch'. This works along the lines of 'report-emacs-bug', but is more geared diff --git a/lisp/bindings.el b/lisp/bindings.el index 20342bc40a..bc9cccde33 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -431,6 +431,24 @@ displayed in `mode-line-position', a component of the default :group 'mode-line) (put 'mode-line-percent-position 'risky-local-variable t) +(defcustom mode-line-position-line-format "L%l" + "Format used to display line numbers in the mode line. +This is used when `line-number-mode' is switched on. The \"%l\" +format spec will be replaced by the line number." + :type 'string + :version "28.1" + :group 'mode-line) + +(defcustom mode-line-position-column-format "C%c" + "Format used to display column numbers in the mode line. +This is used when `column-number-mode' is switched on. The +\"%c\" format spec will be replaced by the column number, which +is zero-based if `column-number-indicator-zero-based' is non-nil, +and one-based if `column-number-indicator-zero-based' is nil." + :type 'string + :version "28.1" + :group 'mode-line) + (defvar mode-line-position `((:propertize mode-line-percent-position @@ -451,19 +469,24 @@ mouse-1: Display Line and Column Mode Menu"))) ((column-number-mode (column-number-indicator-zero-based (10 ,(propertize - " (%l,%c)" + (format " (%s,%s)" + mode-line-position-line-format + mode-line-position-column-format) 'local-map mode-line-column-line-number-mode-map 'mouse-face 'mode-line-highlight 'help-echo "Line number and Column number\n\ mouse-1: Display Line and Column Mode Menu")) (10 ,(propertize - " (%l,%C)" + (format " (%s,%s)" + mode-line-position-line-format + (replace-in-string "%c" "%C" + mode-line-position-column-format)) 'local-map mode-line-column-line-number-mode-map 'mouse-face 'mode-line-highlight 'help-echo "Line number and Column number\n\ mouse-1: Display Line and Column Mode Menu"))) (6 ,(propertize - " L%l" + (format " %s" mode-line-position-line-format) 'local-map mode-line-column-line-number-mode-map 'mouse-face 'mode-line-highlight 'help-echo "Line Number\n\ @@ -471,13 +494,14 @@ mouse-1: Display Line and Column Mode Menu")))) ((column-number-mode (column-number-indicator-zero-based (5 ,(propertize - " C%c" + (format " %s" mode-line-position-column-format) 'local-map mode-line-column-line-number-mode-map 'mouse-face 'mode-line-highlight 'help-echo "Column number\n\ mouse-1: Display Line and Column Mode Menu")) (5 ,(propertize - " C%C" + (format " %s" (replace-in-string "%c" "%C" + mode-line-position-column-format)) 'local-map mode-line-column-line-number-mode-map 'mouse-face 'mode-line-highlight 'help-echo "Column number\n\ diff --git a/lisp/simple.el b/lisp/simple.el index 6ef327ba40..7dc695848b 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -7805,11 +7805,17 @@ a specialization of overwrite mode, entered by setting the Line numbers do not appear for very large buffers and buffers with very long lines; see variables `line-number-display-limit' -and `line-number-display-limit-width'." +and `line-number-display-limit-width'. + +See `mode-line-position-line-format' for how this number is +presented." :init-value t :global t :group 'mode-line) (define-minor-mode column-number-mode - "Toggle column number display in the mode line (Column Number mode)." + "Toggle column number display in the mode line (Column Number mode). + +See `mode-line-position-column-format' for how this number is +presented." :global t :group 'mode-line) (define-minor-mode size-indication-mode commit caf64ae08bff5c89a8eb0433891cc81f789b3efc Author: Lars Ingebrigtsen Date: Tue Sep 15 16:50:44 2020 +0200 Add new, simple `replace-in-string' function * lisp/subr.el (replace-in-string): New, side-effect-free function. * doc/lispref/searching.texi (Search and Replace): Document it. diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi index b6242c539b..a217c6e935 100644 --- a/doc/lispref/searching.texi +++ b/doc/lispref/searching.texi @@ -2542,7 +2542,7 @@ and replace them, the best way is to write an explicit loop using description of @code{replace-match}. However, replacing matches in a string is more complex, especially -if you want to do it efficiently. So Emacs provides a function to do +if you want to do it efficiently. So Emacs provides two functions to do this. @defun replace-regexp-in-string regexp rep string &optional fixedcase literal subexp start @@ -2564,6 +2564,11 @@ passing the text of the match as its sole argument. It collects the value @var{rep} returns and passes that to @code{replace-match} as the replacement string. The match data at this point are the result of matching @var{regexp} against a substring of @var{string}. +@end defun + +@defun replace-in-string fromstring tostring instring +This function copies @var{instring} and replaces any occurrences of +@var{fromstring} with @var{tostring}. @end defun If you want to write a command along the lines of @code{query-replace}, diff --git a/etc/NEWS b/etc/NEWS index 2928fd9d97..c9221a2284 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1317,6 +1317,12 @@ ledit.el, lmenu.el, lucid.el and old-whitespace.el. * Lisp Changes in Emacs 28.1 ++++ +*** New function 'replace-in-string'. +This function works along the line of 'replace-regexp-in-string', but +matching on strings instead of regexps, and does not change the global +match state. + --- *** 'ascii' is now a coding system alias for 'us-ascii'. diff --git a/lisp/subr.el b/lisp/subr.el index b1537fd27a..b8331760e3 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -4411,6 +4411,36 @@ Unless optional argument INPLACE is non-nil, return a new string." (aset newstr i tochar))) newstr)) +(defun replace-in-string (fromstring tostring instring) + "Replace FROMSTRING with TOSTRING in INSTRING each time it occurs. +This function returns a freshly created string." + (declare (side-effect-free t)) + (let ((i 0) + (start 0) + (result nil)) + (while (< i (length instring)) + (if (eq (aref instring i) + (aref fromstring 0)) + ;; See if we're in a match. + (let ((ii i) + (if 0)) + (while (and (< ii (length instring)) + (< if (length fromstring)) + (eq (aref instring ii) + (aref fromstring if))) + (setq ii (1+ ii) + if (1+ if))) + (when (= if (length fromstring)) + (when (not (= start i)) + (push (substring instring start i) result)) + (push tostring result) + (setq i ii + start ii))) + (setq i (1+ i)))) + (when (not (= start i)) + (push (substring instring start i) result)) + (apply #'concat (nreverse result)))) + (defun replace-regexp-in-string (regexp rep string &optional fixedcase literal subexp start) "Replace all matches for REGEXP with REP in STRING. diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index 2df5537102..8bec097aad 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el @@ -440,5 +440,17 @@ See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19350." (should-error (ignore-error foo (read "")))) +(ert-deftest replace-in-string () + (should (equal (replace-in-string "foo" "bar" "zot") + "zot")) + (should (equal (replace-in-string "foo" "bar" "foozot") + "barzot")) + (should (equal (replace-in-string "foo" "bar" "barfoozot") + "barbarzot")) + (should (equal (replace-in-string "zot" "bar" "barfoozot") + "barfoobar")) + (should (equal (replace-in-string "z" "bar" "barfoozot") + "barfoobarot"))) + (provide 'subr-tests) ;;; subr-tests.el ends here commit 77aeddc1492e6b33b48366ca02d375088f754bd3 Author: Stefan Kangas Date: Tue Sep 15 15:38:24 2020 +0200 * lisp/window.el: Add provide statement * lisp/window.el (window): Put a `provide' form to help with the popular `use-package' external package (bug#37053). diff --git a/lisp/window.el b/lisp/window.el index bb34a6d7b4..f1ee87aad2 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -10184,4 +10184,6 @@ displaying that processes's buffer." (define-key ctl-x-4-map "1" 'same-window-prefix) (define-key ctl-x-4-map "4" 'other-window-prefix) +(provide 'window) + ;;; window.el ends here commit 9d5b675f2c2d20a6d0da58038235a9982f620915 Author: Eli Zaretskii Date: Tue Sep 15 18:09:03 2020 +0300 Fix MS-Windows compilation of Gnulib with old versions of MinGW * nt/inc/ms-w32.h (_WIN32_WINNT_WIN2K, _WIN32_WINNT_WINXP) (_WIN32_WINNT_WS03, _WIN32_WINNT_VISTA, _WIN32_WINNT_WIN7, _WIN32_WINNT_WIN8, _WIN32_WINNT_WINBLUE, _WIN32_WINNT_WIN10) [__MINGW32__]: Define if any of these is not defined. Reported by martin rudalics . diff --git a/nt/inc/ms-w32.h b/nt/inc/ms-w32.h index 4cbae16dc5..2c754f93e8 100644 --- a/nt/inc/ms-w32.h +++ b/nt/inc/ms-w32.h @@ -39,6 +39,32 @@ along with GNU Emacs. If not, see . */ # undef __POSIX_2008_DEPRECATED # define __POSIX_2008_DEPRECATED # endif +/* Old versions of MinGW don't have these in the w32api headers, and + Gnulib uses them in some files. */ +# ifndef _WIN32_WINNT_WIN2K +# define _WIN32_WINNT_WIN2K 0x0500 +# endif +# ifndef _WIN32_WINNT_WINXP +# define _WIN32_WINNT_WINXP 0x0501 +# endif +# ifndef _WIN32_WINNT_WS03 +# define _WIN32_WINNT_WS03 0x0502 +# endif +# ifndef _WIN32_WINNT_VISTA +# define _WIN32_WINNT_VISTA 0x0600 +# endif +# ifndef _WIN32_WINNT_WIN7 +# define _WIN32_WINNT_WIN7 0x0601 +# endif +# ifndef _WIN32_WINNT_WIN8 +# define _WIN32_WINNT_WIN8 0x0602 +# endif +# ifndef _WIN32_WINNT_WINBLUE +# define _WIN32_WINNT_WINBLUE 0x0603 +# endif +# ifndef _WIN32_WINNT_WIN10 +# define _WIN32_WINNT_WIN10 0x0A00 +# endif #endif /* #undef const */ commit ffe893114f4581e34005ea7d7c6bf04975c0dc7f Merge: c5d53ac36d 32220b53fd Author: Jimmy Aguilar Mena Date: Tue Sep 15 16:18:02 2020 +0200 Merge branch 'feature/uniquify-as-function' into master commit 32220b53fd4e4c8a630434eec008325121143236 Author: Jimmy Aguilar Mena Date: Tue Sep 15 13:19:13 2020 +0200 Document use of uniquify-buffer-name-style as a function. diff --git a/doc/emacs/buffers.texi b/doc/emacs/buffers.texi index 89ed470c05..537c653608 100644 --- a/doc/emacs/buffers.texi +++ b/doc/emacs/buffers.texi @@ -697,6 +697,17 @@ forward order after the file name, as in @samp{file|top/middle}. If @code{uniquify-buffer-name-style} is set to @code{nil}, the buffer names simply get @samp{<2>}, @samp{<3>}, etc.@: appended. + The value of @code{uniquify-buffer-name-style} can be set to a +customized function with two arguments @var{base} and +@var{extra-strings} where @var{base} is a string and +@var{extra-strings} is a list of strings. For example the current +implementation for @code{post-forward-angle-brackets} could be: + +@example +(defun my-post-forward-angle-brackets (base extra-string) + (concat base \"<\" (mapconcat #'identity extra-string \"/\") \">\")) +@end example + Which rule to follow for putting the directory names in the buffer name is not very important if you are going to @emph{look} at the buffer names before you type one. But as an experienced user, if you diff --git a/etc/NEWS b/etc/NEWS index 4076630bf2..2928fd9d97 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1425,6 +1425,12 @@ truncating precision field, such as "%.2a". This can be used to parse RGB color specs in several formats and convert them to a list '(R G B)' of primary color values. +--- +** Variable 'uniquify-buffer-name-style' can now be a function. +This variable can be one of the predefined styles or a function to +personalize the uniquified buffer name. + + * Changes in Emacs 28.1 on Non-Free Operating Systems commit 70003969244ffa28b17ba8a3da688bd701f74c80 Author: Jimmy Aguilar Mena Date: Tue Sep 15 12:50:33 2020 +0200 Enable uniquify-buffer-name-style to be a function. * lisp/uniquify.el (uniquify-buffer-name-style) : Add "Other" custom option (uniquify-get-proposed-name) : Add condition for when uniquify-buffer-name-style is a function. diff --git a/lisp/uniquify.el b/lisp/uniquify.el index 70e8ecee74..e6a1b35bc0 100644 --- a/lisp/uniquify.el +++ b/lisp/uniquify.el @@ -104,6 +104,14 @@ would have the following buffer names in the various styles: post-forward-angle-brackets name name nil name name<2> +The value can be set to a customized function with two arguments +BASE and EXTRA-STRINGS where BASE is a string and EXTRA-STRINGS +is a list of strings. For example the current implementation for +post-forward-angle-brackets could be: + +(defun my-post-forward-angle-brackets (base extra-string) + (concat base \"<\" (mapconcat #'identity extra-string \"/\") \">\")) + The \"mumble\" part may be stripped as well, depending on the setting of `uniquify-strip-common-suffix'. For more options that you can set, browse the `uniquify' custom group." @@ -111,6 +119,7 @@ you can set, browse the `uniquify' custom group." (const reverse) (const post-forward) (const post-forward-angle-brackets) + (function :tag "Other") (const :tag "numeric suffixes" nil)) :version "24.4" :require 'uniquify) @@ -364,20 +373,22 @@ in `uniquify-list-buffers-directory-modes', otherwise returns nil." (cond ((null extra-string) base) ((string-equal base "") ;Happens for dired buffers on the root directory. - (mapconcat 'identity extra-string "/")) + (mapconcat #'identity extra-string "/")) ((eq uniquify-buffer-name-style 'reverse) - (mapconcat 'identity + (mapconcat #'identity (cons base (nreverse extra-string)) (or uniquify-separator "\\"))) ((eq uniquify-buffer-name-style 'forward) - (mapconcat 'identity (nconc extra-string (list base)) + (mapconcat #'identity (nconc extra-string (list base)) "/")) ((eq uniquify-buffer-name-style 'post-forward) (concat base (or uniquify-separator "|") - (mapconcat 'identity extra-string "/"))) + (mapconcat #'identity extra-string "/"))) ((eq uniquify-buffer-name-style 'post-forward-angle-brackets) - (concat base "<" (mapconcat 'identity extra-string "/") + (concat base "<" (mapconcat #'identity extra-string "/") ">")) + ((functionp uniquify-buffer-name-style) + (funcall uniquify-buffer-name-style base extra-string)) (t (error "Bad value for uniquify-buffer-name-style: %s" uniquify-buffer-name-style))))) commit c5d53ac36d59f930e5717a921cb8ff1ce1852648 Author: Lars Ingebrigtsen Date: Tue Sep 15 15:27:46 2020 +0200 Fix mailclient-send-it after recent browse-url rewrite * lisp/mail/mailclient.el (mailclient-send-it): Make this function work again after the browse-url machinery was changed to use browse-url-default-handlers instead. diff --git a/lisp/mail/mailclient.el b/lisp/mail/mailclient.el index 0832548467..405ae17a12 100644 --- a/lisp/mail/mailclient.el +++ b/lisp/mail/mailclient.el @@ -134,7 +134,7 @@ The mail client is taken to be the handler of mailto URLs." character-coding ;; Use the external browser function to send the ;; message. - (browse-url-mailto-function nil)) + (browse-url-default-handlers nil)) ;; initialize limiter (setq mailclient-delim-static "?") ;; construct and call up mailto URL commit 27bda2e140902bf73ad458a872d8aee8b40c302c Author: Lars Ingebrigtsen Date: Tue Sep 15 15:26:55 2020 +0200 Fix regression in non-querying about mail addresses in "emacs -Q" * lisp/mail/emacsbug.el (report-emacs-bug-hook): Don't query about the mail address if using an external mailer (bug#43386). diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el index db374f15c2..23b60be97f 100644 --- a/lisp/mail/emacsbug.el +++ b/lisp/mail/emacsbug.el @@ -446,17 +446,20 @@ and send the mail again%s." ;; questions about From header validity if the user is going to ;; use mailclient, anyway. (when (or (and (derived-mode-p 'message-mode) - (eq message-send-mail-function 'sendmail-query-once)) + (eq (message-default-send-mail-function) 'sendmail-query-once)) (and (not (derived-mode-p 'message-mode)) (eq send-mail-function 'sendmail-query-once))) - (sendmail-query-user-about-smtp) + (setq send-mail-function (sendmail-query-user-about-smtp)) (when (derived-mode-p 'message-mode) - (setq message-send-mail-function (message-default-send-mail-function)))) + (setq message-send-mail-function (message-default-send-mail-function)) + (add-hook 'message-sent-hook + (lambda () + (when (y-or-n-p "Save this mail sending choice?") + (customize-save-variable 'send-mail-function + send-mail-function)))))) (or report-emacs-bug-no-confirmation ;; mailclient.el does not need a valid From - (if (derived-mode-p 'message-mode) - (eq message-send-mail-function 'message-send-mail-with-mailclient) - (eq send-mail-function 'mailclient-send-it)) + (eq send-mail-function 'mailclient-send-it) ;; Not narrowing to the headers, but that's OK. (let ((from (mail-fetch-field "From"))) (when (and (or (not from) commit d727d3dad649d1569a6babaf398439d101e282d4 Author: Daniel Martín Date: Tue Sep 15 14:56:10 2020 +0200 Check that the buffer in diff-buffer-with-file is visiting a file * lisp/vc/diff.el (diff-buffer-with-file): Signal a specific error when the buffer passed to diff-buffer-with-file is not visiting a file (bug#43401). diff --git a/lisp/vc/diff.el b/lisp/vc/diff.el index 469888078c..b7f17bf3c7 100644 --- a/lisp/vc/diff.el +++ b/lisp/vc/diff.el @@ -258,6 +258,8 @@ This requires the external program `diff' to be in your `exec-path'." (interactive "bBuffer: ") (let ((buf (get-buffer (or buffer (current-buffer))))) (with-current-buffer (or (buffer-base-buffer buf) buf) + (unless buffer-file-name + (error "Buffer is not visiting a file")) (diff buffer-file-name (current-buffer) nil 'noasync)))) ;;;###autoload