commit fe6b8c91cb7a3c1959f7fb2b43f73cc7f7fc9fc3 (HEAD, refs/remotes/origin/master) Author: Paul Eggert Date: Wed Mar 25 18:32:19 2020 -0700 line-beginning-position args can be bignums * src/editfns.c (Fline_beginning_position, Fline_end_position): Do not restrict integer arguments to fixnums. diff --git a/src/editfns.c b/src/editfns.c index eb15566fb4..cbc1082b2c 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -725,18 +725,23 @@ boundaries, bind `inhibit-field-text-motion' to t. This function does not move point. */) (Lisp_Object n) { - ptrdiff_t charpos, bytepos; + ptrdiff_t charpos, bytepos, count; if (NILP (n)) - XSETFASTINT (n, 1); + count = 0; + else if (FIXNUMP (n)) + count = clip_to_bounds (-BUF_BYTES_MAX, XFIXNUM (n) - 1, BUF_BYTES_MAX); else - CHECK_FIXNUM (n); + { + CHECK_INTEGER (n); + count = NILP (Fnatnump (n)) ? -BUF_BYTES_MAX : BUF_BYTES_MAX; + } - scan_newline_from_point (XFIXNUM (n) - 1, &charpos, &bytepos); + scan_newline_from_point (count, &charpos, &bytepos); /* Return END constrained to the current input field. */ return Fconstrain_to_field (make_fixnum (charpos), make_fixnum (PT), - XFIXNUM (n) != 1 ? Qt : Qnil, + count != 0 ? Qt : Qnil, Qt, Qnil); } @@ -763,11 +768,14 @@ This function does not move point. */) ptrdiff_t orig = PT; if (NILP (n)) - XSETFASTINT (n, 1); + clipped_n = 1; + else if (FIXNUMP (n)) + clipped_n = clip_to_bounds (-BUF_BYTES_MAX, XFIXNUM (n), BUF_BYTES_MAX); else - CHECK_FIXNUM (n); - - clipped_n = clip_to_bounds (PTRDIFF_MIN + 1, XFIXNUM (n), PTRDIFF_MAX); + { + CHECK_INTEGER (n); + clipped_n = NILP (Fnatnump (n)) ? -BUF_BYTES_MAX : BUF_BYTES_MAX; + } end_pos = find_before_next_newline (orig, 0, clipped_n - (clipped_n <= 0), NULL); commit 98546d9c823db544b62bdba0bb388816ea6dd342 Author: Paul Eggert Date: Wed Mar 25 18:20:31 2020 -0700 Fix integer overflow in internal_self_insert * src/cmds.c (internal_self_insert): Avoid undefined behavior on integer overflow by using saturated add. diff --git a/src/cmds.c b/src/cmds.c index 5b98a09fda..c342cd88bd 100644 --- a/src/cmds.c +++ b/src/cmds.c @@ -451,7 +451,10 @@ internal_self_insert (int c, EMACS_INT n) string = concat2 (string, tem); } - replace_range (PT, PT + chars_to_delete, string, 1, 1, 1, 0); + ptrdiff_t to; + if (INT_ADD_WRAPV (PT, chars_to_delete, &to)) + to = PTRDIFF_MAX; + replace_range (PT, to, string, 1, 1, 1, 0); Fforward_char (make_fixnum (n)); } else if (n > 1) commit e4b6151ff119f36c64d3653b56f761fcdfe47fd3 Author: Paul Eggert Date: Wed Mar 25 17:40:57 2020 -0700 Fix integer overflow in forward-point * lisp/subr.el (forward-point): Rewrite in Lisp and move here ... * src/cmds.c (Fforward_point): ... from here. This fixes an integer overflow bug with (forward-point most-positive-fixnum). diff --git a/lisp/subr.el b/lisp/subr.el index 123557e736..70f33ee5bd 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1558,7 +1558,6 @@ be a list of the form returned by `event-start' and `event-end'." ;;;; Obsolescent names for functions. -(make-obsolete 'forward-point "use (+ (point) N) instead." "23.1") (make-obsolete 'buffer-has-markers-at nil "24.3") (make-obsolete 'invocation-directory "use the variable of the same name." @@ -1580,6 +1579,11 @@ be a list of the form returned by `event-start' and `event-end'." (make-obsolete 'string-as-multibyte "use `decode-coding-string'." "26.1") (make-obsolete 'string-make-multibyte "use `decode-coding-string'." "26.1") +(defun forward-point (n) + "Return buffer position N characters after (before if N negative) point." + (declare (obsolete "use (+ (point) N) instead." "23.1")) + (+ (point) n)) + (defun log10 (x) "Return (log X 10), the log base 10 of X." (declare (obsolete log "24.4")) diff --git a/src/cmds.c b/src/cmds.c index 5d7a45e65f..5b98a09fda 100644 --- a/src/cmds.c +++ b/src/cmds.c @@ -31,15 +31,6 @@ along with GNU Emacs. If not, see . */ static int internal_self_insert (int, EMACS_INT); -DEFUN ("forward-point", Fforward_point, Sforward_point, 1, 1, 0, - doc: /* Return buffer position N characters after (before if N negative) point. */) - (Lisp_Object n) -{ - CHECK_FIXNUM (n); - - return make_fixnum (PT + XFIXNUM (n)); -} - /* Add N to point; or subtract N if FORWARD is false. N defaults to 1. Validate the new location. Return nil. */ static Lisp_Object @@ -526,7 +517,6 @@ syms_of_cmds (void) This is run after inserting the character. */); Vpost_self_insert_hook = Qnil; - defsubr (&Sforward_point); defsubr (&Sforward_char); defsubr (&Sbackward_char); defsubr (&Sforward_line); commit d08c9472e821615da06f92756e49c271be8da7f1 Author: Mattias EngdegÄrd Date: Wed Mar 18 16:01:02 2020 +0100 Make compilation-mode regexp matching case-sensitive (bug#40119) The number of regexps is large, they are written independently of one another, and they frequently intersect. Using case-sensitive matching improves separation and performance, and is probably what everyone have being assuming was used by compilation-mode all along. * lisp/progmodes/compile.el (compilation-error-case-fold-search): New. (compilation-parse-errors): Bind case-fold-search to compilation-error-case-fold-search during matching. * etc/NEWS: Announce. diff --git a/etc/NEWS b/etc/NEWS index 1be5ad6acc..910d9fa2d2 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -196,6 +196,12 @@ key binding *** New user option 'gravatar-service' for host to query for gravatars. Defaults to Libravatar, with Unicornify and Gravatar as options. +** Compilation mode + +*** Regexp matching of messages is now case-sensitive by default. +The user option 'compilation-error-case-fold-search' can be set +for case-insensitive matching of messages. + * New Modes and Packages in Emacs 28.1 diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 455f181f50..f4532b7edb 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -646,6 +646,14 @@ matched file names, and weeding out false positives." :link `(file-link :tag "example file" ,(expand-file-name "compilation.txt" data-directory))) +(defcustom compilation-error-case-fold-search nil + "If non-nil, use case-insensitive matching of compilation errors +by the regexps of `compilation-error-regexp-alist' and +`compilation-error-regexp-alist-alist'. +If nil, matching is case-sensitive." + :type 'boolean + :version "28.1") + ;;;###autoload(put 'compilation-directory 'safe-local-variable 'stringp) (defvar compilation-directory nil "Directory to restore to when doing `recompile'.") @@ -1435,7 +1443,8 @@ to `compilation-error-regexp-alist' if RULES is nil." (if (symbolp item) (setq item (cdr (assq item compilation-error-regexp-alist-alist)))) - (let ((file (nth 1 item)) + (let ((case-fold-search compilation-error-case-fold-search) + (file (nth 1 item)) (line (nth 2 item)) (col (nth 3 item)) (type (nth 4 item)) commit 1060a6401b8ee9aaa4b2056025402e7fa1ad1643 Author: Paul Eggert Date: Wed Mar 25 13:39:21 2020 -0700 Update from gnulib This incorporates: 2020-03-25 getopt-posix: port __GETOPT_PREFIX to macOS 2020-03-22 acl-permissions: Improve autoconf macro * lib/getopt-pfx-core.h, m4/acl.m4: Copy from Gnulib. diff --git a/lib/getopt-pfx-core.h b/lib/getopt-pfx-core.h index da0a6d0c3c..ec545c1b51 100644 --- a/lib/getopt-pfx-core.h +++ b/lib/getopt-pfx-core.h @@ -48,6 +48,14 @@ # define optind __GETOPT_ID (optind) # define optopt __GETOPT_ID (optopt) +/* Work around a a problem on macOS, which declares getopt with a + trailing __DARWIN_ALIAS(getopt) that would expand to something like + __asm("_" "rpl_getopt" "$UNIX2003") were it not for the following + hack to suppress the macOS declaration . */ +# ifdef __APPLE__ +# define _GETOPT +# endif + /* The system's getopt.h may have already included getopt-core.h to declare the unprefixed identifiers. Undef _GETOPT_CORE_H so that getopt-core.h declares them with prefixes. */ diff --git a/m4/acl.m4 b/m4/acl.m4 index e459451ae3..a3dcf9357b 100644 --- a/m4/acl.m4 +++ b/m4/acl.m4 @@ -1,5 +1,5 @@ # acl.m4 - check for access control list (ACL) primitives -# serial 23 +# serial 24 # Copyright (C) 2002, 2004-2020 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -139,7 +139,7 @@ int type = ACL_TYPE_EXTENDED;]])], AC_MSG_WARN([AC_PACKAGE_NAME will be built without ACL support.]) fi fi - test $gl_need_lib_has_acl && LIB_HAS_ACL=$LIB_ACL + test -n "$gl_need_lib_has_acl" && LIB_HAS_ACL=$LIB_ACL AC_SUBST([LIB_ACL]) AC_DEFINE_UNQUOTED([USE_ACL], [$use_acl], [Define to nonzero if you want access control list support.]) commit 2ea87d6c6f1161801402958bdc6b6a2e6c41c6b8 Author: Paul Eggert Date: Wed Mar 25 13:37:23 2020 -0700 Pacify --enable-gcc-warnings for lock_file * src/filelock.c (lock_file): Pacify gcc -Wmaybe-uninitialized after recent change to this function. diff --git a/src/filelock.c b/src/filelock.c index 2b734ee00d..ee46e0e3e0 100644 --- a/src/filelock.c +++ b/src/filelock.c @@ -661,7 +661,7 @@ void lock_file (Lisp_Object fn) { Lisp_Object orig_fn, encoded_fn; - char *lfname; + char *lfname = NULL; lock_info_type lock_info; USE_SAFE_ALLOCA; @@ -686,21 +686,15 @@ lock_file (Lisp_Object fn) /* See if this file is visited and has changed on disk since it was visited. */ - { - register Lisp_Object subject_buf; - - subject_buf = get_truename_buffer (orig_fn); - - if (!NILP (subject_buf) - && NILP (Fverify_visited_file_modtime (subject_buf)) - && !NILP (Ffile_exists_p (fn)) - && (!create_lockfiles || current_lock_owner (NULL, lfname) != -2)) - call1 (intern ("userlock--ask-user-about-supersession-threat"), fn); - - } + Lisp_Object subject_buf = get_truename_buffer (orig_fn); + if (!NILP (subject_buf) + && NILP (Fverify_visited_file_modtime (subject_buf)) + && !NILP (Ffile_exists_p (fn)) + && !(lfname && current_lock_owner (NULL, lfname) == -2)) + call1 (intern ("userlock--ask-user-about-supersession-threat"), fn); /* Don't do locking if the user has opted out. */ - if (create_lockfiles) + if (lfname) { /* Try to lock the lock. FIXME: This ignores errors when lock_if_free returns a positive errno value. */ @@ -860,7 +854,7 @@ syms_of_filelock (void) The name of the (per-buffer) lockfile is constructed by prepending a '.#' to the name of the file being locked. See also `lock-buffer' and Info node `(emacs)Interlocking'. */); - create_lockfiles = 1; + create_lockfiles = true; defsubr (&Sunlock_buffer); defsubr (&Slock_buffer); commit 11b37a4167d2eee4cb1f467a7f8ebaa6c8667ce9 Author: Stefan Monnier Date: Wed Mar 25 14:09:48 2020 -0400 * lisp/textmodes/conf-mode.el (conf-mode): Fix last change `delay-mode-hooks` cannot be tested from within `define-derived-mode` because it's always non-nil in there, so arrange to test it before we enter the body. diff --git a/lisp/textmodes/conf-mode.el b/lisp/textmodes/conf-mode.el index 79312757a2..722fc0a313 100644 --- a/lisp/textmodes/conf-mode.el +++ b/lisp/textmodes/conf-mode.el @@ -405,27 +405,31 @@ See also `conf-space-mode', `conf-colon-mode', `conf-javaprop-mode', \\{conf-mode-map}" - ;; `conf-mode' plays two roles: it's the parent of several sub-modes - ;; but it's also the function that chooses between those submodes. - ;; To tell the difference between those two cases where the function - ;; might be called, we check `delay-mode-hooks'. - ;; (adopted from tex-mode.el) - (if (not delay-mode-hooks) - (funcall (conf--guess-mode)) - - (setq-local font-lock-defaults '(conf-font-lock-keywords nil t nil nil)) - ;; Let newcomment.el decide this for itself. - ;; (setq-local comment-use-syntax t) - (setq-local parse-sexp-ignore-comments t) - (setq-local outline-regexp "[ \t]*\\(?:\\[\\|.+[ \t\n]*{\\)") - (setq-local outline-heading-end-regexp "[\n}]") - (setq-local outline-level #'conf-outline-level) - (setq-local imenu-generic-expression - '(("Parameters" "^[ \t]*\\(.+?\\)[ \t]*=" 1) - ;; [section] - (nil "^[ \t]*\\[[ \t]*\\(.+\\)[ \t]*\\]" 1) - ;; section { ... } - (nil "^[ \t]*\\([^=:{} \t\n][^=:{}\n]+\\)[ \t\n]*{" 1))))) + (setq-local font-lock-defaults '(conf-font-lock-keywords nil t nil nil)) + ;; Let newcomment.el decide this for itself. + ;; (setq-local comment-use-syntax t) + (setq-local parse-sexp-ignore-comments t) + (setq-local outline-regexp "[ \t]*\\(?:\\[\\|.+[ \t\n]*{\\)") + (setq-local outline-heading-end-regexp "[\n}]") + (setq-local outline-level #'conf-outline-level) + (setq-local imenu-generic-expression + '(("Parameters" "^[ \t]*\\(.+?\\)[ \t]*=" 1) + ;; [section] + (nil "^[ \t]*\\[[ \t]*\\(.+\\)[ \t]*\\]" 1) + ;; section { ... } + (nil "^[ \t]*\\([^=:{} \t\n][^=:{}\n]+\\)[ \t\n]*{" 1)))) + +;; `conf-mode' plays two roles: it's the parent of several sub-modes +;; but it's also the function that chooses between those submodes. +;; To tell the difference between those two cases where the function +;; might be called, we check `delay-mode-hooks'. +;; (inspired from tex-mode.el) +(advice-add 'conf-mode :around + (lambda (orig-fun) + "Redirect to one of the submodes when called directly." + (funcall (if delay-mode-hooks orig-fun (conf--guess-mode))))) + + (defun conf-mode-initialize (comment &optional font-lock) "Initializations for sub-modes of `conf-mode'. commit 74489bdcb663722b1747f6a3f81f1f111c751f04 Author: Eli Zaretskii Date: Wed Mar 25 16:18:37 2020 +0200 Improve the UI of 'list-timers' * lisp/emacs-lisp/timer-list.el (list-timers): Display both "Next" and "Repeat" in units of seconds, for consistency. (timer-list-mode): Add help-echo to column headers. diff --git a/lisp/emacs-lisp/timer-list.el b/lisp/emacs-lisp/timer-list.el index 4fa31f3267..4cebd739c3 100644 --- a/lisp/emacs-lisp/timer-list.el +++ b/lisp/emacs-lisp/timer-list.el @@ -52,7 +52,7 @@ (let ((repeat (aref timer 4))) (cond ((numberp repeat) - (format "%.2f" (/ repeat 60))) + (format "%.1f" repeat)) ((null repeat) "-") (t @@ -91,7 +91,18 @@ (setq header-line-format (concat (propertize " " 'display '(space :align-to 0)) (format "%4s %10s %8s %s" - "Idle" "Next" "Repeat" "Function")))) + (propertize "Idle" + 'mouse-face 'highlight + 'help-echo "* marks idle timers") + (propertize "Next" + 'mouse-face 'highlight + 'help-echo "Time in sec till next invocation") + (propertize "Repeat" + 'mouse-face 'highlight + 'help-echo "Symbol: repeat; number: repeat interval in sec") + (propertize "Function" + 'mouse-face 'highlight + 'help-echo "Function called by timer"))))) (defun timer-list-cancel () "Cancel the timer on the line under point." diff --git a/lisp/ls-lisp.el b/lisp/ls-lisp.el index 2952242c25..8851522bbd 100644 --- a/lisp/ls-lisp.el +++ b/lisp/ls-lisp.el @@ -435,9 +435,9 @@ not contain `d', so that a full listing is expected." ;; text. But if the listing is empty, as e.g. in empty ;; directories with -a removed from switches, point will be ;; before the inserted text, and dired-insert-directory will - ;; not indent the listing correctly. Going to the end of the - ;; buffer fixes that. - (unless files (goto-char (point-max))) + ;; not indent the listing correctly. Getting past the + ;; inserted text solves this. + (unless (cdr total-line) (forward-line 2)) (if (memq ?R switches) ;; List the contents of all directories recursively. ;; cadr of each element of `file-alist' is t for commit b85d29f4fd555eda34ffba5b9a6006b5758e2955 Merge: ed37f038bd ce141686d2 Author: Eli Zaretskii Date: Wed Mar 25 15:59:19 2020 +0200 Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs commit ed37f038bd6d99fbe0c746d5773c315fed0e3dad Author: Eli Zaretskii Date: Tue Mar 24 16:56:10 2020 +0200 Fix sending signals and EOF to the inferior process in gdb-mi.el * lisp/progmodes/gdb-mi.el (gdb-io-interrupt, gdb-io-quit) (gdb-io-stop, gdb-io-eof): Send signal/EOF to the inferior process, not to GDB. (Bug#40210) diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index ea3b1b816a..7fb3687391 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el @@ -1729,25 +1729,25 @@ this trigger is subscribed to `gdb-buf-publisher' and called with "Interrupt the program being debugged." (interactive) (interrupt-process - (get-buffer-process gud-comint-buffer) comint-ptyp)) + (get-buffer-process (gdb-get-buffer-create 'gdb-inferior-io)) comint-ptyp)) (defun gdb-io-quit () "Send quit signal to the program being debugged." (interactive) (quit-process - (get-buffer-process gud-comint-buffer) comint-ptyp)) + (get-buffer-process (gdb-get-buffer-create 'gdb-inferior-io)) comint-ptyp)) (defun gdb-io-stop () "Stop the program being debugged." (interactive) (stop-process - (get-buffer-process gud-comint-buffer) comint-ptyp)) + (get-buffer-process (gdb-get-buffer-create 'gdb-inferior-io)) comint-ptyp)) (defun gdb-io-eof () "Send end-of-file to the program being debugged." (interactive) (process-send-eof - (get-buffer-process gud-comint-buffer))) + (get-buffer-process (gdb-get-buffer-create 'gdb-inferior-io)))) (defun gdb-clear-inferior-io () (with-current-buffer (gdb-get-buffer-create 'gdb-inferior-io)