aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorGlenn Morris2021-10-04 08:13:11 -0700
committerGlenn Morris2021-10-04 08:13:11 -0700
commite0fdb68f8ccb1c870bfb8c3cd2bf786a0bb312b6 (patch)
treec196f5f691ae5ad5d732f49af358768eaf9141ef /lisp
parentf0e6b47ef0a5ee15568e0b3992352d00d1055f46 (diff)
parent3b8dda6c903e8e103a26ce812fc9400b301a09ae (diff)
downloademacs-e0fdb68f8ccb1c870bfb8c3cd2bf786a0bb312b6.tar.gz
emacs-e0fdb68f8ccb1c870bfb8c3cd2bf786a0bb312b6.zip
Merge from origin/emacs-28
3b8dda6c90 Add safety check in x_menu_show e1fb731393 Tweak x_connection_closed when I/O error 595e506c82 * lisp/erc/erc.el (erc-user-mode): Set "+i" by default. d00f3d4c05 Port unused decls to C2x 317eb2d5b5 Improve structure of TODO c0793cd9de Don't use some obsolete names in documentation 87153cc915 Tweak x_hide_tip for consistency 7e871dcd27 Remove encode_terminal_code UNINITs 2a00634880 Port pdumper.c maybe_unused to C2x 6d9b3c0eaa Port systhreads.h to C2x fd274d7d24 Pacify -Wanalyzer-null-argument in lisp_malloc cc3fc94f09 Pacify gcc 11.2.1 -Wanalyzer-null-argument d3a832a61a Simplify hack-read-symbol-shorthands again (bug#50946) 4831426158 Fix recipe for 'native-lisp' directory 0bb42ef803 ; * lisp/time-stamp.el (time-stamp-format): Doc string. 732c70a0d9 Simplify socket symlink-attack checking fc32a3bd95 ; * doc/lispref/files.texi (Reading from Files): Fix wording. 3cc77aa976 Clarify (elisp) insert-file-contents with BEG or END not o... 5deeb0947d * src/Makefile.in: Simplify conditionals. 121a5abeae Move context-menu selection items Defun/List/Symbol to pro... 0c341e6e84 * lisp/tab-bar.el (tab-bar-detach-tab): Handle frame selec... 931a7276c0 * lisp/tab-line.el (tab-line-format): Add face-modified to... 3863919a00 Fix unmounting in Tramp 7a6d34cd1f * etc/themes/light-blue-theme.el: Add "Maintainer: emacs-d... c1b1e1f545 Define HAVE_NATIVE_COMP in src/Makefile.in 137fa2d716 Rename elisp-shorthands to read-symbol-shorthands e6fbc45b7b Font-lock shorthands in elisp-mode for quick visual recogn... 17e6f3bee5 ; Fix last change in tramp-sshfs.el 3dae1e33d1 Suppress superfluous error messages in Tramp b228ec9fab Fix reading the tail of a file in shorthands.el 7fb2789509 Fix substitution of pretty quotes in code in easy-mmode b47d7ce1b8 Fix agent directory deletion b1a8a66fb0 ; * etc/TODO: Fix previous commit; delete the right thing. 6c01a21365 Clarify the purpose of internal--format-docstring-line 55dadbc57e * lisp/net/dictionary.el (context-menu-dictionary): Move m... bb209cd5ab Update to Org 9.5-30-g10dc9d 4341e79a5f Remove bogus ":safe t" custom properties b6f6b593c6 Fix 'apropos-compact-layout' 62d6cecfcd Remove bogus ":safe nil" custom properties f9111d8784 The safe-local-variable property is a function (bug#50944) 3dc094abee ; Some minor tweaks to TODO a5b4356d37 Revert "; * etc/TODO: Move elpa.gnu.org items to the end." 7bc0cee115 Revert "* etc/TODO: Rearrange to start with "Simple tasks"." 3489471417 Fix selection of fonts for Arabic on Posix platforms 13e5943386 ; Fix a typo in a doc string bd60fca2fa Fix ox-koma-letter compilation warnings 340e527bed Preload paren.el a9052248da Improve documentation of 'shift-select-mode' d505971894 ; Standardize some license headers 9307889d68 Simplify shorthand injection (bug#50946) 5c77cc9584 ; * admin/release-branch.txt: Tweak previous. # Conflicts: # etc/NEWS # test/lisp/subr-tests.el
Diffstat (limited to 'lisp')
-rw-r--r--lisp/Makefile.in15
-rw-r--r--lisp/emacs-lisp/cl-macs.el8
-rw-r--r--lisp/emacs-lisp/easy-mmode.el6
-rw-r--r--lisp/erc/erc.el6
-rw-r--r--lisp/files.el2
-rw-r--r--lisp/gnus/gnus-agent.el31
-rw-r--r--lisp/international/fontset.el4
-rw-r--r--lisp/international/mule.el55
-rw-r--r--lisp/loadup.el6
-rw-r--r--lisp/mouse.el13
-rw-r--r--lisp/net/dictionary.el8
-rw-r--r--lisp/net/tramp-cache.el28
-rw-r--r--lisp/net/tramp-fuse.el51
-rw-r--r--lisp/net/tramp-rclone.el1
-rw-r--r--lisp/net/tramp-sshfs.el14
-rw-r--r--lisp/net/tramp.el28
-rw-r--r--lisp/org/ob-gnuplot.el2
-rw-r--r--lisp/org/ob-julia.el50
-rw-r--r--lisp/org/oc-basic.el20
-rw-r--r--lisp/org/oc-biblatex.el10
-rw-r--r--lisp/org/oc-csl.el51
-rw-r--r--lisp/org/oc-natbib.el11
-rw-r--r--lisp/org/oc.el31
-rw-r--r--lisp/org/ol-doi.el10
-rw-r--r--lisp/org/ol.el18
-rw-r--r--lisp/org/org-keys.el5
-rw-r--r--lisp/org/org-macs.el9
-rw-r--r--lisp/org/org-num.el3
-rw-r--r--lisp/org/org-src.el19
-rw-r--r--lisp/org/org-version.el2
-rw-r--r--lisp/org/org.el3
-rw-r--r--lisp/org/ox-html.el4
-rw-r--r--lisp/org/ox-koma-letter.el8
-rw-r--r--lisp/org/ox-latex.el4
-rw-r--r--lisp/progmodes/elisp-mode.el12
-rw-r--r--lisp/progmodes/prog-mode.el22
-rw-r--r--lisp/progmodes/which-func.el3
-rw-r--r--lisp/shorthands.el80
-rw-r--r--lisp/subr.el4
-rw-r--r--lisp/tab-bar.el26
-rw-r--r--lisp/tab-line.el5
-rw-r--r--lisp/textmodes/etc-authors-mode.el8
-rw-r--r--lisp/textmodes/fill.el2
-rw-r--r--lisp/textmodes/reftex-cite.el4
-rw-r--r--lisp/textmodes/reftex-ref.el4
-rw-r--r--lisp/textmodes/text-mode.el25
-rw-r--r--lisp/textmodes/tildify.el4
-rw-r--r--lisp/time-stamp.el2
48 files changed, 452 insertions, 285 deletions
diff --git a/lisp/Makefile.in b/lisp/Makefile.in
index 60d1d10e5b2..3e764c5a787 100644
--- a/lisp/Makefile.in
+++ b/lisp/Makefile.in
@@ -91,8 +91,19 @@ COMPILE_FIRST = \
91 $(lisp)/emacs-lisp/byte-opt.elc \ 91 $(lisp)/emacs-lisp/byte-opt.elc \
92 $(lisp)/emacs-lisp/bytecomp.elc 92 $(lisp)/emacs-lisp/bytecomp.elc
93ifeq ($(HAVE_NATIVE_COMP),yes) 93ifeq ($(HAVE_NATIVE_COMP),yes)
94COMPILE_FIRST += $(lisp)/emacs-lisp/comp.elc 94COMPILE_FIRST += \
95COMPILE_FIRST += $(lisp)/emacs-lisp/comp-cstr.elc 95 $(lisp)/emacs-lisp/comp.elc \
96 $(lisp)/emacs-lisp/comp-cstr.elc \
97 $(lisp)/emacs-lisp/cl-macs.elc \
98 $(lisp)/emacs-lisp/rx.elc \
99 $(lisp)/emacs-lisp/cl-seq.elc \
100 $(lisp)/help-mode.elc \
101 $(lisp)/emacs-lisp/cl-extra.elc \
102 $(lisp)/emacs-lisp/gv.elc \
103 $(lisp)/emacs-lisp/seq.elc \
104 $(lisp)/emacs-lisp/cl-lib.elc \
105 $(lisp)/emacs-lisp/warnings.elc \
106 $(lisp)/emacs-lisp/subr-x.elc
96endif 107endif
97COMPILE_FIRST += $(lisp)/emacs-lisp/autoload.elc 108COMPILE_FIRST += $(lisp)/emacs-lisp/autoload.elc
98 109
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 527720c6e8d..1852471bcbb 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -3087,6 +3087,14 @@ To see the documentation for a defined struct type, use
3087 ;; and pred-check, so changing it is not straightforward. 3087 ;; and pred-check, so changing it is not straightforward.
3088 (push `(,defsym ,accessor (cl-x) 3088 (push `(,defsym ,accessor (cl-x)
3089 ,(concat 3089 ,(concat
3090 ;; NB. This will produce incorrect results
3091 ;; in some cases, as our coding conventions
3092 ;; says that the first line must be a full
3093 ;; sentence. However, if we don't word wrap
3094 ;; we will have byte-compiler warnings about
3095 ;; overly long docstrings. So we can't have
3096 ;; a perfect result here, and choose to avoid
3097 ;; the byte-compiler warnings.
3090 (internal--format-docstring-line 3098 (internal--format-docstring-line
3091 "Access slot \"%s\" of `%s' struct CL-X." slot name) 3099 "Access slot \"%s\" of `%s' struct CL-X." slot name)
3092 (if doc (concat "\n" doc) "")) 3100 (if doc (concat "\n" doc) ""))
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index d37bca24a0f..f752861d80a 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -93,7 +93,7 @@ Enable the mode if ARG is nil, omitted, or is a positive number.
93Disable the mode if ARG is a negative number. 93Disable the mode if ARG is a negative number.
94 94
95To check whether the minor mode is enabled in the current buffer, 95To check whether the minor mode is enabled in the current buffer,
96evaluate `%S'. 96evaluate `%s'.
97 97
98The mode's hook is called both when the mode is enabled and when 98The mode's hook is called both when the mode is enabled and when
99it is disabled.") 99it is disabled.")
@@ -109,7 +109,9 @@ it is disabled.")
109 (docs-fc (bound-and-true-p emacs-lisp-docstring-fill-column)) 109 (docs-fc (bound-and-true-p emacs-lisp-docstring-fill-column))
110 (fill-column (if (integerp docs-fc) docs-fc 65)) 110 (fill-column (if (integerp docs-fc) docs-fc 65))
111 (argdoc (format easy-mmode--arg-docstring mode-pretty-name 111 (argdoc (format easy-mmode--arg-docstring mode-pretty-name
112 getter)) 112 ;; Avoid having quotes turn into pretty quotes.
113 (string-replace "'" "\\\\='"
114 (format "%S" getter))))
113 (filled (if (fboundp 'fill-region) 115 (filled (if (fboundp 'fill-region)
114 (with-temp-buffer 116 (with-temp-buffer
115 (insert argdoc) 117 (insert argdoc)
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index c4077d48ab0..308812f0eb2 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -188,10 +188,12 @@ parameters and authentication."
188It is not strictly necessary to provide this, since ERC will 188It is not strictly necessary to provide this, since ERC will
189prompt you for it.") 189prompt you for it.")
190 190
191(defcustom erc-user-mode nil 191(defcustom erc-user-mode "+i"
192 ;; +i "Invisible". Hides user from global /who and /names.
192 "Initial user modes to be set after a connection is established." 193 "Initial user modes to be set after a connection is established."
193 :group 'erc 194 :group 'erc
194 :type '(choice (const nil) string function)) 195 :type '(choice (const nil) string function)
196 :version "28.1")
195 197
196 198
197(defcustom erc-prompt-for-password t 199(defcustom erc-prompt-for-password t
diff --git a/lisp/files.el b/lisp/files.el
index 50ca49409f1..7213a6eae5f 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -3897,7 +3897,7 @@ inhibited."
3897 (hack-local-variables-apply)))))) 3897 (hack-local-variables-apply))))))
3898 3898
3899(defun hack-local-variables--find-variables (&optional handle-mode) 3899(defun hack-local-variables--find-variables (&optional handle-mode)
3900 "Return all local variables in the ucrrent buffer. 3900 "Return all local variables in the current buffer.
3901If HANDLE-MODE is nil, we gather all the specified local 3901If HANDLE-MODE is nil, we gather all the specified local
3902variables. If HANDLE-MODE is neither nil nor t, we do the same, 3902variables. If HANDLE-MODE is neither nil nor t, we do the same,
3903except that any settings of `mode' are ignored. 3903except that any settings of `mode' are ignored.
diff --git a/lisp/gnus/gnus-agent.el b/lisp/gnus/gnus-agent.el
index 19d05120045..6426d825465 100644
--- a/lisp/gnus/gnus-agent.el
+++ b/lisp/gnus/gnus-agent.el
@@ -3553,32 +3553,13 @@ articles in every agentized group? "))
3553 (when (and to-remove 3553 (when (and to-remove
3554 (or gnus-expert-user 3554 (or gnus-expert-user
3555 (gnus-y-or-n-p 3555 (gnus-y-or-n-p
3556 "gnus-agent-expire has identified local directories that are\ 3556 "gnus-agent-expire has identified local directories that are
3557 not currently required by any agentized group. Do you wish to consider\ 3557not currently required by any agentized group. Do you wish to consider
3558 deleting them?"))) 3558deleting them?")))
3559 (while to-remove 3559 (dolist (dir to-remove)
3560 (let ((dir (pop to-remove))) 3560 (when (or gnus-expert-user
3561 (if (or gnus-expert-user
3562 (gnus-y-or-n-p (format "Delete %s? " dir))) 3561 (gnus-y-or-n-p (format "Delete %s? " dir)))
3563 (let* (delete-recursive 3562 (delete-directory dir t)))))))
3564 files f
3565 (delete-recursive
3566 (lambda (f-or-d)
3567 (ignore-errors
3568 (if (file-directory-p f-or-d)
3569 (condition-case nil
3570 (delete-directory f-or-d)
3571 (file-error
3572 (setq files (directory-files f-or-d))
3573 (while files
3574 (setq f (pop files))
3575 (or (member f '("." ".."))
3576 (funcall delete-recursive
3577 (nnheader-concat
3578 f-or-d f))))
3579 (delete-directory f-or-d)))
3580 (delete-file f-or-d))))))
3581 (funcall delete-recursive dir)))))))))
3582 3563
3583;;;###autoload 3564;;;###autoload
3584(defun gnus-agent-batch () 3565(defun gnus-agent-batch ()
diff --git a/lisp/international/fontset.el b/lisp/international/fontset.el
index 4ec641dca8f..f0ead8a2744 100644
--- a/lisp/international/fontset.el
+++ b/lisp/international/fontset.el
@@ -157,7 +157,9 @@
157 (armenian #x531) 157 (armenian #x531)
158 (hebrew #x5D0) 158 (hebrew #x5D0)
159 (vai #xA500) 159 (vai #xA500)
160 (arabic #x628) 160 ;; U+06C1 prevents us from using bad fonts, like DejaVu Sans,
161 ;; for Arabic text.
162 (arabic #x628 #x6C1)
161 (syriac #x710) 163 (syriac #x710)
162 (thaana #x78C) 164 (thaana #x78C)
163 (devanagari #x915) 165 (devanagari #x915)
diff --git a/lisp/international/mule.el b/lisp/international/mule.el
index 2298af42b28..5022a17db5a 100644
--- a/lisp/international/mule.el
+++ b/lisp/international/mule.el
@@ -294,30 +294,8 @@ attribute."
294 294
295 (apply 'define-charset-internal name (mapcar 'cdr attrs)))) 295 (apply 'define-charset-internal name (mapcar 'cdr attrs))))
296 296
297(defun hack-elisp-shorthands (fullname) 297(defvar hack-read-symbol-shorthands-function nil
298 "Return value of the `elisp-shorthands' file-local variable in FULLNAME. 298 "Holds function to compute `read-symbol-shorthands'.")
299FULLNAME is the absolute file name of an Elisp .el file which
300potentially specifies a file-local value for `elisp-shorthands'.
301The Elisp code in FULLNAME isn't read or evaluated in any way, except
302for extraction of the buffer-local value of `elisp-shorthands'."
303 (let ((size (nth 7 (file-attributes fullname))))
304 (with-temp-buffer
305 (insert-file-contents fullname nil (max 0 (- size 3000)) size)
306 (goto-char (point-max))
307 (let* ((found (search-backward-regexp "elisp-shorthands:[ \t]*" 0 t))
308 (val (and found
309 (goto-char (match-end 0))
310 (ignore-errors (read (current-buffer)))))
311 (probe val)
312 aux)
313 (catch 'done
314 (when (consp probe)
315 (while (setq aux (pop probe))
316 (unless (and (consp aux)
317 (stringp (car aux))
318 (stringp (cdr aux)))
319 (throw 'done nil)))
320 val))))))
321 299
322(defun load-with-code-conversion (fullname file &optional noerror nomessage) 300(defun load-with-code-conversion (fullname file &optional noerror nomessage)
323 "Execute a file of Lisp code named FILE whose absolute name is FULLNAME. 301 "Execute a file of Lisp code named FILE whose absolute name is FULLNAME.
@@ -344,7 +322,8 @@ Return t if file exists."
344 (let ((load-true-file-name fullname) 322 (let ((load-true-file-name fullname)
345 (load-file-name fullname) 323 (load-file-name fullname)
346 (set-auto-coding-for-load t) 324 (set-auto-coding-for-load t)
347 (inhibit-file-name-operation nil)) 325 (inhibit-file-name-operation nil)
326 shorthands)
348 (with-current-buffer buffer 327 (with-current-buffer buffer
349 ;; So that we don't get completely screwed if the 328 ;; So that we don't get completely screwed if the
350 ;; file is encoded in some complicated character set, 329 ;; file is encoded in some complicated character set,
@@ -353,6 +332,13 @@ Return t if file exists."
353 ;; Don't let deactivate-mark remain set. 332 ;; Don't let deactivate-mark remain set.
354 (let (deactivate-mark) 333 (let (deactivate-mark)
355 (insert-file-contents fullname)) 334 (insert-file-contents fullname))
335 (setq shorthands
336 ;; We need this indirection because hacking local
337 ;; variables in too early seems to have cause
338 ;; recursive load loops (bug#50946). Thus it
339 ;; remains nil until it is save to do so.
340 (and hack-read-symbol-shorthands-function
341 (funcall hack-read-symbol-shorthands-function)))
356 ;; If the loaded file was inserted with no-conversion or 342 ;; If the loaded file was inserted with no-conversion or
357 ;; raw-text coding system, make the buffer unibyte. 343 ;; raw-text coding system, make the buffer unibyte.
358 ;; Otherwise, eval-buffer might try to interpret random 344 ;; Otherwise, eval-buffer might try to interpret random
@@ -363,11 +349,13 @@ Return t if file exists."
363 (set-buffer-multibyte nil)) 349 (set-buffer-multibyte nil))
364 ;; Make `kill-buffer' quiet. 350 ;; Make `kill-buffer' quiet.
365 (set-buffer-modified-p nil)) 351 (set-buffer-modified-p nil))
366 ;; Have the original buffer current while we eval. 352 ;; Have the original buffer current while we eval,
367 (eval-buffer buffer nil 353 ;; but consider shorthands of the eval'ed one.
368 ;; This is compatible with what `load' does. 354 (let ((read-symbol-shorthands shorthands))
369 (if dump-mode file fullname) 355 (eval-buffer buffer nil
370 nil t)) 356 ;; This is compatible with what `load' does.
357 (if dump-mode file fullname)
358 nil t)))
371 (let (kill-buffer-hook kill-buffer-query-functions) 359 (let (kill-buffer-hook kill-buffer-query-functions)
372 (kill-buffer buffer))) 360 (kill-buffer buffer)))
373 (do-after-load-evaluation fullname) 361 (do-after-load-evaluation fullname)
@@ -378,13 +366,6 @@ Return t if file exists."
378 (message "Loading %s...done" file))) 366 (message "Loading %s...done" file)))
379 t))) 367 t)))
380 368
381(defun load-with-shorthands-and-code-conversion (fullname file noerror nomessage)
382 "Like `load-with-code-conversion', but also consider Elisp shorthands.
383This function uses shorthands defined in the file FULLNAME's local
384value of `elisp-shorthands', when it processes that file's Elisp code."
385 (let ((elisp-shorthands (hack-elisp-shorthands fullname)))
386 (load-with-code-conversion fullname file noerror nomessage)))
387
388(defun charset-info (charset) 369(defun charset-info (charset)
389 "Return a vector of information of CHARSET. 370 "Return a vector of information of CHARSET.
390This function is provided for backward compatibility. 371This function is provided for backward compatibility.
diff --git a/lisp/loadup.el b/lisp/loadup.el
index 942057c838f..3a55d2c8057 100644
--- a/lisp/loadup.el
+++ b/lisp/loadup.el
@@ -151,7 +151,7 @@
151;; variable its advertised default value (it starts as nil, see 151;; variable its advertised default value (it starts as nil, see
152;; xdisp.c). 152;; xdisp.c).
153(setq resize-mini-windows 'grow-only) 153(setq resize-mini-windows 'grow-only)
154(setq load-source-file-function #'load-with-shorthands-and-code-conversion) 154(setq load-source-file-function #'load-with-code-conversion)
155(load "files") 155(load "files")
156 156
157;; Load-time macro-expansion can only take effect after setting 157;; Load-time macro-expansion can only take effect after setting
@@ -352,6 +352,10 @@
352(load "vc/ediff-hook") 352(load "vc/ediff-hook")
353(load "uniquify") 353(load "uniquify")
354(load "electric") 354(load "electric")
355(load "paren")
356
357(load "shorthands")
358
355(load "emacs-lisp/eldoc") 359(load "emacs-lisp/eldoc")
356(load "cus-start") ;Late to reduce customize-rogue (needs loaddefs.el anyway) 360(load "cus-start") ;Late to reduce customize-rogue (needs loaddefs.el anyway)
357(if (not (eq system-type 'ms-dos)) 361(if (not (eq system-type 'ms-dos))
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 5d4e05fa25e..bb47d04a3a8 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -290,6 +290,7 @@ and should return the same menu with changes such as added new menu items."
290 :type '(repeat 290 :type '(repeat
291 (choice (function-item context-menu-undo) 291 (choice (function-item context-menu-undo)
292 (function-item context-menu-region) 292 (function-item context-menu-region)
293 (function-item context-menu-middle-separator)
293 (function-item context-menu-toolbar) 294 (function-item context-menu-toolbar)
294 (function-item context-menu-global) 295 (function-item context-menu-global)
295 (function-item context-menu-local) 296 (function-item context-menu-local)
@@ -478,14 +479,6 @@ Some context functions add menu items below the separator."
478 `(menu-item "All" 479 `(menu-item "All"
479 ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'buffer)) 480 ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'buffer))
480 :help "Mark the whole buffer for a subsequent cut/copy")) 481 :help "Mark the whole buffer for a subsequent cut/copy"))
481 (define-key-after submenu [mark-defun]
482 `(menu-item "Defun"
483 ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'defun))
484 :help "Mark the defun at click for a subsequent cut/copy"))
485 (define-key-after submenu [mark-list]
486 `(menu-item "List"
487 ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'list))
488 :help "Mark the list at click for a subsequent cut/copy"))
489 (when (let* ((pos (posn-point (event-end click))) 482 (when (let* ((pos (posn-point (event-end click)))
490 (char (when pos (char-after pos)))) 483 (char (when pos (char-after pos))))
491 (or (and char (eq (char-syntax char) ?\")) 484 (or (and char (eq (char-syntax char) ?\"))
@@ -498,10 +491,6 @@ Some context functions add menu items below the separator."
498 `(menu-item "Line" 491 `(menu-item "Line"
499 ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'line)) 492 ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'line))
500 :help "Mark the line at click for a subsequent cut/copy")) 493 :help "Mark the line at click for a subsequent cut/copy"))
501 (define-key-after submenu [mark-symbol]
502 `(menu-item "Symbol"
503 ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'symbol))
504 :help "Mark the symbol at click for a subsequent cut/copy"))
505 (when (region-active-p) 494 (when (region-active-p)
506 (define-key-after submenu [mark-none] 495 (define-key-after submenu [mark-none]
507 `(menu-item "None" 496 `(menu-item "None"
diff --git a/lisp/net/dictionary.el b/lisp/net/dictionary.el
index 86447c2c351..1d07989ef57 100644
--- a/lisp/net/dictionary.el
+++ b/lisp/net/dictionary.el
@@ -1382,10 +1382,12 @@ When you add this function to `context-menu-functions',
1382the context menu will contain an item that searches 1382the context menu will contain an item that searches
1383the word at mouse click." 1383the word at mouse click."
1384 (when (thing-at-mouse click 'word) 1384 (when (thing-at-mouse click 'word)
1385 (define-key menu [dictionary-separator] menu-bar-separator) 1385 (define-key-after menu [dictionary-separator] menu-bar-separator
1386 (define-key menu [dictionary-search-word-at-mouse] 1386 'middle-separator)
1387 (define-key-after menu [dictionary-search-word-at-mouse]
1387 '(menu-item "Dictionary Search" dictionary-search-word-at-mouse 1388 '(menu-item "Dictionary Search" dictionary-search-word-at-mouse
1388 :help "Search the word at mouse click in dictionary"))) 1389 :help "Search the word at mouse click in dictionary")
1390 'dictionary-separator))
1389 menu) 1391 menu)
1390 1392
1391(provide 'dictionary) 1393(provide 'dictionary)
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el
index 5a00915f4f0..f1c656ec209 100644
--- a/lisp/net/tramp-cache.el
+++ b/lisp/net/tramp-cache.el
@@ -319,12 +319,7 @@ KEY identifies the connection, it is either a process or a
319used to cache connection properties of the local machine. 319used to cache connection properties of the local machine.
320If KEY is `tramp-cache-undefined', or if the value is not set for 320If KEY is `tramp-cache-undefined', or if the value is not set for
321the connection, return DEFAULT." 321the connection, return DEFAULT."
322 ;; Unify key by removing localname and hop from `tramp-file-name' 322 (setq key (tramp-file-name-unify key))
323 ;; structure. Work with a copy in order to avoid side effects.
324 (when (tramp-file-name-p key)
325 (setq key (copy-tramp-file-name key))
326 (setf (tramp-file-name-localname key) nil
327 (tramp-file-name-hop key) nil))
328 (let* ((hash (tramp-get-hash-table key)) 323 (let* ((hash (tramp-get-hash-table key))
329 (cached (if (hash-table-p hash) 324 (cached (if (hash-table-p hash)
330 (gethash property hash tramp-cache-undefined) 325 (gethash property hash tramp-cache-undefined)
@@ -350,12 +345,7 @@ used to cache connection properties of the local machine. If KEY
350is `tramp-cache-undefined', nothing is set. 345is `tramp-cache-undefined', nothing is set.
351PROPERTY is set persistent when KEY is a `tramp-file-name' structure. 346PROPERTY is set persistent when KEY is a `tramp-file-name' structure.
352Return VALUE." 347Return VALUE."
353 ;; Unify key by removing localname and hop from `tramp-file-name' 348 (setq key (tramp-file-name-unify key))
354 ;; structure. Work with a copy in order to avoid side effects.
355 (when (tramp-file-name-p key)
356 (setq key (copy-tramp-file-name key))
357 (setf (tramp-file-name-localname key) nil
358 (tramp-file-name-hop key) nil))
359 (when-let ((hash (tramp-get-hash-table key))) 349 (when-let ((hash (tramp-get-hash-table key)))
360 (puthash property value hash)) 350 (puthash property value hash))
361 (setq tramp-cache-data-changed 351 (setq tramp-cache-data-changed
@@ -379,12 +369,7 @@ KEY identifies the connection, it is either a process or a
379`tramp-file-name' structure. A special case is nil, which is 369`tramp-file-name' structure. A special case is nil, which is
380used to cache connection properties of the local machine. 370used to cache connection properties of the local machine.
381PROPERTY is set persistent when KEY is a `tramp-file-name' structure." 371PROPERTY is set persistent when KEY is a `tramp-file-name' structure."
382 ;; Unify key by removing localname and hop from `tramp-file-name' 372 (setq key (tramp-file-name-unify key))
383 ;; structure. Work with a copy in order to avoid side effects.
384 (when (tramp-file-name-p key)
385 (setq key (copy-tramp-file-name key))
386 (setf (tramp-file-name-localname key) nil
387 (tramp-file-name-hop key) nil))
388 (when-let ((hash (tramp-get-hash-table key))) 373 (when-let ((hash (tramp-get-hash-table key)))
389 (remhash property hash)) 374 (remhash property hash))
390 (setq tramp-cache-data-changed 375 (setq tramp-cache-data-changed
@@ -397,12 +382,7 @@ PROPERTY is set persistent when KEY is a `tramp-file-name' structure."
397KEY identifies the connection, it is either a process or a 382KEY identifies the connection, it is either a process or a
398`tramp-file-name' structure. A special case is nil, which is 383`tramp-file-name' structure. A special case is nil, which is
399used to cache connection properties of the local machine." 384used to cache connection properties of the local machine."
400 ;; Unify key by removing localname and hop from `tramp-file-name' 385 (setq key (tramp-file-name-unify key))
401 ;; structure. Work with a copy in order to avoid side effects.
402 (when (tramp-file-name-p key)
403 (setq key (copy-tramp-file-name key))
404 (setf (tramp-file-name-localname key) nil
405 (tramp-file-name-hop key) nil))
406 (tramp-message 386 (tramp-message
407 key 7 "%s %s" key 387 key 7 "%s %s" key
408 (when-let ((hash (gethash key tramp-cache-data))) 388 (when-let ((hash (gethash key tramp-cache-data)))
diff --git a/lisp/net/tramp-fuse.el b/lisp/net/tramp-fuse.el
index 8c5afa7cf93..d2bac2d0ee2 100644
--- a/lisp/net/tramp-fuse.el
+++ b/lisp/net/tramp-fuse.el
@@ -175,15 +175,30 @@
175 mount) 175 mount)
176 (match-string 1 mount))))))) 176 (match-string 1 mount)))))))
177 177
178(defun tramp-fuse-get-fusermount ()
179 "Determine the local `fusermount' command."
180 ;; We use key nil for local connection properties.
181 (with-tramp-connection-property nil "fusermount"
182 (or (executable-find "fusermount3")
183 (executable-find "fusermount"))))
184
185(defvar tramp-fuse-mount-points nil
186 "List of fuse volume determined by a VEC.")
187
178(defun tramp-fuse-unmount (vec) 188(defun tramp-fuse-unmount (vec)
179 "Unmount fuse volume determined by VEC." 189 "Unmount fuse volume determined by VEC."
180 (let ((default-directory tramp-compat-temporary-file-directory) 190 (let* ((default-directory tramp-compat-temporary-file-directory)
181 (command (format "fusermount3 -u %s" (tramp-fuse-mount-point vec)))) 191 (mount-point (tramp-fuse-mount-point vec))
192 (command (format "%s -u %s" (tramp-fuse-get-fusermount) mount-point)))
182 (tramp-message vec 6 "%s\n%s" command (shell-command-to-string command)) 193 (tramp-message vec 6 "%s\n%s" command (shell-command-to-string command))
183 (tramp-flush-connection-property 194 (tramp-flush-connection-property
184 (tramp-get-connection-process vec) "mounted") 195 (tramp-get-connection-process vec) "mounted")
196 (setq tramp-fuse-mount-points
197 (delete (tramp-file-name-unify vec) tramp-fuse-mount-points))
185 ;; Give the caches a chance to expire. 198 ;; Give the caches a chance to expire.
186 (sleep-for 1))) 199 (sleep-for 1)
200 (when (tramp-compat-directory-empty-p mount-point)
201 (delete-directory mount-point))))
187 202
188(defun tramp-fuse-local-file-name (filename) 203(defun tramp-fuse-local-file-name (filename)
189 "Return local mount name of FILENAME." 204 "Return local mount name of FILENAME."
@@ -205,6 +220,36 @@
205 (substring localname 1) localname) 220 (substring localname 1) localname)
206 (tramp-fuse-mount-point v))))))) 221 (tramp-fuse-mount-point v)))))))
207 222
223(defcustom tramp-fuse-unmount-on-cleanup nil
224 "Whether fuse volumes shall be unmounted on cleanup."
225 :group 'tramp
226 :version "28.1"
227 :type 'boolean)
228
229(defun tramp-fuse-cleanup (vec)
230 "Cleanup fuse volume determined by VEC."
231 (and tramp-fuse-unmount-on-cleanup
232 (member (tramp-file-name-unify vec) tramp-fuse-mount-points)
233 (tramp-fuse-unmount vec)))
234
235(defun tramp-fuse-cleanup-all ()
236 "Unmount all fuse volumes used by Tramp."
237 (and tramp-fuse-unmount-on-cleanup
238 (mapc #'tramp-fuse-unmount tramp-fuse-mount-points)))
239
240;; Add cleanup hooks.
241(add-hook 'tramp-cleanup-connection-hook #'tramp-fuse-cleanup)
242(add-hook 'tramp-cleanup-all-connections-hook #'tramp-fuse-cleanup-all)
243(add-hook 'kill-emacs-hook #'tramp-fuse-cleanup-all)
244(add-hook 'tramp-fuse-unload-hook
245 (lambda ()
246 (remove-hook 'tramp-cleanup-connection-hook
247 #'tramp-fuse-cleanup)
248 (remove-hook 'tramp-cleanup-all-connections-hook
249 #'tramp-fuse-cleanup-all)
250 (remove-hook 'kill-emacs-hook
251 #'tramp-fuse-cleanup-all)))
252
208(add-hook 'tramp-unload-hook 253(add-hook 'tramp-unload-hook
209 (lambda () 254 (lambda ()
210 (unload-feature 'tramp-fuse 'force))) 255 (unload-feature 'tramp-fuse 'force)))
diff --git a/lisp/net/tramp-rclone.el b/lisp/net/tramp-rclone.el
index 49e366c01c6..812e06f3f11 100644
--- a/lisp/net/tramp-rclone.el
+++ b/lisp/net/tramp-rclone.el
@@ -386,6 +386,7 @@ connection if a previous connection has died for some reason."
386 (tramp-cleanup-connection vec 'keep-debug 'keep-password)) 386 (tramp-cleanup-connection vec 'keep-debug 'keep-password))
387 387
388 ;; Mark it as connected. 388 ;; Mark it as connected.
389 (add-to-list 'tramp-fuse-mount-points (tramp-file-name-unify vec))
389 (tramp-set-connection-property 390 (tramp-set-connection-property
390 (tramp-get-connection-process vec) "connected" t)))) 391 (tramp-get-connection-process vec) "connected" t))))
391 392
diff --git a/lisp/net/tramp-sshfs.el b/lisp/net/tramp-sshfs.el
index 0019ac014f8..2be0485fbf1 100644
--- a/lisp/net/tramp-sshfs.el
+++ b/lisp/net/tramp-sshfs.el
@@ -222,11 +222,14 @@ arguments to pass to the OPERATION."
222(defun tramp-sshfs-handle-insert-file-contents 222(defun tramp-sshfs-handle-insert-file-contents
223 (filename &optional visit beg end replace) 223 (filename &optional visit beg end replace)
224 "Like `insert-file-contents' for Tramp files." 224 "Like `insert-file-contents' for Tramp files."
225 (let ((result 225 (setq filename (expand-file-name filename))
226 (insert-file-contents 226 (let (signal-hook-function result)
227 (tramp-fuse-local-file-name filename) visit beg end replace))) 227 (unwind-protect
228 (when visit (setq buffer-file-name filename)) 228 (setq result
229 (cons (expand-file-name filename) (cdr result)))) 229 (insert-file-contents
230 (tramp-fuse-local-file-name filename) visit beg end replace))
231 (when visit (setq buffer-file-name filename))
232 (cons filename (cdr result)))))
230 233
231(defun tramp-sshfs-handle-process-file 234(defun tramp-sshfs-handle-process-file
232 (program &optional infile destination display &rest args) 235 (program &optional infile destination display &rest args)
@@ -368,6 +371,7 @@ connection if a previous connection has died for some reason."
368 vec 'file-error "Error mounting %s" (tramp-fuse-mount-spec vec)))) 371 vec 'file-error "Error mounting %s" (tramp-fuse-mount-spec vec))))
369 372
370 ;; Mark it as connected. 373 ;; Mark it as connected.
374 (add-to-list 'tramp-fuse-mount-points (tramp-file-name-unify vec))
371 (tramp-set-connection-property 375 (tramp-set-connection-property
372 (tramp-get-connection-process vec) "connected" t))) 376 (tramp-get-connection-process vec) "connected" t)))
373 377
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 62628363b77..c0f1cb161ec 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1450,16 +1450,24 @@ If nil, return `tramp-default-port'."
1450 1450
1451(put #'tramp-file-name-port-or-default 'tramp-suppress-trace t) 1451(put #'tramp-file-name-port-or-default 'tramp-suppress-trace t)
1452 1452
1453(defun tramp-file-name-unify (vec)
1454 "Unify VEC by removing localname and hop from `tramp-file-name' structure.
1455Objects returned by this function compare `equal' if they refer to the
1456same connection. Make a copy in order to avoid side effects."
1457 (when (tramp-file-name-p vec)
1458 (setq vec (copy-tramp-file-name vec))
1459 (setf (tramp-file-name-localname vec) nil
1460 (tramp-file-name-hop vec) nil))
1461 vec)
1462
1463(put #'tramp-file-name-unify 'tramp-suppress-trace t)
1464
1453;; Comparison of file names is performed by `tramp-equal-remote'. 1465;; Comparison of file names is performed by `tramp-equal-remote'.
1454(defun tramp-file-name-equal-p (vec1 vec2) 1466(defun tramp-file-name-equal-p (vec1 vec2)
1455 "Check, whether VEC1 and VEC2 denote the same `tramp-file-name'." 1467 "Check, whether VEC1 and VEC2 denote the same `tramp-file-name'."
1456 (and (tramp-file-name-p vec1) (tramp-file-name-p vec2) 1468 (and (tramp-file-name-p vec1) (tramp-file-name-p vec2)
1457 (string-equal (tramp-file-name-method vec1) 1469 (equal (tramp-file-name-unify vec1)
1458 (tramp-file-name-method vec2)) 1470 (tramp-file-name-unify vec2))))
1459 (string-equal (tramp-file-name-user-domain vec1)
1460 (tramp-file-name-user-domain vec2))
1461 (string-equal (tramp-file-name-host-port vec1)
1462 (tramp-file-name-host-port vec2))))
1463 1471
1464(defun tramp-get-method-parameter (vec param) 1472(defun tramp-get-method-parameter (vec param)
1465 "Return the method parameter PARAM. 1473 "Return the method parameter PARAM.
@@ -3743,7 +3751,8 @@ User is always nil."
3743 (with-parsed-tramp-file-name filename nil 3751 (with-parsed-tramp-file-name filename nil
3744 (unwind-protect 3752 (unwind-protect
3745 (if (not (file-exists-p filename)) 3753 (if (not (file-exists-p filename))
3746 (tramp-compat-file-missing v filename) 3754 (let ((tramp-verbose (if visit 0 tramp-verbose)))
3755 (tramp-compat-file-missing v filename))
3747 3756
3748 (with-tramp-progress-reporter 3757 (with-tramp-progress-reporter
3749 v 3 (format-message "Inserting `%s'" filename) 3758 v 3 (format-message "Inserting `%s'" filename)
@@ -3845,7 +3854,7 @@ User is always nil."
3845 (delete-file (tramp-make-tramp-file-name v remote-copy 'nohop)))) 3854 (delete-file (tramp-make-tramp-file-name v remote-copy 'nohop))))
3846 3855
3847 ;; Result. 3856 ;; Result.
3848 (cons (expand-file-name filename) (cdr result))))) 3857 (cons filename (cdr result)))))
3849 3858
3850(defun tramp-get-lock-file (file) 3859(defun tramp-get-lock-file (file)
3851 "Read lockfile info of FILE. 3860 "Read lockfile info of FILE.
@@ -3920,7 +3929,8 @@ Return nil when there is no lockfile."
3920 (tramp-error v 'file-error "Unsafe lock file name"))) 3929 (tramp-error v 'file-error "Unsafe lock file name")))
3921 3930
3922 ;; Do the lock. 3931 ;; Do the lock.
3923 (let (create-lockfiles signal-hook-function) 3932 (let ((tramp-verbose 0)
3933 create-lockfiles signal-hook-function)
3924 (condition-case nil 3934 (condition-case nil
3925 (make-symbolic-link info lockname 'ok-if-already-exists) 3935 (make-symbolic-link info lockname 'ok-if-already-exists)
3926 (error 3936 (error
diff --git a/lisp/org/ob-gnuplot.el b/lisp/org/ob-gnuplot.el
index 3c84e4da14f..8c4a5957b99 100644
--- a/lisp/org/ob-gnuplot.el
+++ b/lisp/org/ob-gnuplot.el
@@ -290,7 +290,7 @@ Pass PARAMS through to `orgtbl-to-generic' when exporting TABLE."
290 (orgtbl-to-generic 290 (orgtbl-to-generic
291 table 291 table
292 (org-combine-plists 292 (org-combine-plists
293 '(:sep "\t" :fmt org-babel-gnuplot-quote-tsv-field) 293 '(:sep "\t" :fmt org-babel-gnuplot-quote-tsv-field :raw t :backend ascii)
294 params))))) 294 params)))))
295 data-file) 295 data-file)
296 296
diff --git a/lisp/org/ob-julia.el b/lisp/org/ob-julia.el
index 5ff6a7ca0a7..4fae0d142b2 100644
--- a/lisp/org/ob-julia.el
+++ b/lisp/org/ob-julia.el
@@ -6,20 +6,20 @@
6;; Keywords: literate programming, reproducible research, scientific computing 6;; Keywords: literate programming, reproducible research, scientific computing
7;; Homepage: https://github.com/phrb/ob-julia 7;; Homepage: https://github.com/phrb/ob-julia
8 8
9;; This file is not part of GNU Emacs. 9;; This file is part of GNU Emacs.
10 10
11;; This program is free software; you can redistribute it and/or modify 11;; GNU Emacs is free software: you can redistribute it and/or modify
12;; it under the terms of the GNU General Public License as published by 12;; it under the terms of the GNU General Public License as published by
13;; the Free Software Foundation, either version 3 of the License, or 13;; the Free Software Foundation, either version 3 of the License, or
14;; (at your option) any later version. 14;; (at your option) any later version.
15 15
16;; This program is distributed in the hope that it will be useful, 16;; GNU Emacs is distributed in the hope that it will be useful,
17;; but WITHOUT ANY WARRANTY; without even the implied warranty of 17;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;; GNU General Public License for more details. 19;; GNU General Public License for more details.
20 20
21;; You should have received a copy of the GNU General Public License 21;; You should have received a copy of the GNU General Public License
22;; along with this program. If not, see <https://www.gnu.org/licenses/>. 22;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
23 23
24;;; Commentary: 24;;; Commentary:
25 25
@@ -90,18 +90,13 @@ This function is called by `org-babel-execute-src-block'."
90 (graphics-file (and (member "graphics" (assq :result-params params)) 90 (graphics-file (and (member "graphics" (assq :result-params params))
91 (org-babel-graphical-output-file params))) 91 (org-babel-graphical-output-file params)))
92 (colnames-p (unless graphics-file (cdr (assq :colnames params)))) 92 (colnames-p (unless graphics-file (cdr (assq :colnames params))))
93 ;; (rownames-p (unless graphics-file (cdr (assq :rownames params))))
94 (full-body (org-babel-expand-body:julia body params graphics-file)) 93 (full-body (org-babel-expand-body:julia body params graphics-file))
95 (result 94 (result
96 (org-babel-julia-evaluate 95 (org-babel-julia-evaluate
97 session full-body result-type result-params 96 session full-body result-type result-params
98 (or (equal "yes" colnames-p) 97 (or (equal "yes" colnames-p)
99 (org-babel-pick-name 98 (org-babel-pick-name
100 (cdr (assq :colname-names params)) colnames-p)) 99 (cdr (assq :colname-names params)) colnames-p)))))
101 ;; (or (equal "yes" rownames-p)
102 ;; (org-babel-pick-name
103 ;; (cdr (assq :rowname-names params)) rownames-p))
104 )))
105 (if graphics-file nil result)))) 100 (if graphics-file nil result))))
106 101
107(defun org-babel-normalize-newline (result) 102(defun org-babel-normalize-newline (result)
@@ -135,12 +130,7 @@ This function is called by `org-babel-execute-src-block'."
135 "Return list of julia statements assigning the block's variables." 130 "Return list of julia statements assigning the block's variables."
136 (let ((vars (org-babel--get-vars params))) 131 (let ((vars (org-babel--get-vars params)))
137 (mapcar 132 (mapcar
138 (lambda (pair) 133 (lambda (pair) (org-babel-julia-assign-elisp (car pair) (cdr pair)))
139 (org-babel-julia-assign-elisp
140 (car pair) (cdr pair)
141 ;; (equal "yes" (cdr (assq :colnames params)))
142 ;; (equal "yes" (cdr (assq :rownames params)))
143 ))
144 (mapcar 134 (mapcar
145 (lambda (i) 135 (lambda (i)
146 (cons (car (nth i vars)) 136 (cons (car (nth i vars))
@@ -156,7 +146,7 @@ This function is called by `org-babel-execute-src-block'."
156 (concat "\"" (mapconcat #'identity (split-string s "\"") "\"\"") "\"") 146 (concat "\"" (mapconcat #'identity (split-string s "\"") "\"\"") "\"")
157 (format "%S" s))) 147 (format "%S" s)))
158 148
159(defun org-babel-julia-assign-elisp (name value) ;; colnames-p rownames-p 149(defun org-babel-julia-assign-elisp (name value)
160 "Construct julia code assigning the elisp VALUE to a variable named NAME." 150 "Construct julia code assigning the elisp VALUE to a variable named NAME."
161 (if (listp value) 151 (if (listp value)
162 (let* ((lengths (mapcar #'length (cl-remove-if-not #'sequencep value))) 152 (let* ((lengths (mapcar #'length (cl-remove-if-not #'sequencep value)))
@@ -164,11 +154,7 @@ This function is called by `org-babel-execute-src-block'."
164 (min (if lengths (apply #'min lengths) 0))) 154 (min (if lengths (apply #'min lengths) 0)))
165 ;; Ensure VALUE has an orgtbl structure (depth of at least 2). 155 ;; Ensure VALUE has an orgtbl structure (depth of at least 2).
166 (unless (listp (car value)) (setq value (list value))) 156 (unless (listp (car value)) (setq value (list value)))
167 (let ((file (orgtbl-to-csv value '(:fmt org-babel-julia-quote-csv-field))) 157 (let ((file (orgtbl-to-csv value '(:fmt org-babel-julia-quote-csv-field))))
168 ;; (header (if (or (eq (nth 1 value) 'hline) colnames-p)
169 ;; "TRUE" "FALSE"))
170 ;; (row-names (if rownames-p "1" "NULL"))
171 )
172 (if (= max min) 158 (if (= max min)
173 (format "%s = begin 159 (format "%s = begin
174 using CSV 160 using CSV
@@ -188,7 +174,7 @@ end"
188 (let ((session (or session "*Julia*")) 174 (let ((session (or session "*Julia*"))
189 (ess-ask-for-ess-directory 175 (ess-ask-for-ess-directory
190 (and (bound-and-true-p ess-ask-for-ess-directory) 176 (and (bound-and-true-p ess-ask-for-ess-directory)
191 (not (cdr (assq :dir params)))))) 177 (not (cdr (assq :dir params))))))
192 (if (org-babel-comint-buffer-livep session) 178 (if (org-babel-comint-buffer-livep session)
193 session 179 session
194 ;; FIXME: Depending on `display-buffer-alist', (julia) may end up 180 ;; FIXME: Depending on `display-buffer-alist', (julia) may end up
@@ -209,14 +195,6 @@ end"
209 (buffer-name)))) 195 (buffer-name))))
210 (current-buffer)))))) 196 (current-buffer))))))
211 197
212 ; (defun org-babel-julia-associate-session (session)
213 ; "Associate julia code buffer with a julia session.
214 ; Make SESSION be the inferior ESS process associated with the
215 ; current code buffer."
216 ; (setq ess-local-process-name
217 ; (process-name (get-buffer-process session)))
218 ; (ess-make-buffer-current))
219
220(defun org-babel-julia-graphical-output-file (params) 198(defun org-babel-julia-graphical-output-file (params)
221 "Name of file to which julia should send graphical output." 199 "Name of file to which julia should send graphical output."
222 (and (member "graphics" (cdr (assq :result-params params))) 200 (and (member "graphics" (cdr (assq :result-params params)))
@@ -259,16 +237,16 @@ end"
259end") 237end")
260 238
261(defun org-babel-julia-evaluate 239(defun org-babel-julia-evaluate
262 (session body result-type result-params column-names-p) ;; row-names-p 240 (session body result-type result-params column-names-p)
263 "Evaluate julia code in BODY." 241 "Evaluate julia code in BODY."
264 (if session 242 (if session
265 (org-babel-julia-evaluate-session 243 (org-babel-julia-evaluate-session
266 session body result-type result-params column-names-p) ;; row-names-p 244 session body result-type result-params column-names-p)
267 (org-babel-julia-evaluate-external-process 245 (org-babel-julia-evaluate-external-process
268 body result-type result-params column-names-p))) ;; row-names-p 246 body result-type result-params column-names-p)))
269 247
270(defun org-babel-julia-evaluate-external-process 248(defun org-babel-julia-evaluate-external-process
271 (body result-type result-params column-names-p) ;; row-names-p 249 (body result-type result-params column-names-p)
272 "Evaluate BODY in external julia process. 250 "Evaluate BODY in external julia process.
273If RESULT-TYPE equals 'output then return standard output as a 251If RESULT-TYPE equals 'output then return standard output as a
274string. If RESULT-TYPE equals 'value then return the value of the 252string. If RESULT-TYPE equals 'value then return the value of the
@@ -292,7 +270,7 @@ last statement in BODY, as elisp."
292 (output (org-babel-eval org-babel-julia-command body)))) 270 (output (org-babel-eval org-babel-julia-command body))))
293 271
294(defun org-babel-julia-evaluate-session 272(defun org-babel-julia-evaluate-session
295 (session body result-type result-params column-names-p) ;; row-names-p 273 (session body result-type result-params column-names-p)
296 "Evaluate BODY in SESSION. 274 "Evaluate BODY in SESSION.
297If RESULT-TYPE equals 'output then return standard output as a 275If RESULT-TYPE equals 'output then return standard output as a
298string. If RESULT-TYPE equals 'value then return the value of the 276string. If RESULT-TYPE equals 'value then return the value of the
diff --git a/lisp/org/oc-basic.el b/lisp/org/oc-basic.el
index 3b589908e04..98242f3b841 100644
--- a/lisp/org/oc-basic.el
+++ b/lisp/org/oc-basic.el
@@ -4,18 +4,20 @@
4 4
5;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr> 5;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
6 6
7;; This program is free software; you can redistribute it and/or modify 7;; This file is part of GNU Emacs.
8
9;; GNU Emacs is free software: you can redistribute it and/or modify
8;; it under the terms of the GNU General Public License as published by 10;; it under the terms of the GNU General Public License as published by
9;; the Free Software Foundation, either version 3 of the License, or 11;; the Free Software Foundation, either version 3 of the License, or
10;; (at your option) any later version. 12;; (at your option) any later version.
11 13
12;; This program is distributed in the hope that it will be useful, 14;; GNU Emacs is distributed in the hope that it will be useful,
13;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;; GNU General Public License for more details. 17;; GNU General Public License for more details.
16 18
17;; You should have received a copy of the GNU General Public License 19;; You should have received a copy of the GNU General Public License
18;; along with this program. If not, see <https://www.gnu.org/licenses/>. 20;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
19 21
20;;; Commentary: 22;;; Commentary:
21 23
@@ -87,42 +89,42 @@
87 :group 'org-cite 89 :group 'org-cite
88 :package-version '(Org . "9.5") 90 :package-version '(Org . "9.5")
89 :type 'symbol 91 :type 'symbol
90 :safe t) 92 :safe #'symbolp)
91 93
92(defcustom org-cite-basic-author-year-separator ", " 94(defcustom org-cite-basic-author-year-separator ", "
93 "String used to separate cites in an author-year configuration." 95 "String used to separate cites in an author-year configuration."
94 :group 'org-cite 96 :group 'org-cite
95 :package-version '(Org . "9.5") 97 :package-version '(Org . "9.5")
96 :type 'string 98 :type 'string
97 :safe t) 99 :safe #'stringp)
98 100
99(defcustom org-cite-basic-max-key-distance 2 101(defcustom org-cite-basic-max-key-distance 2
100 "Maximum (Levenshtein) distance between a wrong key and its suggestions." 102 "Maximum (Levenshtein) distance between a wrong key and its suggestions."
101 :group 'org-cite 103 :group 'org-cite
102 :package-version '(Org . "9.5") 104 :package-version '(Org . "9.5")
103 :type 'integer 105 :type 'integer
104 :safe t) 106 :safe #'integerp)
105 107
106(defcustom org-cite-basic-author-column-end 25 108(defcustom org-cite-basic-author-column-end 25
107 "Column where author field ends in completion table, as an integer." 109 "Column where author field ends in completion table, as an integer."
108 :group 'org-cite 110 :group 'org-cite
109 :package-version '(Org . "9.5") 111 :package-version '(Org . "9.5")
110 :type 'integer 112 :type 'integer
111 :safe t) 113 :safe #'integerp)
112 114
113(defcustom org-cite-basic-column-separator " " 115(defcustom org-cite-basic-column-separator " "
114 "Column separator in completion table, as a string." 116 "Column separator in completion table, as a string."
115 :group 'org-cite 117 :group 'org-cite
116 :package-version '(Org . "9.5") 118 :package-version '(Org . "9.5")
117 :type 'string 119 :type 'string
118 :safe t) 120 :safe #'stringp)
119 121
120(defcustom org-cite-basic-mouse-over-key-face 'highlight 122(defcustom org-cite-basic-mouse-over-key-face 'highlight
121 "Face used when mouse is over a citation key." 123 "Face used when mouse is over a citation key."
122 :group 'org-cite 124 :group 'org-cite
123 :package-version '(Org . "9.5") 125 :package-version '(Org . "9.5")
124 :type 'face 126 :type 'face
125 :safe t) 127 :safe #'facep)
126 128
127 129
128;;; Internal variables 130;;; Internal variables
diff --git a/lisp/org/oc-biblatex.el b/lisp/org/oc-biblatex.el
index a27f9e9bf10..f517e391398 100644
--- a/lisp/org/oc-biblatex.el
+++ b/lisp/org/oc-biblatex.el
@@ -4,18 +4,20 @@
4 4
5;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr> 5;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
6 6
7;; This program is free software; you can redistribute it and/or modify 7;; This file is part of GNU Emacs.
8
9;; GNU Emacs is free software: you can redistribute it and/or modify
8;; it under the terms of the GNU General Public License as published by 10;; it under the terms of the GNU General Public License as published by
9;; the Free Software Foundation, either version 3 of the License, or 11;; the Free Software Foundation, either version 3 of the License, or
10;; (at your option) any later version. 12;; (at your option) any later version.
11 13
12;; This program is distributed in the hope that it will be useful, 14;; GNU Emacs is distributed in the hope that it will be useful,
13;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;; GNU General Public License for more details. 17;; GNU General Public License for more details.
16 18
17;; You should have received a copy of the GNU General Public License 19;; You should have received a copy of the GNU General Public License
18;; along with this program. If not, see <https://www.gnu.org/licenses/>. 20;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
19 21
20;;; Commentary: 22;;; Commentary:
21 23
@@ -78,7 +80,7 @@ If \"biblatex\" package is already required in the document, e.g., through
78 :type '(choice 80 :type '(choice
79 (string :tag "Options (key=value,key2=value2...)") 81 (string :tag "Options (key=value,key2=value2...)")
80 (const :tag "No option" nil)) 82 (const :tag "No option" nil))
81 :safe t) 83 :safe #'string-or-null-p)
82 84
83 85
84;;; Internal functions 86;;; Internal functions
diff --git a/lisp/org/oc-csl.el b/lisp/org/oc-csl.el
index 5623efcc1b3..3d138807592 100644
--- a/lisp/org/oc-csl.el
+++ b/lisp/org/oc-csl.el
@@ -4,18 +4,20 @@
4 4
5;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr> 5;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
6 6
7;; This program is free software; you can redistribute it and/or modify 7;; This file is part of GNU Emacs.
8
9;; GNU Emacs is free software: you can redistribute it and/or modify
8;; it under the terms of the GNU General Public License as published by 10;; it under the terms of the GNU General Public License as published by
9;; the Free Software Foundation, either version 3 of the License, or 11;; the Free Software Foundation, either version 3 of the License, or
10;; (at your option) any later version. 12;; (at your option) any later version.
11 13
12;; This program is distributed in the hope that it will be useful, 14;; GNU Emacs is distributed in the hope that it will be useful,
13;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;; GNU General Public License for more details. 17;; GNU General Public License for more details.
16 18
17;; You should have received a copy of the GNU General Public License 19;; You should have received a copy of the GNU General Public License
18;; along with this program. If not, see <https://www.gnu.org/licenses/>. 20;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
19 21
20;;; Commentary: 22;;; Commentary:
21 23
@@ -125,7 +127,9 @@ If nil then only the fallback en-US locale will be available."
125 :type '(choice 127 :type '(choice
126 (directory :tag "Locales directory") 128 (directory :tag "Locales directory")
127 (const :tag "Use en-US locale only" nil)) 129 (const :tag "Use en-US locale only" nil))
128 :safe t) 130 ;; It's not obvious to me that arbitrary locations are safe.
131;;; :safe #'string-or-null-p
132 )
129 133
130(defcustom org-cite-csl-styles-dir nil 134(defcustom org-cite-csl-styles-dir nil
131 "Directory of CSL style files. 135 "Directory of CSL style files.
@@ -136,7 +140,9 @@ directory. This variable is ignored when style file is absolute."
136 :type '(choice 140 :type '(choice
137 (directory :tag "Styles directory") 141 (directory :tag "Styles directory")
138 (const :tag "Use absolute file names" nil)) 142 (const :tag "Use absolute file names" nil))
139 :safe t) 143 ;; It's not obvious to me that arbitrary locations are safe.
144;;; :safe #'string-or-null-p
145 )
140 146
141;;;; Citelinks 147;;;; Citelinks
142(defcustom org-cite-csl-link-cites t 148(defcustom org-cite-csl-link-cites t
@@ -144,7 +150,7 @@ directory. This variable is ignored when style file is absolute."
144 :group 'org-cite 150 :group 'org-cite
145 :package-version '(Org . "9.5") 151 :package-version '(Org . "9.5")
146 :type 'boolean 152 :type 'boolean
147 :safe t) 153 :safe #'booleanp)
148 154
149(defcustom org-cite-csl-no-citelinks-backends '(ascii) 155(defcustom org-cite-csl-no-citelinks-backends '(ascii)
150 "List of export back-ends for which cite linking is disabled. 156 "List of export back-ends for which cite linking is disabled.
@@ -152,8 +158,7 @@ Cite linking for export back-ends derived from any of the back-ends listed here,
152is also disabled." 158is also disabled."
153 :group 'org-cite 159 :group 'org-cite
154 :package-version '(Org . "9.5") 160 :package-version '(Org . "9.5")
155 :type '(repeat symbol) 161 :type '(repeat symbol))
156 :safe t)
157 162
158;;;; Output-specific variables 163;;;; Output-specific variables
159(defcustom org-cite-csl-html-hanging-indent "1.5em" 164(defcustom org-cite-csl-html-hanging-indent "1.5em"
@@ -161,7 +166,7 @@ is also disabled."
161 :group 'org-cite 166 :group 'org-cite
162 :package-version '(Org . "9.5") 167 :package-version '(Org . "9.5")
163 :type 'string 168 :type 'string
164 :safe t) 169 :safe #'stringp)
165 170
166(defcustom org-cite-csl-html-label-width-per-char "0.6em" 171(defcustom org-cite-csl-html-label-width-per-char "0.6em"
167 "Character width in CSS units for calculating entry label widths. 172 "Character width in CSS units for calculating entry label widths.
@@ -169,27 +174,33 @@ Used only when `second-field-align' is activated by the used CSL style."
169 :group 'org-cite 174 :group 'org-cite
170 :package-version '(Org . "9.5") 175 :package-version '(Org . "9.5")
171 :type 'string 176 :type 'string
172 :safe t) 177 :safe #'stringp)
173 178
174(defcustom org-cite-csl-latex-hanging-indent "1.5em" 179(defcustom org-cite-csl-latex-hanging-indent "1.5em"
175 "Size of hanging-indent for LaTeX output in valid LaTeX units." 180 "Size of hanging-indent for LaTeX output in valid LaTeX units."
176 :group 'org-cite 181 :group 'org-cite
177 :package-version '(Org . "9.5") 182 :package-version '(Org . "9.5")
178 :type 'string 183 :type 'string
179 :safe t) 184 :safe #'stringp)
180 185
181 186
182;;; Internal variables 187;;; Internal variables
183(defconst org-cite-csl--etc-dir 188(defconst org-cite-csl--etc-dir
184 (let* ((oc-root (file-name-directory (locate-library "oc"))) 189 (let ((oc-root (file-name-directory (locate-library "oc"))))
185 (oc-etc-dir-1 (expand-file-name "../etc/csl/" oc-root))) 190 (cond
186 ;; package.el and straight will put all of org-mode/lisp/ in org-mode/. 191 ;; First check whether it looks like we're running from the main
187 ;; This will cause .. to resolve to the directory above Org. 192 ;; Org repository.
188 ;; To make life easier for people using package.el or straight, we can 193 ((let ((csl-org (expand-file-name "../etc/csl/" oc-root)))
189 ;; check to see if ../etc/csl exists, and if it doesn't try ./etc/csl. 194 (and (file-directory-p csl-org) csl-org)))
190 (if (file-exists-p oc-etc-dir-1) oc-etc-dir-1 195 ;; Next look for the directory alongside oc.el because package.el
191 (expand-file-name "etc/csl/" oc-root))) 196 ;; and straight will put all of org-mode/lisp/ in org-mode/.
192 "Directory \"etc/\" from repository.") 197 ((let ((csl-pkg (expand-file-name "etc/csl/" oc-root)))
198 (and (file-directory-p csl-pkg) csl-pkg)))
199 ;; Finally fall back the location used by shared system installs
200 ;; and when running directly from Emacs repository.
201 (t
202 (expand-file-name "org/csl/" data-directory))))
203 "Directory containing CSL-related data files.")
193 204
194(defconst org-cite-csl--fallback-locales-dir org-cite-csl--etc-dir 205(defconst org-cite-csl--fallback-locales-dir org-cite-csl--etc-dir
195 "Fallback CSL locale files directory.") 206 "Fallback CSL locale files directory.")
diff --git a/lisp/org/oc-natbib.el b/lisp/org/oc-natbib.el
index 7e2127bd8d9..13cac9ed0b9 100644
--- a/lisp/org/oc-natbib.el
+++ b/lisp/org/oc-natbib.el
@@ -4,18 +4,20 @@
4 4
5;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr> 5;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
6 6
7;; This program is free software; you can redistribute it and/or modify 7;; This file is part of GNU Emacs.
8
9;; GNU Emacs is free software: you can redistribute it and/or modify
8;; it under the terms of the GNU General Public License as published by 10;; it under the terms of the GNU General Public License as published by
9;; the Free Software Foundation, either version 3 of the License, or 11;; the Free Software Foundation, either version 3 of the License, or
10;; (at your option) any later version. 12;; (at your option) any later version.
11 13
12;; This program is distributed in the hope that it will be useful, 14;; GNU Emacs is distributed in the hope that it will be useful,
13;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;; GNU General Public License for more details. 17;; GNU General Public License for more details.
16 18
17;; You should have received a copy of the GNU General Public License 19;; You should have received a copy of the GNU General Public License
18;; along with this program. If not, see <https://www.gnu.org/licenses/>. 20;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
19 21
20;;; Commentary: 22;;; Commentary:
21 23
@@ -69,8 +71,7 @@ If \"natbib\" package is already required in the document, e.g., through
69 (const :tag "order as above, but numerical citations are compressed if possible" sort&compress) 71 (const :tag "order as above, but numerical citations are compressed if possible" sort&compress)
70 (const :tag "display full author list on first citation, abbreviate the others" longnamesfirst) 72 (const :tag "display full author list on first citation, abbreviate the others" longnamesfirst)
71 (const :tag "redefine \\thebibliography to issue \\section* instead of \\chapter*" sectionbib) 73 (const :tag "redefine \\thebibliography to issue \\section* instead of \\chapter*" sectionbib)
72 (const :tag "keep all the authors' names in a citation on one line" nonamebreak)) 74 (const :tag "keep all the authors' names in a citation on one line" nonamebreak)))
73 :safe t)
74 75
75 76
76;;; Internal functions 77;;; Internal functions
diff --git a/lisp/org/oc.el b/lisp/org/oc.el
index eb2b7a16953..bbf2195fbd8 100644
--- a/lisp/org/oc.el
+++ b/lisp/org/oc.el
@@ -4,18 +4,20 @@
4 4
5;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr> 5;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
6 6
7;; This program is free software; you can redistribute it and/or modify 7;; This file is part of GNU Emacs.
8
9;; GNU Emacs is free software: you can redistribute it and/or modify
8;; it under the terms of the GNU General Public License as published by 10;; it under the terms of the GNU General Public License as published by
9;; the Free Software Foundation, either version 3 of the License, or 11;; the Free Software Foundation, either version 3 of the License, or
10;; (at your option) any later version. 12;; (at your option) any later version.
11 13
12;; This program is distributed in the hope that it will be useful, 14;; GNU Emacs is distributed in the hope that it will be useful,
13;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;; GNU General Public License for more details. 17;; GNU General Public License for more details.
16 18
17;; You should have received a copy of the GNU General Public License 19;; You should have received a copy of the GNU General Public License
18;; along with this program. If not, see <https://www.gnu.org/licenses/>. 20;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
19 21
20;;; Commentary: 22;;; Commentary:
21 23
@@ -125,16 +127,14 @@ File names must be absolute."
125 :package-version '(Org . "9.5") 127 :package-version '(Org . "9.5")
126 :type '(choice (const :tag "No global bibliography" nil) 128 :type '(choice (const :tag "No global bibliography" nil)
127 (repeat :tag "List of bibliography files" 129 (repeat :tag "List of bibliography files"
128 (file :tag "Bibliography"))) 130 (file :tag "Bibliography"))))
129 :safe t)
130 131
131(defcustom org-cite-activate-processor 'basic 132(defcustom org-cite-activate-processor 'basic
132 "Processor used for activating citations, as a symbol." 133 "Processor used for activating citations, as a symbol."
133 :group 'org-cite 134 :group 'org-cite
134 :package-version '(Org . "9.5") 135 :package-version '(Org . "9.5")
135 :type '(choice (const :tag "Default fontification" nil) 136 :type '(choice (const :tag "Default fontification" nil)
136 (symbol :tag "Citation processor")) 137 (symbol :tag "Citation processor")))
137 :safe nil)
138 138
139(defcustom org-cite-export-processors '((t basic)) 139(defcustom org-cite-export-processors '((t basic))
140 "Processor used for exporting citations, as a triplet, or nil. 140 "Processor used for exporting citations, as a triplet, or nil.
@@ -198,24 +198,21 @@ back-end."
198 (string :tag "Use specific bibliography style")) 198 (string :tag "Use specific bibliography style"))
199 (choice 199 (choice
200 (const :tag "Default citation style" nil) 200 (const :tag "Default citation style" nil)
201 (string :tag "Use specific citation style"))))) 201 (string :tag "Use specific citation style"))))))
202 :safe nil)
203 202
204(defcustom org-cite-follow-processor 'basic 203(defcustom org-cite-follow-processor 'basic
205 "Processor used for following citations, as a symbol." 204 "Processor used for following citations, as a symbol."
206 :group 'org-cite 205 :group 'org-cite
207 :package-version '(Org . "9.5") 206 :package-version '(Org . "9.5")
208 :type '(choice (const :tag "No following" nil) 207 :type '(choice (const :tag "No following" nil)
209 (symbol :tag "Citation processor")) 208 (symbol :tag "Citation processor")))
210 :safe nil)
211 209
212(defcustom org-cite-insert-processor 'basic 210(defcustom org-cite-insert-processor 'basic
213 "Processor used for inserting citations, as a symbol." 211 "Processor used for inserting citations, as a symbol."
214 :group 'org-cite 212 :group 'org-cite
215 :package-version '(Org . "9.5") 213 :package-version '(Org . "9.5")
216 :type '(choice (const :tag "No insertion" nil) 214 :type '(choice (const :tag "No insertion" nil)
217 (symbol :tag "Citation processor")) 215 (symbol :tag "Citation processor")))
218 :safe nil)
219 216
220(defcustom org-cite-adjust-note-numbers t 217(defcustom org-cite-adjust-note-numbers t
221 "When non-nil, allow process to modify location of note numbers. 218 "When non-nil, allow process to modify location of note numbers.
@@ -232,7 +229,7 @@ When nil, the note number is not moved."
232 :package-version '(Org . "9.5") 229 :package-version '(Org . "9.5")
233 :type '(choice (const :tag "Automatic note number location" t) 230 :type '(choice (const :tag "Automatic note number location" t)
234 (const :tag "Place note numbers manually" nil)) 231 (const :tag "Place note numbers manually" nil))
235 :safe t) 232 :safe #'booleanp)
236 233
237(defcustom org-cite-note-rules 234(defcustom org-cite-note-rules
238 '(("en-us" inside outside after) 235 '(("en-us" inside outside after)
@@ -297,8 +294,7 @@ This roughly follows the Oxford Guide to Style recommendations."
297 (const :tag "Citation next to punctuation" same)) 294 (const :tag "Citation next to punctuation" same))
298 (choice :tag "Order of citation and punctuation" 295 (choice :tag "Order of citation and punctuation"
299 (const :tag "Citation first" before) 296 (const :tag "Citation first" before)
300 (const :tag "Citation last" after)))) 297 (const :tag "Citation last" after)))))
301 :safe t)
302 298
303(defcustom org-cite-punctuation-marks '("." "," ";" ":" "!" "?") 299(defcustom org-cite-punctuation-marks '("." "," ";" ":" "!" "?")
304 "List of strings that can be moved around when placing note numbers. 300 "List of strings that can be moved around when placing note numbers.
@@ -308,8 +304,7 @@ allowed to shuffle punctuation marks specified in this list in order to
308place note numbers according to rules defined in `org-cite-note-rules'." 304place note numbers according to rules defined in `org-cite-note-rules'."
309 :group 'org-cite 305 :group 'org-cite
310 :package-version '(Org . "9.5") 306 :package-version '(Org . "9.5")
311 :type '(repeat string) 307 :type '(repeat string))
312 :safe t)
313 308
314 309
315;;; Citation processors 310;;; Citation processors
diff --git a/lisp/org/ol-doi.el b/lisp/org/ol-doi.el
index dfde380209f..d2d16b27d51 100644
--- a/lisp/org/ol-doi.el
+++ b/lisp/org/ol-doi.el
@@ -1,21 +1,23 @@
1;;; ol-doi.el --- DOI links support in Org -*- lexical-binding: t; -*- 1;;; ol-doi.el --- DOI links support in Org -*- lexical-binding: t; -*-
2 2
3;; Copyright (C) 2021 Free Software Foundation, Inc. 3;; Copyright (C) 2021 Free Software Foundation, Inc.
4 4
5;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr> 5;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
6 6
7;; This program is free software; you can redistribute it and/or modify 7;; This file is part of GNU Emacs.
8
9;; GNU Emacs is free software: you can redistribute it and/or modify
8;; it under the terms of the GNU General Public License as published by 10;; it under the terms of the GNU General Public License as published by
9;; the Free Software Foundation, either version 3 of the License, or 11;; the Free Software Foundation, either version 3 of the License, or
10;; (at your option) any later version. 12;; (at your option) any later version.
11 13
12;; This program is distributed in the hope that it will be useful, 14;; GNU Emacs is distributed in the hope that it will be useful,
13;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;; GNU General Public License for more details. 17;; GNU General Public License for more details.
16 18
17;; You should have received a copy of the GNU General Public License 19;; You should have received a copy of the GNU General Public License
18;; along with this program. If not, see <https://www.gnu.org/licenses/>. 20;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
19 21
20;;; Commentary: 22;;; Commentary:
21 23
diff --git a/lisp/org/ol.el b/lisp/org/ol.el
index e4a5a278dda..aa1849715c3 100644
--- a/lisp/org/ol.el
+++ b/lisp/org/ol.el
@@ -178,8 +178,7 @@ link.
178 :group 'org-link 178 :group 'org-link
179 :package-version '(Org . "9.1") 179 :package-version '(Org . "9.1")
180 :type '(alist :tag "Link display parameters" 180 :type '(alist :tag "Link display parameters"
181 :value-type plist) 181 :value-type plist))
182 :safe nil)
183 182
184(defcustom org-link-descriptive t 183(defcustom org-link-descriptive t
185 "Non-nil means Org displays descriptive links. 184 "Non-nil means Org displays descriptive links.
@@ -335,8 +334,7 @@ another window."
335 (cons (const wl) 334 (cons (const wl)
336 (choice 335 (choice
337 (const wl) 336 (const wl)
338 (const wl-other-frame)))) 337 (const wl-other-frame)))))
339 :safe nil)
340 338
341(defcustom org-link-search-must-match-exact-headline 'query-to-create 339(defcustom org-link-search-must-match-exact-headline 'query-to-create
342 "Non-nil means internal fuzzy links can only match headlines. 340 "Non-nil means internal fuzzy links can only match headlines.
@@ -385,15 +383,13 @@ single keystroke rather than having to type \"yes\"."
385 :type '(choice 383 :type '(choice
386 (const :tag "with yes-or-no (safer)" yes-or-no-p) 384 (const :tag "with yes-or-no (safer)" yes-or-no-p)
387 (const :tag "with y-or-n (faster)" y-or-n-p) 385 (const :tag "with y-or-n (faster)" y-or-n-p)
388 (const :tag "no confirmation (dangerous)" nil)) 386 (const :tag "no confirmation (dangerous)" nil)))
389 :safe nil)
390 387
391(defcustom org-link-shell-skip-confirm-regexp "" 388(defcustom org-link-shell-skip-confirm-regexp ""
392 "Regexp to skip confirmation for shell links." 389 "Regexp to skip confirmation for shell links."
393 :group 'org-link-follow 390 :group 'org-link-follow
394 :version "24.1" 391 :version "24.1"
395 :type 'regexp 392 :type 'regexp)
396 :safe nil)
397 393
398(defcustom org-link-elisp-confirm-function 'yes-or-no-p 394(defcustom org-link-elisp-confirm-function 'yes-or-no-p
399 "Non-nil means ask for confirmation before executing Emacs Lisp links. 395 "Non-nil means ask for confirmation before executing Emacs Lisp links.
@@ -410,15 +406,13 @@ single keystroke rather than having to type \"yes\"."
410 :type '(choice 406 :type '(choice
411 (const :tag "with yes-or-no (safer)" yes-or-no-p) 407 (const :tag "with yes-or-no (safer)" yes-or-no-p)
412 (const :tag "with y-or-n (faster)" y-or-n-p) 408 (const :tag "with y-or-n (faster)" y-or-n-p)
413 (const :tag "no confirmation (dangerous)" nil)) 409 (const :tag "no confirmation (dangerous)" nil)))
414 :safe nil)
415 410
416(defcustom org-link-elisp-skip-confirm-regexp "" 411(defcustom org-link-elisp-skip-confirm-regexp ""
417 "A regexp to skip confirmation for Elisp links." 412 "A regexp to skip confirmation for Elisp links."
418 :group 'org-link-follow 413 :group 'org-link-follow
419 :version "24.1" 414 :version "24.1"
420 :type 'regexp 415 :type 'regexp)
421 :safe nil)
422 416
423(defgroup org-link-store nil 417(defgroup org-link-store nil
424 "Options concerning storing links in Org mode." 418 "Options concerning storing links in Org mode."
diff --git a/lisp/org/org-keys.el b/lisp/org/org-keys.el
index 2984a4f5145..a10db7e6667 100644
--- a/lisp/org/org-keys.el
+++ b/lisp/org/org-keys.el
@@ -279,8 +279,7 @@ before org.el is loaded."
279 :type '(choice 279 :type '(choice
280 (const :tag "A double click follows the link" double) 280 (const :tag "A double click follows the link" double)
281 (const :tag "Unconditionally follow the link with mouse-1" t) 281 (const :tag "Unconditionally follow the link with mouse-1" t)
282 (integer :tag "mouse-1 click does not follow the link if longer than N ms" 450)) 282 (integer :tag "mouse-1 click does not follow the link if longer than N ms" 450)))
283 :safe t)
284 283
285(defcustom org-tab-follows-link nil 284(defcustom org-tab-follows-link nil
286 "Non-nil means on links TAB will follow the link. 285 "Non-nil means on links TAB will follow the link.
@@ -300,7 +299,7 @@ implementation is bad."
300In tables, the special behavior of RET has precedence." 299In tables, the special behavior of RET has precedence."
301 :group 'org-link-follow 300 :group 'org-link-follow
302 :type 'boolean 301 :type 'boolean
303 :safe t) 302 :safe #'booleanp)
304 303
305 304
306;;; Functions 305;;; Functions
diff --git a/lisp/org/org-macs.el b/lisp/org/org-macs.el
index a8fb79ea3cd..0779c3a82c8 100644
--- a/lisp/org/org-macs.el
+++ b/lisp/org/org-macs.el
@@ -326,17 +326,19 @@ it for output."
326 326
327;;; Indentation 327;;; Indentation
328 328
329(defun org-do-remove-indentation (&optional n) 329(defun org-do-remove-indentation (&optional n skip-fl)
330 "Remove the maximum common indentation from the buffer. 330 "Remove the maximum common indentation from the buffer.
331When optional argument N is a positive integer, remove exactly 331When optional argument N is a positive integer, remove exactly
332that much characters from indentation, if possible. Return nil 332that much characters from indentation, if possible. When
333if it fails." 333optional argument SKIP-FL is non-nil, skip the first
334line. Return nil if it fails."
334 (catch :exit 335 (catch :exit
335 (goto-char (point-min)) 336 (goto-char (point-min))
336 ;; Find maximum common indentation, if not specified. 337 ;; Find maximum common indentation, if not specified.
337 (let ((n (or n 338 (let ((n (or n
338 (let ((min-ind (point-max))) 339 (let ((min-ind (point-max)))
339 (save-excursion 340 (save-excursion
341 (when skip-fl (forward-line))
340 (while (re-search-forward "^[ \t]*\\S-" nil t) 342 (while (re-search-forward "^[ \t]*\\S-" nil t)
341 (let ((ind (current-indentation))) 343 (let ((ind (current-indentation)))
342 (if (zerop ind) (throw :exit nil) 344 (if (zerop ind) (throw :exit nil)
@@ -344,6 +346,7 @@ if it fails."
344 min-ind)))) 346 min-ind))))
345 (if (zerop n) (throw :exit nil) 347 (if (zerop n) (throw :exit nil)
346 ;; Remove exactly N indentation, but give up if not possible. 348 ;; Remove exactly N indentation, but give up if not possible.
349 (when skip-fl (forward-line))
347 (while (not (eobp)) 350 (while (not (eobp))
348 (let ((ind (progn (skip-chars-forward " \t") (current-column)))) 351 (let ((ind (progn (skip-chars-forward " \t") (current-column))))
349 (cond ((eolp) (delete-region (line-beginning-position) (point))) 352 (cond ((eolp) (delete-region (line-beginning-position) (point)))
diff --git a/lisp/org/org-num.el b/lisp/org/org-num.el
index 408b86ff411..f00e6c463b8 100644
--- a/lisp/org/org-num.el
+++ b/lisp/org/org-num.el
@@ -99,8 +99,7 @@ Any `face' text property on the returned string overrides
99`org-num-face'." 99`org-num-face'."
100 :group 'org-appearance 100 :group 'org-appearance
101 :package-version '(Org . "9.3") 101 :package-version '(Org . "9.3")
102 :type 'function 102 :type 'function)
103 :safe nil)
104 103
105(defcustom org-num-max-level nil 104(defcustom org-num-max-level nil
106 "Level below which headlines are not numbered. 105 "Level below which headlines are not numbered.
diff --git a/lisp/org/org-src.el b/lisp/org/org-src.el
index 91a3d415dfa..8d02cf43450 100644
--- a/lisp/org/org-src.el
+++ b/lisp/org/org-src.el
@@ -38,6 +38,7 @@
38(require 'org-keys) 38(require 'org-keys)
39 39
40(declare-function org-mode "org" ()) 40(declare-function org-mode "org" ())
41(declare-function org--get-expected-indentation "org" (element contentsp))
41(declare-function org-element-at-point "org-element" ()) 42(declare-function org-element-at-point "org-element" ())
42(declare-function org-element-class "org-element" (datum &optional parent)) 43(declare-function org-element-class "org-element" (datum &optional parent))
43(declare-function org-element-context "org-element" (&optional element)) 44(declare-function org-element-context "org-element" (&optional element))
@@ -327,7 +328,8 @@ a cons cell (LINE . COLUMN) or symbol `end'. See also
327 (if (>= pos end) 'end 328 (if (>= pos end) 'end
328 (org-with-wide-buffer 329 (org-with-wide-buffer
329 (goto-char (max beg pos)) 330 (goto-char (max beg pos))
330 (cons (count-lines beg (line-beginning-position)) 331 (cons (count-lines (save-excursion (goto-char beg) (line-beginning-position))
332 (line-beginning-position))
331 ;; Column is relative to the end of line to avoid problems of 333 ;; Column is relative to the end of line to avoid problems of
332 ;; comma escaping or colons appended in front of the line. 334 ;; comma escaping or colons appended in front of the line.
333 (- (point) (min end (line-end-position))))))) 335 (- (point) (min end (line-end-position)))))))
@@ -445,6 +447,7 @@ Assume point is in the corresponding edit buffer."
445 org-src--content-indentation 447 org-src--content-indentation
446 0)))) 448 0))))
447 (use-tabs? (and (> org-src--tab-width 0) t)) 449 (use-tabs? (and (> org-src--tab-width 0) t))
450 (preserve-fl (eq org-src--source-type 'latex-fragment))
448 (source-tab-width org-src--tab-width) 451 (source-tab-width org-src--tab-width)
449 (contents (org-with-wide-buffer 452 (contents (org-with-wide-buffer
450 (let ((eol (line-end-position))) 453 (let ((eol (line-end-position)))
@@ -466,7 +469,8 @@ Assume point is in the corresponding edit buffer."
466 ;; Add INDENTATION-OFFSET to every line in buffer, 469 ;; Add INDENTATION-OFFSET to every line in buffer,
467 ;; unless indentation is meant to be preserved. 470 ;; unless indentation is meant to be preserved.
468 (when (> indentation-offset 0) 471 (when (> indentation-offset 0)
469 (while (not (eobp)) 472 (when preserve-fl (forward-line))
473 (while (not (eobp))
470 (skip-chars-forward " \t") 474 (skip-chars-forward " \t")
471 (when (or (not (eolp)) ; not a blank line 475 (when (or (not (eolp)) ; not a blank line
472 (and (eq (point) (marker-position marker)) ; current line 476 (and (eq (point) (marker-position marker)) ; current line
@@ -518,7 +522,13 @@ Leave point in edit buffer."
518 (source-tab-width (if indent-tabs-mode tab-width 0)) 522 (source-tab-width (if indent-tabs-mode tab-width 0))
519 (type (org-element-type datum)) 523 (type (org-element-type datum))
520 (block-ind (org-with-point-at (org-element-property :begin datum) 524 (block-ind (org-with-point-at (org-element-property :begin datum)
521 (current-indentation))) 525 (cond
526 ((save-excursion (skip-chars-backward " \t") (bolp))
527 (current-indentation))
528 ((org-element-property :parent datum)
529 (org--get-expected-indentation
530 (org-element-property :parent datum) nil))
531 (t (current-indentation)))))
522 (content-ind org-edit-src-content-indentation) 532 (content-ind org-edit-src-content-indentation)
523 (blank-line (save-excursion (beginning-of-line) 533 (blank-line (save-excursion (beginning-of-line)
524 (looking-at-p "^[[:space:]]*$"))) 534 (looking-at-p "^[[:space:]]*$")))
@@ -548,7 +558,8 @@ Leave point in edit buffer."
548 (insert contents) 558 (insert contents)
549 (remove-text-properties (point-min) (point-max) 559 (remove-text-properties (point-min) (point-max)
550 '(display nil invisible nil intangible nil)) 560 '(display nil invisible nil intangible nil))
551 (unless preserve-ind (org-do-remove-indentation)) 561 (let ((lf (eq type 'latex-fragment)))
562 (unless preserve-ind (org-do-remove-indentation (and lf block-ind) lf)))
552 (set-buffer-modified-p nil) 563 (set-buffer-modified-p nil)
553 (setq buffer-file-name nil) 564 (setq buffer-file-name nil)
554 ;; Initialize buffer. 565 ;; Initialize buffer.
diff --git a/lisp/org/org-version.el b/lisp/org/org-version.el
index ef363dc3901..5bccbe497cc 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")) 14 (let ((org-git-version "release_9.5-30-g10dc9d"))
15 org-git-version)) 15 org-git-version))
16 16
17(provide 'org-version) 17(provide 'org-version)
diff --git a/lisp/org/org.el b/lisp/org/org.el
index 2ec6566c0b0..bc0ea24bee7 100644
--- a/lisp/org/org.el
+++ b/lisp/org/org.el
@@ -3630,7 +3630,7 @@ When this is non-nil, the headline after the keyword is set to the
3630 :group 'org-appearance 3630 :group 'org-appearance
3631 :package-version '(Org . "9.4") 3631 :package-version '(Org . "9.4")
3632 :type 'boolean 3632 :type 'boolean
3633 :safe t) 3633 :safe #'booleanp)
3634 3634
3635(defcustom org-fontify-done-headline t 3635(defcustom org-fontify-done-headline t
3636 "Non-nil means change the face of a headline if it is marked DONE. 3636 "Non-nil means change the face of a headline if it is marked DONE.
@@ -5113,6 +5113,7 @@ stacked delimiters is N. Escaping delimiters is not possible."
5113 '(invisible t)) 5113 '(invisible t))
5114 (add-text-properties (match-beginning 3) (match-end 3) 5114 (add-text-properties (match-beginning 3) (match-end 3)
5115 '(invisible t))) 5115 '(invisible t)))
5116 (goto-char (match-end 0))
5116 (throw :exit t)))))))) 5117 (throw :exit t))))))))
5117 5118
5118(defun org-emphasize (&optional char) 5119(defun org-emphasize (&optional char)
diff --git a/lisp/org/ox-html.el b/lisp/org/ox-html.el
index 60bb77d8188..a150b1fdb87 100644
--- a/lisp/org/ox-html.el
+++ b/lisp/org/ox-html.el
@@ -795,7 +795,7 @@ Most common values are:
795 :group 'org-export-html 795 :group 'org-export-html
796 :package-version '(Org . "9.4") 796 :package-version '(Org . "9.4")
797 :type 'string 797 :type 'string
798 :safe t) 798 :safe #'stringp)
799 799
800(defcustom org-html-with-latex org-export-with-latex 800(defcustom org-html-with-latex org-export-with-latex
801 "Non-nil means process LaTeX math snippets. 801 "Non-nil means process LaTeX math snippets.
@@ -903,7 +903,7 @@ numbers are enabled."
903 :group 'org-export-html 903 :group 'org-export-html
904 :package-version '(Org . "9.3") 904 :package-version '(Org . "9.3")
905 :type 'boolean 905 :type 'boolean
906 :safe t) 906 :safe #'booleanp)
907 907
908;;;; Table 908;;;; Table
909 909
diff --git a/lisp/org/ox-koma-letter.el b/lisp/org/ox-koma-letter.el
index 96704dbb985..6a895a6a24d 100644
--- a/lisp/org/ox-koma-letter.el
+++ b/lisp/org/ox-koma-letter.el
@@ -11,12 +11,12 @@
11 11
12;; This file is part of GNU Emacs. 12;; This file is part of GNU Emacs.
13 13
14;; This program is free software: you can redistribute it and/or modify 14;; GNU Emacs is free software: you can redistribute it and/or modify
15;; it under the terms of the GNU General Public License as published by 15;; it under the terms of the GNU General Public License as published by
16;; the Free Software Foundation, either version 3 of the License, or 16;; the Free Software Foundation, either version 3 of the License, or
17;; (at your option) any later version. 17;; (at your option) any later version.
18 18
19;; This program is distributed in the hope that it will be useful, 19;; GNU Emacs is distributed in the hope that it will be useful,
20;; but WITHOUT ANY WARRANTY; without even the implied warranty of 20;; but WITHOUT ANY WARRANTY; without even the implied warranty of
21;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22;; GNU General Public License for more details. 22;; GNU General Public License for more details.
@@ -594,7 +594,7 @@ such as the one tagged with PS."
594 594
595;;;; Export Block 595;;;; Export Block
596 596
597(defun org-koma-letter-export-block (export-block contents info) 597(defun org-koma-letter-export-block (export-block _contents _info)
598 "Transcode an EXPORT-BLOCK element into KOMA Scrlttr2 code. 598 "Transcode an EXPORT-BLOCK element into KOMA Scrlttr2 code.
599CONTENTS is nil. INFO is a plist used as a communication 599CONTENTS is nil. INFO is a plist used as a communication
600channel." 600channel."
@@ -604,7 +604,7 @@ channel."
604 604
605;;;; Export Snippet 605;;;; Export Snippet
606 606
607(defun org-koma-letter-export-snippet (export-snippet contents info) 607(defun org-koma-letter-export-snippet (export-snippet _contents _info)
608 "Transcode an EXPORT-SNIPPET object into KOMA Scrlttr2 code. 608 "Transcode an EXPORT-SNIPPET object into KOMA Scrlttr2 code.
609CONTENTS is nil. INFO is a plist used as a communication 609CONTENTS is nil. INFO is a plist used as a communication
610channel." 610channel."
diff --git a/lisp/org/ox-latex.el b/lisp/org/ox-latex.el
index 993c2c6431d..3e3967033a5 100644
--- a/lisp/org/ox-latex.el
+++ b/lisp/org/ox-latex.el
@@ -413,7 +413,7 @@ to \"\\autoref{%s}\" or \"\\cref{%s}\" for example."
413 :group 'org-export-latex 413 :group 'org-export-latex
414 :type 'string 414 :type 'string
415 :package-version '(Org . "9.5") 415 :package-version '(Org . "9.5")
416 :safe t) 416 :safe #'stringp)
417 417
418;;;; Preamble 418;;;; Preamble
419 419
@@ -793,7 +793,7 @@ default we use here encompasses both."
793 :group 'org-export-latex 793 :group 'org-export-latex
794 :package-version '(Org . "9.5") 794 :package-version '(Org . "9.5")
795 :type 'string 795 :type 'string
796 :safe t) 796 :safe #'stringp)
797 797
798(defcustom org-latex-default-table-mode 'table 798(defcustom org-latex-default-table-mode 'table
799 "Default mode for tables. 799 "Default mode for tables.
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index acf7123225f..c7474b25a78 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -548,7 +548,7 @@ in `completion-at-point-functions' (which see)."
548 (lambda (s) 548 (lambda (s)
549 (push s retval) 549 (push s retval)
550 (cl-loop 550 (cl-loop
551 for (shorthand . longhand) in elisp-shorthands 551 for (shorthand . longhand) in read-symbol-shorthands
552 for full-name = (symbol-name s) 552 for full-name = (symbol-name s)
553 when (string-prefix-p longhand full-name) 553 when (string-prefix-p longhand full-name)
554 do (let ((sym (make-symbol 554 do (let ((sym (make-symbol
@@ -559,17 +559,17 @@ in `completion-at-point-functions' (which see)."
559 (push sym retval) 559 (push sym retval)
560 retval)))) 560 retval))))
561 retval))) 561 retval)))
562 (cond ((null elisp-shorthands) obarray) 562 (cond ((null read-symbol-shorthands) obarray)
563 ((and obarray-cache 563 ((and obarray-cache
564 (gethash (cons (current-buffer) elisp-shorthands) 564 (gethash (cons (current-buffer) read-symbol-shorthands)
565 obarray-cache))) 565 obarray-cache)))
566 (obarray-cache 566 (obarray-cache
567 (puthash (cons (current-buffer) elisp-shorthands) 567 (puthash (cons (current-buffer) read-symbol-shorthands)
568 (obarray-plus-shorthands) 568 (obarray-plus-shorthands)
569 obarray-cache)) 569 obarray-cache))
570 (t 570 (t
571 (setq obarray-cache (make-hash-table :test #'equal)) 571 (setq obarray-cache (make-hash-table :test #'equal))
572 (puthash (cons (current-buffer) elisp-shorthands) 572 (puthash (cons (current-buffer) read-symbol-shorthands)
573 (obarray-plus-shorthands) 573 (obarray-plus-shorthands)
574 obarray-cache))))) 574 obarray-cache)))))
575 575
@@ -2126,7 +2126,7 @@ Runs in a batch-mode Emacs. Interactively use variable
2126 (pp collected))) 2126 (pp collected)))
2127 2127
2128 2128
2129(put 'elisp-shorthands 'safe-local-variable #'consp) 2129(put 'read-symbol-shorthands 'safe-local-variable #'consp)
2130 2130
2131(provide 'elisp-mode) 2131(provide 'elisp-mode)
2132;;; elisp-mode.el ends here 2132;;; elisp-mode.el ends here
diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el
index 6c09dcf881d..4f15686dc87 100644
--- a/lisp/progmodes/prog-mode.el
+++ b/lisp/progmodes/prog-mode.el
@@ -68,6 +68,28 @@
68 `(menu-item "Find Definition" xref-find-definitions-at-mouse 68 `(menu-item "Find Definition" xref-find-definitions-at-mouse
69 :help ,(format "Find definition of `%s'" identifier)) 69 :help ,(format "Find definition of `%s'" identifier))
70 'prog-separator))) 70 'prog-separator)))
71
72 (when (thing-at-mouse click 'symbol)
73 (define-key-after menu [select-region mark-symbol]
74 `(menu-item "Symbol"
75 ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'symbol))
76 :help "Mark the symbol at click for a subsequent cut/copy")
77 'mark-whole-buffer))
78 (define-key-after menu [select-region mark-list]
79 `(menu-item "List"
80 ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'list))
81 :help "Mark the list at click for a subsequent cut/copy")
82 'mark-whole-buffer)
83 (define-key-after menu [select-region mark-defun]
84 `(menu-item "Defun"
85 ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'defun))
86 :help "Mark the defun at click for a subsequent cut/copy")
87 'mark-whole-buffer)
88
89 ;; Include text-mode select menu only in strings and comments.
90 (when (nth 8 (save-excursion (syntax-ppss (posn-point (event-end click)))))
91 (text-mode-menu menu click))
92
71 menu) 93 menu)
72 94
73(defvar prog-mode-map 95(defvar prog-mode-map
diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el
index 8946e2c3f42..176f599649f 100644
--- a/lisp/progmodes/which-func.el
+++ b/lisp/progmodes/which-func.el
@@ -185,7 +185,8 @@ and you want to simplify them for the mode line
185 185
186(defvar-local which-func-mode nil 186(defvar-local which-func-mode nil
187 "Non-nil means display current function name in mode line. 187 "Non-nil means display current function name in mode line.
188This makes a difference only if `which-function-mode' is non-nil.") 188This makes a difference only if variable `which-function-mode' is
189non-nil.")
189 190
190(add-hook 'after-change-major-mode-hook #'which-func-ff-hook t) 191(add-hook 'after-change-major-mode-hook #'which-func-ff-hook t)
191 192
diff --git a/lisp/shorthands.el b/lisp/shorthands.el
new file mode 100644
index 00000000000..e9f5880ab29
--- /dev/null
+++ b/lisp/shorthands.el
@@ -0,0 +1,80 @@
1;;; shorthands.el --- Read code considering Elisp shorthands -*- lexical-binding: t; -*-
2
3;; Copyright (C) 2021 Free Software Foundation, Inc.
4
5;; Author: João Távora <joaotavora@gmail.com>
6;; Keywords: lisp
7
8;; This file is part of GNU Emacs.
9
10;; GNU Emacs is free software: you can redistribute it and/or modify
11;; it under the terms of the GNU General Public License as published by
12;; the Free Software Foundation, either version 3 of the License, or
13;; (at your option) any later version.
14
15;; GNU Emacs is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; GNU General Public License for more details.
19
20;; You should have received a copy of the GNU General Public License
21;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
22
23;;; Commentary:
24
25;; Basic helpers for loading files with Shorthands.
26
27;;; Code:
28(require 'files)
29(require 'mule)
30(eval-when-compile (require 'cl-lib))
31
32(defun hack-read-symbol-shorthands ()
33 "Compute `read-symbol-shorthands' from Local Variables section."
34 ;; FIXME: relies on the `hack-local-variables--find-variables'
35 ;; detail of files.el. That function should be exported,
36 ;; possibly be refactored into two parts, since we're only
37 ;; interested in basic "Local Variables" parsing.
38 (alist-get 'read-symbol-shorthands (hack-local-variables--find-variables)))
39
40(setq hack-read-symbol-shorthands-function #'hack-read-symbol-shorthands)
41
42
43;; FIXME: move this all to progmodes/elisp-mode.el? OTOH it'd make
44;; more sense there, OTOH all the elisp font-lock stuff is actually in
45;; lisp/emacs-lisp/lisp-mode.el, which isn't right either. So
46;; shorthand font-locking logic is probably better here for now.
47
48(defface elisp-shorthand-font-lock-face
49 '((t :inherit font-lock-keyword-face :foreground "cyan"))
50 "Face for highlighting shorthands in Emacs Lisp."
51 :version "28.1"
52 :group 'font-lock-faces)
53
54(defun shorthands--mismatch-from-end (str1 str2)
55 (cl-loop with l1 = (length str1) with l2 = (length str2)
56 for i from 1
57 for i1 = (- l1 i) for i2 = (- l2 i)
58 while (and (>= i1 0) (>= i2 0) (eq (aref str1 i1) (aref str2 i2)))
59 finally (return (1- i))))
60
61(defun shorthands-font-lock-shorthands (limit)
62 (when read-symbol-shorthands
63 (while (re-search-forward
64 (eval-when-compile
65 (concat "\\_<\\(" lisp-mode-symbol-regexp "\\)\\_>"))
66 limit t)
67 (let* ((existing (get-text-property (match-beginning 1) 'face))
68 (probe (and (not (memq existing '(font-lock-comment-face
69 font-lock-string-face)))
70 (intern-soft (match-string 1))))
71 (sname (and probe (symbol-name probe)))
72 (mm (and sname (shorthands--mismatch-from-end
73 (match-string 1) sname))))
74 (unless (or (null mm) (= mm (length sname)))
75 (add-face-text-property (match-beginning 1) (1+ (- (match-end 1) mm))
76 'elisp-shorthand-font-lock-face))))))
77
78(font-lock-add-keywords 'emacs-lisp-mode '((shorthands-font-lock-shorthands)) t)
79
80;;; shorthands.el ends here
diff --git a/lisp/subr.el b/lisp/subr.el
index 6473c5ac11b..c3dbe8df800 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -6437,7 +6437,9 @@ of fill.el (for example `fill-region')."
6437(defun internal--format-docstring-line (string &rest objects) 6437(defun internal--format-docstring-line (string &rest objects)
6438 "Format a single line from a documentation string out of STRING and OBJECTS. 6438 "Format a single line from a documentation string out of STRING and OBJECTS.
6439Signal an error if STRING contains a newline. 6439Signal an error if STRING contains a newline.
6440This is intended for internal use only." 6440This is intended for internal use only. Avoid using this for the
6441first line of a docstring; the first line should be a complete
6442sentence (see Info node `(elisp) Documentation Tips')."
6441 (when (string-match "\n" string) 6443 (when (string-match "\n" string)
6442 (error "Unable to fill string containing newline: %S" string)) 6444 (error "Unable to fill string containing newline: %S" string))
6443 (internal--fill-string-single-line (apply #'format string objects))) 6445 (internal--fill-string-single-line (apply #'format string objects)))
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 634328e223b..68afb539fa3 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -1211,13 +1211,26 @@ Interactively, ARG selects the ARGth different frame to move to."
1211 "Detach tab number FROM-NUMBER to a new frame. 1211 "Detach tab number FROM-NUMBER to a new frame.
1212Interactively or without argument, detach current tab." 1212Interactively or without argument, detach current tab."
1213 (interactive (list (1+ (tab-bar--current-tab-index)))) 1213 (interactive (list (1+ (tab-bar--current-tab-index))))
1214 (let* ((tab (nth (1- (or from-number 1)) (funcall tab-bar-tabs-function))) 1214 (let* ((tabs (funcall tab-bar-tabs-function))
1215 (tab-name (alist-get 'name tab)) 1215 (tab-index (1- (or from-number (1+ (tab-bar--current-tab-index tabs)))))
1216 (tab-name (alist-get 'name (nth tab-index tabs)))
1217 ;; On some window managers, `make-frame' selects the new frame,
1218 ;; so previously selected frame is saved to `from-frame'.
1219 (from-frame (selected-frame))
1216 (new-frame (make-frame `((name . ,tab-name))))) 1220 (new-frame (make-frame `((name . ,tab-name)))))
1217 (tab-bar-move-tab-to-frame nil nil from-number new-frame nil) 1221 (tab-bar-move-tab-to-frame nil from-frame from-number new-frame nil)
1218 (with-selected-frame new-frame 1222 (with-selected-frame new-frame
1219 (tab-bar-close-tab)))) 1223 (tab-bar-close-tab))))
1220 1224
1225(defun tab-bar-move-window-to-tab ()
1226 "Detach the selected window to a new tab."
1227 (interactive)
1228 (let ((tab-bar-new-tab-choice 'window))
1229 (tab-bar-new-tab))
1230 (tab-bar-switch-to-recent-tab)
1231 (delete-window)
1232 (tab-bar-switch-to-recent-tab))
1233
1221 1234
1222(defcustom tab-bar-new-tab-to 'right 1235(defcustom tab-bar-new-tab-to 'right
1223 "Defines where to create a new tab. 1236 "Defines where to create a new tab.
@@ -1264,9 +1277,10 @@ After the tab is created, the hooks in
1264 (select-window (minibuffer-selected-window))) 1277 (select-window (minibuffer-selected-window)))
1265 (let ((ignore-window-parameters t)) 1278 (let ((ignore-window-parameters t))
1266 (delete-other-windows)) 1279 (delete-other-windows))
1267 ;; Create a new window to get rid of old window parameters 1280 (unless (eq tab-bar-new-tab-choice 'window)
1268 ;; (e.g. prev/next buffers) of old window. 1281 ;; Create a new window to get rid of old window parameters
1269 (split-window) (delete-window) 1282 ;; (e.g. prev/next buffers) of old window.
1283 (split-window) (delete-window))
1270 (let ((buffer 1284 (let ((buffer
1271 (if (functionp tab-bar-new-tab-choice) 1285 (if (functionp tab-bar-new-tab-choice)
1272 (funcall tab-bar-new-tab-choice) 1286 (funcall tab-bar-new-tab-choice)
diff --git a/lisp/tab-line.el b/lisp/tab-line.el
index 4a751b384e5..890d1243e73 100644
--- a/lisp/tab-line.el
+++ b/lisp/tab-line.el
@@ -574,7 +574,10 @@ For use in `tab-line-tab-face-functions'."
574 ;; handle tab-line scrolling 574 ;; handle tab-line scrolling
575 (window-parameter nil 'tab-line-hscroll) 575 (window-parameter nil 'tab-line-hscroll)
576 ;; for setting face 'tab-line-tab-current' 576 ;; for setting face 'tab-line-tab-current'
577 (eq (selected-window) (old-selected-window)))) 577 (eq (selected-window) (old-selected-window))
578 (and (memq 'tab-line-tab-face-modified
579 tab-line-tab-face-functions)
580 (buffer-file-name) (buffer-modified-p))))
578 (cache (window-parameter nil 'tab-line-cache))) 581 (cache (window-parameter nil 'tab-line-cache)))
579 ;; Enable auto-hscroll again after it was disabled on manual scrolling. 582 ;; Enable auto-hscroll again after it was disabled on manual scrolling.
580 ;; The moment to enable it is when the window-buffer was updated. 583 ;; The moment to enable it is when the window-buffer was updated.
diff --git a/lisp/textmodes/etc-authors-mode.el b/lisp/textmodes/etc-authors-mode.el
index a591b2db978..8b5fefd3b7d 100644
--- a/lisp/textmodes/etc-authors-mode.el
+++ b/lisp/textmodes/etc-authors-mode.el
@@ -5,18 +5,20 @@
5;; Author: Stefan Kangas <stefan@marxist.se> 5;; Author: Stefan Kangas <stefan@marxist.se>
6;; Keywords: internal 6;; Keywords: internal
7 7
8;; This program is free software; you can redistribute it and/or modify 8;; This file is part of GNU Emacs.
9
10;; GNU Emacs is free software: you can redistribute it and/or modify
9;; it under the terms of the GNU General Public License as published by 11;; it under the terms of the GNU General Public License as published by
10;; the Free Software Foundation, either version 3 of the License, or 12;; the Free Software Foundation, either version 3 of the License, or
11;; (at your option) any later version. 13;; (at your option) any later version.
12 14
13;; This program is distributed in the hope that it will be useful, 15;; GNU Emacs is distributed in the hope that it will be useful,
14;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;; GNU General Public License for more details. 18;; GNU General Public License for more details.
17 19
18;; You should have received a copy of the GNU General Public License 20;; You should have received a copy of the GNU General Public License
19;; along with this program. If not, see <https://www.gnu.org/licenses/>. 21;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
20 22
21;;; Commentary: 23;;; Commentary:
22 24
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el
index 81d908c95e7..decce88573b 100644
--- a/lisp/textmodes/fill.el
+++ b/lisp/textmodes/fill.el
@@ -768,7 +768,7 @@ space does not end a sentence, so don't break a line there."
768 (setq first nil 768 (setq first nil
769 linebeg (+ (point) (length actual-fill-prefix)))) 769 linebeg (+ (point) (length actual-fill-prefix))))
770 (move-to-column (current-fill-column)) 770 (move-to-column (current-fill-column))
771 (if (when (< (point) to) 771 (if (when (and (< (point) to) (< linebeg to))
772 ;; Find the position where we'll break the line. 772 ;; Find the position where we'll break the line.
773 ;; Use an immediately following space, if any. 773 ;; Use an immediately following space, if any.
774 ;; However, note that `move-to-column' may overshoot 774 ;; However, note that `move-to-column' may overshoot
diff --git a/lisp/textmodes/reftex-cite.el b/lisp/textmodes/reftex-cite.el
index 8a54b1a301f..e1475934ddb 100644
--- a/lisp/textmodes/reftex-cite.el
+++ b/lisp/textmodes/reftex-cite.el
@@ -814,7 +814,7 @@ in order to only add another reference in the same cite command."
814 (interactive) 814 (interactive)
815 (reftex-citation nil ?t)) 815 (reftex-citation nil ?t))
816 816
817(defvar reftex-select-bib-map) 817(defvar reftex-select-bib-mode-map)
818(defvar reftex--found-list) 818(defvar reftex--found-list)
819(defun reftex-offer-bib-menu () 819(defun reftex-offer-bib-menu ()
820 "Offer bib menu and return list of selected items." 820 "Offer bib menu and return list of selected items."
@@ -870,7 +870,7 @@ in order to only add another reference in the same cite command."
870 (reftex-select-item 870 (reftex-select-item
871 reftex-citation-prompt 871 reftex-citation-prompt
872 reftex-citation-help 872 reftex-citation-help
873 reftex-select-bib-map 873 reftex-select-bib-mode-map
874 nil 874 nil
875 'reftex-bibtex-selection-callback nil)) 875 'reftex-bibtex-selection-callback nil))
876 (setq key (car rtn) 876 (setq key (car rtn)
diff --git a/lisp/textmodes/reftex-ref.el b/lisp/textmodes/reftex-ref.el
index 9d5bc5a8f0f..a5d83c34d67 100644
--- a/lisp/textmodes/reftex-ref.el
+++ b/lisp/textmodes/reftex-ref.el
@@ -533,7 +533,7 @@ When called with 2 \\[universal-argument] prefix args, disable magic word recogn
533 (cons (cdr cell) (- (match-end 0) (match-end 1))) 533 (cons (cdr cell) (- (match-end 0) (match-end 1)))
534 nil))) 534 nil)))
535 535
536(defvar reftex-select-label-map) 536(defvar reftex-select-label-mode-map)
537(defun reftex-offer-label-menu (typekey) 537(defun reftex-offer-label-menu (typekey)
538 ;; Offer a menu with the appropriate labels. 538 ;; Offer a menu with the appropriate labels.
539 (let* ((buf (current-buffer)) 539 (let* ((buf (current-buffer))
@@ -605,7 +605,7 @@ When called with 2 \\[universal-argument] prefix args, disable magic word recogn
605 (reftex-select-item 605 (reftex-select-item
606 reftex-select-label-prompt 606 reftex-select-label-prompt
607 reftex-select-label-help 607 reftex-select-label-help
608 reftex-select-label-map 608 reftex-select-label-mode-map
609 offset 609 offset
610 'reftex-show-label-location follow)) 610 'reftex-show-label-location follow))
611 (setq key (car rtn) 611 (setq key (car rtn)
diff --git a/lisp/textmodes/text-mode.el b/lisp/textmodes/text-mode.el
index 74c6d412a65..3243bd31c4c 100644
--- a/lisp/textmodes/text-mode.el
+++ b/lisp/textmodes/text-mode.el
@@ -95,6 +95,28 @@ inherit all the commands defined in this map.")
95 :style toggle 95 :style toggle
96 :selected (memq 'turn-on-auto-fill text-mode-hook)])) 96 :selected (memq 'turn-on-auto-fill text-mode-hook)]))
97 97
98(defun text-mode-menu (menu click)
99 "Populate MENU with text selection commands at CLICK."
100
101 (when (thing-at-mouse click 'word)
102 (define-key-after menu [select-region mark-word]
103 `(menu-item "Word"
104 ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'word))
105 :help "Mark the word at click for a subsequent cut/copy")
106 'mark-whole-buffer))
107 (define-key-after menu [select-region mark-sentence]
108 `(menu-item "Sentence"
109 ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'sentence))
110 :help "Mark the sentence at click for a subsequent cut/copy")
111 'mark-whole-buffer)
112 (define-key-after menu [select-region mark-paragraph]
113 `(menu-item "Paragraph"
114 ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'paragraph))
115 :help "Mark the paragraph at click for a subsequent cut/copy")
116 'mark-whole-buffer)
117
118 menu)
119
98 120
99(define-derived-mode text-mode nil "Text" 121(define-derived-mode text-mode nil "Text"
100 "Major mode for editing text written for humans to read. 122 "Major mode for editing text written for humans to read.
@@ -104,7 +126,8 @@ You can thus get the full benefit of adaptive filling
104\\{text-mode-map} 126\\{text-mode-map}
105Turning on Text mode runs the normal hook `text-mode-hook'." 127Turning on Text mode runs the normal hook `text-mode-hook'."
106 (setq-local text-mode-variant t) 128 (setq-local text-mode-variant t)
107 (setq-local require-final-newline mode-require-final-newline)) 129 (setq-local require-final-newline mode-require-final-newline)
130 (add-hook 'context-menu-functions 'text-mode-menu 10 t))
108 131
109(define-derived-mode paragraph-indent-text-mode text-mode "Parindent" 132(define-derived-mode paragraph-indent-text-mode text-mode "Parindent"
110 "Major mode for editing text, with leading spaces starting a paragraph. 133 "Major mode for editing text, with leading spaces starting a paragraph.
diff --git a/lisp/textmodes/tildify.el b/lisp/textmodes/tildify.el
index 01e2ad72d88..2a4c8cff8f0 100644
--- a/lisp/textmodes/tildify.el
+++ b/lisp/textmodes/tildify.el
@@ -67,7 +67,7 @@ matching the white space). The pattern is matched case-sensitive regardless of
67the value of `case-fold-search' setting." 67the value of `case-fold-search' setting."
68 :version "25.1" 68 :version "25.1"
69 :type 'regexp 69 :type 'regexp
70 :safe t) 70 :safe #'stringp)
71 71
72(defcustom tildify-pattern-alist () 72(defcustom tildify-pattern-alist ()
73 "Alist specifying where to insert hard spaces. 73 "Alist specifying where to insert hard spaces.
@@ -112,7 +112,7 @@ If nil, current major mode has no way to represent a hard space."
112 " ") 112 " ")
113 (const :tag "No-break space (U+00A0)" "\u00A0") 113 (const :tag "No-break space (U+00A0)" "\u00A0")
114 (string :tag "Custom string")) 114 (string :tag "Custom string"))
115 :safe t) 115 :safe #'string-or-null-p)
116 116
117(defcustom tildify-string-alist () 117(defcustom tildify-string-alist ()
118 "Alist specifying what is a hard space in the current major mode. 118 "Alist specifying what is a hard space in the current major mode.
diff --git a/lisp/time-stamp.el b/lisp/time-stamp.el
index e1ea922d040..178e490fb7d 100644
--- a/lisp/time-stamp.el
+++ b/lisp/time-stamp.el
@@ -59,7 +59,7 @@ with %, as follows.
59%#p `am' or `pm' %P gives uppercase: `AM' or `PM' 59%#p `am' or `pm' %P gives uppercase: `AM' or `PM'
60%02S seconds 60%02S seconds
61%w day number of week, Sunday is 0 61%w day number of week, Sunday is 0
62%02y 2-digit year: `03' %Y 4-digit year: `2003' 62%02y 2-digit year %Y 4-digit year
63%Z time zone name: `EST' %#Z gives lowercase: `est' 63%Z time zone name: `EST' %#Z gives lowercase: `est'
64%5z time zone offset: `-0500' (since Emacs 27; see note below) 64%5z time zone offset: `-0500' (since Emacs 27; see note below)
65 65