summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/battery.el6
-rw-r--r--lisp/calc/calc-units.el85
-rw-r--r--lisp/calendar/todo-mode.el20
-rw-r--r--lisp/cedet/semantic/db-file.el32
-rw-r--r--lisp/cedet/semantic/db-mode.el1
-rw-r--r--lisp/custom.el2
-rw-r--r--lisp/doc-view.el5
-rw-r--r--lisp/emacs-lisp/cl-generic.el4
-rw-r--r--lisp/emacs-lisp/package.el15
-rw-r--r--lisp/epg-config.el82
-rw-r--r--lisp/epg.el10
-rw-r--r--lisp/filenotify.el63
-rw-r--r--lisp/gnus/gnus-art.el9
-rw-r--r--lisp/help-fns.el1
-rw-r--r--lisp/net/eww.el13
-rw-r--r--lisp/net/pinentry.el28
-rw-r--r--lisp/progmodes/cc-engine.el6
-rw-r--r--lisp/progmodes/xref.el113
-rw-r--r--lisp/time-stamp.el2
-rw-r--r--lisp/window.el26
-rw-r--r--lisp/woman.el6
21 files changed, 310 insertions, 219 deletions
diff --git a/lisp/battery.el b/lisp/battery.el
index d0293697bef..b5e312f6c3e 100644
--- a/lisp/battery.el
+++ b/lisp/battery.el
@@ -628,12 +628,12 @@ The following %-sequences are provided:
(cond ((looking-at "; charging")
(setq battery-status "charging"
battery-status-symbol "+"))
- ((< (string-to-number load-percentage) battery-load-low)
- (setq battery-status "low"
- battery-status-symbol "-"))
((< (string-to-number load-percentage) battery-load-critical)
(setq battery-status "critical"
battery-status-symbol "!"))
+ ((< (string-to-number load-percentage) battery-load-low)
+ (setq battery-status "low"
+ battery-status-symbol "-"))
(t
(setq battery-status "high"
battery-status-symbol "")))
diff --git a/lisp/calc/calc-units.el b/lisp/calc/calc-units.el
index 0c8920848fc..07d9ac90d85 100644
--- a/lisp/calc/calc-units.el
+++ b/lisp/calc/calc-units.el
@@ -43,6 +43,9 @@
;;; Measures, by François Cardarelli)
;;; All conversions are exact unless otherwise noted.
+;; CODATA values updated February 2016, using 2014 adjustment
+;; http://arxiv.org/pdf/1507.07956.pdf
+
(defvar math-standard-units
'( ;; Length
( m nil "*Meter" )
@@ -136,8 +139,8 @@
"31.10347680 g") ;; ESUWM, 1/12 exact value for lbt
( ct "(2/10) g" "Carat" nil
"0.2 g") ;; ESUWM
- ( u "1.660538782*10^(-27) kg" "Unified atomic mass" nil
- "1.660538782 10^-27 kg (*)");;(approx) CODATA
+ ( u "1.660539040*10^(-27) kg" "Unified atomic mass" nil
+ "1.660539040 10^-27 kg (*)");;(approx) CODATA
;; Force
( N "m kg/s^2" "*Newton" )
@@ -204,8 +207,8 @@
( C "A s" "Coulomb" )
( Fdy "ech Nav" "Faraday" )
( e "ech" "Elementary charge" )
- ( ech "1.602176487*10^(-19) C" "Elementary charge" nil
- "1.602176487 10^-19 C (*)") ;;(approx) CODATA
+ ( ech "1.6021766208*10^(-19) C" "Elementary charge" nil
+ "1.6021766208 10^-19 C (*)") ;;(approx) CODATA
( V "W/A" "Volt" )
( ohm "V/A" "Ohm" )
( Ω "ohm" "Ohm" )
@@ -254,47 +257,51 @@
;; Other physical quantities
;; The values are from CODATA, and are approximate.
- ( h "6.62606896*10^(-34) J s" "*Planck's constant" nil
- "6.62606896 10^-34 J s (*)")
+ ( h "6.626070040*10^(-34) J s" "*Planck's constant" nil
+ "6.626070040 10^-34 J s (*)")
( hbar "h / (2 pi)" "Planck's constant" ) ;; Exact
( mu0 "4 pi 10^(-7) H/m" "Permeability of vacuum") ;; Exact
( μ0 "mu0" "Permeability of vacuum") ;; Exact
( eps0 "1 / (mu0 c^2)" "Permittivity of vacuum" )
( ε0 "eps0" "Permittivity of vacuum" )
- ( G "6.67428*10^(-11) m^3/(kg s^2)" "Gravitational constant" nil
- "6.67428 10^-11 m^3/(kg s^2) (*)")
- ( Nav "6.02214179*10^(23) / mol" "Avogadro's constant" nil
- "6.02214179 10^23 / mol (*)")
- ( me "9.10938215*10^(-31) kg" "Electron rest mass" nil
- "9.10938215 10^-31 kg (*)")
- ( mp "1.672621637*10^(-27) kg" "Proton rest mass" nil
- "1.672621637 10^-27 kg (*)")
- ( mn "1.674927211*10^(-27) kg" "Neutron rest mass" nil
- "1.674927211 10^-27 kg (*)")
- ( mmu "1.88353130*10^(-28) kg" "Muon rest mass" nil
- "1.88353130 10^-28 kg (*)")
+ ( G "6.67408*10^(-11) m^3/(kg s^2)" "Gravitational constant" nil
+ "6.67408 10^-11 m^3/(kg s^2) (*)")
+ ( Nav "6.022140857*10^(23) / mol" "Avogadro's constant" nil
+ "6.022140857 10^23 / mol (*)")
+ ( me "9.10938356*10^(-31) kg" "Electron rest mass" nil
+ "9.10938356 10^-31 kg (*)")
+ ( mp "1.672621898*10^(-27) kg" "Proton rest mass" nil
+ "1.672621898 10^-27 kg (*)")
+ ( mn "1.674927471*10^(-27) kg" "Neutron rest mass" nil
+ "1.674927471 10^-27 kg (*)")
+ ( mmu "1.883531594*10^(-28) kg" "Muon rest mass" nil
+ "1.883531594 10^-28 kg (*)")
( mμ "mmu" "Muon rest mass" nil
- "1.88353130 10^-28 kg (*)")
- ( Ryd "10973731.568527 /m" "Rydberg's constant" nil
- "10973731.568527 /m (*)")
- ( k "1.3806504*10^(-23) J/K" "Boltzmann's constant" nil
- "1.3806504 10^-23 J/K (*)")
- ( alpha "7.2973525376*10^(-3)" "Fine structure constant" nil
- "7.2973525376 10^-3 (*)")
+ "1.883531594 10^-28 kg (*)")
+ ( Ryd "10973731.568508 /m" "Rydberg's constant" nil
+ "10973731.568508 /m (*)")
+ ( k "1.38064852*10^(-23) J/K" "Boltzmann's constant" nil
+ "1.38064852 10^-23 J/K (*)")
+ ( sigma "5.670367*10^(-8) W/(m^2 K^4)" "Stefan-Boltzmann constant" nil
+ "5.670367 10^-8 W/(m^2 K^4) (*)")
+ ( σ "sigma" "Stefan-Boltzmann constant" nil
+ "5.670367 10^-8 W/(m^2 K^4) (*)")
+ ( alpha "7.2973525664*10^(-3)" "Fine structure constant" nil
+ "7.2973525664 10^-3 (*)")
( α "alpha" "Fine structure constant" nil
- "7.2973525376 10^-3 (*)")
- ( muB "927.400915*10^(-26) J/T" "Bohr magneton" nil
- "927.400915 10^-26 J/T (*)")
- ( muN "5.05078324*10^(-27) J/T" "Nuclear magneton" nil
- "5.05078324 10^-27 J/T (*)")
- ( mue "-928.476377*10^(-26) J/T" "Electron magnetic moment" nil
- "-928.476377 10^-26 J/T (*)")
- ( mup "1.410606662*10^(-26) J/T" "Proton magnetic moment" nil
- "1.410606662 10^-26 J/T (*)")
- ( R0 "8.314472 J/(mol K)" "Molar gas constant" nil
- "8.314472 J/(mol K) (*)")
- ( V0 "22.710981*10^(-3) m^3/mol" "Standard volume of ideal gas" nil
- "22.710981 10^-3 m^3/mol (*)")
+ "7.2973525664 10^-3 (*)")
+ ( muB "927.4009994*10^(-26) J/T" "Bohr magneton" nil
+ "927.4009994 10^-26 J/T (*)")
+ ( muN "5.050783699*10^(-27) J/T" "Nuclear magneton" nil
+ "5.050783699 10^-27 J/T (*)")
+ ( mue "-928.4764620*10^(-26) J/T" "Electron magnetic moment" nil
+ "-928.4764620 10^-26 J/T (*)")
+ ( mup "1.4106067873*10^(-26) J/T" "Proton magnetic moment" nil
+ "1.4106067873 10^-26 J/T (*)")
+ ( R0 "8.3144598 J/(mol K)" "Molar gas constant" nil
+ "8.3144598 J/(mol K) (*)")
+ ( V0 "22.710947*10^(-3) m^3/mol" "Standard volume of ideal gas" nil
+ "22.710947 10^-3 m^3/mol (*)")
;; Logarithmic units
( Np nil "*Neper")
( dB "(ln(10)/20) Np" "decibel")))
@@ -1628,7 +1635,7 @@ If COMP or STD is non-nil, put that in the units table instead."
"TeX point will be `pt' instead of `texpt', for example.\n"
"To avoid conflicts, the unit names for pint and parsec will\n"
"be `pint' and `parsec' instead of `pt' and `pc'."))))
- (view-mode)
+ (special-mode)
(message "Formatting units table...done"))
(setq math-units-table-buffer-valid t)
(let ((oldbuf (current-buffer)))
diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el
index 29d8dfcfb7f..94cd08eaa4e 100644
--- a/lisp/calendar/todo-mode.el
+++ b/lisp/calendar/todo-mode.el
@@ -2262,9 +2262,8 @@ made in the number or names of categories."
(mlist (append tmn-array nil))
(tma-array todo-month-abbrev-array)
(mablist (append tma-array nil))
- (yy (and oyear (unless (string= oyear "*")
- (string-to-number oyear))))
- (mm (or (and omonth (unless (string= omonth "*")
+ (yy (and oyear (string-to-number oyear))) ; 0 if year is "*".
+ (mm (or (and omonth (if (string= omonth "*") 13
(string-to-number omonth)))
(1+ (- (length mlist)
(length (or (member omonthname mlist)
@@ -2330,12 +2329,11 @@ made in the number or names of categories."
(if omonth
(number-to-string mm)
(aref tma-array (1- mm))))))
- (let ((yy (string-to-number year)) ; 0 if year is "*".
- ;; When mm is 13 (corresponding to "*" as value
- ;; of month), this raises an args-out-of-range
- ;; error in calendar-last-day-of-month, so use 1
- ;; (corresponding to January) to get 31 days.
- (mm (if (= mm 13) 1 mm)))
+ ;; Since the number corresponding to the arbitrary
+ ;; month name "*" is out of the range of
+ ;; calendar-last-day-of-month, set it to 1
+ ;; (corresponding to January) to allow 31 days.
+ (let ((mm (if (= mm 13) 1 mm)))
(if (> (string-to-number day)
(calendar-last-day-of-month mm yy))
(user-error "%s %s does not have %s days"
@@ -2347,7 +2345,7 @@ made in the number or names of categories."
monthname omonthname
day (cond
((not current-prefix-arg)
- (todo-read-date 'day mm oyear))
+ (todo-read-date 'day mm yy))
((string= oday "*")
(user-error "Cannot increment *"))
((or (string= omonth "*") (string= omonthname "*"))
@@ -5933,7 +5931,7 @@ number of the last the day of the month."
(and day (setq day (if (eq day '*)
(symbol-name '*)
(number-to-string day))))
- (and month (setq month (if (eq month '*)
+ (and month (setq month (if (= month 13)
(symbol-name '*)
(number-to-string month))))
(if arg
diff --git a/lisp/cedet/semantic/db-file.el b/lisp/cedet/semantic/db-file.el
index d9dd1f94d33..0ae433fecb5 100644
--- a/lisp/cedet/semantic/db-file.el
+++ b/lisp/cedet/semantic/db-file.el
@@ -287,22 +287,22 @@ Argument OBJ is the object to write."
(when (semanticdb-live-p obj)
(when (semanticdb-in-buffer-p obj)
(with-current-buffer (semanticdb-in-buffer-p obj)
-
- ;; Make sure all our tag lists are up to date.
- (semantic-fetch-tags)
-
- ;; Try to get an accurate unmatched syntax table.
- (when (and (boundp semantic-show-unmatched-syntax-mode)
- semantic-show-unmatched-syntax-mode)
- ;; Only do this if the user runs unmatched syntax
- ;; mode display entries.
- (oset obj unmatched-syntax
- (semantic-show-unmatched-lex-tokens-fetch))
- )
-
- ;; Make sure pointmax is up to date
- (oset obj pointmax (point-max))
- ))
+ (save-excursion
+ ;; Make sure all our tag lists are up to date.
+ (semantic-fetch-tags)
+
+ ;; Try to get an accurate unmatched syntax table.
+ (when (and (boundp semantic-show-unmatched-syntax-mode)
+ semantic-show-unmatched-syntax-mode)
+ ;; Only do this if the user runs unmatched syntax
+ ;; mode display entries.
+ (oset obj unmatched-syntax
+ (semantic-show-unmatched-lex-tokens-fetch))
+ )
+
+ ;; Make sure pointmax is up to date
+ (oset obj pointmax (point-max))
+ )))
;; Make sure that the file size and other attributes are
;; up to date.
diff --git a/lisp/cedet/semantic/db-mode.el b/lisp/cedet/semantic/db-mode.el
index e8be18576c8..73cc7b5585b 100644
--- a/lisp/cedet/semantic/db-mode.el
+++ b/lisp/cedet/semantic/db-mode.el
@@ -39,7 +39,6 @@
(semanticdb-kill-hook kill-buffer-hook)
(semanticdb-kill-hook change-major-mode-hook) ;; Not really a kill, but we need the same effect.
(semanticdb-kill-emacs-hook kill-emacs-hook)
- (semanticdb-save-all-db-idle auto-save-hook)
)
"List of hooks and values to add/remove when configuring semanticdb.")
diff --git a/lisp/custom.el b/lisp/custom.el
index f4045008ebf..056ca341197 100644
--- a/lisp/custom.el
+++ b/lisp/custom.el
@@ -464,7 +464,7 @@ are not usually written so.
MEMBERS should be an alist of the form ((NAME WIDGET)...) where
NAME is a symbol and WIDGET is a widget for editing that symbol.
Useful widgets are `custom-variable' for editing variables,
-`custom-face' for edit faces, and `custom-group' for editing groups.
+`custom-face' for editing faces, and `custom-group' for editing groups.
The remaining arguments should have the form
diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index af7f1996cc5..9d912c3f6d9 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -987,6 +987,11 @@ is named like ODF with the extension turned to pdf."
(doc-view-start-process "odf->pdf" doc-view-odf->pdf-converter-program
(list
(concat "-env:UserInstallation=file://"
+ ;; The URL must be
+ ;; file:///C:/tmp/dir on Windows.
+ ;; https://wiki.documentfoundation.org/UserProfile.
+ (when (eq system-type 'windows-nt)
+ "/")
tmp-user-install-dir)
"--headless" "--convert-to" "pdf"
"--outdir" (doc-view--current-cache-dir) odf)
diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el
index 5413bdbdf7f..7ad9f307f93 100644
--- a/lisp/emacs-lisp/cl-generic.el
+++ b/lisp/emacs-lisp/cl-generic.el
@@ -1019,6 +1019,10 @@ The value returned is a list of elements of the form
(cl--generic-prefill-dispatchers 0 (eql nil))
(cl--generic-prefill-dispatchers window-system (eql nil))
+(cl--generic-prefill-dispatchers (terminal-parameter nil 'xterm--get-selection)
+ (eql nil))
+(cl--generic-prefill-dispatchers (terminal-parameter nil 'xterm--set-selection)
+ (eql nil))
;;; Support for cl-defstructs specializers.
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 14650ba3ab6..dc050444b8d 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -1453,9 +1453,8 @@ loading packages twice."
(defvar package--downloads-in-progress nil
"List of in-progress asynchronous downloads.")
-(declare-function epg-check-configuration "epg-config"
- (config &optional minimum-version))
-(declare-function epg-configuration "epg-config" ())
+(declare-function epg-find-configuration "epg-config"
+ (protocol &optional force))
(declare-function epg-import-keys-from-file "epg" (context keys))
;;;###autoload
@@ -1555,11 +1554,15 @@ downloads in the background."
(let ((default-keyring (expand-file-name "package-keyring.gpg"
data-directory))
(inhibit-message async))
+ (if (get 'package-check-signature 'saved-value)
+ (when package-check-signature
+ (epg-find-configuration 'OpenPGP))
+ (setq package-check-signature
+ (if (epg-find-configuration 'OpenPGP)
+ 'allow-unsigned)))
(when (and package-check-signature (file-exists-p default-keyring))
(condition-case-unless-debug error
- (progn
- (epg-check-configuration (epg-configuration))
- (package-import-keyring default-keyring))
+ (package-import-keyring default-keyring)
(error (message "Cannot import default keyring: %S" (cdr error))))))
(package--download-and-read-archives async))
diff --git a/lisp/epg-config.el b/lisp/epg-config.el
index c41d97dbfac..8a208044cba 100644
--- a/lisp/epg-config.el
+++ b/lisp/epg-config.el
@@ -23,6 +23,8 @@
;;; Code:
+(eval-when-compile (require 'cl-lib))
+
(defconst epg-package-name "epg"
"Name of this package.")
@@ -76,12 +78,66 @@ Note that the buffer name starts with a space."
(defconst epg-gpg-minimum-version "1.4.3")
+(defconst epg-config--program-alist
+ '((OpenPGP
+ epg-gpg-program
+ epg-config--make-gpg-configuration
+ ("gpg2" . "2.1.6") ("gpg" . "1.4.3"))
+ (CMS
+ epg-gpgsm-program
+ epg-config--make-gpgsm-configuration
+ ("gpgsm" . "2.0.4")))
+ "Alist used to obtain the usable configuration of executables.
+The first element of each entry is protocol symbol, which is
+either `OpenPGP' or `CMS'. The second element is a symbol where
+the executable name is remembered. The third element is a
+function which constructs a configuration object (actually a
+plist). The rest of the entry is an alist mapping executable
+names to the minimum required version suitable for the use with
+Emacs.")
+
+(defvar epg--configurations nil)
+
;;;###autoload
-(defun epg-configuration ()
- "Return a list of internal configuration parameters of `epg-gpg-program'."
+(defun epg-find-configuration (protocol &optional force)
+ "Find or create a usable configuration to handle PROTOCOL.
+This function first looks at the existing configuration found by
+the previous invocation of this function, unless FORCE is non-nil.
+
+Then it walks through `epg-config--program-alist'. If
+`epg-gpg-program' or `epg-gpgsm-program' is already set with
+custom, use it. Otherwise, it tries the programs listed in the
+entry until the version requirement is met."
+ (let ((entry (assq protocol epg-config--program-alist)))
+ (unless entry
+ (error "Unknown protocol %S" protocol))
+ (cl-destructuring-bind (symbol constructor . alist)
+ (cdr entry)
+ (or (and (not force) (alist-get protocol epg--configurations))
+ ;; If the executable value is already set with M-x
+ ;; customize, use it without checking.
+ (if (get symbol 'saved-value)
+ (let ((configuration (funcall constructor (symbol-value symbol))))
+ (push (cons protocol configuration) epg--configurations)
+ configuration)
+ (catch 'found
+ (dolist (program-version alist)
+ (let ((executable (executable-find (car program-version))))
+ (when executable
+ (let ((configuration
+ (funcall constructor executable)))
+ (when (ignore-errors
+ (epg-check-configuration configuration
+ (cdr program-version))
+ t)
+ (push (cons protocol configuration) epg--configurations)
+ (throw 'found configuration))))))))))))
+
+;; Create an `epg-configuration' object for `gpg', using PROGRAM.
+(defun epg-config--make-gpg-configuration (program)
(let (config groups type args)
(with-temp-buffer
- (apply #'call-process epg-gpg-program nil (list t nil) nil
+ (apply #'call-process program nil (list t nil) nil
(append (if epg-gpg-home-directory
(list "--homedir" epg-gpg-home-directory))
'("--with-colons" "--list-config")))
@@ -113,10 +169,30 @@ Note that the buffer name starts with a space."
type args))))
(t
(setq config (cons (cons type args) config))))))
+ (push (cons 'program program) config)
(if groups
(cons (cons 'groups groups) config)
config)))
+;; Create an `epg-configuration' object for `gpgsm', using PROGRAM.
+(defun epg-config--make-gpgsm-configuration (program)
+ (with-temp-buffer
+ (call-process program nil (list t nil) nil "--version")
+ (goto-char (point-min))
+ (when (looking-at "\\S-+ (")
+ (goto-char (match-end 0))
+ (backward-char)
+ (forward-sexp)
+ (skip-syntax-forward "-" (point-at-eol))
+ (list (cons 'program program)
+ (cons 'version (buffer-substring (point) (point-at-eol)))))))
+
+;;;###autoload
+(defun epg-configuration ()
+ "Return a list of internal configuration parameters of `epg-gpg-program'."
+ (declare (obsolete epg-find-configuration "25.1"))
+ (epg-config--make-gpg-configuration epg-gpg-program))
+
(defun epg-config--parse-version (string)
(let ((index 0)
version)
diff --git a/lisp/epg.el b/lisp/epg.el
index 1f9db23478c..f4058ed35a4 100644
--- a/lisp/epg.el
+++ b/lisp/epg.el
@@ -186,11 +186,11 @@
compress-algorithm
&aux
(program
- (pcase protocol
- (`OpenPGP epg-gpg-program)
- (`CMS epg-gpgsm-program)
- (_ (signal 'epg-error
- (list "unknown protocol" protocol)))))))
+ (let ((configuration (epg-find-configuration protocol)))
+ (unless configuration
+ (signal 'epg-error
+ (list "no usable configuration" protocol)))
+ (alist-get 'program configuration)))))
(:copier nil)
(:predicate nil))
protocol
diff --git a/lisp/filenotify.el b/lisp/filenotify.el
index 66e7fd7a315..21046a85a7a 100644
--- a/lisp/filenotify.el
+++ b/lisp/filenotify.el
@@ -27,6 +27,9 @@
;;; Code:
+(eval-when-compile
+ (require 'cl))
+
(defconst file-notify--library
(cond
((featurep 'inotify) 'inotify)
@@ -54,18 +57,15 @@ different files from the same directory are watched.")
DESCRIPTOR should be an object returned by `file-notify-add-watch'.
If it is registered in `file-notify-descriptors', a stopped event is sent."
(let* ((desc (if (consp descriptor) (car descriptor) descriptor))
- (file (if (consp descriptor) (cdr descriptor)))
(registered (gethash desc file-notify-descriptors))
+ (file (if (consp descriptor) (cdr descriptor) (caadr registered)))
(dir (car registered)))
(when (consp registered)
;; Send `stopped' event.
- (dolist (entry (cdr registered))
- (funcall (cdr entry)
- `(,descriptor stopped
- ,(or (and (stringp (car entry))
- (expand-file-name (car entry) dir))
- dir))))
+ (funcall
+ (cdr (assoc file (cdr registered)))
+ `(,descriptor stopped ,(if file (expand-file-name file dir) dir)))
;; Modify `file-notify-descriptors'.
(if (not file)
@@ -99,6 +99,15 @@ Otherwise, signal a `file-notify-error'."
"A pending file notification events for a future `renamed' action.
It is a form ((DESCRIPTOR ACTION FILE [FILE1-OR-COOKIE]) CALLBACK).")
+(defun file-notify--event-watched-file (event)
+ "Return file or directory being watched.
+Could be different from the directory watched by the backend library."
+ (let* ((desc (if (consp (car event)) (caar event) (car event)))
+ (registered (gethash desc file-notify-descriptors))
+ (file (if (consp (car event)) (cdar event) (caadr registered)))
+ (dir (car registered)))
+ (if file (expand-file-name file dir) dir)))
+
(defun file-notify--event-file-name (event)
"Return file name of file notification event, or nil."
(directory-file-name
@@ -234,26 +243,6 @@ EVENT is the cadr of the event in `file-notify-handle-event'
(funcall (cadr pending-event) (car pending-event))
(setq pending-event nil))
- ;; Check for stopped.
- (setq
- stopped
- (or
- stopped
- (and
- (memq action '(deleted renamed))
- (= (length (cdr registered)) 1)
- ;; Not, when a file is backed up.
- (not (and (stringp file1) (backup-file-name-p file1)))
- (or
- ;; Watched file or directory is concerned.
- (string-equal
- (file-name-nondirectory file)
- (file-name-nondirectory (car registered)))
- ;; File inside a watched directory is concerned.
- (string-equal
- (file-name-nondirectory file)
- (car (cadr registered)))))))
-
;; Apply callback.
(when (and action
(or
@@ -273,18 +262,24 @@ EVENT is the cadr of the event in `file-notify-handle-event'
(nth 0 entry) (file-name-nondirectory file1)))))
;;(message
;;"file-notify-callback %S %S %S %S %S"
- ;;(file-notify--descriptor desc file) action file file1 registered)
+ ;;(file-notify--descriptor desc (car entry))
+ ;;action file file1 registered)
(if file1
(funcall
callback
- `(,(file-notify--descriptor desc file) ,action ,file ,file1))
+ `(,(file-notify--descriptor desc (car entry))
+ ,action ,file ,file1))
(funcall
callback
- `(,(file-notify--descriptor desc file) ,action ,file)))))
-
- ;; Modify `file-notify-descriptors'.
- (when stopped
- (file-notify-rm-watch (file-notify--descriptor desc file))))))
+ `(,(file-notify--descriptor desc (car entry)) ,action ,file))))
+
+ ;; Send `stopped' event.
+ (when (and (memq action '(deleted renamed))
+ ;; Not, when a file is backed up.
+ (not (and (stringp file1) (backup-file-name-p file1)))
+ ;; Watched file or directory is concerned.
+ (string-equal file (file-notify--event-watched-file event)))
+ (file-notify-rm-watch (file-notify--descriptor desc (car entry))))))))
;; `kqueue', `gfilenotify' and `w32notify' return a unique descriptor
;; for every `file-notify-add-watch', while `inotify' returns a unique
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index c66ca535998..4d8cb802b48 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -518,6 +518,12 @@ each invocation of the saving commands."
(item :tag "never" nil)
(sexp :tag "once" :format "%t\n" :value t)))
+(defcustom gnus-article-show-cursor nil
+ "If non-nil, show the cursor in the Article buffer even when not selected."
+ :version "25.1"
+ :group 'gnus-article
+ :type 'bool)
+
(defcustom gnus-saved-headers gnus-visible-headers
"Headers to keep if `gnus-save-all-headers' is nil.
If `gnus-save-all-headers' is non-nil, this variable will be ignored.
@@ -4484,7 +4490,8 @@ commands:
(set (make-local-variable 'nobreak-char-display) nil)
;; Enable `gnus-article-remove-images' to delete images shr.el renders.
(set (make-local-variable 'shr-put-image-function) 'gnus-shr-put-image)
- (setq cursor-in-non-selected-windows nil)
+ (unless gnus-article-show-cursor
+ (setq cursor-in-non-selected-windows nil))
(gnus-set-default-directory)
(buffer-disable-undo)
(setq buffer-read-only t
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 2021885e996..c3a5f26d261 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -296,7 +296,6 @@ suitable file is found, return nil."
(substring-no-properties lib-name 0 -1)
lib-name)
file-name))
- ;; The next three forms are from `find-source-lisp-file'.
(src-file (locate-library file-name t nil 'readable)))
(and src-file (file-readable-p src-file) src-file))))))
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 7f9f4fad414..91a17755244 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -410,6 +410,10 @@ Currently this means either text/html or application/xhtml+xml."
(condition-case nil
(decode-coding-region (point) (point-max) encode)
(coding-system-error nil))
+ (save-excursion
+ ;; Remove CRLF before parsing.
+ (while (re-search-forward "\r$" nil t)
+ (replace-match "" t t)))
(libxml-parse-html-region (point) (point-max))))))
(source (and (null document)
(buffer-substring (point) (point-max)))))
@@ -1531,11 +1535,10 @@ If CHARSET is nil then use UTF-8."
(defun eww-toggle-fonts ()
"Toggle whether to use monospaced or font-enabled layouts."
(interactive)
- (message "Fonts are now %s"
- (if (setq shr-use-fonts (not shr-use-fonts))
- "on"
- "off"))
- (eww-reload))
+ (setq shr-use-fonts (not shr-use-fonts))
+ (eww-reload)
+ (message "Proportional fonts are now %s"
+ (if shr-use-fonts "on" "off")))
(defun eww-toggle-colors ()
"Toggle whether to use HTML-specified colors or not."
diff --git a/lisp/net/pinentry.el b/lisp/net/pinentry.el
index 27374afe4bf..082a9c8ff89 100644
--- a/lisp/net/pinentry.el
+++ b/lisp/net/pinentry.el
@@ -26,7 +26,8 @@
;; This package allows GnuPG passphrase to be prompted through the
;; minibuffer instead of graphical dialog.
;;
-;; To use, add allow-emacs-pinentry to ~/.gnupg/gpg-agent.conf, and
+;; To use, add "allow-emacs-pinentry" to "~/.gnupg/gpg-agent.conf",
+;; reload the configuration with "gpgconf --reload gpg-agent", and
;; start the server with M-x pinentry-start.
;;
;; The actual communication path between the relevant components is
@@ -48,6 +49,8 @@
;;; Code:
+(eval-when-compile (require 'cl-lib))
+
(defgroup pinentry nil
"The Pinentry server"
:version "25.1"
@@ -171,17 +174,18 @@ will not be shown."
(ignore-errors
(let (delete-by-moving-to-trash)
(delete-file server-file)))
- (setq pinentry--server-process
- (make-network-process
- :name "pinentry"
- :server t
- :noquery t
- :sentinel #'pinentry--process-sentinel
- :filter #'pinentry--process-filter
- :coding 'no-conversion
- :family 'local
- :service server-file))
- (process-put pinentry--server-process :server-file server-file))))
+ (cl-letf (((default-file-modes) ?\700))
+ (setq pinentry--server-process
+ (make-network-process
+ :name "pinentry"
+ :server t
+ :noquery t
+ :sentinel #'pinentry--process-sentinel
+ :filter #'pinentry--process-filter
+ :coding 'no-conversion
+ :family 'local
+ :service server-file))
+ (process-put pinentry--server-process :server-file server-file)))))
(defun pinentry-stop ()
"Stop a Pinentry service."
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 8f2acf3cd61..f5aa4df7c2b 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -3241,7 +3241,7 @@ comment at the start of cc-engine.el for more info."
;; pair element into an open paren element. Doing that would mean that the
;; new open paren wouldn't have the required preceding paren pair element.
;;
- ;; This function is called from c-after-change.
+ ;; This function is called from c-before-change.
;; The caches of non-literals:
;; Note that we use "<=" for the possibility of the second char of a two-char
@@ -3265,7 +3265,7 @@ comment at the start of cc-engine.el for more info."
;; below `here'. To maintain its consistency, we may need to insert a new
;; brace pair.
(let ((here-bol (c-point 'bol here))
- too-high-pa ; recorded {/(/[ next above here, or nil.
+ too-high-pa ; recorded {/(/[ next above or just below here, or nil.
dropped-cons ; was the last removed element a brace pair?
pa)
;; The easy bit - knock over-the-top bits off `c-state-cache'.
@@ -3277,7 +3277,7 @@ comment at the start of cc-engine.el for more info."
;; Do we need to add in an earlier brace pair, having lopped one off?
(if (and dropped-cons
- (< too-high-pa (+ here c-state-cache-too-far)))
+ (<= too-high-pa here))
(c-append-lower-brace-pair-to-state-cache too-high-pa here here-bol))
(setq c-state-cache-good-pos (or (c-state-cache-after-top-paren)
(c-state-get-min-scan-pos)))))
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 2fd7297a2e8..f983525e928 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -414,16 +414,17 @@ elements is negated."
(set-buffer (marker-buffer marker))
(xref--goto-char marker)))
-(defun xref--pop-to-location (item &optional window)
+(defun xref--pop-to-location (item &optional action)
"Go to the location of ITEM and display the buffer.
-WINDOW controls how the buffer is displayed:
+ACTION controls how the buffer is displayed:
nil -- switch-to-buffer
`window' -- pop-to-buffer (other window)
- `frame' -- pop-to-buffer (other frame)"
+ `frame' -- pop-to-buffer (other frame)
+If SELECT is non-nil, select the target window."
(let* ((marker (save-excursion
(xref-location-marker (xref-item-location item))))
(buf (marker-buffer marker)))
- (cl-ecase window
+ (cl-ecase action
((nil) (switch-to-buffer buf))
(window (pop-to-buffer buf t))
(frame (let ((pop-up-frames t)) (pop-to-buffer buf t))))
@@ -436,51 +437,60 @@ WINDOW controls how the buffer is displayed:
;; The xref buffer is used to display a set of xrefs.
-(defvar-local xref--display-history nil
- "List of pairs (BUFFER . WINDOW), for temporarily displayed buffers.")
-
-(defun xref--save-to-history (buf win)
- (let ((restore (window-parameter win 'quit-restore)))
- ;; Save the new entry if the window displayed another buffer
- ;; previously.
- (when (and restore (not (eq (car restore) 'same)))
- (push (cons buf win) xref--display-history))))
-
-(defun xref--display-position (pos other-window buf)
- ;; Show the location, but don't hijack focus.
- (let ((xref-buf (current-buffer)))
- (with-selected-window (display-buffer buf other-window)
+(defmacro xref--with-dedicated-window (&rest body)
+ `(let* ((xref-w (get-buffer-window xref-buffer-name))
+ (xref-w-dedicated (window-dedicated-p xref-w)))
+ (unwind-protect
+ (progn
+ (when xref-w
+ (set-window-dedicated-p xref-w 'soft))
+ ,@body)
+ (when xref-w
+ (set-window-dedicated-p xref-w xref-w-dedicated)))))
+
+(defun xref--show-pos-in-buf (pos buf select)
+ (let ((xref-buf (current-buffer))
+ win)
+ (with-selected-window
+ (xref--with-dedicated-window
+ (display-buffer buf))
(xref--goto-char pos)
(run-hooks 'xref-after-jump-hook)
- (let ((buf (current-buffer))
- (win (selected-window)))
+ (let ((buf (current-buffer)))
+ (setq win (selected-window))
(with-current-buffer xref-buf
- (setq-local other-window-scroll-buffer buf)
- (xref--save-to-history buf win))))))
+ (setq-local other-window-scroll-buffer buf))))
+ (when select
+ (select-window win))))
-(defun xref--show-location (location)
+(defun xref--show-location (location &optional select)
(condition-case err
(let* ((marker (xref-location-marker location))
(buf (marker-buffer marker)))
- (xref--display-position marker t buf))
+ (xref--show-pos-in-buf marker buf select))
(user-error (message (error-message-string err)))))
(defun xref-show-location-at-point ()
- "Display the source of xref at point in the other window, if any."
+ "Display the source of xref at point in the appropriate window, if any."
(interactive)
(let* ((xref (xref--item-at-point))
(xref--current-item xref))
(when xref
- (xref--show-location (xref-item-location xref)))))
+ ;; Try to avoid the window the current xref buffer was
+ ;; originally created from.
+ (if (window-live-p xref--window)
+ (with-selected-window xref--window
+ (xref--show-location (xref-item-location xref)))
+ (xref--show-location (xref-item-location xref))))))
(defun xref-next-line ()
- "Move to the next xref and display its source in the other window."
+ "Move to the next xref and display its source in the appropriate window."
(interactive)
(xref--search-property 'xref-item)
(xref-show-location-at-point))
(defun xref-prev-line ()
- "Move to the previous xref and display its source in the other window."
+ "Move to the previous xref and display its source in the appropriate window."
(interactive)
(xref--search-property 'xref-item t)
(xref-show-location-at-point))
@@ -491,16 +501,14 @@ WINDOW controls how the buffer is displayed:
(get-text-property (point) 'xref-item)))
(defvar-local xref--window nil
- "ACTION argument to call `display-buffer' with.")
+ "The original window this xref buffer was created from.")
(defun xref-goto-xref ()
- "Jump to the xref on the current line and bury the xref buffer."
+ "Jump to the xref on the current line and select its window."
(interactive)
(let ((xref (or (xref--item-at-point)
- (user-error "No reference at point")))
- (window xref--window))
- (xref-quit)
- (xref--pop-to-location xref window)))
+ (user-error "No reference at point"))))
+ (xref--show-location (xref-item-location xref) t)))
(defun xref-query-replace-in-results (from to)
"Perform interactive replacement of FROM with TO in all displayed xrefs.
@@ -573,7 +581,8 @@ references displayed in the current *xref* buffer."
current-beg (car pair)
current-end (cdr pair)
current-buf (marker-buffer current-beg))
- (pop-to-buffer current-buf)
+ (xref--with-dedicated-window
+ (pop-to-buffer current-buf))
(goto-char current-beg)
(when (re-search-forward from current-end noerror)
(setq found t)))
@@ -586,7 +595,6 @@ references displayed in the current *xref* buffer."
(defvar xref--xref-buffer-mode-map
(let ((map (make-sparse-keymap)))
- (define-key map [remap quit-window] #'xref-quit)
(define-key map (kbd "n") #'xref-next-line)
(define-key map (kbd "p") #'xref-prev-line)
(define-key map (kbd "r") #'xref-query-replace-in-results)
@@ -614,27 +622,10 @@ references displayed in the current *xref* buffer."
(dotimes (_ n)
(setq xref (xref--search-property 'xref-item backward)))
(cond (xref
- (xref--pop-to-location xref))
+ (xref--show-location (xref-item-location xref) t))
(t
(error "No %s xref" (if backward "previous" "next"))))))
-(defun xref-quit (&optional kill)
- "Bury temporarily displayed buffers, then quit the current window.
-
-If KILL is non-nil, also kill the current buffer.
-
-The buffers that the user has otherwise interacted with in the
-meantime are preserved."
- (interactive "P")
- (let ((window (selected-window))
- (history xref--display-history))
- (setq xref--display-history nil)
- (pcase-dolist (`(,buf . ,win) history)
- (when (and (window-live-p win)
- (eq buf (window-buffer win)))
- (quit-window nil win)))
- (quit-window kill window)))
-
(defconst xref-buffer-name "*xref*"
"The name of the buffer to show xrefs.")
@@ -724,15 +715,15 @@ Return an alist of the form ((FILENAME . (XREF ...)) ...)."
(defvar xref--read-pattern-history nil)
-(defun xref--show-xrefs (xrefs window &optional always-show-list)
+(defun xref--show-xrefs (xrefs display-action &optional always-show-list)
(cond
((and (not (cdr xrefs)) (not always-show-list))
(xref-push-marker-stack)
- (xref--pop-to-location (car xrefs) window))
+ (xref--pop-to-location (car xrefs) display-action))
(t
(xref-push-marker-stack)
(funcall xref-show-xrefs-function xrefs
- `((window . ,window))))))
+ `((window . ,(selected-window)))))))
(defun xref--prompt-p (command)
(or (eq xref-prompt-for-identifier t)
@@ -761,16 +752,16 @@ Return an alist of the form ((FILENAME . (XREF ...)) ...)."
;;; Commands
-(defun xref--find-xrefs (input kind arg window)
+(defun xref--find-xrefs (input kind arg display-action)
(let ((xrefs (funcall (intern (format "xref-backend-%s" kind))
(xref-find-backend)
arg)))
(unless xrefs
(user-error "No %s found for: %s" (symbol-name kind) input))
- (xref--show-xrefs xrefs window)))
+ (xref--show-xrefs xrefs display-action)))
-(defun xref--find-definitions (id window)
- (xref--find-xrefs id 'definitions id window))
+(defun xref--find-definitions (id display-action)
+ (xref--find-xrefs id 'definitions id display-action))
;;;###autoload
(defun xref-find-definitions (identifier)
diff --git a/lisp/time-stamp.el b/lisp/time-stamp.el
index 79524fb7280..c053ea6e924 100644
--- a/lisp/time-stamp.el
+++ b/lisp/time-stamp.el
@@ -106,7 +106,7 @@ otherwise would have been updated."
(defcustom time-stamp-time-zone nil
"The time zone to be used by \\[time-stamp].
-Its format is that of the ZONE argument of the `format-time-string' function,"
+Its format is that of the ZONE argument of the `format-time-string' function."
:type '(choice (const :tag "Emacs local time" nil)
(const :tag "Universal Time" t)
(const :tag "system wall clock time" wall)
diff --git a/lisp/window.el b/lisp/window.el
index e4669c1f6e7..c45e60e6204 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -3241,9 +3241,9 @@ move it as far as possible in the desired direction."
(setq ignore 'preserved)
(setq right first-right)
(while (and right
- (or (window-size-fixed-p right horizontal 'preserved))
- (<= (window-size right horizontal t)
- (window-min-size right horizontal 'preserved t)))
+ (or (window-size-fixed-p right horizontal 'preserved)
+ (<= (window-size right horizontal t)
+ (window-min-size right horizontal 'preserved t))))
(setq right
(or (window-right right)
(progn
@@ -3352,12 +3352,12 @@ negative, shrink selected window by -DELTA lines or columns."
(window--resize-mini-window minibuffer-window (- delta)))
((window--resizable-p nil delta horizontal)
(window-resize nil delta horizontal))
+ ((window--resizable-p nil delta horizontal 'preserved)
+ (window-resize nil delta horizontal 'preserved))
+ ((eq this-command 'enlarge-window)
+ (user-error "Cannot enlarge selected window"))
(t
- (window-resize
- nil (if (> delta 0)
- (window-max-delta nil horizontal)
- (- (window-min-delta nil horizontal)))
- horizontal)))))
+ (error "Cannot enlarge selected window")))))
(defun shrink-window (delta &optional horizontal)
"Make the selected window DELTA lines smaller.
@@ -3387,12 +3387,12 @@ Also see the `window-min-height' variable."
(window--resize-mini-window minibuffer-window delta))
((window--resizable-p nil (- delta) horizontal)
(window-resize nil (- delta) horizontal))
+ ((window--resizable-p nil (- delta) horizontal 'preserved)
+ (window-resize nil (- delta) horizontal 'preserved))
+ ((eq this-command 'shrink-window)
+ (user-error "Cannot shrink selected window"))
(t
- (window-resize
- nil (if (> delta 0)
- (- (window-min-delta nil horizontal))
- (window-max-delta nil horizontal))
- horizontal)))))
+ (error "Cannot shrink selected window")))))
(defun maximize-window (&optional window)
"Maximize WINDOW.
diff --git a/lisp/woman.el b/lisp/woman.el
index 28a47986c2f..a4a0da209cb 100644
--- a/lisp/woman.el
+++ b/lisp/woman.el
@@ -1654,7 +1654,7 @@ Do not call directly!"
(setq woman-frame (make-frame)))))
(set-buffer (get-buffer-create bufname))
(condition-case nil
- (display-buffer (current-buffer))
+ (pop-to-buffer-same-window (current-buffer))
(error (pop-to-buffer (current-buffer))))
(buffer-disable-undo)
(setq buffer-read-only nil)
@@ -2064,14 +2064,14 @@ alist in `woman-buffer-alist' and return nil."
(if (zerop woman-buffer-number)
(let ((buffer (get-buffer (cdr (car woman-buffer-alist)))))
(if buffer
- (display-buffer buffer)
+ (pop-to-buffer-same-window buffer)
;; Delete alist element:
(setq woman-buffer-alist (cdr woman-buffer-alist))
nil))
(let* ((prev-ptr (nthcdr (1- woman-buffer-number) woman-buffer-alist))
(buffer (get-buffer (cdr (car (cdr prev-ptr))))))
(if buffer
- (display-buffer buffer)
+ (pop-to-buffer-same-window buffer)
;; Delete alist element:
(setcdr prev-ptr (cdr (cdr prev-ptr)))
(if (>= woman-buffer-number (length woman-buffer-alist))