[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 5737c2a3af7 5/7: Merge from origin/emacs-29
From: |
Po Lu |
Subject: |
master 5737c2a3af7 5/7: Merge from origin/emacs-29 |
Date: |
Sat, 10 Dec 2022 20:34:34 -0500 (EST) |
branch: master
commit 5737c2a3af70bc8d653abdb22922c4dc2a49e878
Merge: 52de8885048 79659416f95
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Merge from origin/emacs-29
79659416f95 ; * admin/git-bisect-start: Fix commit hash
a9037aa8e81 ; Fix use-package-ensure-system-package macOS footnote
7d787564c08 Actually improve detection of long lines
118465f6fed ; Improve checkdoc.el commentary section
30e3cb21351 Unset the weight/slant/width in the spec when realizing a...
01154166057 Update to Org 9.6-31-g954a95
26a8644a587 ; tabulated-list.el: Remove duplicate obsolete declaration
29b9aeae32a ; * doc/misc/use-package.texi: Fix misplaced @end group.
3c5a41b2008 ; * doc/lispref/keymaps.texi (Searching Keymaps): Fix a t...
1753da24cd4 Fix infloop in 'shell-resync-dirs' with tcsh
2f1269c3331 ; Fix some minor issues in use-package.texi
---
admin/git-bisect-start | 2 +-
doc/lispref/keymaps.texi | 2 +-
doc/misc/org.org | 2 +-
doc/misc/use-package.texi | 36 +++++++--------
lisp/emacs-lisp/checkdoc.el | 25 +++++++----
lisp/emacs-lisp/tabulated-list.el | 2 -
lisp/org/ob-comint.el | 8 ++++
lisp/org/ob-core.el | 4 +-
lisp/org/ol.el | 6 +--
lisp/org/org-clock.el | 95 ++++++++++++++++++++-------------------
lisp/org/org-element.el | 6 ++-
lisp/org/org-fold-core.el | 9 +++-
lisp/org/org-footnote.el | 9 ++--
lisp/org/org-persist.el | 15 +++++--
lisp/org/org-table.el | 59 +++++++++++++-----------
lisp/org/org-version.el | 2 +-
lisp/org/org.el | 6 ++-
lisp/org/ox-md.el | 3 +-
lisp/org/ox.el | 5 +++
lisp/shell.el | 1 +
src/buffer.c | 1 -
src/buffer.h | 11 -----
src/pdumper.c | 1 -
src/xdisp.c | 3 +-
src/xfaces.c | 60 ++++++++++++++++++++++++-
25 files changed, 236 insertions(+), 137 deletions(-)
diff --git a/admin/git-bisect-start b/admin/git-bisect-start
index 7a715b4261d..dcb291a3ace 100755
--- a/admin/git-bisect-start
+++ b/admin/git-bisect-start
@@ -41,4 +41,4 @@ git bisect good 806734c1b1f433de43d59d9a5e3a1e89d64315f6
# Prune commits 31ea42e15e..a6cbfdd8f1 introduced by 4a1e9d61b5
# (use-package merge on Nov 30 2022)
-git bisect good 4a1e9d61b57c36255752437a2668e037e79fe870
+git bisect good 58cc931e92ece70c3e64131ee12a799d65409100
diff --git a/doc/lispref/keymaps.texi b/doc/lispref/keymaps.texi
index 1e4bf4eb861..5882f247948 100644
--- a/doc/lispref/keymaps.texi
+++ b/doc/lispref/keymaps.texi
@@ -841,7 +841,7 @@ keymaps:
(@var{find-in-any} emulation-mode-map-alists)
(@var{find-in-any} minor-mode-overriding-map-alist)
(@var{find-in-any} minor-mode-map-alist)
- (if (get-text-property (point) 'local-map)
+ (if (get-char-property (point) 'local-map)
(@var{find-in} (get-char-property (point) 'local-map))
(@var{find-in} (current-local-map)))))
(@var{find-in} (current-global-map)))
diff --git a/doc/misc/org.org b/doc/misc/org.org
index 43d85099cff..0b926e3ceed 100644
--- a/doc/misc/org.org
+++ b/doc/misc/org.org
@@ -1401,7 +1401,7 @@ you, configure the option ~org-table-auto-blank-field~.
- {{{kbd(M-x org-table-blank-field)}}} ::
#+findex: org-table-blank-field
- Blank the field at point.
+ Blank the current table field or active region.
- {{{kbd(S-TAB)}}} (~org-table-previous-field~) ::
diff --git a/doc/misc/use-package.texi b/doc/misc/use-package.texi
index d3b6ee99003..6447f96c63f 100644
--- a/doc/misc/use-package.texi
+++ b/doc/misc/use-package.texi
@@ -652,12 +652,11 @@ elisp, GNU Emacs Lisp Reference Manual}). Further, this
value is fixed at
whatever was determined during compilation, to avoid looking up the
same information again on each startup. For example:
-@c FIXME: the below should use shell-command-to-string, surely?
@lisp
@group
(eval-and-compile
(defun ess-site-load-path ()
- (shell-command "find ~ -path ess/lisp")))
+ (shell-command-to-string "find ~ -path ess/lisp")))
@end group
@group
@@ -739,10 +738,8 @@ function and variable definitions that will:
@enumerate
@item
-@c FIXME: ``within a guard block''? what's that??
Make the byte-compiler happy: it will not complain about functions
-whose definitions are unknown because you have them within a guard
-block.
+whose definitions are unknown.
@item
Define functions and variables that will be used in an @code{:if}
@@ -1684,9 +1681,9 @@ them directly to the developers of that package manager.
Some users might want to byte-compile their init file to make Emacs
startup faster. This is not recommended in most cases, as the
-speed-up is often too small to be worth it, and can lead to confusion
-if the byte-compiled files are out-of-date. If you still want to do
-it, this chapter explains how to do that.
+speed-up is usually too small to be worth it, and it can lead to
+confusion if the byte-compiled files are out-of-date. If you still
+want to do it, this chapter explains how to do that.
@code{use-package} always loads every library that it can while a file
is being byte-compiled. This helps silence spurious warnings about
@@ -1723,9 +1720,8 @@ If you need to silence a missing function warning, you
can use
(defun my-ruby-mode-hook ()
(require 'inf-ruby)
(inf-ruby-keys))
-@end group
-
(add-hook 'ruby-mode-hook 'my-ruby-mode-hook))
+@end group
@end lisp
@findex :no-require
@@ -1922,11 +1918,12 @@ be optionally enabled.
@findex :ensure-system-package
The @code{:ensure-system-package} keyword allows you to ensure certain
executables are available on your system alongside your package
-declarations.@footnote{On macOS, you will want to make sure
-@code{exec-path} is cognisant of all binary package names that you
-would like to ensure are installed. The
+declarations.@footnote{On macOS, your @code{exec-path} might be
+different if you are starting Emacs as a GUI app instead of from a
+shell. If you find that Emacs on macOS cannot find some executables
+that you know are already installed, you could try the
@uref{https://github.com/purcell/exec-path-from-shell,@samp{exec-path-from-shell}}
-package is often a good way to do this.}
+package.}
To use this extension, add this immediately after loading
@code{use-package}:
@@ -1962,7 +1959,7 @@ together with @code{:ensure}.
@end group
@end lisp
-For example, on a @code{Debian GNU/Linux} system, this would call
+For example, on a Debian GNU/Linux system, this would call
@samp{apt-get install foo}.
If the package is named differently than the binary, you can use a
@@ -1976,11 +1973,10 @@ cons in the form of @code{(binary . package-name)}.
For example:
@end group
@end lisp
-On a @code{Debian GNU/Linux} system, this would call @code{apt install
-foo} if Emacs could not locate the executable
-@code{foocmd}.@footnote{For manual testing, you could use the
-@code{executable-find} function, which is what @samp{system-packages}
-uses internally.}
+On a Debian GNU/Linux system, this would call @code{apt install foo}
+if Emacs could not locate the executable @code{foocmd}.@footnote{For
+manual testing, you could use the @code{executable-find} function,
+which is what @samp{system-packages} uses internally.}
@code{:ensure-system-package} can also take a cons where the
@code{cdr} is a string that will get called by
diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el
index 3bddb93b64a..26d87a3622d 100644
--- a/lisp/emacs-lisp/checkdoc.el
+++ b/lisp/emacs-lisp/checkdoc.el
@@ -22,28 +22,35 @@
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
-;;
+
;; The Emacs Lisp manual has a nice chapter on how to write
;; documentation strings. Many stylistic suggestions are fairly
;; deterministic and easy to check for syntactically, but also easy
;; to forget. The main checkdoc engine will perform the stylistic
;; checks needed to make sure these styles are remembered.
;;
-;; There are three ways to use checkdoc:
-;; 1) Use `flymake-mode'.
+;; There are four ways to use checkdoc:
+;;
+;; 1) Use `flymake-mode'. Type `M-x flymake-mode' in any Emacs Lisp
+;; buffer; the checkdoc back-end is enabled by default.
+;;
;; 2) Periodically use `checkdoc' or `checkdoc-current-buffer'.
-;; `checkdoc' is a more interactive version of
-;; `checkdoc-current-buffer'
+;; The `checkdoc' command is a more interactive version of
+;; `checkdoc-current-buffer'.
+;;
;; 3) Use `checkdoc-minor-mode' to automatically check your
;; documentation whenever you evaluate Lisp code with C-M-x
;; or [menu-bar emacs-lisp eval-buffer]. Additional key-bindings
;; are also provided under C-c ? KEY
;; (add-hook 'emacs-lisp-mode-hook 'checkdoc-minor-mode)
;;
+;; 4) Use `checkdoc-ispell' to spellcheck docstrings interactively.
+;;
;; Using `checkdoc':
;;
-;; The commands `checkdoc' and `checkdoc-ispell' are the top-level
-;; entry points to all of the different checks that are available. It
+;; Most users will probably use checkdoc through `flymake'. The
+;; commands `checkdoc' and `checkdoc-ispell' are the top-level entry
+;; points to all of the different checks that are available. It
;; breaks examination of your Lisp file into four sections (comments,
;; documentation, messages, and spacing) and indicates its current
;; state in a status buffer.
@@ -66,7 +73,7 @@
;; interface offers several options, including the ability to skip to
;; the next error, or back up to previous errors. Auto-fixing is
;; turned off at this stage, but you can use the `f' or `F' key to fix
-;; a given error (if the fix is available.)
+;; a given error (if the fix is available).
;;
;; Auto-fixing:
;;
@@ -99,6 +106,7 @@
;; install into Ispell on the fly, but only if Ispell is not already
;; running. Use `ispell-kill-ispell' to make checkdoc restart it with
;; these words enabled.
+;; See also the `flyspell-prog-mode' minor mode.
;;
;; Checking parameters:
;;
@@ -176,6 +184,7 @@
"Support for doc string checking in Emacs Lisp."
:prefix "checkdoc"
:group 'lisp
+ :link '(emacs-commentary-link "checkdoc.el")
:version "20.3")
(defcustom checkdoc-minor-mode-string " CDoc"
diff --git a/lisp/emacs-lisp/tabulated-list.el
b/lisp/emacs-lisp/tabulated-list.el
index 206c10a7734..595dc9b29db 100644
--- a/lisp/emacs-lisp/tabulated-list.el
+++ b/lisp/emacs-lisp/tabulated-list.el
@@ -263,8 +263,6 @@ Populated by `tabulated-list-init-header'.")
'header-line-indent--line-number-width "29.1")
(define-obsolete-function-alias 'tabulated-list-watch-line-number-width
'header-line-indent--watch-line-number-width "29.1")
-(define-obsolete-function-alias 'tabulated-list-watch-line-number-width
- 'header-line-indent--watch-line-number-width "29.1")
(define-obsolete-function-alias 'tabulated-list-window-scroll-function
'header-line-indent--window-scroll-function "29.1")
diff --git a/lisp/org/ob-comint.el b/lisp/org/ob-comint.el
index e8d83670767..064ba94464f 100644
--- a/lisp/org/ob-comint.el
+++ b/lisp/org/ob-comint.el
@@ -117,6 +117,14 @@ or user `keyboard-quit' during execution of body."
(goto-char (process-mark (get-buffer-process (current-buffer))))
(insert dangling-text)
+ ;; Replace partially supplied input lines.
+ ;; This is needed when output filter spits partial lines that
+ ;; do not include a full prompt at a time.
+ (setq string-buffer
+ (replace-regexp-in-string
+ comint-prompt-regexp
+ ,org-babel-comint-prompt-separator
+ string-buffer))
;; remove echo'd FULL-BODY from input
(when (and ,remove-echo ,full-body
(string-match
diff --git a/lisp/org/ob-core.el b/lisp/org/ob-core.el
index 5b78ee946ff..f69538f78c9 100644
--- a/lisp/org/ob-core.el
+++ b/lisp/org/ob-core.el
@@ -2709,7 +2709,9 @@ specified as an an \"attachment:\" style link."
((and 'attachment (guard in-attach-dir)) "attachment")
(_ "file"))
(if (and request-attachment in-attach-dir)
- (file-relative-name result-file-name)
+ (file-relative-name
+ result-file-name
+ (file-name-as-directory attach-dir))
(if (and default-directory
base-file-name same-directory?)
(if (eq org-link-file-path-type 'adaptive)
diff --git a/lisp/org/ol.el b/lisp/org/ol.el
index cd52e9cf4df..3ae8f887554 100644
--- a/lisp/org/ol.el
+++ b/lisp/org/ol.el
@@ -1488,9 +1488,9 @@ If the link is in hidden text, expose it."
(defun org-link-descriptive-ensure ()
"Toggle the literal or descriptive display of links in current buffer if
needed."
- (if org-link-descriptive
- (org-fold-core-set-folding-spec-property (car
org-link--link-folding-spec) :visible nil)
- (org-fold-core-set-folding-spec-property (car org-link--link-folding-spec)
:visible t)))
+ (org-fold-core-set-folding-spec-property
+ (car org-link--link-folding-spec)
+ :visible (not org-link-descriptive)))
;;;###autoload
(defun org-toggle-link-display ()
diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el
index f28805d5e6b..02cddddb304 100644
--- a/lisp/org/org-clock.el
+++ b/lisp/org/org-clock.el
@@ -3049,53 +3049,58 @@ PROPERTIES: The list properties specified in the
`:properties' parameter
"If this is a CLOCK line, update it and return t.
Otherwise, return nil."
(interactive)
- (save-excursion
- (beginning-of-line 1)
- (skip-chars-forward " \t")
- (when (looking-at org-clock-string)
- (let ((re (concat "[ \t]*" org-clock-string
- " *[[<]\\([^]>]+\\)[]>]\\(-+[[<]\\([^]>]+\\)[]>]"
- "\\([ \t]*=>.*\\)?\\)?"))
- ts te h m s neg)
- (cond
- ((not (looking-at re))
- nil)
- ((not (match-end 2))
- (when (and (equal (marker-buffer org-clock-marker) (current-buffer))
- (> org-clock-marker (point))
- (<= org-clock-marker (line-end-position)))
- ;; The clock is running here
- (setq org-clock-start-time
- (org-time-string-to-time (match-string 1)))
- (org-clock-update-mode-line)))
- (t
- ;; Prevent recursive call from `org-timestamp-change'.
- (cl-letf (((symbol-function 'org-clock-update-time-maybe) #'ignore))
- ;; Update timestamps.
- (save-excursion
- (goto-char (match-beginning 1)) ; opening timestamp
- (save-match-data (org-timestamp-change 0 'day)))
+ (let ((origin (point))) ;; `save-excursion' may not work when deleting.
+ (save-excursion
+ (beginning-of-line 1)
+ (skip-chars-forward " \t")
+ (when (looking-at org-clock-string)
+ (let ((re (concat "[ \t]*" org-clock-string
+ " *[[<]\\([^]>]+\\)[]>]\\(-+[[<]\\([^]>]+\\)[]>]"
+ "\\([ \t]*=>.*\\)?\\)?"))
+ ts te h m s neg)
+ (cond
+ ((not (looking-at re))
+ nil)
+ ((not (match-end 2))
+ (when (and (equal (marker-buffer org-clock-marker) (current-buffer))
+ (> org-clock-marker (point))
+ (<= org-clock-marker (line-end-position)))
+ ;; The clock is running here
+ (setq org-clock-start-time
+ (org-time-string-to-time (match-string 1)))
+ (org-clock-update-mode-line)))
+ (t
+ ;; Prevent recursive call from `org-timestamp-change'.
+ (cl-letf (((symbol-function 'org-clock-update-time-maybe)
#'ignore))
+ ;; Update timestamps.
+ (save-excursion
+ (goto-char (match-beginning 1)) ; opening timestamp
+ (save-match-data (org-timestamp-change 0 'day)))
+ ;; Refresh match data.
+ (looking-at re)
+ (save-excursion
+ (goto-char (match-beginning 3)) ; closing timestamp
+ (save-match-data (org-timestamp-change 0 'day))))
;; Refresh match data.
(looking-at re)
- (save-excursion
- (goto-char (match-beginning 3)) ; closing timestamp
- (save-match-data (org-timestamp-change 0 'day))))
- ;; Refresh match data.
- (looking-at re)
- (and (match-end 4) (delete-region (match-beginning 4) (match-end 4)))
- (end-of-line 1)
- (setq ts (match-string 1)
- te (match-string 3))
- (setq s (- (org-time-string-to-seconds te)
- (org-time-string-to-seconds ts))
- neg (< s 0)
- s (abs s)
- h (floor (/ s 3600))
- s (- s (* 3600 h))
- m (floor (/ s 60))
- s (- s (* 60 s)))
- (insert " => " (format (if neg "-%d:%02d" "%2d:%02d") h m))
- t))))))
+ (and (match-end 4) (delete-region (match-beginning 4) (match-end
4)))
+ (end-of-line 1)
+ (setq ts (match-string 1)
+ te (match-string 3))
+ (setq s (- (org-time-string-to-seconds te)
+ (org-time-string-to-seconds ts))
+ neg (< s 0)
+ s (abs s)
+ h (floor (/ s 3600))
+ s (- s (* 3600 h))
+ m (floor (/ s 60))
+ s (- s (* 60 s)))
+ (insert " => " (format (if neg "-%d:%02d" "%2d:%02d") h m))
+ t)))))
+ ;; Move back to initial position, but never beyond updated
+ ;; clock.
+ (unless (< (point) origin)
+ (goto-char origin))))
(defun org-clock-save ()
"Persist various clock-related data to disk.
diff --git a/lisp/org/org-element.el b/lisp/org/org-element.el
index 48ede9c5289..1f36775a7b5 100644
--- a/lisp/org/org-element.el
+++ b/lisp/org/org-element.el
@@ -5717,7 +5717,11 @@ This function assumes `org-element--headline-cache' is a
valid AVL tree."
;; `combine-change-calls' because the buffer is potentially
;; changed without notice (the change will be registered
;; after exiting the `combine-change-calls' body though).
- (memq #'org-element--cache-after-change
after-change-functions))))))
+ (catch :inhibited
+ (org-fold-core-cycle-over-indirect-buffers
+ (unless (memq #'org-element--cache-after-change
after-change-functions)
+ (throw :inhibited nil)))
+ t))))))
;; FIXME: Remove after we establish that hashing is effective.
(defun org-element-cache-hash-show-statistics ()
diff --git a/lisp/org/org-fold-core.el b/lisp/org/org-fold-core.el
index be600f8a0cc..ffa689d4fa1 100644
--- a/lisp/org/org-fold-core.el
+++ b/lisp/org/org-fold-core.el
@@ -497,7 +497,7 @@ hanging around."
(declare (debug (form body)) (indent 0))
`(let (buffers dead-properties)
(if (and (not (buffer-base-buffer))
- (not (eq (current-buffer) (car
org-fold-core--indirect-buffers))))
+ (not (memq (current-buffer) org-fold-core--indirect-buffers)))
;; We are in base buffer with `org-fold-core--indirect-buffers' value
from
;; different buffer. This can happen, for example, when
;; org-capture copies local variables into *Capture* buffer.
@@ -930,6 +930,8 @@ are provided.
If FROM is non-nil and TO is nil, search the folded regions at FROM.
+When both FROM and TO are nil, search folded regions in the whole buffer.
+
When SPECS is non-nil it should be a list of folding specs or a symbol.
Only return the matching fold types.
@@ -946,6 +948,9 @@ WITH-MARKERS must be nil when RELATIVE is non-nil."
(unless (listp specs) (setq specs (list specs)))
(let (regions region mk-region)
(org-with-wide-buffer
+ (when (and (not from) (not to))
+ (setq from (point-min)
+ to (point-max)))
(when (and from (not to)) (setq to (point-max)))
(when (and from (< from (point-min))) (setq from (point-min)))
(when (and to (> to (point-max))) (setq to (point-max)))
@@ -1058,7 +1063,7 @@ means that the buffer should stay alive during the
operation,
because otherwise all these markers will point to nowhere."
(declare (debug (form body)) (indent 1))
(org-with-gensyms (regions)
- `(let* ((,regions ,(org-fold-core-get-regions :with-markers use-markers)))
+ `(let* ((,regions (org-fold-core-get-regions :with-markers ,use-markers)))
(unwind-protect (progn ,@body)
(org-fold-core-regions ,regions :override t :clean-markers t)))))
diff --git a/lisp/org/org-footnote.el b/lisp/org/org-footnote.el
index aedd413351c..ac78360aeff 100644
--- a/lisp/org/org-footnote.el
+++ b/lisp/org/org-footnote.el
@@ -851,9 +851,12 @@ to `org-footnote-section'. Inline definitions are
ignored."
(format "[fn:%s] DEFINITION NOT FOUND." label))
"\n"))))
;; Insert un-referenced footnote definitions at the end.
- (pcase-dolist (`(,label . ,definition) definitions)
- (unless (member label inserted)
- (insert "\n" definition "\n")))))))))
+ ;; Combine all insertions into one to create a single cache
+ ;; update call.
+ (combine-change-calls (point) (point)
+ (pcase-dolist (`(,label . ,definition) definitions)
+ (unless (member label inserted)
+ (insert "\n" definition "\n"))))))))))
(defun org-footnote-normalize ()
"Turn every footnote in buffer into a numbered one."
diff --git a/lisp/org/org-persist.el b/lisp/org/org-persist.el
index 108292f1e92..1a32ed01020 100644
--- a/lisp/org/org-persist.el
+++ b/lisp/org/org-persist.el
@@ -161,7 +161,7 @@
(declare-function org-at-heading-p "org" (&optional invisible-not-ok))
-(defconst org-persist--storage-version "2.5"
+(defconst org-persist--storage-version "2.7"
"Persistent storage layout version.")
(defgroup org-persist nil
@@ -856,9 +856,16 @@ When IGNORE-RETURN is non-nil, just return t on success
without calling
(setq associated (org-persist--normalize-associated (get-file-buffer
(plist-get associated :file)))))
(let ((collection (org-persist--get-collection container associated)))
(setf collection (plist-put collection :associated associated))
- (unless (seq-find (lambda (v)
- (run-hook-with-args-until-success
'org-persist-before-write-hook v associated))
- (plist-get collection :container))
+ (unless (or
+ ;; Prevent data leakage from encrypted files.
+ ;; We do it in somewhat paranoid manner and do not
+ ;; allow anything related to encrypted files to be
+ ;; written.
+ (and (plist-get associated :file)
+ (string-match-p epa-file-name-regexp (plist-get associated
:file)))
+ (seq-find (lambda (v)
+ (run-hook-with-args-until-success
'org-persist-before-write-hook v associated))
+ (plist-get collection :container)))
(when (or (file-exists-p org-persist-directory)
(org-persist--save-index))
(let ((file (org-file-name-concat org-persist-directory (plist-get
collection :persist-file)))
(data (mapcar (lambda (c) (cons c (org-persist-write:generic c
collection)))
diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el
index 8e0e8e6cf86..fa9a0319be2 100644
--- a/lisp/org/org-table.el
+++ b/lisp/org/org-table.el
@@ -41,6 +41,7 @@
(require 'org-macs)
(require 'org-compat)
(require 'org-keys)
+(require 'org-fold-core)
(declare-function calc-eval "calc" (str &optional separator &rest args))
(declare-function face-remap-remove-relative "face-remap" (cookie))
@@ -4448,6 +4449,13 @@ FIELD is a string. WIDTH is a number. ALIGN is either
\"c\",
(defun org-table-justify-field-maybe (&optional new)
"Justify the current field, text to left, number to right.
Optional argument NEW may specify text to replace the current field content."
+ ;; FIXME: Prevent newlines inside field. They are currently not
+ ;; supported.
+ (when (and (stringp new) (string-match-p "\n" new))
+ (message "Removing newlines from formula result: %S" new)
+ (setq new (replace-regexp-in-string
+ "\n" " "
+ (replace-regexp-in-string "\\(^\n+\\)\\|\\(\n+$\\)" "" new))))
(cond
((and (not new) org-table-may-need-update)) ; Realignment will happen anyway
((org-at-table-hline-p))
@@ -5721,31 +5729,32 @@ This may be either a string or a function of two
arguments:
;; Initialize communication channel in INFO.
(with-temp-buffer
(let ((org-inhibit-startup t)) (org-mode))
- (let ((standard-output (current-buffer))
- (org-element-use-cache nil))
- (dolist (e table)
- (cond ((eq e 'hline) (princ "|--\n"))
- ((consp e)
- (princ "| ") (dolist (c e) (princ c) (princ " |"))
- (princ "\n")))))
- (org-element-cache-reset)
- ;; Add back-end specific filters, but not user-defined ones. In
- ;; particular, make sure to call parse-tree filters on the
- ;; table.
- (setq info
- (let ((org-export-filters-alist nil))
- (org-export-install-filters
- (org-combine-plists
- (org-export-get-environment backend nil params)
- `(:back-end ,(org-export-get-backend backend))))))
- (setq data
- (org-export-filter-apply-functions
- (plist-get info :filter-parse-tree)
- (org-element-map (org-element-parse-buffer) 'table
- #'identity nil t)
- info)))
- (when (and backend (symbolp backend) (not (org-export-get-backend
backend)))
- (user-error "Unknown :backend value"))
+ (org-fold-core-ignore-modifications
+ (let ((standard-output (current-buffer))
+ (org-element-use-cache nil))
+ (dolist (e table)
+ (cond ((eq e 'hline) (princ "|--\n"))
+ ((consp e)
+ (princ "| ") (dolist (c e) (princ c) (princ " |"))
+ (princ "\n")))))
+ (org-element-cache-reset)
+ ;; Add back-end specific filters, but not user-defined ones. In
+ ;; particular, make sure to call parse-tree filters on the
+ ;; table.
+ (setq info
+ (let ((org-export-filters-alist nil))
+ (org-export-install-filters
+ (org-combine-plists
+ (org-export-get-environment backend nil params)
+ `(:back-end ,(org-export-get-backend backend))))))
+ (setq data
+ (org-export-filter-apply-functions
+ (plist-get info :filter-parse-tree)
+ (org-element-map (org-element-parse-buffer) 'table
+ #'identity nil t)
+ info))
+ (when (and backend (symbolp backend) (not (org-export-get-backend
backend)))
+ (user-error "Unknown :backend value"))))
(when (or (not backend) (plist-get info :raw)) (require 'ox-org))
;; Handle :skip parameter.
(let ((skip (plist-get info :skip)))
diff --git a/lisp/org/org-version.el b/lisp/org/org-version.el
index e9339690409..b9f8d5d66e7 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."
(defun org-git-version ()
"The Git version of Org mode.
Inserted by installing Org or when a release is made."
- (let ((org-git-version "release_9.6-3-ga4d38e"))
+ (let ((org-git-version "release_9.6-31-g954a95"))
org-git-version))
(provide 'org-version)
diff --git a/lisp/org/org.el b/lisp/org/org.el
index ab6212daccd..19f94c5e232 100644
--- a/lisp/org/org.el
+++ b/lisp/org/org.el
@@ -11380,7 +11380,7 @@ See also `org-scan-tags'."
(pv (match-string 7 term))
(regexp (eq (string-to-char pv) ?{))
(strp (eq (string-to-char pv) ?\"))
- (timep (string-match-p "^\"[[<][0-9]+.*[]>]\"$"
pv))
+ (timep (string-match-p
"^\"[[<]\\(?:[0-9]+\\|now\\|today\\|tomorrow\\|[+-][0-9]+[dmwy]\\).*[]>]\"$"
pv))
(po (org-op-to-function (match-string 6 term)
(if timep 'time strp))))
(setq pv (if (or regexp strp) (substring pv 1 -1) pv))
@@ -16322,6 +16322,10 @@ buffer boundaries with possible narrowing."
(org-element-property :end link))
(skip-chars-backward " \t")
(point)))))
+ ;; FIXME: See bug#59902. We cannot rely
+ ;; on Emacs to update image if the file
+ ;; has changed.
+ (image-flush image)
(overlay-put ov 'display image)
(overlay-put ov 'face 'default)
(overlay-put ov 'org-image-overlay t)
diff --git a/lisp/org/ox-md.el b/lisp/org/ox-md.el
index 01e0aa0491b..dcd95e98711 100644
--- a/lisp/org/ox-md.el
+++ b/lisp/org/ox-md.el
@@ -87,7 +87,8 @@ included into another document or application that reserves
top-level
headings for its own use."
:group 'org-export-md
:package-version '(Org . "9.6")
- :type 'natnum)
+ ;; Avoid `natnum' because that's not available until Emacs 28.1.
+ :type 'integer)
diff --git a/lisp/org/ox.el b/lisp/org/ox.el
index f6629cde4dc..aed669ee87d 100644
--- a/lisp/org/ox.el
+++ b/lisp/org/ox.el
@@ -3036,6 +3036,11 @@ Return code as a string."
(org-narrow-to-subtree)
(goto-char (point-min))
(org-end-of-meta-data)
+ ;; Make the region include top heading in the subtree.
+ ;; This way, we will be able to retrieve its export
+ ;; options when calling
+ ;; `org-export--get-subtree-options'.
+ (backward-char)
(narrow-to-region (point) (point-max))))
;; Initialize communication channel with original buffer
;; attributes, unavailable in its copy.
diff --git a/lisp/shell.el b/lisp/shell.el
index b396bc2b180..dadbdcbc034 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -1162,6 +1162,7 @@ line output and parses it to form the new directory
stack."
(dlsl nil)
(pos 0)
(ds nil))
+ (setq dls (string-trim-right dls "[ ]+"))
;; Split the dirlist into whitespace and non-whitespace chunks.
;; dlsl will be a reversed list of tokens.
(while (string-match "\\(\\S-+\\|\\s-+\\)" dls pos)
diff --git a/src/buffer.c b/src/buffer.c
index 71be7ed9e13..69f27c9f476 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -604,7 +604,6 @@ even if it is dead. The return value is never nil. */)
set_buffer_intervals (b, NULL);
BUF_UNCHANGED_MODIFIED (b) = 1;
BUF_OVERLAY_UNCHANGED_MODIFIED (b) = 1;
- BUF_CHARS_UNCHANGED_MODIFIED (b) = 1;
BUF_END_UNCHANGED (b) = 0;
BUF_BEG_UNCHANGED (b) = 0;
*(BUF_GPT_ADDR (b)) = *(BUF_Z_ADDR (b)) = 0; /* Put an anchor '\0'. */
diff --git a/src/buffer.h b/src/buffer.h
index 9ead875bcf8..7c3d1903140 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -149,18 +149,12 @@ enum { BEG = 1, BEG_BYTE = BEG };
#define BUF_BEG_UNCHANGED(buf) ((buf)->text->beg_unchanged)
#define BUF_END_UNCHANGED(buf) ((buf)->text->end_unchanged)
-#define BUF_CHARS_UNCHANGED_MODIFIED(buf) \
- ((buf)->text->chars_unchanged_modified)
-
#define UNCHANGED_MODIFIED \
BUF_UNCHANGED_MODIFIED (current_buffer)
#define OVERLAY_UNCHANGED_MODIFIED \
BUF_OVERLAY_UNCHANGED_MODIFIED (current_buffer)
#define BEG_UNCHANGED BUF_BEG_UNCHANGED (current_buffer)
#define END_UNCHANGED BUF_END_UNCHANGED (current_buffer)
-
-#define CHARS_UNCHANGED_MODIFIED \
- BUF_CHARS_UNCHANGED_MODIFIED (current_buffer)
/* Functions to set PT in the current buffer, or another buffer. */
@@ -274,11 +268,6 @@ struct buffer_text
end_unchanged contain no useful information. */
modiff_count overlay_unchanged_modified;
- /* CHARS_MODIFF as of last redisplay that finished. It's used
- when we only care about changes in actual buffer text, not in
- any other kind of changes, like properties etc. */
- modiff_count chars_unchanged_modified;
-
/* Properties of this buffer's text. */
INTERVAL intervals;
diff --git a/src/pdumper.c b/src/pdumper.c
index 35e86d2b504..e1c55d07ac3 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -2811,7 +2811,6 @@ dump_buffer (struct dump_context *ctx, const struct
buffer *in_buffer)
DUMP_FIELD_COPY (out, buffer, own_text.end_unchanged);
DUMP_FIELD_COPY (out, buffer, own_text.unchanged_modified);
DUMP_FIELD_COPY (out, buffer, own_text.overlay_unchanged_modified);
- DUMP_FIELD_COPY (out, buffer, own_text.chars_unchanged_modified);
if (buffer->own_text.intervals)
dump_field_fixup_later (ctx, out, buffer, &buffer->own_text.intervals);
dump_field_lv_rawptr (ctx, out, buffer, &buffer->own_text.markers,
diff --git a/src/xdisp.c b/src/xdisp.c
index 4e087bc39be..66584e4d73a 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -17264,7 +17264,6 @@ mark_window_display_accurate_1 (struct window *w, bool
accurate_p)
BUF_UNCHANGED_MODIFIED (b) = BUF_MODIFF (b);
BUF_OVERLAY_UNCHANGED_MODIFIED (b) = BUF_OVERLAY_MODIFF (b);
- BUF_CHARS_UNCHANGED_MODIFIED (b) = BUF_CHARS_MODIFF (b);
BUF_BEG_UNCHANGED (b) = BUF_GPT (b) - BUF_BEG (b);
BUF_END_UNCHANGED (b) = BUF_Z (b) - BUF_GPT (b);
@@ -19535,7 +19534,7 @@ redisplay_window (Lisp_Object window, bool
just_this_one_p)
/* Check whether the buffer to be displayed contains long lines. */
if (!NILP (Vlong_line_threshold)
&& !current_buffer->long_line_optimizations_p
- && (CHARS_MODIFF - CHARS_UNCHANGED_MODIFIED > 8
+ && (CHARS_MODIFF - UNCHANGED_MODIFIED > 8
|| current_buffer->clip_changed))
{
ptrdiff_t cur, next, found, max = 0, threshold;
diff --git a/src/xfaces.c b/src/xfaces.c
index df078227c8a..643f4365896 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -6071,8 +6071,42 @@ realize_gui_face (struct face_cache *cache, Lisp_Object
attrs[LFACE_VECTOR_SIZE]
emacs_abort ();
}
if (! FONT_OBJECT_P (attrs[LFACE_FONT_INDEX]))
- attrs[LFACE_FONT_INDEX]
- = font_load_for_lface (f, attrs, attrs[LFACE_FONT_INDEX]);
+ {
+ Lisp_Object spec = copy_font_spec (attrs[LFACE_FONT_INDEX]);
+#define MAYBE_UNSET_ATTRIBUTE(ATTR) \
+ if (realize_gui_face_ignored_spec_attributes \
+ & (1 << FONT_##ATTR##_INDEX)) \
+ ASET (spec, FONT_##ATTR##_INDEX, Qnil);
+ /* The default value of
+ realize_gui_face_ignored_spec_attributes unsets the
+ weight, slant and width in spec. The best possible
+ values for these attributes is determined in
+ font_find_for_lface, called by font_load_for_lface, when
+ the candidate list returned by font_list_entities is
+ sorted by font_select_entity (which calls
+ font_sort_entities, which calls font_score). If these
+ attributes are not unset here, the candidate font list
+ returned by font_list_entities only contains fonts that
+ are exact matches for these weight, slant and width
+ attributes, which leads to suboptimal or wrong font
+ choices. See bug#59347. */
+ MAYBE_UNSET_ATTRIBUTE (WEIGHT);
+ MAYBE_UNSET_ATTRIBUTE (SLANT);
+ MAYBE_UNSET_ATTRIBUTE (WIDTH);
+ /* Also allow unsetting other attributes for debugging
+ purposes. */
+ MAYBE_UNSET_ATTRIBUTE (FAMILY);
+ MAYBE_UNSET_ATTRIBUTE (FOUNDRY);
+ MAYBE_UNSET_ATTRIBUTE (REGISTRY);
+ MAYBE_UNSET_ATTRIBUTE (ADSTYLE);
+ MAYBE_UNSET_ATTRIBUTE (SIZE);
+ MAYBE_UNSET_ATTRIBUTE (DPI);
+ MAYBE_UNSET_ATTRIBUTE (SPACING);
+ MAYBE_UNSET_ATTRIBUTE (AVGWIDTH);
+ MAYBE_UNSET_ATTRIBUTE (EXTRA);
+#undef MAYBE_UNSET_ATTRIBUTE
+ attrs[LFACE_FONT_INDEX] = font_load_for_lface (f, attrs, spec);
+ }
if (FONT_OBJECT_P (attrs[LFACE_FONT_INDEX]))
{
face->font = XFONT_OBJECT (attrs[LFACE_FONT_INDEX]);
@@ -7360,6 +7394,28 @@ Lisp programs that change the value of this variable
should also
clear the face cache, see `clear-face-cache'. */);
face_near_same_color_threshold = 30000;
+ DEFVAR_INT ("realize-gui-face-ignored-spec-attributes",
+ realize_gui_face_ignored_spec_attributes,
+ doc: /* Ignored font-spec attributes in realize_gui_face.
+
+The value is an integer number and represents a bit mask.
+The attribute corresponding to each bit that is set is cleared in
+realize_gui_face. The bits are: 1 = :foundry, 2 = :family,
+3 = :adstyle, 4 = :registry, 5 = :weight, 6 = :slant, 7 = :width,
+8 = :size, 9 = :dpi, 10 = :spacing, 11 = :avgwidth, 12 = extra
+attributes (:name, :script, :lang and :otf).
+
+Bits 5 to 7 are set in the default value. When these bits are not
+set, and when the font chosen for the default face has a weight, slant
+or width that is not supported by other available fonts on the system,
+such as 'medium', Emacs may select suboptimal fonts for other faces.
+
+There is no reason to change that value except for debugging purposes. */);
+ realize_gui_face_ignored_spec_attributes =
+ (1 << FONT_WEIGHT_INDEX) |
+ (1 << FONT_SLANT_INDEX) |
+ (1 << FONT_WIDTH_INDEX);
+
#ifdef HAVE_WINDOW_SYSTEM
defsubr (&Sbitmap_spec_p);
defsubr (&Sx_list_fonts);
- master updated (0878279809c -> 66fdd45bdd8), Po Lu, 2022/12/10
- master 13310643cd6 1/7: Merge from origin/emacs-29, Po Lu, 2022/12/10
- master e0856443291 2/7: ; Merge from origin/emacs-29, Po Lu, 2022/12/10
- master 6d6ca47aba7 3/7: Merge from origin/emacs-29, Po Lu, 2022/12/10
- master 66fdd45bdd8 7/7: Merge from origin/emacs-29, Po Lu, 2022/12/10
- master 52de8885048 4/7: ; Merge from origin/emacs-29, Po Lu, 2022/12/10
- master 5737c2a3af7 5/7: Merge from origin/emacs-29,
Po Lu <=
- master 6048503c526 6/7: ; Merge from origin/emacs-29, Po Lu, 2022/12/10