Merge remote-tracking branch 'origin/master' into feature/android

This commit is contained in:
Po Lu 2023-03-02 20:00:06 +08:00
commit a6a586ffc1
18 changed files with 159 additions and 47 deletions

View file

@ -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}

View file

@ -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

View file

@ -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

View file

@ -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.

View file

@ -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))

View file

@ -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.

View file

@ -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))
@ -3652,6 +3661,15 @@ If NOERROR, return predicate, else erroring function."
(with-eval-after-load 'desktop
(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:

View file

@ -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)

View file

@ -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 ()

View file

@ -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.

View file

@ -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]);

View file

@ -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)))
{

View file

@ -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;

View file

@ -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));
}

View file

@ -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) */
}

View file

@ -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;
|
}
=-=-=

View file

@ -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)

View file

@ -140,6 +140,7 @@ foo () {
5) hello ;;
4) hello ;&
4) hello ;;&
4) hello ;|
5) hello ;;
5) hello ;;
esac