diff options
author | Stefan Kangas <stefankangas@gmail.com> | 2023-03-06 06:30:13 +0100 |
---|---|---|
committer | Stefan Kangas <stefankangas@gmail.com> | 2023-03-06 06:30:13 +0100 |
commit | aad617870b45aa2e68159150c2354db6f7a8cf09 (patch) | |
tree | ef02f6390c25e2a167cd4dea91881f4e7f806de6 | |
parent | 6fb8a4dff7ef22f96ebe1a775240617aabac6526 (diff) | |
parent | 1c67e4f895faf895f3ff132261edcbe6d08bb91d (diff) | |
download | emacs-aad617870b45aa2e68159150c2354db6f7a8cf09.tar.gz |
Merge from origin/emacs-29
1c67e4f895f Fix c-ts-mode indentation
d724d7d6785 Fix c-ts-mode indentation
7292b24c801 Fix c-ts-mode indentation
75cdc1afbe5 ; Change font-lock-variable-name-face to font-lock-variab...
b1b3af5b90b Update to Org 9.6.1-40-g3d817c
80e1037df44 Add string-interpolation feature to bash-ts-mode
5b8e0b31548 Fix tramp-sh-handle-insert-directory
2258ed01f42 ; Minor fix of last change
9c18af0cfaf * Warn when certain primitives are redefined (bug#61880)
5af695c7479 ; * lib-src/etags.c (print_help): Fix indentation.
-rw-r--r-- | doc/misc/org.org | 3 | ||||
-rw-r--r-- | etc/refcards/orgcard.tex | 4 | ||||
-rw-r--r-- | lib-src/etags.c | 4 | ||||
-rw-r--r-- | lisp/emacs-lisp/comp.el | 11 | ||||
-rw-r--r-- | lisp/net/tramp-sh.el | 4 | ||||
-rw-r--r-- | lisp/org/org-clock.el | 10 | ||||
-rw-r--r-- | lisp/org/org-version.el | 2 | ||||
-rw-r--r-- | lisp/org/org.el | 64 | ||||
-rw-r--r-- | lisp/progmodes/c-ts-mode.el | 35 | ||||
-rw-r--r-- | lisp/progmodes/sh-script.el | 9 | ||||
-rw-r--r-- | test/lisp/progmodes/c-ts-mode-resources/indent-preproc.erts | 19 | ||||
-rw-r--r-- | test/lisp/progmodes/c-ts-mode-resources/indent.erts | 16 |
12 files changed, 129 insertions, 52 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/lib-src/etags.c b/lib-src/etags.c index cb842dbf669..2c6b4e7a630 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\ diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index fc726aaef0c..189a010ffc7 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 break native compilation of trampolines." + 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)) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index ce443b558a3..49da0e425ff 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -2626,8 +2626,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. 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))) diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 132c44d330a..c37041d20ac 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -284,17 +284,30 @@ 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") + (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. + (_ (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/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 398a2c8946b..a5428a9a714 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1621,7 +1621,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) @@ -3300,6 +3301,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-use-face))) + :feature 'heredoc :language 'bash '([(heredoc_start) (heredoc_body)] @sh-heredoc) 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..ce753b5b3ea 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,22 @@ 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); +#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 (); +} +=-=-= 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. */ + | +} +=-=-= |