diff options
| author | Po Lu | 2023-03-02 20:00:06 +0800 |
|---|---|---|
| committer | Po Lu | 2023-03-02 20:00:06 +0800 |
| commit | a6a586ffc1bd302e30d80cb88b06e1e7e1573f63 (patch) | |
| tree | 33877aa5d5c405e3943c075acdef9bd94d8d9faf | |
| parent | 42674a71446e2ce1ba1f3226c978c7546334d4ea (diff) | |
| parent | 8d5d7509b0a2c248084fa349b0b188d4de4af804 (diff) | |
| download | emacs-a6a586ffc1bd302e30d80cb88b06e1e7e1573f63.tar.gz emacs-a6a586ffc1bd302e30d80cb88b06e1e7e1573f63.zip | |
Merge remote-tracking branch 'origin/master' into feature/android
| -rw-r--r-- | doc/emacs/programs.texi | 6 | ||||
| -rw-r--r-- | etc/NEWS | 7 | ||||
| -rw-r--r-- | lisp/emacs-lisp/debug-early.el | 8 | ||||
| -rw-r--r-- | lisp/emacs-lisp/eldoc.el | 1 | ||||
| -rw-r--r-- | lisp/man.el | 11 | ||||
| -rw-r--r-- | lisp/progmodes/c-ts-mode.el | 20 | ||||
| -rw-r--r-- | lisp/progmodes/eglot.el | 26 | ||||
| -rw-r--r-- | lisp/progmodes/go-ts-mode.el | 2 | ||||
| -rw-r--r-- | lisp/progmodes/sh-script.el | 25 | ||||
| -rw-r--r-- | lisp/treesit.el | 32 | ||||
| -rw-r--r-- | src/alloc.c | 5 | ||||
| -rw-r--r-- | src/bytecode.c | 4 | ||||
| -rw-r--r-- | src/haikufont.c | 2 | ||||
| -rw-r--r-- | src/profiler.c | 3 | ||||
| -rw-r--r-- | src/xdisp.c | 2 | ||||
| -rw-r--r-- | test/lisp/progmodes/c-ts-mode-resources/indent.erts | 33 | ||||
| -rw-r--r-- | test/lisp/progmodes/sh-script-tests.el | 18 | ||||
| -rwxr-xr-x | test/manual/indent/shell.sh | 1 |
18 files changed, 159 insertions, 47 deletions
diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi index d97bd56be21..62df88a731e 100644 --- a/doc/emacs/programs.texi +++ b/doc/emacs/programs.texi | |||
| @@ -1387,6 +1387,12 @@ this, change the value of the variable @code{Man-switches} to | |||
| 1387 | @kbd{M-p} to switch between man pages in different sections. The mode | 1387 | @kbd{M-p} to switch between man pages in different sections. The mode |
| 1388 | line shows how many manual pages are available. | 1388 | line shows how many manual pages are available. |
| 1389 | 1389 | ||
| 1390 | @vindex Man-prefer-synchronous-call | ||
| 1391 | By default, @kbd{M-x man} calls the @code{man} program | ||
| 1392 | asynchronously. You can force the invocation to be synchronous by | ||
| 1393 | customizing @code{Man-prefer-synchronous-calls} to a non-@code{nil} | ||
| 1394 | value. | ||
| 1395 | |||
| 1390 | @findex woman | 1396 | @findex woman |
| 1391 | @cindex manual pages, on MS-DOS/MS-Windows | 1397 | @cindex manual pages, on MS-DOS/MS-Windows |
| 1392 | An alternative way of reading manual pages is the @kbd{M-x woman} | 1398 | An alternative way of reading manual pages is the @kbd{M-x woman} |
| @@ -213,6 +213,13 @@ This command adds a docstring comment to the current defun. If a | |||
| 213 | comment already exists, point is only moved to the comment. It is | 213 | comment already exists, point is only moved to the comment. It is |
| 214 | bound to 'C-c C-d' in 'go-ts-mode'. | 214 | bound to 'C-c C-d' in 'go-ts-mode'. |
| 215 | 215 | ||
| 216 | ** Man-mode | ||
| 217 | |||
| 218 | +++ | ||
| 219 | *** New user option 'Man-prefer-synchronous-call'. | ||
| 220 | When this is non-nil, call the 'man' program synchronously rather than | ||
| 221 | asynchronously (which is the default behavior). | ||
| 222 | |||
| 216 | 223 | ||
| 217 | * New Modes and Packages in Emacs 30.1 | 224 | * New Modes and Packages in Emacs 30.1 |
| 218 | 225 | ||
diff --git a/lisp/emacs-lisp/debug-early.el b/lisp/emacs-lisp/debug-early.el index 395498f2206..e393daee879 100644 --- a/lisp/emacs-lisp/debug-early.el +++ b/lisp/emacs-lisp/debug-early.el | |||
| @@ -46,10 +46,10 @@ of the build process." | |||
| 46 | (print-escape-control-characters t) | 46 | (print-escape-control-characters t) |
| 47 | (print-escape-nonascii t) | 47 | (print-escape-nonascii t) |
| 48 | (prin1 (if (and (fboundp 'cl-prin1) | 48 | (prin1 (if (and (fboundp 'cl-prin1) |
| 49 | ;; If we're being called while | 49 | (fboundp 'cl-defmethod) ;Used by `cl-print'. |
| 50 | ;; bootstrapping, we won't be able to load | 50 | (condition-case nil |
| 51 | ;; cl-print. | 51 | (require 'cl-print) |
| 52 | (require 'cl-print nil t)) | 52 | (error nil))) |
| 53 | #'cl-prin1 | 53 | #'cl-prin1 |
| 54 | #'prin1))) | 54 | #'prin1))) |
| 55 | (mapbacktrace | 55 | (mapbacktrace |
diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el index 83948ad00d4..a175edcc671 100644 --- a/lisp/emacs-lisp/eldoc.el +++ b/lisp/emacs-lisp/eldoc.el | |||
| @@ -388,6 +388,7 @@ Also store it in `eldoc-last-message' and return that value." | |||
| 388 | (defun eldoc-display-message-no-interference-p () | 388 | (defun eldoc-display-message-no-interference-p () |
| 389 | "Return nil if displaying a message would cause interference." | 389 | "Return nil if displaying a message would cause interference." |
| 390 | (not (or executing-kbd-macro | 390 | (not (or executing-kbd-macro |
| 391 | (bound-and-true-p edebug-active) | ||
| 391 | ;; The following configuration shows "Matches..." in the | 392 | ;; The following configuration shows "Matches..." in the |
| 392 | ;; echo area when point is after a closing bracket, which | 393 | ;; echo area when point is after a closing bracket, which |
| 393 | ;; conflicts with eldoc. | 394 | ;; conflicts with eldoc. |
diff --git a/lisp/man.el b/lisp/man.el index 9f75c07c791..3ab9aa5b4dd 100644 --- a/lisp/man.el +++ b/lisp/man.el | |||
| @@ -97,6 +97,14 @@ | |||
| 97 | :group 'external | 97 | :group 'external |
| 98 | :group 'help) | 98 | :group 'help) |
| 99 | 99 | ||
| 100 | (defcustom Man-prefer-synchronous-call nil | ||
| 101 | "Whether to call the Un*x \"man\" program synchronously. | ||
| 102 | When this is non-nil, call the \"man\" program synchronously | ||
| 103 | (rather than asynchronously, which is the default behavior)." | ||
| 104 | :type 'boolean | ||
| 105 | :group 'man | ||
| 106 | :version 30.1) | ||
| 107 | |||
| 100 | (defcustom Man-filter-list nil | 108 | (defcustom Man-filter-list nil |
| 101 | "Manpage cleaning filter command phrases. | 109 | "Manpage cleaning filter command phrases. |
| 102 | This variable contains a list of the following form: | 110 | This variable contains a list of the following form: |
| @@ -1118,7 +1126,8 @@ Return the buffer in which the manpage will appear." | |||
| 1118 | "[cleaning...]") | 1126 | "[cleaning...]") |
| 1119 | 'face 'mode-line-emphasis))) | 1127 | 'face 'mode-line-emphasis))) |
| 1120 | (Man-start-calling | 1128 | (Man-start-calling |
| 1121 | (if (fboundp 'make-process) | 1129 | (if (and (fboundp 'make-process) |
| 1130 | (not Man-prefer-synchronous-call)) | ||
| 1122 | (let ((proc (start-process | 1131 | (let ((proc (start-process |
| 1123 | manual-program buffer | 1132 | manual-program buffer |
| 1124 | (if (memq system-type '(cygwin windows-nt)) | 1133 | (if (memq system-type '(cygwin windows-nt)) |
diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index abe929bd777..70415f69fbe 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el | |||
| @@ -257,7 +257,7 @@ is actually the parent of point at the moment of indentation." | |||
| 257 | 0 | 257 | 0 |
| 258 | c-ts-mode-indent-offset))) | 258 | c-ts-mode-indent-offset))) |
| 259 | 259 | ||
| 260 | (defun c-ts-mode--anchor-prev-sibling (node &rest _) | 260 | (defun c-ts-mode--anchor-prev-sibling (node parent bol &rest _) |
| 261 | "Return the start of the previous named sibling of NODE. | 261 | "Return the start of the previous named sibling of NODE. |
| 262 | 262 | ||
| 263 | This anchor handles the special case where the previous sibling | 263 | This anchor handles the special case where the previous sibling |
| @@ -273,8 +273,14 @@ The anchor of \"int y = 2;\" should be \"int x = 1;\" rather than | |||
| 273 | the labeled_statement. | 273 | the labeled_statement. |
| 274 | 274 | ||
| 275 | Return nil if a) there is no prev-sibling, or 2) prev-sibling | 275 | Return nil if a) there is no prev-sibling, or 2) prev-sibling |
| 276 | doesn't have a child." | 276 | doesn't have a child. |
| 277 | (when-let ((prev-sibling (treesit-node-prev-sibling node t))) | 277 | |
| 278 | PARENT and BOL are like other anchor functions." | ||
| 279 | (when-let ((prev-sibling | ||
| 280 | (or (treesit-node-prev-sibling node t) | ||
| 281 | (treesit-node-prev-sibling | ||
| 282 | (treesit-node-first-child-for-pos parent bol) t) | ||
| 283 | (treesit-node-child parent -1 t)))) | ||
| 278 | (while (and prev-sibling | 284 | (while (and prev-sibling |
| 279 | (equal "labeled_statement" | 285 | (equal "labeled_statement" |
| 280 | (treesit-node-type prev-sibling))) | 286 | (treesit-node-type prev-sibling))) |
| @@ -350,17 +356,17 @@ MODE is either `c' or `cpp'." | |||
| 350 | 356 | ||
| 351 | ;; int[5] a = { 0, 0, 0, 0 }; | 357 | ;; int[5] a = { 0, 0, 0, 0 }; |
| 352 | ((match nil "initializer_list" nil 1 1) parent-bol c-ts-mode-indent-offset) | 358 | ((match nil "initializer_list" nil 1 1) parent-bol c-ts-mode-indent-offset) |
| 353 | ((match nil "initializer_list" nil 2) c-ts-mode--anchor-prev-sibling 0) | 359 | ((parent-is "initializer_list") c-ts-mode--anchor-prev-sibling 0) |
| 354 | ;; Statement in enum. | 360 | ;; Statement in enum. |
| 355 | ((match nil "enumerator_list" nil 1 1) standalone-parent c-ts-mode-indent-offset) | 361 | ((match nil "enumerator_list" nil 1 1) standalone-parent c-ts-mode-indent-offset) |
| 356 | ((match nil "enumerator_list" nil 2) c-ts-mode--anchor-prev-sibling 0) | 362 | ((parent-is "enumerator_list") c-ts-mode--anchor-prev-sibling 0) |
| 357 | ;; Statement in struct and union. | 363 | ;; Statement in struct and union. |
| 358 | ((match nil "field_declaration_list" nil 1 1) standalone-parent c-ts-mode-indent-offset) | 364 | ((match nil "field_declaration_list" nil 1 1) standalone-parent c-ts-mode-indent-offset) |
| 359 | ((match nil "field_declaration_list" nil 2) c-ts-mode--anchor-prev-sibling 0) | 365 | ((parent-is "field_declaration_list") c-ts-mode--anchor-prev-sibling 0) |
| 360 | 366 | ||
| 361 | ;; Statement in {} blocks. | 367 | ;; Statement in {} blocks. |
| 362 | ((match nil "compound_statement" nil 1 1) standalone-parent c-ts-mode-indent-offset) | 368 | ((match nil "compound_statement" nil 1 1) standalone-parent c-ts-mode-indent-offset) |
| 363 | ((match nil "compound_statement" nil 2) c-ts-mode--anchor-prev-sibling 0) | 369 | ((parent-is "compound_statement") c-ts-mode--anchor-prev-sibling 0) |
| 364 | ;; Opening bracket. | 370 | ;; Opening bracket. |
| 365 | ((node-is "compound_statement") standalone-parent c-ts-mode-indent-offset) | 371 | ((node-is "compound_statement") standalone-parent c-ts-mode-indent-offset) |
| 366 | ;; Bug#61291. | 372 | ;; Bug#61291. |
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index bee86a38bb0..cd7b6a10868 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el | |||
| @@ -130,7 +130,8 @@ | |||
| 130 | (defvar markdown-fontify-code-blocks-natively) | 130 | (defvar markdown-fontify-code-blocks-natively) |
| 131 | (defvar company-backends) | 131 | (defvar company-backends) |
| 132 | (defvar company-tooltip-align-annotations) | 132 | (defvar company-tooltip-align-annotations) |
| 133 | 133 | (defvar tramp-ssh-controlmaster-options) | |
| 134 | (defvar tramp-use-ssh-controlmaster-options) | ||
| 134 | 135 | ||
| 135 | 136 | ||
| 136 | ;;; User tweakable stuff | 137 | ;;; User tweakable stuff |
| @@ -1249,7 +1250,15 @@ This docstring appeases checkdoc, that's all." | |||
| 1249 | (contact (cl-subseq contact 0 probe))) | 1250 | (contact (cl-subseq contact 0 probe))) |
| 1250 | `(:process | 1251 | `(:process |
| 1251 | ,(lambda () | 1252 | ,(lambda () |
| 1252 | (let ((default-directory default-directory)) | 1253 | (let ((default-directory default-directory) |
| 1254 | ;; bug#61350: Tramp turns on a feature | ||
| 1255 | ;; by default that can't (yet) handle | ||
| 1256 | ;; very much data so we turn it off | ||
| 1257 | ;; unconditionally -- just for our | ||
| 1258 | ;; process. | ||
| 1259 | (tramp-use-ssh-controlmaster-options t) | ||
| 1260 | (tramp-ssh-controlmaster-options | ||
| 1261 | "-o ControlMaster=no -o ControlPath=none")) | ||
| 1253 | (make-process | 1262 | (make-process |
| 1254 | :name readable-name | 1263 | :name readable-name |
| 1255 | :command (setq server-info (eglot--cmd contact)) | 1264 | :command (setq server-info (eglot--cmd contact)) |
| @@ -3653,6 +3662,15 @@ If NOERROR, return predicate, else erroring function." | |||
| 3653 | (add-to-list 'desktop-minor-mode-handlers '(eglot--managed-mode . ignore))) | 3662 | (add-to-list 'desktop-minor-mode-handlers '(eglot--managed-mode . ignore))) |
| 3654 | 3663 | ||
| 3655 | 3664 | ||
| 3665 | ;;; Misc | ||
| 3666 | ;;; | ||
| 3667 | (defun eglot--debbugs-or-github-bug-uri () | ||
| 3668 | (format (if (string= (match-string 2) "github") | ||
| 3669 | "https://github.com/joaotavora/eglot/issues/%s" | ||
| 3670 | "https://debbugs.gnu.org/%s") | ||
| 3671 | (match-string 3))) | ||
| 3672 | (put 'eglot--debbugs-or-github-bug-uri 'bug-reference-url-format t) | ||
| 3673 | |||
| 3656 | ;;; Obsolete | 3674 | ;;; Obsolete |
| 3657 | ;;; | 3675 | ;;; |
| 3658 | 3676 | ||
| @@ -3662,8 +3680,8 @@ If NOERROR, return predicate, else erroring function." | |||
| 3662 | 3680 | ||
| 3663 | 3681 | ||
| 3664 | ;; Local Variables: | 3682 | ;; Local Variables: |
| 3665 | ;; bug-reference-bug-regexp: "\\(github#\\([0-9]+\\)\\)" | 3683 | ;; bug-reference-bug-regexp: "\\(\\(github\\|bug\\)#\\([0-9]+\\)\\)" |
| 3666 | ;; bug-reference-url-format: "https://github.com/joaotavora/eglot/issues/%s" | 3684 | ;; bug-reference-url-format: eglot--debbugs-or-github-bug-uri |
| 3667 | ;; checkdoc-force-docstrings-flag: nil | 3685 | ;; checkdoc-force-docstrings-flag: nil |
| 3668 | ;; End: | 3686 | ;; End: |
| 3669 | 3687 | ||
diff --git a/lisp/progmodes/go-ts-mode.el b/lisp/progmodes/go-ts-mode.el index ce77cc3973d..9a02c15aa00 100644 --- a/lisp/progmodes/go-ts-mode.el +++ b/lisp/progmodes/go-ts-mode.el | |||
| @@ -427,7 +427,7 @@ what the parent of the node would be if it were a node." | |||
| 427 | 427 | ||
| 428 | (treesit-major-mode-setup))) | 428 | (treesit-major-mode-setup))) |
| 429 | 429 | ||
| 430 | (if (treesit-ready-p 'gomod) | 430 | (if (treesit-language-available-p 'gomod) |
| 431 | (add-to-list 'auto-mode-alist '("/go\\.mod\\'" . go-mod-ts-mode))) | 431 | (add-to-list 'auto-mode-alist '("/go\\.mod\\'" . go-mod-ts-mode))) |
| 432 | 432 | ||
| 433 | (provide 'go-ts-mode) | 433 | (provide 'go-ts-mode) |
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 17c22ff4751..398a2c8946b 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el | |||
| @@ -1042,7 +1042,9 @@ subshells can nest." | |||
| 1042 | ;; Maybe we've bumped into an escaped newline. | 1042 | ;; Maybe we've bumped into an escaped newline. |
| 1043 | (sh-is-quoted-p (point))) | 1043 | (sh-is-quoted-p (point))) |
| 1044 | (backward-char 1)) | 1044 | (backward-char 1)) |
| 1045 | (when (eq (char-before) ?|) | 1045 | (when (and |
| 1046 | (eq (char-before) ?|) | ||
| 1047 | (not (eq (char-before (1- (point))) ?\;))) | ||
| 1046 | (backward-char 1) t))) | 1048 | (backward-char 1) t))) |
| 1047 | (and (> (point) (1+ (point-min))) | 1049 | (and (> (point) (1+ (point-min))) |
| 1048 | (progn (backward-char 2) | 1050 | (progn (backward-char 2) |
| @@ -1053,7 +1055,7 @@ subshells can nest." | |||
| 1053 | ;; a normal command rather than the real `in' keyword. | 1055 | ;; a normal command rather than the real `in' keyword. |
| 1054 | ;; I.e. we should look back to try and find the | 1056 | ;; I.e. we should look back to try and find the |
| 1055 | ;; corresponding `case'. | 1057 | ;; corresponding `case'. |
| 1056 | (and (looking-at ";[;&]\\|\\_<in") | 1058 | (and (looking-at ";\\(?:;&?\\|[&|]\\)\\|\\_<in") |
| 1057 | ;; ";; esac )" is a case that looks | 1059 | ;; ";; esac )" is a case that looks |
| 1058 | ;; like a case-pattern but it's really just a close | 1060 | ;; like a case-pattern but it's really just a close |
| 1059 | ;; paren after a case statement. I.e. if we skipped | 1061 | ;; paren after a case statement. I.e. if we skipped |
| @@ -1784,8 +1786,9 @@ before the newline and in that case point should be just before the token." | |||
| 1784 | (pattern (rpattern) ("case-(" rpattern)) | 1786 | (pattern (rpattern) ("case-(" rpattern)) |
| 1785 | (branches (branches ";;" branches) | 1787 | (branches (branches ";;" branches) |
| 1786 | (branches ";&" branches) (branches ";;&" branches) ;bash. | 1788 | (branches ";&" branches) (branches ";;&" branches) ;bash. |
| 1789 | (branches ";|" branches) ;zsh. | ||
| 1787 | (pattern "case-)" cmd))) | 1790 | (pattern "case-)" cmd))) |
| 1788 | '((assoc ";;" ";&" ";;&")) | 1791 | '((assoc ";;" ";&" ";;&" ";|")) |
| 1789 | '((assoc ";" "&") (assoc "&&" "||") (assoc "|" "|&"))))) | 1792 | '((assoc ";" "&") (assoc "&&" "||") (assoc "|" "|&"))))) |
| 1790 | 1793 | ||
| 1791 | (defconst sh-smie--sh-operators | 1794 | (defconst sh-smie--sh-operators |
| @@ -2010,7 +2013,7 @@ May return nil if the line should not be treated as continued." | |||
| 2010 | (forward-line -1) | 2013 | (forward-line -1) |
| 2011 | (if (sh-smie--looking-back-at-continuation-p) | 2014 | (if (sh-smie--looking-back-at-continuation-p) |
| 2012 | (current-indentation) | 2015 | (current-indentation) |
| 2013 | (+ (current-indentation) sh-basic-offset)))) | 2016 | (+ (current-indentation) (sh-var-value 'sh-indent-for-continuation))))) |
| 2014 | (t | 2017 | (t |
| 2015 | ;; Just make sure a line-continuation is indented deeper. | 2018 | ;; Just make sure a line-continuation is indented deeper. |
| 2016 | (save-excursion | 2019 | (save-excursion |
| @@ -2031,7 +2034,10 @@ May return nil if the line should not be treated as continued." | |||
| 2031 | ;; check the line before that one. | 2034 | ;; check the line before that one. |
| 2032 | (> ci indent)) | 2035 | (> ci indent)) |
| 2033 | (t ;Previous line is the beginning of the continued line. | 2036 | (t ;Previous line is the beginning of the continued line. |
| 2034 | (setq indent (min (+ ci sh-basic-offset) max)) | 2037 | (setq |
| 2038 | indent | ||
| 2039 | (min | ||
| 2040 | (+ ci (sh-var-value 'sh-indent-for-continuation)) max)) | ||
| 2035 | nil))))) | 2041 | nil))))) |
| 2036 | indent)))))) | 2042 | indent)))))) |
| 2037 | 2043 | ||
| @@ -2055,11 +2061,11 @@ May return nil if the line should not be treated as continued." | |||
| 2055 | `(column . ,(smie-indent-virtual)))))) | 2061 | `(column . ,(smie-indent-virtual)))))) |
| 2056 | ;; FIXME: Maybe this handling of ;; should be made into | 2062 | ;; FIXME: Maybe this handling of ;; should be made into |
| 2057 | ;; a smie-rule-terminator function that takes the substitute ";" as arg. | 2063 | ;; a smie-rule-terminator function that takes the substitute ";" as arg. |
| 2058 | (`(:before . ,(or ";;" ";&" ";;&")) | 2064 | (`(:before . ,(or ";;" ";&" ";;&" ";|")) |
| 2059 | (if (and (smie-rule-bolp) (looking-at ";;?&?[ \t]*\\(#\\|$\\)")) | 2065 | (if (and (smie-rule-bolp) (looking-at ";\\(?:;&?\\|[&|]\\)?[ \t]*\\(#\\|$\\)")) |
| 2060 | (cons 'column (smie-indent-keyword ";")) | 2066 | (cons 'column (smie-indent-keyword ";")) |
| 2061 | (smie-rule-separator kind))) | 2067 | (smie-rule-separator kind))) |
| 2062 | (`(:after . ,(or ";;" ";&" ";;&")) | 2068 | (`(:after . ,(or ";;" ";&" ";;&" ";|")) |
| 2063 | (with-demoted-errors "SMIE rule error: %S" | 2069 | (with-demoted-errors "SMIE rule error: %S" |
| 2064 | (smie-backward-sexp token) | 2070 | (smie-backward-sexp token) |
| 2065 | (cons 'column | 2071 | (cons 'column |
| @@ -2148,8 +2154,9 @@ May return nil if the line should not be treated as continued." | |||
| 2148 | (pattern (pattern "|" pattern)) | 2154 | (pattern (pattern "|" pattern)) |
| 2149 | (branches (branches ";;" branches) | 2155 | (branches (branches ";;" branches) |
| 2150 | (branches ";&" branches) (branches ";;&" branches) ;bash. | 2156 | (branches ";&" branches) (branches ";;&" branches) ;bash. |
| 2157 | (branches ";|" branches) ;zsh. | ||
| 2151 | (pattern "case-)" cmd))) | 2158 | (pattern "case-)" cmd))) |
| 2152 | '((assoc ";;" ";&" ";;&")) | 2159 | '((assoc ";;" ";&" ";;&" ";|")) |
| 2153 | '((assoc "case") (assoc ";" "&") (assoc "&&" "||") (assoc "|" "|&"))))) | 2160 | '((assoc "case") (assoc ";" "&") (assoc "&&" "||") (assoc "|" "|&"))))) |
| 2154 | 2161 | ||
| 2155 | (defun sh-smie--rc-after-special-arg-p () | 2162 | (defun sh-smie--rc-after-special-arg-p () |
diff --git a/lisp/treesit.el b/lisp/treesit.el index 9e639149ce0..e7a8ad6104f 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el | |||
| @@ -1237,9 +1237,17 @@ See `treesit-simple-indent-presets'.") | |||
| 1237 | (line-beginning-position)) | 1237 | (line-beginning-position)) |
| 1238 | (throw 'term (point))) | 1238 | (throw 'term (point))) |
| 1239 | (setq parent (treesit-node-parent parent))))))) | 1239 | (setq parent (treesit-node-parent parent))))))) |
| 1240 | (cons 'prev-sibling (lambda (node &rest _) | 1240 | (cons 'prev-sibling (lambda (node parent bol &rest _) |
| 1241 | (treesit-node-start | 1241 | (treesit-node-start |
| 1242 | (treesit-node-prev-sibling node)))) | 1242 | (or (treesit-node-prev-sibling node t) |
| 1243 | ;; If node is nil (indenting empty | ||
| 1244 | ;; line), we still try to guess the | ||
| 1245 | ;; previous sibling. | ||
| 1246 | (treesit-node-prev-sibling | ||
| 1247 | (treesit-node-first-child-for-pos | ||
| 1248 | parent bol) | ||
| 1249 | t) | ||
| 1250 | (treesit-node-child parent -1 t))))) | ||
| 1243 | (cons 'no-indent (lambda (_n _p bol &rest _) bol)) | 1251 | (cons 'no-indent (lambda (_n _p bol &rest _) bol)) |
| 1244 | (cons 'prev-line (lambda (_n _p bol &rest _) | 1252 | (cons 'prev-line (lambda (_n _p bol &rest _) |
| 1245 | (save-excursion | 1253 | (save-excursion |
| @@ -1532,14 +1540,24 @@ Similar to `treesit-indent', but indent a region instead." | |||
| 1532 | (aref meta-vec (+ 1 (* idx meta-len))) nil) | 1540 | (aref meta-vec (+ 1 (* idx meta-len))) nil) |
| 1533 | (pcase-let* ((`(,anchor . ,offset) (treesit--indent-1)) | 1541 | (pcase-let* ((`(,anchor . ,offset) (treesit--indent-1)) |
| 1534 | (marker (aref meta-vec (* idx meta-len)))) | 1542 | (marker (aref meta-vec (* idx meta-len)))) |
| 1535 | ;; Set ANCHOR. | 1543 | (if (not (and anchor offset)) |
| 1536 | (when anchor | 1544 | ;; No indent for this line, either... |
| 1545 | (if (markerp marker) | ||
| 1546 | (progn | ||
| 1547 | ;; ... Set marker and offset to do a dummy | ||
| 1548 | ;; indent, or... | ||
| 1549 | (back-to-indentation) | ||
| 1550 | (move-marker marker (point)) | ||
| 1551 | (setf (aref meta-vec (+ 1 (* idx meta-len))) 0)) | ||
| 1552 | ;; ...Set anchor to nil so no indent is performed. | ||
| 1553 | (setf (aref meta-vec (* idx meta-len)) nil)) | ||
| 1554 | ;; Set ANCHOR. | ||
| 1537 | (if (markerp marker) | 1555 | (if (markerp marker) |
| 1538 | (move-marker marker anchor) | 1556 | (move-marker marker anchor) |
| 1539 | (setf (aref meta-vec (* idx meta-len)) | 1557 | (setf (aref meta-vec (* idx meta-len)) |
| 1540 | (copy-marker anchor t)))) | 1558 | (copy-marker anchor t))) |
| 1541 | ;; SET OFFSET. | 1559 | ;; SET OFFSET. |
| 1542 | (setf (aref meta-vec (+ 1 (* idx meta-len))) offset))) | 1560 | (setf (aref meta-vec (+ 1 (* idx meta-len))) offset)))) |
| 1543 | (cl-incf idx) | 1561 | (cl-incf idx) |
| 1544 | (setq lines-left-to-move (forward-line 1))) | 1562 | (setq lines-left-to-move (forward-line 1))) |
| 1545 | ;; Now IDX = last valid IDX + 1. | 1563 | ;; Now IDX = last valid IDX + 1. |
diff --git a/src/alloc.c b/src/alloc.c index 6d8658e7bb0..3e7d5c2d15f 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -3742,7 +3742,8 @@ usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INT | |||
| 3742 | && FIXNATP (args[COMPILED_STACK_DEPTH]))) | 3742 | && FIXNATP (args[COMPILED_STACK_DEPTH]))) |
| 3743 | error ("Invalid byte-code object"); | 3743 | error ("Invalid byte-code object"); |
| 3744 | 3744 | ||
| 3745 | pin_string (args[COMPILED_BYTECODE]); // Bytecode must be immovable. | 3745 | /* Bytecode must be immovable. */ |
| 3746 | pin_string (args[COMPILED_BYTECODE]); | ||
| 3746 | 3747 | ||
| 3747 | /* We used to purecopy everything here, if purify-flag was set. This worked | 3748 | /* We used to purecopy everything here, if purify-flag was set. This worked |
| 3748 | OK for Emacs-23, but with Emacs-24's lexical binding code, it can be | 3749 | OK for Emacs-23, but with Emacs-24's lexical binding code, it can be |
| @@ -5959,7 +5960,7 @@ purecopy (Lisp_Object obj) | |||
| 5959 | memcpy (vec, objp, nbytes); | 5960 | memcpy (vec, objp, nbytes); |
| 5960 | for (i = 0; i < size; i++) | 5961 | for (i = 0; i < size; i++) |
| 5961 | vec->contents[i] = purecopy (vec->contents[i]); | 5962 | vec->contents[i] = purecopy (vec->contents[i]); |
| 5962 | // Byte code strings must be pinned. | 5963 | /* Byte code strings must be pinned. */ |
| 5963 | if (COMPILEDP (obj) && size >= 2 && STRINGP (vec->contents[1]) | 5964 | if (COMPILEDP (obj) && size >= 2 && STRINGP (vec->contents[1]) |
| 5964 | && !STRING_MULTIBYTE (vec->contents[1])) | 5965 | && !STRING_MULTIBYTE (vec->contents[1])) |
| 5965 | pin_string (vec->contents[1]); | 5966 | pin_string (vec->contents[1]); |
diff --git a/src/bytecode.c b/src/bytecode.c index 124348e5b35..74a94859aba 100644 --- a/src/bytecode.c +++ b/src/bytecode.c | |||
| @@ -789,10 +789,10 @@ exec_byte_code (Lisp_Object fun, ptrdiff_t args_template, | |||
| 789 | Lisp_Object template; | 789 | Lisp_Object template; |
| 790 | Lisp_Object bytecode; | 790 | Lisp_Object bytecode; |
| 791 | if (COMPILEDP (call_fun) | 791 | if (COMPILEDP (call_fun) |
| 792 | // Lexical binding only. | 792 | /* Lexical binding only. */ |
| 793 | && (template = AREF (call_fun, COMPILED_ARGLIST), | 793 | && (template = AREF (call_fun, COMPILED_ARGLIST), |
| 794 | FIXNUMP (template)) | 794 | FIXNUMP (template)) |
| 795 | // No autoloads. | 795 | /* No autoloads. */ |
| 796 | && (bytecode = AREF (call_fun, COMPILED_BYTECODE), | 796 | && (bytecode = AREF (call_fun, COMPILED_BYTECODE), |
| 797 | !CONSP (bytecode))) | 797 | !CONSP (bytecode))) |
| 798 | { | 798 | { |
diff --git a/src/haikufont.c b/src/haikufont.c index a025dec58bb..b4c2e547247 100644 --- a/src/haikufont.c +++ b/src/haikufont.c | |||
| @@ -760,7 +760,7 @@ haikufont_open (struct frame *f, Lisp_Object font_entity, int pixel_size) | |||
| 760 | struct haiku_font_pattern ptn; | 760 | struct haiku_font_pattern ptn; |
| 761 | struct font *font; | 761 | struct font *font; |
| 762 | void *be_font; | 762 | void *be_font; |
| 763 | Lisp_Object font_object, tem, extra, indices, antialias; | 763 | Lisp_Object font_object, extra, indices, antialias; |
| 764 | int px_size, min_width, max_width; | 764 | int px_size, min_width, max_width; |
| 765 | int avg_width, height, space_width, ascent; | 765 | int avg_width, height, space_width, ascent; |
| 766 | int descent, underline_pos, underline_thickness; | 766 | int descent, underline_pos, underline_thickness; |
diff --git a/src/profiler.c b/src/profiler.c index 81b5e7b0cf0..8247b2e90c6 100644 --- a/src/profiler.c +++ b/src/profiler.c | |||
| @@ -505,6 +505,9 @@ Before returning, a new log is allocated for future samples. */) | |||
| 505 | void | 505 | void |
| 506 | malloc_probe (size_t size) | 506 | malloc_probe (size_t size) |
| 507 | { | 507 | { |
| 508 | if (EQ (backtrace_top_function (), QAutomatic_GC)) /* bug#60237 */ | ||
| 509 | /* FIXME: We should do something like what we did with `cpu_gc_count`. */ | ||
| 510 | return; | ||
| 508 | eassert (HASH_TABLE_P (memory_log)); | 511 | eassert (HASH_TABLE_P (memory_log)); |
| 509 | record_backtrace (XHASH_TABLE (memory_log), min (size, MOST_POSITIVE_FIXNUM)); | 512 | record_backtrace (XHASH_TABLE (memory_log), min (size, MOST_POSITIVE_FIXNUM)); |
| 510 | } | 513 | } |
diff --git a/src/xdisp.c b/src/xdisp.c index e32b0dc5166..d3cd897f489 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -4583,7 +4583,7 @@ face_at_pos (const struct it *it, enum lface_attribute_index attr_filter) | |||
| 4583 | &next_stop, | 4583 | &next_stop, |
| 4584 | base_face_id, false, | 4584 | base_face_id, false, |
| 4585 | attr_filter); | 4585 | attr_filter); |
| 4586 | } // !STRINGP (it->string)) | 4586 | } /* !STRINGP (it->string) */ |
| 4587 | } | 4587 | } |
| 4588 | 4588 | ||
| 4589 | 4589 | ||
diff --git a/test/lisp/progmodes/c-ts-mode-resources/indent.erts b/test/lisp/progmodes/c-ts-mode-resources/indent.erts index 36d7af4faf1..904c6498cb5 100644 --- a/test/lisp/progmodes/c-ts-mode-resources/indent.erts +++ b/test/lisp/progmodes/c-ts-mode-resources/indent.erts | |||
| @@ -84,14 +84,6 @@ int main() | |||
| 84 | } | 84 | } |
| 85 | =-=-= | 85 | =-=-= |
| 86 | 86 | ||
| 87 | Name: Empty Line | ||
| 88 | =-= | ||
| 89 | int main() | ||
| 90 | { | ||
| 91 | | | ||
| 92 | } | ||
| 93 | =-=-= | ||
| 94 | |||
| 95 | Name: Concecutive blocks (GNU Style) (bug#60873) | 87 | Name: Concecutive blocks (GNU Style) (bug#60873) |
| 96 | 88 | ||
| 97 | =-= | 89 | =-= |
| @@ -385,3 +377,28 @@ namespace test { | |||
| 385 | }; | 377 | }; |
| 386 | } | 378 | } |
| 387 | =-=-= | 379 | =-=-= |
| 380 | |||
| 381 | Code: | ||
| 382 | (lambda () | ||
| 383 | (c-ts-mode) | ||
| 384 | (setq-local indent-tabs-mode nil) | ||
| 385 | (setq-local c-ts-mode-indent-offset 2) | ||
| 386 | (c-ts-mode-set-style 'gnu) | ||
| 387 | (indent-for-tab-command)) | ||
| 388 | |||
| 389 | Name: Empty Line | ||
| 390 | =-= | ||
| 391 | int main() | ||
| 392 | { | ||
| 393 | | | ||
| 394 | } | ||
| 395 | =-=-= | ||
| 396 | |||
| 397 | Name: Empty Line Previous Sibling | ||
| 398 | =-= | ||
| 399 | int main() | ||
| 400 | { | ||
| 401 | int a = 1; | ||
| 402 | | | ||
| 403 | } | ||
| 404 | =-=-= | ||
diff --git a/test/lisp/progmodes/sh-script-tests.el b/test/lisp/progmodes/sh-script-tests.el index c850a5d8af7..52c1303c414 100644 --- a/test/lisp/progmodes/sh-script-tests.el +++ b/test/lisp/progmodes/sh-script-tests.el | |||
| @@ -52,6 +52,24 @@ | |||
| 52 | (ert-deftest test-indentation () | 52 | (ert-deftest test-indentation () |
| 53 | (ert-test-erts-file (ert-resource-file "sh-indents.erts"))) | 53 | (ert-test-erts-file (ert-resource-file "sh-indents.erts"))) |
| 54 | 54 | ||
| 55 | (ert-deftest test-indent-after-continuation () | ||
| 56 | (with-temp-buffer | ||
| 57 | (insert "for f \\\nin a; do \\\ntoto; \\\ndone\n") | ||
| 58 | (shell-script-mode) | ||
| 59 | (let ((sh-indent-for-continuation '++)) | ||
| 60 | (let ((sh-indent-after-continuation t)) | ||
| 61 | (indent-region (point-min) (point-max)) | ||
| 62 | (should (equal (buffer-string) | ||
| 63 | "for f \\\n\tin a; do \\\n toto; \\\n done\n"))) | ||
| 64 | (let ((sh-indent-after-continuation 'always)) | ||
| 65 | (indent-region (point-min) (point-max)) | ||
| 66 | (should (equal (buffer-string) | ||
| 67 | "for f \\\n\tin a; do \\\n\ttoto; \\\n\tdone\n"))) | ||
| 68 | (let ((sh-indent-after-continuation nil)) | ||
| 69 | (indent-region (point-min) (point-max)) | ||
| 70 | (should (equal (buffer-string) | ||
| 71 | "for f \\\nin a; do \\\n toto; \\\ndone\n")))))) | ||
| 72 | |||
| 55 | (defun test-sh-back (string &optional pos) | 73 | (defun test-sh-back (string &optional pos) |
| 56 | (with-temp-buffer | 74 | (with-temp-buffer |
| 57 | (shell-script-mode) | 75 | (shell-script-mode) |
diff --git a/test/manual/indent/shell.sh b/test/manual/indent/shell.sh index bd4a74f7054..5b3fb0e66fb 100755 --- a/test/manual/indent/shell.sh +++ b/test/manual/indent/shell.sh | |||
| @@ -140,6 +140,7 @@ foo () { | |||
| 140 | 5) hello ;; | 140 | 5) hello ;; |
| 141 | 4) hello ;& | 141 | 4) hello ;& |
| 142 | 4) hello ;;& | 142 | 4) hello ;;& |
| 143 | 4) hello ;| | ||
| 143 | 5) hello ;; | 144 | 5) hello ;; |
| 144 | 5) hello ;; | 145 | 5) hello ;; |
| 145 | esac | 146 | esac |