1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-17 03:10:58 -08:00

Merge branch 'master' into scratch/igc

This commit is contained in:
Pip Cet 2024-07-10 13:01:42 +00:00
commit 2a34ced4cd
378 changed files with 6547 additions and 3703 deletions

View file

@ -3833,7 +3833,7 @@ This assumes the function has the `important-return-value' property."
(defun byte-compile-free-vars-warn (arg var &optional assignment)
"Warn if symbol VAR refers to a free variable.
VAR must not be lexically bound.
ARG is a position argument, used by byte-compile-warn-x.
ARG is a position argument, used by `byte-compile-warn-x'.
If optional argument ASSIGNMENT is non-nil, this is treated as an
assignment (i.e. `setq')."
(unless (or (not (byte-compile-warning-enabled-p 'free-vars var))
@ -5489,7 +5489,7 @@ OP and OPERAND are as passed to `byte-compile-out'."
(defun byte-compile-out (op &optional operand)
"Push the operation onto `byte-compile-output'.
OP is an opcode, a symbol. OPERAND is either nil or a number or
a one-element list of a lisp form."
a one-element list of a Lisp form."
(when (and (consp operand) (null (cdr operand)))
(setq operand (byte-run-strip-symbol-positions operand)))
(push (cons op operand) byte-compile-output)

View file

@ -262,14 +262,15 @@ with these words enabled."
;;;###autoload(put 'checkdoc-ispell-list-words 'safe-local-variable #'list-of-strings-p)
(defcustom checkdoc-max-keyref-before-warn nil
"If non-nil, number of \\\\=[command-to-keystroke] tokens allowed in a doc string.
Any more than this and a warning is generated suggesting that the construct
\\\\={mapvar} be used instead. If the value is nil, never warn.
"Maximum number of \\\\=[command-to-keystroke] tokens allowed in a doc string.
It used to not be practical to use `\\\\=[...]' very many times,
because display of the documentation string would become slow.
This is not an issue on modern machines, unless you have
thousands of substitutions."
Any more than this and a warning is generated suggesting that the
construct \\\\={mapvar} be used instead. If the value is nil, never
warn.
It used to be impractical to use `\\\\=[...]' very many times, because
display of the documentation string would become slow. This is not an
issue on modern machines, unless you have thousands of substitutions."
:type '(choice (const nil)
integer)
:version "28.1")
@ -289,6 +290,7 @@ made in the style guide relating to order."
Currently, all recognized keywords must be on `finder-known-keywords'."
:version "25.1"
:type 'boolean)
;;;###autoload(put 'checkdoc-package-keywords-flag 'safe-local-variable #'booleanp)
(defvar checkdoc-style-functions nil
"Hook run after the standard style check is completed.
@ -307,11 +309,12 @@ problem discovered. This is useful for adding additional checks.")
(defvar checkdoc-diagnostic-buffer "*Style Warnings*"
"Name of warning message buffer.")
(defcustom checkdoc-verb-check-experimental-flag t
(defcustom checkdoc-verb-check-experimental-flag nil
"Non-nil means to attempt to check the voice of the doc string.
This check keys off some words which are commonly misused. See the
variable `checkdoc-common-verbs-wrong-voice' if you wish to add your own."
:type 'boolean)
:type 'boolean
:version "31.1")
;;;###autoload(put 'checkdoc-verb-check-experimental-flag 'safe-local-variable #'booleanp)
(defvar checkdoc-generate-compile-warnings-flag nil
@ -345,6 +348,7 @@ See Info node `(elisp) Documentation Tips' for background."
;; (setq checkdoc--argument-missing-flag nil) ; optional
;; (setq checkdoc--disambiguate-symbol-flag nil) ; optional
;; (setq checkdoc--interactive-docstring-flag nil) ; optional
;; (setq checkdoc-permit-comma-termination-flag t) ; optional
;; (setq checkdoc-verb-check-experimental-flag nil)
;; Then use `M-x find-dired' ("-name '*.el'") and `M-x checkdoc-dired'
@ -1084,7 +1088,7 @@ Optional argument TAKE-NOTES causes all errors to be logged."
Evaluation is done first so the form will be read before the
documentation is checked. If there is a documentation error, then the display
of what was evaluated will be overwritten by the diagnostic message."
(interactive)
(interactive nil emacs-lisp-mode)
(call-interactively #'eval-defun)
(checkdoc-defun))
@ -1095,7 +1099,7 @@ Call `error' if the doc string has problems. If NO-ERROR is
non-nil, then do not call error, but call `message' instead.
If the doc string passes the test, then check the function for rogue white
space at the end of each line."
(interactive)
(interactive nil emacs-lisp-mode)
(save-excursion
(beginning-of-defun)
(when (checkdoc--next-docstring)
@ -2133,7 +2137,7 @@ Examples of recognized abbreviations: \"e.g.\", \"i.e.\", \"cf.\"."
(seq (any "cC") "f") ; cf.
(seq (any "eE") ".g") ; e.g.
(seq (any "iI") "." (any "eE")) ; i.e.
"a.k.a" "etc" "vs" "N.B"
"a.k.a" "etc" "vs" "N.B" "U.S"
;; Some non-standard or less common ones that we
;; might as well accept.
"Inc" "Univ" "misc" "resp")
@ -2472,25 +2476,33 @@ Code:, and others referenced in the style guide."
(setq
err
(or
;; * A footer. Not compartmentalized from lm-verify: too bad.
;; The following is partially clipped from lm-verify
;; * Library footer
(save-excursion
(goto-char (point-max))
(if (not (re-search-backward
;; This should match the requirement in
;; `package-buffer-info'.
(concat "^;;; " (regexp-quote (concat fn fe)) " ends here")
nil t))
(if (checkdoc-y-or-n-p "No identifiable footer! Add one?")
(progn
(goto-char (point-max))
(insert "\n(provide '" fn ")\n\n;;; " fn fe " ends here\n"))
(checkdoc-create-error
(format "The footer should be: (provide '%s)\\n;;; %s%s ends here"
fn fn fe)
;; The buffer may be empty.
(max (point-min) (1- (point-max)))
(point-max)))))
(let* ((footer-line (lm-package-needs-footer-line)))
(if (not (re-search-backward
;; This should match the requirement in
;; `package-buffer-info'.
(if footer-line
(concat "^;;; " (regexp-quote (concat fn fe)) " ends here")
(concat "\n(provide '" fn ")\n"))
nil t))
(if (checkdoc-y-or-n-p (if footer-line
"No identifiable footer! Add one?"
"No `provide' statement! Add one?"))
(progn
(goto-char (point-max))
(insert (if footer-line
(concat "\n(provide '" fn ")\n\n;;; " fn fe " ends here\n")
(concat "\n(provide '" fn ")\n"))))
(checkdoc-create-error
(if footer-line
(format "The footer should be: (provide '%s)\\n;;; %s%s ends here"
fn fn fe)
(format "The footer should be: (provide '%s)\\n" fn))
;; The buffer may be empty.
(max (point-min) (1- (point-max)))
(point-max))))))
err))
;; The below checks will not return errors if the user says NO
@ -2531,14 +2543,18 @@ Code:, and others referenced in the style guide."
"Search between BEG and END for a style error with message text.
Optional arguments BEG and END represent the boundary of the check.
The default boundary is the entire buffer."
(let ((e nil)
(type nil))
(let ((e nil))
(if (not (or beg end)) (setq beg (point-min) end (point-max)))
(goto-char beg)
(while (setq type (checkdoc-message-text-next-string end))
(while-let ((type (checkdoc-message-text-next-string end)))
(setq e (checkdoc-message-text-engine type)))
e))
(defvar checkdoc--warning-function-re
(rx (or "display-warning" "org-display-warning"
"warn" "lwarn"
"message-box")))
(defun checkdoc-message-text-next-string (end)
"Move cursor to the next checkable message string after point.
Return the message classification.
@ -2551,6 +2567,7 @@ Argument END is the maximum bounds to search in."
(group
(or (seq (* (or wordchar (syntax symbol)))
"error")
(regexp checkdoc--warning-function-re)
(seq (* (or wordchar (syntax symbol)))
(or "y-or-n-p" "yes-or-no-p")
(? "-with-timeout"))
@ -2558,8 +2575,13 @@ Argument END is the maximum bounds to search in."
(+ (any "\n\t ")))
end t))
(let* ((fn (match-string 1))
(type (cond ((string-match "error" fn)
'error)
(type (cond ((string-match "error" fn)
'error)
((string-match (rx bos
(regexp checkdoc--warning-function-re)
eos)
fn)
'warning)
(t 'y-or-n-p))))
(if (string-match "checkdoc-autofix-ask-replace" fn)
(progn (forward-sexp 2)
@ -2629,30 +2651,33 @@ should not end with a period, and should start with a capital letter.
The function `y-or-n-p' has similar constraints.
Argument TYPE specifies the type of question, such as `error' or `y-or-n-p'."
;; If type is nil, then attempt to derive it.
(if (not type)
(save-excursion
(up-list -1)
(if (looking-at "(format")
(up-list -1))
(setq type
(cond ((looking-at "(error")
'error)
(t 'y-or-n-p)))))
(unless type
(save-excursion
(up-list -1)
(when (looking-at "(format")
(up-list -1))
(setq type
(cond ((looking-at "(error")
'error)
((looking-at
(rx "(" (regexp checkdoc--warning-function-re)
(syntax whitespace)))
'warning)
(t 'y-or-n-p)))))
(let ((case-fold-search nil))
(or
;; From the documentation of the symbol `error':
;; In Emacs, the convention is that error messages start with a capital
;; letter but *do not* end with a period. Please follow this convention
;; for the sake of consistency.
(if (and (checkdoc--error-bad-format-p)
(not (checkdoc-autofix-ask-replace
(match-beginning 1) (match-end 1)
"Capitalize your message text?"
(capitalize (match-string 1))
t)))
(checkdoc-create-error "Messages should start with a capital letter"
(match-beginning 1) (match-end 1))
nil)
(when (and (checkdoc--error-bad-format-p)
(not (checkdoc-autofix-ask-replace
(match-beginning 1) (match-end 1)
"Capitalize your message text?"
(capitalize (match-string 1))
t)))
(checkdoc-create-error "Messages should start with a capital letter"
(match-beginning 1) (match-end 1)))
;; In general, sentences should have two spaces after the period.
(checkdoc-sentencespace-region-engine (point)
(save-excursion (forward-sexp 1)
@ -2662,19 +2687,18 @@ Argument TYPE specifies the type of question, such as `error' or `y-or-n-p'."
(save-excursion (forward-sexp 1)
(point)))
;; Here are message type specific questions.
(if (and (eq type 'error)
(save-excursion (forward-sexp 1)
(forward-char -2)
(looking-at "\\."))
(not (checkdoc-autofix-ask-replace (match-beginning 0)
(match-end 0)
"Remove period from error?"
""
t)))
(checkdoc-create-error
"Error messages should *not* end with a period"
(match-beginning 0) (match-end 0))
nil)
(when (and (eq type 'error)
(save-excursion (forward-sexp 1)
(forward-char -2)
(looking-at "\\."))
(not (checkdoc-autofix-ask-replace (match-beginning 0)
(match-end 0)
"Remove period from error?"
""
t)))
(checkdoc-create-error
"Error messages should *not* end with a period"
(match-beginning 0) (match-end 0)))
;; From `(elisp) Programming Tips': "A question asked in the
;; minibuffer with `yes-or-no-p' or `y-or-n-p' should start with
;; a capital letter and end with '?'."
@ -2827,7 +2851,7 @@ function called to create the messages."
;;;###autoload
(defun checkdoc-package-keywords ()
"Find package keywords that aren't in `finder-known-keywords'."
(interactive)
(interactive nil emacs-lisp-mode)
(require 'finder)
(let ((unrecognized-keys
(cl-remove-if

View file

@ -195,7 +195,7 @@ processes from `comp-async-compilations'"
(if native-comp-async-report-warnings-errors
(let ((warning-suppress-types
(if (eq native-comp-async-report-warnings-errors 'silent)
(cons '(comp) warning-suppress-types)
(cons '(native-compiler) warning-suppress-types)
warning-suppress-types))
(regexp (if (eq native-comp-async-warnings-errors-kind 'all)
"^.*?\\(?:Error\\|Warning\\): .*$"
@ -211,7 +211,7 @@ processes from `comp-async-compilations'"
(accept-process-output process)
(goto-char (or comp-last-scanned-async-output (point-min)))
(while (re-search-forward regexp nil t)
(display-warning 'comp (match-string 0)))
(display-warning 'native-compiler (match-string 0)))
(setq comp-last-scanned-async-output (point-max)))))
(accept-process-output process)))
@ -446,8 +446,8 @@ bytecode definition was not changed in the meantime)."
(setf comp-files-queue
(append comp-files-queue `((,file . ,load)))
added-something t)
(display-warning 'comp
(format "No write access for %s skipping."
(display-warning 'native-compiler
(format "Cannot write %s; skipping."
out-filename)))))))
;; Perhaps nothing passed `native--compile-async-skip-p'?
(when (and added-something

View file

@ -75,7 +75,9 @@ This is intended for debugging the compiler itself.
1 emit debug symbols.
2 emit debug symbols and dump pseudo C code.
3 emit debug symbols and dump: pseudo C code, GCC intermediate
passes and libgccjit log file."
passes and libgccjit log file.
When generated, the pseudo C code is deposited in the same directory
as the corresponding .eln file."
:type 'natnum
:safe #'natnump
:version "29.1")
@ -790,21 +792,29 @@ clashes."
:byte-func byte-code)))
(maphash #'comp--intern-func-in-ctxt byte-to-native-lambdas-h)))
(cl-defmethod comp--spill-lap-function ((form list))
"Byte-compile FORM, spilling data from the byte compiler."
(unless (memq (car-safe form) '(lambda closure))
(signal 'native-compiler-error
'("Cannot native-compile, form is not a lambda or closure")))
(defun comp--spill-lap-single-function (function)
"Byte-compile FUNCTION, spilling data from the byte compiler."
(unless (comp-ctxt-output comp-ctxt)
(setf (comp-ctxt-output comp-ctxt)
(make-temp-file "comp-lambda-" nil ".eln")))
(let* ((byte-code (byte-compile form))
(let* ((byte-code (byte-compile function))
(c-name (comp-c-func-name "anonymous-lambda" "F")))
(setf (comp-ctxt-top-level-forms comp-ctxt)
(list (make-byte-to-native-func-def :name '--anonymous-lambda
:c-name c-name
:byte-func byte-code)))
(maphash #'comp--intern-func-in-ctxt byte-to-native-lambdas-h)))
(setf (comp-ctxt-top-level-forms comp-ctxt)
(list (make-byte-to-native-func-def :name '--anonymous-lambda
:c-name c-name
:byte-func byte-code)))
(maphash #'comp--intern-func-in-ctxt byte-to-native-lambdas-h)))
(cl-defmethod comp--spill-lap-function ((form list))
"Byte-compile FORM, spilling data from the byte compiler."
(unless (eq (car-safe form) 'lambda)
(signal 'native-compiler-error
'("Cannot native-compile, form is not a lambda")))
(comp--spill-lap-single-function form))
(cl-defmethod comp--spill-lap-function ((fun interpreted-function))
"Spill data from the byte compiler for the interpreted-function FUN."
(comp--spill-lap-single-function fun))
(defun comp--intern-func-in-ctxt (_ obj)
"Given OBJ of type `byte-to-native-lambda', create a function in `comp-ctxt'."
@ -1055,7 +1065,7 @@ If DST-N is specified, use it; otherwise assume it to be the current slot."
"Set constant VAL to current slot."
(comp--add-const-to-relocs val)
;; Leave relocation index nil on purpose, will be fixed-up in final
;; by `comp-finalize-relocs'.
;; by `comp--finalize-relocs'.
(comp--emit `(setimm ,(comp--slot) ,val)))
(defun comp--make-curr-block (block-name entry-sp &optional addr)
@ -2792,7 +2802,7 @@ Return t if something was changed."
finally
(when (= i 100)
(display-warning
'comp
'native-compiler
(format "fwprop pass jammed into %s?" (comp-func-name f))))
(comp-log (format "Propagation run %d times\n" i) 2))
(comp--rewrite-non-locals)
@ -3575,14 +3585,13 @@ Search happens in `native-comp-eln-load-path'."
;;;###autoload
(defun native-compile (function-or-file &optional output)
"Compile FUNCTION-OR-FILE into native code.
This is the synchronous entry-point for the Emacs Lisp native
compiler. FUNCTION-OR-FILE is a function symbol, a form, or the
filename of an Emacs Lisp source file. If OUTPUT is non-nil, use
it as the filename for the compiled object. If FUNCTION-OR-FILE
is a filename, if the compilation was successful return the
filename of the compiled object. If FUNCTION-OR-FILE is a
function symbol or a form, if the compilation was successful
return the compiled function."
This is the synchronous entry-point for the Emacs Lisp native compiler.
FUNCTION-OR-FILE is a function symbol, a form, an interpreted-function,
or the filename of an Emacs Lisp source file. If OUTPUT is non-nil, use
it as the filename for the compiled object. If FUNCTION-OR-FILE is a
filename, if the compilation was successful return the filename of the
compiled object. If FUNCTION-OR-FILE is a function symbol or a form, if
the compilation was successful return the compiled function."
(declare (ftype (function ((or string symbol) &optional string)
(or native-comp-function string))))
(comp--native-compile function-or-file nil output))

View file

@ -524,7 +524,8 @@ on if the hook has explicitly disabled it.
(progn
(put ',global-mode 'globalized-minor-mode t)
:autoload-end
(defvar-local ,MODE-major-mode nil))
(defvar-local ,MODE-major-mode nil)
,@(when predicate `((defvar ,MODE-predicate))))
;; The actual global minor-mode
(define-minor-mode ,global-mode
,(concat (format "Toggle %s in all buffers.\n" pretty-name)

View file

@ -4577,10 +4577,9 @@ With prefix argument, make it a temporary breakpoint."
(add-hook 'called-interactively-p-functions
#'edebug--called-interactively-skip)
(defun edebug--called-interactively-skip (i frame1 frame2)
(when (and (memq (car-safe (nth 1 frame1)) '(lambda closure))
(when (and (interpreted-function-p (nth 1 frame1))
;; Lambda value with no arguments.
(null (nth (if (eq (car-safe (nth 1 frame1)) 'lambda) 1 2)
(nth 1 frame1)))
(null (aref (nth 1 frame1) 0))
(memq (nth 1 frame2) '(edebug-enter edebug-default-enter)))
;; `edebug-enter' calls itself on its first invocation.
(let ((s 1))

View file

@ -462,7 +462,7 @@ documentation-displaying frontends. For example, KEY can be:
The additional KEY `:origin' is always added by ElDoc, its VALUE
being the member of `eldoc-documentation-functions' where
DOCSTRING originated. `eldoc-display-functions' may use this
DOCSTRING originated. `eldoc-display-functions' may use this
information to organize display of multiple docstrings.
Finally, major modes should modify this hook locally, for

View file

@ -125,7 +125,7 @@ should insert the feature name."
(defcustom find-ert-deftest-regexp
"(ert-deftest +'%s"
"The regexp used to search for an ert-deftest definition.
"The regexp used to search for an `ert-deftest' definition.
Note it must contain a `%s' at the place where `format'
should insert the feature name."
:type 'regexp

View file

@ -1,7 +1,6 @@
;;; lisp-mnt.el --- utility functions for Emacs Lisp maintainers -*- lexical-binding:t -*-
;; Copyright (C) 1992, 1994, 1997, 2000-2024 Free Software Foundation,
;; Inc.
;; Copyright (C) 1992-2024 Free Software Foundation, Inc.
;; Author: Eric S. Raymond <esr@thyrsus.com>
;; Maintainer: emacs-devel@gnu.org
@ -71,8 +70,8 @@
;; ;; Eric S. Raymond <esr@thyrsus.com>
;;
;; * Maintainer line --- should be a single name/address as in the Author
;; line, or an address only. If there is no maintainer
;; line, the person(s) in the Author field are presumed to be it.
;; line, or an address only. If there is no maintainer line, the person(s) in
;; the Author field are presumed to be it.
;; The idea behind these two fields is to be able to write a Lisp function
;; that does "send mail to the author" without having to mine the name out by
;; hand. Please be careful about surrounding the network address with <> if
@ -106,8 +105,10 @@
;; * Code line --- exists so Lisp can know where commentary and/or
;; change-log sections end.
;;
;; * Footer line --- marks end-of-file so it can be distinguished from
;; an expanded formfeed or the results of truncation.
;; * Footer line --- marks end-of-file so it can be distinguished
;; from an expanded formfeed or the results of truncation. This is
;; required for a package to be installable by package.el in Emacs 29.1
;; or earlier, but is optional in later versions.
;;; Code:
@ -467,6 +468,29 @@ package version (a string)."
(lm--prepare-package-dependencies
(package-read-from-string (mapconcat #'identity require-lines " "))))))
(defun lm-package-needs-footer-line (&optional file)
"Return non-nil if package in current buffer needs a footer line.
Footer lines (sometimes referred to as \"terminating comments\") look
like this:
;;; some-cool-package.el ends here
Such lines are required for a package to be installable by package.el in
Emacs 29.1 or earlier, but are optional in later versions. If the
package depends on a version of Emacs where package.el requires such
comments, or if no version requirement is specified, return non-nil.
If optional argument FILE is non-nil, use that file instead of the
current buffer."
(lm-with-file file
;; Starting in Emacs 30.1, avoid warning if the minimum Emacs
;; version is specified as 30.1 or later.
(let ((min-emacs (cadar (seq-filter (lambda (x) (eq (car x) 'emacs))
(lm-package-requires)))))
(or (null min-emacs)
(version< min-emacs "30.1")))))
(defun lm-keywords (&optional file)
"Return the keywords given in file FILE, or current buffer if FILE is nil.
The return is a `downcase'-ed string, or nil if no keywords
@ -533,7 +557,6 @@ absent, return nil."
(if (and page (string-match (rx bol "<" (+ nonl) ">" eol) page))
(substring page 1 -1)
page)))
(defalias 'lm-homepage #'lm-website) ; for backwards-compatibility
;;; Verification and synopses
@ -552,7 +575,7 @@ says display \"OK\" in temp buffer for files that have no problems.
Optional argument VERBOSE specifies verbosity level.
Optional argument NON-FSF-OK if non-nil means a non-FSF
copyright notice is allowed."
;; FIXME: Make obsolete in favor of checkdoc?
(declare (obsolete checkdoc "31.1"))
(interactive (list nil nil t))
(let* ((ret (and verbose "Ok"))
name)
@ -593,11 +616,12 @@ copyright notice is allowed."
((not (lm-code-start))
"Can't find a `Code' section marker")
((progn
(goto-char (point-max))
(not
(re-search-backward
(rx bol ";;; " (regexp name) " ends here")
nil t)))
(when (lm-package-needs-footer-line)
(goto-char (point-max))
(not
(re-search-backward
(rx bol ";;; " (regexp name) " ends here")
nil t))))
"Can't find the footer line")
((not (and (lm-copyright-mark) (lm-crack-copyright)))
"Can't find a valid copyright notice")
@ -663,6 +687,7 @@ Prompts for bug subject TOPIC. Leaves you in a mail buffer."
(define-obsolete-function-alias 'lm-code-mark #'lm-code-start "30.1")
(define-obsolete-function-alias 'lm-commentary-mark #'lm-commentary-start "30.1")
(define-obsolete-function-alias 'lm-history-mark #'lm-history-start "30.1")
(define-obsolete-function-alias 'lm-homepage #'lm-website "31.1")
(provide 'lisp-mnt)

View file

@ -37,7 +37,7 @@ most deeply nested form.
Normally a form is manually pushed onto the list at the beginning
of `byte-compile-form', etc., and manually popped off at its end.
This is to preserve the data in it in the event of a
condition-case handling a signaled error.")
`condition-case' handling a signaled error.")
(defmacro macroexp--with-extended-form-stack (expr &rest body)
"Evaluate BODY with EXPR pushed onto `byte-compile-form-stack'."

View file

@ -1161,6 +1161,7 @@ Signal an error if the entire string was not used."
(declare-function lm-keywords-list "lisp-mnt" (&optional file))
(declare-function lm-maintainers "lisp-mnt" (&optional file))
(declare-function lm-authors "lisp-mnt" (&optional file))
(declare-function lm-package-needs-footer-line "lisp-mnt" (&optional file))
(defun package-buffer-info ()
"Return a `package-desc' describing the package in the current buffer.
@ -1174,23 +1175,18 @@ boundaries."
(let ((file-name (match-string-no-properties 1))
(desc (match-string-no-properties 2))
(start (line-beginning-position)))
(require 'lisp-mnt)
;; This warning was added in Emacs 27.1, and should be removed at
;; the earliest in version 31.1. The idea is to phase out the
;; requirement for a "footer line" without unduly impacting users
;; on earlier Emacs versions. See Bug#26490 for more details.
(unless (search-forward (concat ";;; " file-name ".el ends here") nil 'move)
;; Starting in Emacs 30.1, avoid warning if the minimum Emacs
;; version is specified as 30.1 or later.
(let ((min-emacs (cadar (seq-filter (lambda (x) (eq (car x) 'emacs))
(lm-package-requires)))))
(when (or (null min-emacs)
(version< min-emacs "30.1"))
(lwarn '(package package-format) :warning
"Package lacks a terminating comment"))))
(when (lm-package-needs-footer-line)
(lwarn '(package package-format) :warning
"Package lacks a terminating comment")))
;; Try to include a trailing newline.
(forward-line)
(narrow-to-region start (point))
(require 'lisp-mnt)
;; Use some headers we've invented to drive the process.
(let* (;; Prefer Package-Version; if defined, the package author
;; probably wants us to use it. Otherwise try Version.

View file

@ -182,6 +182,9 @@ Usage example:
(read-multiple-choice--short-answers
prompt choices help-string show-help)))
(declare-function touch-screen-scroll "touch-screen.el")
(declare-function touch-screen-pinch "touch-screen.el")
(defun read-multiple-choice--short-answers (prompt choices help-string show-help)
(let* ((dialog-p (use-dialog-box-p))
(prompt-choices
@ -228,7 +231,10 @@ Usage example:
(when (setq command
(let ((current-key-remap-sequence
(vector tchar)))
(touch-screen-translate-touch nil)))
;; Provide an empty prompt so that it may
;; not repeatedly display and/or disable
;; the on-screen keyboard, or move point.
(touch-screen-translate-touch "")))
(setq command (if (> (length command) 0)
(aref command 0)
nil))
@ -243,9 +249,9 @@ Usage example:
;; Respond to scroll and pinch events as if RMC were
;; not in progress.
((eq (car-safe command) 'touchscreen-scroll)
(funcall #'touch-screen-scroll command))
(touch-screen-scroll command))
((eq (car-safe command) 'touchscreen-pinch)
(funcall #'touch-screen-pinch command))
(touch-screen-pinch command))
;; Prevent other touchscreen-generated events from
;; reaching the default conditional.
((memq (or (and (symbolp command) command)

View file

@ -158,20 +158,22 @@ removed."
(string-trim (replace-regexp-in-string blank " " string t t)
blank blank)))
(defun string-fill (string length)
"Try to word-wrap STRING so that no lines are longer than LENGTH.
Wrapping is done where there is whitespace. If there are
individual words in STRING that are longer than LENGTH, the
result will have lines that are longer than LENGTH."
;;;###autoload
(defun string-fill (string width)
"Try to word-wrap STRING so that it displays with lines no wider than WIDTH.
STRING is wrapped where there is whitespace in it. If there are
individual words in STRING that are wider than WIDTH, the result
will have lines that are wider than WIDTH."
(declare (important-return-value t))
(with-temp-buffer
(insert string)
(goto-char (point-min))
(let ((fill-column length)
(let ((fill-column width)
(adaptive-fill-mode nil))
(fill-region (point-min) (point-max)))
(buffer-string)))
;;;###autoload
(defun string-limit (string length &optional end coding-system)
"Return a substring of STRING that is (up to) LENGTH characters long.
If STRING is shorter than or equal to LENGTH characters, return the
@ -253,6 +255,7 @@ than this function."
(end (substring string (- (length string) length)))
(t (substring string 0 length)))))
;;;###autoload
(defun string-pad (string length &optional padding start)
"Pad STRING to LENGTH using PADDING.
If PADDING is nil, the space character is used. If not nil, it
@ -272,6 +275,7 @@ the string."
(start (concat (make-string pad-length (or padding ?\s)) string))
(t (concat string (make-string pad-length (or padding ?\s)))))))
;;;###autoload
(defun string-chop-newline (string)
"Remove the final newline (if any) from STRING."
(declare (pure t) (side-effect-free t))