Michael Albinus [Tue, 25 Feb 2020 12:25:57 +0000 (13:25 +0100)]
Finish implementation of {set-}file-modes FLAG arg in Tramp
* lisp/net/tramp-adb.el (tramp-adb-handle-file-local-copy): Do not use
'nofollow for temporary files. Use `tramp-compat-set-file-modes'.
(tramp-adb-handle-write-region): Do not use 'nofollow for
temporary files.
(tramp-adb-handle-set-file-modes): Implement FLAG.
* lisp/net/tramp-compat.el (tramp-compat-file-modes)
(tramp-compat-set-file-modes): New defaliases.
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-set-file-modes):
Make explicit check (eq flag 'nofollow).
* lisp/net/tramp-sh.el (tramp-sh-handle-set-file-modes): Implement FLAG.
(tramp-do-copy-or-rename-file-directly)
(tramp-sh-handle-file-local-copy, tramp-sh-handle-write-region):
Do not use 'nofollow for temporary files.
(tramp-get-remote-chmod-h): New defun.
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-set-file-modes):
Implement FLAG.
(tramp-sudoedit-handle-write-region): Use `tramp-compat-set-file-modes'.
* lisp/net/tramp.el (tramp-default-file-modes): Optional argument FLAG.
(tramp-handle-file-modes): Use `file-truename' instead of
`file-chase-links'. The latter function does not work for remote
file names.
(tramp-handle-write-region): Call `tramp-default-file-modes' with
'nofollow if needed. Do not use 'nofollow for temporary files.
* test/lisp/net/tramp-tests.el
(tramp--test-ignore-make-symbolic-link-error): Check also for
"Cannot chmod .* with nofollow flag" error.
(tramp-test20-file-modes): Extend test.
(tramp--test-emacs28-p): New defun.
Paul Eggert [Tue, 25 Feb 2020 01:55:00 +0000 (17:55 -0800)]
Update from Gnulib
This incorporates:
2020-02-24 getloadavg: don't use /usr/local when cross-compiling on AIX
2020-02-24 fcntl: add witness of gnulib override
* lib/fcntl.in.h, m4/getloadavg.m4: Copy from Gnulib.
Eli Zaretskii [Mon, 24 Feb 2020 16:16:51 +0000 (18:16 +0200)]
Adapt the MS-Windows build to 'nofollow' changes
* nt/gnulib-cfg.mk (OMIT_GNULIB_MODULE_fchmodat)
(OMIT_GNULIB_MODULE_lchmod): Set to true to omit building these
modules on MS-Windows.
* nt/mingw-cfg.site (ac_cv_func_fchmodat)
(gl_cv_func_fchmodat_works, ac_cv_func_lchmod): Disable tests on
MS-Windows.
* src/w32.c (chmod_worker, lchmod, fchmodat): New functions.
(sys_chmod): Move most of the code to chmod_worker.
* src/w32.h (fchmodat, lchmod): Add prototypes.
Paul Eggert [Mon, 24 Feb 2020 00:19:42 +0000 (16:19 -0800)]
Add 'nofollow' flag to set-file-modes etc.
This avoids some race conditions (Bug#39683). E.g., if some other
program changes a file to a symlink between the time Emacs creates
the file and the time it changes the file’s permissions, using the
new flag prevents Emacs from inadvertently changing the
permissions of a victim in some completely unrelated directory.
* admin/merge-gnulib (GNULIB_MODULES): Add fchmodat.
* doc/lispref/files.texi (Testing Accessibility, Changing Files):
* doc/lispref/os.texi (File Notifications):
* etc/NEWS:
Adjust documentation accordingly.
* lib/chmodat.c, lib/fchmodat.c, lib/lchmod.c, m4/fchmodat.m4:
* m4/lchmod.m4: New files, copied from Gnulib.
* lib/gnulib.mk.in: Regenerate.
* lisp/dired-aux.el (dired-do-chmod):
* lisp/doc-view.el (doc-view-make-safe-dir):
* lisp/emacs-lisp/autoload.el (autoload--save-buffer):
* lisp/emacs-lisp/bytecomp.el (byte-compile-file):
* lisp/eshell/em-pred.el (eshell-pred-file-mode):
* lisp/files.el (backup-buffer-copy, copy-directory):
* lisp/gnus/mail-source.el (mail-source-movemail):
* lisp/gnus/mm-decode.el (mm-display-external):
* lisp/gnus/nnmail.el (nnmail-write-region):
* lisp/net/tramp-adb.el (tramp-adb-handle-file-local-copy)
(tramp-adb-handle-write-region):
* lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-directly):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-write-region):
* lisp/net/tramp.el (tramp-handle-write-region)
(tramp-make-tramp-temp-file):
* lisp/server.el (server-ensure-safe-dir):
* lisp/url/url-util.el (url-make-private-file):
When getting or setting file modes, avoid following symbolic links
when the file is not supposed to be a symbolic link.
* lisp/doc-view.el (doc-view-make-safe-dir):
Omit no-longer-needed separate symlink test.
* lisp/gnus/gnus-util.el (gnus-set-file-modes):
* lisp/net/tramp.el (tramp-handle-file-modes):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-set-file-modes):
* src/fileio.c (symlink_nofollow_flag): New function.
(Ffile_modes, Fset_file_modes):
Support an optional FLAG arg. All C callers changed.
* lisp/net/ange-ftp.el (ange-ftp-set-file-modes):
* lisp/net/tramp-adb.el (tramp-adb-handle-set-file-modes):
* lisp/net/tramp-sh.el (tramp-sh-handle-set-file-modes):
* lisp/net/tramp-smb.el (tramp-smb-handle-set-file-modes):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-set-file-modes):
Accept an optional FLAG arg that is currently ignored,
and add a FIXME comment for it.
* m4/gnulib-comp.m4: Regenerate.
Wilson Snyder [Sun, 23 Feb 2020 22:18:08 +0000 (17:18 -0500)]
Add `verilog-auto-inst-template-required'.
* lisp/progmodes/verilog-mode.el (verilog-auto-inst-template-required)
(verilog-auto-inst): Add `verilog-auto-inst-template-required' to only
insert AUTOINST ports inside an AUTO_TEMPLATE, msg3170. Reported by Ted
Huang, Brian Magnuson.
Glenn Morris [Sun, 23 Feb 2020 15:50:33 +0000 (07:50 -0800)]
Merge from origin/emacs-27
ba7004b2a7 (origin/emacs-27) Shorten some ppss struct field names 693749c60f Java Mode: Fix fontification of variable decl inside `for' 884b68ca2c CC Mode: Fontify foo in "const auto foo :" correctly
Glenn Morris [Sun, 23 Feb 2020 15:50:28 +0000 (07:50 -0800)]
Merge from origin/emacs-27
dd5756436c Move more logic to vc-ignore from vc-default-ignore 2aed279be1 Warn about the likes of "[:alnum:]" in regexps 0273f261a7 Don't write absolute filenames and duplicate strings to CV... d7c22338d2 Fix cursor-sensor--detect when current buf != selected win... 2e39fc83bb * doc/emacs/sending.texi (Mail Sending): Fix index entries. b410f902d5 Document 'message-send-mail-function' in the Emacs manual ac0546612d Fix reference to 'message-send-and-exit' in Emacs manual cd6a9b8f65 Skip shell prompt on current line in Eshell even if it's p...
Alan Mackenzie [Sun, 23 Feb 2020 11:00:28 +0000 (11:00 +0000)]
CC Mode: Fontify foo in "const auto foo :" correctly
* lisp/progmodes/cc-engine.el (c-forward-decl-or-cast-1): While attempting to
find a declaration's identifier, recast the latest found id. as that
identifier when there is no other type identifier and the result of the most
recent c-forward-type call is 'maybe or 'found. In the latter case, remove
the id. from the found types list, too.
Dmitry Gutov [Sat, 22 Feb 2020 23:51:38 +0000 (01:51 +0200)]
Move more logic to vc-ignore from vc-default-ignore
* lisp/vc/vc-dir.el (vc-dir-ignore):
Pass relative file names to vc-ignore.
* lisp/vc/vc.el (vc-ignore): Move the responsibility of
constructing the ignore pattern (right now, most often a relative
file name) using a file name received from the user, here.
(vc-default-ignore): ...from here (bug#37189, see discussion).
Also clarify the docstring.
Paul Eggert [Sat, 22 Feb 2020 16:04:16 +0000 (08:04 -0800)]
Restore runtime check for invalid tag
* src/data.c (wrong_type_argument): Restore check that the
object’s tag is valid, since invalid tags exist again.
* src/lisp.h (Lisp_Type_Unused0): New constant.
Eli Zaretskii [Sat, 22 Feb 2020 09:07:42 +0000 (11:07 +0200)]
Warn about the likes of "[:alnum:]" in regexps
* doc/lispref/searching.texi (Char Classes): Warn about erroneous
usage of named character classes. Suggested by Stephen Leake
<stephen_leake@stephe-leake.org>.
Wolfgang Scherer [Fri, 21 Feb 2020 20:28:11 +0000 (21:28 +0100)]
Don't write absolute filenames and duplicate strings to CVS ignore files
* lisp/vc/vc-cvs.el (vc-cvs-ignore): Expand filename correctly
and pass on only the basename as the pattern.
(vc-cvs-append-to-ignore) Do not write duplicate strings to
.cvsignore. New optional parameter SORT to more explicitly
control sorting of the ignore entries. (Bug#37215)
* lisp/vc/pcvs.el (cvs-mode-ignore): Call 'vc-cvs-append-to-ignore'
with SORT argument.
Federico Tedin [Mon, 17 Feb 2020 21:24:40 +0000 (22:24 +0100)]
Allow tempo-define-template to reassign tags to new templates
* lisp/tempo.el (tempo-define-template): Update documentation string
to mention that existing tags can be reassigned new templates.
(tempo-add-tag): Allow reassigning tags to new templates.
Additionally, invalidate tag collections in all buffers if the global
tags list is being modified.
(tempo-invalidate-collection): Allow invalidating tag collections in
all buffers at the same time.
* test/lisp/tempo-tests.el (tempo-define-tag-globally-test): Add a
test to check that new templates plus tags can be defined from any
buffer and then immediately used in other buffers.
(tempo-overwrite-tag-test): Add a test to check that tags can be
reassigned templates.
* etc/NEWS: Announce changes in tempo.el.
Allen Li [Mon, 17 Feb 2020 07:55:43 +0000 (23:55 -0800)]
Document 'message-send-mail-function' in the Emacs manual
Most of the manual here addresses Message mode, yet talks about
'send-mail-function' which is used for Mail mode.
Fixing this completely requires more involved work, but for now at
least document the difference here.
Steven Allen [Sat, 15 Feb 2020 23:13:59 +0000 (15:13 -0800)]
Skip shell prompt on current line in Eshell even if it's protected
When the eshell prompt is protected (e.g., with rear non-sticky,
inhibited movements, etc.), 'beginning-of-line' won't move to the
actual beginning of the line and therefore won't skip over the
prompt.
* lisp/eshell/em-prompt.el (eshell-previous-prompt): Use
'forward-line' to go to the beginning of the line, even if it's
protected. (Bug#39627)
Make regexps smaller and faster by removing terms that are superfluous
by virtue of standing next to another term that matches more. See
https://lists.gnu.org/archive/html/emacs-devel/2020-01/msg00949.html
for details.
Kévin Le Gouguec [Thu, 20 Feb 2020 13:30:45 +0000 (14:30 +0100)]
Introduce face for <code> elements in shr
* lisp/net/shr.el (shr-tag-code): Don't use the `default' font,
because it has properties that will override surrounding elements
(like <a...>) (bug#39504).
Paul Eggert [Thu, 20 Feb 2020 01:21:16 +0000 (17:21 -0800)]
Fix bug when visiting euc-jp-encoded directories
Problem reported by Ken Sasaki (Bug#39672).
* src/fileio.c (Ffile_directory_p):
Encode filename before giving it to file_directory_p.
This fixes a typo introduced in
2019-09-18T02:18:14Z!eggert@cs.ucla.edu.
Paul Eggert [Wed, 19 Feb 2020 21:47:57 +0000 (13:47 -0800)]
Fix some file-modes races
* lisp/gnus/gnus-start.el (gnus-save-newsrc-file)
(gnus-slave-save-newsrc):
* lisp/gnus/gnus-uu.el (gnus-uu-initialize):
* lisp/gnus/mm-archive.el (mm-dissect-archive):
* lisp/gnus/mm-decode.el (mm-temp-files-delete)
(mm-display-external):
* lisp/image-dired.el (image-dired-create-thumb-1):
Use with-file-modes rather than setting the file modes later.
This fixes some race conditions where the file temporarily
has the wrong permissions.
* lisp/gnus/mml.el (mml-expand-all-html-into-multipart-related):
New function (bug#39230).
(mml-generate-mime): Use it to expand all HTML parts, no matter
where in the MIME tree.
Alan Third [Fri, 14 Feb 2020 20:08:40 +0000 (20:08 +0000)]
Fix horizontal bit shifting
* src/nsterm.m ([EmacsView copyRect:to:]): Calculate the horizontal
difference instead of just the vertical.
([EmacsView updateLayer]): Fix NSTRACE message.
Juri Linkov [Tue, 18 Feb 2020 23:35:03 +0000 (01:35 +0200)]
Support state changing VC operations in dired-mode on files (bug#34949)
* lisp/vc/vc.el (vc-deduce-fileset): Don't error out when observer is nil.
(vc-dired-deduce-fileset): Add optional args 'state-model-only-files'
and 'observer'. Check that all files are in a consistent state
when state-model-only-files is non-nil. Error out on directories.
* lisp/vc/vc-dispatcher.el (vc-dispatcher-browsing): Check dired-mode
for derived-mode-p.
Make OMake support slightly less expensive (bug#39595)
When run with -p or -P, OMake regurgitates error messages that
prevented further progress, indented by 6 spaces. Use that fact
to ameliorate the modification done to other error message regexps.
* lisp/progmodes/compile.el (compilation-parse-errors):
When 'omake' is enabled, allow error messages to be indented by 0 or 6
spaces instead of any number of spaces, to avoid pathological
behaviour.
(compilation-error-regexp-alist-alist): Anchor the 'omake' pattern to
bol for performance. Repair the 'ruby-Test::Unit' pattern, which
relied on the previously over-generous 'omake' hack.
* etc/compilation.txt (OMake): Add examples.
* test/lisp/progmodes/compile-tests.el (compile-tests--test-regexps-data)
(compile-test-error-regexps): Add test for OMake (indented error).
Speed up 'msft' and 'watcom' compilation error regexps
They have similar structure, and both suffer from being able to
match leading spaces in multiple ways which leads to bad performance
when backtracking (bug#39595).
* lisp/progmodes/compile.el (compilation-error-regexp-alist-alist):
Improved 'msft' and 'watcom' regexps.
Anchor the regexp at line-start to prevent quadratic behaviour when
it doesn't match (bug#39595). It's unclear whether the type tag, like
[ERROR], is always present; we keep it optional just in case.
* lisp/progmodes/compile.el (compilation-error-regexp-alist-alist):
Rewrite 'maven' regexp, using rx for clarity.
* etc/compilation.txt (maven): More examples.
* test/lisp/progmodes/compile-tests.el
(compile-tests--test-regexps-data): No leading spaces; they seems to
stem from a misunderstanding in bug#11517.
Paul Eggert [Sun, 16 Feb 2020 19:36:19 +0000 (11:36 -0800)]
Improve C-h C-h bug fix
* src/lread.c (read1): Guard against two 'struct Lisp_Vector *'
pointers differing only in their most significant bit. Problem
reported by Pip Cet (Bug#39529#22).
Alan Mackenzie [Sun, 16 Feb 2020 17:46:02 +0000 (17:46 +0000)]
Amend c-backward-sws better to handle multiline block comments
In particular, multiline comments lacking escaped newlines.
* lisp/progmodes/cc-engine.el (c-backward-sws): Whilst searching backward for
a putative beginning of macro, move back over block comments whose innards
lack escaped newlines.
Glenn Morris [Sun, 16 Feb 2020 15:50:36 +0000 (07:50 -0800)]
Merge from origin/emacs-27
7ceb45f61f (origin/emacs-27) Reformulate c-end-of-macro, handling mul... 888ffd960c Fix unexec failure on macOS 10.15.4 b392c9f365 Fix 'reverse-region' when less than one line is in region 7448834f73 Correct default regexp in 'package-menu-hide-package' faada7ca42 Remove obsolete menu entry "Redisplay buffer" 78d76cd93c Remove redundant 'msft' compilation error rule (bug#39595) 75a9eee8b8 ; * src/editfns.c (Fbuffer_size): Tiny clarification. 4d8d25d641 * doc/lispref/variables.texi (special-variable-p): Clarify... 9f6a4bbcc9 Remove the optional KEEP-ORDER argument to regexp-opt d1e8ce8bb6 Make after-change-functions called from call-process get t...
* lisp/progmodes/cc-engine.el (c-end-of-macro): Handle multiline block
comments lacking escaped newlines using parse-partial-sexp rather than the
former variables removed from cc-langs.el.
Paul Eggert [Sat, 15 Feb 2020 23:12:34 +0000 (15:12 -0800)]
Fix C-h C-h bug due to mutating a hash key
Problem reported by Federico Tedin (Bug#39529).
The problem was that dumping uses a hash table based on 'equal'
when purecopying compiled objects, but then modifies the compiled
objects while they are keys in the table. This no-no was uncovered
by the sxhash fixes in 2020-01-07T19:23:11Z!eggert@cs.ucla.edu.
Eli Zaretski pinpointed the patch that triggered the bug.
* src/lread.c (read1): When reading a compiled object, replace
its docstring with a unique negative integer instead of with 0,
so that purecopy doesn’t unify it with some other compiled object
that happens to have the same Lisp code.
Eli Zaretskii [Sat, 15 Feb 2020 08:47:08 +0000 (10:47 +0200)]
Fix 'reverse-region' when less than one line is in region
* lisp/sort.el (reverse-region): Signal a user-error if the region
includes less than one full line, thus avoiding an inadvertent
deletion of text following the current line. Fix the doc string.
Fix comments to start with a capital letter. (Bug#39376)
* lisp/emacs-lisp/package.el (package-menu-mode-menu): Remove obsolete
menu entry "Redisplay buffer".
(package-menu-mode-menu): Menu entry "Refresh Package List":
make the doc string more accurate.
(Bug#39436)
Eric Abrahamsen [Fri, 14 Feb 2020 19:56:58 +0000 (11:56 -0800)]
When searching a topic in Gnus, search all topic's groups
Bug#39515
* lisp/gnus/nnir.el (gnus-group-make-nnir-group): Bring the code in
line with the documentation, which says that all topic groups will be
searched, even if they're not visible.
Stefan Monnier [Fri, 14 Feb 2020 16:18:00 +0000 (11:18 -0500)]
* src/lread.c: Remove old-style backquotes support
(new_backquote_flag): Delete variable.
(load_error_old_style_backquotes): Delete function.
(force_new_style_backquotes): Delete variable.
(read_internal_start): Don't obey it any more.
Alan Third [Sat, 1 Feb 2020 21:17:29 +0000 (21:17 +0000)]
Use CGImage instead of NSBitmapImageRep (bug#32932)
* src/nsterm.m (ns_update_end):
(ns_clear_frame): Remove forced draws.
(ns_draw_fringe_bitmap):
(ns_dumpglyphs_image): No longer need to invert images as the context
is already flipped.
([EmacsView updateFrameSize:]):
([EmacsView initFrameFromEmacs:]): Use new function.
([EmacsView createDrawingBuffer]): Replaces createDrawingBufferWithRect:.
([EmacsView focusOnDrawingBuffer]): Set CGImage context.
([EmacsView windowDidChangeBackingProperties:]): Use new function.
([EmacsView copyRect:to:]): Copy using CGImages.
([EmacsView wantsUpdateLayer]):
([EmacsView updateLayer]): New Functions.
([EmacsView drawRect:]): We no longer do anything special here for
Cocoa.
([EmacsView windowDidChangeBackingProperties:]): Fix indentation and
add NSTRACE.
Glenn Morris [Thu, 13 Feb 2020 15:50:30 +0000 (07:50 -0800)]
Merge from origin/emacs-27
0304f53076 (origin/emacs-27) doc/misc/org.texi: Fix @dircategory 027da652a4 Fix display of minibuffer prompt in ido.el 5a21aaff46 rx: Use longest match for all-string 'or' forms (bug#37659) 2b12c2b6f2 Make sure not to mark directories ff4ed4a0ff ; Add a TODO 3a5129a1c9 vc-hg-dir-status-files: Fix when DIR is not repository root
Glenn Morris [Thu, 13 Feb 2020 15:50:24 +0000 (07:50 -0800)]
Merge from origin/emacs-27
ad5e350ab7 c-end-of-macro: Handle block coment lines with unescaped N... 06c302d425 Fix set-fontset-font with ADD arg non-nil 530067463b Correct "different than" to "different from" where appropr... 56b8768b32 More accurate documentation of 'package-menu-hide-package'
Eli Zaretskii [Wed, 12 Feb 2020 19:39:44 +0000 (21:39 +0200)]
Fix display of minibuffer prompt in ido.el
* lisp/minibuffer.el (minibuffer--message-overlay-pos): New
function.
(set-minibuffer-message): Use it to determine where to show the
overlay with the temporary message.
* lisp/ido.el (ido-exhibit): Revert "Render Ido suggestions using
an overlay"; this restores the original code which inserted the
match-status information into the minibuffer, instead of
displaying it in an overlay with an after-string. Put the special
'minibuffer-message' text property at the beginning of the
inserted text. (Bug#39379)
* etc/NEWS:
* doc/lispref/display.texi (Displaying Messages):
* doc/lispref/text.texi (Special Properties): Document the
'minibuffer-message' text property and its effect.
Michael Albinus [Wed, 12 Feb 2020 19:26:47 +0000 (20:26 +0100)]
Fix Tramp tests towards *BSD
* test/lisp/net/tramp-tests.el (tramp-get-remote-gid): Declare.
(tramp-test18-file-attributes): Check `file-ownership-preserved-p'
only if possible.
(tramp-test30-make-process): Modify test due to *BSD.
rx: Use longest match for all-string 'or' forms (bug#37659)
Revert to the Emacs 26 semantics that always gave the longest match
for rx 'or' forms with only string arguments. This guarantee was
never well documented, but it is useful and people likely have come to
rely on it. For example, prior to this change,
(rx (or ">" ">="))
matched ">" even if the text contained ">=".
* lisp/emacs-lisp/rx.el (rx--translate-or): Don't tell regexp-opt to
preserve the matching order.
* doc/lispref/searching.texi (Rx Constructs): Document the
longest-match guarantee for all-string 'or' forms.
* test/lisp/emacs-lisp/rx-tests.el (rx-or): Update test.