Paul Eggert [Sun, 4 Aug 2019 18:39:03 +0000 (11:39 -0700)]
Fix 2019-08-04 regex lint
Problem reported by Mattias Engdegård in:
https://lists.gnu.org/r/emacs-devel/2019-08/msg00085.html
* lisp/calendar/diary-lib.el (diary-glob-file-regexp-prefix):
Omit unnecessary ‘\’ before ordinary char.
* lisp/cedet/inversion.el (inversion-decoders):
* lisp/org/ob-haskell.el (org-babel-haskell-export-to-lhs):
Omit unnecessary ‘?’ after nullable pattern.
* lisp/org/org-capture.el (org-capture-fill-template):
Match upper-case as well as lower-case letters.
* lisp/progmodes/cc-mode.el (c-before-change-check-unbalanced-strings)
(c-after-change-mark-abnormal-strings):
Simplify ‘.|\r’ to ‘.’.
* lisp/progmodes/gdb-mi.el (gdb-jsonify-buffer):
Put ‘-’ at end of bracket expression.
Paul Eggert [Sun, 4 Aug 2019 17:04:18 +0000 (10:04 -0700)]
Tweak time arithmetic performance
* src/timefns.c (lispint_arith): New function, which
should be a bit faster if B is 0, or if A is a bignum
and B a fixnum with absolute value in unsigned long range.
(time_arith): Use it.
Paul Eggert [Sun, 4 Aug 2019 16:57:27 +0000 (09:57 -0700)]
Improve time function doc
* doc/misc/emacs-mime.texi (time-date): Don’t give
parse-iso8601-time-string in the example, as the function is
not autoloaded.
* lisp/gnus/nndiary.el (nndiary-compute-reminders):
No need to call encode-time or use floating point here.
Eli Zaretskii [Sun, 4 Aug 2019 16:38:08 +0000 (19:38 +0300)]
Fix the MS-Windows build broken by recent changes
* src/inotify.c (syms_of_inotify) <Qignored>: Don't define here...
* src/coding.c (syms_of_coding) <Qignored>: ...define it here,
because it is needed also on platforms that don't compile
inotify.c.
Martin Rudalics [Sun, 4 Aug 2019 07:21:18 +0000 (09:21 +0200)]
Fix two mouse drag and drop issues (Bug#28620, Bug#36269)
Allow 'mouse-drag-and-drop-region' to move/copy text from one
frame to another (Bug#28620). Prevent mouse avoidance mode from
interfering with 'mouse-drag-and-drop-region' (Bug#36269).
* lisp/avoid.el (mouse-avoidance-ignore-p): Suspend avoidance
when 'track-mouse' equals 'dropping'.
* lisp/mouse.el (mouse-drag-and-drop-region): Set
'track-mouse' to 'dropping'. Continue reading events also
when switching frames.
* src/keyboard.c (Finternal_track_mouse): Rename from
Ftrack_mouse.
(some_mouse_moved): Return NULL also when mouse is not tracked.
(show_help_echo, readable_events, kbd_buffer_get_event): Don't
check whether mouse is tracked, some_mouse_moved does it now.
(track_mouse): Rename variable from do_mouse_tracking. Adjust
all users. In doc-string explain meanings of special values
'dragging' and 'dropping'.
* src/nsterm.m (ns_mouse_position): During drag and drop
consider last mouse frame only when there is no currently
focused frame.
* src/w32fns.c (w32_wnd_proc): Don't set mouse capture during a
drag and drop operation.
* src/w32term.c (w32_mouse_position): Track frame under mouse
during mouse drag and drop.
(mouse_or_wdesc_frame): New function.
(w32_read_socket): Call mouse_or_wdesc_frame on mouse events.
* src/xdisp.c (define_frame_cursor1): Don't change mouse cursor
shape during mouse drag and drop.
(syms_of_xdisp): New symbol Qdropping.
* src/xterm.c (XTmouse_position): Allow mouse drag and drop move
to another frame
(mouse_or_wdesc_frame): New function.
(handle_one_xevent): Use mouse_or_wdesc_frame for mouse events.
Eric Abrahamsen [Sun, 4 Aug 2019 00:01:52 +0000 (17:01 -0700)]
Fix Gnus group name reference in gnus-mark-xrefs-as-read
* lisp/gnus/gnus-sum.el (gnus-mark-xrefs-as-read): There's already a
local binding for "group", don't need another "name". This was left
over from the obarray-to-hashtable change.
Eric Abrahamsen [Fri, 7 Jun 2019 03:43:27 +0000 (20:43 -0700)]
Temporarily preserve encoded Gnus group names in Gnus files
Non-ascii Gnus groups should be written to files in their encoded
version until we're ready to bump Gnus' version and add an upgrade
routine.
* lisp/gnus/gnus-start.el (gnus-gnus-to-quick-newsrc-format):
* lisp/gnus/gnus-agent.el (gnus-category-read):
(gnus-category-write): Handle non-ascii group names appropriately.
* lisp/gnus/gnus-registry.el (gnus-registry--munge-group-names): New
function to encode/decode group names.
(gnus-registry-fixup-registry):
(gnus-registry-save): Use function.
Eric Abrahamsen [Fri, 16 Nov 2018 20:53:56 +0000 (12:53 -0800)]
Remove Gnus group name encoding/decoding
This completes the process started in c1b63af445. Gnus group names are
now fully decoded inside the Gnus system.
* lisp/gnus/gnus-agent.el (gnus-agent-file-coding-system): Change
default to utf-8-emacs.
(gnus-agent-decoded-group-names, gnus-agent-decoded-group-name):
Remove variable and function. Remove all usage in this file.
* lisp/gnus/gnus-cache.el (gnus-cache-decoded-group-names,
gnus-cache-unified-group-names, gnus-cache-decoded-group-name):
Remove these variables and function. Remove all usage in this file.
* lisp/gnus/gnus-group.el (gnus-tmp-decoded-group): Remove this
variable, gnus-tmp-group is now decoded.
(gnus-group-completing-read): Don't encode or decode group names
here.
(gnus-group-make-group): Remove ENCODED argument.
* lisp/gnus/gnus-srvr.el (gnus-browse-foreign-server): Decode group
names here.
* lisp/gnus/gnus-start.el (gnus-make-hashtable-from-newsrc-alist):
check for encoded group names and decode.
(gnus-active-to-gnus-format): Make sure incoming group names are
decoded.
(gnus-read-newsrc-el-file): Check for encoded group names in
gnus-topic-alist.
* lisp/gnus/nnagent.el: Don't use a unibyte buffer.
* lisp/gnus/nnheader.el (nnheader-file-coding-system): Switch default
from 'raw-text to 'undecided, on the assumption that 'undecided will
probably write 'utf-8-emacs unless the user has arranged things
otherwise.
* lisp/gnus/nnimap.el (nnimap-decode-gnus-group,
nnimap-encode-gnus-group): Remove functions and their use.
* lisp/gnus/nnmail.el (nnmail-parse-active): Remove encoding.
(nnmail-active-file-coding-system): Default to 'utf-8-emacs instead
of 'raw-text.
(nnmail-group-names-not-encoded-p): Obsolete this variable; stop
using it.
* lisp/gnus/gnus-art.el:
* lisp/gnus/gnus-cus.el:
* lisp/gnus/gnus-msg.el:
* lisp/gnus/gnus-start.el:
* lisp/gnus/gnus-sum.el:
* lisp/gnus/gnus.el:
* lisp/gnus/nnml.el:
* lisp/gnus/message.el:
* lisp/gnus/nnrss.el: Stop using gnus-group-decoded-name in all these
files.
Eric Abrahamsen [Sat, 3 Aug 2019 21:43:44 +0000 (14:43 -0700)]
Fix ordering of Gnus groups after yanking
* lisp/gnus/gnus-start.el (gnus-group-change-level): Fix docstring to
note that the inserted group is inserted *before* the PREVIOUS
group. Fix indexing -- shouldn't have been adding one to the index.
Paul Eggert [Sat, 3 Aug 2019 21:12:29 +0000 (14:12 -0700)]
Remove stale .pdmp files with ‘make clean’
Problem reported by Sven Joachim (Bug#36907).
* admin/make-emacs: Simplify, now that clean does versionclean.
* src/Makefile.in ($(etc)/DOC, versionclean, extraclean):
Don’t ignore rm -f failures.
(versionclean): Also remove emacs-*.*.*[0-9].pdmp and ../etc/DOC*.
(clean): Depend on versionclean and simplify.
Paul Eggert [Sat, 3 Aug 2019 19:45:19 +0000 (12:45 -0700)]
Fix rare undefined behaviors in replace-match
* src/search.c (Freplace_match): Simplify by caching search_regs
components. Fix sanity check for out-of-range subscripts;
it incorrectly allowed negative subscripts, subscripts
equal to search_regs.num_regs, and it had undefined
behavior for subscripts outside ptrdiff_t range.
Improve wording of newly-introduced replace-match diagnostic.
Rework use of opoint, to avoid setting point to an out-of-range value
in rare cases involving modification hooks.
Andreas Politz [Sat, 3 Aug 2019 14:33:06 +0000 (16:33 +0200)]
Tweak tq queue processing
* lisp/emacs-lisp/tq.el (tq-process-buffer): Pop the queue before
calling the function because the function may add new entries to
the queue (bug#19016). Also report errors.
Eli Zaretskii [Sat, 3 Aug 2019 09:41:35 +0000 (12:41 +0300)]
Improve documentation of debugging Lisp syntax error
* doc/lispref/debugging.texi (Syntax Errors, Excess Open)
(Excess Close): Name the commands invoked by the key
sequences. Add cross-references to appropriate sections of
the Emacs manual. (Bug#21385)
Tassilo Horn [Fri, 2 Aug 2019 16:05:13 +0000 (18:05 +0200)]
Improve pretty-printing of multiple JSON snippets in a region
* lisp/json.el (json-pretty-print): Improve pretty-printing of
multiple JSON snippets in a region. Don't lose the region contents
starting with the first non-JSON-parseable text. Also, don't swallow
errors that occurred while parsing (bug#34160).
Alan Mackenzie [Fri, 2 Aug 2019 13:38:13 +0000 (13:38 +0000)]
CC Mode: Fix error in macro cache. This fixes bug #36802
* lisp/progmodes/cc-engine.el (c-invalidate-macro-cache): Add in a cond arm
to handle the change position being less than the recorded CPP contruct end.
For discussion, see the following thread:
https://lists.gnu.org/archive/html/emacs-devel/2019-07/msg00528.html
* etc/NEWS: Announce changes in gravatar.el user options.
* lisp/image/gravatar.el (gravatar-cache-ttl): Change :type to
number of seconds without changing the default value and while still
accepting other timestamp formats.
(gravatar-rating): Restrict :type to ratings recognized by Gravatar.
(gravatar-size): Allow nil as a value, in which case Gravatar's
default size is used.
(gravatar-default-image, gravatar-force-default): New user options
controlling the Gravatar query parameters 'default' and
'forcedefault', respectively.
(gravatar-base-url): Use HTTPS.
(gravatar--query-string): New helper function to facilitate testing.
(gravatar-build-url): Use it.
* test/lisp/image/gravatar-tests.el (gravatar-size)
(gravatar-default-image, gravatar-force-default)
(gravatar-build-url): New tests.
For discussion, see the following thread:
https://lists.gnu.org/archive/html/emacs-devel/2019-07/msg00528.html
* lisp/image/gravatar.el (gravatar-hash): Trim leading and trailing
whitespace in given address, as per the Gravatar docs.
(gravatar-retrieve-synchronously): Silence call to
url-retrieve-synchronously for consistency with gravatar-retrieve.
(gravatar-retrieved): Only cache buffer on successful retrieval.
* test/lisp/image/gravatar-tests.el: New file.
For discussion, see the following thread:
https://lists.gnu.org/archive/html/emacs-devel/2019-07/msg00528.html
* lisp/image/gravatar.el (gravatar-data->image): Remove.
(gravatar-retrieve, gravatar-retrieve-synchronously): Reuse
url-fetch-from-cache and gravatar-retrieved to reduce duplication.
(gravatar-retrieved): Only cache buffer if url-current-object is
non-nil and return result of callback. This affords reusing this
function in cached URL buffers.
For discussion, see the following thread:
https://lists.gnu.org/archive/html/emacs-devel/2019-07/msg00528.html
* lisp/gnus/gnus-gravatar.el: Use lexical-binding. Link custom
group 'gnus-gravatar' to 'gravatar'.
(gnus-gravatar-size, gnus-gravatar-too-ugly): Doc fix.
(gnus-gravatar-insert): Check liveness of article buffer sooner.
(gnus-treat-from-gravatar, gnus-treat-mail-gravatar): Use
interactive spec "p" instead of emulating it.
* lisp/image/gravatar.el: Use lexical-binding.
(gravatar-cache-expired): Remove. Change all callers to use
url-cache-expired instead.
(gravatar-get-data, gravatar-retrieve)
(gravatar-retrieve-synchronously): Simplify.
Alan Mackenzie [Fri, 2 Aug 2019 12:57:40 +0000 (12:57 +0000)]
CC Mode: Fix spurious recognition of operators beginning with, e.g. "or"
This fixes bug #36801.
* lisp/progmodes/cc-langs.el (c-pre-lambda-tokens-re): Use c-make-keywords-re
rather than regexp-opt to make an optimised regexp out of a list of tokens.
Mention that some dired commands work on the current file, too
* lisp/dired-aux.el (dired-do-search): Mention that it works on
file under point (bug#20194).
(dired-do-find-regexp-and-replace): Ditto.
(dired-do-find-regexp): Ditto.
Alan Mackenzie [Fri, 2 Aug 2019 11:24:38 +0000 (11:24 +0000)]
CC Mode: Fix the timing of application and removal of string fence properties
This fixes bug #36897.
* lisp/progmodes/cc-mode.el (c-before-change-check-unbalanced-strings): Check
string fence text properties are actually present on string delimiters before
trying to remove them.
(c-before-change): Amend the nesting of unwind-protect, widen,
c-restore-string-fences, and c-clear-string-fences. Move
invalidate-state-cache to outside of the widening.
(c-after-change): Amend the nesting of unwind-protect, widen,
c-restore-string-fences, and c-clear-string-fences.
Paul Eggert [Thu, 1 Aug 2019 22:34:35 +0000 (15:34 -0700)]
Fix two parse-time-months invalid assumptions
* lisp/gnus/nnimap.el: Do not require parse-time.
* lisp/gnus/nnimap.el (nnimap-find-expired-articles):
* lisp/net/pop3.el (pop3-make-date):
Just use system-time-locale and format-time-string; no need to
refer to parse-time-months.
* lisp/net/pop3.el (parse-time-months): Remove defvar.
* lisp/net/tramp-smb.el (tramp-smb-read-file-entry):
Add FIXME comment about this.
Fix proposed by Martin Rudalics <rudalics@gmx.at> in:
https://lists.gnu.org/archive/html/emacs-devel/2008-12/msg00945.html
* lisp/image-file.el (image-file-yank-handler): Handle case when
yank-excluded-properties is t.
Martin Rudalics [Thu, 1 Aug 2019 07:56:44 +0000 (09:56 +0200)]
Add example for removing scroll bars/fringes from mini windows (Bug#8868)
* doc/lispref/display.texi (Fringe Size/Pos): Mention example
for how to permenantly remove fringes from minibuffer windows.
(Scroll Bars): Add example for how to permanently remove
scroll bars and fringes from minibuffer windows.
Restore `replace-region-contents' in json-pretty-print
* lisp/json.el (json-pretty-print): Switch back to using
`replace-region-contents' to preserve markers and fonts which went
missing when fixing the bug
(bug#34160).
(json-pretty-print-max-secs): Restore, too.
`decoded-time-set-defaults' refactored out from iso8601 code
* lisp/calendar/iso8601.el (iso8601--encode-time):
* lisp/calendar/time-date.el (decoded-time-set-defaults):
Refactor out from `iso8601--encode-time', because it's helpful
in other contexts.