]> git.eshelyaron.com Git - emacs.git/log
emacs.git
4 years agoSimplify byte-code optimisation of pure functions
Mattias Engdegård [Mon, 6 Jul 2020 15:38:52 +0000 (17:38 +0200)]
Simplify byte-code optimisation of pure functions

Most pure functions need no explicit optimisation; we can do away with
almost all uses of byte-optimize-predicate (now renamed to
byte-optimize-constant-args, since it is not just for predicates).
Also remove some superfluous arity warnings.

* lisp/emacs-lisp/byte-opt.el (byte-optimize-identity, byte-optimize-memq)
(byte-optimize-nth, byte-optimize-nthcdr):
Remove arity warnings and simplify.
* lisp/emacs-lisp/byte-opt.el (<, >, <=, >=, not, null, consp, listp)
(symbolp, stringp, string<, string-lessp, proper-list-p, logand)
(logior, logxor, lognot, car, cdr, car-safe, cdr-safe):
Remove superfluous byte-optimizer property.
(byte-optimize-predicate): Rename to byte-optimize-constant-args.
All uses changed.

4 years agoMark more functions pure (bug#42147)
Mattias Engdegård [Sun, 5 Jul 2020 11:47:34 +0000 (13:47 +0200)]
Mark more functions pure (bug#42147)

Extend the list of 'pure' functions to many predicates and numerical
functions that we are reasonably confident will give portable results.
Also include various list and array accessors, because our use of purity
in the byte compiler isn't affected by the mutability of arguments.

* lisp/emacs-lisp/byte-opt.el: Update example in comment.
(pure-fns): Add many functions.
(byte-optimize-form-code-walker) Don't signal errors during evaluation
of calls to pure functions with constant arguments at compile time,
since such calls are not necessarily reachable.

4 years ago; Revert "; Add a note about a bottleneck"
Dmitry Gutov [Mon, 6 Jul 2020 01:29:52 +0000 (04:29 +0300)]
; Revert "; Add a note about a bottleneck"

This reverts commit 9f9ce631a2ff44ebcb87b0b1390a21b13665db43.

It's still a bottleneck, but so are mapcar (with its effect on GC) and
concat. So our limits show in several places at once.

4 years ago; Add a note about a bottleneck
Dmitry Gutov [Mon, 6 Jul 2020 00:50:59 +0000 (03:50 +0300)]
; Add a note about a bottleneck

4 years ago* lisp/progmodes/project.el: Bump the version.
Dmitry Gutov [Sun, 5 Jul 2020 21:51:13 +0000 (00:51 +0300)]
* lisp/progmodes/project.el: Bump the version.

4 years ago; Add a couple of FIXMEs
Dmitry Gutov [Sun, 5 Jul 2020 21:50:32 +0000 (00:50 +0300)]
; Add a couple of FIXMEs

4 years agoproject-switch-to-buffer: Don't filter based on default-directory
Dmitry Gutov [Sun, 5 Jul 2020 00:35:00 +0000 (03:35 +0300)]
project-switch-to-buffer: Don't filter based on default-directory

* lisp/progmodes/project.el (project-switch-to-buffer):
Don't filter based on default-directory
(https://lists.gnu.org/archive/html/emacs-devel/2020-07/msg00075.html).
(project-switch-to-buffer): Ditto.

4 years agoVerilog-Mode collected updates.
Wilson Snyder [Sun, 5 Jul 2020 17:31:39 +0000 (13:31 -0400)]
Verilog-Mode collected updates.

* lisp/progmodes/verilog-mode.el (verilog-auto-inst): Support regexp of
what AUTOINST I/O to include, issue #1682.  Reported by Mrainy.
(verilog-font-lock-keywords-1): Fix highlighting module names with no
following (, issue #1679.  Reported by Vinam Arora.
(verilog-font-lock-keywords) Adds syntax highlighting for identifiers in
declaration statements, #1678.
(verilog-calculate-indent, verilog-inject-arg)
(verilog-keywords, verilog-showscopes): Support AMS
connectmodule/endconnectmodule, #1665. Reported by Dan McMahill.

4 years agoDon't confuse errors with nil in bytecomp-tests.el
Mattias Engdegård [Sun, 5 Jul 2020 15:44:34 +0000 (17:44 +0200)]
Don't confuse errors with nil in bytecomp-tests.el

* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-check-1)
(bytecomp-explain-1, test-byte-opt-arithmetic, bytecomp-lexbind-check-1)
(bytecomp-lexbind-explain-1):
If an expression raises an error when evaluated, don't treat it as if
it had succeeded with the value nil; use 'bytecomp-check-error' as the
result instead.

4 years agoRelax portable number check in byte compiler (bug#42147)
Mattias Engdegård [Fri, 3 Jul 2020 18:13:50 +0000 (20:13 +0200)]
Relax portable number check in byte compiler (bug#42147)

With bignums, the set of representable integers is no longer
platform-dependent, and since we use nothing but IEEE754 64-bit
floats, all numbers are now portable.  Take advantage of this fact
to simplify constant-folding in the byte compiler, allowing it to
be applied more widely.

* lisp/emacs-lisp/byte-opt.el (byte-opt--portable-max)
(byte-opt--portable-min, byte-opt--portable-numberp): Remove.
(byte-opt--arith-reduce, byte-optimize-minus, byte-optimize-1+)
(byte-optimize-1-): Simplify: any number will do, and if N is a
number, then so are -N, N+1 and N-1.

4 years agoRemove long obsolete c-looking-at-bos. Make c-at-expression-start-p obsolete
Alan Mackenzie [Sat, 4 Jul 2020 16:35:47 +0000 (16:35 +0000)]
Remove long obsolete c-looking-at-bos.  Make c-at-expression-start-p obsolete

* lisp/progmodes/cc-engine.el (c-looking-at-bos): Remove.
(c-at-expression-start-p): Make obsolete, with no alternative function.

4 years agoFix filling in js-mode and mhtml-mode (js-mode parts), fixing bug #41897
Alan Mackenzie [Sat, 4 Jul 2020 12:55:49 +0000 (12:55 +0000)]
Fix filling in js-mode and mhtml-mode (js-mode parts), fixing bug #41897

* lisp/progmodes/js.el (js-mode): Use "\\(?:" in the value of
comment-start-skip rather than "\\(", fixing the second half of bug #41952.
Call c-foreign-init-lit-pos-cache and install c-foreign-truncate-lit-pos-cache
on before-change-functions, to connect up correctly with CC Mode's filling
mechanism.

* lisp/textmodes/mhtml-mode.el (mhtml--crucial-variable-prefix): Add prefixes
"adaptive-fill-", "fill-", "normal-auto-fill-function" and "paragraph-" to
pull in variables crucial to filling.
(mhtml-syntax-propertize): Read the current submode from the piece of text
being propertized rather than one character before it, and do so before
erasing the submode text-property.
(mhtml-mode): Set the js-mode value of auto-fill-function to js-do-auto-fill.
Correctly initialize and use CC Mode's filling facilities, as above.

4 years agoCC Mode: Fix wrong value of comment-start-skip, fixing half of bug #41952
Alan Mackenzie [Sat, 4 Jul 2020 11:56:18 +0000 (11:56 +0000)]
CC Mode: Fix wrong value of comment-start-skip, fixing half of bug #41952

Also add functions to enable correct use of CC Mode's filling functionality
from major modes which don't initialize CC Mode fully.  These modes are
currently js-mode and mhtml-mode.

* lisp/progmodes/cc-langs.el (comment-start-skip): Replace "\\(" by "\\(?:" so
that (match-end 1) isn't falsely taken to be the start of the comment.

* lisp/progmodes/cc-engine.el (c-foreign-truncate-lit-pos-cache)
(c-foreign-init-lit-pos-cache): New functions.

4 years agoUse 'emacs-lisp-mode-syntax-table' for reading Lisp expressions
Daniel Koning [Tue, 23 Jun 2020 00:03:20 +0000 (19:03 -0500)]
Use 'emacs-lisp-mode-syntax-table' for reading Lisp expressions

* lisp/simple.el (read--expression): Set syntax table to
'emacs-lisp-mode-syntax-table' when reading a Lisp expression
from the minibuffer.  (Bug#41781)

Copyright-paperwork-exempt: yes

4 years ago* lisp/progmodes/cc-mode.el (c-or-c++-mode--regexp): Change WS to [ \t] in it
Alan Mackenzie [Thu, 2 Jul 2020 18:14:30 +0000 (18:14 +0000)]
* lisp/progmodes/cc-mode.el (c-or-c++-mode--regexp): Change WS to [ \t] in it

4 years agoRemove Emacs-27 reference
Phillip Lord [Thu, 2 Jul 2020 17:03:23 +0000 (18:03 +0100)]
Remove Emacs-27 reference

* admin/nt/dist-build/README-windows-binaries:

4 years agoRevert feature added in bfd96e995d using project directories in vc (bug#41821)
Juri Linkov [Wed, 1 Jul 2020 22:08:18 +0000 (01:08 +0300)]
Revert feature added in bfd96e995d using project directories in vc (bug#41821)

4 years ago; * etc/NEWS: Announce dropping of support for OpenBSD 5.3.
Eli Zaretskii [Wed, 1 Jul 2020 14:25:52 +0000 (17:25 +0300)]
; * etc/NEWS: Announce dropping of support for OpenBSD 5.3.

4 years agoSupport pty's on OpenBSD
YASUOKA Masahiko [Sat, 27 Jun 2020 03:56:42 +0000 (12:56 +0900)]
Support pty's on OpenBSD

* configure.ac (PTY_TTY_NAME_SPRINTF): OpenBSD has posix_openpt
nowadays.  (Bug#42059)

Copyright-paperwork-exempt: yes

4 years ago; Auto-commit of loaddefs files.
Glenn Morris [Wed, 1 Jul 2020 13:27:56 +0000 (06:27 -0700)]
; Auto-commit of loaddefs files.

4 years agoBind 'C-x 4 1' to 'same-window-prefix' and document new commands (bug#41691)
Juri Linkov [Tue, 30 Jun 2020 21:30:18 +0000 (00:30 +0300)]
Bind 'C-x 4 1' to 'same-window-prefix' and document new commands (bug#41691)

* lisp/window.el (ctl-x-4-map): Bind 'C-x 4 1' to 'same-window-prefix'.

* doc/emacs/windows.texi (Pop Up Window): Add 'C-x 4 4' and 'C-x 4 1'.
* doc/emacs/frames.texi (Creating Frames): Add 'C-x 5 5'.
(Tab Bars): Add 'C-x t t'.

4 years agoSubject: Frame-local tab-bar for numeric value of tab-bar-show (bug#42052)
James N. V. Cash [Mon, 29 Jun 2020 23:45:15 +0000 (02:45 +0300)]
Subject: Frame-local tab-bar for numeric value of tab-bar-show (bug#42052)

* lisp/tab-bar.el (tab-bar-new-tab-to): Set frame parameter
tab-bar-lines to 1 when tab-bar-show is the same as number of tabs.
(tab-bar-close-tab, tab-bar-close-other-tabs): Set frame parameter
tab-bar-lines to 0 when tab-bar-show is the same as number of tabs.

Copyright-paperwork-exempt: yes

4 years agoCC Mode: optimize for repeated simple operations.
Alan Mackenzie [Mon, 29 Jun 2020 19:10:09 +0000 (19:10 +0000)]
CC Mode: optimize for repeated simple operations.

Do this by recognising that unterminated strings in a buffer are typically
going to be few and close together.  Also optimize code for C++ attributes.

* lisp/progmodes/cc-defs.el (c-previous-single-property-change): New macro.
(c-put-syn-tab, c-clear-syn-tab): Turned from macros into functions, and moved
to cc-mode.el.
(c-clear-syn-tab-properties): Amended to use c-min/max-syn-tab-mkr.
(c-with-extended-string-fences): Removed.

* lisp/progmodes/cc-engine-el (c-enclosing-c++-attribute): Rewritten for
speed.
(c-slow-enclosing-c++-attribute): Removed.
(c-semi-pp-to-literal): Remove a superfluous call to
c-with-extended-string-fences.

* lisp/progmodes/cc-mode.el (c-min-syn-tab-mkr, c-max-syn-tab-mkr): two new
marker variables which bound the region occupied by positions with
c-fl-syn-tab text properties.
(c-basic-common-init): Initialize these two variables.
(c-fl-syn-tab-region): Removed.
(c-put-syn-tab, c-clear-syn-tab): Functions moved from cc-defs.el.
(c-clear-string-fences): Amended to use the new scheme.
(c-restore-string-fences): Now takes no arguments; amended to use the new
scheme.
(c-font-lock-fontify-region): Amended to use the new scheme.

4 years ago* test/src/fns-tests.el (test-secure-hash): Test getrandom format.
Paul Eggert [Mon, 29 Jun 2020 16:54:45 +0000 (09:54 -0700)]
* test/src/fns-tests.el (test-secure-hash): Test getrandom format.

4 years agoUpdate from Gnulib.
Paul Eggert [Sun, 28 Jun 2020 20:22:44 +0000 (13:22 -0700)]
Update from Gnulib.

This incorporates:
2020-06-28 getrandom: do not depend on ‘open’ on mingw
2020-06-28 getrandom: fix compilation errors on older versions of mingw
* build-aux/config.sub, lib/getrandom.c, m4/getrandom.m4:
Copy from Gnulib
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.

4 years agoMS-Windows fixes as followup to import of Gnulib 'getrandom'
Eli Zaretskii [Sun, 28 Jun 2020 15:26:20 +0000 (18:26 +0300)]
MS-Windows fixes as followup to import of Gnulib 'getrandom'

* nt/mingw-cfg.site (gl_cv_lib_assume_bcrypt): Set to "no" to
disable linking against bcrypt.dll.  (Bug#42095)

* src/gnutls.c (gnutls_rnd) [WINDOWSNT]: Don't define a function
pointer, and don't load it from GnuTLS DLL.
(w32_gnutls_rnd) [WINDOWSNT]: Delete unused function.
* src/fns.c (gnutls_rnd) [WINDOWSNT]: Don't redirect to
w32_gnutls_rnd.

4 years agoAdd thread-naming support for OpenBSD
Timo Myyrä [Sun, 28 Jun 2020 08:27:21 +0000 (10:27 +0200)]
Add thread-naming support for OpenBSD

OpenBSD has pthread_set_name_np; FreeBSD appears to have both
this call and pthread_setname_np (the latter call is used in preference).

* configure.ac: Detect pthread_set_name_np.
* sys/systhread.c:
Include <pthread_np.h> and call pthread_set_name_np if available.

4 years agoUse getrandom syscall for nonces
Paul Eggert [Sat, 27 Jun 2020 20:02:24 +0000 (13:02 -0700)]
Use getrandom syscall for nonces

* admin/merge-gnulib (GNULIB_MODULES): Add getrandom.
* doc/lispref/text.texi (Format of GnuTLS Cryptography Inputs):
Don’t say that iv-auto uses GNUTLS_RND_NONCE.  Also, don’t say
that it returns the IV’s actual value, as it never has done that.
* src/fns.c, src/sysdep.c: Include sys/random.h, for getrandom.
* src/fns.c (Fsecure_hash_algorithms): Use getrandom so that this
function does not depend on HAVE_GNUTLS3.
* src/sysdep.c: Do not include <gnutls/crypto.h>.
(random_seed) [HAVE_LRAND48]: Can be long int now.
(init_random) [!WINDOWSNT]: Use getrandom syscall instead
of opening /dev/urandom, as this works even on GNU/Linux
hosts that lack /dev/urandom.  Don’t bother with gnutls_rnd
as it’s not needed now that we have getrandom.

4 years agoUpdate from Gnulib
Paul Eggert [Sat, 27 Jun 2020 17:00:17 +0000 (10:00 -0700)]
Update from Gnulib

This incorporates:
2020-06-27 getloadavg: don’t depend on fopen-gnu
2020-06-25 c-dtoastr, c-ldtoastr: new modules
2020-06-01 getloadavg: fix double-increment bug
2020-06-01 tempname: use getrandom, not getentropy
2020-05-31 tempname: merge from glibc and coreutils
2020-05-31 getentropy: work around a macOS and Solaris problem
2020-05-31 fnmatch: merge from glibc
2020-05-30 unistd: remove conflicting declaration of getrandom
2020-05-30 don't assume that UNICODE is not defined
2020-05-29 fix compilation error on native Windows
2020-05-28 avoid dynamic loading of Windows API functions when possible
2020-05-28 at-internal: make more robust in multithreaded applications
2020-05-28 getloadavg: make more robust in multithreaded applications
2020-05-27 getloadavg: make more robust in multithreaded applications
2020-05-26 count-one-bits: fix MSVC specific code
2020-05-25 getentropy, getrandom: new modules
2020-05-24 open, openat: really support O_CLOEXEC
2020-05-23 verify: document ‘assume’ better
2020-05-21 regex: configure better with "clang -fsanitize=leak"
2020-05-21 memmem: configure better with "clang -fsanitize=undefined"
2020-05-19 ftoastr: fix ifndef typo
* build-aux/config.guess, build-aux/config.sub, doc/misc/texinfo.tex:
* lib/count-one-bits.h, lib/ftoastr.c, lib/ftoastr.h:
* lib/getloadavg.c, lib/gettimeofday.c, lib/libc-config.h:
* lib/open.c, lib/openat-proc.c, lib/tempname.c, lib/tempname.h:
* lib/unistd.in.h, lib/verify.h, m4/memmem.m4, m4/regex.m4:
* m4/unistd_h.m4:
Update from Gnulib.
* lib/getrandom.c, lib/sys_random.in.h:
* m4/getrandom.m4, m4/sys_random_h.m4:
New files, copied from Gnulib.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.

4 years agoMerge from origin/emacs-27
Glenn Morris [Fri, 26 Jun 2020 14:50:38 +0000 (07:50 -0700)]
Merge from origin/emacs-27

5280e118c0 (origin/emacs-27) ; * src/xdisp.c (pos_visible_p): Fix las...
bb1a9481c9 Fix posn-at-point at beginning of a display string
0c4b033670 Improve documentation of Info node movement commands
632b0119e1 Add Jansson dependency to Windows Build
dbfcdab837 Unbreak 'reverse-region'
c37de84845 Fix typos and markup in fill column indicator docs
f61bff3ee9 ; * CONTRIBUTE: Clarify the preferences for patch formatting.
368e140660 Avoid crashes in 'defconst'
11e3413cff Fix text about Lisp archives in the Emacs FQ
4c81724675 Don't use 'cl' functions in ELisp manual's examples

4 years ago; * src/xdisp.c (pos_visible_p): Fix last change. (Bug#42039)
Eli Zaretskii [Fri, 26 Jun 2020 13:34:50 +0000 (16:34 +0300)]
; * src/xdisp.c (pos_visible_p): Fix last change.  (Bug#42039)

4 years agoFix posn-at-point at beginning of a display string
Eli Zaretskii [Fri, 26 Jun 2020 12:01:44 +0000 (15:01 +0300)]
Fix posn-at-point at beginning of a display string

* src/xdisp.c (pos_visible_p): Account for the line-number width
when the display string at CHARPOS ends in a newline.  (Bug#42039)

4 years ago; Fix recent indentation in project.el
Basil L. Contovounesios [Fri, 26 Jun 2020 08:37:52 +0000 (09:37 +0100)]
; Fix recent indentation in project.el

* lisp/progmodes/project.el (project-ignores, project-find-file-in)
(project-eshell, project--read-project-list): Fix indentation.

4 years agoImprove documentation of Info node movement commands
Eli Zaretskii [Fri, 26 Jun 2020 07:41:09 +0000 (10:41 +0300)]
Improve documentation of Info node movement commands

* lisp/info.el (Info-next, Info-prev, Info-forward-node)
(Info-backward-node): More detailed descriptions of what each
commands does with respect to child and parent nodes.  (Bug#42050)

4 years agoFix byte-compilation warning in project.el
Eli Zaretskii [Fri, 26 Jun 2020 07:15:46 +0000 (10:15 +0300)]
Fix byte-compilation warning in project.el

* lisp/emacs-lisp/seq.el (seq-every-p): Autoload it.  This fixes
byte-compilation warning in project.el.

4 years agovc-known-roots: Actually update
Dmitry Gutov [Fri, 26 Jun 2020 00:44:51 +0000 (03:44 +0300)]
vc-known-roots: Actually update

* lisp/vc/vc-hooks.el (vc-known-roots):
Actually update for the change in 733921edfe (bug#41821).

4 years agoproject--read-project-list: Add structure verification
Dmitry Gutov [Fri, 26 Jun 2020 00:41:42 +0000 (03:41 +0300)]
project--read-project-list: Add structure verification

* lisp/progmodes/project.el (project--list): Update docstring.
(project--read-project-list): Add structure verification.

4 years agoproject-known-roots: Rename and improve
Dmitry Gutov [Fri, 26 Jun 2020 00:33:13 +0000 (03:33 +0300)]
project-known-roots: Rename and improve

* lisp/progmodes/project.el (project-known-project-roots):
Rename from 'project-known-roots'.  Update the docstring.  Make
sure the returned value is a list of strings.  Update the caller
(bug#41821).

4 years agoRename project-kill-buffers-{skip-conditions,ignores}
Dmitry Gutov [Fri, 26 Jun 2020 00:27:39 +0000 (03:27 +0300)]
Rename project-kill-buffers-{skip-conditions,ignores}

* lisp/progmodes/project.el (project-kill-buffers-ignores):
Rename from project-kill-buffers-skip-conditions (bug#41868).
Update both references.
Add a :package-version attribute.

4 years agoAdd NEWS entry for bug-reference auto-setup.
Tassilo Horn [Thu, 25 Jun 2020 20:06:53 +0000 (22:06 +0200)]
Add NEWS entry for bug-reference auto-setup.

* etc/NEWS: Add entry for bug-reference auto-setup.

4 years agoFix last change
Eli Zaretskii [Thu, 25 Jun 2020 19:27:19 +0000 (22:27 +0300)]
Fix last change

* lisp/menu-bar.el (menu-bar-describe-menu): Improve the wording
and the help-echo of the new list-recent-keystrokes Help menu
item.  (Bug#41933)

* etc/NEWS: Call out the new menu item.

4 years agoAdd help menu entry for view-lossage
Tino Calancha [Thu, 25 Jun 2020 18:54:46 +0000 (20:54 +0200)]
Add help menu entry for view-lossage

* lisp/menu-bar.el (menu-bar-describe-menu):
Add an entry for view-lossage (Bug#41933).

4 years agoCC Mode. Fix an off by one error. Fixes bug #41809
Alan Mackenzie [Thu, 25 Jun 2020 17:07:16 +0000 (17:07 +0000)]
CC Mode.  Fix an off by one error.  Fixes bug #41809

* lisp/progmodes/cc-engine.el (c-full-pp-to-literal): Change > to >= (twice).

4 years agoPush action to list of functions in display-buffer-override-next-command
Juri Linkov [Thu, 25 Jun 2020 00:48:32 +0000 (03:48 +0300)]
Push action to list of functions in display-buffer-override-next-command

* lisp/window.el (display-buffer-override-next-command):
Push action to 'car' of 'display-buffer-overriding-action'
and in exitfun remove action from 'car'.
https://lists.gnu.org/archive/html/emacs-devel/2020-06/msg00803.html

4 years agoMake switch work in AWK Mode. Fixes bug #41923
Alan Mackenzie [Wed, 24 Jun 2020 19:45:30 +0000 (19:45 +0000)]
Make switch work in AWK Mode.  Fixes bug #41923

lisp/progmodes/cc-langs.el (c-block-stmt-2-kwds): Insert "switch" into the AWK
Mode entry.
(c-case-kwds): Remove the special entry for AWK Mode.

4 years ago; * etc/NEWS: Improve format and wording of recently added entries.
Eli Zaretskii [Wed, 24 Jun 2020 14:51:08 +0000 (17:51 +0300)]
; * etc/NEWS: Improve format and wording of recently added entries.

4 years ago; Fix typos in etc/NEWS
Michael Albinus [Wed, 24 Jun 2020 08:41:39 +0000 (10:41 +0200)]
; Fix typos in etc/NEWS

4 years agoM-n in read-directory-name of vc commands gets project dirs (bug#41821)
Juri Linkov [Tue, 23 Jun 2020 23:59:31 +0000 (02:59 +0300)]
M-n in read-directory-name of vc commands gets project dirs (bug#41821)

* lisp/progmodes/project.el (project-known-roots): New autoloaded function.

* lisp/vc/vc-hooks.el (vc-known-roots): New function.

* lisp/vc/vc.el (vc-root-diff, vc-print-root-log):
* lisp/vc/vc-dir.el (vc-dir): Use 'vc-known-roots' for default
values for read-directory-name.

4 years agoMore not-state-changing vc commands can be used from non-file buffers
Juri Linkov [Tue, 23 Jun 2020 23:54:30 +0000 (02:54 +0300)]
More not-state-changing vc commands can be used from non-file buffers

* lisp/vc/vc.el (vc-deduce-fileset): Instead of checking for
log-view-mode, check for '(not buffer-file-name)' before trying to
get the backend for default-directory.  Remove the branch that
checks for '(not buffer-file-name)' and signals the error because
vc-responsible-backend used in previous condition already signals
its error.  (Bug#41974)

4 years agoFix problem in tramp-smb.el
Michael Albinus [Tue, 23 Jun 2020 19:18:08 +0000 (21:18 +0200)]
Fix problem in tramp-smb.el

* lisp/net/tramp-smb.el (tramp-smb-handle-directory-files):
Use `directory-file-name'.

* test/lisp/net/tramp-tests.el (trace): Require it.
(tramp--test-instrument-test-case): Print also function traces.
(tramp--test-smb-p): New defun.
(tramp-test03-file-name-method-rules)
(tramp-test05-expand-file-name-relative)
(tramp-test21-file-links, tramp--test-windows-nt-or-smb-p)
(tramp--test-check-files): Use it.

4 years ago; Fix indentation in last change
Basil L. Contovounesios [Tue, 23 Jun 2020 14:48:24 +0000 (15:48 +0100)]
; Fix indentation in last change

* lisp/gnus/gnus-cloud.el (gnus-cloud-download-data): Reindent first
argument of prog1.

4 years agoFix gnus-cloud-download-all-data return value
David Edmondson [Tue, 23 Jun 2020 11:52:34 +0000 (12:52 +0100)]
Fix gnus-cloud-download-all-data return value

* lisp/gnus/gnus-cloud.el (gnus-cloud-download-data): Return the
result of calling `gnus-cloud-update-all' when UPDATE is t, as per the
documented behaviour. (Bug#40280)

4 years agoAdd Jansson dependency to Windows Build
Phillip Lord [Mon, 22 Jun 2020 17:14:48 +0000 (18:14 +0100)]
Add Jansson dependency to Windows Build

* admin/nt/dist-build/build-dep-zips.py: Add dependency

4 years agoUnbreak 'reverse-region'
Richard Copley [Thu, 18 Jun 2020 17:59:21 +0000 (18:59 +0100)]
Unbreak 'reverse-region'

* lisp/sort.el (reverse-region): Unbreak the function.  It was
broken by a fix for bug#39376.

Copyright-paperwork-exempt: yes

4 years agoMinor improvements as followup to recent RGB string-parsing change
Eli Zaretskii [Mon, 22 Jun 2020 15:32:01 +0000 (18:32 +0300)]
Minor improvements as followup to recent RGB string-parsing change

* src/xfaces.c (Finternal_color_values_from_color_spec): Rename to...
(Fcolor_values_from_color_spec): ...this.  Callers changed.
Rename the argument to SPEC and improve the doc string.
(parse_color_spec, parse_float_color_comp, parse_hex_color_comp):
Improve commentary.
(parse_color_spec): Rename the argument S to SPEC.

* etc/NEWS: Mention 'color-values-from-color-spec'.

4 years agoproject-switch-to-buffer: Improve Ido compatibility
Dmitry Gutov [Mon, 22 Jun 2020 13:58:02 +0000 (16:58 +0300)]
project-switch-to-buffer: Improve Ido compatibility

* lisp/progmodes/project.el (project-switch-to-buffer):
Check that the entry contains a non-nil CDR.

4 years agoFix typos and markup in fill column indicator docs
Basil L. Contovounesios [Mon, 22 Jun 2020 13:43:53 +0000 (14:43 +0100)]
Fix typos and markup in fill column indicator docs

* doc/emacs/display.texi (Displaying Boundaries): Fix typos and
Texinfo markup.

4 years agoproject-switch-to-buffer: Do not require matching input
Dmitry Gutov [Mon, 22 Jun 2020 13:48:43 +0000 (16:48 +0300)]
project-switch-to-buffer: Do not require matching input

* lisp/progmodes/project.el (project-switch-to-buffer):
Do not require matching input, to allow creating buffers as well
(bug#41879).

4 years agoAccept lexical lambda in auto-insert-alist
Mattias Engdegård [Mon, 22 Jun 2020 11:07:37 +0000 (13:07 +0200)]
Accept lexical lambda in auto-insert-alist

This bug was exposed by a previous removal of quoting around lambda
expressions in autoinsert-tests.el (1ecd350f38ee), which caused some
of those tests to fail.

* lisp/autoinsert.el (auto-insert): Cope with lexical closures.

4 years agoFix spurious error in beginning-of-defun in pascal-mode (bug#41740)
Mattias Engdegård [Sun, 21 Jun 2020 19:11:17 +0000 (21:11 +0200)]
Fix spurious error in beginning-of-defun in pascal-mode (bug#41740)

* lisp/progmodes/pascal.el (pascal-beg-of-defun):
Ignore errors in forward-sexp.
* test/lisp/progmodes/pascal-tests.el (pascal-beg-of-defun): New test.

4 years agoPreserve point in pascal-mode completion (bug#41740)
Mattias Engdegård [Sun, 21 Jun 2020 19:04:30 +0000 (21:04 +0200)]
Preserve point in pascal-mode completion (bug#41740)

Failure to do so caused errors in several cases.
Reported by Shinichi Sakata.

* lisp/progmodes/pascal.el (pascal-type-completion)
(pascal-completion): Wrap code that may move point in save-excursion.
* test/lisp/progmodes/pascal-tests.el: New file.

4 years agoFix display-buffer-override-next-command to call action only once (bug#39722)
Juri Linkov [Sun, 21 Jun 2020 23:36:16 +0000 (02:36 +0300)]
Fix display-buffer-override-next-command to call action only once (bug#39722)

* lisp/vc/vc-dir.el (vc-dir-bookmark-jump): Don't use save-window-excursion.

* lisp/window.el (display-buffer-override-next-command): Reset
display-buffer-overriding-action after the first buffer display action.

* lisp/tab-bar.el (switch-to-buffer-other-tab): Don't reuse frame tabs.
(other-tab-prefix): Don't reuse frame tabs.

4 years agoNew commands other-window-prefix (C-x 4 4) and other-frame-prefix (C-x 5 5)
Juri Linkov [Sun, 21 Jun 2020 23:17:02 +0000 (02:17 +0300)]
New commands other-window-prefix (C-x 4 4) and other-frame-prefix (C-x 5 5)

* lisp/window.el (other-window-prefix, same-window-prefix): New commands.
(ctl-x-4-map): Bind 'C-x 4 4' to 'other-window-prefix'.  (Bug#41691)

* lisp/frame.el (other-frame-prefix): New command.
(ctl-x-5-map): Bind 'C-x 5 5' to 'other-frame-prefix'.

4 years agoForward declare eshell-buffer-name in project-eshell
Theodor Thornhill [Sun, 21 Jun 2020 22:49:20 +0000 (01:49 +0300)]
Forward declare eshell-buffer-name in project-eshell

* lisp/progmodes/project.el: Forward declare 'eshell-buffer-name' so
that 'project-eshell' can use dynamically scoping with it.

4 years ago; project-shell, project-eshell: Doc fixes
Dmitry Gutov [Sun, 21 Jun 2020 22:47:55 +0000 (01:47 +0300)]
; project-shell, project-eshell: Doc fixes

4 years agoConsolidate #RGB string parsers
Mattias Engdegård [Fri, 12 Jun 2020 16:12:37 +0000 (18:12 +0200)]
Consolidate #RGB string parsers

Use a single parser of color strings in the #RGB, rgb:R/G/B and
rgbi:R/G/B formats, replacing four existing ones.  Previously,
error-checking was spotty, handling of the rgbi: format not always
present, and normalization of the result was sometimes incorrect.

* src/dispextern.h: New prototype.
* src/xfaces.c (parse_hex_color_comp, parse_float_color_comp)
(parse_color_spec, Finternal-color_values_from_color_spec): New functions.
* test/src/xfaces-tests.el (xfaces-internal-color-values-from-color-spec):
New test.
* lisp/term/tty-colors.el (tty-color-standard-values):
Use internal-color-values-from-color-spec, replacing old parser.
* src/nsterm.m (ns_get_color):
* src/w32fns.c (x_to_w32_color):
* src/xterm.c (x_parse_color): Use parse_color_spec, replacing old
parsers.
(HEX_COLOR_NAME_LENGTH): Remove #define.

4 years agoRevert last change in benchmark.el
Basil L. Contovounesios [Sun, 21 Jun 2020 18:01:40 +0000 (19:01 +0100)]
Revert last change in benchmark.el

For discussion, see the following thread:
https://lists.gnu.org/archive/html/emacs-devel/2020-06/msg00791.html

* lisp/emacs-lisp/benchmark.el (benchmark-run-compiled): Revert to
giving byte-compile a form rather than a closure.

4 years agoImprove doc strings of 'project-shell' and 'project-eshell'
Eli Zaretskii [Sun, 21 Jun 2020 16:20:37 +0000 (19:20 +0300)]
Improve doc strings of 'project-shell' and 'project-eshell'

* lisp/progmodes/project.el (project-shell, project-eshell): Doc
fixes.

4 years agoReplace some uses of cl-mapcan with mapcan
Basil L. Contovounesios [Sun, 21 Jun 2020 13:31:16 +0000 (14:31 +0100)]
Replace some uses of cl-mapcan with mapcan

* lisp/progmodes/project.el (project-files, project-files):
* lisp/progmodes/xref.el (xref-backend-references)
(xref--convert-hits):
* test/lisp/emacs-lisp/package-tests.el
(package-test-strip-version): Replace cl-mapcan with equivalent
calls to mapcan.

4 years agoFix remaining problems with tramp-crypt.el
Michael Albinus [Sun, 21 Jun 2020 13:19:51 +0000 (15:19 +0200)]
Fix remaining problems with tramp-crypt.el

* lisp/net/tramp-compat.el (tramp-compat-make-temp-file):
Simplify implementation.

* lisp/net/tramp-crypt.el (tramp-crypt-handle-delete-file)
(tramp-crypt-handle-file-attributes, tramp-crypt-handle-file-system-info)
(tramp-crypt-handle-make-directory): Let-bind `tramp-crypt-enabled' to nil.

* lisp/net/tramp.el (tramp-file-name-for-operation): Fix for operations
with two arguments.
(tramp-handle-load): Suppress `signal-hook-function' when NOERROR
is non-nil.

* test/lisp/net/tramp-tests.el (tramp-test41-utf8)
(tramp-test41-utf8-with-stat, tramp-test41-utf8-with-perl)
(tramp-test41-utf8-with-ls): Skip if needed.

4 years agoEvaluate some unnecessarily quoted lambdas
Basil L. Contovounesios [Sun, 21 Jun 2020 12:42:14 +0000 (13:42 +0100)]
Evaluate some unnecessarily quoted lambdas

* lisp/cedet/semantic/complete.el
(semantic-displayer-tooltip-max-tags):
* lisp/emacs-lisp/benchmark.el (benchmark-run-compiled):
* lisp/emacs-lisp/package.el (package--default-summary)
(package-menu-filter-by-version):
* lisp/eshell/em-pred.el (eshell-pred-file-time):
* lisp/progmodes/verilog-mode.el (verilog-auto-lineup)
(verilog-auto-reset-widths, verilog-auto-arg-format)
(verilog-auto-inst-vector, verilog-auto-inst-template-numbers):
* lisp/textmodes/bibtex.el (bibtex-dialect):
* test/lisp/autoinsert-tests.el
(autoinsert-tests-define-auto-insert-before)
(autoinsert-tests-define-auto-insert-after): Remove some unnecessary
quoting around anonymous functions.

4 years agoSilence some warnings in tests
Basil L. Contovounesios [Sun, 21 Jun 2020 11:50:34 +0000 (12:50 +0100)]
Silence some warnings in tests

* test/lisp/emacs-lisp/package-tests.el
(package-test-suffix-matches): Evaluate lambda.
(package-test-list-filter-marked):
* test/lisp/vc/vc-tests.el
(vc-test--run-maybe-unsupported-function):
* test/src/undo-tests.el (undo-test-skip-invalidated-markers):
Silence "unused local variable" warnings.
* test/lisp/imenu-tests.el (imenu-simple-scan-deftest): Fix
docstring.  Don't shadow global major-mode.

4 years ago; project-shell, project-eshell: Docstring tweaks
Dmitry Gutov [Sun, 21 Jun 2020 01:19:29 +0000 (04:19 +0300)]
; project-shell, project-eshell: Docstring tweaks

4 years agoPop to an existing Eshell buffer by default
Theodor Thornhill [Sat, 20 Jun 2020 09:54:22 +0000 (11:54 +0200)]
Pop to an existing Eshell buffer by default

* lisp/progmodes/project.el (project-shell): Improve docstring to
include information about an implementation detail.

* list/progmodes/project.el (project-eshell): Modelled after
'project-shell', change default behavior such that we don't create too
many eshell buffers by default.  Use universal argument to create
subsequent buffers.

4 years agoFix a byte-compile warning.
Philipp Stephani [Sat, 20 Jun 2020 20:12:19 +0000 (22:12 +0200)]
Fix a byte-compile warning.

* lisp/gnus/gnus-cloud.el (gnus-cloud-download-data): Don't use
'mapcar' or effect.

4 years agoFix last change for bug#41619
Eli Zaretskii [Sat, 20 Jun 2020 08:46:52 +0000 (11:46 +0300)]
Fix last change for bug#41619

* lisp/progmodes/python.el (python-shell-virtualenv-root): Fix
last change.  (Bug#41619)

4 years ago; * CONTRIBUTE: Clarify the preferences for patch formatting.
Eli Zaretskii [Sat, 20 Jun 2020 08:42:41 +0000 (11:42 +0300)]
; * CONTRIBUTE: Clarify the preferences for patch formatting.

4 years agoDocumentation followup to the last change
Eli Zaretskii [Sat, 20 Jun 2020 08:31:19 +0000 (11:31 +0300)]
Documentation followup to the last change

* doc/emacs/cmdargs.texi (General Variables):
* etc/NEWS: Document the COLORTERM environment variable.
(Bug#41846)

4 years agoAdd fallback for 24-bit terminal color via COLORTERM=truecolor
Jan Beich [Sun, 14 Jun 2020 03:51:24 +0000 (03:51 +0000)]
Add fallback for 24-bit terminal color via COLORTERM=truecolor

* src/term.c (init_tty): When COLORTERM=truecolor is defined,
override setaf/setab/colors terminfo capabilities with 24-bit
color support.

* doc/misc/efaq.texi (Colors on a TTY): Mention the possibility to
enable 24-bit color via the COLORTERM environment variable.

(Bug#41846)

Copyright-paperwork-exempt: yes

4 years agoAvoid crashes in 'defconst'
Stephen Berman [Thu, 11 Jun 2020 21:10:07 +0000 (23:10 +0200)]
Avoid crashes in 'defconst'

* src/eval.c (Fdefconst): Verify that SYMBOL is a known symbol.
(Bug#41817)

4 years agoFix text about Lisp archives in the Emacs FQ
Richard Stallman [Thu, 11 Jun 2020 03:41:39 +0000 (23:41 -0400)]
Fix text about Lisp archives in the Emacs FQ

* doc/misc/efaq.texi (Packages that do not come with Emacs): Warn
about using Lisp archives other than GNU ELPA.

4 years agoRevert "Don't mention non-GNU package archives."
Eli Zaretskii [Sat, 20 Jun 2020 07:51:51 +0000 (10:51 +0300)]
Revert "Don't mention non-GNU package archives."

This reverts commit 5daa7a5fd4aced33a2ae016bde5bb37d1d95edf6.
A proper fix will be committed to the emacs-27 branch, and
will be later merged to master.

4 years agoFix bug with deactivation of mark in 'cua-cancel'
Andrew Burgess [Sun, 7 Jun 2020 08:20:19 +0000 (09:20 +0100)]
Fix bug with deactivation of mark in 'cua-cancel'

* lisp/emulation/cua-base.el (cua-cancel): Use 'deactivate-mark'
instead of setting 'mark-active' directly.

Copyright-paperwork-exempt: yes

4 years agoDon't use 'cl' functions in ELisp manual's examples
Eli Zaretskii [Sat, 20 Jun 2020 07:29:37 +0000 (10:29 +0300)]
Don't use 'cl' functions in ELisp manual's examples

* doc/lispref/control.texi (pcase Macro): Use 'cl-evenp' instead
of 'evenp'.  (Bug#41947)

4 years agoproject-shell: Pop to an existing shell buffer by default
Theodor Thornhill [Sat, 20 Jun 2020 01:02:18 +0000 (04:02 +0300)]
project-shell: Pop to an existing shell buffer by default

* lisp/progmodes/project.el (project-shell):
Pop to an existing shell buffer by default.
If there's none, or if universal argument is used, open a subsequent
shell buffer and jump to it.  Prefix shell buffer name with the base
name of project root directory. (Bug#41858)

4 years agoFix last change in doc strings of project.el
Eli Zaretskii [Fri, 19 Jun 2020 18:50:30 +0000 (21:50 +0300)]
Fix last change in doc strings of project.el

* lisp/progmodes/project.el (project-switch-to-buffer): More accurate
doc string.

4 years agoFix various problems in Tramp
Michael Albinus [Fri, 19 Jun 2020 13:12:31 +0000 (15:12 +0200)]
Fix various problems in Tramp

* lisp/net/tramp-compat.el (tramp-temp-name-prefix): Declare.
(tramp-compat-make-temp-name):
* lisp/net/tramp.el (tramp-make-tramp-temp-name): New defuns.

* lisp/net/tramp.el (tramp-make-tramp-temp-file):
* lisp/net/tramp-sh.el (tramp-find-inline-encoding)
(tramp-maybe-open-connection, tramp-get-remote-touch)
(tramp-get-remote-chmod-h):
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory): Use them.

* lisp/net/tramp-sh.el (tramp-do-file-attributes-with-stat):
Simplify shell command.  Suppress errors (interpret as nil).
(tramp-sh-handle-make-process): Do not visit with
`insert-file-contents'.  Delete tmp file only if exists.
(tramp-send-command-and-read): Suppress `signal-hook-function'
when reading expression.

4 years agoImprove doc strings of project.el
Eli Zaretskii [Fri, 19 Jun 2020 07:52:00 +0000 (10:52 +0300)]
Improve doc strings of project.el

* lisp/progmodes/project.el (project-dired, project-shell)
(project-eshell, project-switch-to-buffer, project-kill-buffers)
(project-list-file, project--read-project-list)
(project--ensure-read-project-list, project--write-project-list)
(project--add-to-project-list-front)
(project--remove-from-project-list, project-prompt-project-dir)
(project-switch-commands, project-switch-project): Fix wording and
formatting of doc strings.

4 years agoFix newly introduced errors in Tramp
Michael Albinus [Fri, 19 Jun 2020 07:24:27 +0000 (09:24 +0200)]
Fix newly introduced errors in Tramp

* lisp/net/tramp-gvfs.el (tramp-gvfs-unload-hook):
Remove `tramp-gvfs-dbus-event-error' from `dbus-event-error-functions'.

* lisp/net/tramp.el (tramp-autoload-file-name-handler): Revert patch.

4 years agoproject-switch-to-buffer: Use the "other buffer" as default
Andrii Kolomoiets [Thu, 18 Jun 2020 23:21:55 +0000 (02:21 +0300)]
project-switch-to-buffer: Use the "other buffer" as default

* lisp/progmodes/project.el
(project-switch-to-buffer): Pass the "other buffer" as DEF to
read-buffer if it belongs to the current project (bug#41879).

4 years agoCheck AREF and aref_addr subscripts
Paul Eggert [Thu, 18 Jun 2020 21:01:56 +0000 (14:01 -0700)]
Check AREF and aref_addr subscripts

* src/lisp.h (gc_asize): Move before first use.
(AREF, aref_addr): Check subscripts.
Co-authored-by: Tino Calancha <tino.calancha@gmail.com>
4 years ago; * lisp/faces.el (color-luminance-dark-limit): Better doc string.
Mattias Engdegård [Thu, 18 Jun 2020 19:55:36 +0000 (21:55 +0200)]
; * lisp/faces.el (color-luminance-dark-limit): Better doc string.

4 years agoDefine the dark luminance limit as a named constant
Mattias Engdegård [Thu, 18 Jun 2020 19:16:42 +0000 (21:16 +0200)]
Define the dark luminance limit as a named constant

To make the meaning of the color-dark-p cutoff luminance clear,
define it as a named constant.  (We no longer use the somewhat
obscure 0.6^2.2 definition since it doesn't really make sense
to define the limit in gamma-compressed space.)

* lisp/faces.el (color-luminance-dark-limit): New constant.
(color-dark-p): Use color-luminance-dark-limit.

4 years ago* etc/NEWS: Fix inconsistencies. Add `tramp-crypt-add-directory'.
Michael Albinus [Thu, 18 Jun 2020 18:00:39 +0000 (20:00 +0200)]
* etc/NEWS: Fix inconsistencies.  Add `tramp-crypt-add-directory'.

4 years agoSome Tramp cleanups, mainly in tramp-crypt.el
Michael Albinus [Thu, 18 Jun 2020 18:00:26 +0000 (20:00 +0200)]
Some Tramp cleanups, mainly in tramp-crypt.el

* lisp/net/tramp-crypt.el (tramp-crypt-file-name-handler-alist):
Add `add-name-to-file', `make-directory-internal',
`make-nearby-temp-file', `temporary-file-directory' and
`unhandled-file-name-directory'.
(tramp-crypt-file-name-for-operation):
Use `tramp-compat-temporary-file-directory'.
(tramp-crypt-do-encrypt-or-decrypt-file-name)
(tramp-crypt-do-encrypt-or-decrypt-file): Fix syntax error in
`tramp-error'.

* lisp/net/tramp.el (tramp-autoload-file-name-handler):
* lisp/net/tramp-rclone.el (tramp-rclone-mounted-p)
(tramp-rclone-flush-directory-cache):
Use `tramp-compat-temporary-file-directory'.

4 years agoAdd binding for project-kill-buffers
Dmitry Gutov [Thu, 18 Jun 2020 15:42:28 +0000 (18:42 +0300)]
Add binding for project-kill-buffers

* lisp/progmodes/project.el (project-prefix-map):
Add binding for project-kill-buffers (bug#41868).

4 years agoPropertize all shr fragment IDs as shr-target-id
Basil L. Contovounesios [Thu, 7 May 2020 23:25:38 +0000 (00:25 +0100)]
Propertize all shr fragment IDs as shr-target-id

* lisp/net/shr.el (shr-target-id): Add docstring.
(shr-descend, shr-tag-a): Display dummy anchor characters as the
empty string.  Give all relevant 'id' or 'name' fragment identifier
attributes the shr-target-id text property.  This ensures that
cached content, such as tables, retains the property across
renders.  (Bug#40532)

* lisp/net/eww.el: (eww-display-html): Adapt shr-target-id property
search accordingly.

4 years agoImprove battery.el UPower support
Basil L. Contovounesios [Thu, 11 Jun 2020 12:49:31 +0000 (13:49 +0100)]
Improve battery.el UPower support

For discussion, see the following threads:
https://lists.gnu.org/archive/html/emacs-devel/2020-01/msg00843.html
https://lists.gnu.org/archive/html/emacs-devel/2020-02/msg00042.html
https://lists.gnu.org/archive/html/emacs-devel/2020-02/msg00282.html

* etc/NEWS: Announce that battery-upower is enabled by default.

* lisp/battery.el (battery-upower-device): Accept both battery and
line power device names, or a list thereof (bug#39491).
(battery-upower-line-power-device): Remove user option; superseded
by battery-upower-device.
(battery-upower-subscribe): New user option.
(battery-status-function): Check whether a UPower service is
provided without activating it.
(display-battery-mode): Subscribe to UPower signals when using
battery-upower.
(battery-upower): Merge data from multiple power sources.  Calculate
terse battery status %b based on average battery load percentage
rather than coarse and often missing BatteryLevel (bug#39491).  Add
support for average temperature %d.

(battery-upower-dbus-service)
(battery-upower-dbus-interface)
(battery-upower-dbus-path)
(battery-upower-dbus-device-interface)
(battery-upower-dbus-device-path)
(battery-upower-device-all-properties): Rename to...
(battery-upower-service)
(battery-upower-interface)
(battery-upower-path)
(battery-upower-device-interface)
(battery-upower-device-path)
(battery--upower-device-properties): ...these, respectively.

(battery-upower-device-list): Rename to...
(battery--upower-devices) ...this.  Return a flat list of device
names determined by battery-upower-device.
(battery-upower-types, battery-upower-states)
(battery-upower-device-property, battery-upower-device-autodetect):
Remove.
(battery--upower-signals): New variable.
(battery--upower-signal-handler, battery--upower-props-changed)
(battery--upower-unsubscribe, battery--upower-subsribe)
(battery--upower-state): New functions.

* test/lisp/battery-tests.el (battery-upower-state)
(battery-upower-state-unknown): New tests.

4 years agoVarious battery.el improvements (bug#41808)
Basil L. Contovounesios [Thu, 11 Jun 2020 12:48:37 +0000 (13:48 +0100)]
Various battery.el improvements (bug#41808)

* lisp/battery.el: Mention BSD support in Commentary.  Don't load
preloaded lisp/emacs-lisp/timer.el.
(battery--files): New function.
(battery--find-linux-sysfs-batteries): Use it and make fewer
syscalls.
(battery-status-function): Perform GNU/Linux checks in increasing
order of obsolescence: sysfs, ACPI, and then APM.  Simplify Darwin
check.  Add :version tag now that battery-upower is the default.
(battery-echo-area-format, battery-mode-line-format): Mention %s.
(battery-load-low, battery-load-critical): New faces.
(battery-update): Display battery-mode-line-format even if
percentage is N/A.  Apply faces battery-load-low or
battery-load-critical according to the percentage, but append them
so they don't override user customizations.  Update all mode lines
since we are in global-mode-string.
(battery-linux-proc-apm-regexp): Mark as obsolete, replacing with...
(battery--linux-proc-apm): ...this new rx definition.
(battery-linux-proc-apm): Use it.  Fix indentation.  Simplify.
(battery--acpi-rate, battery--acpi-capacity): New rx definitions.
(battery-linux-proc-acpi): Use them.  Fix pathological whitespace
regexps.  Simplify.
(battery-linux-sysfs): Fix docstring and indentation.  Reduce number
of file searches.  Simplify.
(battery-bsd-apm): Fix docstring.  Simplify.
(battery-pmset): Fix docstring.  Simplify ID regexp.

* lisp/emacs-lisp/rx.el (rx-define): Indent as a defun.

* test/lisp/battery-tests.el (battery-linux-proc-apm-regexp): Test
new battery--linux-proc-apm rx definition.
(battery-acpi-rate-regexp, battery-acpi-capacity-regexp): New tests.

4 years agoFix and extend format-spec (bug#41758)
Basil L. Contovounesios [Fri, 29 May 2020 18:56:14 +0000 (19:56 +0100)]
Fix and extend format-spec (bug#41758)

* lisp/format-spec.el: Use lexical-binding.  Remove dependence on
subr-x.el.
(format-spec-make): Clarify docstring.
(format-spec--parse-modifiers): Rename to...
(format-spec--parse-flags): ...this and simplify.  In particular,
don't bother parsing :space-pad which is redundant and unused.
(format-spec--pad): Remove, replacing with...
(format-spec--do-flags): ...this new helper function which performs
more of format-spec's supported text manipulation.
(format-spec): Autoload.  Allow optional argument to take on special
values 'ignore' and 'delete' for more control over what happens when
a replacement for a format specification isn't provided.  Bring back
proper support for a precision modifier similar to that of 'format'.

* lisp/battery.el (battery-format): Rewrite in terms of format-spec.
(battery-echo-area-format, battery-mode-line-format): Mention
support of format-spec syntax in docstrings.

* doc/lispref/strings.texi (Custom Format Strings):
* etc/NEWS: Document and announce these changes.

* lisp/dired-aux.el (dired-do-compress-to):
* lisp/erc/erc-match.el (erc-log-matches):
* lisp/erc/erc.el (erc-update-mode-line-buffer):
* lisp/gnus/gnus-sieve.el (gnus-sieve-update):
* lisp/gnus/gssapi.el (open-gssapi-stream):
* lisp/gnus/mail-source.el (mail-source-fetch-file)
(mail-source-fetch-directory, mail-source-fetch-pop)
(mail-source-fetch-imap):
* lisp/gnus/message.el (message-insert-formatted-citation-line):
* lisp/image-dired.el:
* lisp/net/eww.el:
* lisp/net/imap.el (imap-kerberos4-open, imap-gssapi-open)
(imap-shell-open):
* lisp/net/network-stream.el (network-stream-open-shell):
* lisp/obsolete/tls.el (open-tls-stream):
* lisp/textmodes/tex-mode.el:
Remove extraneous loads and autoloads of format-spec now that it is
autoloaded and simplify its uses where possible.

* test/lisp/battery-tests.el (battery-format): Test new format-spec
support.
* test/lisp/format-spec-tests.el (test-format-spec): Rename to...
(format-spec) ...this, extending test cases.
(test-format-unknown): Rename to...
(format-spec-unknown): ...this, extending test cases.
(test-format-modifiers): Rename to...
(format-spec-flags): ...this.
(format-spec-make, format-spec-parse-flags, format-spec-do-flags)
(format-spec-do-flags-truncate, format-spec-do-flags-pad)
(format-spec-do-flags-chop, format-spec-do-flags-case): New tests.