commit bc1c2cf009e30af77523fd87a8910fdbc4284704 (HEAD, refs/remotes/origin/master) Author: Paul Eggert Date: Mon Sep 16 17:43:56 2019 -0700 Fix some file-mode races * lisp/emacs-lisp/autoload.el (autoload-ensure-file-writeable): * lisp/files.el (after-find-file): * lisp/gnus/gnus-start.el (gnus-dribble-read-file): * lisp/htmlfontify.el (hfy-copy-and-fontify-file): * lisp/server.el (server-ensure-safe-dir): Avoid a race when getting file permissions. diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el index a2dbd402c5..ce2827162b 100644 --- a/lisp/emacs-lisp/autoload.el +++ b/lisp/emacs-lisp/autoload.el @@ -398,9 +398,8 @@ FILE's name." ;; Probably pointless, but replaces the old AUTOGEN_VCS in lisp/Makefile, ;; which was designed to handle CVSREAD=1 and equivalent. (and autoload-ensure-writable - (file-exists-p file) (let ((modes (file-modes file))) - (if (zerop (logand modes #o0200)) + (if (and modes (zerop (logand modes #o0200))) ;; Ignore any errors here, and let subsequent attempts ;; to write the file raise any real error. (ignore-errors (set-file-modes file (logior modes #o0200)))))) diff --git a/lisp/files.el b/lisp/files.el index ce4dd99bd5..5ceaacd744 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -2554,13 +2554,13 @@ unless NOMODES is non-nil." (auto-save-mode 1))) ;; Make people do a little extra work (C-x C-q) ;; before altering a backup file. - (when (backup-file-name-p buffer-file-name) - (setq buffer-read-only t)) ;; When a file is marked read-only, ;; make the buffer read-only even if root is looking at it. - (when (and (file-modes (buffer-file-name)) - (zerop (logand (file-modes (buffer-file-name)) #o222))) - (setq buffer-read-only t)) + (unless buffer-read-only + (when (or (backup-file-name-p buffer-file-name) + (let ((modes (file-modes (buffer-file-name)))) + (and modes (zerop (logand modes #o222))))) + (setq buffer-read-only t))) (unless nomodes (when (and view-read-only view-mode) (view-mode -1)) diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el index e8775c6667..cb369f07b9 100644 --- a/lisp/gnus/gnus-start.el +++ b/lisp/gnus/gnus-start.el @@ -897,9 +897,8 @@ If REGEXP is given, lines that match it will be deleted." (set-buffer-modified-p t)) ;; Set the file modes to reflect the .newsrc file modes. (save-buffer) - (when (and (file-exists-p gnus-current-startup-file) - (file-exists-p dribble-file) - (setq modes (file-modes gnus-current-startup-file))) + (when (and (setq modes (file-modes gnus-current-startup-file)) + (file-exists-p dribble-file)) (gnus-set-file-modes dribble-file modes)) (goto-char (point-min)) (when (search-forward "Gnus was exited on purpose" nil t) diff --git a/lisp/htmlfontify.el b/lisp/htmlfontify.el index b8442be1e8..c1aaab5e21 100644 --- a/lisp/htmlfontify.el +++ b/lisp/htmlfontify.el @@ -1938,9 +1938,9 @@ adding an extension of `hfy-extn'. Fontification is actually done by (set-buffer html) (write-file (concat target hfy-extn)) (kill-buffer html)) - ;; #o0200 == 128, but emacs20 doesn't know that - (if (and (file-exists-p target) (not (file-writable-p target))) - (set-file-modes target (logior (file-modes target) 128))) + (let ((modes (file-modes target))) + (if (and modes (not (file-writable-p target))) + (set-file-modes target (logior modes #o0200)))) (copy-file (buffer-file-name source) target 'overwrite)) (kill-buffer source)) )) diff --git a/lisp/server.el b/lisp/server.el index ac81cdbd48..45fa55ad6b 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -563,9 +563,9 @@ See variable `server-auth-dir' for details." (format "it is not owned by you (owner = %s (%d))" (user-full-name uid) uid)) (w32 nil) ; on NTFS? - ((/= 0 (logand ?\077 (file-modes dir))) - (format "it is accessible by others (%03o)" - (file-modes dir))) + ((let ((modes (file-modes dir))) + (unless (zerop (logand (or modes 0) #o077)) + (format "it is accessible by others (%03o)" modes)))) (t nil)))) (when unsafe (error "`%s' is not a safe directory because %s" commit b124cb8f30d575fcda97507c40f16a499640bcd5 Author: Paul Eggert Date: Mon Sep 16 17:22:48 2019 -0700 vc-cvs-revert: fix off-by-one file mode * lisp/vc/vc-cvs.el (vc-cvs-revert): 3950 (#o7556) is wrong as it keeps other-write but disables other-execute permissions. 3949 (#o7555) was intended here. Use octal notation for clarity. diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el index d84700fc17..a9e79d7956 100644 --- a/lisp/vc/vc-cvs.el +++ b/lisp/vc/vc-cvs.el @@ -440,7 +440,7 @@ REV is the revision to check out." (if vc-cvs-use-edit (vc-cvs-command nil 0 file "unedit") ;; Make the file read-only by switching off all w-bits - (set-file-modes file (logand (file-modes file) 3950))))) + (set-file-modes file (logand (file-modes file) #o7555))))) (defun vc-cvs-merge-file (file) "Accept a file merge request, prompting for revisions." commit 8635147ccba1fc8e1010010da8c3f8e467562f76 Author: Lars Ingebrigtsen Date: Tue Sep 17 01:39:37 2019 +0200 Fix imenu menu when we're auto-refreshing * lisp/imenu.el (imenu--make-index-alist): Don't add a *Refresh* item if we're auto-refreshing (bug#30449). diff --git a/lisp/imenu.el b/lisp/imenu.el index 5084fe61ef..9df597b4d6 100644 --- a/lisp/imenu.el +++ b/lisp/imenu.el @@ -510,8 +510,9 @@ See `imenu--index-alist' for the format of the index alist." "No items suitable for an index found in this buffer")) (or imenu--index-alist (setq imenu--index-alist (list nil))) - ;; Add a rescan option to the index. - (cons imenu--rescan-item imenu--index-alist)) + (unless imenu-auto-rescan + ;; Add a rescan option to the index. + (cons imenu--rescan-item imenu--index-alist))) (defvar imenu--cleanup-seen nil) commit 3a6b5e6ad0173dfe164640e8a09bf465f78836cb Author: Lars Ingebrigtsen Date: Tue Sep 17 01:26:43 2019 +0200 Add a new variable smtpmail-retries * doc/misc/smtpmail.texi (Server workarounds): Mention it (bug#34177). * lisp/mail/smtpmail.el (smtpmail-retries): New variable. (smtpmail-via-smtp): Use it. diff --git a/doc/misc/smtpmail.texi b/doc/misc/smtpmail.texi index b2fc90a337..7fa7b24e16 100644 --- a/doc/misc/smtpmail.texi +++ b/doc/misc/smtpmail.texi @@ -372,6 +372,13 @@ implement support for common requirements. @table @code +@item smtpmail-retries +@vindex smtpmail-retries +An SMTP server may return an error code saying that there's a +transient error (a @samp{4xx} code). In that case, smtpmail will try +to resend the message automatically, and the number of times it tries +before giving up is determined by this variable, which defaults to 10. + @item smtpmail-local-domain @vindex smtpmail-local-domain The variable @code{smtpmail-local-domain} controls the hostname sent diff --git a/etc/NEWS b/etc/NEWS index adb2b642ba..33a7d12b7e 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1164,7 +1164,8 @@ attempt when communicating with the SMTP server(s), the --- *** smtpmail will now try resending mail when getting a transient 4xx -error message from the SMTP server. +error message from the SMTP server. The new 'smtpmail-retries' +variable says how many times to retry. ** Footnote mode diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el index 57913c1f0f..802c9ba788 100644 --- a/lisp/mail/smtpmail.el +++ b/lisp/mail/smtpmail.el @@ -165,6 +165,13 @@ attempt." :type '(choice regexp (const :tag "None" nil)) :version "27.1") +(defcustom smtpmail-retries 10 + "The number of times smtpmail will retry sending when getting transient errors. +These are errors with a code of 4xx from the SMTP server, which +mean \"try again\"." + :type 'integer + :version "27.1") + ;; End of customizable variables. @@ -823,7 +830,7 @@ Returns an error if the server cannot be contacted." ) ((and (numberp (car result)) (<= 400 (car result) 499) - (< send-attempts 10)) + (< send-attempts smtpmail-retries)) (message "Got transient error code %s when sending; retrying attempt %d..." (car result) send-attempts) ;; Retry on getting a transient 4xx code; see commit 90ddad804a34b70af7d849f1fdd1f069a3c30f54 Author: Michał Kondraciuk Date: Tue Sep 17 01:13:08 2019 +0200 Allow `M-u' to work when editing fields in Customize * lisp/cus-edit.el (custom-notify): Allow more editing commands to work in the Customize buffers (bug#31205). Copyright-paperwork-exempt: yes diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index 8a8bad9113..2496963337 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -2212,7 +2212,12 @@ and `face'." (unless (eq state 'modified) (unless (memq state '(nil unknown hidden)) (widget-put widget :custom-state 'modified)) - (custom-magic-reset widget) + ;; Update the status text (usually from "STANDARD" to "EDITED + ;; bla bla" in the buffer after the command has run. Otherwise + ;; commands like `M-u' (that work on a region in the buffer) + ;; will upcase the wrong part of the buffer, since more text has + ;; been inserted before point. + (run-with-idle-timer 0.0 nil #'custom-magic-reset widget) (apply 'widget-default-notify widget args)))) (defun custom-redraw (widget) commit 603e70483b844201a46f13e0a9e7acf50d3fd273 Author: Lars Ingebrigtsen Date: Mon Sep 16 23:45:34 2019 +0200 Try resending when getting a transient 4xx SMTP code * lisp/mail/smtpmail.el (smtpmail-via-smtp): Try resending when getting a transient error message (bug#34177). diff --git a/etc/NEWS b/etc/NEWS index 12182694d1..adb2b642ba 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1162,6 +1162,10 @@ defining new 'cl-defmethod' of 'smtpmail-try-auth-method'. attempt when communicating with the SMTP server(s), the 'smtpmail-servers-requiring-authorization' variable can be used. +--- +*** smtpmail will now try resending mail when getting a transient 4xx +error message from the SMTP server. + ** Footnote mode *** Support Hebrew-style footnotes diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el index f6fd1cd65e..57913c1f0f 100644 --- a/lisp/mail/smtpmail.el +++ b/lisp/mail/smtpmail.el @@ -654,10 +654,12 @@ Returns an error if the server cannot be contacted." user-mail-address)))) (defun smtpmail-via-smtp (recipient smtpmail-text-buffer - &optional ask-for-password) + &optional ask-for-password + send-attempts) (unless smtpmail-smtp-server (smtpmail-query-smtp-server)) (let ((process nil) + (send-attempts (or send-attempts 1)) (host (or smtpmail-smtp-server (error "`smtpmail-smtp-server' not defined"))) (port smtpmail-smtp-service) @@ -819,6 +821,23 @@ Returns an error if the server cannot be contacted." ((smtpmail-ok-p (setq result (smtpmail-read-response process))) ;; Success. ) + ((and (numberp (car result)) + (<= 400 (car result) 499) + (< send-attempts 10)) + (message "Got transient error code %s when sending; retrying attempt %d..." + (car result) send-attempts) + ;; Retry on getting a transient 4xx code; see + ;; https://tools.ietf.org/html/rfc5321#section-4.2.1 + (ignore-errors + (smtpmail-send-command process "QUIT") + (smtpmail-read-response process)) + (delete-process process) + (sleep-for 1) + (setq process nil) + (throw 'done + (smtpmail-via-smtp recipient smtpmail-text-buffer + ask-for-password + (1+ send-attempts)))) ((and auth-mechanisms (not ask-for-password) (eq (car result) 530)) commit 2c2f0eb9fcdfb644c106679999501b9c7edf51e2 Author: Paul Eggert Date: Mon Sep 16 14:04:04 2019 -0700 Remove obsolete Lint directives Most of the directives were wrong anyway. Apparently traditional lint hasn’t been used to check Emacs for years. * src/callint.c (Finteractive): * src/cm.c (evalcost): * src/emacs.c (main): * src/eval.c (call1, call2, call3, call4, call5, call6, call7, call8): * src/fns.c (concat2, concat3, nconc2): * src/term.c (calculate_ins_del_char_costs): Omit ARGSUSED comments. * src/eval.c (call1): Omit VARARGS comment. diff --git a/src/callint.c b/src/callint.c index d76836f32b..449b504860 100644 --- a/src/callint.c +++ b/src/callint.c @@ -35,7 +35,6 @@ static Lisp_Object point_marker; /* String for the prompt text used in Fcall_interactively. */ static Lisp_Object callint_message; -/* ARGSUSED */ DEFUN ("interactive", Finteractive, Sinteractive, 0, UNEVALLED, 0, doc: /* Specify a way of parsing arguments for interactive use of a function. For example, write diff --git a/src/cm.c b/src/cm.c index e09216a854..7947d3565c 100644 --- a/src/cm.c +++ b/src/cm.c @@ -30,7 +30,6 @@ along with GNU Emacs. If not, see . */ int cost; /* sums up costs */ -/* ARGSUSED */ int evalcost (int c) { diff --git a/src/emacs.c b/src/emacs.c index 5a526687b1..558dd11a35 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -923,7 +923,6 @@ load_pdump (int argc, char **argv) } #endif /* HAVE_PDUMPER */ -/* ARGSUSED */ int main (int argc, char **argv) { diff --git a/src/eval.c b/src/eval.c index 06d5c63f7f..2bfc16eae0 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1890,7 +1890,6 @@ verror (const char *m, va_list ap) /* Dump an error message; called like printf. */ -/* VARARGS 1 */ void error (const char *m, ...) { @@ -2649,7 +2648,6 @@ call0 (Lisp_Object fn) } /* Call function fn with 1 argument arg1. */ -/* ARGSUSED */ Lisp_Object call1 (Lisp_Object fn, Lisp_Object arg1) { @@ -2657,7 +2655,6 @@ call1 (Lisp_Object fn, Lisp_Object arg1) } /* Call function fn with 2 arguments arg1, arg2. */ -/* ARGSUSED */ Lisp_Object call2 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2) { @@ -2665,7 +2662,6 @@ call2 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2) } /* Call function fn with 3 arguments arg1, arg2, arg3. */ -/* ARGSUSED */ Lisp_Object call3 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3) { @@ -2673,7 +2669,6 @@ call3 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3) } /* Call function fn with 4 arguments arg1, arg2, arg3, arg4. */ -/* ARGSUSED */ Lisp_Object call4 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, Lisp_Object arg4) @@ -2682,7 +2677,6 @@ call4 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, } /* Call function fn with 5 arguments arg1, arg2, arg3, arg4, arg5. */ -/* ARGSUSED */ Lisp_Object call5 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, Lisp_Object arg4, Lisp_Object arg5) @@ -2691,7 +2685,6 @@ call5 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, } /* Call function fn with 6 arguments arg1, arg2, arg3, arg4, arg5, arg6. */ -/* ARGSUSED */ Lisp_Object call6 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, Lisp_Object arg4, Lisp_Object arg5, Lisp_Object arg6) @@ -2700,7 +2693,6 @@ call6 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, } /* Call function fn with 7 arguments arg1, arg2, arg3, arg4, arg5, arg6, arg7. */ -/* ARGSUSED */ Lisp_Object call7 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, Lisp_Object arg4, Lisp_Object arg5, Lisp_Object arg6, Lisp_Object arg7) @@ -2710,7 +2702,6 @@ call7 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, /* Call function fn with 8 arguments arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8. */ -/* ARGSUSED */ Lisp_Object call8 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, Lisp_Object arg4, Lisp_Object arg5, Lisp_Object arg6, Lisp_Object arg7, diff --git a/src/fns.c b/src/fns.c index df921e28f3..f45c729cfa 100644 --- a/src/fns.c +++ b/src/fns.c @@ -532,14 +532,12 @@ Do NOT use this function to compare file names for equality. */) static Lisp_Object concat (ptrdiff_t nargs, Lisp_Object *args, enum Lisp_Type target_type, bool last_special); -/* ARGSUSED */ Lisp_Object concat2 (Lisp_Object s1, Lisp_Object s2) { return concat (2, ((Lisp_Object []) {s1, s2}), Lisp_String, 0); } -/* ARGSUSED */ Lisp_Object concat3 (Lisp_Object s1, Lisp_Object s2, Lisp_Object s3) { @@ -2577,7 +2575,6 @@ This makes STRING unibyte and may change its length. */) return Qnil; } -/* ARGSUSED */ Lisp_Object nconc2 (Lisp_Object s1, Lisp_Object s2) { diff --git a/src/term.c b/src/term.c index a88d47f923..5f70c7a3d4 100644 --- a/src/term.c +++ b/src/term.c @@ -1084,7 +1084,6 @@ int *char_ins_del_vector; #define char_ins_del_cost(f) (&char_ins_del_vector[FRAME_COLS ((f))]) -/* ARGSUSED */ static void calculate_ins_del_char_costs (struct frame *f) { commit 57ac6523af76efe6f6767c5480b2832cdd3adc4d Author: Tino Calancha Date: Mon Sep 16 22:57:25 2019 +0200 Add backquote tests * test/lisp/emacs-lisp/backquote-tests.el: New file (bug#37432). diff --git a/test/lisp/emacs-lisp/backquote-tests.el b/test/lisp/emacs-lisp/backquote-tests.el new file mode 100644 index 0000000000..01f2c4a897 --- /dev/null +++ b/test/lisp/emacs-lisp/backquote-tests.el @@ -0,0 +1,47 @@ +;;; backquote-tests.el --- Tests for backquote.el -*- lexical-binding: t -*- + +;; Copyright (C) 2019 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;;; Code: + +(require 'ert) + +(ert-deftest backquote-test-basic () + (let ((lst '(ba bb bc)) + (vec [ba bb bc])) + (should (equal 3 `,(eval '(+ x y) '((x . 1) (y . 2))))) + (should (equal vec `[,@lst])) + (should (equal `(a lst c) '(a lst c))) + (should (equal `(a ,lst c) '(a (ba bb bc) c))) + (should (equal `(a ,@lst c) '(a ba bb bc c))) + ;; Vectors work just like lists. + (should (equal `(a vec c) '(a vec c))) + (should (equal `(a ,vec c) '(a [ba bb bc] c))) + (should (equal `(a ,@vec c) '(a ba bb bc c))))) + +(ert-deftest backquote-test-nested () + "Test nested backquotes." + (let ((lst '(ba bb bc)) + (vec [ba bb bc])) + (should (equal `(a ,`(,@lst) c) `(a ,lst c))) + (should (equal `(a ,`[,@lst] c) `(a ,vec c))) + (should (equal `(a ,@`[,@lst] c) `(a ,@lst c))))) + +;;; backquote-tests.el ends here commit 2335704fccc2a5088c864bea1f10b4f0ef788e6b Author: Paul Eggert Date: Mon Sep 16 13:54:57 2019 -0700 directory-files cleanup and speed tweaking * src/dired.c (directory_files_internal): Check ‘match’ before doing anything heavyweight. Move decls closer to use. Remove obsolete comments about GC. No need to encode ‘directory’ or to call multibyte_chars_in_text. Remove no-longer-needed bug check. Skip finalname construction if file_attributes fails. diff --git a/src/dired.c b/src/dired.c index cec79ab46b..5fc6ccd3ea 100644 --- a/src/dired.c +++ b/src/dired.c @@ -167,28 +167,19 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, Lisp_Object match, Lisp_Object nosort, bool attrs, Lisp_Object id_format) { - ptrdiff_t directory_nbytes; - Lisp_Object list, dirfilename, encoded_directory; - bool needsep = 0; - ptrdiff_t count = SPECPDL_INDEX (); -#ifdef WINDOWSNT - Lisp_Object w32_save = Qnil; -#endif + if (!NILP (match)) + CHECK_STRING (match); /* Don't let the compiler optimize away all copies of DIRECTORY, which would break GC; see Bug#16986. */ Lisp_Object volatile directory_volatile = directory; - /* Because of file name handlers, these functions might call - Ffuncall, and cause a GC. */ - list = encoded_directory = dirfilename = Qnil; - dirfilename = Fdirectory_file_name (directory); + Lisp_Object dirfilename = Fdirectory_file_name (directory); /* Note: ENCODE_FILE and DECODE_FILE can GC because they can run run_pre_post_conversion_on_str which calls Lisp directly and indirectly. */ Lisp_Object encoded_dirfilename = ENCODE_FILE (dirfilename); - encoded_directory = ENCODE_FILE (directory); int fd; DIR *d = open_directory (dirfilename, encoded_dirfilename, &fd); @@ -196,9 +187,11 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, /* Unfortunately, we can now invoke expand-file-name and file-attributes on filenames, both of which can throw, so we must do a proper unwind-protect. */ + ptrdiff_t count = SPECPDL_INDEX (); record_unwind_protect_ptr (directory_files_internal_unwind, d); #ifdef WINDOWSNT + Lisp_Object w32_save = Qnil; if (attrs) { /* Do this only once to avoid doing it (in w32.c:stat) for each @@ -218,89 +211,63 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, } #endif - directory_nbytes = SBYTES (directory); + ptrdiff_t directory_nbytes = SBYTES (directory); re_match_object = Qt; /* Decide whether we need to add a directory separator. */ - if (directory_nbytes == 0 - || !IS_ANY_SEP (SREF (directory, directory_nbytes - 1))) - needsep = 1; + bool needsep = (directory_nbytes == 0 + || !IS_ANY_SEP (SREF (directory, directory_nbytes - 1))); /* Windows users want case-insensitive wildcards. */ - Lisp_Object case_table = + Lisp_Object case_table = Qnil; #ifdef WINDOWSNT - BVAR (&buffer_defaults, case_canon_table) -#else - Qnil + case_table = BVAR (&buffer_defaults, case_canon_table); #endif - ; - if (!NILP (match)) - CHECK_STRING (match); - - /* Loop reading directory entries. */ + /* Read directory entries and accumulate them into LIST. */ + Lisp_Object list = Qnil; for (struct dirent *dp; (dp = read_dirent (d, directory)); ) { ptrdiff_t len = dirent_namelen (dp); Lisp_Object name = make_unibyte_string (dp->d_name, len); Lisp_Object finalname = name; - /* Note: DECODE_FILE can GC; it should protect its argument, - though. */ + /* This can GC. */ name = DECODE_FILE (name); - len = SBYTES (name); - /* Now that we have unwind_protect in place, we might as well - allow matching to be interrupted. */ maybe_quit (); - bool wanted = (NILP (match) || - fast_string_match_internal ( - match, name, case_table) >= 0); + if (!NILP (match) + && fast_string_match_internal (match, name, case_table) < 0) + continue; - if (wanted) + Lisp_Object fileattrs; + if (attrs) { - if (!NILP (full)) - { - Lisp_Object fullname; - ptrdiff_t nbytes = len + directory_nbytes + needsep; - ptrdiff_t nchars; - - fullname = make_uninit_multibyte_string (nbytes, nbytes); - memcpy (SDATA (fullname), SDATA (directory), - directory_nbytes); - - if (needsep) - SSET (fullname, directory_nbytes, DIRECTORY_SEP); - - memcpy (SDATA (fullname) + directory_nbytes + needsep, - SDATA (name), len); - - nchars = multibyte_chars_in_text (SDATA (fullname), nbytes); - - /* Some bug somewhere. */ - if (nchars > nbytes) - emacs_abort (); - - STRING_SET_CHARS (fullname, nchars); - if (nchars == nbytes) - STRING_SET_UNIBYTE (fullname); - - finalname = fullname; - } - else - finalname = name; + fileattrs = file_attributes (fd, dp->d_name, directory, name, + id_format); + if (NILP (fileattrs)) + continue; + } - if (attrs) - { - Lisp_Object fileattrs - = file_attributes (fd, dp->d_name, directory, name, id_format); - if (!NILP (fileattrs)) - list = Fcons (Fcons (finalname, fileattrs), list); - } - else - list = Fcons (finalname, list); + if (!NILP (full)) + { + ptrdiff_t name_nbytes = SBYTES (name); + ptrdiff_t nbytes = directory_nbytes + needsep + name_nbytes; + ptrdiff_t nchars = SCHARS (directory) + needsep + SCHARS (name); + finalname = make_uninit_multibyte_string (nchars, nbytes); + if (nchars == nbytes) + STRING_SET_UNIBYTE (finalname); + memcpy (SDATA (finalname), SDATA (directory), directory_nbytes); + if (needsep) + SSET (finalname, directory_nbytes, DIRECTORY_SEP); + memcpy (SDATA (finalname) + directory_nbytes + needsep, + SDATA (name), name_nbytes); } + else + finalname = name; + + list = Fcons (attrs ? Fcons (finalname, fileattrs) : finalname, list); } closedir (d); @@ -330,14 +297,14 @@ If MATCH is non-nil, mention only file names that match the regexp MATCH. If NOSORT is non-nil, the list is not sorted--its order is unpredictable. Otherwise, the list returned is sorted with `string-lessp'. NOSORT is useful if you plan to sort the result yourself. */) - (Lisp_Object directory, Lisp_Object full, Lisp_Object match, Lisp_Object nosort) + (Lisp_Object directory, Lisp_Object full, Lisp_Object match, + Lisp_Object nosort) { - Lisp_Object handler; directory = Fexpand_file_name (directory, Qnil); /* If the file name has special constructs in it, call the corresponding file name handler. */ - handler = Ffind_file_name_handler (directory, Qdirectory_files); + Lisp_Object handler = Ffind_file_name_handler (directory, Qdirectory_files); if (!NILP (handler)) return call5 (handler, Qdirectory_files, directory, full, match, nosort); @@ -365,14 +332,15 @@ ID-FORMAT specifies the preferred format of attributes uid and gid, see `file-attributes' for further documentation. On MS-Windows, performance depends on `w32-get-true-file-attributes', which see. */) - (Lisp_Object directory, Lisp_Object full, Lisp_Object match, Lisp_Object nosort, Lisp_Object id_format) + (Lisp_Object directory, Lisp_Object full, Lisp_Object match, + Lisp_Object nosort, Lisp_Object id_format) { - Lisp_Object handler; directory = Fexpand_file_name (directory, Qnil); /* If the file name has special constructs in it, call the corresponding file name handler. */ - handler = Ffind_file_name_handler (directory, Qdirectory_files_and_attributes); + Lisp_Object handler + = Ffind_file_name_handler (directory, Qdirectory_files_and_attributes); if (!NILP (handler)) return call6 (handler, Qdirectory_files_and_attributes, directory, full, match, nosort, id_format); @@ -1032,7 +1000,8 @@ file_attributes (int fd, char const *name, INT_TO_INTEGER (s.st_dev)); } -DEFUN ("file-attributes-lessp", Ffile_attributes_lessp, Sfile_attributes_lessp, 2, 2, 0, +DEFUN ("file-attributes-lessp", Ffile_attributes_lessp, + Sfile_attributes_lessp, 2, 2, 0, doc: /* Return t if first arg file attributes list is less than second. Comparison is in lexicographic order and case is significant. */) (Lisp_Object f1, Lisp_Object f2) commit 1a84d8fba4b526f7c8f240b8163e66714a41cca6 Author: Lars Ingebrigtsen Date: Mon Sep 16 22:31:29 2019 +0200 mm-inline-large-images-proportion doc clarification * lisp/gnus/mm-view.el (mm-inline-large-images-proportion): Doc clarification. diff --git a/lisp/gnus/mm-view.el b/lisp/gnus/mm-view.el index 6ffa1fc168..02d99200a3 100644 --- a/lisp/gnus/mm-view.el +++ b/lisp/gnus/mm-view.el @@ -65,8 +65,9 @@ :group 'mime-display) (defcustom mm-inline-large-images-proportion 0.9 - "Maximum proportion of large image resized when -`mm-inline-large-images' is set to resize." + "Maximum proportion large images can occupy in the buffer. +This is only used if `mm-inline-large-images' is set to +`resize'." :type 'float :version "24.1" :group 'mime-display) commit e46831507556639ecb9db2f864d4cb3a2c11ec4a Author: Lars Ingebrigtsen Date: Mon Sep 16 22:30:04 2019 +0200 Default to rescaling images in mm buffers * doc/misc/emacs-mime.texi (Display Customization): Document it. * lisp/gnus/mm-decode.el (mm-inline-large-images): Change default to `resize'. diff --git a/doc/misc/emacs-mime.texi b/doc/misc/emacs-mime.texi index 131a358ba5..8a1ba969ed 100644 --- a/doc/misc/emacs-mime.texi +++ b/doc/misc/emacs-mime.texi @@ -375,16 +375,13 @@ message as follows: @item mm-inline-large-images @vindex mm-inline-large-images -When displaying inline images that are larger than the window, Emacs -does not enable scrolling, which means that you cannot see the whole -image. To prevent this, the library tries to determine the image size -before displaying it inline, and if it doesn't fit the window, the -library will display it externally (e.g., with @samp{ImageMagick} or -@samp{xv}). Setting this variable to @code{t} disables this check and -makes the library display all inline images as inline, regardless of -their size. If you set this variable to @code{resize}, the image will -be displayed resized to fit in the window, if Emacs has the ability to -resize images. +This variable is @code{resize} by default, which means that images +that are bigger than the Emacs window are resized so that they fit. +If you set this to @code{nil}, large images are not displayed in +Emacs, but can instead be displayed externally (e.g., with +@samp{ImageMagick} or @samp{xv}). Setting this variable to @code{t} +disables this check and makes the library display all inline images as +inline, regardless of their size. @item mm-inline-large-images-proportion @vindex mm-inline-images-max-proportion diff --git a/etc/NEWS b/etc/NEWS index e7d054fd60..12182694d1 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1062,6 +1062,11 @@ See the concept index in the Gnus manual for the 'match-list' entry. +++ *** nil is no longer an allowed value for 'mm-text-html-renderer'. ++++ +The default value of 'mm-inline-large-images' has changed from nil to +'resize', which means that large images will be resized instead of +displayed with an external program by default. + +++ *** A new Gnus summary mode command, 'S A' ('gnus-summary-attach-article') can be used to attach the current diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el index a763e34785..5636b8eca4 100644 --- a/lisp/gnus/mm-decode.el +++ b/lisp/gnus/mm-decode.el @@ -381,10 +381,11 @@ enables you to choose manually one of two types those mails include." :type 'directory :group 'mime-display) -(defcustom mm-inline-large-images nil +(defcustom mm-inline-large-images 'resize "If nil, images larger than the window aren't displayed in the buffer. If `resize', try to resize the images so they fit in the buffer. If t, show the images as they are without resizing." + :version "27.1" :type '(radio (const :tag "Inline large images as they are." t) (const :tag "Resize large images." resize) commit f1e5877a6b2f577f85c893a8f05475e213a212c2 Author: Lars Ingebrigtsen Date: Mon Sep 16 22:22:54 2019 +0200 mm-inline-large-images doc string clarification * lisp/gnus/mm-decode.el (mm-inline-large-images): Clarify doc string. diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el index cba9633b53..a763e34785 100644 --- a/lisp/gnus/mm-decode.el +++ b/lisp/gnus/mm-decode.el @@ -382,8 +382,9 @@ enables you to choose manually one of two types those mails include." :group 'mime-display) (defcustom mm-inline-large-images nil - "If t, then all images fit in the buffer. -If `resize', try to resize the images so they fit." + "If nil, images larger than the window aren't displayed in the buffer. +If `resize', try to resize the images so they fit in the buffer. +If t, show the images as they are without resizing." :type '(radio (const :tag "Inline large images as they are." t) (const :tag "Resize large images." resize) commit f22346fe5abdbdac2ba5f690c11fda4d4f5d22d6 Author: Mauro Aranda Date: Mon Sep 16 22:17:51 2019 +0200 With tooltip-mode disabled, don't unconditionally clear the echo area * lisp/tooltip.el (tooltip-show-help-non-mode): Only clear the echo area when the current message displayed is a tooltip message (Bug#3192). diff --git a/lisp/tooltip.el b/lisp/tooltip.el index b1c69ae736..eac510ba7b 100644 --- a/lisp/tooltip.el +++ b/lisp/tooltip.el @@ -365,7 +365,10 @@ It is also called if Tooltip mode is on, for text-only displays." (let ((message-log-max nil)) (message "%s" tooltip-previous-message) (setq tooltip-previous-message nil))) - (t + ;; Only stop displaying the message when the current message is our own. + ;; This has the advantage of not clearing the echo area when + ;; running after an error message was displayed (Bug#3192). + ((equal-including-properties tooltip-help-message (current-message)) (message nil))))) (defun tooltip-show-help (msg) commit 72ad41c05994a67679c7bd54a3d73726bcca0597 Author: Lars Ingebrigtsen Date: Mon Sep 16 22:08:57 2019 +0200 Minor fix for previous maintaining.texi change * doc/emacs/maintaining.texi (VC Directory Commands): Use @file for files. diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index ae4b7bbaff..9a9957069f 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -1284,7 +1284,7 @@ listed files and directories. @item G Add the file under point to the list of files that the VC should ignore (@code{vc-dir-ignore}). For instance, if the VC is Git, it -will append this file to the @samp{.gitignore} file. If given a +will append this file to the @file{.gitignore} file. If given a prefix, do this with all the marked files. @item q commit dbf2f18f170d5de05a80b12fa538e14b540780a5 Author: Lars Ingebrigtsen Date: Mon Sep 16 22:02:19 2019 +0200 Document vc-dir-ignore * doc/emacs/maintaining.texi (VC Directory Commands): Document vc-dir-ignore. diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index e92a959d99..ae4b7bbaff 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -1281,6 +1281,12 @@ point is on a directory entry, mark all files in that directory tree (@code{vc-dir-mark-all-files}). With a prefix argument, mark all listed files and directories. +@item G +Add the file under point to the list of files that the VC should +ignore (@code{vc-dir-ignore}). For instance, if the VC is Git, it +will append this file to the @samp{.gitignore} file. If given a +prefix, do this with all the marked files. + @item q Quit the VC Directory buffer, and bury it (@code{quit-window}). commit facd6d5affaa897e7efe4018ede054489268b065 Author: Eli Zaretskii Date: Mon Sep 16 22:19:16 2019 +0300 Improve error reporting in file_accessible_directory_p * src/w32.c (w32_accessible_directory_p): Set errno, so that file_accessible_directory_p does on MS-Windows, to live up to its callers' expectations. diff --git a/src/w32.c b/src/w32.c index d7a91692c6..88e9aef338 100644 --- a/src/w32.c +++ b/src/w32.c @@ -4151,13 +4151,36 @@ w32_accessible_directory_p (const char *dirname, ptrdiff_t dirlen) /* In case DIRNAME cannot be expressed in characters from the current ANSI codepage. */ if (_mbspbrk (pat_a, "?")) - dh = INVALID_HANDLE_VALUE; - else - dh = FindFirstFileA (pat_a, &dfd_a); + { + errno = ENOENT; + return 0; + } + dh = FindFirstFileA (pat_a, &dfd_a); } if (dh == INVALID_HANDLE_VALUE) + { + DWORD w32err = GetLastError (); + + switch (w32err) + { + case ERROR_INVALID_NAME: + case ERROR_BAD_PATHNAME: + case ERROR_FILE_NOT_FOUND: + case ERROR_PATH_NOT_FOUND: + case ERROR_NO_MORE_FILES: + case ERROR_BAD_NETPATH: + errno = ENOENT; + break; + case ERROR_NOT_READY: + errno = ENODEV; + break; + default: + errno = EACCES; + break; + } return 0; + } FindClose (dh); return 1; } commit 169d04b8ac416c71a8b89a9c4a975d0f014265e0 Author: Eli Zaretskii Date: Mon Sep 16 17:51:25 2019 +0300 Fix initialization of shared-game-score-directory on MS-Windows * src/callproc.c (init_callproc) [WINDOWSNT]: Run PATH_GAME through w32_relocate, to expand %emacs_dir%. [DOS_NT]: Accept EACCES as not "unusual" errno value. Reported by Richard Copley . diff --git a/src/callproc.c b/src/callproc.c index 20e0bc50da..1ac0bdc710 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -1595,10 +1595,21 @@ init_callproc (void) Lisp_Object gamedir = Qnil; if (PATH_GAME) { - Lisp_Object path_game = build_unibyte_string (PATH_GAME); + const char *cpath_game = PATH_GAME; +#ifdef WINDOWSNT + /* On MS-Windows, PATH_GAME normally starts with a literal + "%emacs_dir%", so it will never work without some tweaking. */ + cpath_game = w32_relocate (cpath_game); +#endif + Lisp_Object path_game = build_unibyte_string (cpath_game); if (file_accessible_directory_p (path_game)) gamedir = path_game; - else if (errno != ENOENT && errno != ENOTDIR) + else if (errno != ENOENT && errno != ENOTDIR +#ifdef DOS_NT + /* DOS/Windows sometimes return EACCES for bad file names */ + && errno != EACCES +#endif + ) dir_warning ("game dir", path_game); } Vshared_game_score_directory = gamedir; commit 6684db8cea9793051e71460eba87312bab461d7f Author: Michael Albinus Date: Mon Sep 16 15:00:37 2019 +0200 ; Disable traces in shadowfile-tests diff --git a/test/lisp/shadowfile-tests.el b/test/lisp/shadowfile-tests.el index d09c15e991..7caddc53d7 100644 --- a/test/lisp/shadowfile-tests.el +++ b/test/lisp/shadowfile-tests.el @@ -64,7 +64,7 @@ "Temporary directory for Tramp tests.") (setq password-cache-expiry nil - shadow-debug t + shadow-debug nil tramp-verbose 0 tramp-message-show-message nil ;; On macOS, `temporary-file-directory' is a symlinked directory. commit dfc17fc02e9e9f724c8ec86e3fd3a91a5ff638f6 Author: Lars Ingebrigtsen Date: Mon Sep 16 14:32:17 2019 +0200 Remove NEWS entry that talks about a change that was reverted (bug#37257) diff --git a/etc/NEWS b/etc/NEWS index 1153daf9ac..e7d054fd60 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -196,10 +196,6 @@ the new version of the file again.) ** emacsclient -*** emacsclient no longer passes '--eval' arguments to an alternate editor. -Previously, '--eval' arguments were passed as file names to any -alternate editor started by '--alternate-editor'. - +++ *** emacsclient now supports an 'EMACS_SOCKET_NAME' environment variable. The command-line argument '--socket-name' overrides it.