commit 36bf4fa0b3ceef56a89ca657ce82bdc7ea10203f (HEAD, refs/remotes/origin/master) Author: Stephen Berman Date: Fri Aug 21 22:41:48 2020 +0200 Fix several todo-mode.el editing bugs (bug#42976) * lisp/calendar/todo-mode.el (todo-insert-item--basic): Ensure the target todo file is in todo-mode. (todo-edit-item--text): When editing a done item comment, prevent clobbering match data on finishing the edit. (todo-edit-item--header): Ensure that decrementing the month of the date header works for intervals greater than a year, and when incrementing or decrementing the month crosses one or more years, adjust the year as needed. (todo-read-category): If we're outside of todo-mode and there is a current todo file, use it; otherwise, use the default todo file. * test/lisp/calendar/todo-mode-tests.el (todo-test-edit-item-date-month): New test. * test/lisp/calendar/todo-mode-resources/todo-test-1.todo: Modify to accommodate new test. diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el index a49f428a3c..4f513d3386 100644 --- a/lisp/calendar/todo-mode.el +++ b/lisp/calendar/todo-mode.el @@ -1937,11 +1937,13 @@ their associated keys and their effects." (find-file-noselect file 'nowarn) (set-window-buffer (selected-window) (set-buffer (find-buffer-visiting file))) - ;; If this command was invoked outside of a Todo mode buffer, - ;; the call to todo-current-category above returned nil. If - ;; we just entered Todo mode now, then cat was set to the - ;; file's first category, but if todo-mode was already - ;; enabled, cat did not get set, so we have to do that. + ;; If FILE is not in Todo mode, set it now, which also sets + ;; CAT to the file's first category. + (unless (derived-mode-p 'todo-mode) (todo-mode)) + ;; But if FILE was already in todo-mode and the item insertion + ;; command was invoked outside of a Todo mode buffer, the + ;; above calls to todo-current-category returned nil, so we + ;; have to explicitly set CAT to the current category. (unless cat (setq cat (todo-current-category))) (setq todo-current-todo-file file) @@ -2169,7 +2171,9 @@ the item at point." (if comment-delete (when (todo-y-or-n-p "Delete comment? ") (delete-region (match-beginning 0) (match-end 0))) - (replace-match (read-string prompt (cons (match-string 1) 1)) + (replace-match (save-match-data + (read-string prompt + (cons (match-string 1) 1))) nil nil nil 1)) (if comment-delete (user-error "There is no comment to delete") @@ -2348,25 +2352,35 @@ made in the number or names of categories." ((or (string= omonth "*") (= mm 13)) (user-error "Cannot increment *")) (t - (let ((mminc (+ mm inc (if (< inc 0) 12 0)))) - ;; Increment or decrement month by INC - ;; modulo 12. - (setq mm (% mminc 12)) - ;; If result is 0, make month December. - (setq mm (if (= mm 0) 12 (abs mm))) + (let* ((mmo mm) + ;; Change by 12 or more months? + (bigincp (>= (abs inc) 12)) + ;; Month number is in range 1..12. + (mminc (+ mm (% inc 12))) + (mm (% (+ mminc 12) 12)) + ;; 12n mod 12 = 0, so 0 is December. + (mm (if (= mm 0) 12 mm)) + ;; Does change in month cross year? + (mmcmp (cond ((< inc 0) (> mm mmo)) + ((> inc 0) (< mm mmo)))) + (yyadjust (if bigincp + (+ (abs (/ inc 12)) + (if mmcmp 1 0)) + 1))) ;; Adjust year if necessary. - (setq year (or (and (cond ((> mminc 12) - (+ yy (/ mminc 12))) - ((< mminc 1) - (- yy (/ mminc 12) 1)) - (t yy)) - (number-to-string yy)) - oyear))) - ;; Return the changed numerical month as - ;; a string or the corresponding month name. - (if omonth - (number-to-string mm) - (aref tma-array (1- mm)))))) + (setq yy (cond ((and (< inc 0) + (or mmcmp bigincp)) + (- yy yyadjust)) + ((and (> inc 0) + (or mmcmp bigincp)) + (+ yy yyadjust)) + (t yy))) + (setq year (number-to-string yy)) + ;; Return the changed numerical month as + ;; a string or the corresponding month name. + (if omonth + (number-to-string mm) + (aref tma-array (1- mm))))))) ;; Since the number corresponding to the arbitrary ;; month name "*" is out of the range of ;; calendar-last-day-of-month, set it to 1 @@ -5923,8 +5937,15 @@ categories from `todo-category-completions-files'." (todo-absolute-file-name (let ((files (mapcar #'todo-short-file-name catfil))) (completing-read (format str cat) files))))))) - ;; Default to the current file. - (unless file0 (setq file0 todo-current-todo-file)) + ;; When called without arg FILE, use fallback todo file. + (unless file0 (setq file0 (or todo-current-todo-file + ;; If we're outside of todo-mode + ;; but there is a current todo + ;; file, use it. + todo-global-current-todo-file + ;; Else, use the default todo file. + (todo-absolute-file-name + todo-default-todo-file)))) ;; First validate only a name passed interactively from ;; todo-add-category, which must be of a nonexistent category. (unless (and (assoc cat categories) (not add)) diff --git a/test/lisp/calendar/todo-mode-resources/todo-test-1.todo b/test/lisp/calendar/todo-mode-resources/todo-test-1.todo index 598d487cad..557134fd45 100644 --- a/test/lisp/calendar/todo-mode-resources/todo-test-1.todo +++ b/test/lisp/calendar/todo-mode-resources/todo-test-1.todo @@ -1,4 +1,4 @@ -(("testcat1" . [2 0 2 1]) ("testcat2" . [3 0 1 1]) ("testcat3" . [0 0 0 0])) +(("testcat1" . [2 0 2 1]) ("testcat2" . [3 0 1 1]) ("testcat3" . [0 0 0 0]) ("testcat4" . [1 0 0 0])) --==-- testcat1 [May 29, 2017] testcat1 item3 has more than one line @@ -18,3 +18,7 @@ --==-- testcat3 ==--== DONE +--==-- testcat4 +[Jan 1, 2020] testcat4 item1 + +==--== DONE diff --git a/test/lisp/calendar/todo-mode-tests.el b/test/lisp/calendar/todo-mode-tests.el index d65f94d4f3..a19612ee56 100644 --- a/test/lisp/calendar/todo-mode-tests.el +++ b/test/lisp/calendar/todo-mode-tests.el @@ -848,6 +848,52 @@ should display the previously current (or default) todo file." (should (equal todo-current-todo-file todo-test-file-1)) (delete-file (concat file "~"))))) +(ert-deftest todo-test-edit-item-date-month () + "Test incrementing and decrementing the month of an item's date. +If the change in month crosses a year boundary, the year of the +item's date should be adjusted accordingly." + (with-todo-test + (todo-test--show 4) + (let ((current-prefix-arg t) ; For todo-edit-item--header. + (get-date (lambda () + (save-excursion + (todo-date-string-matcher (line-end-position)) + (buffer-substring-no-properties (match-beginning 1) + (match-end 0)))))) + (should (equal (funcall get-date) "Jan 1, 2020")) + (todo-edit-item--header 'month 0) + (should (equal (funcall get-date) "Jan 1, 2020")) + (todo-edit-item--header 'month 1) + (should (equal (funcall get-date) "Feb 1, 2020")) + (todo-edit-item--header 'month -1) + (should (equal (funcall get-date) "Jan 1, 2020")) + (todo-edit-item--header 'month -1) + (should (equal (funcall get-date) "Dec 1, 2019")) + (todo-edit-item--header 'month 1) + (should (equal (funcall get-date) "Jan 1, 2020")) + (todo-edit-item--header 'month 12) + (should (equal (funcall get-date) "Jan 1, 2021")) + (todo-edit-item--header 'month -12) + (should (equal (funcall get-date) "Jan 1, 2020")) + (todo-edit-item--header 'month -13) + (should (equal (funcall get-date) "Dec 1, 2018")) + (todo-edit-item--header 'month 7) + (should (equal (funcall get-date) "Jul 1, 2019")) + (todo-edit-item--header 'month 6) + (should (equal (funcall get-date) "Jan 1, 2020")) + (todo-edit-item--header 'month 23) + (should (equal (funcall get-date) "Dec 1, 2021")) + (todo-edit-item--header 'month -23) + (should (equal (funcall get-date) "Jan 1, 2020")) + (todo-edit-item--header 'month 24) + (should (equal (funcall get-date) "Jan 1, 2022")) + (todo-edit-item--header 'month -24) + (should (equal (funcall get-date) "Jan 1, 2020")) + (todo-edit-item--header 'month 25) + (should (equal (funcall get-date) "Feb 1, 2022")) + (todo-edit-item--header 'month -25) + (should (equal (funcall get-date) "Jan 1, 2020")) + ))) (provide 'todo-mode-tests) ;;; todo-mode-tests.el ends here commit 3e10174fb65f4eb601b1921271bdcf10c933b879 Author: Paul Eggert Date: Fri Aug 21 12:19:18 2020 -0700 Update from Gnulib This incorporates: 2020-08-20 sigabbrev_np: New module 2020-08-20 stdalign: Fix 32-bit test failures clang versions < 8 2020-08-17 careadlinkat: speedup for GCC 10 with GCC_LINT 2020-08-17 Assume autoconf >= 2.64 * build-aux/config.guess, build-aux/config.sub, lib/careadlinkat.c: * lib/stdalign.in.h, lib/string.in.h, m4/std-gnu11.m4, m4/string_h.m4: Copy from Gnulib. * lib/gnulib.mk.in: Regenerate. diff --git a/build-aux/config.guess b/build-aux/config.guess index e94095c5fb..9aff91cfd0 100755 --- a/build-aux/config.guess +++ b/build-aux/config.guess @@ -2,7 +2,7 @@ # Attempt to guess a canonical system name. # Copyright 1992-2020 Free Software Foundation, Inc. -timestamp='2020-07-12' +timestamp='2020-08-17' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -404,7 +404,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. - if [ "$CC_FOR_BUILD" != no_compiler_found ]; then + if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null @@ -544,10 +544,10 @@ EOF AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ] + if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 then - if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \ - [ "$TARGET_BINARY_INTERFACE"x = x ] + if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ + test "$TARGET_BINARY_INTERFACE"x = x then echo m88k-dg-dgux"$UNAME_RELEASE" else @@ -580,7 +580,7 @@ EOF echo i386-ibm-aix exit ;; ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then + if test -x /usr/bin/oslevel ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" @@ -620,7 +620,7 @@ EOF else IBM_ARCH=powerpc fi - if [ -x /usr/bin/lslpp ] ; then + if test -x /usr/bin/lslpp ; then IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else @@ -655,7 +655,7 @@ EOF 9000/31?) HP_ARCH=m68000 ;; 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then + if test -x /usr/bin/getconf; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "$sc_cpu_version" in @@ -669,7 +669,7 @@ EOF esac ;; esac fi - if [ "$HP_ARCH" = "" ]; then + if test "$HP_ARCH" = ""; then set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" @@ -708,7 +708,7 @@ EOF test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac - if [ "$HP_ARCH" = hppa2.0w ] + if test "$HP_ARCH" = hppa2.0w then set_cc_for_build @@ -782,7 +782,7 @@ EOF echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then + if test -x /usr/sbin/sysversion ; then echo "$UNAME_MACHINE"-unknown-osf1mk else echo "$UNAME_MACHINE"-unknown-osf1 @@ -1097,7 +1097,7 @@ EOF x86_64:Linux:*:*) set_cc_for_build LIBCABI=$LIBC - if [ "$CC_FOR_BUILD" != no_compiler_found ]; then + if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_X32 >/dev/null @@ -1294,7 +1294,7 @@ EOF echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then + if test -d /usr/nec; then echo mips-nec-sysv"$UNAME_RELEASE" else echo mips-unknown-sysv"$UNAME_RELEASE" @@ -1359,7 +1359,7 @@ EOF else set_cc_for_build fi - if [ "$CC_FOR_BUILD" != no_compiler_found ]; then + if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null diff --git a/build-aux/config.sub b/build-aux/config.sub index 3d9a8dc3d5..0753e30845 100755 --- a/build-aux/config.sub +++ b/build-aux/config.sub @@ -2,7 +2,7 @@ # Configuration validation subroutine script. # Copyright 1992-2020 Free Software Foundation, Inc. -timestamp='2020-07-10' +timestamp='2020-08-17' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -1278,7 +1278,7 @@ esac # Decode manufacturer-specific aliases for certain operating systems. -if [ x$basic_os != x ] +if test x$basic_os != x then # First recognize some ad-hoc caes, or perhaps split kernel-os, or else just diff --git a/lib/careadlinkat.c b/lib/careadlinkat.c index 1aa04363da..e43aa42d5c 100644 --- a/lib/careadlinkat.c +++ b/lib/careadlinkat.c @@ -38,66 +38,41 @@ #include "allocator.h" -/* Assuming the current directory is FD, get the symbolic link value - of FILENAME as a null-terminated string and put it into a buffer. - If FD is AT_FDCWD, FILENAME is interpreted relative to the current - working directory, as in openat. - - If the link is small enough to fit into BUFFER put it there. - BUFFER's size is BUFFER_SIZE, and BUFFER can be null - if BUFFER_SIZE is zero. - - If the link is not small, put it into a dynamically allocated - buffer managed by ALLOC. It is the caller's responsibility to free - the returned value if it is nonnull and is not BUFFER. A null - ALLOC stands for the standard allocator. - - The PREADLINKAT function specifies how to read links. It operates - like POSIX readlinkat() - - but can assume that its first argument is the same as FD. - - If successful, return the buffer address; otherwise return NULL and - set errno. */ - -char * -careadlinkat (int fd, char const *filename, +enum { STACK_BUF_SIZE = 1024 }; + +/* Act like careadlinkat (see below), with an additional argument + STACK_BUF that can be used as temporary storage. + + If GCC_LINT is defined, do not inline this function with GCC 10.1 + and later, to avoid creating a pointer to the stack that GCC + -Wreturn-local-addr incorrectly complains about. See: + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93644 + Although the noinline attribute can hurt performance a bit, no better way + to pacify GCC is known; even an explicit #pragma does not pacify GCC. + When the GCC bug is fixed this workaround should be limited to the + broken GCC versions. */ +#if (defined GCC_LINT || defined lint) && _GL_GNUC_PREREQ (10, 1) +__attribute__ ((__noinline__)) +#endif +static char * +readlink_stk (int fd, char const *filename, char *buffer, size_t buffer_size, struct allocator const *alloc, - ssize_t (*preadlinkat) (int, char const *, char *, size_t)) + ssize_t (*preadlinkat) (int, char const *, char *, size_t), + char stack_buf[STACK_BUF_SIZE]) { char *buf; size_t buf_size; size_t buf_size_max = SSIZE_MAX < SIZE_MAX ? (size_t) SSIZE_MAX + 1 : SIZE_MAX; - char stack_buf[1024]; - -#if (defined GCC_LINT || defined lint) && _GL_GNUC_PREREQ (10, 1) - /* Pacify preadlinkat without creating a pointer to the stack - that a broken gcc -Wreturn-local-addr would cry wolf about. See: - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95044 - This workaround differs from the mainline code, but - no other way to pacify GCC 10.1.0 is known; even an explicit - #pragma does not pacify GCC. When the GCC bug is fixed this - workaround should be limited to the broken GCC versions. */ -# define WORK_AROUND_GCC_BUG_95044 -#endif if (! alloc) alloc = &stdlib_allocator; if (!buffer) { -#ifdef WORK_AROUND_GCC_BUG_95044 - buffer = alloc->allocate (sizeof stack_buf); -#else - /* Allocate the initial buffer on the stack. This way, in the - common case of a symlink of small size, we get away with a - single small malloc() instead of a big malloc() followed by a - shrinking realloc(). */ buffer = stack_buf; -#endif - buffer_size = sizeof stack_buf; + buffer_size = STACK_BUF_SIZE; } buf = buffer; @@ -172,3 +147,44 @@ careadlinkat (int fd, char const *filename, errno = ENOMEM; return NULL; } + + +/* Assuming the current directory is FD, get the symbolic link value + of FILENAME as a null-terminated string and put it into a buffer. + If FD is AT_FDCWD, FILENAME is interpreted relative to the current + working directory, as in openat. + + If the link is small enough to fit into BUFFER put it there. + BUFFER's size is BUFFER_SIZE, and BUFFER can be null + if BUFFER_SIZE is zero. + + If the link is not small, put it into a dynamically allocated + buffer managed by ALLOC. It is the caller's responsibility to free + the returned value if it is nonnull and is not BUFFER. A null + ALLOC stands for the standard allocator. + + The PREADLINKAT function specifies how to read links. It operates + like POSIX readlinkat() + + but can assume that its first argument is the same as FD. + + If successful, return the buffer address; otherwise return NULL and + set errno. */ + +char * +careadlinkat (int fd, char const *filename, + char *buffer, size_t buffer_size, + struct allocator const *alloc, + ssize_t (*preadlinkat) (int, char const *, char *, size_t)) +{ + /* Allocate the initial buffer on the stack. This way, in the + common case of a symlink of small size, we get away with a + single small malloc instead of a big malloc followed by a + shrinking realloc. + + If GCC -Wreturn-local-addr warns about this buffer, the warning + is bogus; see readlink_stk. */ + char stack_buf[STACK_BUF_SIZE]; + return readlink_stk (fd, filename, buffer, buffer_size, alloc, + preadlinkat, stack_buf); +} diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in index 7b4fc74219..78b4542d80 100644 --- a/lib/gnulib.mk.in +++ b/lib/gnulib.mk.in @@ -424,6 +424,7 @@ GNULIB_SECURE_GETENV = @GNULIB_SECURE_GETENV@ GNULIB_SELECT = @GNULIB_SELECT@ GNULIB_SETENV = @GNULIB_SETENV@ GNULIB_SETHOSTNAME = @GNULIB_SETHOSTNAME@ +GNULIB_SIGABBREV_NP = @GNULIB_SIGABBREV_NP@ GNULIB_SIGACTION = @GNULIB_SIGACTION@ GNULIB_SIGNAL_H_SIGPIPE = @GNULIB_SIGNAL_H_SIGPIPE@ GNULIB_SIGPROCMASK = @GNULIB_SIGPROCMASK@ @@ -644,6 +645,7 @@ HAVE_SECURE_GETENV = @HAVE_SECURE_GETENV@ HAVE_SETENV = @HAVE_SETENV@ HAVE_SETHOSTNAME = @HAVE_SETHOSTNAME@ HAVE_SETSTATE = @HAVE_SETSTATE@ +HAVE_SIGABBREV_NP = @HAVE_SIGABBREV_NP@ HAVE_SIGACTION = @HAVE_SIGACTION@ HAVE_SIGHANDLER_T = @HAVE_SIGHANDLER_T@ HAVE_SIGINFO_T = @HAVE_SIGINFO_T@ @@ -2843,6 +2845,7 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's/@''GNULIB_STRTOK_R''@/$(GNULIB_STRTOK_R)/g' \ -e 's/@''GNULIB_STRERROR''@/$(GNULIB_STRERROR)/g' \ -e 's/@''GNULIB_STRERROR_R''@/$(GNULIB_STRERROR_R)/g' \ + -e 's/@''GNULIB_SIGABBREV_NP''@/$(GNULIB_SIGABBREV_NP)/g' \ -e 's/@''GNULIB_STRSIGNAL''@/$(GNULIB_STRSIGNAL)/g' \ -e 's/@''GNULIB_STRVERSCMP''@/$(GNULIB_STRVERSCMP)/g' \ < $(srcdir)/string.in.h | \ @@ -2865,6 +2868,7 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \ -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \ -e 's|@''HAVE_DECL_STRERROR_R''@|$(HAVE_DECL_STRERROR_R)|g' \ + -e 's|@''HAVE_SIGABBREV_NP''@|$(HAVE_SIGABBREV_NP)|g' \ -e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \ -e 's|@''HAVE_STRVERSCMP''@|$(HAVE_STRVERSCMP)|g' \ -e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \ diff --git a/lib/stdalign.in.h b/lib/stdalign.in.h index e4809b401f..b5b63e53f1 100644 --- a/lib/stdalign.in.h +++ b/lib/stdalign.in.h @@ -54,10 +54,12 @@ #undef _Alignof /* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023 - . */ + . + clang versions < 8.0.0 have the same bug. */ #if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \ || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \ - && !defined __clang__)) + && !defined __clang__) \ + || (defined __clang__ && __clang_major__ < 8)) # ifdef __cplusplus # if 201103 <= __cplusplus # define _Alignof(type) alignof (type) diff --git a/lib/string.in.h b/lib/string.in.h index 7d83668f6e..5134e11289 100644 --- a/lib/string.in.h +++ b/lib/string.in.h @@ -1045,6 +1045,21 @@ _GL_WARN_ON_USE (strerror_r, "strerror_r is unportable - " # endif #endif +/* Return an abbreviation string for the signal number SIG. */ +#if @GNULIB_SIGABBREV_NP@ +# if ! @HAVE_SIGABBREV_NP@ +_GL_FUNCDECL_SYS (sigabbrev_np, const char *, (int sig)); +# endif +_GL_CXXALIAS_SYS (sigabbrev_np, const char *, (int sig)); +_GL_CXXALIASWARN (sigabbrev_np); +#elif defined GNULIB_POSIXCHECK +# undef sigabbrev_np +# if HAVE_RAW_DECL_SIGABBREV_NP +_GL_WARN_ON_USE (sigabbrev_np, "sigabbrev_np is unportable - " + "use gnulib module sigabbrev_np for portability"); +# endif +#endif + #if @GNULIB_STRSIGNAL@ # if @REPLACE_STRSIGNAL@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) diff --git a/m4/std-gnu11.m4 b/m4/std-gnu11.m4 index c1ec624b3b..db833d820f 100644 --- a/m4/std-gnu11.m4 +++ b/m4/std-gnu11.m4 @@ -70,7 +70,7 @@ _AS_ECHO_LOG([checking for _AC_LANG compiler version]) set X $ac_compile ac_compiler=$[2] for ac_option in --version -v -V -qversion -version; do - m4_ifdef([_AC_DO_LIMIT],[_AC_DO_LIMIT],[_AC_DO])([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD]) + _AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD]) done m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl @@ -135,7 +135,7 @@ _AS_ECHO_LOG([checking for _AC_LANG compiler version]) set X $ac_compile ac_compiler=$[2] for ac_option in --version -v -V -qversion; do - m4_ifdef([_AC_DO_LIMIT],[_AC_DO_LIMIT],[_AC_DO])([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD]) + _AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD]) done m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl diff --git a/m4/string_h.m4 b/m4/string_h.m4 index 516b346b31..d519beaa59 100644 --- a/m4/string_h.m4 +++ b/m4/string_h.m4 @@ -5,7 +5,7 @@ # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 24 +# serial 25 # Written by Paul Eggert. @@ -28,7 +28,7 @@ AC_DEFUN([gl_HEADER_STRING_H_BODY], ]], [ffsl ffsll memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul strdup strncat strndup strnlen strpbrk strsep strcasestr strtok_r - strerror_r strsignal strverscmp]) + strerror_r sigabbrev_np strsignal strverscmp]) AC_REQUIRE([AC_C_RESTRICT]) ]) @@ -80,6 +80,7 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], GNULIB_MBSTOK_R=0; AC_SUBST([GNULIB_MBSTOK_R]) GNULIB_STRERROR=0; AC_SUBST([GNULIB_STRERROR]) GNULIB_STRERROR_R=0; AC_SUBST([GNULIB_STRERROR_R]) + GNULIB_SIGABBREV_NP=0;AC_SUBST([GNULIB_SIGABBREV_NP]) GNULIB_STRSIGNAL=0; AC_SUBST([GNULIB_STRSIGNAL]) GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP]) HAVE_MBSLEN=0; AC_SUBST([HAVE_MBSLEN]) @@ -102,6 +103,7 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR]) HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R]) HAVE_DECL_STRERROR_R=1; AC_SUBST([HAVE_DECL_STRERROR_R]) + HAVE_SIGABBREV_NP=1; AC_SUBST([HAVE_SIGABBREV_NP]) HAVE_DECL_STRSIGNAL=1; AC_SUBST([HAVE_DECL_STRSIGNAL]) HAVE_STRVERSCMP=1; AC_SUBST([HAVE_STRVERSCMP]) REPLACE_MEMCHR=0; AC_SUBST([REPLACE_MEMCHR]) commit 348686b3f318195f4d341206744b8e98470c90f4 Author: Lars Ingebrigtsen Date: Fri Aug 21 17:15:22 2020 +0200 Minor mode doc string clarification * lisp/emacs-lisp/easy-mmode.el (easy-mmode--arg-docstring): Clarify that the minor mode hook is called both when enabling and disabling the mode (bug#34073). diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index 59e2e2e08f..24c9e79f2c 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -87,7 +87,10 @@ replacing its case-insensitive matches with the literal string in LIGHTER." If called interactively, enable %s if ARG is positive, and disable it if ARG is zero or negative. If called from Lisp, also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise.") +if ARG is `toggle'; disable the mode otherwise. + +The mode's hook is called both when the mode is enabled and when +it is disabled.") (defun easy-mmode--mode-docstring (doc mode-pretty-name keymap-sym) (let ((doc (or doc (format "Toggle %s on or off. commit ac1270de400c643c422ca9475ed9497cef818ad4 Author: Lars Ingebrigtsen Date: Fri Aug 21 16:55:55 2020 +0200 Fread_variable doc string clarification * src/minibuf.c (Fread_variable): Doc string clarification (bug#38886). diff --git a/src/minibuf.c b/src/minibuf.c index e18ff17abb..f957b2ae17 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -1039,7 +1039,7 @@ Prompt with PROMPT. */) DEFUN ("read-variable", Fread_variable, Sread_variable, 1, 2, 0, doc: /* Read the name of a user option and return it as a symbol. Prompt with PROMPT. By default, return DEFAULT-VALUE or its first element -if it is a list. +if it is a list of strings. A user option, or customizable variable, is one for which `custom-variable-p' returns non-nil. */) (Lisp_Object prompt, Lisp_Object default_value) commit fff5c3c061d99a067d728bd90ca00e329bb252ab Author: Lars Ingebrigtsen Date: Fri Aug 21 16:33:33 2020 +0200 help-at-pt-display-when-idle doc string clarification * lisp/help-at-pt.el (help-at-pt-display-when-idle): Clarify when kbd-help is useful (bug#39295). diff --git a/lisp/help-at-pt.el b/lisp/help-at-pt.el index dead1f6bf7..e184c78264 100644 --- a/lisp/help-at-pt.el +++ b/lisp/help-at-pt.el @@ -162,6 +162,10 @@ included in this list. Suggested properties are `keymap', `local-map', `button' and `kbd-help'. Any value other than t or a non-empty list disables the feature. +The text printed from the `help-echo' property is often only +relevant when using the mouse. The presence of a `kbd-help' +property guarantees that non mouse specific help is available. + This variable only takes effect after a call to `help-at-pt-set-timer'. The help gets printed after Emacs has been idle for `help-at-pt-timer-delay' seconds. You can call commit 70964b9c6b8458a7529ab0eb5563321c65a43f4f Author: Lars Ingebrigtsen Date: Fri Aug 21 16:15:18 2020 +0200 Mention `exec-path' in some process related doc strings * src/callproc.c (Fcall_process_region): (Fcall_process): * src/process.c (Fmake_process): Mention `exec-path' in the doc strings (bug#42704). diff --git a/src/callproc.c b/src/callproc.c index 65c858393a..e3346e2eab 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -231,6 +231,9 @@ DESTINATION can also have the form (REAL-BUFFER STDERR-FILE); in that case, Fourth arg DISPLAY non-nil means redisplay buffer as output is inserted. Remaining arguments ARGS are strings passed as command arguments to PROGRAM. +If PROGRAM is not an absolute file name, `call-process' will look for +PROGRAM in `exec-path' (which is a list of directories). + If executable PROGRAM can't be found as an executable, `call-process' signals a Lisp error. `call-process' reports errors in execution of the program only through its return and output. @@ -1060,6 +1063,9 @@ Sixth arg DISPLAY non-nil means redisplay buffer as output is inserted. Remaining arguments ARGS are passed to PROGRAM at startup as command-line arguments. +If PROGRAM is not an absolute file name, `call-process-region' will +look for PROGRAM in `exec-path' (which is a list of directories). + If BUFFER is 0, `call-process-region' returns immediately with value nil. Otherwise it waits for PROGRAM to terminate and returns a numeric exit status or a signal description string. diff --git a/src/process.c b/src/process.c index 15634e4a8b..3aa105ae34 100644 --- a/src/process.c +++ b/src/process.c @@ -1654,7 +1654,10 @@ you specify a filter function to handle the output. BUFFER may be also nil, meaning that this process is not associated with any buffer. :command COMMAND -- COMMAND is a list starting with the program file -name, followed by strings to give to the program as arguments. +name, followed by strings to give to the program as arguments. If the +program file name is not an absolute file name, `make-process' will +look for the program file name in `exec-path' (which is a list of +directories). :coding CODING -- If CODING is a symbol, it specifies the coding system used for both reading and writing for this process. If CODING commit 4a8d3d81cfc3e26dfb5eafd4af1c6a5a73fca8aa Author: Lars Ingebrigtsen Date: Fri Aug 21 15:58:32 2020 +0200 Highlight error messages from diff in diff-mode * lisp/vc/diff-mode.el (diff-error): New face (bug#2739). (diff-font-lock-keywords): Use it to highlight lines like "diff: " which are error messages from diff (for instance, when a file doesn't exist). diff --git a/etc/NEWS b/etc/NEWS index 717439a6dd..0a6a7dec5c 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -820,6 +820,10 @@ window after starting). This variable defaults to nil. ** Miscellaneous +--- +*** New 'diff-mode' font locking face 'diff-error'. +This face is used for error messages from diff. + --- *** 'hs-minor-mode' now heeds 'hs-special-modes-alist' for derived modes. The settings in 'hs-special-modes-alist' now also affect modes derived diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index aff20b6e6e..9c41d508b6 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -392,6 +392,12 @@ well." '((t :inherit diff-file-header)) "`diff-mode' face used to highlight nonexistent files in recursive diffs.") +(defface diff-error + '((((class color)) + :foreground "red" :background "black" :weight bold) + (t :weight bold)) + "`diff-mode' face for error messages from diff.") + (defconst diff-yank-handler '(diff-yank-function)) (defun diff-yank-function (text) ;; FIXME: the yank-handler is now called separately on each piece of text @@ -472,6 +478,7 @@ and the face `diff-added' for added lines.") ("^\\(#\\)\\(.*\\)" (1 font-lock-comment-delimiter-face) (2 font-lock-comment-face)) + ("^diff: .*" (0 'diff-error)) ("^[^-=+*!<>#].*\n" (0 'diff-context)) (,#'diff--font-lock-syntax) (,#'diff--font-lock-prettify) commit 9d0385d7c7adc810dfd06321b783593b7afb3d58 Author: Lars Ingebrigtsen Date: Fri Aug 21 15:36:45 2020 +0200 Fix problem with 8bit content-transfer-encoding in nndoc mbox files * lisp/gnus/nndoc.el (nndoc-possibly-change-buffer): If we're reading an mbox file, it may contain messages that use content-transfer-encoding 8bit, which means that we have to treat the file as a sequence of byte (bug#42951). This avoids double-decoding -- once by Emacs when inserting the mbox into the buffer, and once by Gnus when displaying the articles. diff --git a/lisp/gnus/nndoc.el b/lisp/gnus/nndoc.el index 36b67a8fd1..8960b3d7aa 100644 --- a/lisp/gnus/nndoc.el +++ b/lisp/gnus/nndoc.el @@ -352,6 +352,7 @@ from the document.") nndoc-group-alist) (setq nndoc-dissection-alist nil) (with-current-buffer nndoc-current-buffer + (set-buffer-multibyte nil) (erase-buffer) (condition-case error (if (and (stringp nndoc-address) commit d3c73fbfddb40a9d613149cfcdfb66cd162c4f58 Author: Eli Zaretskii Date: Fri Aug 21 16:35:58 2020 +0300 ; * etc/NEWS: Fix a recently added entry. diff --git a/etc/NEWS b/etc/NEWS index 8e3c2201e8..717439a6dd 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -821,8 +821,9 @@ window after starting). This variable defaults to nil. ** Miscellaneous --- -*** 'hs-special-modes-alist' is now also heeded for modes derived from -the modes in that list. +*** 'hs-minor-mode' now heeds 'hs-special-modes-alist' for derived modes. +The settings in 'hs-special-modes-alist' now also affect modes derived +from those mentioned in that alist. +++ *** New global mode 'global-goto-address-mode' commit 9d4b11132b7fb45a5804161e16cb9b71b7ac7d5d Author: Noam Postavsky Date: Fri Aug 21 15:08:27 2020 +0200 Clarify docs about line movement * doc/lispref/positions.texi (Text Lines, Screen Lines): Add index entries. * lisp/simple.el (move-beginning-of-line): Remove incorrect mention of images, and reference beginning-of-visual-line. * src/editfns.c (Fline_beginning_position): Reference `vertical-motion' (bug#35899). diff --git a/doc/lispref/positions.texi b/doc/lispref/positions.texi index 91419702ca..751adcff5a 100644 --- a/doc/lispref/positions.texi +++ b/doc/lispref/positions.texi @@ -332,6 +332,8 @@ if provided; otherwise @var{n} defaults to @code{nil}. @node Text Lines @subsection Motion by Text Lines @cindex lines +@cindex logical lines, moving by +@cindex physical lines, moving by Text lines are portions of the buffer delimited by newline characters, which are regarded as part of the previous line. The first text line @@ -518,6 +520,7 @@ beginning or end of a line. @node Screen Lines @subsection Motion by Screen Lines @cindex screen lines, moving by +@cindex visual lines, moving by The line functions in the previous section count text lines, delimited only by newline characters. By contrast, these functions count screen diff --git a/lisp/simple.el b/lisp/simple.el index b106d4b0ba..fa6e154004 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -7021,15 +7021,16 @@ rests." (setq done t))))))) (defun move-beginning-of-line (arg) - "Move point to beginning of current line as displayed. -\(If there's an image in the line, this disregards newlines -that are part of the text that the image rests on.) + "Move point to visible beginning of current logical line. +This disregards any invisible newline characters. With argument ARG not nil or 1, move forward ARG - 1 lines first. If point reaches the beginning or end of buffer, it stops there. \(But if the buffer doesn't end in a newline, it stops at the beginning of the last line.) -To ignore intangibility, bind `inhibit-point-motion-hooks' to t." + +To ignore intangibility, bind `inhibit-point-motion-hooks' to t. +For motion by visual lines, see `beginning-of-visual-line'." (interactive "^p") (or arg (setq arg 1)) diff --git a/src/editfns.c b/src/editfns.c index cb09ea8a31..949f3825a3 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -707,7 +707,8 @@ If the scan reaches the end of the buffer, return that position. This function ignores text display directionality; it returns the position of the first character in logical order, i.e. the smallest -character position on the line. +character position on the logical line. See `vertical-motion' for +movement by screen lines. This function constrains the returned position to the current field unless that position would be on a different line from the original, commit 9c62ffb08262c82b7e38e6eb5767f2087424aa47 Author: Pip Cet Date: Fri Aug 21 14:56:06 2020 +0200 Fix lock failures in xg_select * src/xgselect.c (release_select_lock, acquire_select_lock): Introduce. (xg_select): Use `acquire_select_lock', `release_select_lock'. * src/thread.c (release_select_lock): Introduce for non-GLib builds. (really_call_select): Call `release_select_lock'. Simplify by ensuring acquisition of the lock always succeeds (bug#36609). diff --git a/src/thread.c b/src/thread.c index b638dd77f8..b4d8a53cf6 100644 --- a/src/thread.c +++ b/src/thread.c @@ -28,6 +28,12 @@ along with GNU Emacs. If not, see . */ #include "pdumper.h" #include "keyboard.h" +#ifdef HAVE_GLIB +#include +#else +#define release_select_lock() do { } while (0) +#endif + union aligned_thread_state { struct thread_state s; @@ -586,6 +592,8 @@ really_call_select (void *arg) sa->result = (sa->func) (sa->max_fds, sa->rfds, sa->wfds, sa->efds, sa->timeout, sa->sigmask); + release_select_lock (); + block_interrupt_signal (&oldset); /* If we were interrupted by C-g while inside sa->func above, the signal handler could have called maybe_reacquire_global_lock, in diff --git a/src/xgselect.c b/src/xgselect.c index f8d0bac7fa..be70107b75 100644 --- a/src/xgselect.c +++ b/src/xgselect.c @@ -29,6 +29,27 @@ along with GNU Emacs. If not, see . */ #include "blockinput.h" #include "systime.h" +static ptrdiff_t threads_holding_glib_lock; +static GMainContext *glib_main_context; + +void release_select_lock (void) +{ + if (--threads_holding_glib_lock == 0) + g_main_context_release (glib_main_context); +} + +static void acquire_select_lock (GMainContext *context) +{ + if (threads_holding_glib_lock++ == 0) + { + glib_main_context = context; + while (!g_main_context_acquire (context)) + { + /* Spin. */ + } + } +} + /* `xg_select' is a `pselect' replacement. Why do we need a separate function? 1. Timeouts. Glib and Gtk rely on timer events. If we did pselect with a greater timeout then the one scheduled by Glib, we would @@ -54,26 +75,19 @@ xg_select (int fds_lim, fd_set *rfds, fd_set *wfds, fd_set *efds, GPollFD *gfds = gfds_buf; int gfds_size = ARRAYELTS (gfds_buf); int n_gfds, retval = 0, our_fds = 0, max_fds = fds_lim - 1; - bool context_acquired = false; int i, nfds, tmo_in_millisec, must_free = 0; bool need_to_dispatch; context = g_main_context_default (); - context_acquired = g_main_context_acquire (context); - /* FIXME: If we couldn't acquire the context, we just silently proceed - because this function handles more than just glib file descriptors. - Note that, as implemented, this failure is completely silent: there is - no feedback to the caller. */ + acquire_select_lock (context); if (rfds) all_rfds = *rfds; else FD_ZERO (&all_rfds); if (wfds) all_wfds = *wfds; else FD_ZERO (&all_wfds); - n_gfds = (context_acquired - ? g_main_context_query (context, G_PRIORITY_LOW, &tmo_in_millisec, - gfds, gfds_size) - : -1); + n_gfds = g_main_context_query (context, G_PRIORITY_LOW, &tmo_in_millisec, + gfds, gfds_size); if (gfds_size < n_gfds) { @@ -151,8 +165,10 @@ xg_select (int fds_lim, fd_set *rfds, fd_set *wfds, fd_set *efds, #else need_to_dispatch = true; #endif - if (need_to_dispatch && context_acquired) + if (need_to_dispatch) { + acquire_select_lock (context); + int pselect_errno = errno; /* Prevent g_main_dispatch recursion, that would occur without block_input wrapper, because event handlers call @@ -162,11 +178,9 @@ xg_select (int fds_lim, fd_set *rfds, fd_set *wfds, fd_set *efds, g_main_context_dispatch (context); unblock_input (); errno = pselect_errno; + release_select_lock (); } - if (context_acquired) - g_main_context_release (context); - /* To not have to recalculate timeout, return like this. */ if ((our_fds > 0 || (nfds == 0 && tmop == &tmo)) && (retval == 0)) { diff --git a/src/xgselect.h b/src/xgselect.h index a38591f329..512bf3ad85 100644 --- a/src/xgselect.h +++ b/src/xgselect.h @@ -29,4 +29,6 @@ extern int xg_select (int max_fds, fd_set *rfds, fd_set *wfds, fd_set *efds, struct timespec *timeout, sigset_t *sigmask); +extern void release_select_lock (void); + #endif /* XGSELECT_H */ commit 19ee08f1e8599ce0e0465f6ffbd4a76791d791b4 Author: Pip Cet Date: Fri Aug 21 14:47:45 2020 +0200 Fix return value for CCL opcode lookup-integer * src/ccl.c (ccl_driver): Fix LookupIntConstTbl return value. * test/lisp/international/ccl-tests.el (ccl-hash-table): Add test. * lisp/international/ccl.el (ccl-embed-data): Don't pass non-numbers to `ccl-fixnum' (bug#36740). diff --git a/lisp/international/ccl.el b/lisp/international/ccl.el index d3ae23c2f7..3b3fcf4c04 100644 --- a/lisp/international/ccl.el +++ b/lisp/international/ccl.el @@ -196,7 +196,9 @@ "Embed integer DATA in `ccl-program-vector' at `ccl-current-ic' and increment it. If IC is specified, embed DATA at IC." (if ic - (aset ccl-program-vector ic (ccl-fixnum data)) + (aset ccl-program-vector ic (if (numberp data) + (ccl-fixnum data) + data)) (let ((len (length ccl-program-vector))) (if (>= ccl-current-ic len) (let ((new (make-vector (* len 2) nil))) @@ -204,7 +206,9 @@ increment it. If IC is specified, embed DATA at IC." (setq len (1- len)) (aset new len (aref ccl-program-vector len))) (setq ccl-program-vector new)))) - (aset ccl-program-vector ccl-current-ic (ccl-fixnum data)) + (aset ccl-program-vector ccl-current-ic (if (numberp data) + (ccl-fixnum data) + data)) (setq ccl-current-ic (1+ ccl-current-ic)))) (defun ccl-embed-symbol (symbol prop) diff --git a/src/ccl.c b/src/ccl.c index 86debeef0e..796698eb1c 100644 --- a/src/ccl.c +++ b/src/ccl.c @@ -1374,7 +1374,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size if (! (IN_INT_RANGE (eop) && CHARACTERP (opl))) CCL_INVALID_CMD; reg[RRR] = charset_unicode; - reg[rrr] = eop; + reg[rrr] = XFIXNUM (opl); reg[7] = 1; /* r7 true for success */ } else diff --git a/test/lisp/international/ccl-tests.el b/test/lisp/international/ccl-tests.el index 9277d0162e..16e591f1dd 100644 --- a/test/lisp/international/ccl-tests.el +++ b/test/lisp/international/ccl-tests.el @@ -232,3 +232,17 @@ At EOF: (with-temp-buffer (ccl-dump prog-midi-code) (should (equal (buffer-string) prog-midi-dump)))) + +(ert-deftest ccl-hash-table () + (let ((sym (gensym)) + (table (make-hash-table :test 'eq))) + (puthash 16 17 table) + (puthash 17 16 table) + (define-translation-hash-table sym table) + (let* ((prog `(2 + ((loop + (lookup-integer ,sym r0 r1))))) + (compiled (ccl-compile prog)) + (registers [17 0 0 0 0 0 0 0])) + (ccl-execute compiled registers) + (should (equal registers [2 16 0 0 0 0 0 1]))))) commit a415179b56f022f50138f55d231070e3d1b00697 Author: Tobias Zawada Date: Fri Aug 21 14:42:20 2020 +0200 Make hs-special-modes-alist also work for modes derived from those modes * lisp/progmodes/hideshow.el (hs-grok-mode-type): Also set up hideshow variables based on hs-special-modes-alist in derived modes (bug#39354). diff --git a/etc/NEWS b/etc/NEWS index 53391f91f7..8e3c2201e8 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -820,6 +820,10 @@ window after starting). This variable defaults to nil. ** Miscellaneous +--- +*** 'hs-special-modes-alist' is now also heeded for modes derived from +the modes in that list. + +++ *** New global mode 'global-goto-address-mode' This will enable 'goto-address-mode' in all buffers. diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el index 625e08e4d7..c5b9cfc2e7 100644 --- a/lisp/progmodes/hideshow.el +++ b/lisp/progmodes/hideshow.el @@ -225,6 +225,8 @@ ;;--------------------------------------------------------------------------- ;; user-configurable variables +(require 'cl-lib) + (defgroup hideshow nil "Minor mode for hiding and showing program and comment blocks." :prefix "hs-" @@ -652,7 +654,9 @@ Otherwise, guess start, end and `comment-start' regexps; `forward-sexp' function; and adjust-block-beginning function." (if (and (bound-and-true-p comment-start) (bound-and-true-p comment-end)) - (let* ((lookup (assoc major-mode hs-special-modes-alist)) + (let* ((lookup (cl-assoc-if (lambda (mode) + (derived-mode-p major-mode mode)) + hs-special-modes-alist)) (start-elem (or (nth 1 lookup) "\\s("))) (if (listp start-elem) ;; handle (START-REGEXP MDATA-SELECT) commit 47b3adf8bb29f89a2c3cbfd99ac3df52810ca211 Author: Kevin Ryde Date: Fri Aug 21 14:17:56 2020 +0200 Have ispell add new LocalWords lines after any such existing lines * textmodes/ispell.el (ispell-add-per-file-word-list): Add new LocalWords line just after existing such lines. Good to keep words together or if deliberately placed somewhere special (bug#20486). diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index b2ccbc8da2..8252da604e 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -4188,7 +4188,7 @@ Both should not be used to define a buffer-local dictionary." (let (line-okay search done found) (while (not done) (let ((case-fold-search nil)) - (setq search (search-forward ispell-words-keyword nil 'move) + (setq search (search-forward ispell-words-keyword nil t) found (or found search) line-okay (< (+ (length word) 1 ; 1 for space after word.. (progn (end-of-line) (current-column))) @@ -4199,8 +4199,10 @@ Both should not be used to define a buffer-local dictionary." (setq done t) (if (null search) (progn - (open-line 1) - (unless found (newline)) + (if found (insert "\n") ;; after an existing LocalWords + (goto-char (point-max)) ;; no LocalWords, go to end of file + (open-line 1) + (newline)) (insert (if comment-start (concat (progn commit 3feef0428dad1e847d250d949248907ad31669dc Author: Christophe Troestler Date: Fri Aug 21 13:31:38 2020 +0200 Fix displaying inline ical attachments with no charset * lisp/gnus/gnus-icalendar.el (gnus-icalendar-with-decoded-handle): Check whether there is a charset before using it (bug#40290). Copyright-paperwork-exempt: yes diff --git a/lisp/gnus/gnus-icalendar.el b/lisp/gnus/gnus-icalendar.el index 29d3e30780..ab121f1f9e 100644 --- a/lisp/gnus/gnus-icalendar.el +++ b/lisp/gnus/gnus-icalendar.el @@ -757,7 +757,7 @@ These will be used to retrieve the RSVP information from ical events." `(let ((,charset (cdr (assoc 'charset (mm-handle-type ,handle))))) (with-temp-buffer (mm-insert-part ,handle) - (when (string= (downcase ,charset) "utf-8") + (when (and ,charset (string= (downcase ,charset) "utf-8")) (decode-coding-region (point-min) (point-max) 'utf-8)) ,@body)))) commit 44f6a2bba28a0b341a082a8167b3f9d2bd894340 Author: Gregory Heytings Date: Fri Aug 21 12:44:52 2020 +0200 Tweak completion of Makefile targets * lisp/pcmpl-gnu.el (pcmpl-gnu-make-targets): Require that target names not be preceded by a TAG character (bug#42411). Copyright-paperwork-exempt: yes diff --git a/lisp/pcmpl-gnu.el b/lisp/pcmpl-gnu.el index 098aa3d5fe..d7c5b381d2 100644 --- a/lisp/pcmpl-gnu.el +++ b/lisp/pcmpl-gnu.el @@ -118,7 +118,7 @@ Return the new list." (goto-char (point-min)) (while (re-search-forward - "^\\s-*\\([^\n#%.$][^:=\n]*\\)\\s-*:[^=]" nil t) + "^\\([^\t\n#%.$][^:=\n]*\\)\\s-*:[^=]" nil t) (setq targets (nconc (split-string (match-string-no-properties 1)) targets))) targets)