aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2021-11-07 18:06:24 +0100
committerMichael Albinus2021-11-07 18:06:24 +0100
commit54fd811eecdd2ba5c1981c7b6c2108e4e2d2de5e (patch)
treee2d9eec8c21f1be436352df14e32decf39522aca
parent50121247079cd1ce06f093391b744c8f3fee49d6 (diff)
parent7fdb2ae412d4b727c6075ff3988836841b052120 (diff)
downloademacs-54fd811eecdd2ba5c1981c7b6c2108e4e2d2de5e.tar.gz
emacs-54fd811eecdd2ba5c1981c7b6c2108e4e2d2de5e.zip
Merge from origin/emacs-28
7fdb2ae412 Add some unit tests for 'abbreviate-file-name' 21de5e7b2e Fix compilation MinGW warnings 54b726c815 ; * etc/PROBLEMS: More specific recipe for WebKit-related ... d85cf33e49 Escape '%' in filenames to fix flymake warnings 6243a43ac2 Fix search string generation in nnimap-make-thread-query f05b8a939b Update to Org 9.5-68-g77e2ec
-rw-r--r--etc/PROBLEMS6
-rw-r--r--lisp/gnus/nnimap.el2
-rw-r--r--lisp/org/oc-basic.el58
-rw-r--r--lisp/org/oc-csl.el18
-rw-r--r--lisp/org/oc-natbib.el6
-rw-r--r--lisp/org/oc.el22
-rw-r--r--lisp/org/org-macro.el2
-rw-r--r--lisp/org/org-version.el2
-rw-r--r--lisp/progmodes/flymake.el4
-rw-r--r--src/w32.h4
-rw-r--r--test/lisp/files-tests.el33
11 files changed, 112 insertions, 45 deletions
diff --git a/etc/PROBLEMS b/etc/PROBLEMS
index b069ccee56f..2e3f70ae117 100644
--- a/etc/PROBLEMS
+++ b/etc/PROBLEMS
@@ -184,7 +184,11 @@ This could happen if the version of WebKitGTK installed on your system
184is buggy, and errors out trying to start a subprocess through 184is buggy, and errors out trying to start a subprocess through
185Bubblewrap sandboxing. You can avoid the crash by setting the 185Bubblewrap sandboxing. You can avoid the crash by setting the
186environment variables SNAP, SNAP_NAME and SNAP_REVISION, which will 186environment variables SNAP, SNAP_NAME and SNAP_REVISION, which will
187make WebKit use GLib to launch subprocesses instead. 187make WebKit use GLib to launch subprocesses instead. For example,
188invoke Emacs like this (where "..." stands for the command-line
189arguments you need to pass to Emacs):
190
191 $ SNAP=1 SNAP_NAME=1 SNAP_REVISION=1 emacs ...
188 192
189** Emacs crashes when you try to view a file with complex characters. 193** Emacs crashes when you try to view a file with complex characters.
190 194
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el
index 8a2acf6459a..b7082696b2c 100644
--- a/lisp/gnus/nnimap.el
+++ b/lisp/gnus/nnimap.el
@@ -2307,7 +2307,7 @@ Return the server's response to the SELECT or EXAMINE command."
2307 nnimap-incoming-split-list))) 2307 nnimap-incoming-split-list)))
2308 2308
2309(defun nnimap-make-thread-query (header) 2309(defun nnimap-make-thread-query (header)
2310 (let* ((id (mail-header-id header)) 2310 (let* ((id (substring-no-properties (mail-header-id header)))
2311 (refs (split-string 2311 (refs (split-string
2312 (or (mail-header-references header) 2312 (or (mail-header-references header)
2313 ""))) 2313 "")))
diff --git a/lisp/org/oc-basic.el b/lisp/org/oc-basic.el
index c51c7d301e4..7b09db5f8b4 100644
--- a/lisp/org/oc-basic.el
+++ b/lisp/org/oc-basic.el
@@ -325,15 +325,19 @@ This is used for disambiguation."
325 ((= n 27) (throw :complete (cons 0 (cons 0 result)))) 325 ((= n 27) (throw :complete (cons 0 (cons 0 result))))
326 (t nil)))))))) 326 (t nil))))))))
327 327
328(defun org-cite-basic--get-year (entry-or-key info) 328(defun org-cite-basic--get-year (entry-or-key info &optional no-suffix)
329 "Return year associated to ENTRY-OR-KEY. 329 "Return year associated to ENTRY-OR-KEY.
330 330
331ENTRY-OR-KEY is either an association list, as returned by 331ENTRY-OR-KEY is either an association list, as returned by
332`org-cite-basic--get-entry', or a string representing a citation key. INFO is 332`org-cite-basic--get-entry', or a string representing a citation
333the export state, as a property list. 333key. INFO is the export state, as a property list.
334 334
335Unlike `org-cite-basic--get-field', this function disambiguates author-year 335Year is obtained from the \"year\" field, if available, or from
336patterns." 336the \"date\" field if it starts with a year pattern.
337
338Unlike `org-cite-basic--get-field', this function disambiguates
339author-year patterns by adding a letter suffix to the year when
340necessary, unless optional argument NO-SUFFIX is non-nil."
337 ;; The cache is an association list with the following structure: 341 ;; The cache is an association list with the following structure:
338 ;; 342 ;;
339 ;; (AUTHOR-YEAR . KEY-SUFFIX-ALIST). 343 ;; (AUTHOR-YEAR . KEY-SUFFIX-ALIST).
@@ -345,7 +349,16 @@ patterns."
345 ;; the cite key, as a string, and SUFFIX is the generated suffix 349 ;; the cite key, as a string, and SUFFIX is the generated suffix
346 ;; string, or the empty string. 350 ;; string, or the empty string.
347 (let* ((author (org-cite-basic--get-field 'author entry-or-key info 'raw)) 351 (let* ((author (org-cite-basic--get-field 'author entry-or-key info 'raw))
348 (year (org-cite-basic--get-field 'year entry-or-key info 'raw)) 352 (year
353 (or (org-cite-basic--get-field 'year entry-or-key info 'raw)
354 (let ((date
355 (org-cite-basic--get-field 'date entry-or-key info t)))
356 (and (stringp date)
357 (string-match (rx string-start
358 (group (= 4 digit))
359 (or string-end (not digit)))
360 date)
361 (match-string 1 date)))))
349 (cache-key (cons author year)) 362 (cache-key (cons author year))
350 (key 363 (key
351 (pcase entry-or-key 364 (pcase entry-or-key
@@ -359,11 +372,13 @@ patterns."
359 (plist-put info :cite-basic/author-date-cache (cons value cache)) 372 (plist-put info :cite-basic/author-date-cache (cons value cache))
360 year)) 373 year))
361 (`(,_ . ,alist) 374 (`(,_ . ,alist)
362 (concat year 375 (let ((suffix
363 (or (cdr (assoc key alist)) 376 (or (cdr (assoc key alist))
364 (let ((new (org-cite-basic--number-to-suffix (1- (length alist))))) 377 (let ((new (org-cite-basic--number-to-suffix
365 (push (cons key new) alist) 378 (1- (length alist)))))
366 new))))))) 379 (push (cons key new) alist)
380 new))))
381 (if no-suffix year (concat year suffix)))))))
367 382
368(defun org-cite-basic--print-entry (entry style &optional info) 383(defun org-cite-basic--print-entry (entry style &optional info)
369 "Format ENTRY according to STYLE string. 384 "Format ENTRY according to STYLE string.
@@ -371,7 +386,6 @@ ENTRY is an alist, as returned by `org-cite-basic--get-entry'.
371Optional argument INFO is the export state, as a property list." 386Optional argument INFO is the export state, as a property list."
372 (let ((author (org-cite-basic--get-field 'author entry info)) 387 (let ((author (org-cite-basic--get-field 'author entry info))
373 (title (org-cite-basic--get-field 'title entry info)) 388 (title (org-cite-basic--get-field 'title entry info))
374 (year (org-cite-basic--get-field 'year entry info))
375 (from 389 (from
376 (or (org-cite-basic--get-field 'publisher entry info) 390 (or (org-cite-basic--get-field 'publisher entry info)
377 (org-cite-basic--get-field 'journal entry info) 391 (org-cite-basic--get-field 'journal entry info)
@@ -379,10 +393,12 @@ Optional argument INFO is the export state, as a property list."
379 (org-cite-basic--get-field 'school entry info)))) 393 (org-cite-basic--get-field 'school entry info))))
380 (pcase style 394 (pcase style
381 ("plain" 395 ("plain"
382 (org-cite-concat 396 (let ((year (org-cite-basic--get-year entry info 'no-suffix)))
383 author ". " title (and from (list ", " from)) ", " year ".")) 397 (org-cite-concat
398 author ". " title (and from (list ", " from)) ", " year ".")))
384 ("numeric" 399 ("numeric"
385 (let ((n (org-cite-basic--key-number (cdr (assq 'id entry)) info))) 400 (let ((n (org-cite-basic--key-number (cdr (assq 'id entry)) info))
401 (year (org-cite-basic--get-year entry info 'no-suffix)))
386 (org-cite-concat 402 (org-cite-concat
387 (format "[%d] " n) author ", " 403 (format "[%d] " n) author ", "
388 (org-cite-emphasize 'italic title) 404 (org-cite-emphasize 'italic title)
@@ -603,15 +619,7 @@ export communication channel, as a property list."
603 ;; When using this style on citations with multiple references, 619 ;; When using this style on citations with multiple references,
604 ;; use global affixes and ignore local ones. 620 ;; use global affixes and ignore local ones.
605 (`(,(or "numeric" "nb") . ,_) 621 (`(,(or "numeric" "nb") . ,_)
606 (let* ((references (org-cite-get-references citation)) 622 (pcase-let ((`(,prefix . ,suffix) (org-cite-main-affixes citation)))
607 (prefix
608 (or (org-element-property :prefix citation)
609 (and (= 1 (length references))
610 (org-element-property :prefix (car references)))))
611 (suffix
612 (or (org-element-property :suffix citation)
613 (and (= 1 (length references))
614 (org-element-property :suffix (car references))))))
615 (org-export-data 623 (org-export-data
616 (org-cite-concat 624 (org-cite-concat
617 "(" prefix (org-cite-basic--citation-numbers citation info) suffix ")") 625 "(" prefix (org-cite-basic--citation-numbers citation info) suffix ")")
@@ -712,7 +720,7 @@ reference. Values are the cite key."
712 org-cite-basic-author-column-end nil ?\s) 720 org-cite-basic-author-column-end nil ?\s)
713 (make-string org-cite-basic-author-column-end ?\s))) 721 (make-string org-cite-basic-author-column-end ?\s)))
714 org-cite-basic-column-separator 722 org-cite-basic-column-separator
715 (let ((date (org-cite-basic--get-field 'year key nil t))) 723 (let ((date (org-cite-basic--get-year key nil 'no-suffix)))
716 (format "%4s" (or date ""))) 724 (format "%4s" (or date "")))
717 org-cite-basic-column-separator 725 org-cite-basic-column-separator
718 (org-cite-basic--get-field 'title key nil t)))) 726 (org-cite-basic--get-field 'title key nil t))))
diff --git a/lisp/org/oc-csl.el b/lisp/org/oc-csl.el
index 94de97e33a1..7cd63c3ff3a 100644
--- a/lisp/org/oc-csl.el
+++ b/lisp/org/oc-csl.el
@@ -487,21 +487,25 @@ INFO is the export state, as a property list."
487 (let ((global-prefix (org-element-property :prefix citation))) 487 (let ((global-prefix (org-element-property :prefix citation)))
488 (when global-prefix 488 (when global-prefix
489 (let* ((first (car cites)) 489 (let* ((first (car cites))
490 (prefix (org-element-property :prefix first))) 490 (prefix-item (assq 'prefix first)))
491 (org-element-put-property 491 (setcdr prefix-item
492 first :prefix (org-cite-concat global-prefix prefix))))) 492 (concat (org-element-interpret-data global-prefix)
493 " "
494 (cdr prefix-item))))))
493 ;; Global suffix is appended to the suffix of the last reference. 495 ;; Global suffix is appended to the suffix of the last reference.
494 (let ((global-suffix (org-element-property :suffix citation))) 496 (let ((global-suffix (org-element-property :suffix citation)))
495 (when global-suffix 497 (when global-suffix
496 (let* ((last (org-last cites)) 498 (let* ((last (org-last cites))
497 (suffix (org-element-property :suffix last))) 499 (suffix-item (assq 'suffix last)))
498 (org-element-put-property 500 (setcdr suffix-item
499 last :suffix (org-cite-concat suffix global-suffix))))) 501 (concat (cdr suffix-item)
502 " "
503 (org-element-interpret-data global-suffix))))))
500 ;; Check if CITATION needs wrapping, i.e., it should be wrapped in 504 ;; Check if CITATION needs wrapping, i.e., it should be wrapped in
501 ;; a footnote, but isn't yet. 505 ;; a footnote, but isn't yet.
502 (when (and (not footnote) (org-cite-csl--note-style-p info)) 506 (when (and (not footnote) (org-cite-csl--note-style-p info))
503 (org-cite-adjust-note citation info) 507 (org-cite-adjust-note citation info)
504 (org-cite-wrap-citation citation info)) 508 (setq footnote (org-cite-wrap-citation citation info)))
505 ;; Return structure. 509 ;; Return structure.
506 (apply #'citeproc-citation-create 510 (apply #'citeproc-citation-create
507 `(:note-index 511 `(:note-index
diff --git a/lisp/org/oc-natbib.el b/lisp/org/oc-natbib.el
index 13cac9ed0b9..bf086f36dff 100644
--- a/lisp/org/oc-natbib.el
+++ b/lisp/org/oc-natbib.el
@@ -119,11 +119,7 @@ If \"natbib\" package is already required in the document, e.g., through
119(defun org-cite-natbib--build-optional-arguments (citation info) 119(defun org-cite-natbib--build-optional-arguments (citation info)
120 "Build optional arguments for citation command. 120 "Build optional arguments for citation command.
121CITATION is the citation object. INFO is the export state, as a property list." 121CITATION is the citation object. INFO is the export state, as a property list."
122 (let* ((origin (pcase (org-cite-get-references citation) 122 (pcase-let ((`(,prefix . ,suffix) (org-cite-main-affixes citation)))
123 (`(,reference) reference)
124 (_ citation)))
125 (suffix (org-element-property :suffix origin))
126 (prefix (org-element-property :prefix origin)))
127 (concat (and prefix (format "[%s]" (org-trim (org-export-data prefix info)))) 123 (concat (and prefix (format "[%s]" (org-trim (org-export-data prefix info))))
128 (cond 124 (cond
129 (suffix (format "[%s]" (org-trim (org-export-data suffix info)))) 125 (suffix (format "[%s]" (org-trim (org-export-data suffix info))))
diff --git a/lisp/org/oc.el b/lisp/org/oc.el
index dcda8d7d084..41fd688c060 100644
--- a/lisp/org/oc.el
+++ b/lisp/org/oc.el
@@ -638,6 +638,24 @@ in the current buffer. Positions include leading \"@\" character."
638 (re-search-forward org-element-citation-key-re end t) 638 (re-search-forward org-element-citation-key-re end t)
639 (cons (match-beginning 0) (match-end 0))))) 639 (cons (match-beginning 0) (match-end 0)))))
640 640
641(defun org-cite-main-affixes (citation)
642 "Return main affixes for CITATION object.
643
644Some export back-ends only support a single pair of affixes per
645citation, even if it contains multiple keys. This function
646decides what affixes are the most appropriate.
647
648Return a pair (PREFIX . SUFFIX) where PREFIX and SUFFIX are
649parsed data."
650 (let ((source
651 ;; When there are multiple references, use global affixes.
652 ;; Otherwise, local affixes have priority.
653 (pcase (org-cite-get-references citation)
654 (`(,reference) reference)
655 (_ citation))))
656 (cons (org-element-property :prefix source)
657 (org-element-property :suffix source))))
658
641(defun org-cite-supported-styles (&optional processors) 659(defun org-cite-supported-styles (&optional processors)
642 "List of supported citation styles and variants. 660 "List of supported citation styles and variants.
643 661
@@ -872,7 +890,9 @@ When non-nil, the return value if the footnote container."
872INFO is the export state, as a property list. 890INFO is the export state, as a property list.
873 891
874White space before the citation, if any, are removed. The parse tree is 892White space before the citation, if any, are removed. The parse tree is
875modified by side-effect." 893modified by side-effect.
894
895Return newly created footnote object."
876 (let ((footnote 896 (let ((footnote
877 (list 'footnote-reference 897 (list 'footnote-reference
878 (list :label nil 898 (list :label nil
diff --git a/lisp/org/org-macro.el b/lisp/org/org-macro.el
index 1259430ae44..c38a07b69af 100644
--- a/lisp/org/org-macro.el
+++ b/lisp/org/org-macro.el
@@ -173,7 +173,7 @@ a file, \"input-file\" and \"modification-time\"."
173 modtime)))))))) 173 modtime))))))))
174 ;; Install generic macros. 174 ;; Install generic macros.
175 '(("keyword" . (lambda (arg1 &rest _) 175 '(("keyword" . (lambda (arg1 &rest _)
176 (org-macro--find-keyword-value arg1))) 176 (org-macro--find-keyword-value arg1 t)))
177 ("n" . (lambda (&optional arg1 arg2 &rest _) 177 ("n" . (lambda (&optional arg1 arg2 &rest _)
178 (org-macro--counter-increment arg1 arg2))) 178 (org-macro--counter-increment arg1 arg2)))
179 ("property" . (lambda (arg1 &optional arg2 &rest _) 179 ("property" . (lambda (arg1 &optional arg2 &rest _)
diff --git a/lisp/org/org-version.el b/lisp/org/org-version.el
index 55f186b4712..6427f30072e 100644
--- a/lisp/org/org-version.el
+++ b/lisp/org/org-version.el
@@ -11,7 +11,7 @@ Inserted by installing Org mode or when a release is made."
11(defun org-git-version () 11(defun org-git-version ()
12 "The Git version of Org mode. 12 "The Git version of Org mode.
13Inserted by installing Org or when a release is made." 13Inserted by installing Org or when a release is made."
14 (let ((org-git-version "release_9.5-59-g52e6f1")) 14 (let ((org-git-version "release_9.5-68-g77e2ec"))
15 org-git-version)) 15 org-git-version))
16 16
17(provide 'org-version) 17(provide 'org-version)
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index bcb43c1faf1..403925c8557 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -266,7 +266,9 @@ If set to nil, don't suppress any zero counters."
266 (warning-type-format 266 (warning-type-format
267 (format " [%s %s]" 267 (format " [%s %s]"
268 (or sublog 'flymake) 268 (or sublog 'flymake)
269 (current-buffer)))) 269 ;; Handle file names with "%" correctly. (Bug#51549)
270 (string-replace "%" "%%"
271 (buffer-name (current-buffer))))))
270 (display-warning (list 'flymake sublog) 272 (display-warning (list 'flymake sublog)
271 (apply #'format-message msg args) 273 (apply #'format-message msg args)
272 (if (numberp level) 274 (if (numberp level)
diff --git a/src/w32.h b/src/w32.h
index ec0f37123e8..b31d66646c9 100644
--- a/src/w32.h
+++ b/src/w32.h
@@ -155,11 +155,11 @@ extern unsigned int w32_get_short_filename (const char *, char *, int);
155 155
156/* Prepare our standard handles for proper inheritance by child processes. */ 156/* Prepare our standard handles for proper inheritance by child processes. */
157extern void prepare_standard_handles (int in, int out, 157extern void prepare_standard_handles (int in, int out,
158 int err, HANDLE handles[4]); 158 int err, HANDLE handles[3]);
159 159
160/* Reset our standard handles to their original state. */ 160/* Reset our standard handles to their original state. */
161extern void reset_standard_handles (int in, int out, 161extern void reset_standard_handles (int in, int out,
162 int err, HANDLE handles[4]); 162 int err, HANDLE handles[3]);
163 163
164/* Query Windows Registry and return the resource associated 164/* Query Windows Registry and return the resource associated
165 associated with KEY and NAME of type TYPE. */ 165 associated with KEY and NAME of type TYPE. */
diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el
index c641851261d..cf9d87f76d7 100644
--- a/test/lisp/files-tests.el
+++ b/test/lisp/files-tests.el
@@ -1331,6 +1331,39 @@ name (Bug#28412)."
1331 (should (file-directory-p (concat (file-name-as-directory dest2) "a"))) 1331 (should (file-directory-p (concat (file-name-as-directory dest2) "a")))
1332 (delete-directory dir 'recursive)))) 1332 (delete-directory dir 'recursive))))
1333 1333
1334(ert-deftest files-tests-abbreviate-file-name-homedir ()
1335 ;; Check homedir abbreviation.
1336 (let* ((homedir temporary-file-directory)
1337 (process-environment (cons (format "HOME=%s" homedir)
1338 process-environment))
1339 (abbreviated-home-dir nil))
1340 (should (equal "~/foo/bar"
1341 (abbreviate-file-name (concat homedir "foo/bar")))))
1342 ;; Check that homedir abbreviation doesn't occur when homedir is just /.
1343 (let* ((homedir "/")
1344 (process-environment (cons (format "HOME=%s" homedir)
1345 process-environment))
1346 (abbreviated-home-dir nil))
1347 (should (equal "/foo/bar"
1348 (abbreviate-file-name (concat homedir "foo/bar"))))))
1349
1350(ert-deftest files-tests-abbreviate-file-name-directory-abbrev-alist ()
1351 ;; Check `directory-abbrev-alist' abbreviation.
1352 (let ((directory-abbrev-alist '(("\\`/nowhere/special" . "/nw/sp"))))
1353 (should (equal "/nw/sp/here"
1354 (abbreviate-file-name "/nowhere/special/here"))))
1355 ;; Check homedir and `directory-abbrev-alist' abbreviation.
1356 (let* ((homedir temporary-file-directory)
1357 (process-environment (cons (format "HOME=%s" homedir)
1358 process-environment))
1359 (abbreviated-home-dir nil)
1360 (directory-abbrev-alist
1361 `((,(concat "\\`" (regexp-quote homedir) "nowhere/special")
1362 . ,(concat homedir "nw/sp")))))
1363 (should (equal "~/nw/sp/here"
1364 (abbreviate-file-name
1365 (concat homedir "nowhere/special/here"))))))
1366
1334(ert-deftest files-tests-abbreviated-home-dir () 1367(ert-deftest files-tests-abbreviated-home-dir ()
1335 "Test that changing HOME does not confuse `abbreviate-file-name'. 1368 "Test that changing HOME does not confuse `abbreviate-file-name'.
1336See <https://debbugs.gnu.org/19657#20>." 1369See <https://debbugs.gnu.org/19657#20>."