From 5af695c7479f97d86bf913b5ff96d3f3b744781f Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 5 Mar 2023 08:43:03 +0200 Subject: ; * lib-src/etags.c (print_help): Fix indentation. --- lib-src/etags.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib-src/etags.c b/lib-src/etags.c index 0b048748602..749827e0664 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -978,8 +978,8 @@ Relative ones are stored relative to the output file's directory.\n"); puts ("\tand create tags for extern variables unless --no-globals is used."); - puts ("In Mercury, tag both declarations starting a line with ':-' and first\n\ - predicates or functions in clauses."); + puts ("\tIn Mercury, tag both declarations starting a line with ':-' and\n\ + first predicates or functions in clauses."); if (CTAGS) puts ("-d, --defines\n\ -- cgit v1.2.1 From 9c18af0cfaf2d949d782f6c44c6604b54dbb87a0 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Sun, 5 Mar 2023 10:46:18 +0100 Subject: * Warn when certain primitives are redefined (bug#61880) * lisp/emacs-lisp/comp.el (comp-warn-primitives): New constant. (comp-subr-trampoline-install): Warn when a sensitive primitive is being redefined. --- lisp/emacs-lisp/comp.el | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 046d169f00f..48756caf100 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -698,11 +698,22 @@ Useful to hook into pass checkers.") (defvar comp-no-spawn nil "Non-nil don't spawn native compilation processes.") +(defconst comp-warn-primitives + '(null memq gethash and subrp not subr-native-elisp-p + comp--install-trampoline concat if symbolp symbol-name make-string + length aset aref length> mapcar expand-file-name + file-name-as-directory file-exists-p native-elisp-load) + "List of primitives we want to warn about in case of redefinition. +This are essential for the trampoline machinery to work properly.") + ;; Moved early to avoid circularity when comp.el is loaded and ;; `macroexpand' needs to be advised (bug#47049). ;;;###autoload (defun comp-subr-trampoline-install (subr-name) "Make SUBR-NAME effectively advice-able when called from native code." + (when (memq subr-name comp-warn-primitives) + (warn "Redefining `%s' might breaks trampoline native compilation." + subr-name)) (unless (or (null native-comp-enable-subr-trampolines) (memq subr-name native-comp-never-optimize-functions) (gethash subr-name comp-installed-trampolines-h)) -- cgit v1.2.1 From 2258ed01f420fd4fe66402169add1db7e01f7d2c Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 5 Mar 2023 12:24:39 +0200 Subject: ; Minor fix of last change * lisp/emacs-lisp/comp.el (comp-subr-trampoline-install): Fix wording. (Bug#61880) --- lisp/emacs-lisp/comp.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 48756caf100..72e9b8e37dc 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -712,7 +712,7 @@ This are essential for the trampoline machinery to work properly.") (defun comp-subr-trampoline-install (subr-name) "Make SUBR-NAME effectively advice-able when called from native code." (when (memq subr-name comp-warn-primitives) - (warn "Redefining `%s' might breaks trampoline native compilation." + (warn "Redefining `%s' might break native compilation of trampolines." subr-name)) (unless (or (null native-comp-enable-subr-trampolines) (memq subr-name native-comp-never-optimize-functions) -- cgit v1.2.1 From 5b8e0b31548feb7450d73a6ee33e10e6ed9796ee Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sun, 5 Mar 2023 17:31:26 +0100 Subject: Fix tramp-sh-handle-insert-directory * lisp/net/tramp-sh.el (tramp-sh-handle-insert-directory): Remove also //DIRED-OPTIONS// line when there is no //DIRED// line. --- lisp/net/tramp-sh.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index ec8437176db..392a654df21 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -2742,8 +2742,8 @@ The method used must be an out-of-band method." ;; End is followed by \n or by " -> ". (put-text-property start end 'dired-filename t)))))) ;; Remove trailing lines. - (beginning-of-line) - (while (looking-at "//") + (goto-char (point-max)) + (while (re-search-backward (rx bol "//") nil 'noerror) (forward-line 1) (delete-region (match-beginning 0) (point)))) ;; Reset multibyte if needed. -- cgit v1.2.1 From 80e1037df44c0b4607423d744a8b9b409a15efce Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Sun, 5 Mar 2023 14:16:58 -0800 Subject: Add string-interpolation feature to bash-ts-mode * lisp/progmodes/sh-script.el: (bash-ts-mode): Add string-interpolation feature. (sh-mode--treesit-settings): Add rule for string-interpolation feature. --- lisp/progmodes/sh-script.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 4c06efc8146..29820049636 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1619,7 +1619,8 @@ not written in Bash or sh." (setq-local treesit-font-lock-feature-list '(( comment function) ( command declaration-command keyword string) - ( builtin-variable constant heredoc number variable) + ( builtin-variable constant heredoc number + string-interpolation variable) ( bracket delimiter misc-punctuation operator))) (setq-local treesit-font-lock-settings sh-mode--treesit-settings) @@ -3289,6 +3290,12 @@ See `sh-mode--treesit-other-keywords' and :language 'bash '([(string) (raw_string)] @font-lock-string-face) + :feature 'string-interpolation + :language 'bash + :override t + '((command_substitution) @sh-quoted-exec + (string (expansion (variable_name) @font-lock-variable-name-face))) + :feature 'heredoc :language 'bash '([(heredoc_start) (heredoc_body)] @sh-heredoc) -- cgit v1.2.1 From b1b3af5b90ba6f5416dfaf60e33729b32ca2f195 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sun, 5 Mar 2023 17:22:06 -0500 Subject: Update to Org 9.6.1-40-g3d817c --- doc/misc/org.org | 3 ++- etc/refcards/orgcard.tex | 4 +-- lisp/org/org-clock.el | 10 +++++--- lisp/org/org-version.el | 2 +- lisp/org/org.el | 64 ++++++++++++++++++++++++++---------------------- 5 files changed, 47 insertions(+), 36 deletions(-) diff --git a/doc/misc/org.org b/doc/misc/org.org index ad889a5c622..7ff0933de75 100644 --- a/doc/misc/org.org +++ b/doc/misc/org.org @@ -18096,7 +18096,8 @@ evaluating untrusted code blocks by prompting for a confirmation. - =yes= :: - Org always evaluates the source code without asking permission. + Org evaluates the source code, possibly asking permission according + to ~org-confirm-babel-evaluate~. - =never= or =no= :: diff --git a/etc/refcards/orgcard.tex b/etc/refcards/orgcard.tex index 093dfceafa7..dc222719b7e 100644 --- a/etc/refcards/orgcard.tex +++ b/etc/refcards/orgcard.tex @@ -1,6 +1,6 @@ % Reference Card for Org Mode \def\orgversionnumber{9.6.1} -\def\versionyear{2021} % latest update +\def\versionyear{2023} % latest update \input emacsver.tex %**start of header @@ -329,7 +329,7 @@ \key{archive subtree using the default command}{C-c C-x C-a} \key{move subtree to archive file}{C-c C-x C-s} \key{toggle ARCHIVE tag / to ARCHIVE sibling}{C-c C-x a/A} -\key{force cycling of an ARCHIVEd tree}{C-TAB} +\key{force cycling of an ARCHIVEd tree}{C-c C-TAB} \section{Filtering and Sparse Trees} diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el index 55372e5649b..f9daf3f14d8 100644 --- a/lisp/org/org-clock.el +++ b/lisp/org/org-clock.el @@ -726,9 +726,9 @@ If not, show simply the clocked time like 01:50." 'org-mode-line-clock-overrun 'org-mode-line-clock))) (effort-str (org-duration-from-minutes effort-in-minutes))) - (format (propertize " [%s/%s] (%s)" 'face 'org-mode-line-clock) + (format (propertize "[%s/%s] (%s) " 'face 'org-mode-line-clock) work-done-str effort-str org-clock-heading)) - (format (propertize " [%s] (%s)" 'face 'org-mode-line-clock) + (format (propertize "[%s] (%s) " 'face 'org-mode-line-clock) (org-duration-from-minutes clocked-time) org-clock-heading)))) @@ -1798,7 +1798,11 @@ Optional argument N tells to change by that many units." (begts (if updatets1 begts1 begts2))) (setq tdiff (time-subtract - (org-time-string-to-time org-last-changed-timestamp) + (org-time-string-to-time + (save-excursion + (goto-char (if updatets1 begts2 begts1)) + (looking-at org-ts-regexp3) + (match-string 0))) (org-time-string-to-time ts))) ;; `save-excursion' won't work because ;; `org-timestamp-change' deletes and re-inserts the diff --git a/lisp/org/org-version.el b/lisp/org/org-version.el index 5f93356709e..a8a13152dc8 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.1-34-geea8da")) + (let ((org-git-version "release_9.6.1-40-g3d817c")) org-git-version)) (provide 'org-version) diff --git a/lisp/org/org.el b/lisp/org/org.el index 9a4f7803cf4..2fbb825015f 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -297,47 +297,49 @@ default, only Emacs Lisp is loaded, since it has no specific requirement." :group 'org-babel :set 'org-babel-do-load-languages - :version "24.1" + :package-version '(Org . "9.6") :type '(alist :tag "Babel Languages" :key-type (choice (const :tag "Awk" awk) - (const :tag "C" C) + (const :tag "C, D, C++, and cpp" C) (const :tag "R" R) (const :tag "Calc" calc) - (const :tag "Clojure" clojure) + (const :tag "Clojure and ClojureScript" clojure) (const :tag "CSS" css) (const :tag "Ditaa" ditaa) (const :tag "Dot" dot) (const :tag "Emacs Lisp" emacs-lisp) + (const :tag "Eshell" eshell) (const :tag "Forth" forth) (const :tag "Fortran" fortran) - (const :tag "Gnuplot" gnuplot) + (const :tag "GnuPlot" gnuplot) + (const :tag "Groovy" groovy) (const :tag "Haskell" haskell) (const :tag "Java" java) - (const :tag "Javascript" js) - (const :tag "LaTeX" latex) - (const :tag "Lilypond" lilypond) + (const :tag "JavaScript" js) + (const :tag "Julia" julia) + (const :tag "LaTeX" latex) + (const :tag "LilyPond" lilypond) (const :tag "Lisp" lisp) + (const :tag "Lua" lua) (const :tag "Makefile" makefile) (const :tag "Maxima" maxima) - (const :tag "Matlab" matlab) - (const :tag "Ocaml" ocaml) - (const :tag "Octave" octave) + (const :tag "OCaml" ocaml) + (const :tag "Octave and MatLab" octave) (const :tag "Org" org) (const :tag "Perl" perl) - (const :tag "Pico Lisp" picolisp) + (const :tag "Processing" processing) (const :tag "PlantUML" plantuml) (const :tag "Python" python) (const :tag "Ruby" ruby) (const :tag "Sass" sass) - (const :tag "Scala" scala) (const :tag "Scheme" scheme) (const :tag "Screen" screen) + (const :tag "Sed" sed) (const :tag "Shell Script" shell) (const :tag "Sql" sql) - (const :tag "Sqlite" sqlite) - (const :tag "Stan" stan)) + (const :tag "Sqlite" sqlite)) :value-type (boolean :tag "Activate" :value t))) ;;;; Customization variables @@ -4559,21 +4561,25 @@ is available. This option applies only if FILE is a URL." (cache) (is-url (if (org--should-fetch-remote-resource-p file) - (with-current-buffer (url-retrieve-synchronously file) - (goto-char (point-min)) - ;; Move point to after the url-retrieve header. - (search-forward "\n\n" nil :move) - ;; Search for the success code only in the url-retrieve header. - (if (save-excursion - (re-search-backward "HTTP.*\\s-+200\\s-OK" nil :noerror)) - ;; Update the cache `org--file-cache' and return contents. - (puthash file - (buffer-substring-no-properties (point) (point-max)) - org--file-cache) - (funcall (if noerror #'message #'user-error) - "Unable to fetch file from %S" - file) - nil)) + (condition-case error + (with-current-buffer (url-retrieve-synchronously file) + (goto-char (point-min)) + ;; Move point to after the url-retrieve header. + (search-forward "\n\n" nil :move) + ;; Search for the success code only in the url-retrieve header. + (if (save-excursion + (re-search-backward "HTTP.*\\s-+200\\s-OK" nil :noerror)) + ;; Update the cache `org--file-cache' and return contents. + (puthash file + (buffer-substring-no-properties (point) (point-max)) + org--file-cache) + (funcall (if noerror #'message #'user-error) + "Unable to fetch file from %S" + file) + nil)) + (error (if noerror + (message "Org could't download \"%s\": %s %S" file (car error) (cdr error)) + (signal (car error) (cdr error))))) (funcall (if noerror #'message #'user-error) "The remote resource %S is considered unsafe, and will not be downloaded." file))) -- cgit v1.2.1 From 75cdc1afbe5a649eed02cd186a38d40b3d0a4439 Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Sun, 5 Mar 2023 14:42:28 -0800 Subject: ; Change font-lock-variable-name-face to font-lock-variable-use-face * lisp/progmodes/sh-script.el: (sh-mode--treesit-settings): Change font-lock-variable-name-face to font-lock-variable-use-face. --- lisp/progmodes/sh-script.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 29820049636..5493e68d5bd 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -3294,7 +3294,7 @@ See `sh-mode--treesit-other-keywords' and :language 'bash :override t '((command_substitution) @sh-quoted-exec - (string (expansion (variable_name) @font-lock-variable-name-face))) + (string (expansion (variable_name) @font-lock-variable-use-face))) :feature 'heredoc :language 'bash -- cgit v1.2.1 From 7292b24c80143d697870a670963f136db375580b Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Sun, 5 Mar 2023 15:01:54 -0800 Subject: Fix c-ts-mode indentation Not the subject of it, but mentioned in bug#61893. * lisp/progmodes/c-ts-mode.el (c-ts-mode--anchor-prev-sibling): Skip the sibling if it doesn't start on it's own line. * test/lisp/progmodes/c-ts-mode-resources/indent.erts: New test. --- lisp/progmodes/c-ts-mode.el | 30 ++++++++++++++-------- .../lisp/progmodes/c-ts-mode-resources/indent.erts | 16 ++++++++++++ 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index f40bbc57eb5..ee4a3bb2de0 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -284,17 +284,25 @@ PARENT and BOL are like other anchor functions." (treesit-node-first-child-for-pos parent bol) t) (treesit-node-child parent -1 t))) (continue t)) - (while (and prev-sibling continue) - (pcase (treesit-node-type prev-sibling) - ;; Get the statement in the label. - ("labeled_statement" - (setq prev-sibling (treesit-node-child prev-sibling 2))) - ;; Get the last statement in the preproc. Tested by - ;; "Prev-Sibling When Prev-Sibling is Preproc" test. - ((or "preproc_if" "preproc_ifdef" "preproc_elif" "preproc_else") - (setq prev-sibling (treesit-node-child prev-sibling -2))) - ;; Don't do anything special. - (_ (setq continue nil)))) + (save-excursion + (while (and prev-sibling continue) + (pcase (treesit-node-type prev-sibling) + ;; Get the statement in the label. + ("labeled_statement" + (setq prev-sibling (treesit-node-child prev-sibling 2))) + ;; Get the last statement in the preproc. Tested by + ;; "Prev-Sibling When Prev-Sibling is Preproc" test. + ((or "preproc_if" "preproc_ifdef" "preproc_elif" "preproc_else") + (setq prev-sibling (treesit-node-child prev-sibling -2))) + ;; If the start of the previous sibling isn't at the + ;; beginning of a line, something's probably not quite + ;; right, go a step further. + (_ (goto-char (treesit-node-start prev-sibling)) + (if (looking-back (rx bol (* whitespace)) + (line-beginning-position)) + (setq continue nil) + (setq prev-sibling + (treesit-node-prev-sibling prev-sibling))))))) ;; This could be nil if a) there is no prev-sibling or b) ;; prev-sibling doesn't have a child. (treesit-node-start prev-sibling))) diff --git a/test/lisp/progmodes/c-ts-mode-resources/indent.erts b/test/lisp/progmodes/c-ts-mode-resources/indent.erts index 904c6498cb5..77bfeb5ad6e 100644 --- a/test/lisp/progmodes/c-ts-mode-resources/indent.erts +++ b/test/lisp/progmodes/c-ts-mode-resources/indent.erts @@ -402,3 +402,19 @@ int main() | } =-=-= + +Name: Prev-Sibling But Not Trailing Comment + +=-= +static int +required_matrix_height (struct window *w) +{ +#ifdef HAVE_WINDOW_SYSTEM + if (FRAME_WINDOW_P (f)) + { + return 0; + } +#endif /* Don't align to this comment. */ + | +} +=-=-= -- cgit v1.2.1 From d724d7d6785db7224b5a9f04b092d8671bddd290 Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Sun, 5 Mar 2023 15:07:58 -0800 Subject: Fix c-ts-mode indentation Mentioned in bug#61893, although not the subject of it. * lisp/progmodes/c-ts-mode.el: (c-ts-mode--anchor-prev-sibling): Fix the child index for preproc_else and preproc_elif case. * test/lisp/progmodes/c-ts-mode-resources/indent-preproc.erts: New test. --- lisp/progmodes/c-ts-mode.el | 4 +++- .../progmodes/c-ts-mode-resources/indent-preproc.erts | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index ee4a3bb2de0..2c534aa785a 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -292,8 +292,10 @@ PARENT and BOL are like other anchor functions." (setq prev-sibling (treesit-node-child prev-sibling 2))) ;; Get the last statement in the preproc. Tested by ;; "Prev-Sibling When Prev-Sibling is Preproc" test. - ((or "preproc_if" "preproc_ifdef" "preproc_elif" "preproc_else") + ((or "preproc_if" "preproc_ifdef") (setq prev-sibling (treesit-node-child prev-sibling -2))) + ((or "preproc_elif" "preproc_else") + (setq prev-sibling (treesit-node-child prev-sibling -1))) ;; If the start of the previous sibling isn't at the ;; beginning of a line, something's probably not quite ;; right, go a step further. diff --git a/test/lisp/progmodes/c-ts-mode-resources/indent-preproc.erts b/test/lisp/progmodes/c-ts-mode-resources/indent-preproc.erts index 0f9256ad984..a82596e0010 100644 --- a/test/lisp/progmodes/c-ts-mode-resources/indent-preproc.erts +++ b/test/lisp/progmodes/c-ts-mode-resources/indent-preproc.erts @@ -78,3 +78,19 @@ free_glyph_pool (struct glyph_pool *pool) } } =-=-= + +Name: Prev-Sibling Plus Preproc + +=-=-= +int main() { +#ifdef MSDOS + f->output_data.tty = &the_only_tty_output; + f->output_data.tty->display_info = &the_only_display_info; +#else + if (f->output_method == output_termcap) + create_tty_output (f); +#endif + t->display_info.tty->top_frame = selected_frame; + change_frame_size (); +} +=-=-= -- cgit v1.2.1 From 1c67e4f895faf895f3ff132261edcbe6d08bb91d Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Sun, 5 Mar 2023 15:22:36 -0800 Subject: Fix c-ts-mode indentation Mentioned in bug#61893. * lisp/progmodes/c-ts-mode.el (c-ts-mode--anchor-prev-sibling): Handle "#elif" and "#else". * test/lisp/progmodes/c-ts-mode-resources/indent-preproc.erts: Add an "#elif" to the test. --- lisp/progmodes/c-ts-mode.el | 3 +++ test/lisp/progmodes/c-ts-mode-resources/indent-preproc.erts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 2c534aa785a..0b775b2d5c8 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -296,6 +296,9 @@ PARENT and BOL are like other anchor functions." (setq prev-sibling (treesit-node-child prev-sibling -2))) ((or "preproc_elif" "preproc_else") (setq prev-sibling (treesit-node-child prev-sibling -1))) + ((or "#elif" "#else") + (setq prev-sibling (treesit-node-prev-sibling + (treesit-node-parent prev-sibling) t))) ;; If the start of the previous sibling isn't at the ;; beginning of a line, something's probably not quite ;; right, go a step further. diff --git a/test/lisp/progmodes/c-ts-mode-resources/indent-preproc.erts b/test/lisp/progmodes/c-ts-mode-resources/indent-preproc.erts index a82596e0010..ce753b5b3ea 100644 --- a/test/lisp/progmodes/c-ts-mode-resources/indent-preproc.erts +++ b/test/lisp/progmodes/c-ts-mode-resources/indent-preproc.erts @@ -89,6 +89,9 @@ int main() { #else if (f->output_method == output_termcap) create_tty_output (f); +#elif defined (HAVE_X_WINDOWS) /* X without toolkit. */ + if (FRAME_WINDOW_P (f)) + {} #endif t->display_info.tty->top_frame = selected_frame; change_frame_size (); -- cgit v1.2.1