Now on revision 111745. ------------------------------------------------------------ revno: 111745 committer: Glenn Morris branch nick: trunk timestamp: Mon 2013-02-11 23:38:54 -0800 message: ChangeLog fixes diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-02-12 04:46:18 +0000 +++ lisp/ChangeLog 2013-02-12 07:38:54 +0000 @@ -22,7 +22,7 @@ 2013-02-11 Elias Pipping * doc-view.el (doc-view-current-cache-dir): Beware % escapes - (bug#13689). + (bug#13679). 2013-02-11 Stefan Monnier === modified file 'lisp/erc/ChangeLog' --- lisp/erc/ChangeLog 2013-02-09 12:52:01 +0000 +++ lisp/erc/ChangeLog 2013-02-12 07:38:54 +0000 @@ -1,3 +1,8 @@ +2013-02-12 Aidan Gauland + + * erc-match.el (erc-match-message): + Don't truncate action messages. (Bug#13689) + 2013-02-09 Eli Zaretskii * erc-dcc.el (erc-dcc-get-file): Don't reference buffer-file-type. ------------------------------------------------------------ revno: 111744 fixes bug: http://debbugs.gnu.org/2145 committer: Glenn Morris branch nick: trunk timestamp: Mon 2013-02-11 20:46:18 -0800 message: Make S-SPC scroll in the opposite direction to SPC * lisp/calc/calc-graph.el (calc-graph-show-dumb): * lisp/calendar/calendar.el (calendar-mode-map): * lisp/cus-edit.el (custom-mode-map): * lisp/ehelp.el (electric-help-map): * lisp/emulation/vip.el (vip-mode-map): * lisp/epa.el (epa-key-list-mode-map): * lisp/info.el (Info-mode-map): * lisp/mail/rmail.el (rmail-mode-map): * lisp/mail/rmailsum.el (rmail-summary-mode-map): * lisp/man.el (Man-mode-map): * lisp/net/newst-plainview.el (newsticker-mode-map): * lisp/progmodes/cpp.el (cpp-edit-mode-map): * lisp/progmodes/grep.el (grep-mode-map): * lisp/progmodes/idlw-help.el (idlwave-help-mode-map): * lisp/simple.el (special-mode-map): * lisp/startup.el (splash-screen-keymap): * lisp/view.el (view-mode-map): Make S-SPC scroll in the opposite sense to SPC. diff: === modified file 'etc/NEWS' --- etc/NEWS 2013-02-11 19:21:23 +0000 +++ etc/NEWS 2013-02-12 04:46:18 +0000 @@ -76,6 +76,9 @@ ** New commands `toggle-frame-fullscreen' and `toggle-frame-maximized', bound to and M-, respectively. +** In keymaps where SPC scrolls, S-SPC now scrolls in the reverse direction. +Eg View mode, etc. + * Changes in Specialized Modes and Packages in Emacs 24.4 === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-02-11 22:53:36 +0000 +++ lisp/ChangeLog 2013-02-12 04:46:18 +0000 @@ -1,3 +1,24 @@ +2013-02-12 Glenn Morris + + * calc/calc-graph.el (calc-graph-show-dumb): + * calendar/calendar.el (calendar-mode-map): + * cus-edit.el (custom-mode-map): + * ehelp.el (electric-help-map): + * emulation/vip.el (vip-mode-map): + * epa.el (epa-key-list-mode-map): + * info.el (Info-mode-map): + * mail/rmail.el (rmail-mode-map): + * mail/rmailsum.el (rmail-summary-mode-map): + * man.el (Man-mode-map): + * net/newst-plainview.el (newsticker-mode-map): + * progmodes/cpp.el (cpp-edit-mode-map): + * progmodes/grep.el (grep-mode-map): + * progmodes/idlw-help.el (idlwave-help-mode-map): + * simple.el (special-mode-map): + * startup.el (splash-screen-keymap): + * view.el (view-mode-map): + Make S-SPC scroll in the opposite sense to SPC. (Bug#2145) + 2013-02-11 Elias Pipping * doc-view.el (doc-view-current-cache-dir): Beware % escapes === modified file 'lisp/calc/calc-graph.el' --- lisp/calc/calc-graph.el 2013-01-01 09:11:05 +0000 +++ lisp/calc/calc-graph.el 2013-02-12 04:46:18 +0000 @@ -948,6 +948,7 @@ (setq calc-dumb-map (make-sparse-keymap)) (define-key calc-dumb-map "\n" 'scroll-up-command) (define-key calc-dumb-map " " 'scroll-up-command) + (define-key calc-dump-map [?\S-\ ] 'scroll-down-command) (define-key calc-dumb-map "\177" 'scroll-down-command) (define-key calc-dumb-map "<" 'scroll-left) (define-key calc-dumb-map ">" 'scroll-right) === modified file 'lisp/calendar/calendar.el' --- lisp/calendar/calendar.el 2013-01-14 15:39:04 +0000 +++ lisp/calendar/calendar.el 2013-02-12 04:46:18 +0000 @@ -1635,6 +1635,7 @@ (define-key map "S" 'calendar-sunrise-sunset) (define-key map "M" 'calendar-lunar-phases) (define-key map " " 'scroll-other-window) + (define-key map [?\S-\ ] 'scroll-other-window-down) (define-key map "\d" 'scroll-other-window-down) (define-key map "\C-c\C-l" 'calendar-redraw) (define-key map "." 'calendar-goto-today) === modified file 'lisp/cus-edit.el' --- lisp/cus-edit.el 2013-01-02 16:13:04 +0000 +++ lisp/cus-edit.el 2013-02-12 04:46:18 +0000 @@ -443,6 +443,7 @@ (define-key map [remap self-insert-command] 'Custom-no-edit) (define-key map "\^m" 'Custom-newline) (define-key map " " 'scroll-up-command) + (define-key map [?\S-\ ] 'scroll-down-command) (define-key map "\177" 'scroll-down-command) (define-key map "\C-c\C-c" 'Custom-set) (define-key map "\C-x\C-s" 'Custom-save) === modified file 'lisp/ehelp.el' --- lisp/ehelp.el 2013-01-01 09:11:05 +0000 +++ lisp/ehelp.el 2013-02-12 04:46:18 +0000 @@ -80,6 +80,7 @@ (define-key map (char-to-string help-char) 'electric-help-help) (define-key map "?" 'electric-help-help) (define-key map " " 'scroll-up) + (define-key map [?\S-\ ] 'scroll-down) (define-key map "\^?" 'scroll-down) (define-key map "." 'beginning-of-buffer) (define-key map "<" 'beginning-of-buffer) === modified file 'lisp/emulation/vip.el' --- lisp/emulation/vip.el 2013-01-01 09:11:05 +0000 +++ lisp/emulation/vip.el 2013-02-12 04:46:18 +0000 @@ -183,6 +183,7 @@ (define-key map "\C-z" 'vip-change-mode-to-emacs) (define-key map "\e" 'vip-ESC) + (define-key map [?\S-\ ] 'vip-scroll-back) (define-key map " " 'vip-scroll) (define-key map "!" 'vip-command-argument) (define-key map "\"" 'vip-command-argument) === modified file 'lisp/epa.el' --- lisp/epa.el 2013-01-01 09:11:05 +0000 +++ lisp/epa.el 2013-02-12 04:46:18 +0000 @@ -169,6 +169,7 @@ (define-key keymap "n" 'next-line) (define-key keymap "p" 'previous-line) (define-key keymap " " 'scroll-up-command) + (define-key keymap [?\S-\ ] 'scroll-down-command) (define-key keymap [delete] 'scroll-down-command) (define-key keymap "q" 'epa-exit-buffer) (define-key keymap [menu-bar epa-key-list-mode] (cons "Keys" menu-map)) === modified file 'lisp/info.el' --- lisp/info.el 2013-02-01 16:46:46 +0000 +++ lisp/info.el 2013-02-12 04:46:18 +0000 @@ -3874,6 +3874,7 @@ (suppress-keymap map) (define-key map "." 'beginning-of-buffer) (define-key map " " 'Info-scroll-up) + (define-key map [?\S-\ ] 'Info-scroll-down) (define-key map "\C-m" 'Info-follow-nearest-node) (define-key map "\t" 'Info-next-reference) (define-key map "\e\t" 'Info-prev-reference) === modified file 'lisp/mail/rmail.el' --- lisp/mail/rmail.el 2013-02-07 08:04:05 +0000 +++ lisp/mail/rmail.el 2013-02-12 04:46:18 +0000 @@ -1085,6 +1085,7 @@ (define-key map "<" 'rmail-first-message) (define-key map ">" 'rmail-last-message) (define-key map " " 'scroll-up-command) + (define-key map [?\S-\ ] 'scroll-down-command) (define-key map "\177" 'scroll-down-command) (define-key map "?" 'describe-mode) (define-key map "\C-c\C-s\C-d" 'rmail-sort-by-date) @@ -4751,7 +4752,7 @@ ;;;### (autoloads (rmail-summary-by-senders rmail-summary-by-topic ;;;;;; rmail-summary-by-regexp rmail-summary-by-recipients rmail-summary-by-labels -;;;;;; rmail-summary) "rmailsum" "rmailsum.el" "341825201e892b8fc875c1ae49ffd560") +;;;;;; rmail-summary) "rmailsum" "rmailsum.el" "119ce8b431f01e7f54bb6fa99603b3d9") ;;; Generated autoloads from rmailsum.el (autoload 'rmail-summary "rmailsum" "\ === modified file 'lisp/mail/rmailsum.el' --- lisp/mail/rmailsum.el 2013-01-01 09:11:05 +0000 +++ lisp/mail/rmailsum.el 2013-02-12 04:46:18 +0000 @@ -118,6 +118,7 @@ (define-key map "<" 'rmail-summary-first-message) (define-key map ">" 'rmail-summary-last-message) (define-key map " " 'rmail-summary-scroll-msg-up) + (define-key map [?\S-\ ] 'rmail-summary-scroll-msg-down) (define-key map "\177" 'rmail-summary-scroll-msg-down) (define-key map "?" 'describe-mode) (define-key map "\C-c\C-n" 'rmail-summary-next-same-subject) === modified file 'lisp/man.el' --- lisp/man.el 2013-01-10 15:01:35 +0000 +++ lisp/man.el 2013-02-12 04:46:18 +0000 @@ -426,6 +426,7 @@ (suppress-keymap map) (set-keymap-parent map button-buffer-map) + (define-key map [?\S-\ ] 'scroll-down-command) (define-key map " " 'scroll-up-command) (define-key map "\177" 'scroll-down-command) (define-key map "n" 'Man-next-section) === modified file 'lisp/net/newst-plainview.el' --- lisp/net/newst-plainview.el 2013-01-01 09:11:05 +0000 +++ lisp/net/newst-plainview.el 2013-02-12 04:46:18 +0000 @@ -5,7 +5,7 @@ ;; Author: Ulf Jasper ;; Filename: newst-plainview.el ;; URL: http://www.nongnu.org/newsticker -;; Time-stamp: "13. Mai 2011, 19:28:34 (ulf)" +;; Time-stamp: "Mon 11-Feb-2013 20:27:11 gm on skiddaw" ;; Package: newsticker ;; ====================================================================== @@ -405,6 +405,7 @@ (define-key map "sx" 'newsticker-show-extra) (define-key map "hx" 'newsticker-hide-extra) + (define-key map [?\S-\ ] 'scroll-down-command) (define-key map " " 'scroll-up-command) (define-key map "q" 'newsticker-close-buffer) (define-key map "p" 'newsticker-previous-item) === modified file 'lisp/progmodes/cpp.el' --- lisp/progmodes/cpp.el 2013-01-01 09:11:05 +0000 +++ lisp/progmodes/cpp.el 2013-02-12 04:46:18 +0000 @@ -420,6 +420,7 @@ (define-key map [ down-mouse-2 ] 'cpp-push-button) (define-key map [ mouse-2 ] 'ignore) (define-key map " " 'scroll-up-command) + (define-key map [?\S-\ ] 'scroll-down-command) (define-key map "\C-?" 'scroll-down-command) (define-key map [ delete ] 'scroll-down) (define-key map "\C-c\C-c" 'cpp-edit-apply) === modified file 'lisp/progmodes/grep.el' --- lisp/progmodes/grep.el 2013-02-02 00:35:38 +0000 +++ lisp/progmodes/grep.el 2013-02-12 04:46:18 +0000 @@ -246,6 +246,7 @@ (let ((map (make-sparse-keymap))) (set-keymap-parent map compilation-minor-mode-map) (define-key map " " 'scroll-up-command) + (define-key map [?\S-\ ] 'scroll-down-command) (define-key map "\^?" 'scroll-down-command) (define-key map "\C-c\C-f" 'next-error-follow-minor-mode) === modified file 'lisp/progmodes/idlw-help.el' --- lisp/progmodes/idlw-help.el 2013-01-01 09:11:05 +0000 +++ lisp/progmodes/idlw-help.el 2013-02-12 04:46:18 +0000 @@ -227,6 +227,7 @@ (interactive "p") (scroll-up arg))) (define-key map " " 'scroll-up-command) + (define-key map [?\S-\ ] 'scroll-down-command) (define-key map [delete] 'scroll-down-command) (define-key map "h" 'idlwave-help-find-header) (define-key map "H" 'idlwave-help-find-first-header) === modified file 'lisp/simple.el' --- lisp/simple.el 2013-02-08 15:53:49 +0000 +++ lisp/simple.el 2013-02-12 04:46:18 +0000 @@ -358,6 +358,7 @@ (suppress-keymap map) (define-key map "q" 'quit-window) (define-key map " " 'scroll-up-command) + (define-key map [?\S-\ ] 'scroll-down-command) (define-key map "\C-?" 'scroll-down-command) (define-key map "?" 'describe-mode) (define-key map "h" 'describe-mode) === modified file 'lisp/startup.el' --- lisp/startup.el 2013-02-06 02:03:35 +0000 +++ lisp/startup.el 2013-02-12 04:46:18 +0000 @@ -1466,6 +1466,7 @@ (suppress-keymap map) (set-keymap-parent map button-buffer-map) (define-key map "\C-?" 'scroll-down-command) + (define-key map [?\S-\ ] 'scroll-down-command) (define-key map " " 'scroll-up-command) (define-key map "q" 'exit-splash-screen) map) === modified file 'lisp/view.el' --- lisp/view.el 2013-01-04 02:53:48 +0000 +++ lisp/view.el 2013-02-12 04:46:18 +0000 @@ -199,6 +199,7 @@ (define-key map "\C-?" 'View-scroll-page-backward) ;; (define-key map "f" 'View-scroll-page-forward) (define-key map " " 'View-scroll-page-forward) + (define-key map [?\S-\ ] 'View-scroll-page-backward) (define-key map "o" 'View-scroll-to-buffer-end) (define-key map ">" 'end-of-buffer) (define-key map "<" 'beginning-of-buffer) @@ -407,8 +408,8 @@ \\[View-scroll-to-buffer-end] scroll so that buffer end is at last line of window. SPC scroll forward \"page size\" lines. With prefix scroll forward prefix lines. -DEL scroll backward \"page size\" lines. - With prefix scroll backward prefix lines. +DEL, S-SPC scroll backward \"page size\" lines. + With prefix scroll backward prefix lines. \\[View-scroll-page-forward-set-page-size] like \\[View-scroll-page-forward] but with prefix sets \"page size\" to prefix. \\[View-scroll-page-backward-set-page-size] like \\[View-scroll-page-backward] but with prefix sets \"page size\" to prefix. \\[View-scroll-half-page-forward] scroll forward \"half page size\" lines. With prefix, sets ------------------------------------------------------------ revno: 111743 committer: Eli Zaretskii branch nick: trunk timestamp: Tue 2013-02-12 05:52:04 +0200 message: MS-Windows followup for revision 111741. lib/makefile.w32-in (GNULIBOBJS): Add $(BLD)/memrchr.$(O). ($(BLD)/memrchr.$(O)): New dependency. nt/inc/ms-w32.h: Add prototype for memrchr. diff: === modified file 'ChangeLog' --- ChangeLog 2013-02-11 23:37:18 +0000 +++ ChangeLog 2013-02-12 03:52:04 +0000 @@ -1,3 +1,8 @@ +2013-02-12 Eli Zaretskii + + * lib/makefile.w32-in (GNULIBOBJS): Add $(BLD)/memrchr.$(O). + ($(BLD)/memrchr.$(O)): New dependency. + 2013-02-11 Paul Eggert Tune by using memchr and memrchr. === modified file 'lib/makefile.w32-in' --- lib/makefile.w32-in 2013-01-02 16:13:04 +0000 +++ lib/makefile.w32-in 2013-02-12 03:52:04 +0000 @@ -34,6 +34,7 @@ $(BLD)/getopt.$(O) \ $(BLD)/getopt1.$(O) \ $(BLD)/gettime.$(O) \ + $(BLD)/memrchr.$(O) \ $(BLD)/strftime.$(O) \ $(BLD)/time_r.$(O) \ $(BLD)/timespec-add.$(O) \ @@ -201,6 +202,10 @@ $(CONFIG_H) \ $(MD5_H) +$(BLD)/memrchr.$(O) : \ + $(GNU_LIB)/memrchr.c \ + $(CONFIG_H) + $(BLD)/sha1.$(O) : \ $(GNU_LIB)/sha1.c \ $(NT_INC)/stdalign.h \ === modified file 'nt/ChangeLog' --- nt/ChangeLog 2013-02-01 06:30:51 +0000 +++ nt/ChangeLog 2013-02-12 03:52:04 +0000 @@ -1,3 +1,7 @@ +2013-02-12 Eli Zaretskii + + * inc/ms-w32.h: Add prototype for memrchr. + 2013-02-01 Paul Eggert Use fdopendir, fstatat and readlinkat, for efficiency (Bug#13539). === modified file 'nt/inc/ms-w32.h' --- nt/inc/ms-w32.h 2013-01-02 16:13:04 +0000 +++ nt/inc/ms-w32.h 2013-02-12 03:52:04 +0000 @@ -394,6 +394,9 @@ extern int getloadavg (double *, int); extern int getpagesize (void); +extern void * memrchr (void const *, int, size_t); + + #if defined (__MINGW32__) /* Define to 1 if the system has the type `long long int'. */ ------------------------------------------------------------ revno: 111742 committer: Glenn Morris branch nick: trunk timestamp: Mon 2013-02-11 19:51:24 -0500 message: Tweak quoting in earlier configure.ac emacs_config_options change diff: === modified file 'autogen/configure' --- autogen/configure 2013-02-11 11:17:34 +0000 +++ autogen/configure 2013-02-12 00:51:24 +0000 @@ -3377,7 +3377,7 @@ esac eval val="\$${var}" test x"$val" = x && continue - emacs_config_options="${emacs_config_options}${emacs_config_options:+ }$var=$val" + emacs_config_options="${emacs_config_options}${emacs_config_options:+ }$var=\"$val\"" done ac_config_headers="$ac_config_headers src/config.h:src/config.in" === modified file 'configure.ac' --- configure.ac 2013-02-11 00:54:48 +0000 +++ configure.ac 2013-02-12 00:51:24 +0000 @@ -35,7 +35,7 @@ esac eval val="\$${var}" test x"$val" = x && continue - emacs_config_options="${emacs_config_options}${emacs_config_options:+ }$var=$val" + emacs_config_options="${emacs_config_options}${emacs_config_options:+ }$var=\"$val\"" done AC_CONFIG_HEADER(src/config.h:src/config.in) ------------------------------------------------------------ revno: 111741 committer: Paul Eggert branch nick: trunk timestamp: Mon 2013-02-11 15:37:18 -0800 message: Tune by using memchr and memrchr. * .bzrignore: Add string.h. * admin/merge-gnulib (GNULIB_MODULES): Add memrchr. * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate. * lib/memrchr.c, lib/string.in.h, m4/memrchr.m4, m4/string_h.m4: New files, from gnulib. * src/doc.c (Fsnarf_documentation): * src/fileio.c (Fsubstitute_in_file_name): * src/search.c (find_newline, scan_newline): * src/xdisp.c (pos_visible_p, display_count_lines): Use memchr and memrchr rather than scanning byte-by-byte. * src/search.c (find_newline): Rename from scan_buffer. Omit first arg TARGET, as it's always '\n'. All callers changed. diff: === modified file '.bzrignore' --- .bzrignore 2013-02-01 06:30:51 +0000 +++ .bzrignore 2013-02-11 23:37:18 +0000 @@ -97,6 +97,7 @@ lib/stdio.h lib/stdint.h lib/stdlib.h +lib/string.h lib/sys/ lib/SYS lib/time.h === modified file 'ChangeLog' --- ChangeLog 2013-02-11 23:15:46 +0000 +++ ChangeLog 2013-02-11 23:37:18 +0000 @@ -1,5 +1,11 @@ 2013-02-11 Paul Eggert + Tune by using memchr and memrchr. + * .bzrignore: Add string.h. + * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate. + * lib/memrchr.c, lib/string.in.h, m4/memrchr.m4, m4/string_h.m4: + New files, from gnulib. + Merge from gnulib, incorporating: 2013-02-11 unsetenv etc.: port to Solaris 11 + GNU Emacs 2013-02-09 secure_getenv: fix C++ declaration typo === modified file 'admin/ChangeLog' --- admin/ChangeLog 2013-02-01 06:30:51 +0000 +++ admin/ChangeLog 2013-02-11 23:37:18 +0000 @@ -1,3 +1,8 @@ +2013-02-11 Paul Eggert + + Tune by using memchr and memrchr. + * merge-gnulib (GNULIB_MODULES): Add memrchr. + 2013-02-01 Paul Eggert Use fdopendir, fstatat and readlinkat, for efficiency (Bug#13539). === modified file 'admin/merge-gnulib' --- admin/merge-gnulib 2013-02-01 06:30:51 +0000 +++ admin/merge-gnulib 2013-02-11 23:37:18 +0000 @@ -31,7 +31,8 @@ dtoastr dtotimespec dup2 environ execinfo faccessat fcntl-h fdopendir filemode fstatat getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat - manywarnings mktime pselect pthread_sigmask putenv readlink readlinkat + manywarnings memrchr mktime + pselect pthread_sigmask putenv readlink readlinkat sig2str socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timer-time timespec-add timespec-sub unsetenv utimens === modified file 'lib/gnulib.mk' --- lib/gnulib.mk 2013-02-08 23:37:17 +0000 +++ lib/gnulib.mk 2013-02-11 23:37:18 +0000 @@ -21,7 +21,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=dup --avoid=errno --avoid=fchdir --avoid=fcntl --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=open --avoid=openat-die --avoid=opendir --avoid=raise --avoid=save-cwd --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt c-ctype c-strcase careadlinkat close-stream crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat fcntl-h fdopendir filemode fstatat getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask putenv readlink readlinkat sig2str socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timer-time timespec-add timespec-sub unsetenv utimens warnings +# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=dup --avoid=errno --avoid=fchdir --avoid=fcntl --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=open --avoid=openat-die --avoid=opendir --avoid=raise --avoid=save-cwd --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt c-ctype c-strcase careadlinkat close-stream crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat fcntl-h fdopendir filemode fstatat getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings memrchr mktime pselect pthread_sigmask putenv readlink readlinkat sig2str socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timer-time timespec-add timespec-sub unsetenv utimens warnings MOSTLYCLEANFILES += core *.stackdump @@ -480,6 +480,15 @@ ## end gnulib module lstat +## begin gnulib module memrchr + + +EXTRA_DIST += memrchr.c + +EXTRA_libgnu_a_SOURCES += memrchr.c + +## end gnulib module memrchr + ## begin gnulib module mktime @@ -1105,6 +1114,106 @@ ## end gnulib module strftime +## begin gnulib module string + +BUILT_SOURCES += string.h + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \ + -e 's/@''GNULIB_FFSL''@/$(GNULIB_FFSL)/g' \ + -e 's/@''GNULIB_FFSLL''@/$(GNULIB_FFSLL)/g' \ + -e 's/@''GNULIB_MBSLEN''@/$(GNULIB_MBSLEN)/g' \ + -e 's/@''GNULIB_MBSNLEN''@/$(GNULIB_MBSNLEN)/g' \ + -e 's/@''GNULIB_MBSCHR''@/$(GNULIB_MBSCHR)/g' \ + -e 's/@''GNULIB_MBSRCHR''@/$(GNULIB_MBSRCHR)/g' \ + -e 's/@''GNULIB_MBSSTR''@/$(GNULIB_MBSSTR)/g' \ + -e 's/@''GNULIB_MBSCASECMP''@/$(GNULIB_MBSCASECMP)/g' \ + -e 's/@''GNULIB_MBSNCASECMP''@/$(GNULIB_MBSNCASECMP)/g' \ + -e 's/@''GNULIB_MBSPCASECMP''@/$(GNULIB_MBSPCASECMP)/g' \ + -e 's/@''GNULIB_MBSCASESTR''@/$(GNULIB_MBSCASESTR)/g' \ + -e 's/@''GNULIB_MBSCSPN''@/$(GNULIB_MBSCSPN)/g' \ + -e 's/@''GNULIB_MBSPBRK''@/$(GNULIB_MBSPBRK)/g' \ + -e 's/@''GNULIB_MBSSPN''@/$(GNULIB_MBSSPN)/g' \ + -e 's/@''GNULIB_MBSSEP''@/$(GNULIB_MBSSEP)/g' \ + -e 's/@''GNULIB_MBSTOK_R''@/$(GNULIB_MBSTOK_R)/g' \ + -e 's/@''GNULIB_MEMCHR''@/$(GNULIB_MEMCHR)/g' \ + -e 's/@''GNULIB_MEMMEM''@/$(GNULIB_MEMMEM)/g' \ + -e 's/@''GNULIB_MEMPCPY''@/$(GNULIB_MEMPCPY)/g' \ + -e 's/@''GNULIB_MEMRCHR''@/$(GNULIB_MEMRCHR)/g' \ + -e 's/@''GNULIB_RAWMEMCHR''@/$(GNULIB_RAWMEMCHR)/g' \ + -e 's/@''GNULIB_STPCPY''@/$(GNULIB_STPCPY)/g' \ + -e 's/@''GNULIB_STPNCPY''@/$(GNULIB_STPNCPY)/g' \ + -e 's/@''GNULIB_STRCHRNUL''@/$(GNULIB_STRCHRNUL)/g' \ + -e 's/@''GNULIB_STRDUP''@/$(GNULIB_STRDUP)/g' \ + -e 's/@''GNULIB_STRNCAT''@/$(GNULIB_STRNCAT)/g' \ + -e 's/@''GNULIB_STRNDUP''@/$(GNULIB_STRNDUP)/g' \ + -e 's/@''GNULIB_STRNLEN''@/$(GNULIB_STRNLEN)/g' \ + -e 's/@''GNULIB_STRPBRK''@/$(GNULIB_STRPBRK)/g' \ + -e 's/@''GNULIB_STRSEP''@/$(GNULIB_STRSEP)/g' \ + -e 's/@''GNULIB_STRSTR''@/$(GNULIB_STRSTR)/g' \ + -e 's/@''GNULIB_STRCASESTR''@/$(GNULIB_STRCASESTR)/g' \ + -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_STRSIGNAL''@/$(GNULIB_STRSIGNAL)/g' \ + -e 's/@''GNULIB_STRVERSCMP''@/$(GNULIB_STRVERSCMP)/g' \ + < $(srcdir)/string.in.h | \ + sed -e 's|@''HAVE_FFSL''@|$(HAVE_FFSL)|g' \ + -e 's|@''HAVE_FFSLL''@|$(HAVE_FFSLL)|g' \ + -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \ + -e 's|@''HAVE_MEMCHR''@|$(HAVE_MEMCHR)|g' \ + -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \ + -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \ + -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \ + -e 's|@''HAVE_RAWMEMCHR''@|$(HAVE_RAWMEMCHR)|g' \ + -e 's|@''HAVE_STPCPY''@|$(HAVE_STPCPY)|g' \ + -e 's|@''HAVE_STPNCPY''@|$(HAVE_STPNCPY)|g' \ + -e 's|@''HAVE_STRCHRNUL''@|$(HAVE_STRCHRNUL)|g' \ + -e 's|@''HAVE_DECL_STRDUP''@|$(HAVE_DECL_STRDUP)|g' \ + -e 's|@''HAVE_DECL_STRNDUP''@|$(HAVE_DECL_STRNDUP)|g' \ + -e 's|@''HAVE_DECL_STRNLEN''@|$(HAVE_DECL_STRNLEN)|g' \ + -e 's|@''HAVE_STRPBRK''@|$(HAVE_STRPBRK)|g' \ + -e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \ + -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_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \ + -e 's|@''HAVE_STRVERSCMP''@|$(HAVE_STRVERSCMP)|g' \ + -e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \ + -e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \ + -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \ + -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \ + -e 's|@''REPLACE_STRCHRNUL''@|$(REPLACE_STRCHRNUL)|g' \ + -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \ + -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \ + -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \ + -e 's|@''REPLACE_STRERROR_R''@|$(REPLACE_STRERROR_R)|g' \ + -e 's|@''REPLACE_STRNCAT''@|$(REPLACE_STRNCAT)|g' \ + -e 's|@''REPLACE_STRNDUP''@|$(REPLACE_STRNDUP)|g' \ + -e 's|@''REPLACE_STRNLEN''@|$(REPLACE_STRNLEN)|g' \ + -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \ + -e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \ + -e 's|@''UNDEFINE_STRTOK_R''@|$(UNDEFINE_STRTOK_R)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ + < $(srcdir)/string.in.h; \ + } > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += string.h string.h-t + +EXTRA_DIST += string.in.h + +## end gnulib module string + ## begin gnulib module strtoimax === added file 'lib/memrchr.c' --- lib/memrchr.c 1970-01-01 00:00:00 +0000 +++ lib/memrchr.c 2013-02-11 23:37:18 +0000 @@ -0,0 +1,161 @@ +/* memrchr -- find the last occurrence of a byte in a memory block + + Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2013 Free Software + Foundation, Inc. + + Based on strlen implementation by Torbjorn Granlund (tege@sics.se), + with help from Dan Sahlin (dan@sics.se) and + commentary by Jim Blandy (jimb@ai.mit.edu); + adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu), + and implemented by Roland McGrath (roland@ai.mit.edu). + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#if defined _LIBC +# include +#else +# include +# define reg_char char +#endif + +#include +#include + +#undef __memrchr +#ifdef _LIBC +# undef memrchr +#endif + +#ifndef weak_alias +# define __memrchr memrchr +#endif + +/* Search no more than N bytes of S for C. */ +void * +__memrchr (void const *s, int c_in, size_t n) +{ + /* On 32-bit hardware, choosing longword to be a 32-bit unsigned + long instead of a 64-bit uintmax_t tends to give better + performance. On 64-bit hardware, unsigned long is generally 64 + bits already. Change this typedef to experiment with + performance. */ + typedef unsigned long int longword; + + const unsigned char *char_ptr; + const longword *longword_ptr; + longword repeated_one; + longword repeated_c; + unsigned reg_char c; + + c = (unsigned char) c_in; + + /* Handle the last few bytes by reading one byte at a time. + Do this until CHAR_PTR is aligned on a longword boundary. */ + for (char_ptr = (const unsigned char *) s + n; + n > 0 && (size_t) char_ptr % sizeof (longword) != 0; + --n) + if (*--char_ptr == c) + return (void *) char_ptr; + + longword_ptr = (const longword *) char_ptr; + + /* All these elucidatory comments refer to 4-byte longwords, + but the theory applies equally well to any size longwords. */ + + /* Compute auxiliary longword values: + repeated_one is a value which has a 1 in every byte. + repeated_c has c in every byte. */ + repeated_one = 0x01010101; + repeated_c = c | (c << 8); + repeated_c |= repeated_c << 16; + if (0xffffffffU < (longword) -1) + { + repeated_one |= repeated_one << 31 << 1; + repeated_c |= repeated_c << 31 << 1; + if (8 < sizeof (longword)) + { + size_t i; + + for (i = 64; i < sizeof (longword) * 8; i *= 2) + { + repeated_one |= repeated_one << i; + repeated_c |= repeated_c << i; + } + } + } + + /* Instead of the traditional loop which tests each byte, we will test a + longword at a time. The tricky part is testing if *any of the four* + bytes in the longword in question are equal to c. We first use an xor + with repeated_c. This reduces the task to testing whether *any of the + four* bytes in longword1 is zero. + + We compute tmp = + ((longword1 - repeated_one) & ~longword1) & (repeated_one << 7). + That is, we perform the following operations: + 1. Subtract repeated_one. + 2. & ~longword1. + 3. & a mask consisting of 0x80 in every byte. + Consider what happens in each byte: + - If a byte of longword1 is zero, step 1 and 2 transform it into 0xff, + and step 3 transforms it into 0x80. A carry can also be propagated + to more significant bytes. + - If a byte of longword1 is nonzero, let its lowest 1 bit be at + position k (0 <= k <= 7); so the lowest k bits are 0. After step 1, + the byte ends in a single bit of value 0 and k bits of value 1. + After step 2, the result is just k bits of value 1: 2^k - 1. After + step 3, the result is 0. And no carry is produced. + So, if longword1 has only non-zero bytes, tmp is zero. + Whereas if longword1 has a zero byte, call j the position of the least + significant zero byte. Then the result has a zero at positions 0, ..., + j-1 and a 0x80 at position j. We cannot predict the result at the more + significant bytes (positions j+1..3), but it does not matter since we + already have a non-zero bit at position 8*j+7. + + So, the test whether any byte in longword1 is zero is equivalent to + testing whether tmp is nonzero. */ + + while (n >= sizeof (longword)) + { + longword longword1 = *--longword_ptr ^ repeated_c; + + if ((((longword1 - repeated_one) & ~longword1) + & (repeated_one << 7)) != 0) + { + longword_ptr++; + break; + } + n -= sizeof (longword); + } + + char_ptr = (const unsigned char *) longword_ptr; + + /* At this point, we know that either n < sizeof (longword), or one of the + sizeof (longword) bytes starting at char_ptr is == c. On little-endian + machines, we could determine the first such byte without any further + memory accesses, just by looking at the tmp result from the last loop + iteration. But this does not work on big-endian machines. Choose code + that works in both cases. */ + + while (n-- > 0) + { + if (*--char_ptr == c) + return (void *) char_ptr; + } + + return NULL; +} +#ifdef weak_alias +weak_alias (__memrchr, memrchr) +#endif === added file 'lib/string.in.h' --- lib/string.in.h 1970-01-01 00:00:00 +0000 +++ lib/string.in.h 2013-02-11 23:37:18 +0000 @@ -0,0 +1,1029 @@ +/* A GNU-like . + + Copyright (C) 1995-1996, 2001-2013 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . */ + +#ifndef _@GUARD_PREFIX@_STRING_H + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +/* The include_next requires a split double-inclusion guard. */ +#@INCLUDE_NEXT@ @NEXT_STRING_H@ + +#ifndef _@GUARD_PREFIX@_STRING_H +#define _@GUARD_PREFIX@_STRING_H + +/* NetBSD 5.0 mis-defines NULL. */ +#include + +/* MirBSD defines mbslen as a macro. */ +#if @GNULIB_MBSLEN@ && defined __MirBSD__ +# include +#endif + +/* The __attribute__ feature is available in gcc versions 2.5 and later. + The attribute __pure__ was added in gcc 2.96. */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#else +# define _GL_ATTRIBUTE_PURE /* empty */ +#endif + +/* NetBSD 5.0 declares strsignal in , not in . */ +/* But in any case avoid namespace pollution on glibc systems. */ +#if (@GNULIB_STRSIGNAL@ || defined GNULIB_POSIXCHECK) && defined __NetBSD__ \ + && ! defined __GLIBC__ +# include +#endif + +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + +/* The definition of _GL_ARG_NONNULL is copied here. */ + +/* The definition of _GL_WARN_ON_USE is copied here. */ + + +/* Find the index of the least-significant set bit. */ +#if @GNULIB_FFSL@ +# if !@HAVE_FFSL@ +_GL_FUNCDECL_SYS (ffsl, int, (long int i)); +# endif +_GL_CXXALIAS_SYS (ffsl, int, (long int i)); +_GL_CXXALIASWARN (ffsl); +#elif defined GNULIB_POSIXCHECK +# undef ffsl +# if HAVE_RAW_DECL_FFSL +_GL_WARN_ON_USE (ffsl, "ffsl is not portable - use the ffsl module"); +# endif +#endif + + +/* Find the index of the least-significant set bit. */ +#if @GNULIB_FFSLL@ +# if !@HAVE_FFSLL@ +_GL_FUNCDECL_SYS (ffsll, int, (long long int i)); +# endif +_GL_CXXALIAS_SYS (ffsll, int, (long long int i)); +_GL_CXXALIASWARN (ffsll); +#elif defined GNULIB_POSIXCHECK +# undef ffsll +# if HAVE_RAW_DECL_FFSLL +_GL_WARN_ON_USE (ffsll, "ffsll is not portable - use the ffsll module"); +# endif +#endif + + +/* Return the first instance of C within N bytes of S, or NULL. */ +#if @GNULIB_MEMCHR@ +# if @REPLACE_MEMCHR@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define memchr rpl_memchr +# endif +_GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n)); +# else +# if ! @HAVE_MEMCHR@ +_GL_FUNCDECL_SYS (memchr, void *, (void const *__s, int __c, size_t __n) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); +# endif + /* On some systems, this function is defined as an overloaded function: + extern "C" { const void * std::memchr (const void *, int, size_t); } + extern "C++" { void * std::memchr (void *, int, size_t); } */ +_GL_CXXALIAS_SYS_CAST2 (memchr, + void *, (void const *__s, int __c, size_t __n), + void const *, (void const *__s, int __c, size_t __n)); +# endif +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +_GL_CXXALIASWARN1 (memchr, void *, (void *__s, int __c, size_t __n)); +_GL_CXXALIASWARN1 (memchr, void const *, + (void const *__s, int __c, size_t __n)); +# else +_GL_CXXALIASWARN (memchr); +# endif +#elif defined GNULIB_POSIXCHECK +# undef memchr +/* Assume memchr is always declared. */ +_GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - " + "use gnulib module memchr for portability" ); +#endif + +/* Return the first occurrence of NEEDLE in HAYSTACK. */ +#if @GNULIB_MEMMEM@ +# if @REPLACE_MEMMEM@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define memmem rpl_memmem +# endif +_GL_FUNCDECL_RPL (memmem, void *, + (void const *__haystack, size_t __haystack_len, + void const *__needle, size_t __needle_len) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1, 3))); +_GL_CXXALIAS_RPL (memmem, void *, + (void const *__haystack, size_t __haystack_len, + void const *__needle, size_t __needle_len)); +# else +# if ! @HAVE_DECL_MEMMEM@ +_GL_FUNCDECL_SYS (memmem, void *, + (void const *__haystack, size_t __haystack_len, + void const *__needle, size_t __needle_len) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1, 3))); +# endif +_GL_CXXALIAS_SYS (memmem, void *, + (void const *__haystack, size_t __haystack_len, + void const *__needle, size_t __needle_len)); +# endif +_GL_CXXALIASWARN (memmem); +#elif defined GNULIB_POSIXCHECK +# undef memmem +# if HAVE_RAW_DECL_MEMMEM +_GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - " + "use gnulib module memmem-simple for portability, " + "and module memmem for speed" ); +# endif +#endif + +/* Copy N bytes of SRC to DEST, return pointer to bytes after the + last written byte. */ +#if @GNULIB_MEMPCPY@ +# if ! @HAVE_MEMPCPY@ +_GL_FUNCDECL_SYS (mempcpy, void *, + (void *restrict __dest, void const *restrict __src, + size_t __n) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (mempcpy, void *, + (void *restrict __dest, void const *restrict __src, + size_t __n)); +_GL_CXXALIASWARN (mempcpy); +#elif defined GNULIB_POSIXCHECK +# undef mempcpy +# if HAVE_RAW_DECL_MEMPCPY +_GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - " + "use gnulib module mempcpy for portability"); +# endif +#endif + +/* Search backwards through a block for a byte (specified as an int). */ +#if @GNULIB_MEMRCHR@ +# if ! @HAVE_DECL_MEMRCHR@ +_GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); +# endif + /* On some systems, this function is defined as an overloaded function: + extern "C++" { const void * std::memrchr (const void *, int, size_t); } + extern "C++" { void * std::memrchr (void *, int, size_t); } */ +_GL_CXXALIAS_SYS_CAST2 (memrchr, + void *, (void const *, int, size_t), + void const *, (void const *, int, size_t)); +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +_GL_CXXALIASWARN1 (memrchr, void *, (void *, int, size_t)); +_GL_CXXALIASWARN1 (memrchr, void const *, (void const *, int, size_t)); +# else +_GL_CXXALIASWARN (memrchr); +# endif +#elif defined GNULIB_POSIXCHECK +# undef memrchr +# if HAVE_RAW_DECL_MEMRCHR +_GL_WARN_ON_USE (memrchr, "memrchr is unportable - " + "use gnulib module memrchr for portability"); +# endif +#endif + +/* Find the first occurrence of C in S. More efficient than + memchr(S,C,N), at the expense of undefined behavior if C does not + occur within N bytes. */ +#if @GNULIB_RAWMEMCHR@ +# if ! @HAVE_RAWMEMCHR@ +_GL_FUNCDECL_SYS (rawmemchr, void *, (void const *__s, int __c_in) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); +# endif + /* On some systems, this function is defined as an overloaded function: + extern "C++" { const void * std::rawmemchr (const void *, int); } + extern "C++" { void * std::rawmemchr (void *, int); } */ +_GL_CXXALIAS_SYS_CAST2 (rawmemchr, + void *, (void const *__s, int __c_in), + void const *, (void const *__s, int __c_in)); +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +_GL_CXXALIASWARN1 (rawmemchr, void *, (void *__s, int __c_in)); +_GL_CXXALIASWARN1 (rawmemchr, void const *, (void const *__s, int __c_in)); +# else +_GL_CXXALIASWARN (rawmemchr); +# endif +#elif defined GNULIB_POSIXCHECK +# undef rawmemchr +# if HAVE_RAW_DECL_RAWMEMCHR +_GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - " + "use gnulib module rawmemchr for portability"); +# endif +#endif + +/* Copy SRC to DST, returning the address of the terminating '\0' in DST. */ +#if @GNULIB_STPCPY@ +# if ! @HAVE_STPCPY@ +_GL_FUNCDECL_SYS (stpcpy, char *, + (char *restrict __dst, char const *restrict __src) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (stpcpy, char *, + (char *restrict __dst, char const *restrict __src)); +_GL_CXXALIASWARN (stpcpy); +#elif defined GNULIB_POSIXCHECK +# undef stpcpy +# if HAVE_RAW_DECL_STPCPY +_GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - " + "use gnulib module stpcpy for portability"); +# endif +#endif + +/* Copy no more than N bytes of SRC to DST, returning a pointer past the + last non-NUL byte written into DST. */ +#if @GNULIB_STPNCPY@ +# if @REPLACE_STPNCPY@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef stpncpy +# define stpncpy rpl_stpncpy +# endif +_GL_FUNCDECL_RPL (stpncpy, char *, + (char *restrict __dst, char const *restrict __src, + size_t __n) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (stpncpy, char *, + (char *restrict __dst, char const *restrict __src, + size_t __n)); +# else +# if ! @HAVE_STPNCPY@ +_GL_FUNCDECL_SYS (stpncpy, char *, + (char *restrict __dst, char const *restrict __src, + size_t __n) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (stpncpy, char *, + (char *restrict __dst, char const *restrict __src, + size_t __n)); +# endif +_GL_CXXALIASWARN (stpncpy); +#elif defined GNULIB_POSIXCHECK +# undef stpncpy +# if HAVE_RAW_DECL_STPNCPY +_GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - " + "use gnulib module stpncpy for portability"); +# endif +#endif + +#if defined GNULIB_POSIXCHECK +/* strchr() does not work with multibyte strings if the locale encoding is + GB18030 and the character to be searched is a digit. */ +# undef strchr +/* Assume strchr is always declared. */ +_GL_WARN_ON_USE (strchr, "strchr cannot work correctly on character strings " + "in some multibyte locales - " + "use mbschr if you care about internationalization"); +#endif + +/* Find the first occurrence of C in S or the final NUL byte. */ +#if @GNULIB_STRCHRNUL@ +# if @REPLACE_STRCHRNUL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define strchrnul rpl_strchrnul +# endif +_GL_FUNCDECL_RPL (strchrnul, char *, (const char *__s, int __c_in) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (strchrnul, char *, + (const char *str, int ch)); +# else +# if ! @HAVE_STRCHRNUL@ +_GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); +# endif + /* On some systems, this function is defined as an overloaded function: + extern "C++" { const char * std::strchrnul (const char *, int); } + extern "C++" { char * std::strchrnul (char *, int); } */ +_GL_CXXALIAS_SYS_CAST2 (strchrnul, + char *, (char const *__s, int __c_in), + char const *, (char const *__s, int __c_in)); +# endif +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +_GL_CXXALIASWARN1 (strchrnul, char *, (char *__s, int __c_in)); +_GL_CXXALIASWARN1 (strchrnul, char const *, (char const *__s, int __c_in)); +# else +_GL_CXXALIASWARN (strchrnul); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strchrnul +# if HAVE_RAW_DECL_STRCHRNUL +_GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - " + "use gnulib module strchrnul for portability"); +# endif +#endif + +/* Duplicate S, returning an identical malloc'd string. */ +#if @GNULIB_STRDUP@ +# if @REPLACE_STRDUP@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef strdup +# define strdup rpl_strdup +# endif +_GL_FUNCDECL_RPL (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (strdup, char *, (char const *__s)); +# else +# if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup + /* strdup exists as a function and as a macro. Get rid of the macro. */ +# undef strdup +# endif +# if !(@HAVE_DECL_STRDUP@ || defined strdup) +_GL_FUNCDECL_SYS (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (strdup, char *, (char const *__s)); +# endif +_GL_CXXALIASWARN (strdup); +#elif defined GNULIB_POSIXCHECK +# undef strdup +# if HAVE_RAW_DECL_STRDUP +_GL_WARN_ON_USE (strdup, "strdup is unportable - " + "use gnulib module strdup for portability"); +# endif +#endif + +/* Append no more than N characters from SRC onto DEST. */ +#if @GNULIB_STRNCAT@ +# if @REPLACE_STRNCAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef strncat +# define strncat rpl_strncat +# endif +_GL_FUNCDECL_RPL (strncat, char *, (char *dest, const char *src, size_t n) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (strncat, char *, (char *dest, const char *src, size_t n)); +# else +_GL_CXXALIAS_SYS (strncat, char *, (char *dest, const char *src, size_t n)); +# endif +_GL_CXXALIASWARN (strncat); +#elif defined GNULIB_POSIXCHECK +# undef strncat +# if HAVE_RAW_DECL_STRNCAT +_GL_WARN_ON_USE (strncat, "strncat is unportable - " + "use gnulib module strncat for portability"); +# endif +#endif + +/* Return a newly allocated copy of at most N bytes of STRING. */ +#if @GNULIB_STRNDUP@ +# if @REPLACE_STRNDUP@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef strndup +# define strndup rpl_strndup +# endif +_GL_FUNCDECL_RPL (strndup, char *, (char const *__string, size_t __n) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (strndup, char *, (char const *__string, size_t __n)); +# else +# if ! @HAVE_DECL_STRNDUP@ +_GL_FUNCDECL_SYS (strndup, char *, (char const *__string, size_t __n) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (strndup, char *, (char const *__string, size_t __n)); +# endif +_GL_CXXALIASWARN (strndup); +#elif defined GNULIB_POSIXCHECK +# undef strndup +# if HAVE_RAW_DECL_STRNDUP +_GL_WARN_ON_USE (strndup, "strndup is unportable - " + "use gnulib module strndup for portability"); +# endif +#endif + +/* Find the length (number of bytes) of STRING, but scan at most + MAXLEN bytes. If no '\0' terminator is found in that many bytes, + return MAXLEN. */ +#if @GNULIB_STRNLEN@ +# if @REPLACE_STRNLEN@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef strnlen +# define strnlen rpl_strnlen +# endif +_GL_FUNCDECL_RPL (strnlen, size_t, (char const *__string, size_t __maxlen) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (strnlen, size_t, (char const *__string, size_t __maxlen)); +# else +# if ! @HAVE_DECL_STRNLEN@ +_GL_FUNCDECL_SYS (strnlen, size_t, (char const *__string, size_t __maxlen) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (strnlen, size_t, (char const *__string, size_t __maxlen)); +# endif +_GL_CXXALIASWARN (strnlen); +#elif defined GNULIB_POSIXCHECK +# undef strnlen +# if HAVE_RAW_DECL_STRNLEN +_GL_WARN_ON_USE (strnlen, "strnlen is unportable - " + "use gnulib module strnlen for portability"); +# endif +#endif + +#if defined GNULIB_POSIXCHECK +/* strcspn() assumes the second argument is a list of single-byte characters. + Even in this simple case, it does not work with multibyte strings if the + locale encoding is GB18030 and one of the characters to be searched is a + digit. */ +# undef strcspn +/* Assume strcspn is always declared. */ +_GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on character strings " + "in multibyte locales - " + "use mbscspn if you care about internationalization"); +#endif + +/* Find the first occurrence in S of any character in ACCEPT. */ +#if @GNULIB_STRPBRK@ +# if ! @HAVE_STRPBRK@ +_GL_FUNCDECL_SYS (strpbrk, char *, (char const *__s, char const *__accept) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1, 2))); +# endif + /* On some systems, this function is defined as an overloaded function: + extern "C" { const char * strpbrk (const char *, const char *); } + extern "C++" { char * strpbrk (char *, const char *); } */ +_GL_CXXALIAS_SYS_CAST2 (strpbrk, + char *, (char const *__s, char const *__accept), + const char *, (char const *__s, char const *__accept)); +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +_GL_CXXALIASWARN1 (strpbrk, char *, (char *__s, char const *__accept)); +_GL_CXXALIASWARN1 (strpbrk, char const *, + (char const *__s, char const *__accept)); +# else +_GL_CXXALIASWARN (strpbrk); +# endif +# if defined GNULIB_POSIXCHECK +/* strpbrk() assumes the second argument is a list of single-byte characters. + Even in this simple case, it does not work with multibyte strings if the + locale encoding is GB18030 and one of the characters to be searched is a + digit. */ +# undef strpbrk +_GL_WARN_ON_USE (strpbrk, "strpbrk cannot work correctly on character strings " + "in multibyte locales - " + "use mbspbrk if you care about internationalization"); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strpbrk +# if HAVE_RAW_DECL_STRPBRK +_GL_WARN_ON_USE (strpbrk, "strpbrk is unportable - " + "use gnulib module strpbrk for portability"); +# endif +#endif + +#if defined GNULIB_POSIXCHECK +/* strspn() assumes the second argument is a list of single-byte characters. + Even in this simple case, it cannot work with multibyte strings. */ +# undef strspn +/* Assume strspn is always declared. */ +_GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings " + "in multibyte locales - " + "use mbsspn if you care about internationalization"); +#endif + +#if defined GNULIB_POSIXCHECK +/* strrchr() does not work with multibyte strings if the locale encoding is + GB18030 and the character to be searched is a digit. */ +# undef strrchr +/* Assume strrchr is always declared. */ +_GL_WARN_ON_USE (strrchr, "strrchr cannot work correctly on character strings " + "in some multibyte locales - " + "use mbsrchr if you care about internationalization"); +#endif + +/* Search the next delimiter (char listed in DELIM) starting at *STRINGP. + If one is found, overwrite it with a NUL, and advance *STRINGP + to point to the next char after it. Otherwise, set *STRINGP to NULL. + If *STRINGP was already NULL, nothing happens. + Return the old value of *STRINGP. + + This is a variant of strtok() that is multithread-safe and supports + empty fields. + + Caveat: It modifies the original string. + Caveat: These functions cannot be used on constant strings. + Caveat: The identity of the delimiting character is lost. + Caveat: It doesn't work with multibyte strings unless all of the delimiter + characters are ASCII characters < 0x30. + + See also strtok_r(). */ +#if @GNULIB_STRSEP@ +# if ! @HAVE_STRSEP@ +_GL_FUNCDECL_SYS (strsep, char *, + (char **restrict __stringp, char const *restrict __delim) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (strsep, char *, + (char **restrict __stringp, char const *restrict __delim)); +_GL_CXXALIASWARN (strsep); +# if defined GNULIB_POSIXCHECK +# undef strsep +_GL_WARN_ON_USE (strsep, "strsep cannot work correctly on character strings " + "in multibyte locales - " + "use mbssep if you care about internationalization"); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strsep +# if HAVE_RAW_DECL_STRSEP +_GL_WARN_ON_USE (strsep, "strsep is unportable - " + "use gnulib module strsep for portability"); +# endif +#endif + +#if @GNULIB_STRSTR@ +# if @REPLACE_STRSTR@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define strstr rpl_strstr +# endif +_GL_FUNCDECL_RPL (strstr, char *, (const char *haystack, const char *needle) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (strstr, char *, (const char *haystack, const char *needle)); +# else + /* On some systems, this function is defined as an overloaded function: + extern "C++" { const char * strstr (const char *, const char *); } + extern "C++" { char * strstr (char *, const char *); } */ +_GL_CXXALIAS_SYS_CAST2 (strstr, + char *, (const char *haystack, const char *needle), + const char *, (const char *haystack, const char *needle)); +# endif +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +_GL_CXXALIASWARN1 (strstr, char *, (char *haystack, const char *needle)); +_GL_CXXALIASWARN1 (strstr, const char *, + (const char *haystack, const char *needle)); +# else +_GL_CXXALIASWARN (strstr); +# endif +#elif defined GNULIB_POSIXCHECK +/* strstr() does not work with multibyte strings if the locale encoding is + different from UTF-8: + POSIX says that it operates on "strings", and "string" in POSIX is defined + as a sequence of bytes, not of characters. */ +# undef strstr +/* Assume strstr is always declared. */ +_GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot " + "work correctly on character strings in most " + "multibyte locales - " + "use mbsstr if you care about internationalization, " + "or use strstr if you care about speed"); +#endif + +/* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive + comparison. */ +#if @GNULIB_STRCASESTR@ +# if @REPLACE_STRCASESTR@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define strcasestr rpl_strcasestr +# endif +_GL_FUNCDECL_RPL (strcasestr, char *, + (const char *haystack, const char *needle) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (strcasestr, char *, + (const char *haystack, const char *needle)); +# else +# if ! @HAVE_STRCASESTR@ +_GL_FUNCDECL_SYS (strcasestr, char *, + (const char *haystack, const char *needle) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1, 2))); +# endif + /* On some systems, this function is defined as an overloaded function: + extern "C++" { const char * strcasestr (const char *, const char *); } + extern "C++" { char * strcasestr (char *, const char *); } */ +_GL_CXXALIAS_SYS_CAST2 (strcasestr, + char *, (const char *haystack, const char *needle), + const char *, (const char *haystack, const char *needle)); +# endif +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +_GL_CXXALIASWARN1 (strcasestr, char *, (char *haystack, const char *needle)); +_GL_CXXALIASWARN1 (strcasestr, const char *, + (const char *haystack, const char *needle)); +# else +_GL_CXXALIASWARN (strcasestr); +# endif +#elif defined GNULIB_POSIXCHECK +/* strcasestr() does not work with multibyte strings: + It is a glibc extension, and glibc implements it only for unibyte + locales. */ +# undef strcasestr +# if HAVE_RAW_DECL_STRCASESTR +_GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character " + "strings in multibyte locales - " + "use mbscasestr if you care about " + "internationalization, or use c-strcasestr if you want " + "a locale independent function"); +# endif +#endif + +/* Parse S into tokens separated by characters in DELIM. + If S is NULL, the saved pointer in SAVE_PTR is used as + the next starting point. For example: + char s[] = "-abc-=-def"; + char *sp; + x = strtok_r(s, "-", &sp); // x = "abc", sp = "=-def" + x = strtok_r(NULL, "-=", &sp); // x = "def", sp = NULL + x = strtok_r(NULL, "=", &sp); // x = NULL + // s = "abc\0-def\0" + + This is a variant of strtok() that is multithread-safe. + + For the POSIX documentation for this function, see: + http://www.opengroup.org/susv3xsh/strtok.html + + Caveat: It modifies the original string. + Caveat: These functions cannot be used on constant strings. + Caveat: The identity of the delimiting character is lost. + Caveat: It doesn't work with multibyte strings unless all of the delimiter + characters are ASCII characters < 0x30. + + See also strsep(). */ +#if @GNULIB_STRTOK_R@ +# if @REPLACE_STRTOK_R@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef strtok_r +# define strtok_r rpl_strtok_r +# endif +_GL_FUNCDECL_RPL (strtok_r, char *, + (char *restrict s, char const *restrict delim, + char **restrict save_ptr) + _GL_ARG_NONNULL ((2, 3))); +_GL_CXXALIAS_RPL (strtok_r, char *, + (char *restrict s, char const *restrict delim, + char **restrict save_ptr)); +# else +# if @UNDEFINE_STRTOK_R@ || defined GNULIB_POSIXCHECK +# undef strtok_r +# endif +# if ! @HAVE_DECL_STRTOK_R@ +_GL_FUNCDECL_SYS (strtok_r, char *, + (char *restrict s, char const *restrict delim, + char **restrict save_ptr) + _GL_ARG_NONNULL ((2, 3))); +# endif +_GL_CXXALIAS_SYS (strtok_r, char *, + (char *restrict s, char const *restrict delim, + char **restrict save_ptr)); +# endif +_GL_CXXALIASWARN (strtok_r); +# if defined GNULIB_POSIXCHECK +_GL_WARN_ON_USE (strtok_r, "strtok_r cannot work correctly on character " + "strings in multibyte locales - " + "use mbstok_r if you care about internationalization"); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strtok_r +# if HAVE_RAW_DECL_STRTOK_R +_GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - " + "use gnulib module strtok_r for portability"); +# endif +#endif + + +/* The following functions are not specified by POSIX. They are gnulib + extensions. */ + +#if @GNULIB_MBSLEN@ +/* Return the number of multibyte characters in the character string STRING. + This considers multibyte characters, unlike strlen, which counts bytes. */ +# ifdef __MirBSD__ /* MirBSD defines mbslen as a macro. Override it. */ +# undef mbslen +# endif +# if @HAVE_MBSLEN@ /* AIX, OSF/1, MirBSD define mbslen already in libc. */ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define mbslen rpl_mbslen +# endif +_GL_FUNCDECL_RPL (mbslen, size_t, (const char *string) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (mbslen, size_t, (const char *string)); +# else +_GL_FUNCDECL_SYS (mbslen, size_t, (const char *string) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_SYS (mbslen, size_t, (const char *string)); +# endif +_GL_CXXALIASWARN (mbslen); +#endif + +#if @GNULIB_MBSNLEN@ +/* Return the number of multibyte characters in the character string starting + at STRING and ending at STRING + LEN. */ +_GL_EXTERN_C size_t mbsnlen (const char *string, size_t len) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1)); +#endif + +#if @GNULIB_MBSCHR@ +/* Locate the first single-byte character C in the character string STRING, + and return a pointer to it. Return NULL if C is not found in STRING. + Unlike strchr(), this function works correctly in multibyte locales with + encodings such as GB18030. */ +# if defined __hpux +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define mbschr rpl_mbschr /* avoid collision with HP-UX function */ +# endif +_GL_FUNCDECL_RPL (mbschr, char *, (const char *string, int c) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (mbschr, char *, (const char *string, int c)); +# else +_GL_FUNCDECL_SYS (mbschr, char *, (const char *string, int c) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_SYS (mbschr, char *, (const char *string, int c)); +# endif +_GL_CXXALIASWARN (mbschr); +#endif + +#if @GNULIB_MBSRCHR@ +/* Locate the last single-byte character C in the character string STRING, + and return a pointer to it. Return NULL if C is not found in STRING. + Unlike strrchr(), this function works correctly in multibyte locales with + encodings such as GB18030. */ +# if defined __hpux || defined __INTERIX +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define mbsrchr rpl_mbsrchr /* avoid collision with system function */ +# endif +_GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (mbsrchr, char *, (const char *string, int c)); +# else +_GL_FUNCDECL_SYS (mbsrchr, char *, (const char *string, int c) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_SYS (mbsrchr, char *, (const char *string, int c)); +# endif +_GL_CXXALIASWARN (mbsrchr); +#endif + +#if @GNULIB_MBSSTR@ +/* Find the first occurrence of the character string NEEDLE in the character + string HAYSTACK. Return NULL if NEEDLE is not found in HAYSTACK. + Unlike strstr(), this function works correctly in multibyte locales with + encodings different from UTF-8. */ +_GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1, 2)); +#endif + +#if @GNULIB_MBSCASECMP@ +/* Compare the character strings S1 and S2, ignoring case, returning less than, + equal to or greater than zero if S1 is lexicographically less than, equal to + or greater than S2. + Note: This function may, in multibyte locales, return 0 for strings of + different lengths! + Unlike strcasecmp(), this function works correctly in multibyte locales. */ +_GL_EXTERN_C int mbscasecmp (const char *s1, const char *s2) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1, 2)); +#endif + +#if @GNULIB_MBSNCASECMP@ +/* Compare the initial segment of the character string S1 consisting of at most + N characters with the initial segment of the character string S2 consisting + of at most N characters, ignoring case, returning less than, equal to or + greater than zero if the initial segment of S1 is lexicographically less + than, equal to or greater than the initial segment of S2. + Note: This function may, in multibyte locales, return 0 for initial segments + of different lengths! + Unlike strncasecmp(), this function works correctly in multibyte locales. + But beware that N is not a byte count but a character count! */ +_GL_EXTERN_C int mbsncasecmp (const char *s1, const char *s2, size_t n) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1, 2)); +#endif + +#if @GNULIB_MBSPCASECMP@ +/* Compare the initial segment of the character string STRING consisting of + at most mbslen (PREFIX) characters with the character string PREFIX, + ignoring case. If the two match, return a pointer to the first byte + after this prefix in STRING. Otherwise, return NULL. + Note: This function may, in multibyte locales, return non-NULL if STRING + is of smaller length than PREFIX! + Unlike strncasecmp(), this function works correctly in multibyte + locales. */ +_GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1, 2)); +#endif + +#if @GNULIB_MBSCASESTR@ +/* Find the first occurrence of the character string NEEDLE in the character + string HAYSTACK, using case-insensitive comparison. + Note: This function may, in multibyte locales, return success even if + strlen (haystack) < strlen (needle) ! + Unlike strcasestr(), this function works correctly in multibyte locales. */ +_GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1, 2)); +#endif + +#if @GNULIB_MBSCSPN@ +/* Find the first occurrence in the character string STRING of any character + in the character string ACCEPT. Return the number of bytes from the + beginning of the string to this occurrence, or to the end of the string + if none exists. + Unlike strcspn(), this function works correctly in multibyte locales. */ +_GL_EXTERN_C size_t mbscspn (const char *string, const char *accept) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1, 2)); +#endif + +#if @GNULIB_MBSPBRK@ +/* Find the first occurrence in the character string STRING of any character + in the character string ACCEPT. Return the pointer to it, or NULL if none + exists. + Unlike strpbrk(), this function works correctly in multibyte locales. */ +# if defined __hpux +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */ +# endif +_GL_FUNCDECL_RPL (mbspbrk, char *, (const char *string, const char *accept) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (mbspbrk, char *, (const char *string, const char *accept)); +# else +_GL_FUNCDECL_SYS (mbspbrk, char *, (const char *string, const char *accept) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_SYS (mbspbrk, char *, (const char *string, const char *accept)); +# endif +_GL_CXXALIASWARN (mbspbrk); +#endif + +#if @GNULIB_MBSSPN@ +/* Find the first occurrence in the character string STRING of any character + not in the character string REJECT. Return the number of bytes from the + beginning of the string to this occurrence, or to the end of the string + if none exists. + Unlike strspn(), this function works correctly in multibyte locales. */ +_GL_EXTERN_C size_t mbsspn (const char *string, const char *reject) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1, 2)); +#endif + +#if @GNULIB_MBSSEP@ +/* Search the next delimiter (multibyte character listed in the character + string DELIM) starting at the character string *STRINGP. + If one is found, overwrite it with a NUL, and advance *STRINGP to point + to the next multibyte character after it. Otherwise, set *STRINGP to NULL. + If *STRINGP was already NULL, nothing happens. + Return the old value of *STRINGP. + + This is a variant of mbstok_r() that supports empty fields. + + Caveat: It modifies the original string. + Caveat: These functions cannot be used on constant strings. + Caveat: The identity of the delimiting character is lost. + + See also mbstok_r(). */ +_GL_EXTERN_C char * mbssep (char **stringp, const char *delim) + _GL_ARG_NONNULL ((1, 2)); +#endif + +#if @GNULIB_MBSTOK_R@ +/* Parse the character string STRING into tokens separated by characters in + the character string DELIM. + If STRING is NULL, the saved pointer in SAVE_PTR is used as + the next starting point. For example: + char s[] = "-abc-=-def"; + char *sp; + x = mbstok_r(s, "-", &sp); // x = "abc", sp = "=-def" + x = mbstok_r(NULL, "-=", &sp); // x = "def", sp = NULL + x = mbstok_r(NULL, "=", &sp); // x = NULL + // s = "abc\0-def\0" + + Caveat: It modifies the original string. + Caveat: These functions cannot be used on constant strings. + Caveat: The identity of the delimiting character is lost. + + See also mbssep(). */ +_GL_EXTERN_C char * mbstok_r (char *string, const char *delim, char **save_ptr) + _GL_ARG_NONNULL ((2, 3)); +#endif + +/* Map any int, typically from errno, into an error message. */ +#if @GNULIB_STRERROR@ +# if @REPLACE_STRERROR@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef strerror +# define strerror rpl_strerror +# endif +_GL_FUNCDECL_RPL (strerror, char *, (int)); +_GL_CXXALIAS_RPL (strerror, char *, (int)); +# else +_GL_CXXALIAS_SYS (strerror, char *, (int)); +# endif +_GL_CXXALIASWARN (strerror); +#elif defined GNULIB_POSIXCHECK +# undef strerror +/* Assume strerror is always declared. */ +_GL_WARN_ON_USE (strerror, "strerror is unportable - " + "use gnulib module strerror to guarantee non-NULL result"); +#endif + +/* Map any int, typically from errno, into an error message. Multithread-safe. + Uses the POSIX declaration, not the glibc declaration. */ +#if @GNULIB_STRERROR_R@ +# if @REPLACE_STRERROR_R@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef strerror_r +# define strerror_r rpl_strerror_r +# endif +_GL_FUNCDECL_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen)); +# else +# if !@HAVE_DECL_STRERROR_R@ +_GL_FUNCDECL_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen) + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen)); +# endif +# if @HAVE_DECL_STRERROR_R@ +_GL_CXXALIASWARN (strerror_r); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strerror_r +# if HAVE_RAW_DECL_STRERROR_R +_GL_WARN_ON_USE (strerror_r, "strerror_r is unportable - " + "use gnulib module strerror_r-posix for portability"); +# endif +#endif + +#if @GNULIB_STRSIGNAL@ +# if @REPLACE_STRSIGNAL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define strsignal rpl_strsignal +# endif +_GL_FUNCDECL_RPL (strsignal, char *, (int __sig)); +_GL_CXXALIAS_RPL (strsignal, char *, (int __sig)); +# else +# if ! @HAVE_DECL_STRSIGNAL@ +_GL_FUNCDECL_SYS (strsignal, char *, (int __sig)); +# endif +/* Need to cast, because on Cygwin 1.5.x systems, the return type is + 'const char *'. */ +_GL_CXXALIAS_SYS_CAST (strsignal, char *, (int __sig)); +# endif +_GL_CXXALIASWARN (strsignal); +#elif defined GNULIB_POSIXCHECK +# undef strsignal +# if HAVE_RAW_DECL_STRSIGNAL +_GL_WARN_ON_USE (strsignal, "strsignal is unportable - " + "use gnulib module strsignal for portability"); +# endif +#endif + +#if @GNULIB_STRVERSCMP@ +# if !@HAVE_STRVERSCMP@ +_GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (strverscmp, int, (const char *, const char *)); +_GL_CXXALIASWARN (strverscmp); +#elif defined GNULIB_POSIXCHECK +# undef strverscmp +# if HAVE_RAW_DECL_STRVERSCMP +_GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - " + "use gnulib module strverscmp for portability"); +# endif +#endif + + +#endif /* _@GUARD_PREFIX@_STRING_H */ +#endif /* _@GUARD_PREFIX@_STRING_H */ === modified file 'm4/gnulib-comp.m4' --- m4/gnulib-comp.m4 2013-02-01 06:30:51 +0000 +++ m4/gnulib-comp.m4 2013-02-11 23:37:18 +0000 @@ -83,6 +83,7 @@ AC_REQUIRE([AC_SYS_LARGEFILE]) # Code from module lstat: # Code from module manywarnings: + # Code from module memrchr: # Code from module mktime: # Code from module multiarch: # Code from module nocrash: @@ -117,6 +118,7 @@ # Code from module stdio: # Code from module stdlib: # Code from module strftime: + # Code from module string: # Code from module strtoimax: # Code from module strtoll: # Code from module strtoull: @@ -242,6 +244,12 @@ gl_PREREQ_LSTAT fi gl_SYS_STAT_MODULE_INDICATOR([lstat]) + gl_FUNC_MEMRCHR + if test $ac_cv_func_memrchr = no; then + AC_LIBOBJ([memrchr]) + gl_PREREQ_MEMRCHR + fi + gl_STRING_MODULE_INDICATOR([memrchr]) gl_FUNC_MKTIME if test $REPLACE_MKTIME = 1; then AC_LIBOBJ([mktime]) @@ -294,6 +302,7 @@ gl_STDIO_H gl_STDLIB_H gl_FUNC_GNU_STRFTIME + gl_HEADER_STRING_H gl_FUNC_STRTOIMAX if test $HAVE_STRTOIMAX = 0 || test $REPLACE_STRTOIMAX = 1; then AC_LIBOBJ([strtoimax]) @@ -757,6 +766,7 @@ lib/lstat.c lib/md5.c lib/md5.h + lib/memrchr.c lib/mktime-internal.h lib/mktime.c lib/openat-priv.h @@ -790,6 +800,7 @@ lib/stdlib.in.h lib/strftime.c lib/strftime.h + lib/string.in.h lib/strtoimax.c lib/strtol.c lib/strtoll.c @@ -848,6 +859,7 @@ m4/lstat.m4 m4/manywarnings.m4 m4/md5.m4 + m4/memrchr.m4 m4/mktime.m4 m4/multiarch.m4 m4/nocrash.m4 @@ -877,6 +889,7 @@ m4/stdio_h.m4 m4/stdlib_h.m4 m4/strftime.m4 + m4/string_h.m4 m4/strtoimax.m4 m4/strtoll.m4 m4/strtoull.m4 === added file 'm4/memrchr.m4' --- m4/memrchr.m4 1970-01-01 00:00:00 +0000 +++ m4/memrchr.m4 2013-02-11 23:37:18 +0000 @@ -0,0 +1,23 @@ +# memrchr.m4 serial 10 +dnl Copyright (C) 2002-2003, 2005-2007, 2009-2013 Free Software Foundation, +dnl Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_MEMRCHR], +[ + dnl Persuade glibc to declare memrchr(). + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + + AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + AC_CHECK_DECLS_ONCE([memrchr]) + if test $ac_cv_have_decl_memrchr = no; then + HAVE_DECL_MEMRCHR=0 + fi + + AC_CHECK_FUNCS([memrchr]) +]) + +# Prerequisites of lib/memrchr.c. +AC_DEFUN([gl_PREREQ_MEMRCHR], [:]) === added file 'm4/string_h.m4' --- m4/string_h.m4 1970-01-01 00:00:00 +0000 +++ m4/string_h.m4 2013-02-11 23:37:18 +0000 @@ -0,0 +1,120 @@ +# Configure a GNU-like replacement for . + +# Copyright (C) 2007-2013 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 21 + +# Written by Paul Eggert. + +AC_DEFUN([gl_HEADER_STRING_H], +[ + dnl Use AC_REQUIRE here, so that the default behavior below is expanded + dnl once only, before all statements that occur in other macros. + AC_REQUIRE([gl_HEADER_STRING_H_BODY]) +]) + +AC_DEFUN([gl_HEADER_STRING_H_BODY], +[ + AC_REQUIRE([AC_C_RESTRICT]) + AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + gl_NEXT_HEADERS([string.h]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use, and which is not + dnl guaranteed by C89. + gl_WARN_ON_USE_PREPARE([[#include + ]], + [ffsl ffsll memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul + strdup strncat strndup strnlen strpbrk strsep strcasestr strtok_r + strerror_r strsignal strverscmp]) +]) + +AC_DEFUN([gl_STRING_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], +[ + GNULIB_FFSL=0; AC_SUBST([GNULIB_FFSL]) + GNULIB_FFSLL=0; AC_SUBST([GNULIB_FFSLL]) + GNULIB_MEMCHR=0; AC_SUBST([GNULIB_MEMCHR]) + GNULIB_MEMMEM=0; AC_SUBST([GNULIB_MEMMEM]) + GNULIB_MEMPCPY=0; AC_SUBST([GNULIB_MEMPCPY]) + GNULIB_MEMRCHR=0; AC_SUBST([GNULIB_MEMRCHR]) + GNULIB_RAWMEMCHR=0; AC_SUBST([GNULIB_RAWMEMCHR]) + GNULIB_STPCPY=0; AC_SUBST([GNULIB_STPCPY]) + GNULIB_STPNCPY=0; AC_SUBST([GNULIB_STPNCPY]) + GNULIB_STRCHRNUL=0; AC_SUBST([GNULIB_STRCHRNUL]) + GNULIB_STRDUP=0; AC_SUBST([GNULIB_STRDUP]) + GNULIB_STRNCAT=0; AC_SUBST([GNULIB_STRNCAT]) + GNULIB_STRNDUP=0; AC_SUBST([GNULIB_STRNDUP]) + GNULIB_STRNLEN=0; AC_SUBST([GNULIB_STRNLEN]) + GNULIB_STRPBRK=0; AC_SUBST([GNULIB_STRPBRK]) + GNULIB_STRSEP=0; AC_SUBST([GNULIB_STRSEP]) + GNULIB_STRSTR=0; AC_SUBST([GNULIB_STRSTR]) + GNULIB_STRCASESTR=0; AC_SUBST([GNULIB_STRCASESTR]) + GNULIB_STRTOK_R=0; AC_SUBST([GNULIB_STRTOK_R]) + GNULIB_MBSLEN=0; AC_SUBST([GNULIB_MBSLEN]) + GNULIB_MBSNLEN=0; AC_SUBST([GNULIB_MBSNLEN]) + GNULIB_MBSCHR=0; AC_SUBST([GNULIB_MBSCHR]) + GNULIB_MBSRCHR=0; AC_SUBST([GNULIB_MBSRCHR]) + GNULIB_MBSSTR=0; AC_SUBST([GNULIB_MBSSTR]) + GNULIB_MBSCASECMP=0; AC_SUBST([GNULIB_MBSCASECMP]) + GNULIB_MBSNCASECMP=0; AC_SUBST([GNULIB_MBSNCASECMP]) + GNULIB_MBSPCASECMP=0; AC_SUBST([GNULIB_MBSPCASECMP]) + GNULIB_MBSCASESTR=0; AC_SUBST([GNULIB_MBSCASESTR]) + GNULIB_MBSCSPN=0; AC_SUBST([GNULIB_MBSCSPN]) + GNULIB_MBSPBRK=0; AC_SUBST([GNULIB_MBSPBRK]) + GNULIB_MBSSPN=0; AC_SUBST([GNULIB_MBSSPN]) + GNULIB_MBSSEP=0; AC_SUBST([GNULIB_MBSSEP]) + 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_STRSIGNAL=0; AC_SUBST([GNULIB_STRSIGNAL]) + GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP]) + HAVE_MBSLEN=0; AC_SUBST([HAVE_MBSLEN]) + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_FFSL=1; AC_SUBST([HAVE_FFSL]) + HAVE_FFSLL=1; AC_SUBST([HAVE_FFSLL]) + HAVE_MEMCHR=1; AC_SUBST([HAVE_MEMCHR]) + HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM]) + HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY]) + HAVE_DECL_MEMRCHR=1; AC_SUBST([HAVE_DECL_MEMRCHR]) + HAVE_RAWMEMCHR=1; AC_SUBST([HAVE_RAWMEMCHR]) + HAVE_STPCPY=1; AC_SUBST([HAVE_STPCPY]) + HAVE_STPNCPY=1; AC_SUBST([HAVE_STPNCPY]) + HAVE_STRCHRNUL=1; AC_SUBST([HAVE_STRCHRNUL]) + HAVE_DECL_STRDUP=1; AC_SUBST([HAVE_DECL_STRDUP]) + HAVE_DECL_STRNDUP=1; AC_SUBST([HAVE_DECL_STRNDUP]) + HAVE_DECL_STRNLEN=1; AC_SUBST([HAVE_DECL_STRNLEN]) + HAVE_STRPBRK=1; AC_SUBST([HAVE_STRPBRK]) + HAVE_STRSEP=1; AC_SUBST([HAVE_STRSEP]) + 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_DECL_STRSIGNAL=1; AC_SUBST([HAVE_DECL_STRSIGNAL]) + HAVE_STRVERSCMP=1; AC_SUBST([HAVE_STRVERSCMP]) + REPLACE_MEMCHR=0; AC_SUBST([REPLACE_MEMCHR]) + REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM]) + REPLACE_STPNCPY=0; AC_SUBST([REPLACE_STPNCPY]) + REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP]) + REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR]) + REPLACE_STRCASESTR=0; AC_SUBST([REPLACE_STRCASESTR]) + REPLACE_STRCHRNUL=0; AC_SUBST([REPLACE_STRCHRNUL]) + REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR]) + REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R]) + REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT]) + REPLACE_STRNDUP=0; AC_SUBST([REPLACE_STRNDUP]) + REPLACE_STRNLEN=0; AC_SUBST([REPLACE_STRNLEN]) + REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL]) + REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R]) + UNDEFINE_STRTOK_R=0; AC_SUBST([UNDEFINE_STRTOK_R]) +]) === modified file 'src/ChangeLog' --- src/ChangeLog 2013-02-11 19:42:04 +0000 +++ src/ChangeLog 2013-02-11 23:37:18 +0000 @@ -1,5 +1,14 @@ 2013-02-11 Paul Eggert + Tune by using memchr and memrchr. + * doc.c (Fsnarf_documentation): + * fileio.c (Fsubstitute_in_file_name): + * search.c (find_newline, scan_newline): + * xdisp.c (pos_visible_p, display_count_lines): + Use memchr and memrchr rather than scanning byte-by-byte. + * search.c (find_newline): Rename from scan_buffer. + Omit first arg TARGET, as it's always '\n'. All callers changed. + Clean up read_key_sequence a tiny bit more. * keyboard.c (read_char_x_menu_prompt) [HAVE_MENUS]: (read_key_sequence): Remove unused locals. === modified file 'src/doc.c' --- src/doc.c 2013-02-08 17:42:09 +0000 +++ src/doc.c 2013-02-11 23:37:18 +0000 @@ -630,11 +630,10 @@ break; buf[filled] = 0; - p = buf; end = buf + (filled < 512 ? filled : filled - 128); - while (p != end && *p != '\037') p++; + p = memchr (buf, '\037', end - buf); /* p points to ^_Ffunctionname\n or ^_Vvarname\n or ^_Sfilename\n. */ - if (p != end) + if (p) { end = strchr (p, '\n'); === modified file 'src/editfns.c' --- src/editfns.c 2013-01-23 20:07:28 +0000 +++ src/editfns.c 2013-02-11 23:37:18 +0000 @@ -735,9 +735,8 @@ /* This is the ONLY_IN_LINE case, check that NEW_POS and FIELD_BOUND are on the same line by seeing whether there's an intervening newline or not. */ - || (scan_buffer ('\n', - XFASTINT (new_pos), XFASTINT (field_bound), - fwd ? -1 : 1, &shortage, 1), + || (find_newline (XFASTINT (new_pos), XFASTINT (field_bound), + fwd ? -1 : 1, &shortage, 1), shortage != 0))) /* Constrain NEW_POS to FIELD_BOUND. */ new_pos = field_bound; === modified file 'src/fileio.c' --- src/fileio.c 2013-02-11 00:35:37 +0000 +++ src/fileio.c 2013-02-11 23:37:18 +0000 @@ -1710,8 +1710,9 @@ else if (*p == '{') { o = ++p; - while (p != endp && *p != '}') p++; - if (*p != '}') goto missingclose; + p = memchr (p, '}', endp - p); + if (! p) + goto missingclose; s = p; } else @@ -1779,8 +1780,9 @@ else if (*p == '{') { o = ++p; - while (p != endp && *p != '}') p++; - if (*p != '}') goto missingclose; + p = memchr (p, '}', endp - p); + if (! p) + goto missingclose; s = p++; } else === modified file 'src/lisp.h' --- src/lisp.h 2013-02-09 22:42:33 +0000 +++ src/lisp.h 2013-02-11 23:37:18 +0000 @@ -3346,8 +3346,8 @@ extern ptrdiff_t fast_string_match_ignore_case (Lisp_Object, Lisp_Object); extern ptrdiff_t fast_looking_at (Lisp_Object, ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t, Lisp_Object); -extern ptrdiff_t scan_buffer (int, ptrdiff_t, ptrdiff_t, ptrdiff_t, - ptrdiff_t *, bool); +extern ptrdiff_t find_newline (ptrdiff_t, ptrdiff_t, ptrdiff_t, + ptrdiff_t *, bool); extern EMACS_INT scan_newline (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t, EMACS_INT, bool); extern ptrdiff_t find_next_newline (ptrdiff_t, int); === modified file 'src/region-cache.h' --- src/region-cache.h 2013-01-01 09:11:05 +0000 +++ src/region-cache.h 2013-02-11 23:37:18 +0000 @@ -40,7 +40,7 @@ existing data structure, and disturb as little of the existing code as possible. - So here's the tack. We add some caching to the scan_buffer + So here's the tack. We add some caching to the find_newline function, so that when it searches for a newline, it notes that the region between the start and end of the search contained no newlines; then, the next time around, it consults this cache to see === modified file 'src/search.c' --- src/search.c 2013-02-08 14:44:53 +0000 +++ src/search.c 2013-02-11 23:37:18 +0000 @@ -619,7 +619,7 @@ } -/* Search for COUNT instances of the character TARGET between START and END. +/* Search for COUNT newlines between START and END. If COUNT is positive, search forwards; END must be >= START. If COUNT is negative, search backwards for the -COUNTth instance; @@ -634,14 +634,14 @@ this is not the same as the usual convention for Emacs motion commands. If we don't find COUNT instances before reaching END, set *SHORTAGE - to the number of TARGETs left unfound, and return END. + to the number of newlines left unfound, and return END. If ALLOW_QUIT, set immediate_quit. That's good to do except when inside redisplay. */ ptrdiff_t -scan_buffer (int target, ptrdiff_t start, ptrdiff_t end, - ptrdiff_t count, ptrdiff_t *shortage, bool allow_quit) +find_newline (ptrdiff_t start, ptrdiff_t end, + ptrdiff_t count, ptrdiff_t *shortage, bool allow_quit) { struct region_cache *newline_cache; ptrdiff_t end_byte = -1; @@ -656,7 +656,7 @@ else { direction = -1; - if (!end) + if (!end) end = BEGV, end_byte = BEGV_BYTE; } if (end_byte == -1) @@ -684,7 +684,7 @@ /* If we're looking for a newline, consult the newline cache to see where we can avoid some scanning. */ - if (target == '\n' && newline_cache) + if (newline_cache) { ptrdiff_t next_change; immediate_quit = 0; @@ -723,32 +723,32 @@ while (cursor < ceiling_addr) { - unsigned char *scan_start = cursor; - /* The dumb loop. */ - while (*cursor != target && ++cursor < ceiling_addr) - ; + unsigned char *nl = memchr (cursor, '\n', ceiling_addr - cursor); /* If we're looking for newlines, cache the fact that the region from start to cursor is free of them. */ - if (target == '\n' && newline_cache) - know_region_cache (current_buffer, newline_cache, - BYTE_TO_CHAR (start_byte + scan_start - base), - BYTE_TO_CHAR (start_byte + cursor - base)); - - /* Did we find the target character? */ - if (cursor < ceiling_addr) - { - if (--count == 0) - { - immediate_quit = 0; - return BYTE_TO_CHAR (start_byte + cursor - base + 1); - } - cursor++; - } + if (newline_cache) + { + unsigned char *low = cursor; + unsigned char *lim = nl ? nl : ceiling_addr; + know_region_cache (current_buffer, newline_cache, + BYTE_TO_CHAR (low - base + start_byte), + BYTE_TO_CHAR (lim - base + start_byte)); + } + + if (! nl) + break; + + if (--count == 0) + { + immediate_quit = 0; + return BYTE_TO_CHAR (nl + 1 - base + start_byte); + } + cursor = nl + 1; } - start = BYTE_TO_CHAR (start_byte + cursor - base); + start = BYTE_TO_CHAR (ceiling_addr - base + start_byte); } } else @@ -760,7 +760,7 @@ ptrdiff_t tem; /* Consult the newline cache, if appropriate. */ - if (target == '\n' && newline_cache) + if (newline_cache) { ptrdiff_t next_change; immediate_quit = 0; @@ -794,31 +794,32 @@ while (cursor >= ceiling_addr) { - unsigned char *scan_start = cursor; - - while (*cursor != target && --cursor >= ceiling_addr) - ; + unsigned char *nl = memrchr (ceiling_addr, '\n', + cursor + 1 - ceiling_addr); /* If we're looking for newlines, cache the fact that the region from after the cursor to start is free of them. */ - if (target == '\n' && newline_cache) - know_region_cache (current_buffer, newline_cache, - BYTE_TO_CHAR (start_byte + cursor - base), - BYTE_TO_CHAR (start_byte + scan_start - base)); - - /* Did we find the target character? */ - if (cursor >= ceiling_addr) - { - if (++count >= 0) - { - immediate_quit = 0; - return BYTE_TO_CHAR (start_byte + cursor - base); - } - cursor--; - } + if (newline_cache) + { + unsigned char *low = nl ? nl : ceiling_addr - 1; + unsigned char *lim = cursor; + know_region_cache (current_buffer, newline_cache, + BYTE_TO_CHAR (low - base + start_byte), + BYTE_TO_CHAR (lim - base + start_byte)); + } + + if (! nl) + break; + + if (++count >= 0) + { + immediate_quit = 0; + return BYTE_TO_CHAR (nl - base + start_byte); + } + cursor = nl - 1; } - start = BYTE_TO_CHAR (start_byte + cursor - base); + start = BYTE_TO_CHAR (ceiling_addr - 1 - base + start_byte); } } @@ -828,8 +829,7 @@ return start; } -/* Search for COUNT instances of a line boundary, which means either a - newline or (if selective display enabled) a carriage return. +/* Search for COUNT instances of a line boundary. Start at START. If COUNT is negative, search backwards. We report the resulting position by calling TEMP_SET_PT_BOTH. @@ -860,9 +860,6 @@ bool old_immediate_quit = immediate_quit; - /* The code that follows is like scan_buffer - but checks for either newline or carriage return. */ - if (allow_quit) immediate_quit++; @@ -874,29 +871,25 @@ ceiling = min (limit_byte - 1, ceiling); ceiling_addr = BYTE_POS_ADDR (ceiling) + 1; base = (cursor = BYTE_POS_ADDR (start_byte)); - while (1) + + do { - while (*cursor != '\n' && ++cursor != ceiling_addr) - ; - - if (cursor != ceiling_addr) + unsigned char *nl = memchr (cursor, '\n', ceiling_addr - cursor); + if (! nl) + break; + if (--count == 0) { - if (--count == 0) - { - immediate_quit = old_immediate_quit; - start_byte = start_byte + cursor - base + 1; - start = BYTE_TO_CHAR (start_byte); - TEMP_SET_PT_BOTH (start, start_byte); - return 0; - } - else - if (++cursor == ceiling_addr) - break; + immediate_quit = old_immediate_quit; + start_byte += nl - base + 1; + start = BYTE_TO_CHAR (start_byte); + TEMP_SET_PT_BOTH (start, start_byte); + return 0; } - else - break; + cursor = nl + 1; } - start_byte += cursor - base; + while (cursor < ceiling_addr); + + start_byte += ceiling_addr - base; } } else @@ -905,31 +898,28 @@ { ceiling = BUFFER_FLOOR_OF (start_byte - 1); ceiling = max (limit_byte, ceiling); - ceiling_addr = BYTE_POS_ADDR (ceiling) - 1; + ceiling_addr = BYTE_POS_ADDR (ceiling); base = (cursor = BYTE_POS_ADDR (start_byte - 1) + 1); while (1) { - while (--cursor != ceiling_addr && *cursor != '\n') - ; + unsigned char *nl = memrchr (ceiling_addr, '\n', + cursor - ceiling_addr); + if (! nl) + break; - if (cursor != ceiling_addr) + if (++count == 0) { - if (++count == 0) - { - immediate_quit = old_immediate_quit; - /* Return the position AFTER the match we found. */ - start_byte = start_byte + cursor - base + 1; - start = BYTE_TO_CHAR (start_byte); - TEMP_SET_PT_BOTH (start, start_byte); - return 0; - } + immediate_quit = old_immediate_quit; + /* Return the position AFTER the match we found. */ + start_byte += nl - base + 1; + start = BYTE_TO_CHAR (start_byte); + TEMP_SET_PT_BOTH (start, start_byte); + return 0; } - else - break; + + cursor = nl; } - /* Here we add 1 to compensate for the last decrement - of CURSOR, which took it past the valid range. */ - start_byte += cursor - base + 1; + start_byte += ceiling_addr - base; } } @@ -942,7 +932,7 @@ ptrdiff_t find_next_newline_no_quit (ptrdiff_t from, ptrdiff_t cnt) { - return scan_buffer ('\n', from, 0, cnt, (ptrdiff_t *) 0, 0); + return find_newline (from, 0, cnt, (ptrdiff_t *) 0, 0); } /* Like find_next_newline, but returns position before the newline, @@ -953,7 +943,7 @@ find_before_next_newline (ptrdiff_t from, ptrdiff_t to, ptrdiff_t cnt) { ptrdiff_t shortage; - ptrdiff_t pos = scan_buffer ('\n', from, to, cnt, &shortage, 1); + ptrdiff_t pos = find_newline (from, to, cnt, &shortage, 1); if (shortage == 0) pos--; === modified file 'src/xdisp.c' --- src/xdisp.c 2013-02-11 17:32:32 +0000 +++ src/xdisp.c 2013-02-11 23:37:18 +0000 @@ -1392,21 +1392,9 @@ Lisp_Object cpos = make_number (charpos); Lisp_Object spec = Fget_char_property (cpos, Qdisplay, Qnil); Lisp_Object string = string_from_display_spec (spec); - int newline_in_string = 0; - - if (STRINGP (string)) - { - const char *s = SSDATA (string); - const char *e = s + SBYTES (string); - while (s < e) - { - if (*s++ == '\n') - { - newline_in_string = 1; - break; - } - } - } + bool newline_in_string + = (STRINGP (string) + && memchr (SDATA (string), '\n', SBYTES (string))); /* The tricky code below is needed because there's a discrepancy between move_it_to and how we set cursor when the display line ends in a newline from a @@ -14759,7 +14747,7 @@ SET_TEXT_POS (start_pos, ZV, ZV_BYTE); /* Find the start of the continued line. This should be fast - because scan_buffer is fast (newline cache). */ + because find_newline is fast (newline cache). */ row = w->desired_matrix->rows + (WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0); init_iterator (&it, w, CHARPOS (start_pos), BYTEPOS (start_pos), row, DEFAULT_FACE_ID); @@ -21626,31 +21614,36 @@ ceiling = min (limit_byte - 1, ceiling); ceiling_addr = BYTE_POS_ADDR (ceiling) + 1; base = (cursor = BYTE_POS_ADDR (start_byte)); - while (1) + + do { if (selective_display) - while (*cursor != '\n' && *cursor != 015 && ++cursor != ceiling_addr) - ; - else - while (*cursor != '\n' && ++cursor != ceiling_addr) - ; - - if (cursor != ceiling_addr) - { - if (--count == 0) - { - start_byte += cursor - base + 1; - *byte_pos_ptr = start_byte; - return orig_count; - } - else - if (++cursor == ceiling_addr) - break; - } - else - break; + { + while (*cursor != '\n' && *cursor != 015 + && ++cursor != ceiling_addr) + continue; + if (cursor == ceiling_addr) + break; + } + else + { + cursor = memchr (cursor, '\n', ceiling_addr - cursor); + if (! cursor) + break; + } + + cursor++; + + if (--count == 0) + { + start_byte += cursor - base; + *byte_pos_ptr = start_byte; + return orig_count; + } } - start_byte += cursor - base; + while (cursor < ceiling_addr); + + start_byte += ceiling_addr - base; } } else @@ -21659,35 +21652,35 @@ { ceiling = BUFFER_FLOOR_OF (start_byte - 1); ceiling = max (limit_byte, ceiling); - ceiling_addr = BYTE_POS_ADDR (ceiling) - 1; + ceiling_addr = BYTE_POS_ADDR (ceiling); base = (cursor = BYTE_POS_ADDR (start_byte - 1) + 1); while (1) { if (selective_display) - while (--cursor != ceiling_addr - && *cursor != '\n' && *cursor != 015) - ; + { + while (--cursor >= ceiling_addr + && *cursor != '\n' && *cursor != 015) + continue; + if (cursor < ceiling_addr) + break; + } else - while (--cursor != ceiling_addr && *cursor != '\n') - ; + { + cursor = memrchr (ceiling_addr, '\n', cursor - ceiling_addr); + if (! cursor) + break; + } - if (cursor != ceiling_addr) + if (++count == 0) { - if (++count == 0) - { - start_byte += cursor - base + 1; - *byte_pos_ptr = start_byte; - /* When scanning backwards, we should - not count the newline posterior to which we stop. */ - return - orig_count - 1; - } + start_byte += cursor - base + 1; + *byte_pos_ptr = start_byte; + /* When scanning backwards, we should + not count the newline posterior to which we stop. */ + return - orig_count - 1; } - else - break; } - /* Here we add 1 to compensate for the last decrement - of CURSOR, which took it past the valid range. */ - start_byte += cursor - base + 1; + start_byte += ceiling_addr - base; } } ------------------------------------------------------------ revno: 111740 committer: Paul Eggert branch nick: trunk timestamp: Mon 2013-02-11 15:15:46 -0800 message: Merge from gnulib. diff: === modified file 'ChangeLog' --- ChangeLog 2013-02-11 00:55:26 +0000 +++ ChangeLog 2013-02-11 23:15:46 +0000 @@ -1,3 +1,9 @@ +2013-02-11 Paul Eggert + + Merge from gnulib, incorporating: + 2013-02-11 unsetenv etc.: port to Solaris 11 + GNU Emacs + 2013-02-09 secure_getenv: fix C++ declaration typo + 2013-02-11 Glenn Morris * configure.ac (emacs_config_options): Record some env vars. === modified file 'lib/stdlib.in.h' --- lib/stdlib.in.h 2013-02-08 23:37:17 +0000 +++ lib/stdlib.in.h 2013-02-11 23:15:46 +0000 @@ -773,7 +773,7 @@ _GL_FUNCDECL_SYS (secure_getenv, char *, (char const *name) _GL_ARG_NONNULL ((1))); # endif -_GL_CXXALIAS_SYS (secure_getenv, int, (char const *name)); +_GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name)); _GL_CXXALIASWARN (secure_getenv); #elif defined GNULIB_POSIXCHECK # undef secure_getenv === modified file 'lib/unsetenv.c' --- lib/unsetenv.c 2013-01-02 16:37:04 +0000 +++ lib/unsetenv.c 2013-02-11 23:15:46 +0000 @@ -14,12 +14,12 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include - /* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc optimizes away the name == NULL test below. */ #define _GL_ARG_NONNULL(params) +#include + /* Specification. */ #include ------------------------------------------------------------ revno: 111739 committer: Stefan Monnier branch nick: trunk timestamp: Mon 2013-02-11 17:53:36 -0500 message: Aidan Gauland Fixes: debbugs:13689 * lisp/erc/erc-match.el (erc-match-message): Don't truncate action messages. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-02-11 19:29:40 +0000 +++ lisp/ChangeLog 2013-02-11 22:53:36 +0000 @@ -1,7 +1,7 @@ 2013-02-11 Elias Pipping * doc-view.el (doc-view-current-cache-dir): Beware % escapes - (bug#13679). + (bug#13689). 2013-02-11 Stefan Monnier === modified file 'lisp/erc/erc-match.el' --- lisp/erc/erc-match.el 2013-01-02 16:13:04 +0000 +++ lisp/erc/erc-match.el 2013-02-11 22:53:36 +0000 @@ -447,16 +447,24 @@ (nth 0 (erc-parse-user nickuserhost)))) (old-pt (point)) (nick-beg (and nickname - (re-search-forward (regexp-quote nickname) + (re-search-forward "\\(\\* \\)?"(regexp-quote nickname) (point-max) t) (match-beginning 0))) (nick-end (when nick-beg (match-end 0))) - (message (buffer-substring (if (and nick-end - (<= (+ 2 nick-end) (point-max))) - (+ 2 nick-end) - (point-min)) - (point-max)))) + (message (buffer-substring + (if (and nick-end + (<= (+ 2 nick-end) (point-max))) + (+ nick-end + ;; Message starts 2 characters after the nick except + ;; for CTCP ACTION messages. + (if (string= "* " + (buffer-substring (- nick-beg 2) + nick-beg)) + 1 + 2)) + (point-min)) + (point-max)))) (when (and vector (not (and erc-match-exclude-server-buffer (erc-server-buffer-p)))) ------------------------------------------------------------ revno: 111738 committer: Paul Eggert branch nick: trunk timestamp: Mon 2013-02-11 11:42:04 -0800 message: Clean up read_key_sequence a tiny bit more. * keyboard.c (read_char_x_menu_prompt) [HAVE_MENUS]: (read_key_sequence): Remove unused locals. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-02-11 19:21:23 +0000 +++ src/ChangeLog 2013-02-11 19:42:04 +0000 @@ -1,3 +1,9 @@ +2013-02-11 Paul Eggert + + Clean up read_key_sequence a tiny bit more. + * keyboard.c (read_char_x_menu_prompt) [HAVE_MENUS]: + (read_key_sequence): Remove unused locals. + 2013-02-11 Stefan Monnier Clean up read_key_sequence a bit; reread active keymaps after first event. === modified file 'src/keyboard.c' --- src/keyboard.c 2013-02-11 19:21:23 +0000 +++ src/keyboard.c 2013-02-11 19:42:04 +0000 @@ -8355,10 +8355,6 @@ read_char_x_menu_prompt (Lisp_Object map, Lisp_Object prev_event, bool *used_mouse_menu) { -#ifdef HAVE_MENUS - ptrdiff_t mapno; -#endif - if (used_mouse_menu) *used_mouse_menu = 0; @@ -8444,7 +8440,7 @@ #define PUSH_C_STR(str, listvar) \ listvar = Fcons (make_unibyte_string (str, strlen (str)), listvar) - + /* Prompt string always starts with map's prompt, and a space. */ prompt_strings = Fcons (name, prompt_strings); PUSH_C_STR (": ", prompt_strings); @@ -8829,7 +8825,6 @@ bool dont_downcase_last, bool can_return_switch_frame, bool fix_current_buffer) { - Lisp_Object from_string; ptrdiff_t count = SPECPDL_INDEX (); /* How many keys there are in the current key sequence. */ @@ -8931,8 +8926,6 @@ keys_start = this_command_key_count; this_single_command_key_start = keys_start; - from_string = Qnil; - /* We jump here when we need to reinitialize fkey and keytran; this happens if we switch keyboards between rescans. */ replay_entire_sequence: @@ -8958,7 +8951,7 @@ click and we need to switch buffers, we jump back here to rebuild the initial keymaps from the current buffer. */ current_binding = active_maps (first_event); - + /* Start from the beginning in keybuf. */ t = 0; @@ -9240,16 +9233,11 @@ or when user programs play with this-command-keys. */ if (EVENT_HAS_PARAMETERS (key)) { - Lisp_Object kind; - Lisp_Object string; - - kind = EVENT_HEAD_KIND (EVENT_HEAD (key)); + Lisp_Object kind = EVENT_HEAD_KIND (EVENT_HEAD (key)); if (EQ (kind, Qmouse_click)) { - Lisp_Object window, posn; - - window = POSN_WINDOW (EVENT_START (key)); - posn = POSN_POSN (EVENT_START (key)); + Lisp_Object window = POSN_WINDOW (EVENT_START (key)); + Lisp_Object posn = POSN_POSN (EVENT_START (key)); if (CONSP (posn) || (!NILP (fake_prefixed_keys) ------------------------------------------------------------ revno: 111737 fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13679 author: Elias Pipping committer: Stefan Monnier branch nick: trunk timestamp: Mon 2013-02-11 14:29:40 -0500 message: * lisp/doc-view.el (doc-view-current-cache-dir): Beware % escapes. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-02-11 19:21:23 +0000 +++ lisp/ChangeLog 2013-02-11 19:29:40 +0000 @@ -1,3 +1,8 @@ +2013-02-11 Elias Pipping + + * doc-view.el (doc-view-current-cache-dir): Beware % escapes + (bug#13679). + 2013-02-11 Stefan Monnier * cus-start.el (all): Remove inhibit-local-menu-bar-menus. === modified file 'lisp/doc-view.el' --- lisp/doc-view.el 2013-02-09 09:58:48 +0000 +++ lisp/doc-view.el 2013-02-11 19:29:40 +0000 @@ -686,7 +686,8 @@ (setq doc-view-current-cache-dir (file-name-as-directory (expand-file-name - (concat (file-name-nondirectory doc-view-buffer-file-name) + (concat (subst-char-in-string ?% ?_ ;; bug#13679 + (file-name-nondirectory doc-view-buffer-file-name)) "-" (let ((file doc-view-buffer-file-name)) (with-temp-buffer ------------------------------------------------------------ revno: 111736 committer: Stefan Monnier branch nick: trunk timestamp: Mon 2013-02-11 14:21:23 -0500 message: Clean up read_key_sequence a bit; reread active keymaps after first event. * src/keyboard.c (read_char, read_char_x_menu_prompt) (read_char_minibuf_menu_prompt): Replace nmaps+maps with a single `map' arg. (follow_key): Operate on a single map. (active_maps): New function. (test_undefined): Also return true for nil bindings. (read_key_sequence): Use active_maps to replace the arrays of keymaps with a single (composed) keymap. Remember `first_event' to choose the right set of active keymaps. Recompute the set of keymaps after receiving the first event. Remove GOBBLE_FIRST_EVENT. (syms_of_keyboard): Remove inhibit_local_menu_bar_menus. * src/keyboard.h (read_char): Update declaration. * src/lread.c (read_filtered_event): Adjust call to read_char. * lisp/cus-start.el (all): Remove inhibit-local-menu-bar-menus. diff: === modified file 'etc/NEWS' --- etc/NEWS 2013-02-11 10:42:58 +0000 +++ etc/NEWS 2013-02-11 19:21:23 +0000 @@ -210,6 +210,8 @@ * Incompatible Lisp Changes in Emacs 24.4 +** Removed inhibit-local-menu-bar-menus. + ** frame-local variables that affect redisplay do not work any more. More specifically, the redisplay does not bother to check for a frame-local value when looking up variables. === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-02-11 08:28:08 +0000 +++ lisp/ChangeLog 2013-02-11 19:21:23 +0000 @@ -1,3 +1,7 @@ +2013-02-11 Stefan Monnier + + * cus-start.el (all): Remove inhibit-local-menu-bar-menus. + 2013-02-11 Glenn Morris * vc/diff.el (diff-use-labels): New variable. @@ -14,8 +18,8 @@ 2013-02-10 Christopher Schmidt - * minibuf-eldef.el (minibuffer-default--in-prompt-regexps): Handle - "foo (bar, default: xxx): " prompts. + * minibuf-eldef.el (minibuffer-default--in-prompt-regexps): + Handle "foo (bar, default: xxx): " prompts. 2013-02-10 Chong Yidong === modified file 'lisp/cus-start.el' --- lisp/cus-start.el 2013-02-05 12:16:35 +0000 +++ lisp/cus-start.el 2013-02-11 19:21:23 +0000 @@ -286,7 +286,6 @@ (double-click-time mouse (restricted-sexp :match-alternatives (integerp 'nil 't))) (double-click-fuzz mouse integer "22.1") - (inhibit-local-menu-bar-menus menu boolean) (help-char keyboard character) (help-event-list keyboard (repeat (sexp :format "%v"))) (menu-prompting menu boolean) @@ -301,15 +300,15 @@ (const :tag "When sent SIGUSR2" sigusr2)) "24.1") -;; This is not good news because it will use the wrong -;; version-specific directories when you upgrade. We need -;; customization of the front of the list, maintaining the standard -;; value intact at the back. -;;; (load-path environment -;;; (repeat (choice :tag "[Current dir?]" -;;; :format "%[Current dir?%] %v" -;;; (const :tag " current dir" nil) -;;; (directory :format "%v")))) + ;; This is not good news because it will use the wrong + ;; version-specific directories when you upgrade. We need + ;; customization of the front of the list, maintaining the + ;; standard value intact at the back. + ;;(load-path environment + ;; (repeat (choice :tag "[Current dir?]" + ;; :format "%[Current dir?%] %v" + ;; (const :tag " current dir" nil) + ;; (directory :format "%v")))) ;; minibuf.c (enable-recursive-minibuffers minibuffer boolean) (history-length minibuffer === modified file 'src/ChangeLog' --- src/ChangeLog 2013-02-11 17:32:32 +0000 +++ src/ChangeLog 2013-02-11 19:21:23 +0000 @@ -1,7 +1,24 @@ +2013-02-11 Stefan Monnier + + Clean up read_key_sequence a bit; reread active keymaps after first event. + * keyboard.c (read_char, read_char_x_menu_prompt) + (read_char_minibuf_menu_prompt): + Replace nmaps+maps with a single `map' arg. + (follow_key): Operate on a single map. + (active_maps): New function. + (test_undefined): Also return true for nil bindings. + (read_key_sequence): Use active_maps to replace the arrays of keymaps with + a single (composed) keymap. Remember `first_event' to choose the right + set of active keymaps. Recompute the set of keymaps after receiving + the first event. Remove GOBBLE_FIRST_EVENT. + (syms_of_keyboard): Remove inhibit_local_menu_bar_menus. + * keyboard.h (read_char): Update declaration. + * lread.c (read_filtered_event): Adjust call to read_char. + 2013-02-11 Eli Zaretskii - * xdisp.c (move_it_vertically_backward, move_it_by_lines): Don't - use the limitation on backwards movement when lines are truncated + * xdisp.c (move_it_vertically_backward, move_it_by_lines): + Don't use the limitation on backwards movement when lines are truncated in the window. (Bug#13675) 2013-02-11 Dmitry Antipov @@ -17,8 +34,8 @@ 2013-02-10 Eli Zaretskii - * xdisp.c (move_it_vertically_backward, move_it_by_lines): When - text lines are longer than window's screen lines, don't move back + * xdisp.c (move_it_vertically_backward, move_it_by_lines): + When text lines are longer than window's screen lines, don't move back too far. This speeds up some redisplay operations. (Bug#13675) 2013-02-10 Dmitry Antipov @@ -140,8 +157,8 @@ * xdisp.c (window_buffer_changed): region_showing can be negative, which still means region is being displayed. (redisplay_internal): Resurrect code that forced redisplay of the - whole window when showing region and the mark has changed. Record - the new mark position to allow redisplay optimizations. + whole window when showing region and the mark has changed. + Record the new mark position to allow redisplay optimizations. (display_line): If it->region_beg_charpos is non-zero, set the window's region_showing member to -1. (Bug#13623) (Bug#13626) @@ -196,8 +213,8 @@ * dired.c (file_name_completion): Don't call Fdirectory_file_name with an encoded file name. - * w32proc.c (Fw32_short_file_name, Fw32_long_file_name): Adjust - calls to dostounix_filename. + * w32proc.c (Fw32_short_file_name, Fw32_long_file_name): + Adjust calls to dostounix_filename. * w32fns.c (Fx_file_dialog): Adjust call to dostounix_filename. @@ -292,8 +309,8 @@ closing it. (Bug#13546) * w32.c (parse_root, get_volume_info, readdir, read_unc_volume) - (logon_network_drive, stat_worker, symlink, chase_symlinks): Use - CharNextExA and CharPrevExA to iterate over file names encoded in + (logon_network_drive, stat_worker, symlink, chase_symlinks): + Use CharNextExA and CharPrevExA to iterate over file names encoded in DBCS. (Bug#13553) * w32.c (w32_get_long_filename, init_environment, readlink): @@ -333,8 +350,8 @@ (normalize_filename, readdir): Use it to detect locales where ANSI encoding of file names uses a double-byte character set (DBCS). If a DBCS encoding is used, advance by characters using - CharNextExA, instead of incrementing a 'char *' pointer. Use - _mbslwr instead of _strlwr. (Bug#13515) + CharNextExA, instead of incrementing a 'char *' pointer. + Use _mbslwr instead of _strlwr. (Bug#13515) * w32heap.c (allocate_heap) [!_WIN64]: Decrease the initial request of memory reservation to 1.7GB. (Bug#13065) @@ -475,8 +492,8 @@ segfault when there are lots of overlays. * buffer.c (sort_overlays): Use SAFE_NALLOCA, to avoid segfault - when there are lots of overlays. See - http://lists.gnu.org/archive/html/emacs-devel/2013-01/msg00421.html + when there are lots of overlays. + See http://lists.gnu.org/archive/html/emacs-devel/2013-01/msg00421.html for the details and a way to reproduce. 2013-01-19 Paul Eggert @@ -534,8 +551,8 @@ 2013-01-18 Dmitry Antipov - Fix crash when inserting data from non-regular files. See - http://lists.gnu.org/archive/html/emacs-devel/2013-01/msg00406.html + Fix crash when inserting data from non-regular files. + See http://lists.gnu.org/archive/html/emacs-devel/2013-01/msg00406.html for the error description produced by valgrind. * fileio.c (read_non_regular): Rename to read_contents. Free Lisp_Save_Value object used to pass parameters. @@ -587,8 +604,8 @@ (map_keymap_char_table_item): Adjust accordingly. * fileio.c (non_regular_fd, non_regular_inserted) (non_regular_nbytes): Remove. - (Finsert_file_contents): Convert trytry to ptrdiff_t. Use - format_save_value to pass parameters to read_non_regular. + (Finsert_file_contents): Convert trytry to ptrdiff_t. + Use format_save_value to pass parameters to read_non_regular. (read_non_regular): Use XSAVE_ macros to extract parameters. Adjust comment. * xmenu.c (xmenu_show) [!USE_X_TOOLKIT && !USE_GTK]: Use @@ -715,8 +732,8 @@ 2013-01-11 Aaron S. Hawley - * insdel.c (Fcombine_after_change_execute, syms_of_insdel): Fix - ambiguous doc string cross-reference(s). + * insdel.c (Fcombine_after_change_execute, syms_of_insdel): + Fix ambiguous doc string cross-reference(s). * keyboard.c (Fcommand_execute, syms_of_keyboard): Fix ambiguous doc string cross-reference(s). === modified file 'src/keyboard.c' --- src/keyboard.c 2013-01-23 20:07:28 +0000 +++ src/keyboard.c 2013-02-11 19:21:23 +0000 @@ -417,10 +417,9 @@ static bool get_input_pending (int); static bool readable_events (int); -static Lisp_Object read_char_x_menu_prompt (ptrdiff_t, Lisp_Object *, +static Lisp_Object read_char_x_menu_prompt (Lisp_Object, Lisp_Object, bool *); -static Lisp_Object read_char_minibuf_menu_prompt (int, ptrdiff_t, - Lisp_Object *); +static Lisp_Object read_char_minibuf_menu_prompt (int, Lisp_Object); static Lisp_Object make_lispy_event (struct input_event *); static Lisp_Object make_lispy_movement (struct frame *, Lisp_Object, enum scroll_bar_part, @@ -2231,13 +2230,12 @@ do { if (polling_stopped_here) start_polling (); \ polling_stopped_here = 0; } while (0) -/* read a character from the keyboard; call the redisplay if needed */ +/* Read a character from the keyboard; call the redisplay if needed. */ /* commandflag 0 means do not autosave, but do redisplay. -1 means do not redisplay, but do autosave. 1 means do both. */ -/* The arguments MAPS and NMAPS are for menu prompting. - MAPS is an array of keymaps; NMAPS is the length of MAPS. +/* The arguments MAP is for menu prompting. MAP is a keymap. PREV_EVENT is the previous input event, or nil if we are reading the first event of a key sequence (or not reading a key sequence). @@ -2259,7 +2257,7 @@ Value is t if we showed a menu and the user rejected it. */ Lisp_Object -read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps, +read_char (int commandflag, Lisp_Object map, Lisp_Object prev_event, bool *used_mouse_menu, EMACS_TIME *end_time) { @@ -2407,7 +2405,7 @@ goto reread_first; } - /* if redisplay was requested */ + /* If redisplay was requested. */ if (commandflag >= 0) { bool echo_current = EQ (echo_message_buffer, echo_area_buffer[0]); @@ -2416,7 +2414,7 @@ user-visible, such as X selection_request events. */ if (input_pending || detect_input_pending_run_timers (0)) - swallow_events (0); /* may clear input_pending */ + swallow_events (0); /* May clear input_pending. */ /* Redisplay if no pending input. */ while (!input_pending) @@ -2486,13 +2484,13 @@ menu prompting. If EVENT_HAS_PARAMETERS then we are reading after a mouse event so don't try a minibuf menu. */ c = Qnil; - if (nmaps > 0 && INTERACTIVE + if (KEYMAPP (map) && INTERACTIVE && !NILP (prev_event) && ! EVENT_HAS_PARAMETERS (prev_event) /* Don't bring up a menu if we already have another event. */ && NILP (Vunread_command_events) && !detect_input_pending_run_timers (0)) { - c = read_char_minibuf_menu_prompt (commandflag, nmaps, maps); + c = read_char_minibuf_menu_prompt (commandflag, map); if (INTEGERP (c) && XINT (c) == -2) return c; /* wrong_kboard_jmpbuf */ @@ -2616,7 +2614,7 @@ because the recursive call of read_char in read_char_minibuf_menu_prompt does not pass on any keymaps. */ - if (nmaps > 0 && INTERACTIVE + if (KEYMAPP (map) && INTERACTIVE && !NILP (prev_event) && EVENT_HAS_PARAMETERS (prev_event) && !EQ (XCAR (prev_event), Qmenu_bar) @@ -2624,7 +2622,7 @@ /* Don't bring up a menu if we already have another event. */ && NILP (Vunread_command_events)) { - c = read_char_x_menu_prompt (nmaps, maps, prev_event, used_mouse_menu); + c = read_char_x_menu_prompt (map, prev_event, used_mouse_menu); /* Now that we have read an event, Emacs is not idle. */ if (!end_time) @@ -3002,7 +3000,7 @@ /* If we are not reading a key sequence, never use the echo area. */ - if (maps == 0) + if (!KEYMAPP (map)) { specbind (Qinput_method_use_echo_area, Qt); } @@ -3095,7 +3093,7 @@ last_input_event = c; num_input_events++; - /* Process the help character specially if enabled */ + /* Process the help character specially if enabled. */ if (!NILP (Vhelp_form) && help_char_p (c)) { ptrdiff_t count = SPECPDL_INDEX (); @@ -3109,13 +3107,13 @@ cancel_echoing (); do { - c = read_char (0, 0, 0, Qnil, 0, NULL); + c = read_char (0, Qnil, Qnil, 0, NULL); if (EVENT_HAS_PARAMETERS (c) && EQ (EVENT_HEAD_KIND (EVENT_HEAD (c)), Qmouse_click)) XSETCAR (help_form_saved_window_configs, Qnil); } while (BUFFERP (c)); - /* Remove the help from the frame */ + /* Remove the help from the frame. */ unbind_to (count, Qnil); redisplay (); @@ -3123,7 +3121,7 @@ { cancel_echoing (); do - c = read_char (0, 0, 0, Qnil, 0, NULL); + c = read_char (0, Qnil, Qnil, 0, NULL); while (BUFFERP (c)); } } @@ -8313,9 +8311,9 @@ static void append_tool_bar_item (void) { - ptrdiff_t incr = - (ntool_bar_items - - (ASIZE (tool_bar_items_vector) - TOOL_BAR_ITEM_NSLOTS)); + ptrdiff_t incr + = (ntool_bar_items + - (ASIZE (tool_bar_items_vector) - TOOL_BAR_ITEM_NSLOTS)); /* Enlarge tool_bar_items_vector if necessary. */ if (0 < incr) @@ -8333,8 +8331,8 @@ -/* Read a character using menus based on maps in the array MAPS. - NMAPS is the length of MAPS. Return nil if there are no menus in the maps. +/* Read a character using menus based on the keymap MAP. + Return nil if there are no menus in the maps. Return t if we displayed a menu but the user rejected it. PREV_EVENT is the previous input event, or nil if we are reading @@ -8354,7 +8352,7 @@ and do auto-saving in the inner call of read_char. */ static Lisp_Object -read_char_x_menu_prompt (ptrdiff_t nmaps, Lisp_Object *maps, +read_char_x_menu_prompt (Lisp_Object map, Lisp_Object prev_event, bool *used_mouse_menu) { #ifdef HAVE_MENUS @@ -8364,18 +8362,11 @@ if (used_mouse_menu) *used_mouse_menu = 0; - /* Use local over global Menu maps */ + /* Use local over global Menu maps. */ if (! menu_prompting) return Qnil; - /* Optionally disregard all but the global map. */ - if (inhibit_local_menu_bar_menus) - { - maps += (nmaps - 1); - nmaps = 1; - } - #ifdef HAVE_MENUS /* If we got to this point via a mouse click, use a real menu for mouse selection. */ @@ -8384,16 +8375,9 @@ && !EQ (XCAR (prev_event), Qtool_bar)) { /* Display the menu and get the selection. */ - Lisp_Object *realmaps = alloca (nmaps * sizeof *realmaps); Lisp_Object value; - ptrdiff_t nmaps1 = 0; - - /* Use the maps that are not nil. */ - for (mapno = 0; mapno < nmaps; mapno++) - if (!NILP (maps[mapno])) - realmaps[nmaps1++] = maps[mapno]; - - value = Fx_popup_menu (prev_event, Flist (nmaps1, realmaps)); + + value = Fx_popup_menu (prev_event, get_keymap (map, 0, 1)); if (CONSP (value)) { Lisp_Object tem; @@ -8435,9 +8419,8 @@ static Lisp_Object read_char_minibuf_menu_prompt (int commandflag, - ptrdiff_t nmaps, Lisp_Object *maps) + Lisp_Object map) { - ptrdiff_t mapno; register Lisp_Object name; ptrdiff_t nlength; /* FIXME: Use the minibuffer's frame width. */ @@ -8448,18 +8431,12 @@ Lisp_Object prompt_strings = Qnil; vector = Qnil; - name = Qnil; if (! menu_prompting) return Qnil; - /* Get the menu name from the first map that has one (a prompt string). */ - for (mapno = 0; mapno < nmaps; mapno++) - { - name = Fkeymap_prompt (maps[mapno]); - if (!NILP (name)) - break; - } + map = get_keymap (map, 0, 1); + name = Fkeymap_prompt (map); /* If we don't have any menus, just read a character normally. */ if (!STRINGP (name)) @@ -8473,9 +8450,7 @@ PUSH_C_STR (": ", prompt_strings); nlength = SCHARS (name) + 2; - /* Start prompting at start of first map. */ - mapno = 0; - rest = maps[mapno]; + rest = map; /* Present the documented bindings, a line at a time. */ while (1) @@ -8493,18 +8468,14 @@ /* FIXME: Use map_keymap to handle new keymap formats. */ - /* If reached end of map, start at beginning of next map. */ + /* At end of map, wrap around if just starting, + or end this line if already have something on it. */ if (NILP (rest)) { - mapno++; - /* At end of last map, wrap around to first map if just starting, - or end this line if already have something on it. */ - if (mapno == nmaps) - { - mapno = 0; - if (notfirst || nobindings) break; - } - rest = maps[mapno]; + if (notfirst || nobindings) + break; + else + rest = map; } /* Look at the next element of the map. */ @@ -8638,7 +8609,7 @@ } /* Prompt with that and read response. */ - message3_nolog (apply1 (intern ("concat"), menu_strings)); + message3_nolog (apply1 (intern ("concat"), Fnreverse (menu_strings))); /* Make believe it's not a keyboard macro in case the help char is pressed. Help characters are not recorded because menu prompting @@ -8646,7 +8617,7 @@ orig_defn_macro = KVAR (current_kboard, defining_kbd_macro); kset_defining_kbd_macro (current_kboard, Qnil); do - obj = read_char (commandflag, 0, 0, Qt, 0, NULL); + obj = read_char (commandflag, Qnil, Qt, 0, NULL); while (BUFFERP (obj)); kset_defining_kbd_macro (current_kboard, orig_defn_macro); @@ -8667,46 +8638,18 @@ /* Reading key sequences. */ -/* Follow KEY in the maps in CURRENT[0..NMAPS-1], placing its bindings - in DEFS[0..NMAPS-1]. Set NEXT[i] to DEFS[i] if DEFS[i] is a - keymap, or nil otherwise. Return the index of the first keymap in - which KEY has any binding, or NMAPS if no map has a binding. - - If KEY is a meta ASCII character, treat it like meta-prefix-char - followed by the corresponding non-meta character. Keymaps in - CURRENT with non-prefix bindings for meta-prefix-char become nil in - NEXT. - - If KEY has no bindings in any of the CURRENT maps, NEXT is left - unmodified. - - NEXT may be the same array as CURRENT. */ - -static int -follow_key (Lisp_Object key, ptrdiff_t nmaps, Lisp_Object *current, - Lisp_Object *defs, Lisp_Object *next) -{ - ptrdiff_t i, first_binding; - - first_binding = nmaps; - for (i = nmaps - 1; i >= 0; i--) - { - if (! NILP (current[i])) - { - defs[i] = access_keymap (current[i], key, 1, 0, 1); - if (! NILP (defs[i])) - first_binding = i; - } - else - defs[i] = Qnil; - } - - /* Given the set of bindings we've found, produce the next set of maps. */ - if (first_binding < nmaps) - for (i = 0; i < nmaps; i++) - next[i] = NILP (defs[i]) ? Qnil : get_keymap (defs[i], 0, 1); - - return first_binding; +static Lisp_Object +follow_key (Lisp_Object keymap, Lisp_Object key) +{ + return access_keymap (get_keymap (keymap, 0, 1), + key, 1, 0, 1); +} + +static Lisp_Object +active_maps (Lisp_Object first_event) +{ + Lisp_Object position = INTEGERP (first_event) ? Qnil : first_event; + return Fcons (Qkeymap, Fcurrent_active_maps (Qt, position)); } /* Structure used to keep track of partial application of key remapping @@ -8838,8 +8781,9 @@ static bool test_undefined (Lisp_Object binding) { - return (EQ (binding, Qundefined) - || (!NILP (binding) && SYMBOLP (binding) + return (NILP (binding) + || EQ (binding, Qundefined) + || (SYMBOLP (binding) && EQ (Fcommand_remapping (binding, Qnil, Qnil), Qundefined))); } @@ -8896,34 +8840,9 @@ ptrdiff_t echo_start IF_LINT (= 0); ptrdiff_t keys_start; - /* The number of keymaps we're scanning right now, and the number of - keymaps we have allocated space for. */ - ptrdiff_t nmaps; - ptrdiff_t nmaps_allocated = 0; - - /* defs[0..nmaps-1] are the definitions of KEYBUF[0..t-1] in - the current keymaps. */ - Lisp_Object *defs = NULL; - - /* submaps[0..nmaps-1] are the prefix definitions of KEYBUF[0..t-1] - in the current keymaps, or nil where it is not a prefix. */ - Lisp_Object *submaps = NULL; - - /* The local map to start out with at start of key sequence. */ - Lisp_Object orig_local_map; - - /* The map from the `keymap' property to start out with at start of - key sequence. */ - Lisp_Object orig_keymap; - - /* Positive if we have already considered switching to the local-map property - of the place where a mouse click occurred. */ - int localized_local_map = 0; - - /* The index in submaps[] of the first keymap that has a binding for - this key sequence. In other words, the lowest i such that - submaps[i] is non-nil. */ - ptrdiff_t first_binding; + Lisp_Object current_binding = Qnil; + Lisp_Object first_event = Qnil; + /* Index of the first key that has no binding. It is useless to try fkey.start larger than that. */ int first_unbound; @@ -8966,11 +8885,6 @@ While we're reading, we keep the event here. */ Lisp_Object delayed_switch_frame; - /* See the comment below... */ -#if defined (GOBBLE_FIRST_EVENT) - Lisp_Object first_event; -#endif - Lisp_Object original_uppercase IF_LINT (= Qnil); int original_uppercase_position = -1; @@ -8982,10 +8896,6 @@ /* List of events for which a fake prefix key has been generated. */ Lisp_Object fake_prefixed_keys = Qnil; -#if defined (GOBBLE_FIRST_EVENT) - int junk; -#endif - struct gcpro gcpro1; GCPRO1 (fake_prefixed_keys); @@ -9021,19 +8931,6 @@ keys_start = this_command_key_count; this_single_command_key_start = keys_start; -#if defined (GOBBLE_FIRST_EVENT) - /* This doesn't quite work, because some of the things that read_char - does cannot safely be bypassed. It seems too risky to try to make - this work right. */ - - /* Read the first char of the sequence specially, before setting - up any keymaps, in case a filter runs and switches buffers on us. */ - first_event = read_char (NILP (prompt), 0, submaps, last_nonmenu_event, - &junk, NULL); -#endif /* GOBBLE_FIRST_EVENT */ - - orig_local_map = get_local_map (PT, current_buffer, Qlocal_map); - orig_keymap = get_local_map (PT, current_buffer, Qkeymap); from_string = Qnil; /* We jump here when we need to reinitialize fkey and keytran; this @@ -9060,60 +8957,8 @@ keybuf with its symbol, or if the sequence starts with a mouse click and we need to switch buffers, we jump back here to rebuild the initial keymaps from the current buffer. */ - nmaps = 0; - - if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map))) - { - if (2 > nmaps_allocated) - { - submaps = alloca (2 * sizeof *submaps); - defs = alloca (2 * sizeof *defs); - nmaps_allocated = 2; - } - submaps[nmaps++] = KVAR (current_kboard, Voverriding_terminal_local_map); - } - else if (!NILP (Voverriding_local_map)) - { - if (2 > nmaps_allocated) - { - submaps = alloca (2 * sizeof *submaps); - defs = alloca (2 * sizeof *defs); - nmaps_allocated = 2; - } - submaps[nmaps++] = Voverriding_local_map; - } - else - { - ptrdiff_t nminor; - ptrdiff_t total; - Lisp_Object *maps; - - nminor = current_minor_maps (0, &maps); - total = nminor + (!NILP (orig_keymap) ? 3 : 2); - - if (total > nmaps_allocated) - { - submaps = alloca (total * sizeof *submaps); - defs = alloca (total * sizeof *defs); - nmaps_allocated = total; - } - - if (!NILP (orig_keymap)) - submaps[nmaps++] = orig_keymap; - - memcpy (submaps + nmaps, maps, nminor * sizeof (submaps[0])); - - nmaps += nminor; - - submaps[nmaps++] = orig_local_map; - } - submaps[nmaps++] = current_global_map; - - /* Find an accurate initial value for first_binding. */ - for (first_binding = 0; first_binding < nmaps; first_binding++) - if (! NILP (submaps[first_binding])) - break; - + current_binding = active_maps (first_event); + /* Start from the beginning in keybuf. */ t = 0; @@ -9126,9 +8971,9 @@ /* If the best binding for the current key sequence is a keymap, or we may be looking at a function key's escape sequence, keep on reading. */ - while (first_binding < nmaps + while (!NILP (current_binding) /* Keep reading as long as there's a prefix binding. */ - ? !NILP (submaps[first_binding]) + ? KEYMAPP (current_binding) /* Don't return in the middle of a possible function key sequence, if the only bindings we found were via case conversion. Thus, if ESC O a has a function-key-map translation @@ -9152,7 +8997,7 @@ just one key. */ ptrdiff_t echo_local_start IF_LINT (= 0); int keys_local_start; - ptrdiff_t local_first_binding; + Lisp_Object new_binding; eassert (indec.end == t || (indec.end > t && indec.end <= mock_input)); eassert (indec.start <= indec.end); @@ -9189,7 +9034,6 @@ if (INTERACTIVE) echo_local_start = echo_length (); keys_local_start = this_command_key_count; - local_first_binding = first_binding; replay_key: /* These are no-ops, unless we throw away a keystroke below and @@ -9199,7 +9043,6 @@ if (INTERACTIVE && t < mock_input) echo_truncate (echo_local_start); this_command_key_count = keys_local_start; - first_binding = local_first_binding; /* By default, assume each event is "real". */ last_real_key_start = t; @@ -9224,8 +9067,8 @@ { KBOARD *interrupted_kboard = current_kboard; struct frame *interrupted_frame = SELECTED_FRAME (); - key = read_char (NILP (prompt), nmaps, - (Lisp_Object *) submaps, last_nonmenu_event, + key = read_char (NILP (prompt), + current_binding, last_nonmenu_event, &used_mouse_menu, NULL); if ((INTEGERP (key) && XINT (key) == -2) /* wrong_kboard_jmpbuf */ /* When switching to a new tty (with a new keyboard), @@ -9280,8 +9123,6 @@ KVAR (interrupted_kboard, kbd_queue))); } mock_input = 0; - orig_local_map = get_local_map (PT, current_buffer, Qlocal_map); - orig_keymap = get_local_map (PT, current_buffer, Qkeymap); goto replay_entire_sequence; } } @@ -9322,12 +9163,11 @@ { if (! FRAME_LIVE_P (XFRAME (selected_frame))) Fkill_emacs (Qnil); - if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer) + if (XBUFFER (XWINDOW (selected_window)->buffer) + != current_buffer) Fset_buffer (XWINDOW (selected_window)->buffer); } - orig_local_map = get_local_map (PT, current_buffer, Qlocal_map); - orig_keymap = get_local_map (PT, current_buffer, Qkeymap); goto replay_sequence; } @@ -9344,8 +9184,6 @@ keybuf[t++] = key; mock_input = t; Vquit_flag = Qnil; - orig_local_map = get_local_map (PT, current_buffer, Qlocal_map); - orig_keymap = get_local_map (PT, current_buffer, Qkeymap); goto replay_sequence; } @@ -9365,6 +9203,22 @@ } } + if (NILP (first_event)) + { + first_event = key; + /* Even if first_event does not specify a particular + window/position, it's important to recompute the maps here + since a long time might have passed since we entered + read_key_sequence, and a timer (or process-filter or + special-event-map, ...) might have switched the current buffer + or the selected window from under us in the mean time. */ + if (fix_current_buffer + && (XBUFFER (XWINDOW (selected_window)->buffer) + != current_buffer)) + Fset_buffer (XWINDOW (selected_window)->buffer); + current_binding = active_maps (first_event); + } + GROW_RAW_KEYBUF; ASET (raw_keybuf, raw_keybuf_count, key); raw_keybuf_count++; @@ -9438,58 +9292,8 @@ if (! FRAME_LIVE_P (XFRAME (selected_frame))) Fkill_emacs (Qnil); set_buffer_internal (XBUFFER (XWINDOW (window)->buffer)); - orig_local_map = get_local_map (PT, current_buffer, - Qlocal_map); - orig_keymap = get_local_map (PT, current_buffer, - Qkeymap); goto replay_sequence; } - - /* For a mouse click, get the local text-property keymap - of the place clicked on, rather than point. */ - if (CONSP (XCDR (key)) - && ! localized_local_map) - { - Lisp_Object map_here, start, pos; - - localized_local_map = 1; - start = EVENT_START (key); - - if (CONSP (start) && POSN_INBUFFER_P (start)) - { - pos = POSN_BUFFER_POSN (start); - if (INTEGERP (pos) - && XINT (pos) >= BEGV - && XINT (pos) <= ZV) - { - map_here = get_local_map (XINT (pos), - current_buffer, - Qlocal_map); - if (!EQ (map_here, orig_local_map)) - { - orig_local_map = map_here; - ++localized_local_map; - } - - map_here = get_local_map (XINT (pos), - current_buffer, - Qkeymap); - if (!EQ (map_here, orig_keymap)) - { - orig_keymap = map_here; - ++localized_local_map; - } - - if (localized_local_map > 1) - { - keybuf[t] = key; - mock_input = t + 1; - - goto replay_sequence; - } - } - } - } } /* Expand mode-line and scroll-bar events into two events: @@ -9510,63 +9314,8 @@ prevent proper action when the event is pushed back into unread-command-events. */ fake_prefixed_keys = Fcons (key, fake_prefixed_keys); - - /* If on a mode line string with a local keymap, - reconsider the key sequence with that keymap. */ - if (string = POSN_STRING (EVENT_START (key)), - (CONSP (string) && STRINGP (XCAR (string)))) - { - Lisp_Object pos, map, map2; - - pos = XCDR (string); - string = XCAR (string); - if (XINT (pos) >= 0 - && XINT (pos) < SCHARS (string)) - { - map = Fget_text_property (pos, Qlocal_map, string); - if (!NILP (map)) - orig_local_map = map; - map2 = Fget_text_property (pos, Qkeymap, string); - if (!NILP (map2)) - orig_keymap = map2; - if (!NILP (map) || !NILP (map2)) - goto replay_sequence; - } - } - goto replay_key; } - else if (NILP (from_string) - && (string = POSN_STRING (EVENT_START (key)), - (CONSP (string) && STRINGP (XCAR (string))))) - { - /* For a click on a string, i.e. overlay string or a - string displayed via the `display' property, - consider `local-map' and `keymap' properties of - that string. */ - Lisp_Object pos, map, map2; - - pos = XCDR (string); - string = XCAR (string); - if (XINT (pos) >= 0 - && XINT (pos) < SCHARS (string)) - { - map = Fget_text_property (pos, Qlocal_map, string); - if (!NILP (map)) - orig_local_map = map; - map2 = Fget_text_property (pos, Qkeymap, string); - if (!NILP (map2)) - orig_keymap = map2; - - if (!NILP (map) || !NILP (map2)) - { - from_string = string; - keybuf[t++] = key; - mock_input = t; - goto replay_sequence; - } - } - } } else if (CONSP (XCDR (key)) && CONSP (EVENT_START (key)) @@ -9582,7 +9331,7 @@ if (bufsize - t <= 1) error ("Key sequence too long"); keybuf[t] = posn; - keybuf[t+1] = key; + keybuf[t + 1] = key; /* Zap the position in key, so we know that we've expanded it, and don't try to do so again. */ @@ -9605,15 +9354,10 @@ /* We have finally decided that KEY is something we might want to look up. */ - first_binding = (follow_key (key, - nmaps - first_binding, - submaps + first_binding, - defs + first_binding, - submaps + first_binding) - + first_binding); + new_binding = follow_key (current_binding, key); /* If KEY wasn't bound, we'll try some fallbacks. */ - if (first_binding < nmaps) + if (!NILP (new_binding)) /* This is needed for the following scenario: event 0: a down-event that gets dropped by calling replay_key. event 1: some normal prefix like C-h. @@ -9750,20 +9494,13 @@ new_click = Fcons (new_head, Fcons (EVENT_START (key), Qnil)); - /* Look for a binding for this new key. follow_key - promises that it didn't munge submaps the - last time we called it, since key was unbound. */ - first_binding - = (follow_key (new_click, - nmaps - local_first_binding, - submaps + local_first_binding, - defs + local_first_binding, - submaps + local_first_binding) - + local_first_binding); + /* Look for a binding for this new key. */ + new_binding = follow_key (current_binding, new_click); /* If that click is bound, go for it. */ - if (first_binding < nmaps) + if (!NILP (new_binding)) { + current_binding = new_binding; key = new_click; break; } @@ -9772,6 +9509,7 @@ } } } + current_binding = new_binding; keybuf[t++] = key; /* Normally, last_nonmenu_event gets the previous key we read. @@ -9803,9 +9541,8 @@ } } - if (first_binding < nmaps - && NILP (submaps[first_binding]) - && !test_undefined (defs[first_binding]) + if (!KEYMAPP (current_binding) + && !test_undefined (current_binding) && indec.start >= t) /* There is a binding and it's not a prefix. (and it doesn't have any input-decode-map translation pending). @@ -9834,8 +9571,7 @@ first_binding >= nmaps) we don't want to apply this function-key-mapping. */ fkey.end + 1 == t - && (first_binding >= nmaps - || test_undefined (defs[first_binding])), + && (test_undefined (current_binding)), &diff, prompt); UNGCPRO; if (done) @@ -9878,7 +9614,7 @@ and cannot be part of a function key or translation, and is an upper case letter use the corresponding lower-case letter instead. */ - if (first_binding >= nmaps + if (NILP (current_binding) && /* indec.start >= t && fkey.start >= t && */ keytran.start >= t && INTEGERP (key) && ((CHARACTERP (make_number (XINT (key) & ~CHAR_MODIFIER_MASK)) @@ -9909,7 +9645,7 @@ and cannot be part of a function key or translation, and is a shifted function key, use the corresponding unshifted function key instead. */ - if (first_binding >= nmaps + if (NILP (current_binding) && /* indec.start >= t && fkey.start >= t && */ keytran.start >= t) { Lisp_Object breakdown = parse_modifiers (key); @@ -9950,9 +9686,7 @@ } } if (!dummyflag) - read_key_sequence_cmd = (first_binding < nmaps - ? defs[first_binding] - : Qnil); + read_key_sequence_cmd = current_binding; read_key_sequence_remapped /* Remap command through active keymaps. Do the remapping here, before the unbind_to so it uses the keymaps @@ -9966,7 +9700,7 @@ /* Don't downcase the last character if the caller says don't. Don't downcase it if the result is undefined, either. */ - if ((dont_downcase_last || first_binding >= nmaps) + if ((dont_downcase_last || NILP (current_binding)) && t > 0 && t - 1 == original_uppercase_position) { @@ -10063,7 +9797,7 @@ memset (keybuf, 0, sizeof keybuf); GCPRO1 (keybuf[0]); - gcpro1.nvars = (sizeof keybuf/sizeof (keybuf[0])); + gcpro1.nvars = (sizeof keybuf / sizeof (keybuf[0])); if (NILP (continue_echo)) { @@ -11669,10 +11403,6 @@ to count as a drag. */); double_click_fuzz = 3; - DEFVAR_BOOL ("inhibit-local-menu-bar-menus", inhibit_local_menu_bar_menus, - doc: /* Non-nil means inhibit local map menu bar menus. */); - inhibit_local_menu_bar_menus = 0; - DEFVAR_INT ("num-input-keys", num_input_keys, doc: /* Number of complete key sequences read as input so far. This includes key sequences read from keyboard macros. === modified file 'src/keyboard.h' --- src/keyboard.h 2013-01-01 09:11:05 +0000 +++ src/keyboard.h 2013-02-11 19:21:23 +0000 @@ -482,7 +482,7 @@ extern Lisp_Object parse_modifiers (Lisp_Object); extern Lisp_Object reorder_modifiers (Lisp_Object); -extern Lisp_Object read_char (int, ptrdiff_t, Lisp_Object *, Lisp_Object, +extern Lisp_Object read_char (int, Lisp_Object, Lisp_Object, bool *, EMACS_TIME *); extern int parse_solitary_modifier (Lisp_Object symbol); === modified file 'src/keymap.c' --- src/keymap.c 2013-01-17 06:29:40 +0000 +++ src/keymap.c 2013-02-11 19:21:23 +0000 @@ -1244,7 +1244,7 @@ return INTEGERP (command) ? Qnil : command; } -/* Value is number if KEY is too long; nil if valid but has no definition. */ +/* Value is number if KEY is too long; nil if valid but has no definition. */ /* GC is possible in this function. */ DEFUN ("lookup-key", Flookup_key, Slookup_key, 2, 3, 0, @@ -1536,7 +1536,7 @@ doc: /* Return a list of the currently active keymaps. OLP if non-nil indicates that we should obey `overriding-local-map' and `overriding-terminal-local-map'. POSITION can specify a click position -like in the respective argument of `key-binding'. */) +like in the respective argument of `key-binding'. */) (Lisp_Object olp, Lisp_Object position) { ptrdiff_t count = SPECPDL_INDEX (); @@ -1545,7 +1545,7 @@ /* If a mouse click position is given, our variables are based on the buffer clicked on, not the current buffer. So we may have to - switch the buffer here. */ + switch the buffer here. */ if (CONSP (position)) { === modified file 'src/lread.c' --- src/lread.c 2013-02-08 17:42:09 +0000 +++ src/lread.c 2013-02-11 19:21:23 +0000 @@ -614,17 +614,17 @@ end_time = add_emacs_time (current_emacs_time (), wait_time); } -/* Read until we get an acceptable event. */ + /* Read until we get an acceptable event. */ retry: do - val = read_char (0, 0, 0, (input_method ? Qnil : Qt), 0, + val = read_char (0, Qnil, (input_method ? Qnil : Qt), 0, NUMBERP (seconds) ? &end_time : NULL); while (INTEGERP (val) && XINT (val) == -2); /* wrong_kboard_jmpbuf */ if (BUFFERP (val)) goto retry; - /* switch-frame events are put off until after the next ASCII + /* `switch-frame' events are put off until after the next ASCII character. This is better than signaling an error just because the last characters were typed to a separate minibuffer frame, for example. Eventually, some code which can deal with ------------------------------------------------------------ revno: 111735 fixes bug: http://debbugs.gnu.org/13675 committer: Eli Zaretskii branch nick: trunk timestamp: Mon 2013-02-11 19:32:32 +0200 message: Fix previous commit for bug #13675. src/xdisp.c (move_it_vertically_backward, move_it_by_lines): Don't use the limitation on backwards movement when lines are truncated in the window. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-02-11 10:21:52 +0000 +++ src/ChangeLog 2013-02-11 17:32:32 +0000 @@ -1,3 +1,9 @@ +2013-02-11 Eli Zaretskii + + * xdisp.c (move_it_vertically_backward, move_it_by_lines): Don't + use the limitation on backwards movement when lines are truncated + in the window. (Bug#13675) + 2013-02-11 Dmitry Antipov * marker.c (set_marker_internal): If desired position is passed === modified file 'src/xdisp.c' --- src/xdisp.c 2013-02-11 10:21:52 +0000 +++ src/xdisp.c 2013-02-11 17:32:32 +0000 @@ -9003,7 +9003,10 @@ /* Estimate how many newlines we must move back. */ nlines = max (1, dy / FRAME_LINE_HEIGHT (it->f)); - pos_limit = max (start_pos - nlines * nchars_per_row, BEGV); + if (it->line_wrap == TRUNCATE) + pos_limit = BEGV; + else + pos_limit = max (start_pos - nlines * nchars_per_row, BEGV); /* Set the iterator's position that many lines back. But don't go back more than NLINES full screen lines -- this wins a day with @@ -9253,7 +9256,10 @@ /* Go back -DVPOS buffer lines, but no farther than -DVPOS full screen lines, and reseat the iterator there. */ start_charpos = IT_CHARPOS (*it); - pos_limit = max (start_charpos + dvpos * nchars_per_row, BEGV); + if (it->line_wrap == TRUNCATE) + pos_limit = BEGV; + else + pos_limit = max (start_charpos + dvpos * nchars_per_row, BEGV); for (i = -dvpos; i > 0 && IT_CHARPOS (*it) > pos_limit; --i) back_to_previous_visible_line_start (it); reseat (it, it->current.pos, 1); ------------------------------------------------------------ revno: 111734 committer: Glenn Morris branch nick: trunk timestamp: Mon 2013-02-11 06:17:34 -0500 message: Auto-commit of generated files. diff: === modified file 'autogen/configure' --- autogen/configure 2013-02-10 11:19:05 +0000 +++ autogen/configure 2013-02-11 11:17:34 +0000 @@ -3367,7 +3367,19 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + emacs_config_options="$@" +## Add some environment variables, if they were passed via the environment +## rather than on the command-line. +for var in CFLAGS CPPFLAGS LDFLAGS; do + case "$emacs_config_options" in + *$var=*) continue ;; + esac + eval val="\$${var}" + test x"$val" = x && continue + emacs_config_options="${emacs_config_options}${emacs_config_options:+ }$var=$val" +done + ac_config_headers="$ac_config_headers src/config.h:src/config.in" ------------------------------------------------------------ revno: 111733 committer: Michael Albinus + + * NEWS: Add autorevert changes. + 2013-02-05 Jan Djärv * NEWS: Mention ns-use-native-fullscreen. === modified file 'etc/NEWS' --- etc/NEWS 2013-02-11 01:50:45 +0000 +++ etc/NEWS 2013-02-11 10:42:58 +0000 @@ -240,6 +240,20 @@ 'inotify' API on GNU/Linux systems. On MS-Windows systems, this is supported for Windows XP and newer versions. +** Changes in autorevert.el + +--- +*** If Emacs is compiled with file notification support, notifications +are used instead of checking the time stamp of the files. You can +disable this by setting the user option `auto-revert-use-notify' to +nil. Alternatively, a regular expression of directories to be +excluded from file notifications can be specified by +`auto-revert-notify-exclude-dir-regexp'. + +--- +*** The new user option `auto-revert-remote-files' enables reversion +of remote files when set to non-nil. + ** Face changes *** The `face-spec-set' is now analogous to `setq' for face specs. ------------------------------------------------------------ revno: 111732 committer: Dmitry Antipov branch nick: trunk timestamp: Mon 2013-02-11 14:21:52 +0400 message: * marker.c (set_marker_internal): If desired position is passed as a marker, avoid call to buf_charpos_to_bytepos. * window.c (Fset_window_point): Omit redundant type checking. (Fset_window_start): Likewise. Format comment. (window_scroll_pixel_based): Use set_marker_restricted_both with character and byte positions obtained from an iterator. (Fset_window_configuration): Use set_marker_restricted_both. * xdisp.c (message_dolog): Likewise. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-02-10 16:49:09 +0000 +++ src/ChangeLog 2013-02-11 10:21:52 +0000 @@ -1,3 +1,14 @@ +2013-02-11 Dmitry Antipov + + * marker.c (set_marker_internal): If desired position is passed + as a marker, avoid call to buf_charpos_to_bytepos. + * window.c (Fset_window_point): Omit redundant type checking. + (Fset_window_start): Likewise. Format comment. + (window_scroll_pixel_based): Use set_marker_restricted_both + with character and byte positions obtained from an iterator. + (Fset_window_configuration): Use set_marker_restricted_both. + * xdisp.c (message_dolog): Likewise. + 2013-02-10 Eli Zaretskii * xdisp.c (move_it_vertically_backward, move_it_by_lines): When === modified file 'src/marker.c' --- src/marker.c 2013-01-02 16:13:04 +0000 +++ src/marker.c 2013-02-11 10:21:52 +0000 @@ -499,11 +499,29 @@ { register ptrdiff_t charpos, bytepos; - CHECK_NUMBER_COERCE_MARKER (position); - charpos = clip_to_bounds (restricted ? BUF_BEGV (b) : BUF_BEG (b), - XINT (position), - restricted ? BUF_ZV (b) : BUF_Z (b)); - bytepos = buf_charpos_to_bytepos (b, charpos); + /* Do not use CHECK_NUMBER_COERCE_MARKER because we + don't want to call buf_charpos_to_bytepos if POSTION + is a marker and so we know the bytepos already. */ + if (INTEGERP (position)) + charpos = XINT (position), bytepos = -1; + else if (MARKERP (position)) + { + charpos = XMARKER (position)->charpos; + bytepos = XMARKER (position)->bytepos; + } + else + wrong_type_argument (Qinteger_or_marker_p, position); + + charpos = clip_to_bounds + (restricted ? BUF_BEGV (b) : BUF_BEG (b), charpos, + restricted ? BUF_ZV (b) : BUF_Z (b)); + if (bytepos == -1) + bytepos = buf_charpos_to_bytepos (b, charpos); + else + bytepos = clip_to_bounds + (restricted ? BUF_BEGV_BYTE (b) : BUF_BEG_BYTE (b), + bytepos, restricted ? BUF_ZV_BYTE (b) : BUF_Z_BYTE (b)); + attach_marker (m, b, charpos, bytepos); } return marker; === modified file 'src/window.c' --- src/window.c 2013-02-08 05:28:52 +0000 +++ src/window.c 2013-02-11 10:21:52 +0000 @@ -1544,7 +1544,7 @@ { register struct window *w = decode_live_window (window); - CHECK_NUMBER_COERCE_MARKER (pos); + /* Type of POS is checked by Fgoto_char or set_marker_restricted ... */ if (w == XWINDOW (selected_window)) { @@ -1554,6 +1554,8 @@ { struct buffer *old_buffer = current_buffer; + /* ... but here we want to catch type error before buffer change. */ + CHECK_NUMBER_COERCE_MARKER (pos); set_buffer_internal (XBUFFER (w->buffer)); Fgoto_char (pos); set_buffer_internal (old_buffer); @@ -1579,9 +1581,8 @@ { register struct window *w = decode_live_window (window); - CHECK_NUMBER_COERCE_MARKER (pos); set_marker_restricted (w->start, pos, w->buffer); - /* this is not right, but much easier than doing what is right. */ + /* This is not right, but much easier than doing what is right. */ w->start_at_line_beg = 0; if (NILP (noforce)) w->force_start = 1; @@ -4615,8 +4616,8 @@ } /* Set the window start, and set up the window for redisplay. */ - set_marker_restricted (w->start, make_number (pos), - w->buffer); + set_marker_restricted_both (w->start, w->buffer, IT_CHARPOS (it), + IT_BYTEPOS (it)); bytepos = marker_byte_position (w->start); w->start_at_line_beg = (pos == BEGV || FETCH_BYTE (bytepos - 1) == '\n'); w->update_mode_line = 1; @@ -5795,8 +5796,7 @@ { /* Set window markers at start of visible range. */ if (XMARKER (w->start)->buffer == 0) - set_marker_restricted (w->start, make_number (0), - w->buffer); + set_marker_restricted_both (w->start, w->buffer, 0, 0); if (XMARKER (w->pointm)->buffer == 0) set_marker_restricted_both (w->pointm, w->buffer, @@ -5814,10 +5814,8 @@ wset_buffer (w, other_buffer_safely (Fcurrent_buffer ())); /* This will set the markers to beginning of visible range. */ - set_marker_restricted (w->start, - make_number (0), w->buffer); - set_marker_restricted (w->pointm, - make_number (0), w->buffer); + set_marker_restricted_both (w->start, w->buffer, 0, 0); + set_marker_restricted_both (w->pointm, w->buffer, 0, 0); w->start_at_line_beg = 1; if (!NILP (w->dedicated)) /* Record this window as dead. */ === modified file 'src/xdisp.c' --- src/xdisp.c 2013-02-10 16:49:09 +0000 +++ src/xdisp.c 2013-02-11 10:21:52 +0000 @@ -9396,11 +9396,11 @@ bset_undo_list (current_buffer, Qt); oldpoint = message_dolog_marker1; - set_marker_restricted (oldpoint, make_number (PT), Qnil); + set_marker_restricted_both (oldpoint, Qnil, PT, PT_BYTE); oldbegv = message_dolog_marker2; - set_marker_restricted (oldbegv, make_number (BEGV), Qnil); + set_marker_restricted_both (oldbegv, Qnil, BEGV, BEGV_BYTE); oldzv = message_dolog_marker3; - set_marker_restricted (oldzv, make_number (ZV), Qnil); + set_marker_restricted_both (oldzv, Qnil, ZV, ZV_BYTE); GCPRO1 (old_deactivate_mark); if (PT == Z) ------------------------------------------------------------ revno: 111731 fixes bug: http://debbugs.gnu.org/11067 committer: Glenn Morris branch nick: trunk timestamp: Mon 2013-02-11 00:28:08 -0800 message: Check whether diff supports --label before using it * lisp/vc/diff.el (diff-use-labels): New variable. (diff-no-select): Use --label rather than -L, and first check that it is supported. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-02-11 01:50:45 +0000 +++ lisp/ChangeLog 2013-02-11 08:28:08 +0000 @@ -1,5 +1,9 @@ 2013-02-11 Glenn Morris + * vc/diff.el (diff-use-labels): New variable. + (diff-no-select): Use --label rather than -L, and first + check that it is supported. (Bug#11067) + * files.el (enable-dir-local-variables): New variable. (hack-dir-local-variables): Respect enable-dir-local-variables. * tutorial.el (help-with-tutorial): === modified file 'lisp/vc/diff.el' --- lisp/vc/diff.el 2013-01-11 23:08:55 +0000 +++ lisp/vc/diff.el 2013-02-11 08:28:08 +0000 @@ -114,6 +114,13 @@ tempfile)) (file-local-copy file-or-buf))) +(defvar diff-use-labels 'check + "Whether `diff-command' understands the \"--label\" option. +Possible values are: + t -- yes, it does + nil -- no, it does not + check -- try to probe whether it does") + (defun diff-no-select (old new &optional switches no-async buf) ;; Noninteractive helper for creating and reverting diff buffers (unless (bufferp new) (setq new (expand-file-name new))) @@ -121,6 +128,11 @@ (or switches (setq switches diff-switches)) ; If not specified, use default. (unless (listp switches) (setq switches (list switches))) (or buf (setq buf (get-buffer-create "*Diff*"))) + (when (eq 'check diff-use-labels) + (setq diff-use-labels + (with-temp-buffer + (when (ignore-errors (call-process diff-command nil t nil "--help")) + (if (search-backward "--label" nil t) t))))) (let* ((old-alt (diff-file-local-copy old)) (new-alt (diff-file-local-copy new)) (command @@ -130,11 +142,14 @@ ,@switches ,@(mapcar #'shell-quote-argument (nconc - (when (or old-alt new-alt) - (list "-L" (if (stringp old) - old (prin1-to-string old)) - "-L" (if (stringp new) - new (prin1-to-string new)))) + (and (or old-alt new-alt) + (eq diff-use-labels t) + (list "--label" + (if (stringp old) old + (prin1-to-string old)) + "--label" + (if (stringp new) new + (prin1-to-string new)))) (list (or old-alt old) (or new-alt new))))) " ")) ------------------------------------------------------------ revno: 111730 fixes bug: http://debbugs.gnu.org/11127 committer: Glenn Morris branch nick: trunk timestamp: Sun 2013-02-10 17:50:45 -0800 message: Add `enable-dir-local-variables' * lisp/files.el (enable-dir-local-variables): New variable. (hack-dir-local-variables): Respect enable-dir-local-variables. * lisp/tutorial.el (help-with-tutorial): Ignore directory-local variables. diff: === modified file 'etc/NEWS' --- etc/NEWS 2013-02-11 01:44:39 +0000 +++ etc/NEWS 2013-02-11 01:50:45 +0000 @@ -45,6 +45,10 @@ ** `eval-defun' on an already defined defcustom calls the :set function, if there is one. +** If the new variable `enable-dir-local-variables' is nil, +directory local variables are ignored. May be useful for some modes +that want to ignore directory-locals while still respecting file-locals. + ** The option `set-mark-default-inactive' has been deleted. This unfinished feature was introduced by accident in Emacs 23.1; simply disabling Transient Mark mode does the same thing. @@ -228,7 +232,7 @@ file using `set-file-extended-attributes'. -* Lisp changes in Emacs 24.4 +* Lisp Changes in Emacs 24.4 ** Support for filesystem notifications. Emacs now supports notifications of filesystem changes, such as @@ -273,7 +277,7 @@ and ACL entries. -* Changes in Emacs 24.4 on non-free operating systems +* Changes in Emacs 24.4 on Non-Free Operating Systems +++ ** The "generate a backtrace on fatal error" feature now works on MS Windows. === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-02-11 01:07:05 +0000 +++ lisp/ChangeLog 2013-02-11 01:50:45 +0000 @@ -1,5 +1,10 @@ 2013-02-11 Glenn Morris + * files.el (enable-dir-local-variables): New variable. + (hack-dir-local-variables): Respect enable-dir-local-variables. + * tutorial.el (help-with-tutorial): + Ignore directory-local variables. (Bug#11127) + * vc/vc-svn.el (vc-svn-command): Move --non-interactive from here... (vc-svn-global-switches): ... to here. (Bug#13513) === modified file 'lisp/files.el' --- lisp/files.el 2013-02-10 03:08:21 +0000 +++ lisp/files.el 2013-02-11 01:50:45 +0000 @@ -507,6 +507,11 @@ (other :tag "Query" other)) :group 'find-file) +(defvar enable-dir-local-variables t + "Non-nil means enable use of directory-local variables. +Some modes may wish to set this to nil to prevent directory-local +settings being applied, but still respect file-local ones.") + ;; This is an odd variable IMO. ;; You might wonder why it is needed, when we could just do: ;; (set (make-local-variable 'enable-local-variables) nil) @@ -3659,8 +3664,12 @@ (defun hack-dir-local-variables () "Read per-directory local variables for the current buffer. Store the directory-local variables in `dir-local-variables-alist' -and `file-local-variables-alist', without applying them." +and `file-local-variables-alist', without applying them. + +This does nothing if either `enable-local-variables' or +`enable-dir-local-variables' are nil." (when (and enable-local-variables + enable-dir-local-variables (or enable-remote-dir-locals (not (file-remote-p (or (buffer-file-name) default-directory))))) === modified file 'lisp/tutorial.el' --- lisp/tutorial.el 2013-01-01 09:11:05 +0000 +++ lisp/tutorial.el 2013-02-11 01:50:45 +0000 @@ -829,10 +829,9 @@ (progn (insert-file-contents (tutorial--saved-file)) (let ((enable-local-variables :safe) - (enable-local-eval nil)) + (enable-local-eval nil) + (enable-dir-local-variables nil)) ; bug#11127 (hack-local-variables)) - ;; FIXME? What we actually want is to ignore dir-locals (?). - (setq buffer-read-only nil) ; bug#11118 (goto-char (point-min)) (setq old-tut-point (string-to-number @@ -849,10 +848,9 @@ (setq tutorial--point-before-chkeys (point-marker))) (insert-file-contents (expand-file-name filename tutorial-directory)) (let ((enable-local-variables :safe) - (enable-local-eval nil)) + (enable-local-eval nil) + (enable-dir-local-variables nil)) ; bug#11127 (hack-local-variables)) - ;; FIXME? What we actually want is to ignore dir-locals (?). - (setq buffer-read-only nil) ; bug#11118 (forward-line) (setq tutorial--point-before-chkeys (point-marker)))