[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/android a6a586ffc1b 2/2: Merge remote-tracking branch 'origin/ma
From: |
Po Lu |
Subject: |
feature/android a6a586ffc1b 2/2: Merge remote-tracking branch 'origin/master' into feature/android |
Date: |
Thu, 2 Mar 2023 07:00:30 -0500 (EST) |
branch: feature/android
commit a6a586ffc1bd302e30d80cb88b06e1e7e1573f63
Merge: 42674a71446 8d5d7509b0a
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Merge remote-tracking branch 'origin/master' into feature/android
---
doc/emacs/programs.texi | 6 ++++
etc/NEWS | 7 +++++
lisp/emacs-lisp/debug-early.el | 8 +++---
lisp/emacs-lisp/eldoc.el | 1 +
lisp/man.el | 11 +++++++-
lisp/progmodes/c-ts-mode.el | 20 ++++++++-----
lisp/progmodes/eglot.el | 26 ++++++++++++++---
lisp/progmodes/go-ts-mode.el | 2 +-
lisp/progmodes/sh-script.el | 25 ++++++++++------
lisp/treesit.el | 32 ++++++++++++++++-----
src/alloc.c | 5 ++--
src/bytecode.c | 4 +--
src/haikufont.c | 2 +-
src/profiler.c | 3 ++
src/xdisp.c | 2 +-
.../lisp/progmodes/c-ts-mode-resources/indent.erts | 33 ++++++++++++++++------
test/lisp/progmodes/sh-script-tests.el | 18 ++++++++++++
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
@kbd{M-p} to switch between man pages in different sections. The mode
line shows how many manual pages are available.
+@vindex Man-prefer-synchronous-call
+ By default, @kbd{M-x man} calls the @code{man} program
+asynchronously. You can force the invocation to be synchronous by
+customizing @code{Man-prefer-synchronous-calls} to a non-@code{nil}
+value.
+
@findex woman
@cindex manual pages, on MS-DOS/MS-Windows
An alternative way of reading manual pages is the @kbd{M-x woman}
diff --git a/etc/NEWS b/etc/NEWS
index 9ed079a316c..a10927f4166 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -213,6 +213,13 @@ This command adds a docstring comment to the current
defun. If a
comment already exists, point is only moved to the comment. It is
bound to 'C-c C-d' in 'go-ts-mode'.
+** Man-mode
+
++++
+*** New user option 'Man-prefer-synchronous-call'.
+When this is non-nil, call the 'man' program synchronously rather than
+asynchronously (which is the default behavior).
+
* New Modes and Packages in Emacs 30.1
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."
(print-escape-control-characters t)
(print-escape-nonascii t)
(prin1 (if (and (fboundp 'cl-prin1)
- ;; If we're being called while
- ;; bootstrapping, we won't be able to load
- ;; cl-print.
- (require 'cl-print nil t))
+ (fboundp 'cl-defmethod) ;Used by `cl-print'.
+ (condition-case nil
+ (require 'cl-print)
+ (error nil)))
#'cl-prin1
#'prin1)))
(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."
(defun eldoc-display-message-no-interference-p ()
"Return nil if displaying a message would cause interference."
(not (or executing-kbd-macro
+ (bound-and-true-p edebug-active)
;; The following configuration shows "Matches..." in the
;; echo area when point is after a closing bracket, which
;; 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 @@
:group 'external
:group 'help)
+(defcustom Man-prefer-synchronous-call nil
+ "Whether to call the Un*x \"man\" program synchronously.
+When this is non-nil, call the \"man\" program synchronously
+(rather than asynchronously, which is the default behavior)."
+ :type 'boolean
+ :group 'man
+ :version 30.1)
+
(defcustom Man-filter-list nil
"Manpage cleaning filter command phrases.
This variable contains a list of the following form:
@@ -1118,7 +1126,8 @@ Return the buffer in which the manpage will appear."
"[cleaning...]")
'face 'mode-line-emphasis)))
(Man-start-calling
- (if (fboundp 'make-process)
+ (if (and (fboundp 'make-process)
+ (not Man-prefer-synchronous-call))
(let ((proc (start-process
manual-program buffer
(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."
0
c-ts-mode-indent-offset)))
-(defun c-ts-mode--anchor-prev-sibling (node &rest _)
+(defun c-ts-mode--anchor-prev-sibling (node parent bol &rest _)
"Return the start of the previous named sibling of NODE.
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
the labeled_statement.
Return nil if a) there is no prev-sibling, or 2) prev-sibling
-doesn't have a child."
- (when-let ((prev-sibling (treesit-node-prev-sibling node t)))
+doesn't have a child.
+
+PARENT and BOL are like other anchor functions."
+ (when-let ((prev-sibling
+ (or (treesit-node-prev-sibling node t)
+ (treesit-node-prev-sibling
+ (treesit-node-first-child-for-pos parent bol) t)
+ (treesit-node-child parent -1 t))))
(while (and prev-sibling
(equal "labeled_statement"
(treesit-node-type prev-sibling)))
@@ -350,17 +356,17 @@ MODE is either `c' or `cpp'."
;; int[5] a = { 0, 0, 0, 0 };
((match nil "initializer_list" nil 1 1) parent-bol
c-ts-mode-indent-offset)
- ((match nil "initializer_list" nil 2)
c-ts-mode--anchor-prev-sibling 0)
+ ((parent-is "initializer_list") c-ts-mode--anchor-prev-sibling 0)
;; Statement in enum.
((match nil "enumerator_list" nil 1 1) standalone-parent
c-ts-mode-indent-offset)
- ((match nil "enumerator_list" nil 2) c-ts-mode--anchor-prev-sibling
0)
+ ((parent-is "enumerator_list") c-ts-mode--anchor-prev-sibling 0)
;; Statement in struct and union.
((match nil "field_declaration_list" nil 1 1) standalone-parent
c-ts-mode-indent-offset)
- ((match nil "field_declaration_list" nil 2)
c-ts-mode--anchor-prev-sibling 0)
+ ((parent-is "field_declaration_list")
c-ts-mode--anchor-prev-sibling 0)
;; Statement in {} blocks.
((match nil "compound_statement" nil 1 1) standalone-parent
c-ts-mode-indent-offset)
- ((match nil "compound_statement" nil 2)
c-ts-mode--anchor-prev-sibling 0)
+ ((parent-is "compound_statement") c-ts-mode--anchor-prev-sibling 0)
;; Opening bracket.
((node-is "compound_statement") standalone-parent
c-ts-mode-indent-offset)
;; 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 @@
(defvar markdown-fontify-code-blocks-natively)
(defvar company-backends)
(defvar company-tooltip-align-annotations)
-
+(defvar tramp-ssh-controlmaster-options)
+(defvar tramp-use-ssh-controlmaster-options)
;;; User tweakable stuff
@@ -1249,7 +1250,15 @@ This docstring appeases checkdoc, that's all."
(contact (cl-subseq contact 0 probe)))
`(:process
,(lambda ()
- (let ((default-directory default-directory))
+ (let ((default-directory default-directory)
+ ;; bug#61350: Tramp turns on a feature
+ ;; by default that can't (yet) handle
+ ;; very much data so we turn it off
+ ;; unconditionally -- just for our
+ ;; process.
+ (tramp-use-ssh-controlmaster-options t)
+ (tramp-ssh-controlmaster-options
+ "-o ControlMaster=no -o ControlPath=none"))
(make-process
:name readable-name
:command (setq server-info (eglot--cmd contact))
@@ -3653,6 +3662,15 @@ If NOERROR, return predicate, else erroring function."
(add-to-list 'desktop-minor-mode-handlers '(eglot--managed-mode . ignore)))
+;;; Misc
+;;;
+(defun eglot--debbugs-or-github-bug-uri ()
+ (format (if (string= (match-string 2) "github")
+ "https://github.com/joaotavora/eglot/issues/%s"
+ "https://debbugs.gnu.org/%s")
+ (match-string 3)))
+(put 'eglot--debbugs-or-github-bug-uri 'bug-reference-url-format t)
+
;;; Obsolete
;;;
@@ -3662,8 +3680,8 @@ If NOERROR, return predicate, else erroring function."
;; Local Variables:
-;; bug-reference-bug-regexp: "\\(github#\\([0-9]+\\)\\)"
-;; bug-reference-url-format: "https://github.com/joaotavora/eglot/issues/%s"
+;; bug-reference-bug-regexp: "\\(\\(github\\|bug\\)#\\([0-9]+\\)\\)"
+;; bug-reference-url-format: eglot--debbugs-or-github-bug-uri
;; checkdoc-force-docstrings-flag: nil
;; End:
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."
(treesit-major-mode-setup)))
-(if (treesit-ready-p 'gomod)
+(if (treesit-language-available-p 'gomod)
(add-to-list 'auto-mode-alist '("/go\\.mod\\'" . go-mod-ts-mode)))
(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."
;; Maybe we've bumped into an escaped newline.
(sh-is-quoted-p (point)))
(backward-char 1))
- (when (eq (char-before) ?|)
+ (when (and
+ (eq (char-before) ?|)
+ (not (eq (char-before (1- (point))) ?\;)))
(backward-char 1) t)))
(and (> (point) (1+ (point-min)))
(progn (backward-char 2)
@@ -1053,7 +1055,7 @@ subshells can nest."
;; a normal command rather than the real `in' keyword.
;; I.e. we should look back to try and find the
;; corresponding `case'.
- (and (looking-at ";[;&]\\|\\_<in")
+ (and (looking-at ";\\(?:;&?\\|[&|]\\)\\|\\_<in")
;; ";; esac )" is a case that looks
;; like a case-pattern but it's really just a close
;; 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."
(pattern (rpattern) ("case-(" rpattern))
(branches (branches ";;" branches)
(branches ";&" branches) (branches ";;&" branches) ;bash.
+ (branches ";|" branches) ;zsh.
(pattern "case-)" cmd)))
- '((assoc ";;" ";&" ";;&"))
+ '((assoc ";;" ";&" ";;&" ";|"))
'((assoc ";" "&") (assoc "&&" "||") (assoc "|" "|&")))))
(defconst sh-smie--sh-operators
@@ -2010,7 +2013,7 @@ May return nil if the line should not be treated as
continued."
(forward-line -1)
(if (sh-smie--looking-back-at-continuation-p)
(current-indentation)
- (+ (current-indentation) sh-basic-offset))))
+ (+ (current-indentation) (sh-var-value 'sh-indent-for-continuation)))))
(t
;; Just make sure a line-continuation is indented deeper.
(save-excursion
@@ -2031,7 +2034,10 @@ May return nil if the line should not be treated as
continued."
;; check the line before that one.
(> ci indent))
(t ;Previous line is the beginning of the continued line.
- (setq indent (min (+ ci sh-basic-offset) max))
+ (setq
+ indent
+ (min
+ (+ ci (sh-var-value 'sh-indent-for-continuation))
max))
nil)))))
indent))))))
@@ -2055,11 +2061,11 @@ May return nil if the line should not be treated as
continued."
`(column . ,(smie-indent-virtual))))))
;; FIXME: Maybe this handling of ;; should be made into
;; a smie-rule-terminator function that takes the substitute ";" as arg.
- (`(:before . ,(or ";;" ";&" ";;&"))
- (if (and (smie-rule-bolp) (looking-at ";;?&?[ \t]*\\(#\\|$\\)"))
+ (`(:before . ,(or ";;" ";&" ";;&" ";|"))
+ (if (and (smie-rule-bolp) (looking-at ";\\(?:;&?\\|[&|]\\)?[
\t]*\\(#\\|$\\)"))
(cons 'column (smie-indent-keyword ";"))
(smie-rule-separator kind)))
- (`(:after . ,(or ";;" ";&" ";;&"))
+ (`(:after . ,(or ";;" ";&" ";;&" ";|"))
(with-demoted-errors "SMIE rule error: %S"
(smie-backward-sexp token)
(cons 'column
@@ -2148,8 +2154,9 @@ May return nil if the line should not be treated as
continued."
(pattern (pattern "|" pattern))
(branches (branches ";;" branches)
(branches ";&" branches) (branches ";;&" branches) ;bash.
+ (branches ";|" branches) ;zsh.
(pattern "case-)" cmd)))
- '((assoc ";;" ";&" ";;&"))
+ '((assoc ";;" ";&" ";;&" ";|"))
'((assoc "case") (assoc ";" "&") (assoc "&&" "||") (assoc "|" "|&")))))
(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'.")
(line-beginning-position))
(throw 'term (point)))
(setq parent (treesit-node-parent parent)))))))
- (cons 'prev-sibling (lambda (node &rest _)
+ (cons 'prev-sibling (lambda (node parent bol &rest _)
(treesit-node-start
- (treesit-node-prev-sibling node))))
+ (or (treesit-node-prev-sibling node t)
+ ;; If node is nil (indenting empty
+ ;; line), we still try to guess the
+ ;; previous sibling.
+ (treesit-node-prev-sibling
+ (treesit-node-first-child-for-pos
+ parent bol)
+ t)
+ (treesit-node-child parent -1 t)))))
(cons 'no-indent (lambda (_n _p bol &rest _) bol))
(cons 'prev-line (lambda (_n _p bol &rest _)
(save-excursion
@@ -1532,14 +1540,24 @@ Similar to `treesit-indent', but indent a region
instead."
(aref meta-vec (+ 1 (* idx meta-len))) nil)
(pcase-let* ((`(,anchor . ,offset) (treesit--indent-1))
(marker (aref meta-vec (* idx meta-len))))
- ;; Set ANCHOR.
- (when anchor
+ (if (not (and anchor offset))
+ ;; No indent for this line, either...
+ (if (markerp marker)
+ (progn
+ ;; ... Set marker and offset to do a dummy
+ ;; indent, or...
+ (back-to-indentation)
+ (move-marker marker (point))
+ (setf (aref meta-vec (+ 1 (* idx meta-len))) 0))
+ ;; ...Set anchor to nil so no indent is performed.
+ (setf (aref meta-vec (* idx meta-len)) nil))
+ ;; Set ANCHOR.
(if (markerp marker)
(move-marker marker anchor)
(setf (aref meta-vec (* idx meta-len))
- (copy-marker anchor t))))
- ;; SET OFFSET.
- (setf (aref meta-vec (+ 1 (* idx meta-len))) offset)))
+ (copy-marker anchor t)))
+ ;; SET OFFSET.
+ (setf (aref meta-vec (+ 1 (* idx meta-len))) offset))))
(cl-incf idx)
(setq lines-left-to-move (forward-line 1)))
;; 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
&& FIXNATP (args[COMPILED_STACK_DEPTH])))
error ("Invalid byte-code object");
- pin_string (args[COMPILED_BYTECODE]); // Bytecode must be immovable.
+ /* Bytecode must be immovable. */
+ pin_string (args[COMPILED_BYTECODE]);
/* We used to purecopy everything here, if purify-flag was set. This worked
OK for Emacs-23, but with Emacs-24's lexical binding code, it can be
@@ -5959,7 +5960,7 @@ purecopy (Lisp_Object obj)
memcpy (vec, objp, nbytes);
for (i = 0; i < size; i++)
vec->contents[i] = purecopy (vec->contents[i]);
- // Byte code strings must be pinned.
+ /* Byte code strings must be pinned. */
if (COMPILEDP (obj) && size >= 2 && STRINGP (vec->contents[1])
&& !STRING_MULTIBYTE (vec->contents[1]))
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,
Lisp_Object template;
Lisp_Object bytecode;
if (COMPILEDP (call_fun)
- // Lexical binding only.
+ /* Lexical binding only. */
&& (template = AREF (call_fun, COMPILED_ARGLIST),
FIXNUMP (template))
- // No autoloads.
+ /* No autoloads. */
&& (bytecode = AREF (call_fun, COMPILED_BYTECODE),
!CONSP (bytecode)))
{
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)
struct haiku_font_pattern ptn;
struct font *font;
void *be_font;
- Lisp_Object font_object, tem, extra, indices, antialias;
+ Lisp_Object font_object, extra, indices, antialias;
int px_size, min_width, max_width;
int avg_width, height, space_width, ascent;
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. */)
void
malloc_probe (size_t size)
{
+ if (EQ (backtrace_top_function (), QAutomatic_GC)) /* bug#60237 */
+ /* FIXME: We should do something like what we did with `cpu_gc_count`. */
+ return;
eassert (HASH_TABLE_P (memory_log));
record_backtrace (XHASH_TABLE (memory_log), min (size,
MOST_POSITIVE_FIXNUM));
}
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)
&next_stop,
base_face_id, false,
attr_filter);
- } // !STRINGP (it->string))
+ } /* !STRINGP (it->string) */
}
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()
}
=-=-=
-Name: Empty Line
-=-=
-int main()
-{
- |
-}
-=-=-=
-
Name: Concecutive blocks (GNU Style) (bug#60873)
=-=
@@ -385,3 +377,28 @@ namespace test {
};
}
=-=-=
+
+Code:
+ (lambda ()
+ (c-ts-mode)
+ (setq-local indent-tabs-mode nil)
+ (setq-local c-ts-mode-indent-offset 2)
+ (c-ts-mode-set-style 'gnu)
+ (indent-for-tab-command))
+
+Name: Empty Line
+=-=
+int main()
+{
+ |
+}
+=-=-=
+
+Name: Empty Line Previous Sibling
+=-=
+int main()
+{
+ int a = 1;
+ |
+}
+=-=-=
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 @@
(ert-deftest test-indentation ()
(ert-test-erts-file (ert-resource-file "sh-indents.erts")))
+(ert-deftest test-indent-after-continuation ()
+ (with-temp-buffer
+ (insert "for f \\\nin a; do \\\ntoto; \\\ndone\n")
+ (shell-script-mode)
+ (let ((sh-indent-for-continuation '++))
+ (let ((sh-indent-after-continuation t))
+ (indent-region (point-min) (point-max))
+ (should (equal (buffer-string)
+ "for f \\\n\tin a; do \\\n toto; \\\n done\n")))
+ (let ((sh-indent-after-continuation 'always))
+ (indent-region (point-min) (point-max))
+ (should (equal (buffer-string)
+ "for f \\\n\tin a; do \\\n\ttoto; \\\n\tdone\n")))
+ (let ((sh-indent-after-continuation nil))
+ (indent-region (point-min) (point-max))
+ (should (equal (buffer-string)
+ "for f \\\nin a; do \\\n toto; \\\ndone\n"))))))
+
(defun test-sh-back (string &optional pos)
(with-temp-buffer
(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 () {
5) hello ;;
4) hello ;&
4) hello ;;&
+ 4) hello ;|
5) hello ;;
5) hello ;;
esac