From a73d395bd9e31e29814d642bf35d412ccb6f0ee2 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 13 Feb 2011 20:55:07 +0200 Subject: [PATCH 01/46] Fix bug #8020 with quick resizing of the selected frame. xdisp.c (redisplay_internal): Resynchronize `w' if the selected window is changed inside calls to do_pending_window_change. --- src/ChangeLog | 6 ++++++ src/xdisp.c | 21 +++++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index b90a9c02e8b..68e9c76a437 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2011-02-13 Eli Zaretskii + + * xdisp.c (redisplay_internal): Resynchronize `w' if the selected + window is changed inside calls to do_pending_window_change. + (Bug#8020) + 2011-02-12 Eli Zaretskii * terminal.c (create_terminal): Use default-keyboard-coding-system diff --git a/src/xdisp.c b/src/xdisp.c index d625b05075d..c2af4d68b6e 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -11261,6 +11261,7 @@ redisplay_internal (preserve_echo_area) int preserve_echo_area; { struct window *w = XWINDOW (selected_window); + struct window *sw; struct frame *f; int pause; int must_finish = 0; @@ -11331,6 +11332,9 @@ redisplay_internal (preserve_echo_area) } retry: + /* Remember the currently selected window. */ + sw = w; + if (!EQ (old_frame, selected_frame) && FRAME_LIVE_P (XFRAME (old_frame))) /* When running redisplay, we play a bit fast-and-loose and allow e.g. @@ -11396,6 +11400,14 @@ redisplay_internal (preserve_echo_area) /* Notice any pending interrupt request to change frame size. */ do_pending_window_change (1); + /* do_pending_window_change could change the selected_window due to + frame resizing which makes the selected window too small. */ + if (WINDOWP (selected_window) && (w = XWINDOW (selected_window)) != sw) + { + sw = w; + reconsider_clip_changes (w, current_buffer); + } + /* Clear frames marked as garbaged. */ if (frame_garbaged) clear_garbaged_frames (); @@ -11665,6 +11677,10 @@ redisplay_internal (preserve_echo_area) if (!must_finish) { do_pending_window_change (1); + /* If selected_window changed, redisplay again. */ + if (WINDOWP (selected_window) + && (w = XWINDOW (selected_window)) != sw) + goto retry; /* We used to always goto end_of_redisplay here, but this isn't enough if we have a blinking cursor. */ @@ -11959,8 +11975,9 @@ redisplay_internal (preserve_echo_area) do_pending_window_change (1); /* If we just did a pending size change, or have additional - visible frames, redisplay again. */ - if (windows_or_buffers_changed && !pause) + visible frames, or selected_window changed, redisplay again. */ + if ((windows_or_buffers_changed && !pause) + || (WINDOWP (selected_window) && (w = XWINDOW (selected_window)) != sw)) goto retry; /* Clear the face cache eventually. */ From 07ca555579fd4210c6ac6b487b6a491dc8c66562 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sun, 13 Feb 2011 17:37:55 -0800 Subject: [PATCH 02/46] Misc updates for dired-x.texi. * doc/misc/dired-x.texi: Drop meaningless version number. (Introduction): Remove old info. (Optional Installation Dired Jump): Autoload from dired-x. Remove incorrect info about loaddefs.el. (Bugs): Just refer to M-x report-emacs-bug. --- doc/misc/ChangeLog | 8 +++ doc/misc/dired-x.texi | 125 +++++++----------------------------------- 2 files changed, 28 insertions(+), 105 deletions(-) diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index d87bb9f8dc9..172c6187673 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,3 +1,11 @@ +2011-02-14 Glenn Morris + + * dired-x.texi: Drop meaningless version number. + (Introduction): Remove old info. + (Optional Installation Dired Jump): Autoload from dired-x. + Remove incorrect info about loaddefs.el. + (Bugs): Just refer to M-x report-emacs-bug. + 2011-02-12 Glenn Morris * sc.texi (Getting Connected): Remove old index entries. diff --git a/doc/misc/dired-x.texi b/doc/misc/dired-x.texi index 58fcc9ecbc0..a31a3dac319 100644 --- a/doc/misc/dired-x.texi +++ b/doc/misc/dired-x.texi @@ -7,10 +7,9 @@ @c [Dodd's address no longer valid.] @comment %**start of header (This is for running Texinfo on a region.) -@c FOR GNU EMACS USE ../info/dired-x BELOW @setfilename ../../info/dired-x -@c dired-x.el REVISION NUMBER -@settitle Dired Extra Version 2 User's Manual +@settitle Dired Extra User's Manual + @iftex @finalout @end iftex @@ -48,8 +47,7 @@ developing GNU and promoting software freedom.'' @titlepage @sp 6 -@c dired-x.el REVISION NUMBER -@center @titlefont{Dired Extra Version 2} +@center @titlefont{Dired Extra} @sp 2 @center @titlefont{For The GNU Emacs} @sp 1 @@ -70,10 +68,9 @@ developing GNU and promoting software freedom.'' @ifnottex @node Top -@comment node-name, next, previous, up @noindent -This documents the ``extra'' features for Dired Mode for GNU Emacs that are +This documents the ``extra'' features for GNU Emacs's Dired Mode that are provided by the file @file{dired-x.el}. @itemize @bullet @@ -81,20 +78,8 @@ provided by the file @file{dired-x.el}. @item Based on @file{dired.texi} by Sebastian Kremer -@c dired-x.el REVISION NUMBER @item -For @file{dired-x.el} revision 2 - -@c @item -@c Revision of this manual: 2.53 (2001/02/25 14:05:46) - -@c @item -@c Bugs to Lawrence R. Dodd . @emph{Please} type -@c @kbd{M-x dired-x-submit-report} to submit a bug report (@pxref{Bugs}). - -@c @item -@c You can obtain a copy of this package via anonymous ftp in -@c @t{/roebling.poly.edu:/pub/packages/dired-x.tar.gz} +For @file{dired-x.el} as distributed with GNU Emacs 23. @end itemize @@ -124,19 +109,11 @@ For @file{dired-x.el} revision 2 @end ifnottex @node Introduction, Installation, Top, Top -@comment node-name, next, previous, up @chapter Introduction -This documents the @emph{extra} features for Dired Mode for GNU Emacs. It -is derived from version 1.191 of Sebastian Kremer's @file{dired-x.el}. - -In adopting this @file{dired-x.el} to GNU Emacs v19 some material that has -been incorporated into @file{dired.el} and @file{dired-aux.el} of the GNU Emacs -19 distribution has been removed and some material was modified for agreement -with the functions in @file{dired.el} and @file{dired-aux.el}. For example, -the code using @code{gmhist} history functions was replaced with code using -the mini-buffer history now built into GNU Emacs. Finally, a few other -features have been added and a few more functions have been bound to keys. +This documents some @emph{extra} features for GNU Emacs's Dired Mode +that are provided by @file{dired-x.el} (derived from Sebastian Kremer's +original @file{dired-x.el}). @ifnottex @menu @@ -146,7 +123,6 @@ features have been added and a few more functions have been bound to keys. @end ifnottex @node Features, Technical Details, , Introduction -@comment node-name, next, previous, up @section Features @cindex Features @@ -194,7 +170,6 @@ C-f} and @kbd{C-x 4 C-f} to @code{dired-x-find-file} and Point}). @node Technical Details, , Features, Introduction -@comment node-name, next, previous, up @section Technical Details @cindex Redefined functions @cindex @file{dired-aux.el} @@ -222,7 +197,6 @@ and the following functions from @file{dired-aux.el} @end itemize @node Installation, Omitting Files in Dired, Introduction, Top -@comment node-name, next, previous, up @chapter Installation @noindent @@ -231,8 +205,8 @@ This manual describes the Dired features provided by the file file and (optionally) set some variables. @noindent -In your @file{.emacs} file in your home directory, or in the system-wide -initialization file @file{default.el} in the @file{site-lisp} directory, put +In your @file{~/.emacs} file, or in the system-wide initialization file +@file{default.el} in the @file{site-lisp} directory, put @example (add-hook 'dired-load-hook @@ -261,48 +235,27 @@ when you first type @kbd{C-x d}). @end ifnottex @node Optional Installation Dired Jump, Optional Installation File At Point, , Installation -@comment node-name, next, previous, up @section Optional Installation Dired Jump @cindex Autoloading @code{dired-jump} and @code{dired-jump-other-window} In order to have @code{dired-jump} and @code{dired-jump-other-window} (@pxref{Miscellaneous Commands}) work @emph{before} @code{dired} and -@code{dired-x} have been properly loaded the user should set-up an autoload +@code{dired-x} have been properly loaded you should set-up an autoload for these functions. In your @file{.emacs} file put @example -;; Autoload `dired-jump' and `dired-jump-other-window'. -;; We autoload from FILE dired.el. This will then load dired-x.el -;; and hence define `dired-jump' and `dired-jump-other-window'. +(autoload 'dired-jump "dired-x" + "Jump to Dired buffer corresponding to current buffer." t) + +(autoload 'dired-jump-other-window "dired-x" + "Like \\[dired-jump] (dired-jump) but in other window." t) + (define-key global-map "\C-x\C-j" 'dired-jump) (define-key global-map "\C-x4\C-j" 'dired-jump-other-window) - -(autoload (quote dired-jump) "dired" "\ -Jump to Dired buffer corresponding to current buffer. -If in a file, Dired the current directory and move to file's line. -If in Dired already, pop up a level and goto old directory's line. -In case the proper Dired file line cannot be found, refresh the Dired -buffer and try again." t nil) - -(autoload (quote dired-jump-other-window) "dired" "\ -Like \\[dired-jump] (dired-jump) but in other window." t nil) @end example -Note that in recent releases of GNU Emacs 19 (i.e., 19.25 or later) the file -@file{../lisp/loaddefs.el} of the Emacs distribution already contains the -proper auto-loading for @code{dired-jump} so you need only put - -@example -(define-key global-map "\C-x\C-j" 'dired-jump) -@end example - -@noindent -in your @file{.emacs} file in order to have @kbd{C-x C-j} work -before @code{dired} is loaded. - @node Optional Installation File At Point, , Optional Installation Dired Jump, Installation -@comment node-name, next, previous, up @section Optional Installation File At Point @cindex Binding @code{dired-x-find-file} @@ -335,7 +288,6 @@ loaded @end example @node Omitting Files in Dired, Local Variables, Installation, Top -@comment node-name, next, previous, up @chapter Omitting Files in Dired @cindex Omitting Files in Dired @@ -392,8 +344,6 @@ inside @code{dired-load-hook} (@pxref{Installation}) and then evaluate @end ifnottex @node Omitting Variables, Omitting Examples, , Omitting Files in Dired -@comment node-name, next, previous, up - @section Omitting Variables @cindex Customizing file omitting @@ -501,7 +451,6 @@ will show up again after reverting the buffer, unlike the others. @end table @node Omitting Examples, Omitting Technical, Omitting Variables, Omitting Files in Dired -@comment node-name, next, previous, up @section Examples of Omitting Various File Types @itemize @bullet @@ -555,7 +504,6 @@ in the @code{dired-load-hook} (@pxref{Installation}). @end itemize @node Omitting Technical, , Omitting Examples, Omitting Files in Dired -@comment node-name, next, previous, up @section Some Technical Details of Omitting Loading @file{dired-x.el} will install Dired Omit by putting @@ -563,8 +511,8 @@ Loading @file{dired-x.el} will install Dired Omit by putting call @code{dired-extra-startup}, which in turn calls @code{dired-omit-startup} in your @code{dired-mode-hook}. +@c FIXME does the standard dir-locals mechanism obsolete this? @node Local Variables, Shell Command Guessing, Omitting Files in Dired, Top -@comment node-name, next, previous, up @chapter Local Variables for Dired Directories @cindex Local Variables for Dired Directories @@ -633,7 +581,6 @@ Variables are hacked. @end table @node Shell Command Guessing, Virtual Dired, Local Variables, Top -@comment node-name, next, previous, up @chapter Shell Command Guessing @cindex Guessing shell commands for files. @@ -740,7 +687,6 @@ History list for commands that read dired-shell commands. @end table @node Virtual Dired, Advanced Mark Commands, Shell Command Guessing, Top -@comment node-name, next, previous, up @chapter Virtual Dired @cindex Virtual Dired @@ -782,7 +728,6 @@ The regexp is a bit more complicated than usual to exclude @file{.dired} local-variable files. @node Advanced Mark Commands, Multiple Dired Directories, Virtual Dired, Top -@comment node-name, next, previous, up @chapter Advanced Mark Commands @table @kbd @@ -829,8 +774,6 @@ Flag all files with a certain extension for deletion. A @samp{.} is @end ifnottex @node Advanced Cleaning Functions, Advanced Cleaning Variables, , Advanced Mark Commands -@comment node-name, next, previous, up - @section Advanced Cleaning Functions @table @code @@ -862,8 +805,6 @@ and @file{*.dvi} files for deletion. @end table @node Advanced Cleaning Variables, Special Marking Function, Advanced Cleaning Functions, Advanced Mark Commands -@comment node-name, next, previous, up - @section Advanced Cleaning Variables @noindent Variables used by the above cleaning commands (and in the default value for @@ -903,8 +844,6 @@ List of extensions of dispensable files created by Bib@TeX{}. @end table @node Special Marking Function, , Advanced Cleaning Variables, Advanced Mark Commands -@comment node-name, next, previous, up - @section Special Marking Function @table @kbd @@ -961,7 +900,6 @@ to mark all @file{.el} files without a corresponding @file{.elc} file. @end table @node Multiple Dired Directories, Find File At Point, Advanced Mark Commands, Top -@comment node-name, next, previous, up @chapter Multiple Dired Directories and Non-Dired Commands @cindex Multiple Dired directories @@ -994,8 +932,6 @@ also consults the variable @code{default-directory-alist}. @end table @node Find File At Point, Miscellaneous Commands, Multiple Dired Directories, Top -@comment node-name, next, previous, up - @section Find File At Point @cindex Visiting a file mentioned in a buffer @cindex Finding a file at point @@ -1072,7 +1008,6 @@ that uses the value of @code{dired-x-hands-off-my-keys} to determine if @end table @node Miscellaneous Commands, Bugs, Find File At Point, Top -@comment node-name, next, previous, up @chapter Miscellaneous Commands Miscellaneous features not fitting anywhere else: @@ -1210,50 +1145,30 @@ info. @end table @node Bugs, GNU Free Documentation License, Miscellaneous Commands, Top -@comment node-name, next, previous, up @chapter Bugs @cindex Bugs -@findex dired-x-submit-report @noindent -If you encounter a bug in this package, wish to suggest an -enhancement, or want to make a smart remark, then type - -@example -@kbd{M-x dired-x-submit-report} -@end example - -@noindent -to set up an outgoing mail buffer, with the proper address to the -@file{dired-x.el} maintainer automatically inserted in the @samp{To:@:} field. -This command also inserts information that the Dired X maintainer can use to -recreate your exact setup, making it easier to verify your bug or social -maladjustment. - -Lawrence R. Dodd -@c +If you encounter a bug in this package, or wish to suggest an +enhancement, then please use @kbd{M-x report-emacs-bug} to report it. @node GNU Free Documentation License, Concept Index, Bugs, Top @appendix GNU Free Documentation License @include doclicense.texi @node Concept Index, Command Index, GNU Free Documentation License, Top -@comment node-name, next, previous, up @unnumbered Concept Index @printindex cp @node Command Index, Key Index, Concept Index, Top -@comment node-name, next, previous, up @unnumbered Function Index @printindex fn @node Key Index, Variable Index, Command Index, Top -@comment node-name, next, previous, up @unnumbered Key Index @printindex ky @node Variable Index, , Key Index, Top -@comment node-name, next, previous, up @unnumbered Variable Index @printindex vr From 35a7fb0b751e71320b8dd749ac4d762bab372257 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Mon, 14 Feb 2011 17:56:38 -0500 Subject: [PATCH 03/46] Bind delete-by-moving-to-trash to nil in pgg-*.el. This change should not be merged into the trunk. * pgg-gpg.el (pgg-gpg-process-region): Bind delete-by-moving-to-trash to nil. * pgg-pgp.el (pgg-pgp-process-region, pgg-pgp-verify-region) (pgg-pgp-snarf-keys-region): * pgg-pgp5.el (pgg-pgp5-process-region, pgg-pgp5-verify-region) (pgg-pgp5-snarf-keys-region): Likewise. --- lisp/ChangeLog | 10 ++++++++++ lisp/pgg-gpg.el | 3 ++- lisp/pgg-pgp.el | 13 +++++++++---- lisp/pgg-pgp5.el | 13 +++++++++---- 4 files changed, 30 insertions(+), 9 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b77700491c7..9d8446cef10 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,13 @@ +2011-02-14 Chong Yidong + + * pgg-gpg.el (pgg-gpg-process-region): Bind + delete-by-moving-to-trash to nil. + + * pgg-pgp.el (pgg-pgp-process-region, pgg-pgp-verify-region) + (pgg-pgp-snarf-keys-region): + * pgg-pgp5.el (pgg-pgp5-process-region, pgg-pgp5-verify-region) + (pgg-pgp5-snarf-keys-region): Likewise. + 2011-02-12 Chong Yidong * files.el (copy-directory): Revert to pre-2011-01-29 version. diff --git a/lisp/pgg-gpg.el b/lisp/pgg-gpg.el index 2019f88bf15..0666b209aba 100644 --- a/lisp/pgg-gpg.el +++ b/lisp/pgg-gpg.el @@ -130,7 +130,8 @@ (if (and process (eq 'run (process-status process))) (interrupt-process process)) (if (file-exists-p output-file-name) - (delete-file output-file-name)) + (let ((delete-by-moving-to-trash nil)) + (delete-file output-file-name))) (set-default-file-modes orig-mode)))) (defun pgg-gpg-possibly-cache-passphrase (passphrase &optional key notruncate) diff --git a/lisp/pgg-pgp.el b/lisp/pgg-pgp.el index 42d91fb2b80..e36c1efb138 100644 --- a/lisp/pgg-pgp.el +++ b/lisp/pgg-pgp.el @@ -108,7 +108,8 @@ Bourne shell or its equivalent \(not tcsh) is needed for \"2>\"." (if (and process (eq 'run (process-status process))) (interrupt-process process)) (condition-case nil - (delete-file errors-file-name) + (let ((delete-by-moving-to-trash nil)) + (delete-file errors-file-name)) (file-error nil))))) (defun pgg-pgp-lookup-key (string &optional type) @@ -215,8 +216,11 @@ passphrase cache or user." (setq args (concat args " " (shell-quote-argument signature))))) (setq args (concat args " " (shell-quote-argument orig-file))) (pgg-pgp-process-region (point)(point) nil pgg-pgp-program args) - (delete-file orig-file) - (if signature (delete-file signature)) + (let ((delete-by-moving-to-trash nil)) + (delete-file orig-file)) + (if signature + (let ((delete-by-moving-to-trash nil)) + (delete-file signature))) (pgg-process-when-success (goto-char (point-min)) (let ((case-fold-search t)) @@ -248,7 +252,8 @@ passphrase cache or user." (let ((coding-system-for-write 'raw-text-dos)) (write-region start end key-file)) (pgg-pgp-process-region start end nil pgg-pgp-program args) - (delete-file key-file) + (let ((delete-by-moving-to-trash nil)) + (delete-file key-file)) (pgg-process-when-success nil))) (provide 'pgg-pgp) diff --git a/lisp/pgg-pgp5.el b/lisp/pgg-pgp5.el index d174e4873a9..baa0f95265d 100644 --- a/lisp/pgg-pgp5.el +++ b/lisp/pgg-pgp5.el @@ -124,7 +124,8 @@ Bourne shell or its equivalent \(not tcsh) is needed for \"2>\"." (if (and process (eq 'run (process-status process))) (interrupt-process process)) (condition-case nil - (delete-file errors-file-name) + (let ((delete-by-moving-to-trash nil)) + (delete-file errors-file-name)) (file-error nil))))) (defun pgg-pgp5-lookup-key (string &optional type) @@ -219,8 +220,11 @@ Bourne shell or its equivalent \(not tcsh) is needed for \"2>\"." (copy-file signature (setq signature (concat orig-file ".asc"))) (setq args (append args (list signature)))) (pgg-pgp5-process-region (point)(point) nil pgg-pgp5-pgpv-program args) - (delete-file orig-file) - (if signature (delete-file signature)) + (let ((delete-by-moving-to-trash nil)) + (delete-file orig-file)) + (if signature + (let ((delete-by-moving-to-trash nil)) + (delete-file signature))) (with-current-buffer pgg-errors-buffer (goto-char (point-min)) (if (re-search-forward "^Good signature" nil t) @@ -249,7 +253,8 @@ Bourne shell or its equivalent \(not tcsh) is needed for \"2>\"." (let ((coding-system-for-write 'raw-text-dos)) (write-region start end key-file)) (pgg-pgp5-process-region start end nil pgg-pgp5-pgpk-program args) - (delete-file key-file) + (let ((delete-by-moving-to-trash nil)) + (delete-file key-file)) (pgg-process-when-success nil))) (provide 'pgg-pgp5) From 4648b91b097ad9f3dfbd8a988846293ea5a5c78c Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Mon, 14 Feb 2011 23:01:16 -0500 Subject: [PATCH 04/46] Bump versio to 23.2.94. Regenerate release files. --- README | 2 +- configure | 18 +++++------ configure.in | 2 +- doc/emacs/emacs.texi | 2 +- doc/lispref/book-spine.texinfo | 2 +- doc/lispref/elisp.texi | 2 +- doc/lispref/vol1.texi | 2 +- doc/lispref/vol2.texi | 2 +- doc/man/emacs.1 | 2 +- doc/misc/faq.texi | 2 +- etc/AUTHORS | 16 +++++----- lib-src/makefile.w32-in | 2 +- lisp/ldefs-boot.el | 32 +++++++++---------- lisp/version.el | 2 +- nextstep/Cocoa/Emacs.base/Contents/Info.plist | 4 +-- .../Resources/English.lproj/InfoPlist.strings | 4 +-- .../Emacs.base/Resources/Emacs.desktop | 2 +- .../Emacs.base/Resources/Info-gnustep.plist | 4 +-- nt/emacs.rc | 8 ++--- nt/emacsclient.rc | 8 ++--- 20 files changed, 59 insertions(+), 59 deletions(-) diff --git a/README b/README index cfc7d0b8fd4..db6104b0e06 100644 --- a/README +++ b/README @@ -3,7 +3,7 @@ Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, See the end of the file for license conditions. -This directory tree holds version 23.2.93 of GNU Emacs, the extensible, +This directory tree holds version 23.2.94 of GNU Emacs, the extensible, customizable, self-documenting real-time display editor. The file INSTALL in this directory says how to build and install GNU diff --git a/configure b/configure index c0c1753cbc6..e87e7a184a6 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.67 for emacs 23.2.93. +# Generated by GNU Autoconf 2.67 for emacs 23.2.94. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -549,8 +549,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='emacs' PACKAGE_TARNAME='emacs' -PACKAGE_VERSION='23.2.93' -PACKAGE_STRING='emacs 23.2.93' +PACKAGE_VERSION='23.2.94' +PACKAGE_STRING='emacs 23.2.94' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1320,7 +1320,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures emacs 23.2.93 to adapt to many kinds of systems. +\`configure' configures emacs 23.2.94 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1394,7 +1394,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of emacs 23.2.93:";; + short | recursive ) echo "Configuration of emacs 23.2.94:";; esac cat <<\_ACEOF @@ -1540,7 +1540,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -emacs configure 23.2.93 +emacs configure 23.2.94 generated by GNU Autoconf 2.67 Copyright (C) 2010 Free Software Foundation, Inc. @@ -2091,7 +2091,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by emacs $as_me 23.2.93, which was +It was created by emacs $as_me 23.2.94, which was generated by GNU Autoconf 2.67. Invocation command line was $ $0 $@ @@ -14056,7 +14056,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by emacs $as_me 23.2.93, which was +This file was extended by emacs $as_me 23.2.94, which was generated by GNU Autoconf 2.67. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14122,7 +14122,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -emacs config.status 23.2.93 +emacs config.status 23.2.94 configured by $0, generated by GNU Autoconf 2.67, with options \\"\$ac_cs_config\\" diff --git a/configure.in b/configure.in index 3bb678284e3..a89d6d596de 100644 --- a/configure.in +++ b/configure.in @@ -22,7 +22,7 @@ dnl You should have received a copy of the GNU General Public License dnl along with GNU Emacs. If not, see . AC_PREREQ(2.62) -AC_INIT(emacs, 23.2.93) +AC_INIT(emacs, 23.2.94) AC_CONFIG_HEADER(src/config.h:src/config.in) AC_CONFIG_SRCDIR(src/lisp.h) diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi index 5332083cbfb..ec2d00e3c31 100644 --- a/doc/emacs/emacs.texi +++ b/doc/emacs/emacs.texi @@ -5,7 +5,7 @@ @c The edition number appears in several places in this file @set EDITION Sixteenth -@set EMACSVER 23.2.93 +@set EMACSVER 23.2.94 @copying This is the @value{EDITION} edition of the @cite{GNU Emacs Manual},@* diff --git a/doc/lispref/book-spine.texinfo b/doc/lispref/book-spine.texinfo index 8b4615a89a6..9a6f549dc49 100644 --- a/doc/lispref/book-spine.texinfo +++ b/doc/lispref/book-spine.texinfo @@ -11,7 +11,7 @@ @center @titlefont{GNU Emacs Lisp Reference Manual} @sp 5 @center GNU -@center Emacs Version 23.2.93 +@center Emacs Version 23.2.94 @center for Unix Users @sp 5 diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi index b33c9ae55cf..aef8229e4b4 100644 --- a/doc/lispref/elisp.texi +++ b/doc/lispref/elisp.texi @@ -8,7 +8,7 @@ @c Please remember to update the edition number in README as well. @c And also the copies in vol1.texi and vol2.texi. @set VERSION 3.0 -@set EMACSVER 23.2.93 +@set EMACSVER 23.2.94 @set DATE July 2009 @c in general, keep the following line commented out, unless doing a diff --git a/doc/lispref/vol1.texi b/doc/lispref/vol1.texi index 6a62e9b0dc5..9d6bb7da68c 100644 --- a/doc/lispref/vol1.texi +++ b/doc/lispref/vol1.texi @@ -27,7 +27,7 @@ @c Version of the manual and of Emacs. @c Please remember to update the edition number in README as well. @set VERSION 3.0 -@set EMACSVER 23.2.93 +@set EMACSVER 23.2.94 @set DATE July 2009 @dircategory Emacs diff --git a/doc/lispref/vol2.texi b/doc/lispref/vol2.texi index e872ccefa7b..18027ee362f 100644 --- a/doc/lispref/vol2.texi +++ b/doc/lispref/vol2.texi @@ -27,7 +27,7 @@ @c Version of the manual and of Emacs. @c Please remember to update the edition number in README as well. @set VERSION 3.0 -@set EMACSVER 23.2.93 +@set EMACSVER 23.2.94 @set DATE July 2009 @dircategory Emacs diff --git a/doc/man/emacs.1 b/doc/man/emacs.1 index 91e8042e0e7..8f01e4a2165 100644 --- a/doc/man/emacs.1 +++ b/doc/man/emacs.1 @@ -1,5 +1,5 @@ .\" See section COPYING for copyright and redistribution information. -.TH EMACS 1 "2007 April 13" "GNU Emacs 23.2.93" +.TH EMACS 1 "2007 April 13" "GNU Emacs 23.2.94" . . .SH NAME diff --git a/doc/misc/faq.texi b/doc/misc/faq.texi index 7c0f7629799..adacecbabd1 100644 --- a/doc/misc/faq.texi +++ b/doc/misc/faq.texi @@ -5,7 +5,7 @@ @c %**end of header @c This is used in many places -@set VER 23.2.93 +@set VER 23.2.94 @c This file is maintained by Romain Francoise . @c Feel free to install changes without prior permission (but I'd diff --git a/etc/AUTHORS b/etc/AUTHORS index 6f691bc490c..ad9142931a6 100644 --- a/etc/AUTHORS +++ b/etc/AUTHORS @@ -169,7 +169,7 @@ Andreas Politz: changed editfns.c elp.el ido.el term.el Andreas Schwab: changed Makefile.in configure.in lisp.h xdisp.c files.el coding.c alloc.c process.c fileio.c print.c editfns.c fns.c dired.el - keyboard.c xterm.c eval.c simple.el info.el buffer.c sysdep.c emacs.c + keyboard.c xterm.c eval.c simple.el info.el buffer.c sysdep.c window.c and 490 other files Andreas Seltenreich: changed nnweb.el gnus.texi message.el gnus.el @@ -442,7 +442,7 @@ and co-wrote longlines.el and changed xdisp.c simple.el files.el display.texi files.texi frames.texi emacs.texi xterm.c keyboard.c cus-edit.el faces.el Makefile.in font.c xfaces.c image.c misc.texi xfns.c startup.el - text.texi compile.el configure.in and 660 other files + text.texi compile.el configure.in and 664 other files Chris Chase: co-wrote idlw-shell.el idlwave.el @@ -882,8 +882,8 @@ Eli Tziperman: wrote rmail-spam-filter.el Eli Zaretskii: wrote rxvt.el tty-colors.el and changed msdos.c makefile.w32-in Makefile.in files.el info.el fileio.c rmail.el mainmake.v2 pc-win.el simple.el startup.el config.bat msdos.h - w32.c dired.c frame.c menu-bar.el process.c INSTALL internal.el - files.texi and 605 other files + w32.c dired.c frame.c menu-bar.el process.c INSTALL internal.el xdisp.c + and 606 other files Elias Oltmanns: changed tls.el gnus-agent.el gnus-int.el gnus-srvr.el gnus.el @@ -1150,7 +1150,7 @@ Glenn Morris: wrote check-declare.el and changed Makefile.in calendar.el diary-lib.el rmail.el f90.el cal-menu.el cal-hebrew.el fortran.el holidays.el configure.in calendar.texi cal-islam.el bytecomp.el cal-bahai.el appt.el emacs.texi - files.el cal-china.el rmailsum.el simple.el cal-tex.el + files.el cal-china.el simple.el rmailsum.el cal-tex.el and 1012 other files Glynn Clements: wrote gamegrid.el snake.el tetris.el @@ -1806,7 +1806,7 @@ Kenichi Handa: wrote composite.el cyrillic.el isearch-x.el ps-bdf.el and co-wrote ps-def.el ps-mule.el ps-print.el ps-samp.el quail.el and changed coding.c mule-cmds.el mule.el fontset.c charset.c fontset.el xdisp.c xterm.c font.c fileio.c Makefile.in mule-conf.el characters.el - fns.c mule-diag.el charset.h ftfont.c ccl.c coding.h xfaces.c + fns.c mule-diag.el ftfont.c charset.h ccl.c coding.h xfaces.c japanese.el and 380 other files Kenichi Okada: co-wrote sasl-cram.el sasl-digest.el @@ -3164,7 +3164,7 @@ and changed ewoc.el vc.el zone.el info.el Makefile.in processes.texi Thierry Emery: changed kinsoku.el timezone.el url-http.el wid-edit.el -Thierry Volpiatto: changed bookmark.el info.el +Thierry Volpiatto: changed bookmark.el files.el info.el Thomas Baumann: wrote org-mhe.el and co-wrote org-bbdb.el @@ -3302,7 +3302,7 @@ Ulrich Leodolter: changed w32proc.c Ulrich Mueller: changed configure.in Makefile.in files.el gud.el server.el ChgPane.c ChgSel.c HELLO INSTALL XMakeAssoc.c authors.el bytecomp.el calc-units.el case-table.el configure doctor.el emacs.1 - emacs.c emacs.desktop emacsclient.c fortran.el and 14 other files + emacs.c emacs.desktop emacsclient.c fortran.el and 15 other files Ulrich Neumerkel: changed xterm.c diff --git a/lib-src/makefile.w32-in b/lib-src/makefile.w32-in index c7d58b9780c..139fd64406c 100644 --- a/lib-src/makefile.w32-in +++ b/lib-src/makefile.w32-in @@ -22,7 +22,7 @@ ALL = make-docfile hexl ctags etags movemail ebrowse sorted-doc digest-doc emacs .PHONY: $(ALL) -VERSION = 23.2.93 +VERSION = 23.2.94 LOCAL_FLAGS = -DWINDOWSNT -DDOS_NT -DSTDC_HEADERS=1 -DNO_LDAV=1 \ -DNO_ARCHIVES=1 -DHAVE_CONFIG_H=1 -I../nt/inc \ diff --git a/lisp/ldefs-boot.el b/lisp/ldefs-boot.el index f2e5ee7a79e..0e3564d9664 100644 --- a/lisp/ldefs-boot.el +++ b/lisp/ldefs-boot.el @@ -2602,7 +2602,7 @@ Like `bug-reference-mode', but only buttonize in comments and strings. ;;;;;; batch-byte-compile-if-not-done display-call-tree byte-compile ;;;;;; compile-defun byte-compile-file byte-recompile-directory ;;;;;; byte-force-recompile byte-compile-enable-warning byte-compile-disable-warning) -;;;;;; "bytecomp" "emacs-lisp/bytecomp.el" (19752 41642)) +;;;;;; "bytecomp" "emacs-lisp/bytecomp.el" (19800 50267)) ;;; Generated autoloads from emacs-lisp/bytecomp.el (put 'byte-compile-dynamic 'safe-local-variable 'booleanp) (put 'byte-compile-disable-print-circle 'safe-local-variable 'booleanp) @@ -2961,7 +2961,7 @@ Obsoletes `c-forward-into-nomenclature'. ;;;*** ;;;### (autoloads (c-guess-basic-syntax) "cc-engine" "progmodes/cc-engine.el" -;;;;;; (19776 49463)) +;;;;;; (19800 14993)) ;;; Generated autoloads from progmodes/cc-engine.el (autoload 'c-guess-basic-syntax "cc-engine" "\ @@ -3493,7 +3493,7 @@ Returns non-nil if any false statements are found. ;;;;;; checkdoc-comments checkdoc-continue checkdoc-start checkdoc-current-buffer ;;;;;; checkdoc-eval-current-buffer checkdoc-message-interactive ;;;;;; checkdoc-interactive checkdoc checkdoc-list-of-strings-p) -;;;;;; "checkdoc" "emacs-lisp/checkdoc.el" (19770 11773)) +;;;;;; "checkdoc" "emacs-lisp/checkdoc.el" (19798 54314)) ;;; Generated autoloads from emacs-lisp/checkdoc.el (put 'checkdoc-force-docstrings-flag 'safe-local-variable 'booleanp) (put 'checkdoc-force-history-flag 'safe-local-variable 'booleanp) @@ -4794,7 +4794,7 @@ Major mode to edit Cascading Style Sheets. ;;;*** ;;;### (autoloads (cua-selection-mode cua-mode) "cua-base" "emulation/cua-base.el" -;;;;;; (19752 41642)) +;;;;;; (19798 54314)) ;;; Generated autoloads from emulation/cua-base.el (defvar cua-mode nil "\ @@ -5938,7 +5938,7 @@ Deuglify broken Outlook (Express) articles and redisplay. ;;;*** ;;;### (autoloads (diary-mode diary-mail-entries diary) "diary-lib" -;;;;;; "calendar/diary-lib.el" (19752 41642)) +;;;;;; "calendar/diary-lib.el" (19788 46601)) ;;; Generated autoloads from calendar/diary-lib.el (autoload 'diary "diary-lib" "\ @@ -7592,7 +7592,7 @@ Not documented ;;;*** ;;;### (autoloads (ediff-show-registry) "ediff-mult" "ediff-mult.el" -;;;;;; (19752 41642)) +;;;;;; (19798 54314)) ;;; Generated autoloads from ediff-mult.el (autoload 'ediff-show-registry "ediff-mult" "\ @@ -8178,7 +8178,7 @@ Encrypt marked files. ;;;*** ;;;### (autoloads (epa-file-disable epa-file-enable epa-file-handler) -;;;;;; "epa-file" "epa-file.el" (19752 41642)) +;;;;;; "epa-file" "epa-file.el" (19797 53811)) ;;; Generated autoloads from epa-file.el (autoload 'epa-file-handler "epa-file" "\ @@ -8264,7 +8264,7 @@ Minor mode to hook EasyPG into Mail mode. ;;;*** -;;;### (autoloads (epg-make-context) "epg" "epg.el" (19752 41642)) +;;;### (autoloads (epg-make-context) "epg" "epg.el" (19797 53798)) ;;; Generated autoloads from epg.el (autoload 'epg-make-context "epg" "\ @@ -9572,7 +9572,7 @@ This is used only in conjunction with `expand-add-abbrevs'. ;;;*** -;;;### (autoloads (f90-mode) "f90" "progmodes/f90.el" (19752 41642)) +;;;### (autoloads (f90-mode) "f90" "progmodes/f90.el" (19788 46601)) ;;; Generated autoloads from progmodes/f90.el (autoload 'f90-mode "f90" "\ @@ -13368,7 +13368,7 @@ bound to the current value of the filter. ;;;*** ;;;### (autoloads (ibuffer ibuffer-other-window ibuffer-list-buffers) -;;;;;; "ibuffer" "ibuffer.el" (19752 41900)) +;;;;;; "ibuffer" "ibuffer.el" (19789 64363)) ;;; Generated autoloads from ibuffer.el (autoload 'ibuffer-list-buffers "ibuffer" "\ @@ -20365,8 +20365,8 @@ Includes files as well as host names followed by a colon. ;;;### (autoloads (pcomplete-shell-setup pcomplete-comint-setup pcomplete-list ;;;;;; pcomplete-help pcomplete-expand pcomplete-continue pcomplete-expand-and-complete -;;;;;; pcomplete-reverse pcomplete) "pcomplete" "pcomplete.el" (19752 -;;;;;; 41642)) +;;;;;; pcomplete-reverse pcomplete) "pcomplete" "pcomplete.el" (19786 +;;;;;; 56078)) ;;; Generated autoloads from pcomplete.el (autoload 'pcomplete "pcomplete" "\ @@ -20706,7 +20706,7 @@ Import public keys in the current buffer. ;;;*** ;;;### (autoloads (pgg-gpg-symmetric-key-p) "pgg-gpg" "pgg-gpg.el" -;;;;;; (19752 41642)) +;;;;;; (19801 45655)) ;;; Generated autoloads from pgg-gpg.el (autoload 'pgg-gpg-symmetric-key-p "pgg-gpg" "\ @@ -22566,7 +22566,7 @@ With no argument, this command toggles ;;;*** ;;;### (autoloads (reftex-index-phrases-mode) "reftex-index" "textmodes/reftex-index.el" -;;;;;; (19752 41642)) +;;;;;; (19798 54314)) ;;; Generated autoloads from textmodes/reftex-index.el (autoload 'reftex-index-phrases-mode "reftex-index" "\ @@ -32014,8 +32014,8 @@ Zone out, completely. ;;;;;; "url/url-expand.el" "url/url-ftp.el" "url/url-history.el" ;;;;;; "url/url-imap.el" "url/url-methods.el" "url/url-nfs.el" "url/url-proxy.el" ;;;;;; "url/url-vars.el" "vc-dav.el" "vcursor.el" "vt-control.el" -;;;;;; "vt100-led.el" "w32-fns.el" "w32-vars.el" "x-dnd.el") (19783 -;;;;;; 30333 273722)) +;;;;;; "vt100-led.el" "w32-fns.el" "w32-vars.el" "x-dnd.el") (19801 +;;;;;; 62231 520663)) ;;;*** diff --git a/lisp/version.el b/lisp/version.el index 189d0f922ab..aa5016960cb 100644 --- a/lisp/version.el +++ b/lisp/version.el @@ -32,7 +32,7 @@ (defconst emacs-copyright "Copyright (C) 2011 Free Software Foundation, Inc." "\ Short copyright string for this version of Emacs.") -(defconst emacs-version "23.2.93" "\ +(defconst emacs-version "23.2.94" "\ Version numbers of this version of Emacs.") (defconst emacs-major-version (progn (string-match "^[0-9]+" emacs-version) (string-to-number (match-string 0 emacs-version))) "\ diff --git a/nextstep/Cocoa/Emacs.base/Contents/Info.plist b/nextstep/Cocoa/Emacs.base/Contents/Info.plist index 1d37957d878..6ed6a9a2359 100644 --- a/nextstep/Cocoa/Emacs.base/Contents/Info.plist +++ b/nextstep/Cocoa/Emacs.base/Contents/Info.plist @@ -553,7 +553,7 @@ along with GNU Emacs. If not, see . CFBundleExecutable Emacs CFBundleGetInfoString - Emacs 23.2.93 Copyright (C) 2011 Free Software Foundation, Inc. + Emacs 23.2.94 Copyright (C) 2011 Free Software Foundation, Inc. CFBundleIconFile Emacs.icns CFBundleIdentifier @@ -566,7 +566,7 @@ along with GNU Emacs. If not, see . APPL CFBundleShortVersionString - 23.2.93 + 23.2.94 CFBundleSignature EMAx diff --git a/nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings b/nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings index 6e892f08609..02ad5911e8d 100644 --- a/nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings +++ b/nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings @@ -1,6 +1,6 @@ /* Localized versions of Info.plist keys */ CFBundleName = "Emacs"; -CFBundleShortVersionString = "Version 23.2.93"; -CFBundleGetInfoString = "Emacs version 23.2.93, NS Windowing"; +CFBundleShortVersionString = "Version 23.2.94"; +CFBundleGetInfoString = "Emacs version 23.2.94, NS Windowing"; NSHumanReadableCopyright = "Copyright (C) 2011 Free Software Foundation, Inc."; diff --git a/nextstep/GNUstep/Emacs.base/Resources/Emacs.desktop b/nextstep/GNUstep/Emacs.base/Resources/Emacs.desktop index f846f635fec..cf38bab8282 100644 --- a/nextstep/GNUstep/Emacs.base/Resources/Emacs.desktop +++ b/nextstep/GNUstep/Emacs.base/Resources/Emacs.desktop @@ -1,7 +1,7 @@ [Desktop Entry] Encoding=UTF-8 Type=Application -Version=23.2.93 +Version=23.2.94 Categories=GNUstep Name=Emacs Comment=GNU Emacs for NeXT/Open/GNUstep and OS X diff --git a/nextstep/GNUstep/Emacs.base/Resources/Info-gnustep.plist b/nextstep/GNUstep/Emacs.base/Resources/Info-gnustep.plist index d66de209b7f..45472835d85 100644 --- a/nextstep/GNUstep/Emacs.base/Resources/Info-gnustep.plist +++ b/nextstep/GNUstep/Emacs.base/Resources/Info-gnustep.plist @@ -2,7 +2,7 @@ ApplicationDescription = "GNU Emacs for GNUstep / OS X"; ApplicationIcon = emacs.tiff; ApplicationName = Emacs; - ApplicationRelease = "23.2.93"; + ApplicationRelease = "23.2.94"; Authors = ( "Adrian Robert (GNUstep)", "Christophe de Dinechin (MacOS X)", @@ -13,7 +13,7 @@ ); Copyright = "Copyright (C) 2011 Free Software Foundation, Inc."; CopyrightDescription = "Released under the GNU General Public License Version 3 or later"; - FullVersionID = "Emacs 23.2.93, NS Windowing"; + FullVersionID = "Emacs 23.2.94, NS Windowing"; NSExecutable = Emacs; NSIcon = emacs.tiff; NSPrincipalClass = NSApplication; diff --git a/nt/emacs.rc b/nt/emacs.rc index 0fd0b491be5..d370bff1633 100644 --- a/nt/emacs.rc +++ b/nt/emacs.rc @@ -7,8 +7,8 @@ Emacs ICON icons\emacs.ico #endif VS_VERSION_INFO VERSIONINFO - FILEVERSION 23,2,93,0 - PRODUCTVERSION 23,2,93,0 + FILEVERSION 23,2,94,0 + PRODUCTVERSION 23,2,94,0 FILEFLAGSMASK 0x3FL #ifdef EMACSDEBUG FILEFLAGS 0x1L @@ -25,12 +25,12 @@ BEGIN BEGIN VALUE "CompanyName", "Free Software Foundation\0" VALUE "FileDescription", "GNU Emacs: The extensible self-documenting text editor\0" - VALUE "FileVersion", "23, 2, 93, 0\0" + VALUE "FileVersion", "23, 2, 94, 0\0" VALUE "InternalName", "Emacs\0" VALUE "LegalCopyright", "Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011\0" VALUE "OriginalFilename", "emacs.exe" VALUE "ProductName", "Emacs\0" - VALUE "ProductVersion", "23, 2, 93, 0\0" + VALUE "ProductVersion", "23, 2, 94, 0\0" VALUE "OLESelfRegister", "\0" END END diff --git a/nt/emacsclient.rc b/nt/emacsclient.rc index 0cfd3cac1b1..fc1e6b12b2b 100644 --- a/nt/emacsclient.rc +++ b/nt/emacsclient.rc @@ -5,8 +5,8 @@ Emacs ICON icons\emacs.ico #endif VS_VERSION_INFO VERSIONINFO - FILEVERSION 23,2,93,0 - PRODUCTVERSION 23,2,93,0 + FILEVERSION 23,2,94,0 + PRODUCTVERSION 23,2,94,0 FILEFLAGSMASK 0x3FL #ifdef EMACSDEBUG FILEFLAGS 0x1L @@ -23,12 +23,12 @@ BEGIN BEGIN VALUE "CompanyName", "Free Software Foundation\0" VALUE "FileDescription", "GNU EmacsClient: Client for the extensible self-documenting text editor\0" - VALUE "FileVersion", "23, 2, 93, 0\0" + VALUE "FileVersion", "23, 2, 94, 0\0" VALUE "InternalName", "EmacsClient\0" VALUE "LegalCopyright", "Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011\0" VALUE "OriginalFilename", "emacsclientw.exe" VALUE "ProductName", "EmacsClient\0" - VALUE "ProductVersion", "23, 2, 93, 0\0" + VALUE "ProductVersion", "23, 2, 94, 0\0" VALUE "OLESelfRegister", "\0" END END From da5e0ce4d6e000b1bc493cb20ce0cc9ecb1ba244 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 16 Feb 2011 00:32:30 -0800 Subject: [PATCH 05/46] More dired-x cleanup. * lisp/dired-x.el (dired-bind-jump, dired-bind-man, dired-bind-info): Doc fixes. Add :set property, replacing top-level calls. (dired-vm-read-only-folders, dired-vm): Doc fix (drop v. old VM 4). (dired-guess-shell-gnutar): Test tar version rather than system-type. (dired-extra-startup, dired-man, dired-info): Doc fixes. (dired-clean-up-after-deletion): Use when and dolist. (dired-jump): Use unless and when. (dired-virtual): Use line-end-position. (dired-default-directory-alist): Rename from default-directory-alist. (dired-default-directory): Update for above name change. (dired-vm): Drop VM < 5 and simplify. (dired-buffer-more-recently-used-p): Rewrite. (dired-filename-at-point): Use when and or. (dired-x-read-filename-at-point): Rename from read-filename-at-point. Update callers. * doc/misc/dired-x.texi (Multiple Dired Directories): Update for rename of default-directory-alist. (Miscellaneous Commands): No longer mention very old VM version 4. --- doc/misc/ChangeLog | 9 +- doc/misc/dired-x.texi | 15 ++-- lisp/ChangeLog | 18 ++++ lisp/dired-x.el | 204 ++++++++++++++++++++---------------------- 4 files changed, 130 insertions(+), 116 deletions(-) diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 34096144066..fe589bb6fdd 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,3 +1,9 @@ +2011-02-16 Glenn Morris + + * dired-x.texi (Multiple Dired Directories): Update for rename of + default-directory-alist. + (Miscellaneous Commands): No longer mention very old VM version 4. + 2011-02-15 Paul Eggert Merge from gnulib. @@ -5,7 +11,8 @@ 2011-02-14 Teodor Zlatanov - * auth.texi (Help for users): Login collection is "Login" and not "login". + * auth.texi (Help for users): + Login collection is "Login" and not "login". 2011-02-13 Michael Albinus diff --git a/doc/misc/dired-x.texi b/doc/misc/dired-x.texi index 9ae569c151c..a1e7e0ae9fc 100644 --- a/doc/misc/dired-x.texi +++ b/doc/misc/dired-x.texi @@ -978,8 +978,8 @@ A general mechanism is provided for special handling of the working directory in special major modes: @table @code -@item default-directory-alist -@vindex default-directory-alist +@item dired-default-directory-alist +@vindex dired-default-directory-alist Default: @code{((dired-mode . (dired-current-directory)))} Alist of major modes and their notion of @code{default-directory}, as a @@ -990,7 +990,7 @@ in favor of @code{default-directory}. @findex dired-default-directory Use this function like you would use the variable @code{default-directory}, except that @code{dired-default-directory} -also consults the variable @code{default-directory-alist}. +also consults the variable @code{dired-default-directory-alist}. @end table @node Find File At Point, Miscellaneous Commands, Multiple Dired Directories, Top @@ -1141,13 +1141,12 @@ file (assumed to be a UNIX mail folder). @vindex dired-vm-read-only-folders If you give this command a prefix argument, it will visit the folder -read-only. This only works in VM 5, not VM 4. +read-only. If the variable @code{dired-vm-read-only-folders} is @code{t}, -@code{dired-vm} will -visit all folders read-only. If it is neither @code{nil} nor @code{t}, e.g., -the symbol @code{if-file-read-only}, only files not writable by you are -visited read-only. This is the recommended value if you run VM 5. +@code{dired-vm} will visit all folders read-only. If it is neither +@code{nil} nor @code{t}, e.g., the symbol @code{if-file-read-only}, only +files not writable by you are visited read-only. @vindex dired-bind-vm If the variable @code{dired-bind-vm} is @code{t}, @code{dired-vm} will be bound diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a9adce5a3f5..10ca65a55a9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,21 @@ +2011-02-16 Glenn Morris + + * dired-x.el (dired-bind-jump, dired-bind-man, dired-bind-info): + Doc fixes. Add :set property, replacing top-level calls. + (dired-vm-read-only-folders, dired-vm): Doc fix (drop v. old VM 4). + (dired-guess-shell-gnutar): Test tar version rather than system-type. + (dired-extra-startup, dired-man, dired-info): Doc fixes. + (dired-clean-up-after-deletion): Use when and dolist. + (dired-jump): Use unless and when. + (dired-virtual): Use line-end-position. + (dired-default-directory-alist): Rename from default-directory-alist. + (dired-default-directory): Update for above name change. + (dired-vm): Drop VM < 5 and simplify. + (dired-buffer-more-recently-used-p): Rewrite. + (dired-filename-at-point): Use when and or. + (dired-x-read-filename-at-point): Rename from read-filename-at-point. + Update callers. + 2011-02-15 Glenn Morris * dired-x.el: Use easymenu for menu items. Fix item capitalization. diff --git a/lisp/dired-x.el b/lisp/dired-x.el index 95381ccdc0c..fa064898ed4 100644 --- a/lisp/dired-x.el +++ b/lisp/dired-x.el @@ -32,7 +32,7 @@ ;; ;; (add-hook 'dired-load-hook ;; (lambda () -;; (require 'dired-x) +;; (load "dired-x") ;; ;; Set global variables here. For example: ;; ;; (setq dired-guess-shell-gnutar "gtar") ;; )) @@ -79,7 +79,6 @@ (defcustom dired-bind-vm nil "Non-nil means \"V\" runs `dired-vm', otherwise \"V\" runs `dired-rmail'. - RMAIL files in the old Babyl format (used before before Emacs 23.1) contain \"-*- rmail -*-\" at the top, so `dired-find-file' will run `rmail' on these files. New RMAIL files use the standard @@ -88,26 +87,49 @@ mbox format, and so cannot be distinguished in this way." :group 'dired-keys) (defcustom dired-bind-jump t - "Non-nil means bind `dired-jump' to C-x C-j, otherwise do not." + "Non-nil means bind `dired-jump' to C-x C-j, otherwise do not. +Setting this variable directly after dired-x is loaded has no effect - +use \\[customize]." :type 'boolean + :set (lambda (sym val) + (if (set sym val) + (progn + (define-key global-map "\C-x\C-j" 'dired-jump) + (define-key global-map "\C-x4\C-j" 'dired-jump-other-window)) + (if (eq 'dired-jump (lookup-key global-map "\C-x\C-j")) + (define-key global-map "\C-x\C-j" nil)) + (if (eq 'dired-jump-other-window (lookup-key global-map "\C-x4\C-j")) + (define-key global-map "\C-x4\C-j" nil)))) :group 'dired-keys) (defcustom dired-bind-man t - "Non-nil means bind `dired-man' to \"N\" in dired-mode, otherwise do not." + "Non-nil means bind `dired-man' to \"N\" in dired-mode, otherwise do not. +Setting this variable directly after dired-x is loaded has no effect - +use \\[customize]." :type 'boolean + :set (lambda (sym val) + (if (set sym val) + (define-key dired-mode-map "N" 'dired-man) + (if (eq 'dired-man (lookup-key dired-mode-map "N")) + (define-key dired-mode-map "N" nil)))) :group 'dired-keys) (defcustom dired-bind-info t - "Non-nil means bind `dired-info' to \"I\" in dired-mode, otherwise do not." + "Non-nil means bind `dired-info' to \"I\" in dired-mode, otherwise do not. +Setting this variable directly after dired-x is loaded has no effect - +use \\[customize]." :type 'boolean + :set (lambda (sym val) + (if (set sym val) + (define-key dired-mode-map "I" 'dired-info) + (if (eq 'dired-info (lookup-key dired-mode-map "I")) + (define-key dired-mode-map "I" nil)))) :group 'dired-keys) (defcustom dired-vm-read-only-folders nil "If non-nil, \\[dired-vm] will visit all folders read-only. If neither nil nor t, e.g. the symbol `if-file-read-only', only -files not writable by you are visited read-only. - -Read-only folders only work in VM 5, not in VM 4." +files not writable by you are visited read-only." :type '(choice (const :tag "off" nil) (const :tag "on" t) (other :tag "non-writable only" if-file-read-only)) @@ -181,13 +203,20 @@ listing a directory. See also `dired-local-variables-file'." :type 'boolean :group 'dired-x) -(defcustom dired-guess-shell-gnutar (when (or (eq system-type 'gnu) - (eq system-type 'gnu/linux)) - "tar") +(defcustom dired-guess-shell-gnutar + (catch 'found + (dolist (exe '("tar" "gtar")) + (if (with-temp-buffer + (ignore-errors (call-process exe nil t nil "--version")) + (and (re-search-backward "GNU tar" nil t) t)) + (throw 'found exe)))) "If non-nil, name of GNU tar executable. \(E.g., \"tar\" or \"gtar\"). The `z' switch will be used with it for compressed or gzip'ed tar files. If you don't have GNU tar, set this to nil: a pipe using `zcat' or `gunzip -c' will be used." + ;; Changed from system-type test to testing --version output. + ;; Maybe test --help for -z instead? + :version "24.1" :type '(choice (const :tag "Not GNU tar" nil) (string :tag "Command name")) :group 'dired-x) @@ -223,12 +252,6 @@ to nil: a pipe using `zcat' or `gunzip -c' will be used." (define-key dired-mode-map "%Y" 'dired-do-relsymlink-regexp) (define-key dired-mode-map "V" 'dired-do-run-mail) -(if dired-bind-man - (define-key dired-mode-map "N" 'dired-man)) - -(if dired-bind-info - (define-key dired-mode-map "I" 'dired-info)) - ;;; MENU BINDINGS (require 'easymenu) @@ -270,11 +293,6 @@ matching regexp"] files"] "Refresh")) -;;; GLOBAL BINDING. -(when dired-bind-jump - (define-key global-map "\C-x\C-j" 'dired-jump) - (define-key global-map "\C-x4\C-j" 'dired-jump-other-window)) - ;; Install into appropriate hooks. @@ -293,28 +311,8 @@ files"] \\[dired-copy-filename-as-kill]\t-- copy the file or subdir names into the kill ring; \t you can feed it to other commands using \\[yank] -For more features, see variables - - `dired-bind-vm' - `dired-bind-jump' - `dired-bind-info' - `dired-bind-man' - `dired-vm-read-only-folders' - `dired-omit-mode' - `dired-omit-files' - `dired-omit-extensions' - `dired-omit-size-limit' - `dired-find-subdir' - `dired-enable-local-variables' - `dired-local-variables-file' - `dired-guess-shell-gnutar' - `dired-guess-shell-gzip-quiet' - `dired-guess-shell-znew-switches' - `dired-guess-shell-alist-user' - `dired-clean-up-buffers-too' - -See also functions - +To see the options you can set, use M-x customize-group RET dired-x RET. +See also the functions: `dired-flag-extension' `dired-virtual' `dired-jump' @@ -339,26 +337,22 @@ Remove expanded subdir of deleted dir, if any." (save-excursion (and (cdr dired-subdir-alist) (dired-goto-subdir fn) (dired-kill-subdir))) - ;; Offer to kill buffer of deleted file FN. - (if dired-clean-up-buffers-too - (progn - (let ((buf (get-file-buffer fn))) - (and buf - (funcall (function y-or-n-p) - (format "Kill buffer of %s, too? " - (file-name-nondirectory fn))) - (save-excursion ; you never know where kill-buffer leaves you - (kill-buffer buf)))) - (let ((buf-list (dired-buffers-for-dir (expand-file-name fn))) - (buf nil)) - (and buf-list - (y-or-n-p (format "Kill dired buffer%s of %s, too? " - (dired-plural-s (length buf-list)) - (file-name-nondirectory fn))) - (while buf-list - (save-excursion (kill-buffer (car buf-list))) - (setq buf-list (cdr buf-list))))))) + (when dired-clean-up-buffers-too + (let ((buf (get-file-buffer fn))) + (and buf + (funcall (function y-or-n-p) + (format "Kill buffer of %s, too? " + (file-name-nondirectory fn))) + (save-excursion ; you never know where kill-buffer leaves you + (kill-buffer buf)))) + (let ((buf-list (dired-buffers-for-dir (expand-file-name fn)))) + (and buf-list + (y-or-n-p (format "Kill dired buffer%s of %s, too? " + (dired-plural-s (length buf-list)) + (file-name-nondirectory fn))) + (dolist (buf buf-list) + (save-excursion (kill-buffer buf)))))) ;; Anything else? ) @@ -460,11 +454,10 @@ move to its line in dired." (progn (setq dir (dired-current-directory)) (dired-up-directory other-window) - (or (dired-goto-file dir) + (unless (dired-goto-file dir) ;; refresh and try again - (progn - (dired-insert-subdir (file-name-directory dir)) - (dired-goto-file dir)))) + (dired-insert-subdir (file-name-directory dir)) + (dired-goto-file dir))) (if other-window (dired-other-window dir) (dired dir)) @@ -475,10 +468,9 @@ move to its line in dired." (dired-insert-subdir (file-name-directory file)) (dired-goto-file file)) ;; Toggle omitting, if it is on, and try again. - (if dired-omit-mode - (progn - (dired-omit-mode) - (dired-goto-file file)))))))) + (when dired-omit-mode + (dired-omit-mode) + (dired-goto-file file))))))) (defun dired-jump-other-window (&optional file-name) "Like \\[dired-jump] (`dired-jump') but in other window." @@ -695,7 +687,7 @@ you can relist single subdirs using \\[dired-do-redisplay]." (forward-line 1) (and (looking-at "^ wildcard ") (buffer-substring (match-end 0) - (progn (end-of-line) (point))))))) + (line-end-position)))))) (if wildcard (setq dirname (expand-file-name wildcard default-directory)))) ;; If raw ls listing (not a saved old dired buffer), give it a @@ -777,9 +769,12 @@ Also useful for `auto-mode-alist' like this: ;; mechanism is provided for special handling of the working directory in ;; special major modes. +(define-obsolete-variable-alias 'default-directory-alist + 'dired-default-directory-alist "24.1") + ;; It's easier to add to this alist than redefine function ;; default-directory while keeping the old information. -(defconst default-directory-alist +(defconst dired-default-directory-alist '((dired-mode . (if (fboundp 'dired-current-directory) (dired-current-directory) default-directory))) @@ -789,8 +784,8 @@ nil is ignored in favor of `default-directory'.") (defun dired-default-directory () "Usage like variable `default-directory'. -Knows about the special cases in variable `default-directory-alist'." - (or (eval (cdr (assq major-mode default-directory-alist))) +Knows about the special cases in variable `dired-default-directory-alist'." + (or (eval (cdr (assq major-mode dired-default-directory-alist))) default-directory)) (defun dired-smart-shell-command (command &optional output-buffer error-buffer) @@ -1369,8 +1364,9 @@ NOSELECT the files are merely found but not selected." (declare-function Man-getpage-in-background "man" (topic)) (defun dired-man () - "Run man on this file. Display old buffer if buffer name matches filename. -Uses `man.el' of \\[manual-entry] fame." + "Run `man' on this file." +;; Used also to say: "Display old buffer if buffer name matches filename." +;; but I have no idea what that means. (interactive) (require 'man) (let* ((file (dired-get-filename)) @@ -1382,7 +1378,7 @@ Uses `man.el' of \\[manual-entry] fame." ;; Run Info on files. (defun dired-info () - "Run info on this file." + "Run `info' on this file." (interactive) (info (dired-get-filename))) @@ -1393,17 +1389,16 @@ Uses `man.el' of \\[manual-entry] fame." (defun dired-vm (&optional read-only) "Run VM on this file. -With prefix arg, visit folder read-only (this requires at least VM 5). -See also variable `dired-vm-read-only-folders'." +With optional prefix argument, visits the folder read-only. +Otherwise obeys the value of `dired-vm-read-only-folders'." (interactive "P") (let ((dir (dired-current-directory)) (fil (dired-get-filename))) - ;; take care to supply 2nd arg only if requested - may still run VM 4! - (cond (read-only (vm-visit-folder fil t)) - ((eq t dired-vm-read-only-folders) (vm-visit-folder fil t)) - ((null dired-vm-read-only-folders) (vm-visit-folder fil)) - (t (vm-visit-folder fil (not (file-writable-p fil))))) - ;; so that pressing `v' inside VM does prompt within current directory: + (vm-visit-folder fil (or read-only + (eq t dired-vm-read-only-folders) + (and dired-vm-read-only-folders + (not (file-writable-p fil))))) + ;; So that pressing `v' inside VM does prompt within current directory: (set (make-local-variable 'vm-folder-directory) dir))) (defun dired-rmail () @@ -1450,16 +1445,11 @@ See also variable `dired-vm-read-only-folders'." ;; This should be a builtin (defun dired-buffer-more-recently-used-p (buffer1 buffer2) - "Return t if BUFFER1 is more recently used than BUFFER2." - (if (equal buffer1 buffer2) - nil - (let ((more-recent nil) - (list (buffer-list))) - (while (and list - (not (setq more-recent (equal buffer1 (car list)))) - (not (equal buffer2 (car list)))) - (setq list (cdr list))) - more-recent))) + "Return t if BUFFER1 is more recently used than BUFFER2. +Considers buffers closer to the car of `buffer-list' to be more recent." + (and (not (equal buffer1 buffer2)) + (memq buffer1 (buffer-list)) + (not (memq buffer1 (memq buffer2 (buffer-list)))))) ;; Same thing as `dired-buffers-for-dir' of dired.el? - lrd 11/23/93 ;; (defun dired-buffers-for-dir-exact (dir) @@ -1559,7 +1549,7 @@ to mark all zero length files." (forward-char mode-len) (setq nlink (read (current-buffer))) ;; Karsten Wenger fixed uid. - (setq uid (buffer-substring (+ (point) 1) + (setq uid (buffer-substring (1+ (point)) (progn (forward-word 1) (point)))) (re-search-forward directory-listing-before-filename-regexp) (goto-char (match-beginning 1)) @@ -1649,7 +1639,7 @@ Identical to `find-file' except when called interactively, with a prefix arg \(e.g., \\[universal-argument]\), in which case it guesses filename near point. Useful for editing file mentioned in buffer you are viewing, or to test if that file exists. Use minibuffer after snatching filename." - (interactive (list (read-filename-at-point "Find file: "))) + (interactive (list (dired-x-read-filename-at-point "Find file: "))) (find-file (expand-file-name filename))) (defun dired-x-find-file-other-window (filename) @@ -1661,7 +1651,7 @@ Identical to `find-file-other-window' except when called interactively, with a prefix arg \(e.g., \\[universal-argument]\), in which case it guesses filename near point. Useful for editing file mentioned in buffer you are viewing, or to test if that file exists. Use minibuffer after snatching filename." - (interactive (list (read-filename-at-point "Find file: "))) + (interactive (list (dired-x-read-filename-at-point "Find file: "))) (find-file-other-window (expand-file-name filename))) ;;; Internal functions. @@ -1677,13 +1667,10 @@ Not perfect - point must be in middle of or end of filename." (save-excursion ;; First see if just past a filename. - (if (not (eobp)) - (if (looking-at "[] \t\n[{}()]") ; whitespace or some parens - (progn - (skip-chars-backward " \n\t\r({[]})") - (if (not (bobp)) - (backward-char 1))))) - + (or (eobp) + (when (looking-at "[] \t\n[{}()]") ; whitespace or some parens + (skip-chars-backward " \n\t\r({[]})") + (or (bobp) (backward-char 1)))) (if (string-match (concat "[" filename-chars "]") (char-to-string (following-char))) (progn @@ -1706,7 +1693,7 @@ Not perfect - point must be in middle of or end of filename." ;; Return string. (expand-file-name (concat prefix (buffer-substring start (point))))))) -(defun read-filename-at-point (prompt) +(defun dired-x-read-filename-at-point (prompt) "Return filename prompting with PROMPT with completion. If `current-prefix-arg' is non-nil, uses name at point as guess." (if current-prefix-arg @@ -1716,6 +1703,9 @@ If `current-prefix-arg' is non-nil, uses name at point as guess." guess nil (file-name-nondirectory guess))) (read-file-name prompt default-directory))) + +(define-obsolete-function-alias 'read-filename-at-point + 'dired-x-read-filename-at-point "24.1") ; is this even needed? ;;; BUG REPORTS From b322c9aff7e794fa82123c6df4775a3887e90176 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 16 Feb 2011 00:46:13 -0800 Subject: [PATCH 06/46] Use emacsver.texi in dired-x.texi. * doc/misc/dired-x.texi: Use emacsver.texi to get Emacs version. * doc/misc/Makefile.in ($(infodir)/dired-x, dired-x.dvi, dired-x.pdf): Depend on emacsver.texi. --- doc/misc/ChangeLog | 4 ++++ doc/misc/Makefile.in | 6 +++--- doc/misc/dired-x.texi | 7 +++++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 21a2a593c2a..4a03caee911 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,5 +1,9 @@ 2011-02-16 Glenn Morris + * dired-x.texi: Use emacsver.texi to get Emacs version. + * Makefile.in ($(infodir)/dired-x, dired-x.dvi, dired-x.pdf): + Depend on emacsver.texi. + * dired-x.texi: Drop meaningless version number. (Introduction): Remove old info. (Optional Installation Dired Jump): Autoload from dired-x. diff --git a/doc/misc/Makefile.in b/doc/misc/Makefile.in index 169d6c89b85..0a28d417c70 100644 --- a/doc/misc/Makefile.in +++ b/doc/misc/Makefile.in @@ -287,12 +287,12 @@ dbus.pdf: ${srcdir}/dbus.texi $(ENVADD) $(TEXI2PDF) $< dired-x : $(infodir)/dired-x -$(infodir)/dired-x: dired-x.texi +$(infodir)/dired-x: dired-x.texi $(emacsdir)/emacsver.texi $(mkinfodir) cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) $< -dired-x.dvi: ${srcdir}/dired-x.texi +dired-x.dvi: ${srcdir}/dired-x.texi $(emacsdir)/emacsver.texi $(ENVADD) $(TEXI2DVI) $< -dired-x.pdf: ${srcdir}/dired-x.texi +dired-x.pdf: ${srcdir}/dired-x.texi $(emacsdir)/emacsver.texi $(ENVADD) $(TEXI2PDF) $< ebrowse : $(infodir)/ebrowse diff --git a/doc/misc/dired-x.texi b/doc/misc/dired-x.texi index 6d2ee8ac872..c16858beffd 100644 --- a/doc/misc/dired-x.texi +++ b/doc/misc/dired-x.texi @@ -10,6 +10,8 @@ @setfilename ../../info/dired-x @settitle Dired Extra User's Manual +@include emacsver.texi + @iftex @finalout @end iftex @@ -17,7 +19,8 @@ @comment %**end of header (This is for running Texinfo on a region.) @copying -Copyright @copyright{} 1994-1995, 1999, 2001-2011 Free Software Foundation, Inc. +Copyright @copyright{} 1994-1995, 1999, 2001-2011 +Free Software Foundation, Inc. @quotation Permission is granted to copy, distribute and/or modify this document @@ -79,7 +82,7 @@ provided by the file @file{dired-x.el}. Based on @file{dired.texi} by Sebastian Kremer @item -For @file{dired-x.el} as distributed with GNU Emacs 23. +For @file{dired-x.el} as distributed with GNU Emacs @value{EMACSVER}. @end itemize From c6cefd36106ddade8fc65fc074221132357428ff Mon Sep 17 00:00:00 2001 From: Leo Liu Date: Wed, 16 Feb 2011 00:51:39 -0800 Subject: [PATCH 07/46] More dired-x cleanup. * lisp/dired-x.el (dired-mode-map, dired-extra-startup): Remove dired-copy-filename-as-kill since it's already in dired.el. --- lisp/ChangeLog | 5 +++++ lisp/dired-x.el | 3 --- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 10ca65a55a9..65453b44c22 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2011-02-16 Leo + + * dired-x.el (dired-mode-map, dired-extra-startup): + Remove dired-copy-filename-as-kill since it's already in dired.el. + 2011-02-16 Glenn Morris * dired-x.el (dired-bind-jump, dired-bind-man, dired-bind-info): diff --git a/lisp/dired-x.el b/lisp/dired-x.el index fa064898ed4..0d16eef1c28 100644 --- a/lisp/dired-x.el +++ b/lisp/dired-x.el @@ -245,7 +245,6 @@ to nil: a pipe using `zcat' or `gunzip -c' will be used." (define-key dired-mode-map "*(" 'dired-mark-sexp) (define-key dired-mode-map "*." 'dired-mark-extension) (define-key dired-mode-map "\M-!" 'dired-smart-shell-command) -(define-key dired-mode-map "w" 'dired-copy-filename-as-kill) (define-key dired-mode-map "\M-G" 'dired-goto-subdir) (define-key dired-mode-map "F" 'dired-do-find-marked-files) (define-key dired-mode-map "Y" 'dired-do-relsymlink) @@ -308,8 +307,6 @@ files"] \\[dired-do-find-marked-files]\t-- visit all marked files simultaneously \\[dired-omit-mode]\t-- toggle omitting of files \\[dired-mark-sexp]\t-- mark by Lisp expression - \\[dired-copy-filename-as-kill]\t-- copy the file or subdir names into the kill ring; - \t you can feed it to other commands using \\[yank] To see the options you can set, use M-x customize-group RET dired-x RET. See also the functions: From 16d2ff891446b821ef348d451f73683a0d3a21f6 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Wed, 16 Feb 2011 10:25:37 +0100 Subject: [PATCH 08/46] * net/soap-client.el: * net/soap-inspect.el: New files. --- lisp/ChangeLog | 5 + lisp/net/soap-client.el | 1694 ++++++++++++++++++++++++++++++++++++++ lisp/net/soap-inspect.el | 352 ++++++++ 3 files changed, 2051 insertions(+) create mode 100644 lisp/net/soap-client.el create mode 100644 lisp/net/soap-inspect.el diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 65453b44c22..5d346845e58 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2011-02-16 Alex Harsanyi + + * net/soap-client.el: + * net/soap-inspect.el: New files. + 2011-02-16 Leo * dired-x.el (dired-mode-map, dired-extra-startup): diff --git a/lisp/net/soap-client.el b/lisp/net/soap-client.el new file mode 100644 index 00000000000..c43c17dc9ef --- /dev/null +++ b/lisp/net/soap-client.el @@ -0,0 +1,1694 @@ +;;;; soap.el -- Access SOAP web services from Emacs + +;; Copyright (C) 2009-2011 Alex Harsanyi + +;; 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 . + +;; Author: Alexandru Harsanyi (AlexHarsanyi@gmail.com) +;; Created: December, 2009 +;; Keywords: soap, web-services +;; Homepage: http://code.google.com/p/emacs-soap-client +;; + +;;; Commentary: +;; +;; To use the SOAP client, you first need to load the WSDL document for the +;; service you want to access, using `soap-load-wsdl-from-url'. A WSDL +;; document describes the available operations of the SOAP service, how their +;; parameters and responses are encoded. To invoke operations, you use the +;; `soap-invoke' method passing it the WSDL, the service name, the operation +;; you wish to invoke and any required parameters. +;; +;; Idealy, the service you want to access will have some documentation about +;; the operations it supports. If it does not, you can try using +;; `soap-inspect' to browse the WSDL document and see the available operations +;; and their parameters. +;; + +;;; Code: + +(eval-when-compile (require 'cl)) + +(require 'xml) +(require 'warnings) +(require 'url) +(require 'url-http) +(require 'url-util) +(require 'mm-decode) + +(defsubst soap-warning (message &rest args) + "Display a warning MESSAGE with ARGS, using the 'soap-client warning type." + (display-warning 'soap-client (apply 'format message args) :warning)) + +(defgroup soap-client nil + "Access SOAP web services from Emacs." + :group 'tools) + +;;;; Support for parsing XML documents with namespaces + +;; XML documents with namespaces are difficult to parse because the names of +;; the nodes depend on what "xmlns" aliases have been defined in the document. +;; To work with such documents, we introduce a translation layer between a +;; "well known" namespace tag and the local namespace tag in the document +;; being parsed. + +(defconst *soap-well-known-xmlns* + '(("apachesoap" . "http://xml.apache.org/xml-soap") + ("soapenc" . "http://schemas.xmlsoap.org/soap/encoding/") + ("wsdl" . "http://schemas.xmlsoap.org/wsdl/") + ("wsdlsoap" . "http://schemas.xmlsoap.org/wsdl/soap/") + ("xsd" . "http://www.w3.org/2001/XMLSchema") + ("xsi" . "http://www.w3.org/2001/XMLSchema-instance") + ("soap" . "http://schemas.xmlsoap.org/soap/envelope/") + ("soap12" . "http://schemas.xmlsoap.org/wsdl/soap12/") + ("http" . "http://schemas.xmlsoap.org/wsdl/http/") + ("mime" . "http://schemas.xmlsoap.org/wsdl/mime/")) + "A list of well known xml namespaces and their aliases.") + +(defvar *soap-local-xmlns* nil + "A list of local namespace aliases. +This is a dynamically bound variable, controlled by +`soap-with-local-xmlns'.") + +(defvar *soap-default-xmlns* nil + "The default XML namespaces. +Names in this namespace will be unqualified. This is a +dynamically bound variable, controlled by +`soap-with-local-xmlns'") + +(defvar *soap-target-xmlns* nil + "The target XML namespace. +New XSD elements will be defined in this namespace, unless they +are fully qualified for a different namespace. This is a +dynamically bound variable, controlled by +`soap-with-local-xmlns'") + +(defun soap-wk2l (well-known-name) + "Return local variant of WELL-KNOWN-NAME. +This is done by looking up the namespace in the +`*soap-well-known-xmlns*' table and resolving the namespace to +the local name based on the current local translation table +`*soap-local-xmlns*'. See also `soap-with-local-xmlns'." + (let ((wk-name-1 (if (symbolp well-known-name) + (symbol-name well-known-name) + well-known-name))) + (cond + ((string-match "^\\(.*\\):\\(.*\\)$" wk-name-1) + (let ((ns (match-string 1 wk-name-1)) + (name (match-string 2 wk-name-1))) + (let ((namespace (cdr (assoc ns *soap-well-known-xmlns*)))) + (cond ((equal namespace *soap-default-xmlns*) + ;; Name is unqualified in the default namespace + (if (symbolp well-known-name) + (intern name) + name)) + (t + (let* ((local-ns (car (rassoc namespace *soap-local-xmlns*))) + (local-name (concat local-ns ":" name))) + (if (symbolp well-known-name) + (intern local-name) + local-name))))))) + (t well-known-name)))) + +(defun soap-l2wk (local-name) + "Convert LOCAL-NAME into a well known name. +The namespace of LOCAL-NAME is looked up in the +`*soap-well-known-xmlns*' table and a well known namespace tag is +used in the name. + +nil is returned if there is no well-known namespace for the +namespace of LOCAL-NAME." + (let ((l-name-1 (if (symbolp local-name) + (symbol-name local-name) + local-name)) + namespace name) + (cond + ((string-match "^\\(.*\\):\\(.*\\)$" l-name-1) + (setq name (match-string 2 l-name-1)) + (let ((ns (match-string 1 l-name-1))) + (setq namespace (cdr (assoc ns *soap-local-xmlns*))) + (unless namespace + (error "Soap-l2wk(%s): no namespace for alias %s" local-name ns)))) + (t + (setq name l-name-1) + (setq namespace *soap-default-xmlns*))) + + (if namespace + (let ((well-known-ns (car (rassoc namespace *soap-well-known-xmlns*)))) + (if well-known-ns + (let ((well-known-name (concat well-known-ns ":" name))) + (if (symbol-name local-name) + (intern well-known-name) + well-known-name)) + (progn + ;; (soap-warning "soap-l2wk(%s): namespace %s has no well-known tag" + ;; local-name namespace) + nil))) + ;; if no namespace is defined, just return the unqualified name + name))) + + +(defun soap-l2fq (local-name &optional use-tns) + "Convert LOCAL-NAME into a fully qualified name. +A fully qualified name is a cons of the namespace name and the +name of the element itself. For example \"xsd:string\" is +converted to \(\"http://www.w3.org/2001/XMLSchema\" . \"string\" +\). + +The USE-TNS argument specifies what to do when LOCAL-NAME has no +namespace tag. If USE-TNS is non-nil, the `*soap-target-xmlns*' +will be used as the element's namespace, otherwise +`*soap-default-xmlns*' will be used. + +This is needed because different parts of a WSDL document can use +different namespace aliases for the same element." + (let ((local-name-1 (if (symbolp local-name) + (symbol-name local-name) + local-name))) + (cond ((string-match "^\\(.*\\):\\(.*\\)$" local-name-1) + (let ((ns (match-string 1 local-name-1)) + (name (match-string 2 local-name-1))) + (let ((namespace (cdr (assoc ns *soap-local-xmlns*)))) + (if namespace + (cons namespace name) + (error "Soap-l2fq(%s): unknown alias %s" local-name ns))))) + (t + (cons (if use-tns + *soap-target-xmlns* + *soap-default-xmlns*) + local-name))))) + +(defun soap-extract-xmlns (node &optional xmlns-table) + "Return a namespace alias table for NODE by extending XMLNS-TABLE." + (let (xmlns default-ns target-ns) + (dolist (a (xml-node-attributes node)) + (let ((name (symbol-name (car a))) + (value (cdr a))) + (cond ((string= name "targetNamespace") + (setq target-ns value)) + ((string= name "xmlns") + (setq default-ns value)) + ((string-match "^xmlns:\\(.*\\)$" name) + (push (cons (match-string 1 name) value) xmlns))))) + + (let ((tns (assoc "tns" xmlns))) + (cond ((and tns target-ns) + ;; If a tns alias is defined for this node, it must match the target + ;; namespace. + (unless (equal target-ns (cdr tns)) + (soap-warning "soap-extract-xmlns(%s): tns alias and targetNamespace mismatch" + (xml-node-name node)))) + ((and tns (not target-ns)) + (setq target-ns (cdr tns))) + ((and (not tns) target-ns) + ;; a tns alias was not defined in this node. See if the node has + ;; a "targetNamespace" attribute and add an alias to this. Note + ;; that we might override an existing tns alias in XMLNS-TABLE, + ;; but that is intended. + (push (cons "tns" target-ns) xmlns)))) + + (list default-ns target-ns (append xmlns xmlns-table)))) + +(defmacro soap-with-local-xmlns (node &rest body) + "Install a local alias table from NODE and execute BODY." + (declare (debug (form &rest form)) (indent 1)) + (let ((xmlns (make-symbol "xmlns"))) + `(let ((,xmlns (soap-extract-xmlns ,node *soap-local-xmlns*))) + (let ((*soap-default-xmlns* (or (nth 0 ,xmlns) *soap-default-xmlns*)) + (*soap-target-xmlns* (or (nth 1 ,xmlns) *soap-target-xmlns*)) + (*soap-local-xmlns* (nth 2 ,xmlns))) + ,@body)))) + +(defun soap-get-target-namespace (node) + "Return the target namespace of NODE. +This is the namespace in which new elements will be defined." + (or (xml-get-attribute-or-nil node 'targetNamespace) + (cdr (assoc "tns" *soap-local-xmlns*)) + *soap-target-xmlns*)) + +(defun soap-xml-get-children1 (node child-name) + "Return the children of NODE named CHILD-NAME. +This is the same as `xml-get-children', but CHILD-NAME can have +namespace tag." + (let (result) + (dolist (c (xml-node-children node)) + (when (and (consp c) + (soap-with-local-xmlns c + ;; We use `ignore-errors' here because we want to silently + ;; skip nodes for which we cannot convert them to a + ;; well-known name. + (eq (ignore-errors (soap-l2wk (xml-node-name c))) child-name))) + (push c result))) + (nreverse result))) + +(defun soap-xml-get-attribute-or-nil1 (node attribute) + "Return the NODE's ATTRIBUTE, or nil if it does not exist. +This is the same as `xml-get-attribute-or-nil', but ATTRIBUTE can +be tagged with a namespace tag." + (catch 'found + (soap-with-local-xmlns node + (dolist (a (xml-node-attributes node)) + ;; We use `ignore-errors' here because we want to silently skip + ;; attributes for which we cannot convert them to a well-known name. + (when (eq (ignore-errors (soap-l2wk (car a))) attribute) + (throw 'found (cdr a))))))) + + +;;;; XML namespaces + +;; An element in an XML namespace, "things" stored in soap-xml-namespaces will +;; be derived from this object. + +(defstruct soap-element + name + ;; The "well-known" namespace tag for the element. For example, while + ;; parsing XML documents, we can have different tags for the XMLSchema + ;; namespace, but internally all our XMLSchema elements will have the "xsd" + ;; tag. + namespace-tag) + +(defun soap-element-fq-name (element) + "Return a fully qualified name for ELEMENT. +A fq name is the concatenation of the namespace tag and the +element name." + (concat (soap-element-namespace-tag element) + ":" (soap-element-name element))) + +;; a namespace link stores an alias for an object in once namespace to a +;; "target" object possibly in a different namespace + +(defstruct (soap-namespace-link (:include soap-element)) + target) + +;; A namespace is a collection of soap-element objects under a name (the name +;; of the namespace). + +(defstruct soap-namespace + (name nil :read-only t) ; e.g "http://xml.apache.org/xml-soap" + (elements (make-hash-table :test 'equal) :read-only t)) + +(defun soap-namespace-put (element ns) + "Store ELEMENT in NS. +Multiple elements with the same name can be stored in a +namespace. When retrieving the element you can specify a +discriminant predicate to `soap-namespace-get'" + (let ((name (soap-element-name element))) + (push element (gethash name (soap-namespace-elements ns))))) + +(defun soap-namespace-put-link (name target ns &optional replace) + "Store a link from NAME to TARGET in NS. +An error will be signaled if an element by the same name is +already present in NS, unless REPLACE is non nil. + +TARGET can be either a SOAP-ELEMENT or a string denoting an +element name into another namespace. + +If NAME is nil, an element with the same name as TARGET will be +added to the namespace." + + (unless (and name (not (equal name ""))) + ;; if name is nil, use TARGET as a name... + (cond ((soap-element-p target) + (setq name (soap-element-name target))) + ((stringp target) + (cond ((string-match "^\\(.*\\):\\(.*\\)$" target) + (setq name (match-string 2 target))) + (t + (setq name target)))))) + + (assert name) ; by now, name should be valid + (push (make-soap-namespace-link :name name :target target) + (gethash name (soap-namespace-elements ns)))) + +(defun soap-namespace-get (name ns &optional discriminant-predicate) + "Retrieve an element with NAME from the namespace NS. +If multiple elements with the same name exist, +DISCRIMINANT-PREDICATE is used to pick one of them. This allows +storing elements of different types (like a message type and a +binding) but the same name." + (assert (stringp name)) + (let ((elements (gethash name (soap-namespace-elements ns)))) + (cond (discriminant-predicate + (catch 'found + (dolist (e elements) + (when (funcall discriminant-predicate e) + (throw 'found e))))) + ((= (length elements) 1) (car elements)) + ((> (length elements) 1) + (error "Soap-namespace-get(%s): multiple elements, discriminant needed" name)) + (t + nil)))) + + +;;;; WSDL documents +;;;;; WSDL document elements + +(defstruct (soap-basic-type (:include soap-element)) + kind ; a symbol of: string, dateTime, long, int + ) + +(defstruct soap-sequence-element + name type nillable? multiple?) + +(defstruct (soap-sequence-type (:include soap-element)) + parent ; OPTIONAL WSDL-TYPE name + elements ; LIST of SOAP-SEQUCENCE-ELEMENT + ) + +(defstruct (soap-array-type (:include soap-element)) + element-type ; WSDL-TYPE of the array elements + ) + +(defstruct (soap-message (:include soap-element)) + parts ; ALIST of NAME => WSDL-TYPE name + ) + +(defstruct (soap-operation (:include soap-element)) + parameter-order + input ; (NAME . MESSAGE) + output ; (NAME . MESSAGE) + faults) ; a list of (NAME . MESSAGE) + +(defstruct (soap-port-type (:include soap-element)) + operations) ; a namespace of operations + +;; A bound operation is an operation which has a soap action and a use +;; method attached -- these are attached as part of a binding and we +;; can have different bindings for the same operations. +(defstruct soap-bound-operation + operation ; SOAP-OPERATION + soap-action ; value for SOAPAction HTTP header + use ; 'literal or 'encoded, see http://www.w3.org/TR/wsdl#_soap:body + ) + +(defstruct (soap-binding (:include soap-element)) + port-type + (operations (make-hash-table :test 'equal) :readonly t)) + +(defstruct (soap-port (:include soap-element)) + service-url + binding) + +(defun soap-default-xsd-types () + "Return a namespace containing some of the XMLSchema types." + (let ((ns (make-soap-namespace :name "http://www.w3.org/2001/XMLSchema"))) + (dolist (type '("string" "dateTime" "boolean" "long" "int" "float" + "base64Binary" "anyType" "Array" "byte[]")) + (soap-namespace-put + (make-soap-basic-type :name type :kind (intern type)) + ns)) + ns)) + +(defun soap-default-soapenc-types () + "Return a namespace containing some of the SOAPEnc types." + (let ((ns (make-soap-namespace :name "http://schemas.xmlsoap.org/soap/encoding/"))) + (dolist (type '("string" "dateTime" "boolean" "long" "int" "float" + "base64Binary" "anyType" "Array" "byte[]")) + (soap-namespace-put + (make-soap-basic-type :name type :kind (intern type)) + ns)) + ns)) + +(defun soap-type-p (element) + "Return t if ELEMENT is a SOAP data type (basic or complex)." + (or (soap-basic-type-p element) + (soap-sequence-type-p element) + (soap-array-type-p element))) + + +;;;;; The WSDL document + +;; The WSDL data structure used for encoding/decoding SOAP messages +(defstruct soap-wsdl + origin ; file or URL from which this wsdl was loaded + ports ; a list of SOAP-PORT instances + alias-table ; a list of namespace aliases + namespaces ; a list of namespaces + ) + +(defun soap-wsdl-add-alias (alias name wsdl) + "Add a namespace ALIAS for NAME to the WSDL document." + (push (cons alias name) (soap-wsdl-alias-table wsdl))) + +(defun soap-wsdl-find-namespace (name wsdl) + "Find a namespace by NAME in the WSDL document." + (catch 'found + (dolist (ns (soap-wsdl-namespaces wsdl)) + (when (equal name (soap-namespace-name ns)) + (throw 'found ns))))) + +(defun soap-wsdl-add-namespace (ns wsdl) + "Add the namespace NS to the WSDL document. +If a namespace by this name already exists in WSDL, individual +elements will be added to it." + (let ((existing (soap-wsdl-find-namespace (soap-namespace-name ns) wsdl))) + (if existing + ;; Add elements from NS to EXISTING, replacing existing values. + (maphash (lambda (key value) + (dolist (v value) + (soap-namespace-put v existing))) + (soap-namespace-elements ns)) + (push ns (soap-wsdl-namespaces wsdl))))) + +(defun soap-wsdl-get (name wsdl &optional predicate use-local-alias-table) + "Retrieve element NAME from the WSDL document. + +PREDICATE is used to differentiate between elements when NAME +refers to multiple elements. A typical value for this would be a +structure predicate for the type of element you want to retrieve. +For example, to retrieve a message named \"foo\" when other +elements named \"foo\" exist in the WSDL you could use: + + (soap-wsdl-get \"foo\" WSDL 'soap-message-p) + +If USE-LOCAL-ALIAS-TABLE is not nil, `*soap-local-xmlns*` will be +used to resolve the namespace alias." + (let ((alias-table (soap-wsdl-alias-table wsdl)) + namespace element-name element) + + (when (symbolp name) + (setq name (symbol-name name))) + + (when use-local-alias-table + (setq alias-table (append *soap-local-xmlns* alias-table))) + + (cond ((consp name) ; a fully qualified name, as returned by `soap-l2fq' + (setq element-name (cdr name)) + (when (symbolp element-name) + (setq element-name (symbol-name element-name))) + (setq namespace (soap-wsdl-find-namespace (car name) wsdl)) + (unless namespace + (error "Soap-wsdl-get(%s): unknown namespace: %s" name namespace))) + + ((string-match "^\\(.*\\):\\(.*\\)$" name) + (setq element-name (match-string 2 name)) + + (let* ((ns-alias (match-string 1 name)) + (ns-name (cdr (assoc ns-alias alias-table)))) + (unless ns-name + (error "Soap-wsdl-get(%s): cannot find namespace alias %s" name ns-alias)) + + (setq namespace (soap-wsdl-find-namespace ns-name wsdl)) + (unless namespace + (error "Soap-wsdl-get(%s): unknown namespace %s, referenced by alias %s" + name ns-name ns-alias)))) + (t + (error "Soap-wsdl-get(%s): bad name" name))) + + (setq element (soap-namespace-get + element-name namespace + (if predicate + (lambda (e) + (or (funcall 'soap-namespace-link-p e) + (funcall predicate e))) + nil))) + + (unless element + (error "Soap-wsdl-get(%s): cannot find element" name)) + + (if (soap-namespace-link-p element) + ;; NOTE: don't use the local alias table here + (soap-wsdl-get (soap-namespace-link-target element) wsdl predicate) + element))) + +;;;;; Resolving references for wsdl types + +;; See `soap-wsdl-resolve-references', which is the main entry point for +;; resolving references + +(defun soap-resolve-references-for-element (element wsdl) + "Resolve references in ELEMENT using the WSDL document. +This is a generic function which invokes a specific function +depending on the element type. + +If ELEMENT has no resolver function, it is silently ignored. + +All references are resolved in-place, that is the ELEMENT is +updated." + (let ((resolver (get (aref element 0) 'soap-resolve-references))) + (when resolver + (funcall resolver element wsdl)))) + +(defun soap-resolve-references-for-sequence-type (type wsdl) + "Resolve references for a sequence TYPE using WSDL document. +See also `soap-resolve-references-for-element' and +`soap-wsdl-resolve-references'" + (let ((parent (soap-sequence-type-parent type))) + (when (or (consp parent) (stringp parent)) + (setf (soap-sequence-type-parent type) + (soap-wsdl-get parent wsdl 'soap-type-p)))) + (dolist (element (soap-sequence-type-elements type)) + (let ((element-type (soap-sequence-element-type element))) + (cond ((or (consp element-type) (stringp element-type)) + (setf (soap-sequence-element-type element) + (soap-wsdl-get element-type wsdl 'soap-type-p))) + ((soap-element-p element-type) + ;; since the element already has a child element, it + ;; could be an inline structure. we must resolve + ;; references in it, because it might not be reached by + ;; scanning the wsdl names. + (soap-resolve-references-for-element element-type wsdl)))))) + +(defun soap-resolve-references-for-array-type (type wsdl) + "Resolve references for an array TYPE using WSDL. +See also `soap-resolve-references-for-element' and +`soap-wsdl-resolve-references'" + (let ((element-type (soap-array-type-element-type type))) + (when (or (consp element-type) (stringp element-type)) + (setf (soap-array-type-element-type type) + (soap-wsdl-get element-type wsdl 'soap-type-p))))) + +(defun soap-resolve-references-for-message (message wsdl) + "Resolve references for a MESSAGE type using the WSDL document. +See also `soap-resolve-references-for-element' and +`soap-wsdl-resolve-references'" + (let (resolved-parts) + (dolist (part (soap-message-parts message)) + (let ((name (car part)) + (type (cdr part))) + (when (stringp name) + (setq name (intern name))) + (when (or (consp type) (stringp type)) + (setq type (soap-wsdl-get type wsdl 'soap-type-p))) + (push (cons name type) resolved-parts))) + (setf (soap-message-parts message) (nreverse resolved-parts)))) + +(defun soap-resolve-references-for-operation (operation wsdl) + "Resolve references for an OPERATION type using the WSDL document. +See also `soap-resolve-references-for-element' and +`soap-wsdl-resolve-references'" + (let ((input (soap-operation-input operation)) + (counter 0)) + (let ((name (car input)) + (message (cdr input))) + ;; Name this part if it was not named + (when (or (null name) (equal name "")) + (setq name (format "in%d" (incf counter)))) + (when (or (consp message) (stringp message)) + (setf (soap-operation-input operation) + (cons (intern name) (soap-wsdl-get message wsdl 'soap-message-p)))))) + + (let ((output (soap-operation-output operation)) + (counter 0)) + (let ((name (car output)) + (message (cdr output))) + (when (or (null name) (equal name "")) + (setq name (format "out%d" (incf counter)))) + (when (or (consp message) (stringp message)) + (setf (soap-operation-output operation) + (cons (intern name) (soap-wsdl-get message wsdl 'soap-message-p)))))) + + (let ((resolved-faults nil) + (counter 0)) + (dolist (fault (soap-operation-faults operation)) + (let ((name (car fault)) + (message (cdr fault))) + (when (or (null name) (equal name "")) + (setq name (format "fault%d" (incf counter)))) + (if (or (consp message) (stringp message)) + (push (cons (intern name) (soap-wsdl-get message wsdl 'soap-message-p)) + resolved-faults) + (push fault resolved-faults)))) + (setf (soap-operation-faults operation) resolved-faults)) + + (when (= (length (soap-operation-parameter-order operation)) 0) + (setf (soap-operation-parameter-order operation) + (mapcar 'car (soap-message-parts + (cdr (soap-operation-input operation)))))) + + (setf (soap-operation-parameter-order operation) + (mapcar (lambda (p) + (if (stringp p) + (intern p) + p)) + (soap-operation-parameter-order operation)))) + +(defun soap-resolve-references-for-binding (binding wsdl) + "Resolve references for a BINDING type using the WSDL document. +See also `soap-resolve-references-for-element' and +`soap-wsdl-resolve-references'" + (when (or (consp (soap-binding-port-type binding)) + (stringp (soap-binding-port-type binding))) + (setf (soap-binding-port-type binding) + (soap-wsdl-get (soap-binding-port-type binding) wsdl 'soap-port-type-p))) + + (let ((port-ops (soap-port-type-operations (soap-binding-port-type binding)))) + (maphash (lambda (k v) + (setf (soap-bound-operation-operation v) + (soap-namespace-get k port-ops 'soap-operation-p))) + (soap-binding-operations binding)))) + +(defun soap-resolve-references-for-port (port wsdl) + "Resolve references for a PORT type using the WSDL document. +See also `soap-resolve-references-for-element' and +`soap-wsdl-resolve-references'" + (when (or (consp (soap-port-binding port)) + (stringp (soap-port-binding port))) + (setf (soap-port-binding port) + (soap-wsdl-get (soap-port-binding port) wsdl 'soap-binding-p)))) + +;; Install resolvers for our types +(progn + (put (aref (make-soap-sequence-type) 0) 'soap-resolve-references + 'soap-resolve-references-for-sequence-type) + (put (aref (make-soap-array-type) 0) 'soap-resolve-references + 'soap-resolve-references-for-array-type) + (put (aref (make-soap-message) 0) 'soap-resolve-references + 'soap-resolve-references-for-message) + (put (aref (make-soap-operation) 0) 'soap-resolve-references + 'soap-resolve-references-for-operation) + (put (aref (make-soap-binding) 0) 'soap-resolve-references + 'soap-resolve-references-for-binding) + (put (aref (make-soap-port) 0) 'soap-resolve-references + 'soap-resolve-references-for-port)) + +(defun soap-wsdl-resolve-references (wsdl) + "Resolve all references inside the WSDL structure. + +When the WSDL elements are created from the XML document, they +refer to each other by name. For example, the ELEMENT-TYPE slot +of an SOAP-ARRAY-TYPE will contain the name of the element and +the user would have to call `soap-wsdl-get' to obtain the actual +element. + +After the entire document is loaded, we resolve all these +references to the actual elements they refer to so that at +runtime, we don't have to call `soap-wsdl-get' each time we +traverse an element tree." + (let ((nprocessed 0) + (nstag-id 0) + (alias-table (soap-wsdl-alias-table wsdl))) + (dolist (ns (soap-wsdl-namespaces wsdl)) + (let ((nstag (car-safe (rassoc (soap-namespace-name ns) alias-table)))) + (unless nstag + ;; If this namespace does not have an alias, create one for it. + (catch 'done + (while t + (setq nstag (format "ns%d" (incf nstag-id))) + (unless (assoc nstag alias-table) + (soap-wsdl-add-alias nstag (soap-namespace-name ns) wsdl) + (throw 'done t))))) + + (maphash (lambda (name element) + (cond ((soap-element-p element) ; skip links + (incf nprocessed) + (soap-resolve-references-for-element element wsdl) + (setf (soap-element-namespace-tag element) nstag)) + ((listp element) + (dolist (e element) + (when (soap-element-p e) + (incf nprocessed) + (soap-resolve-references-for-element e wsdl) + (setf (soap-element-namespace-tag e) nstag)))))) + (soap-namespace-elements ns)))) + + (message "Processed %d" nprocessed)) + wsdl) + +;;;;; Loading WSDL from XML documents + +(defun soap-load-wsdl-from-url (url) + "Load a WSDL document from URL and return it. +The returned WSDL document needs to be used for `soap-invoke' +calls." + (let ((url-request-method "GET") + (url-package-name "soap-client.el") + (url-package-version "1.0") + (url-mime-charset-string "utf-8;q=1, iso-8859-1;q=0.5") + (url-request-coding-system 'utf-8) + (url-http-attempt-keepalives nil)) + (let ((buffer (url-retrieve-synchronously url))) + (with-current-buffer buffer + (declare (special url-http-response-status)) + (if (> url-http-response-status 299) + (error "Error retrieving WSDL: %s" url-http-response-status)) + (let ((mime-part (mm-dissect-buffer t t))) + (unless mime-part + (error "Failed to decode response from server")) + (unless (equal (car (mm-handle-type mime-part)) "text/xml") + (error "Server response is not an XML document")) + (with-temp-buffer + (mm-insert-part mime-part) + (let ((wsdl-xml (car (xml-parse-region (point-min) (point-max))))) + (prog1 + (let ((wsdl (soap-parse-wsdl wsdl-xml))) + (setf (soap-wsdl-origin wsdl) url) + wsdl) + (kill-buffer buffer))))))))) + +(defun soap-load-wsdl (file) + "Load a WSDL document from FILE and return it." + (with-temp-buffer + (insert-file-contents file) + (let ((xml (car (xml-parse-region (point-min) (point-max))))) + (let ((wsdl (soap-parse-wsdl xml))) + (setf (soap-wsdl-origin wsdl) file) + wsdl)))) + +(defun soap-parse-wsdl (node) + "Construct a WSDL structure from NODE, which is an XML document." + (soap-with-local-xmlns node + + (assert (eq (soap-l2wk (xml-node-name node)) 'wsdl:definitions) + nil + "soap-parse-wsdl: expecting wsdl:definitions node, got %s" + (soap-l2wk (xml-node-name node))) + + (let ((wsdl (make-soap-wsdl))) + + ;; Add the local alias table to the wsdl document -- it will be used for + ;; all types in this document even after we finish parsing it. + (setf (soap-wsdl-alias-table wsdl) *soap-local-xmlns*) + + ;; Add the XSD types to the wsdl document + (let ((ns (soap-default-xsd-types))) + (soap-wsdl-add-namespace ns wsdl) + (soap-wsdl-add-alias "xsd" (soap-namespace-name ns) wsdl)) + + ;; Add the soapenc types to the wsdl document + (let ((ns (soap-default-soapenc-types))) + (soap-wsdl-add-namespace ns wsdl) + (soap-wsdl-add-alias "soapenc" (soap-namespace-name ns) wsdl)) + + ;; Find all the 'xsd:schema nodes which are children of wsdl:types nodes + ;; and build our type-library + + (let ((types (car (soap-xml-get-children1 node 'wsdl:types)))) + (dolist (node (xml-node-children types)) + ;; We cannot use (xml-get-children node (soap-wk2l 'xsd:schema)) + ;; because each node can install its own alias type so the schema + ;; nodes might have a different prefix. + (when (consp node) + (soap-with-local-xmlns node + (when (eq (soap-l2wk (xml-node-name node)) 'xsd:schema) + (soap-wsdl-add-namespace (soap-parse-schema node) wsdl)))))) + + (let ((ns (make-soap-namespace :name (soap-get-target-namespace node)))) + (dolist (node (soap-xml-get-children1 node 'wsdl:message)) + (soap-namespace-put (soap-parse-message node) ns)) + + (dolist (node (soap-xml-get-children1 node 'wsdl:portType)) + (let ((port-type (soap-parse-port-type node))) + (soap-namespace-put port-type ns) + (soap-wsdl-add-namespace (soap-port-type-operations port-type) wsdl))) + + (dolist (node (soap-xml-get-children1 node 'wsdl:binding)) + (soap-namespace-put (soap-parse-binding node) ns)) + + (dolist (node (soap-xml-get-children1 node 'wsdl:service)) + (dolist (node (soap-xml-get-children1 node 'wsdl:port)) + (let ((name (xml-get-attribute node 'name)) + (binding (xml-get-attribute node 'binding)) + (url (let ((n (car (soap-xml-get-children1 node 'wsdlsoap:address)))) + (xml-get-attribute n 'location)))) + (let ((port (make-soap-port + :name name :binding (soap-l2fq binding 'tns) :service-url url))) + (soap-namespace-put port ns) + (push port (soap-wsdl-ports wsdl)))))) + + (soap-wsdl-add-namespace ns wsdl)) + + (soap-wsdl-resolve-references wsdl) + + wsdl))) + +(defun soap-parse-schema (node) + "Parse a schema NODE. +Return a SOAP-NAMESPACE containing the elements." + (soap-with-local-xmlns node + (assert (eq (soap-l2wk (xml-node-name node)) 'xsd:schema) + nil + "soap-parse-schema: expecting an xsd:schema node, got %s" + (soap-l2wk (xml-node-name node))) + (let ((ns (make-soap-namespace :name (soap-get-target-namespace node)))) + ;; NOTE: we only extract the complexTypes from the schema, we wouldn't + ;; know how to handle basic types beyond the built in ones anyway. + (dolist (node (soap-xml-get-children1 node 'xsd:complexType)) + (soap-namespace-put (soap-parse-complex-type node) ns)) + + (dolist (node (soap-xml-get-children1 node 'xsd:element)) + (soap-namespace-put (soap-parse-schema-element node) ns)) + + ns))) + +(defun soap-parse-schema-element (node) + "Parse NODE and construct a schema element from it." + (assert (eq (soap-l2wk (xml-node-name node)) 'xsd:element) + nil + "soap-parse-schema-element: expecting xsd:element node, got %s" + (soap-l2wk (xml-node-name node))) + (let ((name (xml-get-attribute-or-nil node 'name)) + type) + ;; A schema element that contains an inline complex type -- + ;; construct the actual complex type for it. + (let ((type-node (soap-xml-get-children1 node 'xsd:complexType))) + (when (> (length type-node) 0) + (assert (= (length type-node) 1)) ; only one complex type definition per element + (setq type (soap-parse-complex-type (car type-node))))) + (setf (soap-element-name type) name) + type)) + +(defun soap-parse-complex-type (node) + "Parse NODE and construct a complex type from it." + (assert (eq (soap-l2wk (xml-node-name node)) 'xsd:complexType) + nil + "soap-parse-complex-type: expecting xsd:complexType node, got %s" + (soap-l2wk (xml-node-name node))) + (let ((name (xml-get-attribute-or-nil node 'name)) + ;; Use a dummy type for the complex type, it will be replaced + ;; with the real type below, except when the complex type node + ;; is empty... + (type (make-soap-sequence-type :elements nil))) + (dolist (c (xml-node-children node)) + (when (consp c) ; skip string nodes, which are whitespace + (let ((node-name (soap-l2wk (xml-node-name c)))) + (cond + ((eq node-name 'xsd:sequence) + (setq type (soap-parse-complex-type-sequence c))) + ((eq node-name 'xsd:complexContent) + (setq type (soap-parse-complex-type-complex-content c))) + ((eq node-name 'xsd:attribute) + ;; The name of this node comes from an attribute tag + (let ((n (xml-get-attribute-or-nil c 'name))) + (setq name n))) + (t + (error "Unknown node type %s" node-name)))))) + (setf (soap-element-name type) name) + type)) + +(defun soap-parse-sequence (node) + "Parse NODE and a list of sequence elements that it defines. +NODE is assumed to be an xsd:sequence node. In that case, each +of its children is assumed to be a sequence element. Each +sequence element is parsed constructing the corresponding type. +A list of these types is returned." + (assert (eq (soap-l2wk (xml-node-name node)) 'xsd:sequence) + nil + "soap-parse-sequence: expecting xsd:sequence node, got %s" + (soap-l2wk (xml-node-name node))) + (let (elements) + (dolist (e (soap-xml-get-children1 node 'xsd:element)) + (let ((name (xml-get-attribute-or-nil e 'name)) + (type (xml-get-attribute-or-nil e 'type)) + (nillable? (or (equal (xml-get-attribute-or-nil e 'nillable) "true") + (let ((e (xml-get-attribute-or-nil e 'minOccurs))) + (and e (equal e "0"))))) + (multiple? (let ((e (xml-get-attribute-or-nil e 'maxOccurs))) + (and e (not (equal e "1")))))) + (if type + (setq type (soap-l2fq type 'tns)) + + ;; The node does not have a type, maybe it has a complexType + ;; defined inline... + (let ((type-node (soap-xml-get-children1 e 'xsd:complexType))) + (when (> (length type-node) 0) + (assert (= (length type-node) 1) + nil + "only one complex type definition per element supported") + (setq type (soap-parse-complex-type (car type-node)))))) + + (push (make-soap-sequence-element + :name (intern name) :type type :nillable? nillable? :multiple? multiple?) + elements))) + (nreverse elements))) + +(defun soap-parse-complex-type-sequence (node) + "Parse NODE as a sequence type." + (let ((elements (soap-parse-sequence node))) + (make-soap-sequence-type :elements elements))) + +(defun soap-parse-complex-type-complex-content (node) + "Parse NODE as a xsd:complexContent node. +A sequence or an array type is returned depending on the actual +contents." + (assert (eq (soap-l2wk (xml-node-name node)) 'xsd:complexContent) + nil + "soap-parse-complex-type-complex-content: expecting xsd:complexContent node, got %s" + (soap-l2wk (xml-node-name node))) + (let (array? parent elements) + (let ((extension (car-safe (soap-xml-get-children1 node 'xsd:extension))) + (restriction (car-safe (soap-xml-get-children1 node 'xsd:restriction)))) + ;; a complex content node is either an extension or a restriction + (cond (extension + (setq parent (xml-get-attribute-or-nil extension 'base)) + (setq elements (soap-parse-sequence + (car (soap-xml-get-children1 extension 'xsd:sequence))))) + (restriction + (let ((base (xml-get-attribute-or-nil restriction 'base))) + (assert (equal base "soapenc:Array") + nil + "restrictions supported only for soapenc:Array types, this is a %s" + base)) + (setq array? t) + (let ((attribute (car (soap-xml-get-children1 restriction 'xsd:attribute)))) + (let ((array-type (soap-xml-get-attribute-or-nil1 attribute 'wsdl:arrayType))) + (when (string-match "^\\(.*\\)\\[\\]$" array-type) + (setq parent (match-string 1 array-type)))))) + + (t + (error "Unknown complex type")))) + + (if parent + (setq parent (soap-l2fq parent 'tns))) + + (if array? + (make-soap-array-type :element-type parent) + (make-soap-sequence-type :parent parent :elements elements)))) + +(defun soap-parse-message (node) + "Parse NODE as a wsdl:message and return the corresponding type." + (assert (eq (soap-l2wk (xml-node-name node)) 'wsdl:message) + nil + "soap-parse-message: expecting wsdl:message node, got %s" + (soap-l2wk (xml-node-name node))) + (let ((name (xml-get-attribute-or-nil node 'name)) + parts) + (dolist (p (soap-xml-get-children1 node 'wsdl:part)) + (let ((name (xml-get-attribute-or-nil p 'name)) + (type (xml-get-attribute-or-nil p 'type)) + (element (xml-get-attribute-or-nil p 'element))) + + (when type + (setq type (soap-l2fq type 'tns))) + + (when element + (setq element (soap-l2fq element 'tns))) + + (push (cons name (or type element)) parts))) + (make-soap-message :name name :parts (nreverse parts)))) + +(defun soap-parse-port-type (node) + "Parse NODE as a wsdl:portType and return the corresponding port." + (assert (eq (soap-l2wk (xml-node-name node)) 'wsdl:portType) + nil + "soap-parse-port-type: expecting wsdl:portType node got %s" + (soap-l2wk (xml-node-name node))) + (let ((ns (make-soap-namespace + :name (concat "urn:" (xml-get-attribute node 'name))))) + (dolist (node (soap-xml-get-children1 node 'wsdl:operation)) + (let ((o (soap-parse-operation node))) + + (let ((other-operation (soap-namespace-get (soap-element-name o) ns 'soap-operation-p))) + (if other-operation + ;; Unfortunately, the Confluence WSDL defines two operations + ;; named "search" which differ only in parameter names... + (soap-warning "Discarding duplicate operation: %s" (soap-element-name o)) + + (progn + (soap-namespace-put o ns) + + ;; link all messages from this namespace, as this namespace + ;; will be used for decoding the response. + (destructuring-bind (name . message) (soap-operation-input o) + (soap-namespace-put-link name message ns)) + + (destructuring-bind (name . message) (soap-operation-output o) + (soap-namespace-put-link name message ns)) + + (dolist (fault (soap-operation-faults o)) + (destructuring-bind (name . message) fault + (soap-namespace-put-link name message ns 'replace))) + + ))))) + + (make-soap-port-type :name (xml-get-attribute node 'name) + :operations ns))) + +(defun soap-parse-operation (node) + "Parse NODE as a wsdl:operation and return the corresponding type." + (assert (eq (soap-l2wk (xml-node-name node)) 'wsdl:operation) + nil + "soap-parse-operation: expecting wsdl:operation node, got %s" + (soap-l2wk (xml-node-name node))) + (let ((name (xml-get-attribute node 'name)) + (parameter-order (split-string (xml-get-attribute node 'parameterOrder))) + input output faults) + (dolist (n (xml-node-children node)) + (when (consp n) ; skip string nodes which are whitespace + (let ((node-name (soap-l2wk (xml-node-name n)))) + (cond + ((eq node-name 'wsdl:input) + (let ((message (xml-get-attribute n 'message)) + (name (xml-get-attribute n 'name))) + (setq input (cons name (soap-l2fq message 'tns))))) + ((eq node-name 'wsdl:output) + (let ((message (xml-get-attribute n 'message)) + (name (xml-get-attribute n 'name))) + (setq output (cons name (soap-l2fq message 'tns))))) + ((eq node-name 'wsdl:fault) + (let ((message (xml-get-attribute n 'message)) + (name (xml-get-attribute n 'name))) + (push (cons name (soap-l2fq message 'tns)) faults))))))) + (make-soap-operation + :name name + :parameter-order parameter-order + :input input + :output output + :faults (nreverse faults)))) + +(defun soap-parse-binding (node) + "Parse NODE as a wsdl:binding and return the corresponding type." + (assert (eq (soap-l2wk (xml-node-name node)) 'wsdl:binding) + nil + "soap-parse-binding: expecting wsdl:binding node, got %s" + (soap-l2wk (xml-node-name node))) + (let ((name (xml-get-attribute node 'name)) + (type (xml-get-attribute node 'type))) + (let ((binding (make-soap-binding :name name :port-type (soap-l2fq type 'tns)))) + (dolist (wo (soap-xml-get-children1 node 'wsdl:operation)) + (let ((name (xml-get-attribute wo 'name)) + soap-action + use) + (dolist (so (soap-xml-get-children1 wo 'wsdlsoap:operation)) + (setq soap-action (xml-get-attribute-or-nil so 'soapAction))) + + ;; Search a wsdlsoap:body node and find a "use" tag. The + ;; same use tag is assumed to be present for both input and + ;; output types (although the WDSL spec allows separate + ;; "use"-s for each of them... + + (dolist (i (soap-xml-get-children1 wo 'wsdl:input)) + (dolist (b (soap-xml-get-children1 i 'wsdlsoap:body)) + (setq use (or use + (xml-get-attribute-or-nil b 'use))))) + + (unless use + (dolist (i (soap-xml-get-children1 wo 'wsdl:output)) + (dolist (b (soap-xml-get-children1 i 'wsdlsoap:body)) + (setq use (or use + (xml-get-attribute-or-nil b 'use)))))) + + (puthash name (make-soap-bound-operation :operation name + :soap-action soap-action + :use (and use (intern use))) + (soap-binding-operations binding)))) + binding))) + +;;;; SOAP type decoding + +(defvar *soap-multi-refs* nil + "The list of multi-ref nodes in the current SOAP response. +This is a dynamically bound variable used during decoding the +SOAP response.") + +(defvar *soap-decoded-multi-refs* nil + "List of decoded multi-ref nodes in the current SOAP response. +This is a dynamically bound variable used during decoding the +SOAP response.") + +(defvar *soap-current-wsdl* nil + "The current WSDL document used when decoding the SOAP response. +This is a dynamically bound variable.") + +(defun soap-decode-type (type node) + "Use TYPE (an xsd type) to decode the contents of NODE. + +NODE is an XML node, representing some SOAP encoded value or a +reference to another XML node (a multiRef). This function will +resolve the multiRef reference, if any, than call a TYPE specific +decode function to perform the actual decoding." + (let ((href (xml-get-attribute-or-nil node 'href))) + (cond (href + (catch 'done + ;; NODE is actually a HREF, find the target and decode that. + ;; Check first if we already decoded this multiref. + + (let ((decoded (cdr (assoc href *soap-decoded-multi-refs*)))) + (when decoded + (throw 'done decoded))) + + (string-match "^#\\(.*\\)$" href) ; TODO: check that it matched + + (let ((id (match-string 1 href))) + (dolist (mr *soap-multi-refs*) + (let ((mrid (xml-get-attribute mr 'id))) + (when (equal id mrid) + ;; recurse here, in case there are multiple HREF's + (let ((decoded (soap-decode-type type mr))) + (push (cons href decoded) *soap-decoded-multi-refs*) + (throw 'done decoded))))) + (error "Cannot find href %s" href)))) + (t + (soap-with-local-xmlns node + (if (equal (soap-xml-get-attribute-or-nil1 node 'xsi:nil) "true") + nil + (let ((decoder (get (aref type 0) 'soap-decoder))) + (assert decoder nil "no soap-decoder for %s type" (aref type 0)) + (funcall decoder type node)))))))) + +(defun soap-decode-any-type (node) + "Decode NODE using type information inside it." + ;; If the NODE has type information, we use that... + (let ((type (soap-xml-get-attribute-or-nil1 node 'xsi:type))) + (if type + (let ((wtype (soap-wsdl-get type *soap-current-wsdl* 'soap-type-p))) + (if wtype + (soap-decode-type wtype node) + ;; The node has type info encoded in it, but we don't know how + ;; to decode it... + (error "Soap-decode-any-type: node has unknown type: %s" type))) + + ;; No type info in the node... + + (let ((contents (xml-node-children node))) + (if (and (= (length contents) 1) (stringp (car contents))) + ;; contents is just a string + (car contents) + + ;; we assume the NODE is a sequence with every element a + ;; structure name + (let (result) + (dolist (element contents) + (let ((key (xml-node-name element)) + (value (soap-decode-any-type element))) + (push (cons key value) result))) + (nreverse result))))))) + +(defun soap-decode-array (node) + "Decode NODE as an Array using type information inside it." + (let ((type (soap-xml-get-attribute-or-nil1 node 'soapenc:arrayType)) + (wtype nil) + (contents (xml-node-children node)) + result) + (when type + ;; Type is in the format "someType[NUM]" where NUM is the number of + ;; elements in the array. We discard the [NUM] part. + (setq type (replace-regexp-in-string "\\[[0-9]+\\]\\'" "" type)) + (setq wtype (soap-wsdl-get type *soap-current-wsdl* 'soap-type-p)) + (unless wtype + ;; The node has type info encoded in it, but we don't know how to + ;; decode it... + (error "Soap-decode-array: node has unknown type: %s" type))) + (dolist (e contents) + (when (consp e) + (push (if wtype + (soap-decode-type wtype e) + (soap-decode-any-type e)) + result))) + (nreverse result))) + +(defun soap-decode-basic-type (type node) + "Use TYPE to decode the contents of NODE. +TYPE is a `soap-basic-type' struct, and NODE is an XML document. +A LISP value is returned based on the contents of NODE and the +type-info stored in TYPE." + (let ((contents (xml-node-children node)) + (type-kind (soap-basic-type-kind type))) + + (if (null contents) + nil + (ecase type-kind + (string (car contents)) + (dateTime (car contents)) ; TODO: convert to a date time + ((long int float) (string-to-number (car contents))) + (boolean (string= (downcase (car contents)) "true")) + (base64Binary (base64-decode-string (car contents))) + (anyType (soap-decode-any-type node)) + (Array (soap-decode-array node)))))) + +(defun soap-decode-sequence-type (type node) + "Use TYPE to decode the contents of NODE. +TYPE is assumed to be a sequence type and an ALIST with the +contents of the NODE is returned." + (let ((result nil) + (parent (soap-sequence-type-parent type))) + (when parent + (setq result (nreverse (soap-decode-type parent node)))) + (dolist (element (soap-sequence-type-elements type)) + (let ((instance-count 0) + (e-name (soap-sequence-element-name element)) + (e-type (soap-sequence-element-type element))) + (dolist (node (xml-get-children node e-name)) + (incf instance-count) + (push (cons e-name (soap-decode-type e-type node)) result)) + ;; Do some sanity checking + (cond ((and (= instance-count 0) + (not (soap-sequence-element-nillable? element))) + (soap-warning "While decoding %s: missing non-nillable slot %s" + (soap-element-name type) e-name)) + ((and (> instance-count 1) + (not (soap-sequence-element-multiple? element))) + (soap-warning "While decoding %s: multiple slots named %s" + (soap-element-name type) e-name))))) + (nreverse result))) + +(defun soap-decode-array-type (type node) + "Use TYPE to decode the contents of NODE. +TYPE is assumed to be an array type. Arrays are decoded as lists. +This is because it is easier to work with list results in LISP." + (let ((result nil) + (element-type (soap-array-type-element-type type))) + (dolist (node (xml-node-children node)) + (when (consp node) + (push (soap-decode-type element-type node) result))) + (nreverse result))) + +(progn + (put (aref (make-soap-basic-type) 0) + 'soap-decoder 'soap-decode-basic-type) + (put (aref (make-soap-sequence-type) 0) + 'soap-decoder 'soap-decode-sequence-type) + (put (aref (make-soap-array-type) 0) + 'soap-decoder 'soap-decode-array-type)) + +;;;; Soap Envelope parsing + +(put 'soap-error + 'error-conditions + '(error soap-error)) +(put 'soap-error 'error-message "SOAP error") + +(defun soap-parse-envelope (node operation wsdl) + "Parse the SOAP envelope in NODE and return the response. +OPERATION is the WSDL operation for which we expect the response, +WSDL is used to decode the NODE" + (soap-with-local-xmlns node + (assert (eq (soap-l2wk (xml-node-name node)) 'soap:Envelope) + nil + "soap-parse-envelope: expecting soap:Envelope node, got %s" + (soap-l2wk (xml-node-name node))) + (let ((body (car (soap-xml-get-children1 node 'soap:Body)))) + + (let ((fault (car (soap-xml-get-children1 body 'soap:Fault)))) + (when fault + (let ((fault-code (let ((n (car (xml-get-children fault 'faultcode)))) + (car-safe (xml-node-children n)))) + (fault-string (let ((n (car (xml-get-children fault 'faultstring)))) + (car-safe (xml-node-children n))))) + (while t + (signal 'soap-error (list fault-code fault-string)))))) + + ;; First (non string) element of the body is the root node of he + ;; response + (let ((response (if (eq (soap-bound-operation-use operation) 'literal) + ;; For 'literal uses, the response is the actual body + body + ;; ...otherwise the first non string element + ;; of the body is the response + (catch 'found + (dolist (n (xml-node-children body)) + (when (consp n) + (throw 'found n))))))) + (soap-parse-response response operation wsdl body))))) + +(defun soap-parse-response (response-node operation wsdl soap-body) + "Parse RESPONSE-NODE and return the result as a LISP value. +OPERATION is the WSDL operation for which we expect the response, +WSDL is used to decode the NODE. + +SOAP-BODY is the body of the SOAP envelope (of which +RESPONSE-NODE is a sub-node). It is used in case RESPONSE-NODE +reference multiRef parts which are external to RESPONSE-NODE." + (let* ((*soap-current-wsdl* wsdl) + (op (soap-bound-operation-operation operation)) + (use (soap-bound-operation-use operation)) + (message (cdr (soap-operation-output op)))) + + (soap-with-local-xmlns response-node + + (when (eq use 'encoded) + (let* ((received-message-name (soap-l2fq (xml-node-name response-node))) + (received-message (soap-wsdl-get received-message-name wsdl 'soap-message-p))) + (unless (eq received-message message) + (error "Unexpected message: got %s, expecting %s" + received-message-name + (soap-element-name message))))) + + (let ((decoded-parts nil) + (*soap-multi-refs* (xml-get-children soap-body 'multiRef)) + (*soap-decoded-multi-refs* nil)) + + (dolist (part (soap-message-parts message)) + (let ((tag (car part)) + (type (cdr part)) + node) + + (setq node + (cond + ((eq use 'encoded) + (car (xml-get-children response-node tag))) + + ((eq use 'literal) + (catch 'found + (let* ((ns-aliases (soap-wsdl-alias-table wsdl)) + (ns-name (cdr (assoc (soap-element-namespace-tag type) ns-aliases))) + (fqname (cons ns-name (soap-element-name type)))) + (dolist (c (xml-node-children response-node)) + (when (consp c) + (soap-with-local-xmlns c + (when (equal (soap-l2fq (xml-node-name c)) fqname) + (throw 'found c)))))))))) + + (unless node + (error "Soap-parse-response(%s): cannot find message part %s" + (soap-element-name op) tag)) + (push (soap-decode-type type node) decoded-parts))) + + decoded-parts)))) + +;;;; SOAP type encoding + +(defvar *soap-encoded-namespaces* nil + "A list of namespace tags used during encoding a message. +This list is populated by `soap-encode-value' and used by +`soap-create-envelope' to add aliases for these namespace to the +XML request. + +This variable is dynamically bound in `soap-create-envelope'.") + +(defun soap-encode-value (xml-tag value type) + "Encode inside an XML-TAG the VALUE using TYPE. +The resulting XML data is inserted in the current buffer +at (point)/ + +TYPE is one of the soap-*-type structures which defines how VALUE +is to be encoded. This is a generic function which finds an +encoder function based on TYPE and calls that encoder to do the +work." + (let ((encoder (get (aref type 0) 'soap-encoder))) + (assert encoder nil "no soap-encoder for %s type" (aref type 0)) + ;; XML-TAG can be a string or a symbol, but we pass only string's to the + ;; encoders + (when (symbolp xml-tag) + (setq xml-tag (symbol-name xml-tag))) + (funcall encoder xml-tag value type)) + (add-to-list '*soap-encoded-namespaces* (soap-element-namespace-tag type))) + +(defun soap-encode-basic-type (xml-tag value type) + "Encode inside XML-TAG the LISP VALUE according to TYPE. +Do not call this function directly, use `soap-encode-value' +instead." + (let ((xsi-type (soap-element-fq-name type)) + (basic-type (soap-basic-type-kind type))) + + ;; try to classify the type based on the value type and use that type when + ;; encoding + (when (eq basic-type 'anyType) + (cond ((stringp value) + (setq xsi-type "xsd:string" basic-type 'string)) + ((integerp value) + (setq xsi-type "xsd:int" basic-type 'int)) + ((memq value '(t nil)) + (setq xsi-type "xsd:boolean" basic-type 'boolean)) + (t + (error "Soap-encode-basic-type(%s, %s, %s): cannot classify anyType value" + xml-tag value xsi-type)))) + + (insert "<" xml-tag " xsi:type=\"" xsi-type "\"") + + ;; We have some ambiguity here, as a nil value represents "false" when the + ;; type is boolean, we will never have a "nil" boolean type... + + (if (or value (eq basic-type 'boolean)) + (progn + (insert ">") + (case basic-type + (string + (unless (stringp value) + (error "Soap-encode-basic-type(%s, %s, %s): not a string value" + xml-tag value xsi-type)) + (insert (url-insert-entities-in-string value))) + + (dateTime + (cond ((and (consp value) ; is there a time-value-p ? + (>= (length value) 2) + (numberp (nth 0 value)) + (numberp (nth 1 value))) + ;; Value is a (current-time) style value, convert to a string + (insert (format-time-string "%Y-%m-%dT%H:%M:%S" value))) + ((stringp value) + (insert (url-insert-entities-in-string value))) + (t + (error "Soap-encode-basic-type(%s, %s, %s): not a dateTime value" + xml-tag value xsi-type)))) + + (boolean + (unless (memq value '(t nil)) + (error "Soap-encode-basic-type(%s, %s, %s): not a boolean value" + xml-tag value xsi-type)) + (insert (if value "true" "false"))) + + ((long int) + (unless (integerp value) + (error "Soap-encode-basic-type(%s, %s, %s): not an integer value" + xml-tag value xsi-type)) + (insert (number-to-string value))) + + (base64Binary + (unless (stringp value) + (error "Soap-encode-basic-type(%s, %s, %s): not a string value" + xml-tag value xsi-type)) + (insert (base64-encode-string value))) + + (otherwise + (error "Soap-encode-basic-type(%s, %s, %s): don't know how to encode" + xml-tag value xsi-type)))) + + (insert " xsi:nil=\"true\">")) + (insert "\n"))) + +(defun soap-encode-sequence-type (xml-tag value type) + "Encode inside XML-TAG the LISP VALUE according to TYPE. +Do not call this function directly, use `soap-encode-value' +instead." + (let ((xsi-type (soap-element-fq-name type))) + (insert "<" xml-tag " xsi:type=\"" xsi-type "\"") + (if value + (progn + (insert ">\n") + (let ((parents (list type)) + (parent (soap-sequence-type-parent type))) + + (while parent + (push parent parents) + (setq parent (soap-sequence-type-parent parent))) + + (dolist (type parents) + (dolist (element (soap-sequence-type-elements type)) + (let ((instance-count 0) + (e-name (soap-sequence-element-name element)) + (e-type (soap-sequence-element-type element))) + (dolist (v value) + (when (equal (car v) e-name) + (incf instance-count) + (soap-encode-value e-name (cdr v) e-type))) + + ;; Do some sanity checking + (cond ((and (= instance-count 0) + (not (soap-sequence-element-nillable? element))) + (soap-warning "While encoding %s: missing non-nillable slot %s" + (soap-element-name type) e-name)) + ((and (> instance-count 1) + (not (soap-sequence-element-multiple? element))) + (soap-warning "While encoding %s: multiple slots named %s" + (soap-element-name type) e-name)))))))) + (insert " xsi:nil=\"true\">")) + (insert "\n"))) + +(defun soap-encode-array-type (xml-tag value type) + "Encode inside XML-TAG the LISP VALUE according to TYPE. +Do not call this function directly, use `soap-encode-value' +instead." + (unless (vectorp value) + (error "Soap-encode: %s(%s) expects a vector, got: %s" + xml-tag (soap-element-fq-name type) value)) + (let* ((element-type (soap-array-type-element-type type)) + (array-type (concat (soap-element-fq-name element-type) + "[" (format "%s" (length value)) "]"))) + (insert "<" xml-tag + " soapenc:arrayType=\"" array-type "\" " + " xsi:type=\"soapenc:Array\">\n") + (loop for i below (length value) + do (soap-encode-value xml-tag (aref value i) element-type)) + (insert "\n"))) + +(progn + (put (aref (make-soap-basic-type) 0) + 'soap-encoder 'soap-encode-basic-type) + (put (aref (make-soap-sequence-type) 0) + 'soap-encoder 'soap-encode-sequence-type) + (put (aref (make-soap-array-type) 0) + 'soap-encoder 'soap-encode-array-type)) + +(defun soap-encode-body (operation parameters wsdl) + "Create the body of a SOAP request for OPERATION in the current buffer. +PARAMETERS is a list of parameters supplied to the OPERATION. + +The OPERATION and PARAMETERS are encoded according to the WSDL +document." + (let* ((op (soap-bound-operation-operation operation)) + (use (soap-bound-operation-use operation)) + (message (cdr (soap-operation-input op))) + (parameter-order (soap-operation-parameter-order op))) + + (unless (= (length parameter-order) (length parameters)) + (error "Wrong number of parameters for %s: expected %d, got %s" + (soap-element-name op) + (length parameter-order) + (length parameters))) + + (insert "\n") + (when (eq use 'encoded) + (add-to-list '*soap-encoded-namespaces* (soap-element-namespace-tag op)) + (insert "<" (soap-element-fq-name op) ">\n")) + + (let ((param-table (loop for formal in parameter-order + for value in parameters + collect (cons formal value)))) + (dolist (part (soap-message-parts message)) + (let* ((param-name (car part)) + (type (cdr part)) + (tag-name (if (eq use 'encoded) + param-name + (soap-element-name type))) + (value (cdr (assoc param-name param-table))) + (start-pos (point))) + (soap-encode-value tag-name value type) + (when (eq use 'literal) + ;; hack: add the xmlns attribute to the tag, the only way + ;; ASP.NET web services recognize the namespace of the + ;; element itself... + (save-excursion + (goto-char start-pos) + (when (re-search-forward " ") + (let* ((ns (soap-element-namespace-tag type)) + (namespace (cdr (assoc ns (soap-wsdl-alias-table wsdl))))) + (when namespace + (insert "xmlns=\"" namespace "\" "))))))))) + + (when (eq use 'encoded) + (insert "\n")) + (insert "\n"))) + +(defun soap-create-envelope (operation parameters wsdl) + "Create a SOAP request envelope for OPERATION using PARAMETERS. +WSDL is the wsdl document used to encode the PARAMETERS." + (with-temp-buffer + (let ((*soap-encoded-namespaces* '("xsi" "soap" "soapenc")) + (use (soap-bound-operation-use operation))) + + ;; Create the request body + (soap-encode-body operation parameters wsdl) + + ;; Put the envelope around the body + (goto-char (point-min)) + (insert "\n\n") + (goto-char (point-max)) + (insert "\n")) + + (buffer-string))) + +;;;; invoking soap methods + +(defcustom soap-debug nil + "When t, enable some debugging facilities." + :type 'boolean + :group 'soap-client) + +(defun soap-invoke (wsdl service operation-name &rest parameters) + "Invoke a SOAP operation and return the result. + +WSDL is used for encoding the request and decoding the response. +It also contains information about the WEB server address that +will service the request. + +SERVICE is the SOAP service to invoke. + +OPERATION-NAME is the operation to invoke. + +PARAMETERS -- the remaining parameters are used as parameters for +the SOAP request. + +NOTE: The SOAP service provider should document the available +operations and their parameters for the service. You can also +use the `soap-inspect' function to browse the available +operations in a WSDL document." + (let ((port (catch 'found + (dolist (p (soap-wsdl-ports wsdl)) + (when (equal service (soap-element-name p)) + (throw 'found p)))))) + (unless port + (error "Unknown SOAP service: %s" service)) + + (let* ((binding (soap-port-binding port)) + (operation (gethash operation-name (soap-binding-operations binding)))) + (unless operation + (error "No operation %s for SOAP service %s" operation-name service)) + + (let ((url-request-method "POST") + (url-package-name "soap-client.el") + (url-package-version "1.0") + (url-http-version "1.0") + (url-request-data (soap-create-envelope operation parameters wsdl)) + (url-mime-charset-string "utf-8;q=1, iso-8859-1;q=0.5") + (url-request-coding-system 'utf-8) + (url-http-attempt-keepalives t) + (url-request-extra-headers (list + (cons "SOAPAction" (soap-bound-operation-soap-action operation)) + (cons "Content-Type" "text/xml; charset=utf-8")))) + (let ((buffer (url-retrieve-synchronously (soap-port-service-url port)))) + (condition-case err + (with-current-buffer buffer + (declare (special url-http-response-status)) + (if (null url-http-response-status) + (error "No HTTP response from server")) + (if (and soap-debug (> url-http-response-status 299)) + ;; This is a warning because some SOAP errors come + ;; back with a HTTP response 500 (internal server + ;; error) + (warn "Error in SOAP response: HTTP code %s" url-http-response-status)) + (when (> (buffer-size) 1000000) + (soap-warning "Received large message: %s bytes" (buffer-size))) + (let ((mime-part (mm-dissect-buffer t t))) + (unless mime-part + (error "Failed to decode response from server")) + (unless (equal (car (mm-handle-type mime-part)) "text/xml") + (error "Server response is not an XML document")) + (with-temp-buffer + (mm-insert-part mime-part) + (let ((response (car (xml-parse-region (point-min) (point-max))))) + (prog1 + (soap-parse-envelope response operation wsdl) + (kill-buffer buffer) + (mm-destroy-part mime-part)))))) + (soap-error + ;; Propagate soap-errors -- they are error replies of the + ;; SOAP protocol and don't indicate a communication + ;; problem or a bug in this code. + (signal (car err) (cdr err))) + (error + (when soap-debug + (pop-to-buffer buffer)) + (error (error-message-string err))))))))) + +(provide 'soap-client) + + +;;; Local Variables: +;;; mode: emacs-lisp +;;; mode: outline-minor +;;; outline-regexp: ";;;;+" +;;; End: + +;;; soap-client.el ends here diff --git a/lisp/net/soap-inspect.el b/lisp/net/soap-inspect.el new file mode 100644 index 00000000000..4ea6bef0d8c --- /dev/null +++ b/lisp/net/soap-inspect.el @@ -0,0 +1,352 @@ +;;;; soap-inspect.el -- Interactive inspector for soap WSDL structures + +;; Copyright (C) 2010-2011 Alex Harsanyi + +;; 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 . + +;; Author: Alexandru Harsanyi (AlexHarsanyi@gmail.com) +;; Created: October 2010 +;; Keywords: soap, web-services +;; Homepage: http://code.google.com/p/emacs-soap-client +;; + +;;; Commentary: +;; +;; This package provides an inspector for a WSDL document loaded with +;; `soap-load-wsdl' or `soap-load-wsdl-from-url'. To use it, evaluate: +;; +;; (soap-inspect *wsdl*) +;; +;; This will pop-up the inspector buffer. You can click on ports, operations +;; and types to explore the structure of the wsdl document. +;; + +(require 'soap-client) + + +;;; Code: + +;;; sample-value + +(defun soap-sample-value (type) + "Provide a sample value for TYPE, a WSDL type. +A sample value is a LISP value which soap-client.el will accept +for encoding it using TYPE when making SOAP requests. + +This is a generic function, depending on TYPE a specific function +will be called." + (let ((sample-value (get (aref type 0) 'soap-sample-value))) + (if sample-value + (funcall sample-value type) + (error "Cannot provide sample value for type %s" (aref type 0))))) + +(defun soap-sample-value-for-basic-type (type) + "Provide a sample value for TYPE which is a basic type. +This is a specific function which should not be called directly, +use `soap-sample-value' instead." + (case (soap-basic-type-kind type) + (string "a string value") + (boolean t) ; could be nil as well + ((long int) (random 4200)) + ;; TODO: we need better sample values for more types. + (t (format "%s" (soap-basic-type-kind type))))) + +(defun soap-sample-value-for-seqence-type (type) + "Provide a sample value for TYPE which is a sequence type. +Values for sequence types are ALISTS of (slot-name . VALUE) for +each sequence element. + +This is a specific function which should not be called directly, +use `soap-sample-value' instead." + (let ((sample-value nil)) + (dolist (element (soap-sequence-type-elements type)) + (push (cons (soap-sequence-element-name element) + (soap-sample-value (soap-sequence-element-type element))) + sample-value)) + (when (soap-sequence-type-parent type) + (setq sample-value + (append (soap-sample-value (soap-sequence-type-parent type)) + sample-value))) + sample-value)) + +(defun soap-sample-value-for-array-type (type) + "Provide a sample value for TYPE which is an array type. +Values for array types are LISP vectors of values which are +array's element type. + +This is a specific function which should not be called directly, +use `soap-sample-value' instead." + (let* ((element-type (soap-array-type-element-type type)) + (sample1 (soap-sample-value element-type)) + (sample2 (soap-sample-value element-type))) + ;; Our sample value is a vector of two elements, but any number of + ;; elements are permissible + (vector sample1 sample2 '&etc))) + +(defun soap-sample-value-for-message (message) + "Provide a sample value for a WSDL MESSAGE. +This is a specific function which should not be called directly, +use `soap-sample-value' instead." + ;; NOTE: parameter order is not considered. + (let (sample-value) + (dolist (part (soap-message-parts message)) + (push (cons (car part) + (soap-sample-value (cdr part))) + sample-value)) + (nreverse sample-value))) + +(progn + ;; Install soap-sample-value methods for our types + (put (aref (make-soap-basic-type) 0) 'soap-sample-value + 'soap-sample-value-for-basic-type) + + (put (aref (make-soap-sequence-type) 0) 'soap-sample-value + 'soap-sample-value-for-seqence-type) + + (put (aref (make-soap-array-type) 0) 'soap-sample-value + 'soap-sample-value-for-array-type) + + (put (aref (make-soap-message) 0) 'soap-sample-value + 'soap-sample-value-for-message) ) + + + +;;; soap-inspect + +(defvar soap-inspect-previous-items nil + "A stack of previously inspected items in the *soap-inspect* buffer. +Used to implement the BACK button.") + +(defvar soap-inspect-current-item nil + "The current item being inspected in the *soap-inspect* buffer.") + +(progn + (make-variable-buffer-local 'soap-inspect-previous-items) + (make-variable-buffer-local 'soap-inspect-current-item)) + +(defun soap-inspect (element) + "Inspect a SOAP ELEMENT in the *soap-inspect* buffer. +The buffer is populated with information about ELEMENT with links +to its sub elements. If ELEMENT is the WSDL document itself, the +entire WSDL can be inspected." + (let ((inspect (get (aref element 0) 'soap-inspect))) + (unless inspect + (error "Soap-inspect: no inspector for element")) + + (with-current-buffer (get-buffer-create "*soap-inspect*") + (setq buffer-read-only t) + (let ((inhibit-read-only t)) + (erase-buffer) + + (when soap-inspect-current-item + (push soap-inspect-current-item + soap-inspect-previous-items)) + (setq soap-inspect-current-item element) + + (funcall inspect element) + + (unless (null soap-inspect-previous-items) + (insert "\n\n") + (insert-text-button + "[back]" + 'type 'soap-client-describe-back-link + 'item element) + (insert "\n")) + (goto-char (point-min)) + (pop-to-buffer (current-buffer)))))) + + +(define-button-type 'soap-client-describe-link + 'face 'italic + 'help-echo "mouse-2, RET: describe item" + 'follow-link t + 'action (lambda (button) + (let ((item (button-get button 'item))) + (soap-inspect item))) + 'skip t) + +(define-button-type 'soap-client-describe-back-link + 'face 'italic + 'help-echo "mouse-2, RET: browse the previous item" + 'follow-link t + 'action (lambda (button) + (let ((item (pop soap-inspect-previous-items))) + (when item + (setq soap-inspect-current-item nil) + (soap-inspect item)))) + 'skip t) + +(defun soap-insert-describe-button (element) + "Insert a button to inspect ELEMENT when pressed." + (insert-text-button + (soap-element-fq-name element) + 'type 'soap-client-describe-link + 'item element)) + +(defun soap-inspect-basic-type (basic-type) + "Insert information about BASIC-TYPE into the current buffer." + (insert "Basic type: " (soap-element-fq-name basic-type)) + (insert "\nSample value\n") + (pp (soap-sample-value basic-type) (current-buffer))) + +(defun soap-inspect-sequence-type (sequence) + "Insert information about SEQUENCE into the current buffer." + (insert "Sequence type: " (soap-element-fq-name sequence) "\n") + (when (soap-sequence-type-parent sequence) + (insert "Parent: ") + (soap-insert-describe-button + (soap-sequence-type-parent sequence)) + (insert "\n")) + (insert "Elements: \n") + (dolist (element (soap-sequence-type-elements sequence)) + (insert "\t" (symbol-name (soap-sequence-element-name element)) + "\t") + (soap-insert-describe-button + (soap-sequence-element-type element)) + (when (soap-sequence-element-multiple? element) + (insert " multiple")) + (when (soap-sequence-element-nillable? element) + (insert " optional")) + (insert "\n")) + (insert "Sample value:\n") + (pp (soap-sample-value sequence) (current-buffer))) + +(defun soap-inspect-array-type (array) + "Insert information about the ARRAY into the current buffer." + (insert "Array name: " (soap-element-fq-name array) "\n") + (insert "Element type: ") + (soap-insert-describe-button + (soap-array-type-element-type array)) + (insert "\nSample value:\n") + (pp (soap-sample-value array) (current-buffer))) + +(defun soap-inspect-message (message) + "Insert information about MESSAGE into the current buffer." + (insert "Message name: " (soap-element-fq-name message) "\n") + (insert "Parts:\n") + (dolist (part (soap-message-parts message)) + (insert "\t" (symbol-name (car part)) + " type: ") + (soap-insert-describe-button (cdr part)) + (insert "\n"))) + +(defun soap-inspect-operation (operation) + "Insert information about OPERATION into the current buffer." + (insert "Operation name: " (soap-element-fq-name operation) "\n") + (let ((input (soap-operation-input operation))) + (insert "\tInput: " (symbol-name (car input)) " (" ) + (soap-insert-describe-button (cdr input)) + (insert ")\n")) + (let ((output (soap-operation-output operation))) + (insert "\tOutput: " (symbol-name (car output)) " (") + (soap-insert-describe-button (cdr output)) + (insert ")\n")) + + (insert "\n\nSample invocation:\n") + (let ((sample-message-value (soap-sample-value (cdr (soap-operation-input operation)))) + (funcall (list 'soap-invoke '*WSDL* "SomeService" (soap-element-name operation)))) + (let ((sample-invocation (append funcall (mapcar 'cdr sample-message-value)))) + (pp sample-invocation (current-buffer))))) + +(defun soap-inspect-port-type (port-type) + "Insert information about PORT-TYPE into the current buffer." + (insert "Port-type name: " (soap-element-fq-name port-type) "\n") + (insert "Operations:\n") + (loop for o being the hash-values of + (soap-namespace-elements (soap-port-type-operations port-type)) + do (progn + (insert "\t") + (soap-insert-describe-button (car o))))) + +(defun soap-inspect-binding (binding) + "Insert information about BINDING into the current buffer." + (insert "Binding: " (soap-element-fq-name binding) "\n") + (insert "\n") + (insert "Bound operations:\n") + (let* ((ophash (soap-binding-operations binding)) + (operations (loop for o being the hash-keys of ophash + collect o)) + op-name-width) + + (setq operations (sort operations 'string<)) + + (setq op-name-width (loop for o in operations maximizing (length o))) + + (dolist (op operations) + (let* ((bound-op (gethash op ophash)) + (soap-action (soap-bound-operation-soap-action bound-op)) + (use (soap-bound-operation-use bound-op))) + (unless soap-action + (setq soap-action "")) + (insert "\t") + (soap-insert-describe-button (soap-bound-operation-operation bound-op)) + (when (or use (not (equal soap-action ""))) + (insert (make-string (- op-name-width (length op)) ?\s)) + (insert " (") + (insert soap-action) + (when use + (insert " " (symbol-name use))) + (insert ")")) + (insert "\n"))))) + +(defun soap-inspect-port (port) + "Insert information about PORT into the current buffer." + (insert "Port name: " (soap-element-name port) "\n" + "Service URL: " (soap-port-service-url port) "\n" + "Binding: ") + (soap-insert-describe-button (soap-port-binding port))) + +(defun soap-inspect-wsdl (wsdl) + "Insert information about WSDL into the current buffer." + (insert "WSDL Origin: " (soap-wsdl-origin wsdl) "\n") + (insert "Ports:") + (dolist (p (soap-wsdl-ports wsdl)) + (insert "\n--------------------\n") + ;; (soap-insert-describe-button p) + (soap-inspect-port p)) + (insert "\n--------------------\nNamespace alias table:\n") + (dolist (a (soap-wsdl-alias-table wsdl)) + (insert "\t" (car a) " => " (cdr a) "\n"))) + +(progn + ;; Install the soap-inspect methods for our types + + (put (aref (make-soap-basic-type) 0) 'soap-inspect + 'soap-inspect-basic-type) + + (put (aref (make-soap-sequence-type) 0) 'soap-inspect + 'soap-inspect-sequence-type) + + (put (aref (make-soap-array-type) 0) 'soap-inspect + 'soap-inspect-array-type) + + (put (aref (make-soap-message) 0) 'soap-inspect + 'soap-inspect-message) + (put (aref (make-soap-operation) 0) 'soap-inspect + 'soap-inspect-operation) + + (put (aref (make-soap-port-type) 0) 'soap-inspect + 'soap-inspect-port-type) + + (put (aref (make-soap-binding) 0) 'soap-inspect + 'soap-inspect-binding) + + (put (aref (make-soap-port) 0) 'soap-inspect + 'soap-inspect-port) + + (put (aref (make-soap-wsdl) 0) 'soap-inspect + 'soap-inspect-wsdl)) + +(provide 'soap-inspect) +;;; soap-inspect.el ends here From 4b4deea229a39c94762dcf49da538b639df59148 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 16 Feb 2011 08:02:50 -0700 Subject: [PATCH 09/46] Change B_ to BVAR * xfns.c (x_create_tip_frame, Fx_show_tip): Replace B_ with BVAR. * xfaces.c (compute_char_face): Replace B_ with BVAR. * xdisp.c (pos_visible_p, init_iterator, reseat_1) (message_dolog, update_echo_area, ensure_echo_area_buffers) (with_echo_area_buffer, setup_echo_area_for_printing) (set_message_1, update_menu_bar, update_tool_bar) (text_outside_line_unchanged_p, redisplay_internal) (try_scrolling, try_cursor_movement, redisplay_window) (try_window_reusing_current_matrix, row_containing_pos) (try_window_id, get_overlay_arrow_glyph_row, display_line) (Fcurrent_bidi_paragraph_direction, display_mode_lines) (decode_mode_spec_coding, decode_mode_spec, display_count_lines) (get_window_cursor_type, note_mouse_highlight): Replace B_ with BVAR. * window.c (window_display_table, unshow_buffer, window_loop) (window_min_size_2, set_window_buffer, Fset_window_buffer) (select_window, Fforce_window_update, temp_output_buffer_show) (Fset_window_configuration, save_window_save): Replace B_ with BVAR. * w32fns.c (x_create_tip_frame, Fx_show_tip, Fw32_shell_execute): Replace B_ with BVAR. * undo.c (record_point, record_insert, record_delete) (record_marker_adjustment, record_first_change) (record_property_change, Fundo_boundary, truncate_undo_list) (Fprimitive_undo): Replace B_ with BVAR. * syntax.h (Vstandard_syntax_table, CURRENT_SYNTAX_TABLE) (SETUP_BUFFER_SYNTAX_TABLE): Replace B_ with BVAR. * syntax.c (update_syntax_table, dec_bytepos, Fsyntax_table) (Fset_syntax_table, Fmodify_syntax_entry, skip_chars) (skip_syntaxes, scan_lists): Replace B_ with BVAR. * search.c (compile_pattern_1, compile_pattern, looking_at_1) (string_match_1, fast_looking_at, newline_cache_on_off) (search_command, search_buffer, simple_search, boyer_moore) (Freplace_match): Replace B_ with BVAR. * process.c (get_process, list_processes_1, Fstart_process) (Fmake_serial_process, Fmake_network_process) (read_process_output, send_process, exec_sentinel) (status_notify, setup_process_coding_systems): Replace B_ with BVAR. * print.c (PRINTDECLARE, PRINTPREPARE, PRINTFINISH, printchar) (strout, print_string, temp_output_buffer_setup, print_object): Replace B_ with BVAR. * msdos.c (IT_frame_up_to_date): Replace B_ with BVAR. * minibuf.c (read_minibuf, get_minibuffer, Fread_buffer): Replace B_ with BVAR. * marker.c (Fmarker_buffer, Fset_marker, set_marker_restricted) (set_marker_both, set_marker_restricted_both, unchain_marker): Replace B_ with BVAR. * lread.c (readchar, unreadchar, openp, readevalloop) (Feval_buffer, Feval_region): Replace B_ with BVAR. * lisp.h (DOWNCASE_TABLE, UPCASE_TABLE): Replace B_ with BVAR. * keymap.c (Flocal_key_binding, Fuse_local_map) (Fcurrent_local_map, push_key_description) (Fdescribe_buffer_bindings): Replace B_ with BVAR. * keyboard.c (command_loop_1, read_char_minibuf_menu_prompt) (read_key_sequence): Replace B_ with BVAR. * intervals.h (TEXT_PROP_MEANS_INVISIBLE): Replace B_ with BVAR. * intervals.c (set_point_both, get_local_map): Replace B_ with BVAR. * insdel.c (check_markers, insert_char, insert_1_both) (insert_from_string_1, insert_from_gap, insert_from_buffer_1) (adjust_after_replace, replace_range, del_range_2) (modify_region, prepare_to_modify_buffer) (Fcombine_after_change_execute): Replace B_ with BVAR. * indent.c (buffer_display_table, recompute_width_table) (width_run_cache_on_off, current_column, scan_for_column) (Findent_to, position_indentation, compute_motion, vmotion): Replace B_ with BVAR. * fringe.c (get_logical_cursor_bitmap) (get_logical_fringe_bitmap, update_window_fringes): Replace B_ with BVAR. * frame.c (make_frame_visible_1): Replace B_ with BVAR. * font.c (font_at): Replace B_ with BVAR. * fns.c (Fbase64_encode_region, Fbase64_decode_region, Fmd5): Replace B_ with BVAR. * filelock.c (unlock_all_files, Flock_buffer, Funlock_buffer) (unlock_buffer): Replace B_ with BVAR. * fileio.c (Fexpand_file_name, Ffile_directory_p) (Ffile_regular_p, Ffile_selinux_context) (Fset_file_selinux_context, Ffile_modes, Fset_file_modes) (Fset_file_times, Ffile_newer_than_file_p, decide_coding_unwind) (Finsert_file_contents, choose_write_coding_system) (Fwrite_region, build_annotations, Fverify_visited_file_modtime) (Fset_visited_file_modtime, auto_save_error, auto_save_1) (Fdo_auto_save, Fset_buffer_auto_saved): Replace B_ with BVAR. * editfns.c (region_limit, Fmark_marker, save_excursion_save) (save_excursion_restore, Fprevious_char, Fchar_before) (general_insert_function, Finsert_char, Finsert_byte) (make_buffer_string_both, Finsert_buffer_substring) (Fcompare_buffer_substrings, subst_char_in_region_unwind) (subst_char_in_region_unwind_1, Fsubst_char_in_region) (Ftranslate_region_internal, save_restriction_restore) (Fchar_equal): Replace B_ with BVAR. * dispnew.c (Fframe_or_buffer_changed_p): Replace B_ with BVAR. * dispextern.h (WINDOW_WANTS_MODELINE_P) (WINDOW_WANTS_HEADER_LINE_P): Replace B_ with BVAR. * dired.c (directory_files_internal): Replace B_ with BVAR. * data.c (swap_in_symval_forwarding, set_internal) (Fmake_local_variable, Fkill_local_variable, Flocal_variable_p): Replace B_ with BVAR. * composite.c (fill_gstring_header) (composition_compute_stop_pos, composition_adjust_point) (Ffind_composition_internal): Replace B_ with BVAR. * coding.c (decode_coding, encode_coding) (make_conversion_work_buffer, decode_coding_gap) (decode_coding_object, encode_coding_object) (Fdetect_coding_region, Ffind_coding_systems_region_internal) (Funencodable_char_position, Fcheck_coding_systems_region): Replace B_ with BVAR. * cmds.c (Fself_insert_command, internal_self_insert): Replace B_ with BVAR. * charset.c (Ffind_charset_region): Replace B_ with BVAR. * character.h (FETCH_CHAR_ADVANCE, INC_BOTH, DEC_BOTH) (ASCII_CHAR_WIDTH): Replace B_ with BVAR. * character.c (chars_in_text, Fget_byte): Replace B_ with BVAR. * category.h (Vstandard_category_table): Replace B_ with BVAR. * category.c (check_category_table, Fcategory_table) (Fset_category_table, char_category_set): Replace B_ with BVAR. * casetab.c (Fcurrent_case_table, set_case_table): Replace B_ with BVAR. * casefiddle.c (casify_object, casify_region): Replace B_ with BVAR. * callproc.c (Fcall_process, Fcall_process_region): Replace B_ with BVAR. * callint.c (check_mark, Fcall_interactively): Replace B_ with BVAR. * bytecode.c (Fbyte_code): Replace B_ with BVAR. * buffer.h (FETCH_CHAR, FETCH_CHAR_AS_MULTIBYTE, BVAR): Replace B_ with BVAR. * buffer.c (Fbuffer_live_p, Fget_file_buffer) (get_truename_buffer, Fget_buffer_create) (clone_per_buffer_values, Fmake_indirect_buffer, reset_buffer) (reset_buffer_local_variables, Fbuffer_name, Fbuffer_file_name) (Fbuffer_local_value, buffer_lisp_local_variables) (Fset_buffer_modified_p, Frestore_buffer_modified_p) (Frename_buffer, Fother_buffer, Fbuffer_enable_undo) (Fkill_buffer, Fset_buffer_major_mode, set_buffer_internal_1) (set_buffer_temp, Fset_buffer, set_buffer_if_live) (Fbarf_if_buffer_read_only, Fbury_buffer, Ferase_buffer) (Fbuffer_swap_text, swapfield_, Fbuffer_swap_text) (Fset_buffer_multibyte, swap_out_buffer_local_variables) (record_overlay_string, overlay_strings, init_buffer_once) (init_buffer, syms_of_buffer): Replace B_ with BVAR. --- src/ChangeLog | 146 +++++++++++ src/buffer.c | 670 +++++++++++++++++++++++------------------------ src/buffer.h | 8 +- src/bytecode.c | 2 +- src/callint.c | 16 +- src/callproc.c | 12 +- src/casefiddle.c | 12 +- src/casetab.c | 10 +- src/category.c | 8 +- src/category.h | 2 +- src/character.c | 4 +- src/character.h | 12 +- src/charset.c | 2 +- src/cmds.c | 22 +- src/coding.c | 34 +-- src/composite.c | 8 +- src/data.c | 24 +- src/dired.c | 2 +- src/dispextern.h | 6 +- src/dispnew.c | 8 +- src/editfns.c | 74 +++--- src/fileio.c | 178 ++++++------- src/filelock.c | 14 +- src/fns.c | 12 +- src/font.c | 2 +- src/frame.c | 2 +- src/fringe.c | 18 +- src/indent.c | 62 ++--- src/insdel.c | 62 ++--- src/intervals.c | 4 +- src/intervals.h | 4 +- src/keyboard.c | 10 +- src/keymap.c | 12 +- src/lisp.h | 4 +- src/lread.c | 16 +- src/marker.c | 12 +- src/minibuf.c | 22 +- src/msdos.c | 6 +- src/print.c | 40 +-- src/process.c | 58 ++-- src/search.c | 48 ++-- src/syntax.c | 16 +- src/syntax.h | 6 +- src/undo.c | 62 ++--- src/w32fns.c | 6 +- src/window.c | 60 ++--- src/xdisp.c | 186 ++++++------- src/xfaces.c | 2 +- src/xfns.c | 4 +- 49 files changed, 1078 insertions(+), 932 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index d70da316ba9..58f2d9b0c6e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,149 @@ +2011-02-16 Tom Tromey + + * xfns.c (x_create_tip_frame, Fx_show_tip): Replace B_ with BVAR. + * xfaces.c (compute_char_face): Replace B_ with BVAR. + * xdisp.c (pos_visible_p, init_iterator, reseat_1) + (message_dolog, update_echo_area, ensure_echo_area_buffers) + (with_echo_area_buffer, setup_echo_area_for_printing) + (set_message_1, update_menu_bar, update_tool_bar) + (text_outside_line_unchanged_p, redisplay_internal) + (try_scrolling, try_cursor_movement, redisplay_window) + (try_window_reusing_current_matrix, row_containing_pos) + (try_window_id, get_overlay_arrow_glyph_row, display_line) + (Fcurrent_bidi_paragraph_direction, display_mode_lines) + (decode_mode_spec_coding, decode_mode_spec, display_count_lines) + (get_window_cursor_type, note_mouse_highlight): Replace B_ with + BVAR. + * window.c (window_display_table, unshow_buffer, window_loop) + (window_min_size_2, set_window_buffer, Fset_window_buffer) + (select_window, Fforce_window_update, temp_output_buffer_show) + (Fset_window_configuration, save_window_save): Replace B_ with + BVAR. + * w32fns.c (x_create_tip_frame, Fx_show_tip, Fw32_shell_execute): + Replace B_ with BVAR. + * undo.c (record_point, record_insert, record_delete) + (record_marker_adjustment, record_first_change) + (record_property_change, Fundo_boundary, truncate_undo_list) + (Fprimitive_undo): Replace B_ with BVAR. + * syntax.h (Vstandard_syntax_table, CURRENT_SYNTAX_TABLE) + (SETUP_BUFFER_SYNTAX_TABLE): Replace B_ with BVAR. + * syntax.c (update_syntax_table, dec_bytepos, Fsyntax_table) + (Fset_syntax_table, Fmodify_syntax_entry, skip_chars) + (skip_syntaxes, scan_lists): Replace B_ with BVAR. + * search.c (compile_pattern_1, compile_pattern, looking_at_1) + (string_match_1, fast_looking_at, newline_cache_on_off) + (search_command, search_buffer, simple_search, boyer_moore) + (Freplace_match): Replace B_ with BVAR. + * process.c (get_process, list_processes_1, Fstart_process) + (Fmake_serial_process, Fmake_network_process) + (read_process_output, send_process, exec_sentinel) + (status_notify, setup_process_coding_systems): Replace B_ with + BVAR. + * print.c (PRINTDECLARE, PRINTPREPARE, PRINTFINISH, printchar) + (strout, print_string, temp_output_buffer_setup, print_object): + Replace B_ with BVAR. + * msdos.c (IT_frame_up_to_date): Replace B_ with BVAR. + * minibuf.c (read_minibuf, get_minibuffer, Fread_buffer): Replace + B_ with BVAR. + * marker.c (Fmarker_buffer, Fset_marker, set_marker_restricted) + (set_marker_both, set_marker_restricted_both, unchain_marker): + Replace B_ with BVAR. + * lread.c (readchar, unreadchar, openp, readevalloop) + (Feval_buffer, Feval_region): Replace B_ with BVAR. + * lisp.h (DOWNCASE_TABLE, UPCASE_TABLE): Replace B_ with BVAR. + * keymap.c (Flocal_key_binding, Fuse_local_map) + (Fcurrent_local_map, push_key_description) + (Fdescribe_buffer_bindings): Replace B_ with BVAR. + * keyboard.c (command_loop_1, read_char_minibuf_menu_prompt) + (read_key_sequence): Replace B_ with BVAR. + * intervals.h (TEXT_PROP_MEANS_INVISIBLE): Replace B_ with BVAR. + * intervals.c (set_point_both, get_local_map): Replace B_ with + BVAR. + * insdel.c (check_markers, insert_char, insert_1_both) + (insert_from_string_1, insert_from_gap, insert_from_buffer_1) + (adjust_after_replace, replace_range, del_range_2) + (modify_region, prepare_to_modify_buffer) + (Fcombine_after_change_execute): Replace B_ with BVAR. + * indent.c (buffer_display_table, recompute_width_table) + (width_run_cache_on_off, current_column, scan_for_column) + (Findent_to, position_indentation, compute_motion, vmotion): + Replace B_ with BVAR. + * fringe.c (get_logical_cursor_bitmap) + (get_logical_fringe_bitmap, update_window_fringes): Replace B_ + with BVAR. + * frame.c (make_frame_visible_1): Replace B_ with BVAR. + * font.c (font_at): Replace B_ with BVAR. + * fns.c (Fbase64_encode_region, Fbase64_decode_region, Fmd5): + Replace B_ with BVAR. + * filelock.c (unlock_all_files, Flock_buffer, Funlock_buffer) + (unlock_buffer): Replace B_ with BVAR. + * fileio.c (Fexpand_file_name, Ffile_directory_p) + (Ffile_regular_p, Ffile_selinux_context) + (Fset_file_selinux_context, Ffile_modes, Fset_file_modes) + (Fset_file_times, Ffile_newer_than_file_p, decide_coding_unwind) + (Finsert_file_contents, choose_write_coding_system) + (Fwrite_region, build_annotations, Fverify_visited_file_modtime) + (Fset_visited_file_modtime, auto_save_error, auto_save_1) + (Fdo_auto_save, Fset_buffer_auto_saved): Replace B_ with BVAR. + * editfns.c (region_limit, Fmark_marker, save_excursion_save) + (save_excursion_restore, Fprevious_char, Fchar_before) + (general_insert_function, Finsert_char, Finsert_byte) + (make_buffer_string_both, Finsert_buffer_substring) + (Fcompare_buffer_substrings, subst_char_in_region_unwind) + (subst_char_in_region_unwind_1, Fsubst_char_in_region) + (Ftranslate_region_internal, save_restriction_restore) + (Fchar_equal): Replace B_ with BVAR. + * dispnew.c (Fframe_or_buffer_changed_p): Replace B_ with BVAR. + * dispextern.h (WINDOW_WANTS_MODELINE_P) + (WINDOW_WANTS_HEADER_LINE_P): Replace B_ with BVAR. + * dired.c (directory_files_internal): Replace B_ with BVAR. + * data.c (swap_in_symval_forwarding, set_internal) + (Fmake_local_variable, Fkill_local_variable, Flocal_variable_p): + Replace B_ with BVAR. + * composite.c (fill_gstring_header) + (composition_compute_stop_pos, composition_adjust_point) + (Ffind_composition_internal): Replace B_ with BVAR. + * coding.c (decode_coding, encode_coding) + (make_conversion_work_buffer, decode_coding_gap) + (decode_coding_object, encode_coding_object) + (Fdetect_coding_region, Ffind_coding_systems_region_internal) + (Funencodable_char_position, Fcheck_coding_systems_region): + Replace B_ with BVAR. + * cmds.c (Fself_insert_command, internal_self_insert): Replace B_ + with BVAR. + * charset.c (Ffind_charset_region): Replace B_ with BVAR. + * character.h (FETCH_CHAR_ADVANCE, INC_BOTH, DEC_BOTH) + (ASCII_CHAR_WIDTH): Replace B_ with BVAR. + * character.c (chars_in_text, Fget_byte): Replace B_ with BVAR. + * category.h (Vstandard_category_table): Replace B_ with BVAR. + * category.c (check_category_table, Fcategory_table) + (Fset_category_table, char_category_set): Replace B_ with BVAR. + * casetab.c (Fcurrent_case_table, set_case_table): Replace B_ with + BVAR. + * casefiddle.c (casify_object, casify_region): Replace B_ with + BVAR. + * callproc.c (Fcall_process, Fcall_process_region): Replace B_ + with BVAR. + * callint.c (check_mark, Fcall_interactively): Replace B_ with + BVAR. + * bytecode.c (Fbyte_code): Replace B_ with BVAR. + * buffer.h (FETCH_CHAR, FETCH_CHAR_AS_MULTIBYTE, BVAR): Replace B_ + with BVAR. + * buffer.c (Fbuffer_live_p, Fget_file_buffer) + (get_truename_buffer, Fget_buffer_create) + (clone_per_buffer_values, Fmake_indirect_buffer, reset_buffer) + (reset_buffer_local_variables, Fbuffer_name, Fbuffer_file_name) + (Fbuffer_local_value, buffer_lisp_local_variables) + (Fset_buffer_modified_p, Frestore_buffer_modified_p) + (Frename_buffer, Fother_buffer, Fbuffer_enable_undo) + (Fkill_buffer, Fset_buffer_major_mode, set_buffer_internal_1) + (set_buffer_temp, Fset_buffer, set_buffer_if_live) + (Fbarf_if_buffer_read_only, Fbury_buffer, Ferase_buffer) + (Fbuffer_swap_text, swapfield_, Fbuffer_swap_text) + (Fset_buffer_multibyte, swap_out_buffer_local_variables) + (record_overlay_string, overlay_strings, init_buffer_once) + (init_buffer, syms_of_buffer): Replace B_ with BVAR. + 2011-02-16 Eli Zaretskii * xdisp.c (redisplay_internal): Resynchronize `w' if the selected diff --git a/src/buffer.c b/src/buffer.c index 49ae4bbede2..d05fe1754c2 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -162,7 +162,7 @@ DEFUN ("buffer-live-p", Fbuffer_live_p, Sbuffer_live_p, 1, 1, 0, Value is nil if OBJECT is not a buffer or if it has been killed. */) (Lisp_Object object) { - return ((BUFFERP (object) && ! NILP (B_ (XBUFFER (object), name))) + return ((BUFFERP (object) && ! NILP (BVAR (XBUFFER (object), name))) ? Qt : Qnil); } @@ -266,8 +266,8 @@ See also `find-buffer-visiting'. */) { buf = Fcdr (XCAR (tail)); if (!BUFFERP (buf)) continue; - if (!STRINGP (B_ (XBUFFER (buf), filename))) continue; - tem = Fstring_equal (B_ (XBUFFER (buf), filename), filename); + if (!STRINGP (BVAR (XBUFFER (buf), filename))) continue; + tem = Fstring_equal (BVAR (XBUFFER (buf), filename), filename); if (!NILP (tem)) return buf; } @@ -283,8 +283,8 @@ get_truename_buffer (register Lisp_Object filename) { buf = Fcdr (XCAR (tail)); if (!BUFFERP (buf)) continue; - if (!STRINGP (B_ (XBUFFER (buf), file_truename))) continue; - tem = Fstring_equal (B_ (XBUFFER (buf), file_truename), filename); + if (!STRINGP (BVAR (XBUFFER (buf), file_truename))) continue; + tem = Fstring_equal (BVAR (XBUFFER (buf), file_truename), filename); if (!NILP (tem)) return buf; } @@ -353,7 +353,7 @@ even if it is dead. The return value is never nil. */) b->newline_cache = 0; b->width_run_cache = 0; - B_ (b, width_table) = Qnil; + BVAR (b, width_table) = Qnil; b->prevent_redisplay_optimizations_p = 1; /* Put this on the chain of all buffers including killed ones. */ @@ -362,22 +362,22 @@ even if it is dead. The return value is never nil. */) /* An ordinary buffer normally doesn't need markers to handle BEGV and ZV. */ - B_ (b, pt_marker) = Qnil; - B_ (b, begv_marker) = Qnil; - B_ (b, zv_marker) = Qnil; + BVAR (b, pt_marker) = Qnil; + BVAR (b, begv_marker) = Qnil; + BVAR (b, zv_marker) = Qnil; name = Fcopy_sequence (buffer_or_name); STRING_SET_INTERVALS (name, NULL_INTERVAL); - B_ (b, name) = name; + BVAR (b, name) = name; - B_ (b, undo_list) = (SREF (name, 0) != ' ') ? Qnil : Qt; + BVAR (b, undo_list) = (SREF (name, 0) != ' ') ? Qnil : Qt; reset_buffer (b); reset_buffer_local_variables (b, 1); - B_ (b, mark) = Fmake_marker (); + BVAR (b, mark) = Fmake_marker (); BUF_MARKERS (b) = NULL; - B_ (b, name) = name; + BVAR (b, name) = name; /* Put this in the alist of all live buffers. */ XSETBUFFER (buffer, b); @@ -486,7 +486,7 @@ clone_per_buffer_values (struct buffer *from, struct buffer *to) /* Get (a copy of) the alist of Lisp-level local variables of FROM and install that in TO. */ - B_ (to, local_var_alist) = buffer_lisp_local_variables (from); + BVAR (to, local_var_alist) = buffer_lisp_local_variables (from); } DEFUN ("make-indirect-buffer", Fmake_indirect_buffer, Smake_indirect_buffer, @@ -512,7 +512,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */) base_buffer = Fget_buffer (base_buffer); if (NILP (base_buffer)) error ("No such buffer: `%s'", SDATA (tem)); - if (NILP (B_ (XBUFFER (base_buffer), name))) + if (NILP (BVAR (XBUFFER (base_buffer), name))) error ("Base buffer has been killed"); if (SCHARS (name) == 0) @@ -536,7 +536,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */) b->newline_cache = 0; b->width_run_cache = 0; - B_ (b, width_table) = Qnil; + BVAR (b, width_table) = Qnil; /* Put this on the chain of all buffers including killed ones. */ b->next = all_buffers; @@ -544,7 +544,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */) name = Fcopy_sequence (name); STRING_SET_INTERVALS (name, NULL_INTERVAL); - B_ (b, name) = name; + BVAR (b, name) = name; reset_buffer (b); reset_buffer_local_variables (b, 1); @@ -553,57 +553,57 @@ CLONE nil means the indirect buffer's state is reset to default values. */) XSETBUFFER (buf, b); Vbuffer_alist = nconc2 (Vbuffer_alist, Fcons (Fcons (name, buf), Qnil)); - B_ (b, mark) = Fmake_marker (); - B_ (b, name) = name; + BVAR (b, mark) = Fmake_marker (); + BVAR (b, name) = name; /* The multibyte status belongs to the base buffer. */ - B_ (b, enable_multibyte_characters) = B_ (b->base_buffer, enable_multibyte_characters); + BVAR (b, enable_multibyte_characters) = BVAR (b->base_buffer, enable_multibyte_characters); /* Make sure the base buffer has markers for its narrowing. */ - if (NILP (B_ (b->base_buffer, pt_marker))) + if (NILP (BVAR (b->base_buffer, pt_marker))) { - B_ (b->base_buffer, pt_marker) = Fmake_marker (); - set_marker_both (B_ (b->base_buffer, pt_marker), base_buffer, + BVAR (b->base_buffer, pt_marker) = Fmake_marker (); + set_marker_both (BVAR (b->base_buffer, pt_marker), base_buffer, BUF_PT (b->base_buffer), BUF_PT_BYTE (b->base_buffer)); } - if (NILP (B_ (b->base_buffer, begv_marker))) + if (NILP (BVAR (b->base_buffer, begv_marker))) { - B_ (b->base_buffer, begv_marker) = Fmake_marker (); - set_marker_both (B_ (b->base_buffer, begv_marker), base_buffer, + BVAR (b->base_buffer, begv_marker) = Fmake_marker (); + set_marker_both (BVAR (b->base_buffer, begv_marker), base_buffer, BUF_BEGV (b->base_buffer), BUF_BEGV_BYTE (b->base_buffer)); } - if (NILP (B_ (b->base_buffer, zv_marker))) + if (NILP (BVAR (b->base_buffer, zv_marker))) { - B_ (b->base_buffer, zv_marker) = Fmake_marker (); - set_marker_both (B_ (b->base_buffer, zv_marker), base_buffer, + BVAR (b->base_buffer, zv_marker) = Fmake_marker (); + set_marker_both (BVAR (b->base_buffer, zv_marker), base_buffer, BUF_ZV (b->base_buffer), BUF_ZV_BYTE (b->base_buffer)); - XMARKER (B_ (b->base_buffer, zv_marker))->insertion_type = 1; + XMARKER (BVAR (b->base_buffer, zv_marker))->insertion_type = 1; } if (NILP (clone)) { /* Give the indirect buffer markers for its narrowing. */ - B_ (b, pt_marker) = Fmake_marker (); - set_marker_both (B_ (b, pt_marker), buf, BUF_PT (b), BUF_PT_BYTE (b)); - B_ (b, begv_marker) = Fmake_marker (); - set_marker_both (B_ (b, begv_marker), buf, BUF_BEGV (b), BUF_BEGV_BYTE (b)); - B_ (b, zv_marker) = Fmake_marker (); - set_marker_both (B_ (b, zv_marker), buf, BUF_ZV (b), BUF_ZV_BYTE (b)); - XMARKER (B_ (b, zv_marker))->insertion_type = 1; + BVAR (b, pt_marker) = Fmake_marker (); + set_marker_both (BVAR (b, pt_marker), buf, BUF_PT (b), BUF_PT_BYTE (b)); + BVAR (b, begv_marker) = Fmake_marker (); + set_marker_both (BVAR (b, begv_marker), buf, BUF_BEGV (b), BUF_BEGV_BYTE (b)); + BVAR (b, zv_marker) = Fmake_marker (); + set_marker_both (BVAR (b, zv_marker), buf, BUF_ZV (b), BUF_ZV_BYTE (b)); + XMARKER (BVAR (b, zv_marker))->insertion_type = 1; } else { struct buffer *old_b = current_buffer; clone_per_buffer_values (b->base_buffer, b); - B_ (b, filename) = Qnil; - B_ (b, file_truename) = Qnil; - B_ (b, display_count) = make_number (0); - B_ (b, backed_up) = Qnil; - B_ (b, auto_save_file_name) = Qnil; + BVAR (b, filename) = Qnil; + BVAR (b, file_truename) = Qnil; + BVAR (b, display_count) = make_number (0); + BVAR (b, backed_up) = Qnil; + BVAR (b, auto_save_file_name) = Qnil; set_buffer_internal_1 (b); Fset (intern ("buffer-save-without-query"), Qnil); Fset (intern ("buffer-file-number"), Qnil); @@ -647,34 +647,34 @@ delete_all_overlays (struct buffer *b) void reset_buffer (register struct buffer *b) { - B_ (b, filename) = Qnil; - B_ (b, file_truename) = Qnil; - B_ (b, directory) = (current_buffer) ? B_ (current_buffer, directory) : Qnil; + BVAR (b, filename) = Qnil; + BVAR (b, file_truename) = Qnil; + BVAR (b, directory) = (current_buffer) ? BVAR (current_buffer, directory) : Qnil; b->modtime = 0; b->modtime_size = -1; - XSETFASTINT (B_ (b, save_length), 0); + XSETFASTINT (BVAR (b, save_length), 0); b->last_window_start = 1; /* It is more conservative to start out "changed" than "unchanged". */ b->clip_changed = 0; b->prevent_redisplay_optimizations_p = 1; - B_ (b, backed_up) = Qnil; + BVAR (b, backed_up) = Qnil; BUF_AUTOSAVE_MODIFF (b) = 0; b->auto_save_failure_time = -1; - B_ (b, auto_save_file_name) = Qnil; - B_ (b, read_only) = Qnil; + BVAR (b, auto_save_file_name) = Qnil; + BVAR (b, read_only) = Qnil; b->overlays_before = NULL; b->overlays_after = NULL; b->overlay_center = BEG; - B_ (b, mark_active) = Qnil; - B_ (b, point_before_scroll) = Qnil; - B_ (b, file_format) = Qnil; - B_ (b, auto_save_file_format) = Qt; - B_ (b, last_selected_window) = Qnil; - XSETINT (B_ (b, display_count), 0); - B_ (b, display_time) = Qnil; - B_ (b, enable_multibyte_characters) = B_ (&buffer_defaults, enable_multibyte_characters); - B_ (b, cursor_type) = B_ (&buffer_defaults, cursor_type); - B_ (b, extra_line_spacing) = B_ (&buffer_defaults, extra_line_spacing); + BVAR (b, mark_active) = Qnil; + BVAR (b, point_before_scroll) = Qnil; + BVAR (b, file_format) = Qnil; + BVAR (b, auto_save_file_format) = Qt; + BVAR (b, last_selected_window) = Qnil; + XSETINT (BVAR (b, display_count), 0); + BVAR (b, display_time) = Qnil; + BVAR (b, enable_multibyte_characters) = BVAR (&buffer_defaults, enable_multibyte_characters); + BVAR (b, cursor_type) = BVAR (&buffer_defaults, cursor_type); + BVAR (b, extra_line_spacing) = BVAR (&buffer_defaults, extra_line_spacing); b->display_error_modiff = 0; } @@ -698,10 +698,10 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too) things that depend on the major mode. default-major-mode is handled at a higher level. We ignore it here. */ - B_ (b, major_mode) = Qfundamental_mode; - B_ (b, keymap) = Qnil; - B_ (b, mode_name) = QSFundamental; - B_ (b, minor_modes) = Qnil; + BVAR (b, major_mode) = Qfundamental_mode; + BVAR (b, keymap) = Qnil; + BVAR (b, mode_name) = QSFundamental; + BVAR (b, minor_modes) = Qnil; /* If the standard case table has been altered and invalidated, fix up its insides first. */ @@ -710,22 +710,22 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too) && CHAR_TABLE_P (XCHAR_TABLE (Vascii_downcase_table)->extras[2]))) Fset_standard_case_table (Vascii_downcase_table); - B_ (b, downcase_table) = Vascii_downcase_table; - B_ (b, upcase_table) = XCHAR_TABLE (Vascii_downcase_table)->extras[0]; - B_ (b, case_canon_table) = XCHAR_TABLE (Vascii_downcase_table)->extras[1]; - B_ (b, case_eqv_table) = XCHAR_TABLE (Vascii_downcase_table)->extras[2]; - B_ (b, invisibility_spec) = Qt; + BVAR (b, downcase_table) = Vascii_downcase_table; + BVAR (b, upcase_table) = XCHAR_TABLE (Vascii_downcase_table)->extras[0]; + BVAR (b, case_canon_table) = XCHAR_TABLE (Vascii_downcase_table)->extras[1]; + BVAR (b, case_eqv_table) = XCHAR_TABLE (Vascii_downcase_table)->extras[2]; + BVAR (b, invisibility_spec) = Qt; #ifndef DOS_NT - B_ (b, buffer_file_type) = Qnil; + BVAR (b, buffer_file_type) = Qnil; #endif /* Reset all (or most) per-buffer variables to their defaults. */ if (permanent_too) - B_ (b, local_var_alist) = Qnil; + BVAR (b, local_var_alist) = Qnil; else { Lisp_Object tmp, prop, last = Qnil; - for (tmp = B_ (b, local_var_alist); CONSP (tmp); tmp = XCDR (tmp)) + for (tmp = BVAR (b, local_var_alist); CONSP (tmp); tmp = XCDR (tmp)) if (!NILP (prop = Fget (XCAR (XCAR (tmp)), Qpermanent_local))) { /* If permanent-local, keep it. */ @@ -755,7 +755,7 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too) } /* Delete this local variable. */ else if (NILP (last)) - B_ (b, local_var_alist) = XCDR (tmp); + BVAR (b, local_var_alist) = XCDR (tmp); else XSETCDR (last, XCDR (tmp)); } @@ -830,9 +830,9 @@ Return nil if BUFFER has been killed. */) (register Lisp_Object buffer) { if (NILP (buffer)) - return B_ (current_buffer, name); + return BVAR (current_buffer, name); CHECK_BUFFER (buffer); - return B_ (XBUFFER (buffer), name); + return BVAR (XBUFFER (buffer), name); } DEFUN ("buffer-file-name", Fbuffer_file_name, Sbuffer_file_name, 0, 1, 0, @@ -841,9 +841,9 @@ No argument or nil as argument means use the current buffer. */) (register Lisp_Object buffer) { if (NILP (buffer)) - return B_ (current_buffer, filename); + return BVAR (current_buffer, filename); CHECK_BUFFER (buffer); - return B_ (XBUFFER (buffer), filename); + return BVAR (XBUFFER (buffer), filename); } DEFUN ("buffer-base-buffer", Fbuffer_base_buffer, Sbuffer_base_buffer, @@ -895,7 +895,7 @@ is the default binding of the variable. */) { /* Look in local_var_alist. */ struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym); XSETSYMBOL (variable, sym); /* Update In case of aliasing. */ - result = Fassoc (variable, B_ (buf, local_var_alist)); + result = Fassoc (variable, BVAR (buf, local_var_alist)); if (!NILP (result)) { if (blv->fwd) @@ -944,7 +944,7 @@ buffer_lisp_local_variables (struct buffer *buf) { Lisp_Object result = Qnil; register Lisp_Object tail; - for (tail = B_ (buf, local_var_alist); CONSP (tail); tail = XCDR (tail)) + for (tail = BVAR (buf, local_var_alist); CONSP (tail); tail = XCDR (tail)) { Lisp_Object val, elt; @@ -1043,9 +1043,9 @@ A non-nil FLAG means mark the buffer modified. */) /* If buffer becoming modified, lock the file. If buffer becoming unmodified, unlock the file. */ - fn = B_ (current_buffer, file_truename); + fn = BVAR (current_buffer, file_truename); /* Test buffer-file-name so that binding it to nil is effective. */ - if (!NILP (fn) && ! NILP (B_ (current_buffer, filename))) + if (!NILP (fn) && ! NILP (BVAR (current_buffer, filename))) { already = SAVE_MODIFF < MODIFF; if (!already && !NILP (flag)) @@ -1110,9 +1110,9 @@ state of the current buffer. Use with care. */) /* If buffer becoming modified, lock the file. If buffer becoming unmodified, unlock the file. */ - fn = B_ (current_buffer, file_truename); + fn = BVAR (current_buffer, file_truename); /* Test buffer-file-name so that binding it to nil is effective. */ - if (!NILP (fn) && ! NILP (B_ (current_buffer, filename))) + if (!NILP (fn) && ! NILP (BVAR (current_buffer, filename))) { int already = SAVE_MODIFF < MODIFF; if (!already && !NILP (flag)) @@ -1199,14 +1199,14 @@ This does not change the name of the visited file (if any). */) with the original name. It makes UNIQUE equivalent to (rename-buffer (generate-new-buffer-name NEWNAME)). */ if (NILP (unique) && XBUFFER (tem) == current_buffer) - return B_ (current_buffer, name); + return BVAR (current_buffer, name); if (!NILP (unique)) - newname = Fgenerate_new_buffer_name (newname, B_ (current_buffer, name)); + newname = Fgenerate_new_buffer_name (newname, BVAR (current_buffer, name)); else error ("Buffer name `%s' is in use", SDATA (newname)); } - B_ (current_buffer, name) = newname; + BVAR (current_buffer, name) = newname; /* Catch redisplay's attention. Unless we do this, the mode lines for any windows displaying current_buffer will stay unchanged. */ @@ -1214,11 +1214,11 @@ This does not change the name of the visited file (if any). */) XSETBUFFER (buf, current_buffer); Fsetcar (Frassq (buf, Vbuffer_alist), newname); - if (NILP (B_ (current_buffer, filename)) - && !NILP (B_ (current_buffer, auto_save_file_name))) + if (NILP (BVAR (current_buffer, filename)) + && !NILP (BVAR (current_buffer, auto_save_file_name))) call0 (intern ("rename-auto-save-file")); /* Refetch since that last call may have done GC. */ - return B_ (current_buffer, name); + return BVAR (current_buffer, name); } DEFUN ("other-buffer", Fother_buffer, Sother_buffer, 0, 3, 0, @@ -1263,9 +1263,9 @@ If BUFFER is omitted or nil, some interesting buffer is returned. */) continue; if (NILP (buf)) continue; - if (NILP (B_ (XBUFFER (buf), name))) + if (NILP (BVAR (XBUFFER (buf), name))) continue; - if (SREF (B_ (XBUFFER (buf), name), 0) == ' ') + if (SREF (BVAR (XBUFFER (buf), name), 0) == ' ') continue; /* If the selected frame has a buffer_predicate, disregard buffers that don't fit the predicate. */ @@ -1313,8 +1313,8 @@ No argument or nil as argument means do this for the current buffer. */) nsberror (buffer); } - if (EQ (B_ (XBUFFER (real_buffer), undo_list), Qt)) - B_ (XBUFFER (real_buffer), undo_list) = Qnil; + if (EQ (BVAR (XBUFFER (real_buffer), undo_list), Qt)) + BVAR (XBUFFER (real_buffer), undo_list) = Qnil; return Qnil; } @@ -1359,16 +1359,16 @@ with SIGHUP. */) b = XBUFFER (buffer); /* Avoid trouble for buffer already dead. */ - if (NILP (B_ (b, name))) + if (NILP (BVAR (b, name))) return Qnil; /* Query if the buffer is still modified. */ - if (INTERACTIVE && !NILP (B_ (b, filename)) + if (INTERACTIVE && !NILP (BVAR (b, filename)) && BUF_MODIFF (b) > BUF_SAVE_MODIFF (b)) { GCPRO1 (buffer); tem = do_yes_or_no_p (format2 ("Buffer %s modified; kill anyway? ", - B_ (b, name), make_number (0))); + BVAR (b, name), make_number (0))); UNGCPRO; if (NILP (tem)) return Qnil; @@ -1402,7 +1402,7 @@ with SIGHUP. */) if (EQ (buffer, XWINDOW (minibuf_window)->buffer)) return Qnil; - if (NILP (B_ (b, name))) + if (NILP (BVAR (b, name))) return Qnil; /* When we kill a base buffer, kill all its indirect buffers. @@ -1417,7 +1417,7 @@ with SIGHUP. */) for (other = all_buffers; other; other = other->next) /* all_buffers contains dead buffers too; don't re-kill them. */ - if (other->base_buffer == b && !NILP (B_ (other, name))) + if (other->base_buffer == b && !NILP (BVAR (other, name))) { Lisp_Object buffer; XSETBUFFER (buffer, other); @@ -1462,7 +1462,7 @@ with SIGHUP. */) /* Killing buffer processes may run sentinels which may have called kill-buffer. */ - if (NILP (B_ (b, name))) + if (NILP (BVAR (b, name))) return Qnil; clear_charpos_cache (b); @@ -1476,7 +1476,7 @@ with SIGHUP. */) /* Delete any auto-save file, if we saved it in this session. But not if the buffer is modified. */ - if (STRINGP (B_ (b, auto_save_file_name)) + if (STRINGP (BVAR (b, auto_save_file_name)) && BUF_AUTOSAVE_MODIFF (b) != 0 && BUF_SAVE_MODIFF (b) < BUF_AUTOSAVE_MODIFF (b) && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b) @@ -1485,7 +1485,7 @@ with SIGHUP. */) Lisp_Object tem; tem = Fsymbol_value (intern ("delete-auto-save-files")); if (! NILP (tem)) - internal_delete_file (B_ (b, auto_save_file_name)); + internal_delete_file (BVAR (b, auto_save_file_name)); } if (b->base_buffer) @@ -1525,7 +1525,7 @@ with SIGHUP. */) swap_out_buffer_local_variables (b); reset_buffer_local_variables (b, 1); - B_ (b, name) = Qnil; + BVAR (b, name) = Qnil; BLOCK_INPUT; if (! b->base_buffer) @@ -1541,9 +1541,9 @@ with SIGHUP. */) free_region_cache (b->width_run_cache); b->width_run_cache = 0; } - B_ (b, width_table) = Qnil; + BVAR (b, width_table) = Qnil; UNBLOCK_INPUT; - B_ (b, undo_list) = Qnil; + BVAR (b, undo_list) = Qnil; return Qt; } @@ -1637,15 +1637,15 @@ the current buffer's major mode. */) CHECK_BUFFER (buffer); - if (STRINGP (B_ (XBUFFER (buffer), name)) - && strcmp (SSDATA (B_ (XBUFFER (buffer), name)), "*scratch*") == 0) + if (STRINGP (BVAR (XBUFFER (buffer), name)) + && strcmp (SSDATA (BVAR (XBUFFER (buffer), name)), "*scratch*") == 0) function = find_symbol_value (intern ("initial-major-mode")); else { - function = B_ (&buffer_defaults, major_mode); + function = BVAR (&buffer_defaults, major_mode); if (NILP (function) - && NILP (Fget (B_ (current_buffer, major_mode), Qmode_class))) - function = B_ (current_buffer, major_mode); + && NILP (Fget (BVAR (current_buffer, major_mode), Qmode_class))) + function = BVAR (current_buffer, major_mode); } if (NILP (function) || EQ (function, Qfundamental_mode)) @@ -1795,29 +1795,29 @@ set_buffer_internal_1 (register struct buffer *b) /* Put the undo list back in the base buffer, so that it appears that an indirect buffer shares the undo list of its base. */ if (old_buf->base_buffer) - B_ (old_buf->base_buffer, undo_list) = B_ (old_buf, undo_list); + BVAR (old_buf->base_buffer, undo_list) = BVAR (old_buf, undo_list); /* If the old current buffer has markers to record PT, BEGV and ZV when it is not current, update them now. */ - if (! NILP (B_ (old_buf, pt_marker))) + if (! NILP (BVAR (old_buf, pt_marker))) { Lisp_Object obuf; XSETBUFFER (obuf, old_buf); - set_marker_both (B_ (old_buf, pt_marker), obuf, + set_marker_both (BVAR (old_buf, pt_marker), obuf, BUF_PT (old_buf), BUF_PT_BYTE (old_buf)); } - if (! NILP (B_ (old_buf, begv_marker))) + if (! NILP (BVAR (old_buf, begv_marker))) { Lisp_Object obuf; XSETBUFFER (obuf, old_buf); - set_marker_both (B_ (old_buf, begv_marker), obuf, + set_marker_both (BVAR (old_buf, begv_marker), obuf, BUF_BEGV (old_buf), BUF_BEGV_BYTE (old_buf)); } - if (! NILP (B_ (old_buf, zv_marker))) + if (! NILP (BVAR (old_buf, zv_marker))) { Lisp_Object obuf; XSETBUFFER (obuf, old_buf); - set_marker_both (B_ (old_buf, zv_marker), obuf, + set_marker_both (BVAR (old_buf, zv_marker), obuf, BUF_ZV (old_buf), BUF_ZV_BYTE (old_buf)); } } @@ -1825,24 +1825,24 @@ set_buffer_internal_1 (register struct buffer *b) /* Get the undo list from the base buffer, so that it appears that an indirect buffer shares the undo list of its base. */ if (b->base_buffer) - B_ (b, undo_list) = B_ (b->base_buffer, undo_list); + BVAR (b, undo_list) = BVAR (b->base_buffer, undo_list); /* If the new current buffer has markers to record PT, BEGV and ZV when it is not current, fetch them now. */ - if (! NILP (B_ (b, pt_marker))) + if (! NILP (BVAR (b, pt_marker))) { - BUF_PT (b) = marker_position (B_ (b, pt_marker)); - BUF_PT_BYTE (b) = marker_byte_position (B_ (b, pt_marker)); + BUF_PT (b) = marker_position (BVAR (b, pt_marker)); + BUF_PT_BYTE (b) = marker_byte_position (BVAR (b, pt_marker)); } - if (! NILP (B_ (b, begv_marker))) + if (! NILP (BVAR (b, begv_marker))) { - BUF_BEGV (b) = marker_position (B_ (b, begv_marker)); - BUF_BEGV_BYTE (b) = marker_byte_position (B_ (b, begv_marker)); + BUF_BEGV (b) = marker_position (BVAR (b, begv_marker)); + BUF_BEGV_BYTE (b) = marker_byte_position (BVAR (b, begv_marker)); } - if (! NILP (B_ (b, zv_marker))) + if (! NILP (BVAR (b, zv_marker))) { - BUF_ZV (b) = marker_position (B_ (b, zv_marker)); - BUF_ZV_BYTE (b) = marker_byte_position (B_ (b, zv_marker)); + BUF_ZV (b) = marker_position (BVAR (b, zv_marker)); + BUF_ZV_BYTE (b) = marker_byte_position (BVAR (b, zv_marker)); } /* Look down buffer's list of local Lisp variables @@ -1850,7 +1850,7 @@ set_buffer_internal_1 (register struct buffer *b) do { - for (tail = B_ (b, local_var_alist); CONSP (tail); tail = XCDR (tail)) + for (tail = BVAR (b, local_var_alist); CONSP (tail); tail = XCDR (tail)) { Lisp_Object var = XCAR (XCAR (tail)); struct Lisp_Symbol *sym = XSYMBOL (var); @@ -1883,45 +1883,45 @@ set_buffer_temp (struct buffer *b) { /* If the old current buffer has markers to record PT, BEGV and ZV when it is not current, update them now. */ - if (! NILP (B_ (old_buf, pt_marker))) + if (! NILP (BVAR (old_buf, pt_marker))) { Lisp_Object obuf; XSETBUFFER (obuf, old_buf); - set_marker_both (B_ (old_buf, pt_marker), obuf, + set_marker_both (BVAR (old_buf, pt_marker), obuf, BUF_PT (old_buf), BUF_PT_BYTE (old_buf)); } - if (! NILP (B_ (old_buf, begv_marker))) + if (! NILP (BVAR (old_buf, begv_marker))) { Lisp_Object obuf; XSETBUFFER (obuf, old_buf); - set_marker_both (B_ (old_buf, begv_marker), obuf, + set_marker_both (BVAR (old_buf, begv_marker), obuf, BUF_BEGV (old_buf), BUF_BEGV_BYTE (old_buf)); } - if (! NILP (B_ (old_buf, zv_marker))) + if (! NILP (BVAR (old_buf, zv_marker))) { Lisp_Object obuf; XSETBUFFER (obuf, old_buf); - set_marker_both (B_ (old_buf, zv_marker), obuf, + set_marker_both (BVAR (old_buf, zv_marker), obuf, BUF_ZV (old_buf), BUF_ZV_BYTE (old_buf)); } } /* If the new current buffer has markers to record PT, BEGV and ZV when it is not current, fetch them now. */ - if (! NILP (B_ (b, pt_marker))) + if (! NILP (BVAR (b, pt_marker))) { - BUF_PT (b) = marker_position (B_ (b, pt_marker)); - BUF_PT_BYTE (b) = marker_byte_position (B_ (b, pt_marker)); + BUF_PT (b) = marker_position (BVAR (b, pt_marker)); + BUF_PT_BYTE (b) = marker_byte_position (BVAR (b, pt_marker)); } - if (! NILP (B_ (b, begv_marker))) + if (! NILP (BVAR (b, begv_marker))) { - BUF_BEGV (b) = marker_position (B_ (b, begv_marker)); - BUF_BEGV_BYTE (b) = marker_byte_position (B_ (b, begv_marker)); + BUF_BEGV (b) = marker_position (BVAR (b, begv_marker)); + BUF_BEGV_BYTE (b) = marker_byte_position (BVAR (b, begv_marker)); } - if (! NILP (B_ (b, zv_marker))) + if (! NILP (BVAR (b, zv_marker))) { - BUF_ZV (b) = marker_position (B_ (b, zv_marker)); - BUF_ZV_BYTE (b) = marker_byte_position (B_ (b, zv_marker)); + BUF_ZV (b) = marker_position (BVAR (b, zv_marker)); + BUF_ZV_BYTE (b) = marker_byte_position (BVAR (b, zv_marker)); } } @@ -1938,7 +1938,7 @@ ends when the current command terminates. Use `switch-to-buffer' or buffer = Fget_buffer (buffer_or_name); if (NILP (buffer)) nsberror (buffer_or_name); - if (NILP (B_ (XBUFFER (buffer), name))) + if (NILP (BVAR (XBUFFER (buffer), name))) error ("Selecting deleted buffer"); set_buffer_internal (XBUFFER (buffer)); return buffer; @@ -1949,7 +1949,7 @@ ends when the current command terminates. Use `switch-to-buffer' or Lisp_Object set_buffer_if_live (Lisp_Object buffer) { - if (! NILP (B_ (XBUFFER (buffer), name))) + if (! NILP (BVAR (XBUFFER (buffer), name))) Fset_buffer (buffer); return Qnil; } @@ -1959,7 +1959,7 @@ DEFUN ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only, doc: /* Signal a `buffer-read-only' error if the current buffer is read-only. */) (void) { - if (!NILP (B_ (current_buffer, read_only)) + if (!NILP (BVAR (current_buffer, read_only)) && NILP (Vinhibit_read_only)) xsignal1 (Qbuffer_read_only, Fcurrent_buffer ()); return Qnil; @@ -2008,7 +2008,7 @@ its frame, iconify that frame. */) /* Move buffer to the end of the buffer list. Do nothing if the buffer is killed. */ - if (!NILP (B_ (XBUFFER (buffer), name))) + if (!NILP (BVAR (XBUFFER (buffer), name))) { Lisp_Object aelt, link; @@ -2041,7 +2041,7 @@ so the buffer is truly empty after this. */) /* Prevent warnings, or suspension of auto saving, that would happen if future size is less than past size. Use of erase-buffer implies that the future text is not really related to the past text. */ - XSETFASTINT (B_ (current_buffer, save_length), 0); + XSETFASTINT (BVAR (current_buffer, save_length), 0); return Qnil; } @@ -2111,7 +2111,7 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, CHECK_BUFFER (buffer); other_buffer = XBUFFER (buffer); - if (NILP (B_ (other_buffer, name))) + if (NILP (BVAR (other_buffer, name))) error ("Cannot swap a dead buffer's text"); /* Actually, it probably works just fine. @@ -2140,9 +2140,9 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, } while (0) #define swapfield_(field, type) \ do { \ - type tmp##field = B_ (other_buffer, field); \ - B_ (other_buffer, field) = B_ (current_buffer, field); \ - B_ (current_buffer, field) = tmp##field; \ + type tmp##field = BVAR (other_buffer, field); \ + BVAR (other_buffer, field) = BVAR (current_buffer, field); \ + BVAR (current_buffer, field) = tmp##field; \ } while (0) swapfield (own_text, struct buffer_text); @@ -2181,8 +2181,8 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, swapfield_ (pt_marker, Lisp_Object); swapfield_ (begv_marker, Lisp_Object); swapfield_ (zv_marker, Lisp_Object); - B_ (current_buffer, point_before_scroll) = Qnil; - B_ (other_buffer, point_before_scroll) = Qnil; + BVAR (current_buffer, point_before_scroll) = Qnil; + BVAR (other_buffer, point_before_scroll) = Qnil; current_buffer->text->modiff++; other_buffer->text->modiff++; current_buffer->text->chars_modiff++; other_buffer->text->chars_modiff++; @@ -2256,21 +2256,21 @@ current buffer is cleared. */) EMACS_INT begv, zv; int narrowed = (BEG != BEGV || Z != ZV); int modified_p = !NILP (Fbuffer_modified_p (Qnil)); - Lisp_Object old_undo = B_ (current_buffer, undo_list); + Lisp_Object old_undo = BVAR (current_buffer, undo_list); struct gcpro gcpro1; if (current_buffer->base_buffer) error ("Cannot do `set-buffer-multibyte' on an indirect buffer"); /* Do nothing if nothing actually changes. */ - if (NILP (flag) == NILP (B_ (current_buffer, enable_multibyte_characters))) + if (NILP (flag) == NILP (BVAR (current_buffer, enable_multibyte_characters))) return flag; GCPRO1 (old_undo); /* Don't record these buffer changes. We will put a special undo entry instead. */ - B_ (current_buffer, undo_list) = Qt; + BVAR (current_buffer, undo_list) = Qt; /* If the cached position is for this buffer, clear it out. */ clear_charpos_cache (current_buffer); @@ -2292,7 +2292,7 @@ current buffer is cleared. */) to calculate the old correspondences. */ set_intervals_multibyte (0); - B_ (current_buffer, enable_multibyte_characters) = Qnil; + BVAR (current_buffer, enable_multibyte_characters) = Qnil; Z = Z_BYTE; BEGV = BEGV_BYTE; @@ -2430,7 +2430,7 @@ current buffer is cleared. */) /* Do this first, so that chars_in_text asks the right question. set_intervals_multibyte needs it too. */ - B_ (current_buffer, enable_multibyte_characters) = Qt; + BVAR (current_buffer, enable_multibyte_characters) = Qt; GPT_BYTE = advance_to_char_boundary (GPT_BYTE); GPT = chars_in_text (BEG_ADDR, GPT_BYTE - BEG_BYTE) + BEG; @@ -2488,7 +2488,7 @@ current buffer is cleared. */) if (!EQ (old_undo, Qt)) { /* Represent all the above changes by a special undo entry. */ - B_ (current_buffer, undo_list) = Fcons (list3 (Qapply, + BVAR (current_buffer, undo_list) = Fcons (list3 (Qapply, intern ("set-buffer-multibyte"), NILP (flag) ? Qt : Qnil), old_undo); @@ -2504,10 +2504,10 @@ current buffer is cleared. */) /* Copy this buffer's new multibyte status into all of its indirect buffers. */ for (other = all_buffers; other; other = other->next) - if (other->base_buffer == current_buffer && !NILP (B_ (other, name))) + if (other->base_buffer == current_buffer && !NILP (BVAR (other, name))) { - B_ (other, enable_multibyte_characters) - = B_ (current_buffer, enable_multibyte_characters); + BVAR (other, enable_multibyte_characters) + = BVAR (current_buffer, enable_multibyte_characters); other->prevent_redisplay_optimizations_p = 1; } @@ -2574,7 +2574,7 @@ swap_out_buffer_local_variables (struct buffer *b) Lisp_Object oalist, alist, buffer; XSETBUFFER (buffer, b); - oalist = B_ (b, local_var_alist); + oalist = BVAR (b, local_var_alist); for (alist = oalist; CONSP (alist); alist = XCDR (alist)) { @@ -3078,7 +3078,7 @@ record_overlay_string (struct sortstrlist *ssl, Lisp_Object str, Lisp_Object str ssl->buf[ssl->used].priority = (INTEGERP (pri) ? XINT (pri) : 0); ssl->used++; - if (NILP (B_ (current_buffer, enable_multibyte_characters))) + if (NILP (BVAR (current_buffer, enable_multibyte_characters))) nbytes = SCHARS (str); else if (! STRING_MULTIBYTE (str)) nbytes = count_size_as_multibyte (SDATA (str), @@ -3090,7 +3090,7 @@ record_overlay_string (struct sortstrlist *ssl, Lisp_Object str, Lisp_Object str if (STRINGP (str2)) { - if (NILP (B_ (current_buffer, enable_multibyte_characters))) + if (NILP (BVAR (current_buffer, enable_multibyte_characters))) nbytes = SCHARS (str2); else if (! STRING_MULTIBYTE (str2)) nbytes = count_size_as_multibyte (SDATA (str2), @@ -3120,7 +3120,7 @@ overlay_strings (EMACS_INT pos, struct window *w, unsigned char **pstr) Lisp_Object overlay, window, str; struct Lisp_Overlay *ov; EMACS_INT startpos, endpos; - int multibyte = ! NILP (B_ (current_buffer, enable_multibyte_characters)); + int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); overlay_heads.used = overlay_heads.bytes = 0; overlay_tails.used = overlay_tails.bytes = 0; @@ -4991,9 +4991,9 @@ init_buffer_once (void) /* Make sure all markable slots in buffer_defaults are initialized reasonably, so mark_buffer won't choke. */ reset_buffer (&buffer_defaults); - eassert (EQ (B_ (&buffer_defaults, name), make_number (0))); + eassert (EQ (BVAR (&buffer_defaults, name), make_number (0))); reset_buffer_local_variables (&buffer_defaults, 1); - eassert (EQ (B_ (&buffer_local_symbols, name), make_number (0))); + eassert (EQ (BVAR (&buffer_local_symbols, name), make_number (0))); reset_buffer (&buffer_local_symbols); reset_buffer_local_variables (&buffer_local_symbols, 1); /* Prevent GC from getting confused. */ @@ -5010,60 +5010,60 @@ init_buffer_once (void) /* Must do these before making the first buffer! */ /* real setup is done in bindings.el */ - B_ (&buffer_defaults, mode_line_format) = make_pure_c_string ("%-"); - B_ (&buffer_defaults, header_line_format) = Qnil; - B_ (&buffer_defaults, abbrev_mode) = Qnil; - B_ (&buffer_defaults, overwrite_mode) = Qnil; - B_ (&buffer_defaults, case_fold_search) = Qt; - B_ (&buffer_defaults, auto_fill_function) = Qnil; - B_ (&buffer_defaults, selective_display) = Qnil; + BVAR (&buffer_defaults, mode_line_format) = make_pure_c_string ("%-"); + BVAR (&buffer_defaults, header_line_format) = Qnil; + BVAR (&buffer_defaults, abbrev_mode) = Qnil; + BVAR (&buffer_defaults, overwrite_mode) = Qnil; + BVAR (&buffer_defaults, case_fold_search) = Qt; + BVAR (&buffer_defaults, auto_fill_function) = Qnil; + BVAR (&buffer_defaults, selective_display) = Qnil; #ifndef old - B_ (&buffer_defaults, selective_display_ellipses) = Qt; + BVAR (&buffer_defaults, selective_display_ellipses) = Qt; #endif - B_ (&buffer_defaults, abbrev_table) = Qnil; - B_ (&buffer_defaults, display_table) = Qnil; - B_ (&buffer_defaults, undo_list) = Qnil; - B_ (&buffer_defaults, mark_active) = Qnil; - B_ (&buffer_defaults, file_format) = Qnil; - B_ (&buffer_defaults, auto_save_file_format) = Qt; + BVAR (&buffer_defaults, abbrev_table) = Qnil; + BVAR (&buffer_defaults, display_table) = Qnil; + BVAR (&buffer_defaults, undo_list) = Qnil; + BVAR (&buffer_defaults, mark_active) = Qnil; + BVAR (&buffer_defaults, file_format) = Qnil; + BVAR (&buffer_defaults, auto_save_file_format) = Qt; buffer_defaults.overlays_before = NULL; buffer_defaults.overlays_after = NULL; buffer_defaults.overlay_center = BEG; - XSETFASTINT (B_ (&buffer_defaults, tab_width), 8); - B_ (&buffer_defaults, truncate_lines) = Qnil; - B_ (&buffer_defaults, word_wrap) = Qnil; - B_ (&buffer_defaults, ctl_arrow) = Qt; - B_ (&buffer_defaults, bidi_display_reordering) = Qnil; - B_ (&buffer_defaults, bidi_paragraph_direction) = Qnil; - B_ (&buffer_defaults, cursor_type) = Qt; - B_ (&buffer_defaults, extra_line_spacing) = Qnil; - B_ (&buffer_defaults, cursor_in_non_selected_windows) = Qt; + XSETFASTINT (BVAR (&buffer_defaults, tab_width), 8); + BVAR (&buffer_defaults, truncate_lines) = Qnil; + BVAR (&buffer_defaults, word_wrap) = Qnil; + BVAR (&buffer_defaults, ctl_arrow) = Qt; + BVAR (&buffer_defaults, bidi_display_reordering) = Qnil; + BVAR (&buffer_defaults, bidi_paragraph_direction) = Qnil; + BVAR (&buffer_defaults, cursor_type) = Qt; + BVAR (&buffer_defaults, extra_line_spacing) = Qnil; + BVAR (&buffer_defaults, cursor_in_non_selected_windows) = Qt; #ifdef DOS_NT - B_ (&buffer_defaults, buffer_file_type) = Qnil; /* TEXT */ + BVAR (&buffer_defaults, buffer_file_type) = Qnil; /* TEXT */ #endif - B_ (&buffer_defaults, enable_multibyte_characters) = Qt; - B_ (&buffer_defaults, buffer_file_coding_system) = Qnil; - XSETFASTINT (B_ (&buffer_defaults, fill_column), 70); - XSETFASTINT (B_ (&buffer_defaults, left_margin), 0); - B_ (&buffer_defaults, cache_long_line_scans) = Qnil; - B_ (&buffer_defaults, file_truename) = Qnil; - XSETFASTINT (B_ (&buffer_defaults, display_count), 0); - XSETFASTINT (B_ (&buffer_defaults, left_margin_cols), 0); - XSETFASTINT (B_ (&buffer_defaults, right_margin_cols), 0); - B_ (&buffer_defaults, left_fringe_width) = Qnil; - B_ (&buffer_defaults, right_fringe_width) = Qnil; - B_ (&buffer_defaults, fringes_outside_margins) = Qnil; - B_ (&buffer_defaults, scroll_bar_width) = Qnil; - B_ (&buffer_defaults, vertical_scroll_bar_type) = Qt; - B_ (&buffer_defaults, indicate_empty_lines) = Qnil; - B_ (&buffer_defaults, indicate_buffer_boundaries) = Qnil; - B_ (&buffer_defaults, fringe_indicator_alist) = Qnil; - B_ (&buffer_defaults, fringe_cursor_alist) = Qnil; - B_ (&buffer_defaults, scroll_up_aggressively) = Qnil; - B_ (&buffer_defaults, scroll_down_aggressively) = Qnil; - B_ (&buffer_defaults, display_time) = Qnil; + BVAR (&buffer_defaults, enable_multibyte_characters) = Qt; + BVAR (&buffer_defaults, buffer_file_coding_system) = Qnil; + XSETFASTINT (BVAR (&buffer_defaults, fill_column), 70); + XSETFASTINT (BVAR (&buffer_defaults, left_margin), 0); + BVAR (&buffer_defaults, cache_long_line_scans) = Qnil; + BVAR (&buffer_defaults, file_truename) = Qnil; + XSETFASTINT (BVAR (&buffer_defaults, display_count), 0); + XSETFASTINT (BVAR (&buffer_defaults, left_margin_cols), 0); + XSETFASTINT (BVAR (&buffer_defaults, right_margin_cols), 0); + BVAR (&buffer_defaults, left_fringe_width) = Qnil; + BVAR (&buffer_defaults, right_fringe_width) = Qnil; + BVAR (&buffer_defaults, fringes_outside_margins) = Qnil; + BVAR (&buffer_defaults, scroll_bar_width) = Qnil; + BVAR (&buffer_defaults, vertical_scroll_bar_type) = Qt; + BVAR (&buffer_defaults, indicate_empty_lines) = Qnil; + BVAR (&buffer_defaults, indicate_buffer_boundaries) = Qnil; + BVAR (&buffer_defaults, fringe_indicator_alist) = Qnil; + BVAR (&buffer_defaults, fringe_cursor_alist) = Qnil; + BVAR (&buffer_defaults, scroll_up_aggressively) = Qnil; + BVAR (&buffer_defaults, scroll_down_aggressively) = Qnil; + BVAR (&buffer_defaults, display_time) = Qnil; /* Assign the local-flags to the slots that have default values. The local flag is a bit that is used in the buffer @@ -5075,73 +5075,73 @@ init_buffer_once (void) /* 0 means not a lisp var, -1 means always local, else mask */ memset (&buffer_local_flags, 0, sizeof buffer_local_flags); - XSETINT (B_ (&buffer_local_flags, filename), -1); - XSETINT (B_ (&buffer_local_flags, directory), -1); - XSETINT (B_ (&buffer_local_flags, backed_up), -1); - XSETINT (B_ (&buffer_local_flags, save_length), -1); - XSETINT (B_ (&buffer_local_flags, auto_save_file_name), -1); - XSETINT (B_ (&buffer_local_flags, read_only), -1); - XSETINT (B_ (&buffer_local_flags, major_mode), -1); - XSETINT (B_ (&buffer_local_flags, mode_name), -1); - XSETINT (B_ (&buffer_local_flags, undo_list), -1); - XSETINT (B_ (&buffer_local_flags, mark_active), -1); - XSETINT (B_ (&buffer_local_flags, point_before_scroll), -1); - XSETINT (B_ (&buffer_local_flags, file_truename), -1); - XSETINT (B_ (&buffer_local_flags, invisibility_spec), -1); - XSETINT (B_ (&buffer_local_flags, file_format), -1); - XSETINT (B_ (&buffer_local_flags, auto_save_file_format), -1); - XSETINT (B_ (&buffer_local_flags, display_count), -1); - XSETINT (B_ (&buffer_local_flags, display_time), -1); - XSETINT (B_ (&buffer_local_flags, enable_multibyte_characters), -1); + XSETINT (BVAR (&buffer_local_flags, filename), -1); + XSETINT (BVAR (&buffer_local_flags, directory), -1); + XSETINT (BVAR (&buffer_local_flags, backed_up), -1); + XSETINT (BVAR (&buffer_local_flags, save_length), -1); + XSETINT (BVAR (&buffer_local_flags, auto_save_file_name), -1); + XSETINT (BVAR (&buffer_local_flags, read_only), -1); + XSETINT (BVAR (&buffer_local_flags, major_mode), -1); + XSETINT (BVAR (&buffer_local_flags, mode_name), -1); + XSETINT (BVAR (&buffer_local_flags, undo_list), -1); + XSETINT (BVAR (&buffer_local_flags, mark_active), -1); + XSETINT (BVAR (&buffer_local_flags, point_before_scroll), -1); + XSETINT (BVAR (&buffer_local_flags, file_truename), -1); + XSETINT (BVAR (&buffer_local_flags, invisibility_spec), -1); + XSETINT (BVAR (&buffer_local_flags, file_format), -1); + XSETINT (BVAR (&buffer_local_flags, auto_save_file_format), -1); + XSETINT (BVAR (&buffer_local_flags, display_count), -1); + XSETINT (BVAR (&buffer_local_flags, display_time), -1); + XSETINT (BVAR (&buffer_local_flags, enable_multibyte_characters), -1); idx = 1; - XSETFASTINT (B_ (&buffer_local_flags, mode_line_format), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, abbrev_mode), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, overwrite_mode), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, case_fold_search), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, auto_fill_function), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, selective_display), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, mode_line_format), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, abbrev_mode), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, overwrite_mode), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, case_fold_search), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, auto_fill_function), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, selective_display), idx); ++idx; #ifndef old - XSETFASTINT (B_ (&buffer_local_flags, selective_display_ellipses), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, selective_display_ellipses), idx); ++idx; #endif - XSETFASTINT (B_ (&buffer_local_flags, tab_width), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, truncate_lines), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, word_wrap), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, ctl_arrow), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, fill_column), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, left_margin), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, abbrev_table), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, display_table), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, tab_width), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, truncate_lines), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, word_wrap), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, ctl_arrow), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, fill_column), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, left_margin), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, abbrev_table), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, display_table), idx); ++idx; #ifdef DOS_NT - XSETFASTINT (B_ (&buffer_local_flags, buffer_file_type), idx); + XSETFASTINT (BVAR (&buffer_local_flags, buffer_file_type), idx); /* Make this one a permanent local. */ buffer_permanent_local_flags[idx++] = 1; #endif - XSETFASTINT (B_ (&buffer_local_flags, syntax_table), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, cache_long_line_scans), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, category_table), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, bidi_display_reordering), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, bidi_paragraph_direction), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, buffer_file_coding_system), idx); + XSETFASTINT (BVAR (&buffer_local_flags, syntax_table), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, cache_long_line_scans), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, category_table), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, bidi_display_reordering), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, bidi_paragraph_direction), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, buffer_file_coding_system), idx); /* Make this one a permanent local. */ buffer_permanent_local_flags[idx++] = 1; - XSETFASTINT (B_ (&buffer_local_flags, left_margin_cols), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, right_margin_cols), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, left_fringe_width), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, right_fringe_width), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, fringes_outside_margins), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, scroll_bar_width), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, vertical_scroll_bar_type), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, indicate_empty_lines), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, indicate_buffer_boundaries), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, fringe_indicator_alist), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, fringe_cursor_alist), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, scroll_up_aggressively), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, scroll_down_aggressively), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, header_line_format), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, cursor_type), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, extra_line_spacing), idx); ++idx; - XSETFASTINT (B_ (&buffer_local_flags, cursor_in_non_selected_windows), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, left_margin_cols), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, right_margin_cols), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, left_fringe_width), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, right_fringe_width), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, fringes_outside_margins), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, scroll_bar_width), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, vertical_scroll_bar_type), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, indicate_empty_lines), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, indicate_buffer_boundaries), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, fringe_indicator_alist), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, fringe_cursor_alist), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, scroll_up_aggressively), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, scroll_down_aggressively), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, header_line_format), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, cursor_type), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, extra_line_spacing), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, cursor_in_non_selected_windows), idx); ++idx; /* Need more room? */ if (idx >= MAX_PER_BUFFER_VARS) @@ -5155,7 +5155,7 @@ init_buffer_once (void) QSFundamental = make_pure_c_string ("Fundamental"); Qfundamental_mode = intern_c_string ("fundamental-mode"); - B_ (&buffer_defaults, major_mode) = Qfundamental_mode; + BVAR (&buffer_defaults, major_mode) = Qfundamental_mode; Qmode_class = intern_c_string ("mode-class"); @@ -5198,7 +5198,7 @@ init_buffer (void) #endif /* USE_MMAP_FOR_BUFFERS */ Fset_buffer (Fget_buffer_create (build_string ("*scratch*"))); - if (NILP (B_ (&buffer_defaults, enable_multibyte_characters))) + if (NILP (BVAR (&buffer_defaults, enable_multibyte_characters))) Fset_buffer_multibyte (Qnil); pwd = get_current_dir_name (); @@ -5219,28 +5219,28 @@ init_buffer (void) pwd[len + 1] = '\0'; } - B_ (current_buffer, directory) = make_unibyte_string (pwd, strlen (pwd)); - if (! NILP (B_ (&buffer_defaults, enable_multibyte_characters))) + BVAR (current_buffer, directory) = make_unibyte_string (pwd, strlen (pwd)); + if (! NILP (BVAR (&buffer_defaults, enable_multibyte_characters))) /* At this moment, we still don't know how to decode the directory name. So, we keep the bytes in multibyte form so that ENCODE_FILE correctly gets the original bytes. */ - B_ (current_buffer, directory) - = string_to_multibyte (B_ (current_buffer, directory)); + BVAR (current_buffer, directory) + = string_to_multibyte (BVAR (current_buffer, directory)); /* Add /: to the front of the name if it would otherwise be treated as magic. */ - temp = Ffind_file_name_handler (B_ (current_buffer, directory), Qt); + temp = Ffind_file_name_handler (BVAR (current_buffer, directory), Qt); if (! NILP (temp) /* If the default dir is just /, TEMP is non-nil because of the ange-ftp completion handler. However, it is not necessary to turn / into /:/. So avoid doing that. */ - && strcmp ("/", SSDATA (B_ (current_buffer, directory)))) - B_ (current_buffer, directory) - = concat2 (build_string ("/:"), B_ (current_buffer, directory)); + && strcmp ("/", SSDATA (BVAR (current_buffer, directory)))) + BVAR (current_buffer, directory) + = concat2 (build_string ("/:"), BVAR (current_buffer, directory)); temp = get_minibuffer (0); - B_ (XBUFFER (temp), directory) = B_ (current_buffer, directory); + BVAR (XBUFFER (temp), directory) = BVAR (current_buffer, directory); free (pwd); } @@ -5491,13 +5491,13 @@ This value applies in buffers that don't have their own local values. This is the same as (default-value 'scroll-down-aggressively). */); DEFVAR_PER_BUFFER ("header-line-format", - &B_ (current_buffer, header_line_format), + &BVAR (current_buffer, header_line_format), Qnil, doc: /* Analogous to `mode-line-format', but controls the header line. The header line appears, optionally, at the top of a window; the mode line appears at the bottom. */); - DEFVAR_PER_BUFFER ("mode-line-format", &B_ (current_buffer, mode_line_format), + DEFVAR_PER_BUFFER ("mode-line-format", &BVAR (current_buffer, mode_line_format), Qnil, doc: /* Template for displaying mode line for current buffer. Each buffer has its own value of this variable. @@ -5554,7 +5554,7 @@ Decimal digits after the % specify field width to which to pad. */); DEFVAR_BUFFER_DEFAULTS ("default-major-mode", major_mode, doc: /* *Value of `major-mode' for new buffers. */); - DEFVAR_PER_BUFFER ("major-mode", &B_ (current_buffer, major_mode), + DEFVAR_PER_BUFFER ("major-mode", &BVAR (current_buffer, major_mode), make_number (Lisp_Symbol), doc: /* Symbol for current buffer's major mode. The default value (normally `fundamental-mode') affects new buffers. @@ -5567,46 +5567,46 @@ the buffer. Thus, the mode and its hooks should not expect certain variables such as `buffer-read-only' and `buffer-file-coding-system' to be set up. */); - DEFVAR_PER_BUFFER ("mode-name", &B_ (current_buffer, mode_name), + DEFVAR_PER_BUFFER ("mode-name", &BVAR (current_buffer, mode_name), Qnil, doc: /* Pretty name of current buffer's major mode. Usually a string, but can use any of the constructs for `mode-line-format', which see. Format with `format-mode-line' to produce a string value. */); - DEFVAR_PER_BUFFER ("local-abbrev-table", &B_ (current_buffer, abbrev_table), Qnil, + DEFVAR_PER_BUFFER ("local-abbrev-table", &BVAR (current_buffer, abbrev_table), Qnil, doc: /* Local (mode-specific) abbrev table of current buffer. */); - DEFVAR_PER_BUFFER ("abbrev-mode", &B_ (current_buffer, abbrev_mode), Qnil, + DEFVAR_PER_BUFFER ("abbrev-mode", &BVAR (current_buffer, abbrev_mode), Qnil, doc: /* Non-nil if Abbrev mode is enabled. Use the command `abbrev-mode' to change this variable. */); - DEFVAR_PER_BUFFER ("case-fold-search", &B_ (current_buffer, case_fold_search), + DEFVAR_PER_BUFFER ("case-fold-search", &BVAR (current_buffer, case_fold_search), Qnil, doc: /* *Non-nil if searches and matches should ignore case. */); - DEFVAR_PER_BUFFER ("fill-column", &B_ (current_buffer, fill_column), + DEFVAR_PER_BUFFER ("fill-column", &BVAR (current_buffer, fill_column), make_number (LISP_INT_TAG), doc: /* *Column beyond which automatic line-wrapping should happen. Interactively, you can set the buffer local value using \\[set-fill-column]. */); - DEFVAR_PER_BUFFER ("left-margin", &B_ (current_buffer, left_margin), + DEFVAR_PER_BUFFER ("left-margin", &BVAR (current_buffer, left_margin), make_number (LISP_INT_TAG), doc: /* *Column for the default `indent-line-function' to indent to. Linefeed indents to this column in Fundamental mode. */); - DEFVAR_PER_BUFFER ("tab-width", &B_ (current_buffer, tab_width), + DEFVAR_PER_BUFFER ("tab-width", &BVAR (current_buffer, tab_width), make_number (LISP_INT_TAG), doc: /* *Distance between tab stops (for display of tab characters), in columns. */); - DEFVAR_PER_BUFFER ("ctl-arrow", &B_ (current_buffer, ctl_arrow), Qnil, + DEFVAR_PER_BUFFER ("ctl-arrow", &BVAR (current_buffer, ctl_arrow), Qnil, doc: /* *Non-nil means display control chars with uparrow. A value of nil means use backslash and octal digits. This variable does not apply to characters whose display is specified in the current display table (if there is one). */); DEFVAR_PER_BUFFER ("enable-multibyte-characters", - &B_ (current_buffer, enable_multibyte_characters), + &BVAR (current_buffer, enable_multibyte_characters), Qnil, doc: /* Non-nil means the buffer contents are regarded as multi-byte characters. Otherwise they are regarded as unibyte. This affects the display, @@ -5620,7 +5620,7 @@ See also variable `default-enable-multibyte-characters' and Info node XSYMBOL (intern_c_string ("enable-multibyte-characters"))->constant = 1; DEFVAR_PER_BUFFER ("buffer-file-coding-system", - &B_ (current_buffer, buffer_file_coding_system), Qnil, + &BVAR (current_buffer, buffer_file_coding_system), Qnil, doc: /* Coding system to be used for encoding the buffer contents on saving. This variable applies to saving the buffer, and also to `write-region' and other functions that use `write-region'. @@ -5638,11 +5638,11 @@ The variable `coding-system-for-write', if non-nil, overrides this variable. This variable is never applied to a way of decoding a file while reading it. */); DEFVAR_PER_BUFFER ("bidi-display-reordering", - &B_ (current_buffer, bidi_display_reordering), Qnil, + &BVAR (current_buffer, bidi_display_reordering), Qnil, doc: /* Non-nil means reorder bidirectional text for display in the visual order. */); DEFVAR_PER_BUFFER ("bidi-paragraph-direction", - &B_ (current_buffer, bidi_paragraph_direction), Qnil, + &BVAR (current_buffer, bidi_paragraph_direction), Qnil, doc: /* *If non-nil, forces directionality of text paragraphs in the buffer. If this is nil (the default), the direction of each paragraph is @@ -5653,7 +5653,7 @@ Any other value is treated as nil. This variable has no effect unless the buffer's value of \`bidi-display-reordering' is non-nil. */); - DEFVAR_PER_BUFFER ("truncate-lines", &B_ (current_buffer, truncate_lines), Qnil, + DEFVAR_PER_BUFFER ("truncate-lines", &BVAR (current_buffer, truncate_lines), Qnil, doc: /* *Non-nil means do not display continuation lines. Instead, give each line of text just one screen line. @@ -5661,7 +5661,7 @@ Note that this is overridden by the variable `truncate-partial-width-windows' if that variable is non-nil and this buffer is not full-frame width. */); - DEFVAR_PER_BUFFER ("word-wrap", &B_ (current_buffer, word_wrap), Qnil, + DEFVAR_PER_BUFFER ("word-wrap", &BVAR (current_buffer, word_wrap), Qnil, doc: /* *Non-nil means to use word-wrapping for continuation lines. When word-wrapping is on, continuation lines are wrapped at the space or tab character nearest to the right window edge. @@ -5674,7 +5674,7 @@ word-wrapping, you might want to reduce the value of in narrower windows. */); #ifdef DOS_NT - DEFVAR_PER_BUFFER ("buffer-file-type", &B_ (current_buffer, buffer_file_type), + DEFVAR_PER_BUFFER ("buffer-file-type", &BVAR (current_buffer, buffer_file_type), Qnil, doc: /* Non-nil if the visited file is a binary file. This variable is meaningful on MS-DOG and Windows NT. @@ -5682,12 +5682,12 @@ On those systems, it is automatically local in every buffer. On other systems, this variable is normally always nil. */); #endif - DEFVAR_PER_BUFFER ("default-directory", &B_ (current_buffer, directory), + DEFVAR_PER_BUFFER ("default-directory", &BVAR (current_buffer, directory), make_number (Lisp_String), doc: /* Name of default directory of current buffer. Should end with slash. To interactively change the default directory, use command `cd'. */); - DEFVAR_PER_BUFFER ("auto-fill-function", &B_ (current_buffer, auto_fill_function), + DEFVAR_PER_BUFFER ("auto-fill-function", &BVAR (current_buffer, auto_fill_function), Qnil, doc: /* Function called (if non-nil) to perform auto-fill. It is called after self-inserting any character specified in @@ -5695,30 +5695,30 @@ the `auto-fill-chars' table. NOTE: This variable is not a hook; its value may not be a list of functions. */); - DEFVAR_PER_BUFFER ("buffer-file-name", &B_ (current_buffer, filename), + DEFVAR_PER_BUFFER ("buffer-file-name", &BVAR (current_buffer, filename), make_number (Lisp_String), doc: /* Name of file visited in current buffer, or nil if not visiting a file. */); - DEFVAR_PER_BUFFER ("buffer-file-truename", &B_ (current_buffer, file_truename), + DEFVAR_PER_BUFFER ("buffer-file-truename", &BVAR (current_buffer, file_truename), make_number (Lisp_String), doc: /* Abbreviated truename of file visited in current buffer, or nil if none. The truename of a file is calculated by `file-truename' and then abbreviated with `abbreviate-file-name'. */); DEFVAR_PER_BUFFER ("buffer-auto-save-file-name", - &B_ (current_buffer, auto_save_file_name), + &BVAR (current_buffer, auto_save_file_name), make_number (Lisp_String), doc: /* Name of file for auto-saving current buffer. If it is nil, that means don't auto-save this buffer. */); - DEFVAR_PER_BUFFER ("buffer-read-only", &B_ (current_buffer, read_only), Qnil, + DEFVAR_PER_BUFFER ("buffer-read-only", &BVAR (current_buffer, read_only), Qnil, doc: /* Non-nil if this buffer is read-only. */); - DEFVAR_PER_BUFFER ("buffer-backed-up", &B_ (current_buffer, backed_up), Qnil, + DEFVAR_PER_BUFFER ("buffer-backed-up", &BVAR (current_buffer, backed_up), Qnil, doc: /* Non-nil if this buffer's file has been backed up. Backing up is done before the first time the file is saved. */); - DEFVAR_PER_BUFFER ("buffer-saved-size", &B_ (current_buffer, save_length), + DEFVAR_PER_BUFFER ("buffer-saved-size", &BVAR (current_buffer, save_length), make_number (LISP_INT_TAG), doc: /* Length of current buffer when last read in, saved or auto-saved. 0 initially. @@ -5728,7 +5728,7 @@ If you set this to -2, that means don't turn off auto-saving in this buffer if its text size shrinks. If you use `buffer-swap-text' on a buffer, you probably should set this to -2 in that buffer. */); - DEFVAR_PER_BUFFER ("selective-display", &B_ (current_buffer, selective_display), + DEFVAR_PER_BUFFER ("selective-display", &BVAR (current_buffer, selective_display), Qnil, doc: /* Non-nil enables selective display. An integer N as value means display only lines @@ -5739,12 +5739,12 @@ in a file, save the ^M as a newline. */); #ifndef old DEFVAR_PER_BUFFER ("selective-display-ellipses", - &B_ (current_buffer, selective_display_ellipses), + &BVAR (current_buffer, selective_display_ellipses), Qnil, doc: /* Non-nil means display ... on previous line when a line is invisible. */); #endif - DEFVAR_PER_BUFFER ("overwrite-mode", &B_ (current_buffer, overwrite_mode), Qnil, + DEFVAR_PER_BUFFER ("overwrite-mode", &BVAR (current_buffer, overwrite_mode), Qnil, doc: /* Non-nil if self-insertion should replace existing text. The value should be one of `overwrite-mode-textual', `overwrite-mode-binary', or nil. @@ -5753,7 +5753,7 @@ inserts at the end of a line, and inserts when point is before a tab, until the tab is filled in. If `overwrite-mode-binary', self-insertion replaces newlines and tabs too. */); - DEFVAR_PER_BUFFER ("buffer-display-table", &B_ (current_buffer, display_table), + DEFVAR_PER_BUFFER ("buffer-display-table", &BVAR (current_buffer, display_table), Qnil, doc: /* Display table that controls display of the contents of current buffer. @@ -5790,39 +5790,39 @@ In addition, a char-table has six extra slots to control the display of: See also the functions `display-table-slot' and `set-display-table-slot'. */); - DEFVAR_PER_BUFFER ("left-margin-width", &B_ (current_buffer, left_margin_cols), + DEFVAR_PER_BUFFER ("left-margin-width", &BVAR (current_buffer, left_margin_cols), Qnil, doc: /* *Width of left marginal area for display of a buffer. A value of nil means no marginal area. */); - DEFVAR_PER_BUFFER ("right-margin-width", &B_ (current_buffer, right_margin_cols), + DEFVAR_PER_BUFFER ("right-margin-width", &BVAR (current_buffer, right_margin_cols), Qnil, doc: /* *Width of right marginal area for display of a buffer. A value of nil means no marginal area. */); - DEFVAR_PER_BUFFER ("left-fringe-width", &B_ (current_buffer, left_fringe_width), + DEFVAR_PER_BUFFER ("left-fringe-width", &BVAR (current_buffer, left_fringe_width), Qnil, doc: /* *Width of this buffer's left fringe (in pixels). A value of 0 means no left fringe is shown in this buffer's window. A value of nil means to use the left fringe width from the window's frame. */); - DEFVAR_PER_BUFFER ("right-fringe-width", &B_ (current_buffer, right_fringe_width), + DEFVAR_PER_BUFFER ("right-fringe-width", &BVAR (current_buffer, right_fringe_width), Qnil, doc: /* *Width of this buffer's right fringe (in pixels). A value of 0 means no right fringe is shown in this buffer's window. A value of nil means to use the right fringe width from the window's frame. */); - DEFVAR_PER_BUFFER ("fringes-outside-margins", &B_ (current_buffer, fringes_outside_margins), + DEFVAR_PER_BUFFER ("fringes-outside-margins", &BVAR (current_buffer, fringes_outside_margins), Qnil, doc: /* *Non-nil means to display fringes outside display margins. A value of nil means to display fringes between margins and buffer text. */); - DEFVAR_PER_BUFFER ("scroll-bar-width", &B_ (current_buffer, scroll_bar_width), + DEFVAR_PER_BUFFER ("scroll-bar-width", &BVAR (current_buffer, scroll_bar_width), Qnil, doc: /* *Width of this buffer's scroll bars in pixels. A value of nil means to use the scroll bar width from the window's frame. */); - DEFVAR_PER_BUFFER ("vertical-scroll-bar", &B_ (current_buffer, vertical_scroll_bar_type), + DEFVAR_PER_BUFFER ("vertical-scroll-bar", &BVAR (current_buffer, vertical_scroll_bar_type), Qnil, doc: /* *Position of this buffer's vertical scroll bar. The value takes effect whenever you tell a window to display this buffer; @@ -5833,13 +5833,13 @@ of the window; a value of nil means don't show any vertical scroll bars. A value of t (the default) means do whatever the window's frame specifies. */); DEFVAR_PER_BUFFER ("indicate-empty-lines", - &B_ (current_buffer, indicate_empty_lines), Qnil, + &BVAR (current_buffer, indicate_empty_lines), Qnil, doc: /* *Visually indicate empty lines after the buffer end. If non-nil, a bitmap is displayed in the left fringe of a window on window-systems. */); DEFVAR_PER_BUFFER ("indicate-buffer-boundaries", - &B_ (current_buffer, indicate_buffer_boundaries), Qnil, + &BVAR (current_buffer, indicate_buffer_boundaries), Qnil, doc: /* *Visually indicate buffer boundaries and scrolling. If non-nil, the first and last line of the buffer are marked in the fringe of a window on window-systems with angle bitmaps, or if the window can be @@ -5864,7 +5864,7 @@ bitmaps in right fringe. To show just the angle bitmaps in the left fringe, but no arrow bitmaps, use ((top . left) (bottom . left)). */); DEFVAR_PER_BUFFER ("fringe-indicator-alist", - &B_ (current_buffer, fringe_indicator_alist), Qnil, + &BVAR (current_buffer, fringe_indicator_alist), Qnil, doc: /* *Mapping from logical to physical fringe indicator bitmaps. The value is an alist where each element (INDICATOR . BITMAPS) specifies the fringe bitmaps used to display a specific logical @@ -5883,7 +5883,7 @@ last (only) line has no final newline. BITMAPS may also be a single symbol which is used in both left and right fringes. */); DEFVAR_PER_BUFFER ("fringe-cursor-alist", - &B_ (current_buffer, fringe_cursor_alist), Qnil, + &BVAR (current_buffer, fringe_cursor_alist), Qnil, doc: /* *Mapping from logical to physical fringe cursor bitmaps. The value is an alist where each element (CURSOR . BITMAP) specifies the fringe bitmaps used to display a specific logical @@ -5898,7 +5898,7 @@ BITMAP is the corresponding fringe bitmap shown for the logical cursor type. */); DEFVAR_PER_BUFFER ("scroll-up-aggressively", - &B_ (current_buffer, scroll_up_aggressively), Qnil, + &BVAR (current_buffer, scroll_up_aggressively), Qnil, doc: /* How far to scroll windows upward. If you move point off the bottom, the window scrolls automatically. This variable controls how far it scrolls. The value nil, the default, @@ -5911,7 +5911,7 @@ window scrolls by a full window height. Meaningful values are between 0.0 and 1.0, inclusive. */); DEFVAR_PER_BUFFER ("scroll-down-aggressively", - &B_ (current_buffer, scroll_down_aggressively), Qnil, + &BVAR (current_buffer, scroll_down_aggressively), Qnil, doc: /* How far to scroll windows downward. If you move point off the top, the window scrolls automatically. This variable controls how far it scrolls. The value nil, the default, @@ -5966,7 +5966,7 @@ from happening repeatedly and making Emacs nonfunctional. */); The functions are run using the `run-hooks' function. */); Vfirst_change_hook = Qnil; - DEFVAR_PER_BUFFER ("buffer-undo-list", &B_ (current_buffer, undo_list), Qnil, + DEFVAR_PER_BUFFER ("buffer-undo-list", &BVAR (current_buffer, undo_list), Qnil, doc: /* List of undo entries in current buffer. Recent changes come first; older changes follow newer. @@ -6007,10 +6007,10 @@ the changes between two undo boundaries as a single step to be undone. If the value of the variable is t, undo information is not recorded. */); - DEFVAR_PER_BUFFER ("mark-active", &B_ (current_buffer, mark_active), Qnil, + DEFVAR_PER_BUFFER ("mark-active", &BVAR (current_buffer, mark_active), Qnil, doc: /* Non-nil means the mark and region are currently active in this buffer. */); - DEFVAR_PER_BUFFER ("cache-long-line-scans", &B_ (current_buffer, cache_long_line_scans), Qnil, + DEFVAR_PER_BUFFER ("cache-long-line-scans", &BVAR (current_buffer, cache_long_line_scans), Qnil, doc: /* Non-nil means that Emacs should use caches to handle long lines more quickly. Normally, the line-motion functions work by scanning the buffer for @@ -6038,23 +6038,23 @@ maintained internally by the Emacs primitives. Enabling or disabling the cache should not affect the behavior of any of the motion functions; it should only affect their performance. */); - DEFVAR_PER_BUFFER ("point-before-scroll", &B_ (current_buffer, point_before_scroll), Qnil, + DEFVAR_PER_BUFFER ("point-before-scroll", &BVAR (current_buffer, point_before_scroll), Qnil, doc: /* Value of point before the last series of scroll operations, or nil. */); - DEFVAR_PER_BUFFER ("buffer-file-format", &B_ (current_buffer, file_format), Qnil, + DEFVAR_PER_BUFFER ("buffer-file-format", &BVAR (current_buffer, file_format), Qnil, doc: /* List of formats to use when saving this buffer. Formats are defined by `format-alist'. This variable is set when a file is visited. */); DEFVAR_PER_BUFFER ("buffer-auto-save-file-format", - &B_ (current_buffer, auto_save_file_format), Qnil, + &BVAR (current_buffer, auto_save_file_format), Qnil, doc: /* *Format in which to write auto-save files. Should be a list of symbols naming formats that are defined in `format-alist'. If it is t, which is the default, auto-save files are written in the same format as a regular save would use. */); DEFVAR_PER_BUFFER ("buffer-invisibility-spec", - &B_ (current_buffer, invisibility_spec), Qnil, + &BVAR (current_buffer, invisibility_spec), Qnil, doc: /* Invisibility spec of this buffer. The default is t, which means that text is invisible if it has a non-nil `invisible' property. @@ -6065,12 +6065,12 @@ then characters with property value PROP are invisible, and they have an ellipsis as well if ELLIPSIS is non-nil. */); DEFVAR_PER_BUFFER ("buffer-display-count", - &B_ (current_buffer, display_count), Qnil, + &BVAR (current_buffer, display_count), Qnil, doc: /* A number incremented each time this buffer is displayed in a window. The function `set-window-buffer' increments it. */); DEFVAR_PER_BUFFER ("buffer-display-time", - &B_ (current_buffer, display_time), Qnil, + &BVAR (current_buffer, display_time), Qnil, doc: /* Time stamp updated each time this buffer is displayed in a window. The function `set-window-buffer' updates this variable to the value obtained by calling `current-time'. @@ -6105,7 +6105,7 @@ and disregard a `read-only' text property if the property value is a member of the list. */); Vinhibit_read_only = Qnil; - DEFVAR_PER_BUFFER ("cursor-type", &B_ (current_buffer, cursor_type), Qnil, + DEFVAR_PER_BUFFER ("cursor-type", &BVAR (current_buffer, cursor_type), Qnil, doc: /* Cursor to use when this buffer is in the selected window. Values are interpreted as follows: @@ -6124,7 +6124,7 @@ cursor's appearance is instead controlled by the variable `cursor-in-non-selected-windows'. */); DEFVAR_PER_BUFFER ("line-spacing", - &B_ (current_buffer, extra_line_spacing), Qnil, + &BVAR (current_buffer, extra_line_spacing), Qnil, doc: /* Additional space to put between lines when displaying a buffer. The space is measured in pixels, and put below lines on graphic displays, see `display-graphic-p'. @@ -6132,7 +6132,7 @@ If value is a floating point number, it specifies the spacing relative to the default frame line height. A value of nil means add no extra space. */); DEFVAR_PER_BUFFER ("cursor-in-non-selected-windows", - &B_ (current_buffer, cursor_in_non_selected_windows), Qnil, + &BVAR (current_buffer, cursor_in_non_selected_windows), Qnil, doc: /* *Non-nil means show a cursor in non-selected windows. If nil, only shows a cursor in the selected window. If t, displays a cursor related to the usual cursor type diff --git a/src/buffer.h b/src/buffer.h index 36cb5fe9dda..19a7c0b4632 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -321,7 +321,7 @@ while (0) /* Return character at byte position POS. */ #define FETCH_CHAR(pos) \ - (!NILP (B_ (current_buffer, enable_multibyte_characters)) \ + (!NILP (BVAR (current_buffer, enable_multibyte_characters)) \ ? FETCH_MULTIBYTE_CHAR ((pos)) \ : FETCH_BYTE ((pos))) @@ -346,7 +346,7 @@ extern unsigned char *_fetch_multibyte_char_p; multibyte. */ #define FETCH_CHAR_AS_MULTIBYTE(pos) \ - (!NILP (B_ (current_buffer, enable_multibyte_characters)) \ + (!NILP (BVAR (current_buffer, enable_multibyte_characters)) \ ? FETCH_MULTIBYTE_CHAR ((pos)) \ : UNIBYTE_TO_CHAR (FETCH_BYTE ((pos)))) @@ -465,13 +465,13 @@ struct buffer_text }; /* Lisp fields in struct buffer are hidden from most code and accessed - via the B_ macro, below. Only select pieces of code, like the GC, + via the BVAR macro, below. Only select pieces of code, like the GC, are allowed to use BUFFER_INTERNAL_FIELD. */ #define BUFFER_INTERNAL_FIELD(field) field ## _ /* Most code should use this macro to access Lisp fields in struct buffer. */ -#define B_(buf, field) ((buf)->BUFFER_INTERNAL_FIELD (field)) +#define BVAR(buf, field) ((buf)->BUFFER_INTERNAL_FIELD (field)) /* This is the structure that the buffer Lisp object points to. */ diff --git a/src/bytecode.c b/src/bytecode.c index a470eca16a9..a88df080c5a 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -1398,7 +1398,7 @@ If the third argument is incorrect, Emacs may crash. */) CHECK_CHARACTER (TOP); AFTER_POTENTIAL_GC (); c = XFASTINT (TOP); - if (NILP (B_ (current_buffer, enable_multibyte_characters))) + if (NILP (BVAR (current_buffer, enable_multibyte_characters))) MAKE_CHAR_MULTIBYTE (c); XSETFASTINT (TOP, syntax_code_spec[(int) SYNTAX (c)]); } diff --git a/src/callint.c b/src/callint.c index 154659490b8..b998c70187d 100644 --- a/src/callint.c +++ b/src/callint.c @@ -149,12 +149,12 @@ static void check_mark (int for_region) { Lisp_Object tem; - tem = Fmarker_buffer (B_ (current_buffer, mark)); + tem = Fmarker_buffer (BVAR (current_buffer, mark)); if (NILP (tem) || (XBUFFER (tem) != current_buffer)) error (for_region ? "The mark is not set now, so there is no region" : "The mark is not set now"); if (!NILP (Vtransient_mark_mode) && NILP (Vmark_even_if_inactive) - && NILP (B_ (current_buffer, mark_active))) + && NILP (BVAR (current_buffer, mark_active))) xsignal0 (Qmark_inactive); } @@ -385,7 +385,7 @@ invoke it. If KEYS is omitted or nil, the return value of else if (*string == '*') { string++; - if (!NILP (B_ (current_buffer, read_only))) + if (!NILP (BVAR (current_buffer, read_only))) { if (!NILP (record_flag)) { @@ -543,7 +543,7 @@ invoke it. If KEYS is omitted or nil, the return value of case 'D': /* Directory name. */ args[i] = Fread_file_name (callint_message, Qnil, - B_ (current_buffer, directory), Qlambda, Qnil, + BVAR (current_buffer, directory), Qlambda, Qnil, Qfile_directory_p); break; @@ -661,7 +661,7 @@ invoke it. If KEYS is omitted or nil, the return value of case 'm': /* Value of mark. Does not do I/O. */ check_mark (0); /* visargs[i] = Qnil; */ - args[i] = B_ (current_buffer, mark); + args[i] = BVAR (current_buffer, mark); varies[i] = 2; break; @@ -717,11 +717,11 @@ invoke it. If KEYS is omitted or nil, the return value of check_mark (1); set_marker_both (point_marker, Qnil, PT, PT_BYTE); /* visargs[i+1] = Qnil; */ - foo = marker_position (B_ (current_buffer, mark)); + foo = marker_position (BVAR (current_buffer, mark)); /* visargs[i] = Qnil; */ - args[i] = PT < foo ? point_marker : B_ (current_buffer, mark); + args[i] = PT < foo ? point_marker : BVAR (current_buffer, mark); varies[i] = 3; - args[++i] = PT > foo ? point_marker : B_ (current_buffer, mark); + args[++i] = PT > foo ? point_marker : BVAR (current_buffer, mark); varies[i] = 4; break; diff --git a/src/callproc.c b/src/callproc.c index bdd3060bef1..20018c688c9 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -265,7 +265,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) if (nargs >= 2 && ! NILP (args[1])) { - infile = Fexpand_file_name (args[1], B_ (current_buffer, directory)); + infile = Fexpand_file_name (args[1], BVAR (current_buffer, directory)); CHECK_STRING (infile); } else @@ -322,7 +322,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) { struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; - current_dir = B_ (current_buffer, directory); + current_dir = BVAR (current_buffer, directory); GCPRO4 (infile, buffer, current_dir, error_file); @@ -336,7 +336,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) if (NILP (Ffile_accessible_directory_p (current_dir))) report_file_error ("Setting current directory", - Fcons (B_ (current_buffer, directory), Qnil)); + Fcons (BVAR (current_buffer, directory), Qnil)); if (STRING_MULTIBYTE (infile)) infile = ENCODE_FILE (infile); @@ -663,7 +663,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) /* In unibyte mode, character code conversion should not take place but EOL conversion should. So, setup raw-text or one of the subsidiary according to the information just setup. */ - if (NILP (B_ (current_buffer, enable_multibyte_characters)) + if (NILP (BVAR (current_buffer, enable_multibyte_characters)) && !NILP (val)) val = raw_text_coding_system (val); setup_coding_system (val, &process_coding); @@ -713,7 +713,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) if (!NILP (buffer)) { - if (NILP (B_ (current_buffer, enable_multibyte_characters)) + if (NILP (BVAR (current_buffer, enable_multibyte_characters)) && ! CODING_MAY_REQUIRE_DECODING (&process_coding)) insert_1_both (buf, nread, nread, 0, 1, 0); else @@ -926,7 +926,7 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r /* Decide coding-system of the contents of the temporary file. */ if (!NILP (Vcoding_system_for_write)) val = Vcoding_system_for_write; - else if (NILP (B_ (current_buffer, enable_multibyte_characters))) + else if (NILP (BVAR (current_buffer, enable_multibyte_characters))) val = Qraw_text; else { diff --git a/src/casefiddle.c b/src/casefiddle.c index 6c05aecffe8..26fa0db2d77 100644 --- a/src/casefiddle.c +++ b/src/casefiddle.c @@ -39,15 +39,15 @@ casify_object (enum case_action flag, Lisp_Object obj) register int inword = flag == CASE_DOWN; /* If the case table is flagged as modified, rescan it. */ - if (NILP (XCHAR_TABLE (B_ (current_buffer, downcase_table))->extras[1])) - Fset_case_table (B_ (current_buffer, downcase_table)); + if (NILP (XCHAR_TABLE (BVAR (current_buffer, downcase_table))->extras[1])) + Fset_case_table (BVAR (current_buffer, downcase_table)); if (INTEGERP (obj)) { int flagbits = (CHAR_ALT | CHAR_SUPER | CHAR_HYPER | CHAR_SHIFT | CHAR_CTL | CHAR_META); int flags = XINT (obj) & flagbits; - int multibyte = ! NILP (B_ (current_buffer, enable_multibyte_characters)); + int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); /* If the character has higher bits set above the flags, return it unchanged. @@ -198,7 +198,7 @@ casify_region (enum case_action flag, Lisp_Object b, Lisp_Object e) { register int c; register int inword = flag == CASE_DOWN; - register int multibyte = !NILP (B_ (current_buffer, enable_multibyte_characters)); + register int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); EMACS_INT start, end; EMACS_INT start_byte, end_byte; EMACS_INT first = -1, last; /* Position of first and last changes. */ @@ -210,8 +210,8 @@ casify_region (enum case_action flag, Lisp_Object b, Lisp_Object e) return; /* If the case table is flagged as modified, rescan it. */ - if (NILP (XCHAR_TABLE (B_ (current_buffer, downcase_table))->extras[1])) - Fset_case_table (B_ (current_buffer, downcase_table)); + if (NILP (XCHAR_TABLE (BVAR (current_buffer, downcase_table))->extras[1])) + Fset_case_table (BVAR (current_buffer, downcase_table)); validate_region (&b, &e); start = XFASTINT (b); diff --git a/src/casetab.c b/src/casetab.c index 85c2d6e1581..5207e5315ae 100644 --- a/src/casetab.c +++ b/src/casetab.c @@ -71,7 +71,7 @@ DEFUN ("current-case-table", Fcurrent_case_table, Scurrent_case_table, 0, 0, 0, doc: /* Return the case table of the current buffer. */) (void) { - return B_ (current_buffer, downcase_table); + return BVAR (current_buffer, downcase_table); } DEFUN ("standard-case-table", Fstandard_case_table, Sstandard_case_table, 0, 0, 0, @@ -160,10 +160,10 @@ set_case_table (Lisp_Object table, int standard) } else { - B_ (current_buffer, downcase_table) = table; - B_ (current_buffer, upcase_table) = up; - B_ (current_buffer, case_canon_table) = canon; - B_ (current_buffer, case_eqv_table) = eqv; + BVAR (current_buffer, downcase_table) = table; + BVAR (current_buffer, upcase_table) = up; + BVAR (current_buffer, case_canon_table) = canon; + BVAR (current_buffer, case_eqv_table) = eqv; } return table; diff --git a/src/category.c b/src/category.c index bf8269ffd75..bcd73d3a487 100644 --- a/src/category.c +++ b/src/category.c @@ -190,7 +190,7 @@ Lisp_Object check_category_table (Lisp_Object table) { if (NILP (table)) - return B_ (current_buffer, category_table); + return BVAR (current_buffer, category_table); CHECK_TYPE (!NILP (Fcategory_table_p (table)), Qcategory_table_p, table); return table; } @@ -200,7 +200,7 @@ DEFUN ("category-table", Fcategory_table, Scategory_table, 0, 0, 0, This is the one specified by the current buffer. */) (void) { - return B_ (current_buffer, category_table); + return BVAR (current_buffer, category_table); } DEFUN ("standard-category-table", Fstandard_category_table, @@ -281,7 +281,7 @@ Return TABLE. */) { int idx; table = check_category_table (table); - B_ (current_buffer, category_table) = table; + BVAR (current_buffer, category_table) = table; /* Indicate that this buffer now has a specified category table. */ idx = PER_BUFFER_VAR_IDX (category_table); SET_PER_BUFFER_VALUE_P (current_buffer, idx, 1); @@ -292,7 +292,7 @@ Return TABLE. */) Lisp_Object char_category_set (int c) { - return CHAR_TABLE_REF (B_ (current_buffer, category_table), c); + return CHAR_TABLE_REF (BVAR (current_buffer, category_table), c); } DEFUN ("char-category-set", Fchar_category_set, Schar_category_set, 1, 1, 0, diff --git a/src/category.h b/src/category.h index 16b31da0819..b279f3d9c59 100644 --- a/src/category.h +++ b/src/category.h @@ -91,7 +91,7 @@ extern Lisp_Object _temp_category_set; /* The standard category table is stored where it will automatically be used in all new buffers. */ -#define Vstandard_category_table B_ (&buffer_defaults, category_table) +#define Vstandard_category_table BVAR (&buffer_defaults, category_table) /* Return the category set of character C in the current category table. */ #define CATEGORY_SET(c) char_category_set (c) diff --git a/src/character.c b/src/character.c index e4ff3d7922c..f12c4f28d31 100644 --- a/src/character.c +++ b/src/character.c @@ -521,7 +521,7 @@ chars_in_text (const unsigned char *ptr, EMACS_INT nbytes) { /* current_buffer is null at early stages of Emacs initialization. */ if (current_buffer == 0 - || NILP (B_ (current_buffer, enable_multibyte_characters))) + || NILP (BVAR (current_buffer, enable_multibyte_characters))) return nbytes; return multibyte_chars_in_text (ptr, nbytes); @@ -987,7 +987,7 @@ character is not ASCII nor 8-bit character, an error is signalled. */) pos = XFASTINT (position); p = CHAR_POS_ADDR (pos); } - if (NILP (B_ (current_buffer, enable_multibyte_characters))) + if (NILP (BVAR (current_buffer, enable_multibyte_characters))) return make_number (*p); } else diff --git a/src/character.h b/src/character.h index f2d06102f62..fb29ced66b7 100644 --- a/src/character.h +++ b/src/character.h @@ -417,7 +417,7 @@ along with GNU Emacs. If not, see . */ do \ { \ CHARIDX++; \ - if (!NILP (B_ (current_buffer, enable_multibyte_characters))) \ + if (!NILP (BVAR (current_buffer, enable_multibyte_characters))) \ { \ unsigned char *ptr = BYTE_POS_ADDR (BYTEIDX); \ int len; \ @@ -484,7 +484,7 @@ along with GNU Emacs. If not, see . */ do \ { \ (charpos)++; \ - if (NILP (B_ (current_buffer, enable_multibyte_characters))) \ + if (NILP (BVAR (current_buffer, enable_multibyte_characters))) \ (bytepos)++; \ else \ INC_POS ((bytepos)); \ @@ -498,7 +498,7 @@ along with GNU Emacs. If not, see . */ do \ { \ (charpos)--; \ - if (NILP (B_ (current_buffer, enable_multibyte_characters))) \ + if (NILP (BVAR (current_buffer, enable_multibyte_characters))) \ (bytepos)--; \ else \ DEC_POS ((bytepos)); \ @@ -561,11 +561,11 @@ along with GNU Emacs. If not, see . */ #define ASCII_CHAR_WIDTH(c) \ (c < 0x20 \ ? (c == '\t' \ - ? XFASTINT (B_ (current_buffer, tab_width)) \ - : (c == '\n' ? 0 : (NILP (B_ (current_buffer, ctl_arrow)) ? 4 : 2))) \ + ? XFASTINT (BVAR (current_buffer, tab_width)) \ + : (c == '\n' ? 0 : (NILP (BVAR (current_buffer, ctl_arrow)) ? 4 : 2))) \ : (c < 0x7f \ ? 1 \ - : ((NILP (B_ (current_buffer, ctl_arrow)) ? 4 : 2)))) + : ((NILP (BVAR (current_buffer, ctl_arrow)) ? 4 : 2)))) /* Return the width of character C. The width is measured by how many columns C will occupy on the screen when displayed in the current diff --git a/src/charset.c b/src/charset.c index 80e6a114197..3624e740acb 100644 --- a/src/charset.c +++ b/src/charset.c @@ -1554,7 +1554,7 @@ only `ascii', `eight-bit-control', and `eight-bit-graphic'. */) EMACS_INT from, from_byte, to, stop, stop_byte; int i; Lisp_Object val; - int multibyte = ! NILP (B_ (current_buffer, enable_multibyte_characters)); + int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); validate_region (&beg, &end); from = XFASTINT (beg); diff --git a/src/cmds.c b/src/cmds.c index e82ada6f03c..253b8d6a5ec 100644 --- a/src/cmds.c +++ b/src/cmds.c @@ -292,10 +292,10 @@ After insertion, the value of `auto-fill-function' is called if the } if (remove_boundary - && CONSP (B_ (current_buffer, undo_list)) - && NILP (XCAR (B_ (current_buffer, undo_list)))) + && CONSP (BVAR (current_buffer, undo_list)) + && NILP (XCAR (BVAR (current_buffer, undo_list)))) /* Remove the undo_boundary that was just pushed. */ - B_ (current_buffer, undo_list) = XCDR (B_ (current_buffer, undo_list)); + BVAR (current_buffer, undo_list) = XCDR (BVAR (current_buffer, undo_list)); /* Barf if the key that invoked this was not a character. */ if (!CHARACTERP (last_command_event)) @@ -335,12 +335,12 @@ internal_self_insert (int c, EMACS_INT n) EMACS_INT chars_to_delete = 0; EMACS_INT spaces_to_insert = 0; - overwrite = B_ (current_buffer, overwrite_mode); + overwrite = BVAR (current_buffer, overwrite_mode); if (!NILP (Vbefore_change_functions) || !NILP (Vafter_change_functions)) hairy = 1; /* At first, get multi-byte form of C in STR. */ - if (!NILP (B_ (current_buffer, enable_multibyte_characters))) + if (!NILP (BVAR (current_buffer, enable_multibyte_characters))) { len = CHAR_STRING (c, str); if (len == 1) @@ -416,11 +416,11 @@ internal_self_insert (int c, EMACS_INT n) synt = SYNTAX (c); - if (!NILP (B_ (current_buffer, abbrev_mode)) + if (!NILP (BVAR (current_buffer, abbrev_mode)) && synt != Sword - && NILP (B_ (current_buffer, read_only)) + && NILP (BVAR (current_buffer, read_only)) && PT > BEGV - && (SYNTAX (!NILP (B_ (current_buffer, enable_multibyte_characters)) + && (SYNTAX (!NILP (BVAR (current_buffer, enable_multibyte_characters)) ? XFASTINT (Fprevious_char ()) : UNIBYTE_TO_CHAR (XFASTINT (Fprevious_char ()))) == Sword)) @@ -448,7 +448,7 @@ internal_self_insert (int c, EMACS_INT n) if (chars_to_delete) { - int mc = ((NILP (B_ (current_buffer, enable_multibyte_characters)) + int mc = ((NILP (BVAR (current_buffer, enable_multibyte_characters)) && SINGLE_BYTE_CHAR_P (c)) ? UNIBYTE_TO_CHAR (c) : c); Lisp_Object string = Fmake_string (make_number (n), make_number (mc)); @@ -479,7 +479,7 @@ internal_self_insert (int c, EMACS_INT n) if ((CHAR_TABLE_P (Vauto_fill_chars) ? !NILP (CHAR_TABLE_REF (Vauto_fill_chars, c)) : (c == ' ' || c == '\n')) - && !NILP (B_ (current_buffer, auto_fill_function))) + && !NILP (BVAR (current_buffer, auto_fill_function))) { Lisp_Object tem; @@ -488,7 +488,7 @@ internal_self_insert (int c, EMACS_INT n) that. Must have the newline in place already so filling and justification, if any, know where the end is going to be. */ SET_PT_BOTH (PT - 1, PT_BYTE - 1); - tem = call0 (B_ (current_buffer, auto_fill_function)); + tem = call0 (BVAR (current_buffer, auto_fill_function)); /* Test PT < ZV in case the auto-fill-function is strange. */ if (c == '\n' && PT < ZV) SET_PT_BOTH (PT + 1, PT_BYTE + 1); diff --git a/src/coding.c b/src/coding.c index 899cca6d5aa..f6310369ad3 100644 --- a/src/coding.c +++ b/src/coding.c @@ -7038,8 +7038,8 @@ decode_coding (struct coding_system *coding) set_buffer_internal (XBUFFER (coding->dst_object)); if (GPT != PT) move_gap_both (PT, PT_BYTE); - undo_list = B_ (current_buffer, undo_list); - B_ (current_buffer, undo_list) = Qt; + undo_list = BVAR (current_buffer, undo_list); + BVAR (current_buffer, undo_list) = Qt; } coding->consumed = coding->consumed_char = 0; @@ -7136,7 +7136,7 @@ decode_coding (struct coding_system *coding) decode_eol (coding); if (BUFFERP (coding->dst_object)) { - B_ (current_buffer, undo_list) = undo_list; + BVAR (current_buffer, undo_list) = undo_list; record_insert (coding->dst_pos, coding->produced_char); } return coding->result; @@ -7433,7 +7433,7 @@ encode_coding (struct coding_system *coding) { set_buffer_internal (XBUFFER (coding->dst_object)); coding->dst_multibyte - = ! NILP (B_ (current_buffer, enable_multibyte_characters)); + = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); } coding->consumed = coding->consumed_char = 0; @@ -7504,8 +7504,8 @@ make_conversion_work_buffer (int multibyte) doesn't compile new regexps. */ Fset (Fmake_local_variable (Qinhibit_modification_hooks), Qt); Ferase_buffer (); - B_ (current_buffer, undo_list) = Qt; - B_ (current_buffer, enable_multibyte_characters) = multibyte ? Qt : Qnil; + BVAR (current_buffer, undo_list) = Qt; + BVAR (current_buffer, enable_multibyte_characters) = multibyte ? Qt : Qnil; set_buffer_internal (current); return workbuf; } @@ -7562,7 +7562,7 @@ decode_coding_gap (struct coding_system *coding, coding->dst_object = coding->src_object; coding->dst_pos = PT; coding->dst_pos_byte = PT_BYTE; - coding->dst_multibyte = ! NILP (B_ (current_buffer, enable_multibyte_characters)); + coding->dst_multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); if (CODING_REQUIRE_DETECTION (coding)) detect_coding (coding); @@ -7728,7 +7728,7 @@ decode_coding_object (struct coding_system *coding, coding->dst_pos = BUF_PT (XBUFFER (dst_object)); coding->dst_pos_byte = BUF_PT_BYTE (XBUFFER (dst_object)); coding->dst_multibyte - = ! NILP (B_ (XBUFFER (dst_object), enable_multibyte_characters)); + = ! NILP (BVAR (XBUFFER (dst_object), enable_multibyte_characters)); } else { @@ -7798,7 +7798,7 @@ decode_coding_object (struct coding_system *coding, TEMP_SET_PT_BOTH (saved_pt, saved_pt_byte); else if (saved_pt < from + chars) TEMP_SET_PT_BOTH (from, from_byte); - else if (! NILP (B_ (current_buffer, enable_multibyte_characters))) + else if (! NILP (BVAR (current_buffer, enable_multibyte_characters))) TEMP_SET_PT_BOTH (saved_pt + (coding->produced_char - chars), saved_pt_byte + (coding->produced - bytes)); else @@ -7822,7 +7822,7 @@ decode_coding_object (struct coding_system *coding, { tail->bytepos = from_byte + coding->produced; tail->charpos - = (NILP (B_ (current_buffer, enable_multibyte_characters)) + = (NILP (BVAR (current_buffer, enable_multibyte_characters)) ? tail->bytepos : from + coding->produced_char); } } @@ -7960,7 +7960,7 @@ encode_coding_object (struct coding_system *coding, set_buffer_temp (current); } coding->dst_multibyte - = ! NILP (B_ (XBUFFER (dst_object), enable_multibyte_characters)); + = ! NILP (BVAR (XBUFFER (dst_object), enable_multibyte_characters)); } else if (EQ (dst_object, Qt)) { @@ -8003,7 +8003,7 @@ encode_coding_object (struct coding_system *coding, TEMP_SET_PT_BOTH (saved_pt, saved_pt_byte); else if (saved_pt < from + chars) TEMP_SET_PT_BOTH (from, from_byte); - else if (! NILP (B_ (current_buffer, enable_multibyte_characters))) + else if (! NILP (BVAR (current_buffer, enable_multibyte_characters))) TEMP_SET_PT_BOTH (saved_pt + (coding->produced_char - chars), saved_pt_byte + (coding->produced - bytes)); else @@ -8027,7 +8027,7 @@ encode_coding_object (struct coding_system *coding, { tail->bytepos = from_byte + coding->produced; tail->charpos - = (NILP (B_ (current_buffer, enable_multibyte_characters)) + = (NILP (BVAR (current_buffer, enable_multibyte_characters)) ? tail->bytepos : from + coding->produced_char); } } @@ -8481,7 +8481,7 @@ highest priority. */) return detect_coding_system (BYTE_POS_ADDR (from_byte), to - from, to_byte - from_byte, !NILP (highest), - !NILP (B_ (current_buffer + !NILP (BVAR (current_buffer , enable_multibyte_characters)), Qnil); } @@ -8564,7 +8564,7 @@ DEFUN ("find-coding-systems-region-internal", CHECK_NUMBER_COERCE_MARKER (end); if (XINT (start) < BEG || XINT (end) > Z || XINT (start) > XINT (end)) args_out_of_range (start, end); - if (NILP (B_ (current_buffer, enable_multibyte_characters))) + if (NILP (BVAR (current_buffer, enable_multibyte_characters))) return Qt; start_byte = CHAR_TO_BYTE (XINT (start)); end_byte = CHAR_TO_BYTE (XINT (end)); @@ -8698,7 +8698,7 @@ to the string. */) validate_region (&start, &end); from = XINT (start); to = XINT (end); - if (NILP (B_ (current_buffer, enable_multibyte_characters)) + if (NILP (BVAR (current_buffer, enable_multibyte_characters)) || (ascii_compatible && (to - from) == (CHAR_TO_BYTE (to) - (CHAR_TO_BYTE (from))))) return Qnil; @@ -8814,7 +8814,7 @@ is nil. */) CHECK_NUMBER_COERCE_MARKER (end); if (XINT (start) < BEG || XINT (end) > Z || XINT (start) > XINT (end)) args_out_of_range (start, end); - if (NILP (B_ (current_buffer, enable_multibyte_characters))) + if (NILP (BVAR (current_buffer, enable_multibyte_characters))) return Qnil; start_byte = CHAR_TO_BYTE (XINT (start)); end_byte = CHAR_TO_BYTE (XINT (end)); diff --git a/src/composite.c b/src/composite.c index 3c941ea6614..0b0602bf283 100644 --- a/src/composite.c +++ b/src/composite.c @@ -796,7 +796,7 @@ fill_gstring_header (Lisp_Object header, Lisp_Object start, Lisp_Object end, Lis if (NILP (string)) { - if (NILP (B_ (current_buffer, enable_multibyte_characters))) + if (NILP (BVAR (current_buffer, enable_multibyte_characters))) error ("Attempt to shape unibyte text"); validate_region (&start, &end); from = XFASTINT (start); @@ -1028,7 +1028,7 @@ composition_compute_stop_pos (struct composition_it *cmp_it, EMACS_INT charpos, cmp_it->stop_pos = endpos = start; cmp_it->ch = -1; } - if (NILP (B_ (current_buffer, enable_multibyte_characters)) + if (NILP (BVAR (current_buffer, enable_multibyte_characters)) || NILP (Vauto_composition_mode)) return; if (bytepos < 0) @@ -1674,7 +1674,7 @@ composition_adjust_point (EMACS_INT last_pt, EMACS_INT new_pt) return new_pt; } - if (NILP (B_ (current_buffer, enable_multibyte_characters)) + if (NILP (BVAR (current_buffer, enable_multibyte_characters)) || NILP (Vauto_composition_mode)) return new_pt; @@ -1851,7 +1851,7 @@ See `find-composition' for more details. */) if (!find_composition (from, to, &start, &end, &prop, string)) { - if (!NILP (B_ (current_buffer, enable_multibyte_characters)) + if (!NILP (BVAR (current_buffer, enable_multibyte_characters)) && ! NILP (Vauto_composition_mode) && find_automatic_composition (from, to, &start, &end, &gstring, string)) diff --git a/src/data.c b/src/data.c index c0557d5c735..d0afca6a09f 100644 --- a/src/data.c +++ b/src/data.c @@ -1009,7 +1009,7 @@ swap_in_symval_forwarding (struct Lisp_Symbol *symbol, struct Lisp_Buffer_Local_ } else { - tem1 = assq_no_quit (var, B_ (current_buffer, local_var_alist)); + tem1 = assq_no_quit (var, BVAR (current_buffer, local_var_alist)); XSETBUFFER (blv->where, current_buffer); } } @@ -1178,7 +1178,7 @@ set_internal (register Lisp_Object symbol, register Lisp_Object newval, register tem1 = Fassq (symbol, (blv->frame_local ? XFRAME (where)->param_alist - : B_ (XBUFFER (where), local_var_alist))); + : BVAR (XBUFFER (where), local_var_alist))); blv->where = where; blv->found = 1; @@ -1209,8 +1209,8 @@ set_internal (register Lisp_Object symbol, register Lisp_Object newval, register bindings, not for frame-local bindings. */ eassert (!blv->frame_local); tem1 = Fcons (symbol, XCDR (blv->defcell)); - B_ (XBUFFER (where), local_var_alist) - = Fcons (tem1, B_ (XBUFFER (where), local_var_alist)); + BVAR (XBUFFER (where), local_var_alist) + = Fcons (tem1, BVAR (XBUFFER (where), local_var_alist)); } } @@ -1632,13 +1632,13 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */) if (let_shadows_global_binding_p (symbol)) message ("Making %s local to %s while let-bound!", SDATA (SYMBOL_NAME (variable)), - SDATA (B_ (current_buffer, name))); + SDATA (BVAR (current_buffer, name))); } } /* Make sure this buffer has its own value of symbol. */ XSETSYMBOL (variable, sym); /* Update in case of aliasing. */ - tem = Fassq (variable, B_ (current_buffer, local_var_alist)); + tem = Fassq (variable, BVAR (current_buffer, local_var_alist)); if (NILP (tem)) { if (let_shadows_buffer_binding_p (sym)) @@ -1650,9 +1650,9 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */) default value. */ find_symbol_value (variable); - B_ (current_buffer, local_var_alist) + BVAR (current_buffer, local_var_alist) = Fcons (Fcons (variable, XCDR (blv->defcell)), - B_ (current_buffer, local_var_alist)); + BVAR (current_buffer, local_var_alist)); /* Make sure symbol does not think it is set up for this buffer; force it to look once again for this buffer's value. */ @@ -1718,10 +1718,10 @@ From now on the default value will apply in this buffer. Return VARIABLE. */) /* Get rid of this buffer's alist element, if any. */ XSETSYMBOL (variable, sym); /* Propagate variable indirection. */ - tem = Fassq (variable, B_ (current_buffer, local_var_alist)); + tem = Fassq (variable, BVAR (current_buffer, local_var_alist)); if (!NILP (tem)) - B_ (current_buffer, local_var_alist) - = Fdelq (tem, B_ (current_buffer, local_var_alist)); + BVAR (current_buffer, local_var_alist) + = Fdelq (tem, BVAR (current_buffer, local_var_alist)); /* If the symbol is set up with the current buffer's binding loaded, recompute its value. We have to do it now, or else @@ -1848,7 +1848,7 @@ BUFFER defaults to the current buffer. */) XSETBUFFER (tmp, buf); XSETSYMBOL (variable, sym); /* Update in case of aliasing. */ - for (tail = B_ (buf, local_var_alist); CONSP (tail); tail = XCDR (tail)) + for (tail = BVAR (buf, local_var_alist); CONSP (tail); tail = XCDR (tail)) { elt = XCAR (tail); if (EQ (variable, XCAR (elt))) diff --git a/src/dired.c b/src/dired.c index f1dc03b56d0..7b4b83cbe54 100644 --- a/src/dired.c +++ b/src/dired.c @@ -158,7 +158,7 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, Lisp_Object m # ifdef WINDOWSNT /* Windows users want case-insensitive wildcards. */ bufp = compile_pattern (match, 0, - B_ (&buffer_defaults, case_canon_table), 0, 1); + BVAR (&buffer_defaults, case_canon_table), 0, 1); # else /* !WINDOWSNT */ bufp = compile_pattern (match, 0, Qnil, 0, 1); # endif /* !WINDOWSNT */ diff --git a/src/dispextern.h b/src/dispextern.h index e01c1a961f7..6bb0c3a6aae 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -1416,7 +1416,7 @@ struct glyph_string && !(W)->pseudo_window_p \ && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W)))) \ && BUFFERP ((W)->buffer) \ - && !NILP (B_ (XBUFFER ((W)->buffer), mode_line_format)) \ + && !NILP (BVAR (XBUFFER ((W)->buffer), mode_line_format)) \ && WINDOW_TOTAL_LINES (W) > 1) /* Value is non-zero if window W wants a header line. */ @@ -1426,8 +1426,8 @@ struct glyph_string && !(W)->pseudo_window_p \ && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W)))) \ && BUFFERP ((W)->buffer) \ - && !NILP (B_ (XBUFFER ((W)->buffer), header_line_format)) \ - && WINDOW_TOTAL_LINES (W) > 1 + !NILP (B_ (XBUFFER ((W)->buffer), mode_line_format))) + && !NILP (BVAR (XBUFFER ((W)->buffer), header_line_format)) \ + && WINDOW_TOTAL_LINES (W) > 1 + !NILP (BVAR (XBUFFER ((W)->buffer), mode_line_format))) /* Return proper value to be used as baseline offset of font that has diff --git a/src/dispnew.c b/src/dispnew.c index 2aa3d9208b3..4e068bde536 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -6129,7 +6129,7 @@ pass nil for VARIABLE. */) { buf = XCDR (XCAR (tail)); /* Ignore buffers that aren't included in buffer lists. */ - if (SREF (B_ (XBUFFER (buf), name), 0) == ' ') + if (SREF (BVAR (XBUFFER (buf), name), 0) == ' ') continue; if (vecp == end) goto changed; @@ -6137,7 +6137,7 @@ pass nil for VARIABLE. */) goto changed; if (vecp == end) goto changed; - if (!EQ (*vecp++, B_ (XBUFFER (buf), read_only))) + if (!EQ (*vecp++, BVAR (XBUFFER (buf), read_only))) goto changed; if (vecp == end) goto changed; @@ -6184,10 +6184,10 @@ pass nil for VARIABLE. */) { buf = XCDR (XCAR (tail)); /* Ignore buffers that aren't included in buffer lists. */ - if (SREF (B_ (XBUFFER (buf), name), 0) == ' ') + if (SREF (BVAR (XBUFFER (buf), name), 0) == ' ') continue; *vecp++ = buf; - *vecp++ = B_ (XBUFFER (buf), read_only); + *vecp++ = BVAR (XBUFFER (buf), read_only); *vecp++ = Fbuffer_modified_p (buf); } /* Fill up the vector with lambdas (always at least one). */ diff --git a/src/editfns.c b/src/editfns.c index a3de4907efc..5d6189f2a3c 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -306,10 +306,10 @@ region_limit (int beginningp) if (!NILP (Vtransient_mark_mode) && NILP (Vmark_even_if_inactive) - && NILP (B_ (current_buffer, mark_active))) + && NILP (BVAR (current_buffer, mark_active))) xsignal0 (Qmark_inactive); - m = Fmarker_position (B_ (current_buffer, mark)); + m = Fmarker_position (BVAR (current_buffer, mark)); if (NILP (m)) error ("The mark is not set now, so there is no region"); @@ -338,7 +338,7 @@ Watch out! Moving this marker changes the mark position. If you set the marker not to point anywhere, the buffer will have no mark. */) (void) { - return B_ (current_buffer, mark); + return BVAR (current_buffer, mark); } @@ -866,9 +866,9 @@ save_excursion_save (void) == current_buffer); return Fcons (Fpoint_marker (), - Fcons (Fcopy_marker (B_ (current_buffer, mark), Qnil), + Fcons (Fcopy_marker (BVAR (current_buffer, mark), Qnil), Fcons (visible ? Qt : Qnil, - Fcons (B_ (current_buffer, mark_active), + Fcons (BVAR (current_buffer, mark_active), selected_window)))); } @@ -900,8 +900,8 @@ save_excursion_restore (Lisp_Object info) /* Mark marker. */ info = XCDR (info); tem = XCAR (info); - omark = Fmarker_position (B_ (current_buffer, mark)); - Fset_marker (B_ (current_buffer, mark), tem, Fcurrent_buffer ()); + omark = Fmarker_position (BVAR (current_buffer, mark)); + Fset_marker (BVAR (current_buffer, mark), tem, Fcurrent_buffer ()); nmark = Fmarker_position (tem); unchain_marker (XMARKER (tem)); @@ -922,14 +922,14 @@ save_excursion_restore (Lisp_Object info) /* Mark active */ info = XCDR (info); tem = XCAR (info); - tem1 = B_ (current_buffer, mark_active); - B_ (current_buffer, mark_active) = tem; + tem1 = BVAR (current_buffer, mark_active); + BVAR (current_buffer, mark_active) = tem; if (!NILP (Vrun_hooks)) { /* If mark is active now, and either was not active or was at a different place, run the activate hook. */ - if (! NILP (B_ (current_buffer, mark_active))) + if (! NILP (BVAR (current_buffer, mark_active))) { if (! EQ (omark, nmark)) call1 (Vrun_hooks, intern ("activate-mark-hook")); @@ -1114,7 +1114,7 @@ At the beginning of the buffer or accessible region, return 0. */) Lisp_Object temp; if (PT <= BEGV) XSETFASTINT (temp, 0); - else if (!NILP (B_ (current_buffer, enable_multibyte_characters))) + else if (!NILP (BVAR (current_buffer, enable_multibyte_characters))) { EMACS_INT pos = PT_BYTE; DEC_POS (pos); @@ -1228,7 +1228,7 @@ If POS is out of range, the value is nil. */) pos_byte = CHAR_TO_BYTE (XINT (pos)); } - if (!NILP (B_ (current_buffer, enable_multibyte_characters))) + if (!NILP (BVAR (current_buffer, enable_multibyte_characters))) { DEC_POS (pos_byte); XSETFASTINT (val, FETCH_CHAR (pos_byte)); @@ -2135,7 +2135,7 @@ general_insert_function (void (*insert_func) unsigned char str[MAX_MULTIBYTE_LENGTH]; int len; - if (!NILP (B_ (current_buffer, enable_multibyte_characters))) + if (!NILP (BVAR (current_buffer, enable_multibyte_characters))) len = CHAR_STRING (XFASTINT (val), str); else { @@ -2267,7 +2267,7 @@ from adjoining text, if those properties are sticky. */) CHECK_NUMBER (character); CHECK_NUMBER (count); - if (!NILP (B_ (current_buffer, enable_multibyte_characters))) + if (!NILP (BVAR (current_buffer, enable_multibyte_characters))) len = CHAR_STRING (XFASTINT (character), str); else str[0] = XFASTINT (character), len = 1; @@ -2316,7 +2316,7 @@ from adjoining text, if those properties are sticky. */) if (XINT (byte) < 0 || XINT (byte) > 255) args_out_of_range_3 (byte, make_number (0), make_number (255)); if (XINT (byte) >= 128 - && ! NILP (B_ (current_buffer, enable_multibyte_characters))) + && ! NILP (BVAR (current_buffer, enable_multibyte_characters))) XSETFASTINT (byte, BYTE8_TO_CHAR (XINT (byte))); return Finsert_char (byte, count, inherit); } @@ -2370,7 +2370,7 @@ make_buffer_string_both (EMACS_INT start, EMACS_INT start_byte, if (start < GPT && GPT < end) move_gap (start); - if (! NILP (B_ (current_buffer, enable_multibyte_characters))) + if (! NILP (BVAR (current_buffer, enable_multibyte_characters))) result = make_uninit_multibyte_string (end - start, end_byte - start_byte); else result = make_uninit_string (end - start); @@ -2485,7 +2485,7 @@ They default to the values of (point-min) and (point-max) in BUFFER. */) if (NILP (buf)) nsberror (buffer); bp = XBUFFER (buf); - if (NILP (B_ (bp, name))) + if (NILP (BVAR (bp, name))) error ("Selecting deleted buffer"); if (NILP (start)) @@ -2533,8 +2533,8 @@ determines whether case is significant or ignored. */) register EMACS_INT begp1, endp1, begp2, endp2, temp; register struct buffer *bp1, *bp2; register Lisp_Object trt - = (!NILP (B_ (current_buffer, case_fold_search)) - ? B_ (current_buffer, case_canon_table) : Qnil); + = (!NILP (BVAR (current_buffer, case_fold_search)) + ? BVAR (current_buffer, case_canon_table) : Qnil); EMACS_INT chars = 0; EMACS_INT i1, i2, i1_byte, i2_byte; @@ -2549,7 +2549,7 @@ determines whether case is significant or ignored. */) if (NILP (buf1)) nsberror (buffer1); bp1 = XBUFFER (buf1); - if (NILP (B_ (bp1, name))) + if (NILP (BVAR (bp1, name))) error ("Selecting deleted buffer"); } @@ -2587,7 +2587,7 @@ determines whether case is significant or ignored. */) if (NILP (buf2)) nsberror (buffer2); bp2 = XBUFFER (buf2); - if (NILP (B_ (bp2, name))) + if (NILP (BVAR (bp2, name))) error ("Selecting deleted buffer"); } @@ -2627,7 +2627,7 @@ determines whether case is significant or ignored. */) QUIT; - if (! NILP (B_ (bp1, enable_multibyte_characters))) + if (! NILP (BVAR (bp1, enable_multibyte_characters))) { c1 = BUF_FETCH_MULTIBYTE_CHAR (bp1, i1_byte); BUF_INC_POS (bp1, i1_byte); @@ -2640,7 +2640,7 @@ determines whether case is significant or ignored. */) i1++; } - if (! NILP (B_ (bp2, enable_multibyte_characters))) + if (! NILP (BVAR (bp2, enable_multibyte_characters))) { c2 = BUF_FETCH_MULTIBYTE_CHAR (bp2, i2_byte); BUF_INC_POS (bp2, i2_byte); @@ -2680,13 +2680,13 @@ determines whether case is significant or ignored. */) static Lisp_Object subst_char_in_region_unwind (Lisp_Object arg) { - return B_ (current_buffer, undo_list) = arg; + return BVAR (current_buffer, undo_list) = arg; } static Lisp_Object subst_char_in_region_unwind_1 (Lisp_Object arg) { - return B_ (current_buffer, filename) = arg; + return BVAR (current_buffer, filename) = arg; } DEFUN ("subst-char-in-region", Fsubst_char_in_region, @@ -2712,7 +2712,7 @@ Both characters must have the same length of multi-byte form. */) #define COMBINING_BOTH (COMBINING_BEFORE | COMBINING_AFTER) int maybe_byte_combining = COMBINING_NO; EMACS_INT last_changed = 0; - int multibyte_p = !NILP (B_ (current_buffer, enable_multibyte_characters)); + int multibyte_p = !NILP (BVAR (current_buffer, enable_multibyte_characters)); restart: @@ -2756,12 +2756,12 @@ Both characters must have the same length of multi-byte form. */) if (!changed && !NILP (noundo)) { record_unwind_protect (subst_char_in_region_unwind, - B_ (current_buffer, undo_list)); - B_ (current_buffer, undo_list) = Qt; + BVAR (current_buffer, undo_list)); + BVAR (current_buffer, undo_list) = Qt; /* Don't do file-locking. */ record_unwind_protect (subst_char_in_region_unwind_1, - B_ (current_buffer, filename)); - B_ (current_buffer, filename) = Qnil; + BVAR (current_buffer, filename)); + BVAR (current_buffer, filename) = Qnil; } if (pos_byte < GPT_BYTE) @@ -2824,7 +2824,7 @@ Both characters must have the same length of multi-byte form. */) struct gcpro gcpro1; - tem = B_ (current_buffer, undo_list); + tem = BVAR (current_buffer, undo_list); GCPRO1 (tem); /* Make a multibyte string containing this single character. */ @@ -2843,7 +2843,7 @@ Both characters must have the same length of multi-byte form. */) INC_POS (pos_byte_next); if (! NILP (noundo)) - B_ (current_buffer, undo_list) = tem; + BVAR (current_buffer, undo_list) = tem; UNGCPRO; } @@ -2945,7 +2945,7 @@ It returns the number of characters changed. */) int cnt; /* Number of changes made. */ EMACS_INT size; /* Size of translate table. */ EMACS_INT pos, pos_byte, end_pos; - int multibyte = !NILP (B_ (current_buffer, enable_multibyte_characters)); + int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); int string_multibyte; Lisp_Object val; @@ -3206,7 +3206,7 @@ save_restriction_restore (Lisp_Object data) ? XMARKER (XCAR (data))->buffer : XBUFFER (data)); - if (buf && buf != current_buffer && !NILP (B_ (buf, pt_marker))) + if (buf && buf != current_buffer && !NILP (BVAR (buf, pt_marker))) { /* If `buf' uses markers to keep track of PT, BEGV, and ZV (as is the case if it is or has an indirect buffer), then make sure it is current before we update BEGV, so @@ -4136,20 +4136,20 @@ Case is ignored if `case-fold-search' is non-nil in the current buffer. */) if (XINT (c1) == XINT (c2)) return Qt; - if (NILP (B_ (current_buffer, case_fold_search))) + if (NILP (BVAR (current_buffer, case_fold_search))) return Qnil; /* Do these in separate statements, then compare the variables. because of the way DOWNCASE uses temp variables. */ i1 = XFASTINT (c1); - if (NILP (B_ (current_buffer, enable_multibyte_characters)) + if (NILP (BVAR (current_buffer, enable_multibyte_characters)) && ! ASCII_CHAR_P (i1)) { MAKE_CHAR_MULTIBYTE (i1); } i2 = XFASTINT (c2); - if (NILP (B_ (current_buffer, enable_multibyte_characters)) + if (NILP (BVAR (current_buffer, enable_multibyte_characters)) && ! ASCII_CHAR_P (i2)) { MAKE_CHAR_MULTIBYTE (i2); diff --git a/src/fileio.c b/src/fileio.c index 4a4935b43a2..3112d7620c6 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -770,7 +770,7 @@ filesystem tree, not (expand-file-name ".." dirname). */) /* Use the buffer's default-directory if DEFAULT_DIRECTORY is omitted. */ if (NILP (default_directory)) - default_directory = B_ (current_buffer, directory); + default_directory = BVAR (current_buffer, directory); if (! STRINGP (default_directory)) { #ifdef DOS_NT @@ -2669,7 +2669,7 @@ See `file-symlink-p' to distinguish symlinks. */) struct stat st; Lisp_Object handler; - absname = expand_and_dir_to_file (filename, B_ (current_buffer, directory)); + absname = expand_and_dir_to_file (filename, BVAR (current_buffer, directory)); /* If the file name has special constructs in it, call the corresponding file handler. */ @@ -2722,7 +2722,7 @@ See `file-symlink-p' to distinguish symlinks. */) struct stat st; Lisp_Object handler; - absname = expand_and_dir_to_file (filename, B_ (current_buffer, directory)); + absname = expand_and_dir_to_file (filename, BVAR (current_buffer, directory)); /* If the file name has special constructs in it, call the corresponding file handler. */ @@ -2769,7 +2769,7 @@ if file does not exist, is not accessible, or SELinux is disabled */) context_t context; #endif - absname = expand_and_dir_to_file (filename, B_ (current_buffer, directory)); + absname = expand_and_dir_to_file (filename, BVAR (current_buffer, directory)); /* If the file name has special constructs in it, call the corresponding file handler. */ @@ -2827,7 +2827,7 @@ is disabled. */) context_t parsed_con; #endif - absname = Fexpand_file_name (filename, B_ (current_buffer, directory)); + absname = Fexpand_file_name (filename, BVAR (current_buffer, directory)); /* If the file name has special constructs in it, call the corresponding file handler. */ @@ -2894,7 +2894,7 @@ Return nil, if file does not exist or is not accessible. */) struct stat st; Lisp_Object handler; - absname = expand_and_dir_to_file (filename, B_ (current_buffer, directory)); + absname = expand_and_dir_to_file (filename, BVAR (current_buffer, directory)); /* If the file name has special constructs in it, call the corresponding file handler. */ @@ -2923,7 +2923,7 @@ symbolic notation, like the `chmod' command from GNU Coreutils. */) Lisp_Object absname, encoded_absname; Lisp_Object handler; - absname = Fexpand_file_name (filename, B_ (current_buffer, directory)); + absname = Fexpand_file_name (filename, BVAR (current_buffer, directory)); CHECK_NUMBER (mode); /* If the file name has special constructs in it, @@ -2985,7 +2985,7 @@ Use the current time if TIME is nil. TIME is in the format of if (! lisp_time_argument (time, &sec, &usec)) error ("Invalid time specification"); - absname = Fexpand_file_name (filename, B_ (current_buffer, directory)); + absname = Fexpand_file_name (filename, BVAR (current_buffer, directory)); /* If the file name has special constructs in it, call the corresponding file handler. */ @@ -3047,8 +3047,8 @@ otherwise, if FILE2 does not exist, the answer is t. */) absname1 = Qnil; GCPRO2 (absname1, file2); - absname1 = expand_and_dir_to_file (file1, B_ (current_buffer, directory)); - absname2 = expand_and_dir_to_file (file2, B_ (current_buffer, directory)); + absname1 = expand_and_dir_to_file (file1, BVAR (current_buffer, directory)); + absname2 = expand_and_dir_to_file (file2, BVAR (current_buffer, directory)); UNGCPRO; /* If the file name has special constructs in it, @@ -3116,8 +3116,8 @@ decide_coding_unwind (Lisp_Object unwind_data) TEMP_SET_PT_BOTH (BEG, BEG_BYTE); /* Now we are safe to change the buffer's multibyteness directly. */ - B_ (current_buffer, enable_multibyte_characters) = multibyte; - B_ (current_buffer, undo_list) = undo_list; + BVAR (current_buffer, enable_multibyte_characters) = multibyte; + BVAR (current_buffer, undo_list) = undo_list; return Qnil; } @@ -3212,7 +3212,7 @@ variable `last-coding-system-used' to the coding system actually used. */) if (current_buffer->base_buffer && ! NILP (visit)) error ("Cannot do file visiting in an indirect buffer"); - if (!NILP (B_ (current_buffer, read_only))) + if (!NILP (BVAR (current_buffer, read_only))) Fbarf_if_buffer_read_only (); val = Qnil; @@ -3403,16 +3403,16 @@ variable `last-coding-system-used' to the coding system actually used. */) buf = XBUFFER (buffer); delete_all_overlays (buf); - B_ (buf, directory) = B_ (current_buffer, directory); - B_ (buf, read_only) = Qnil; - B_ (buf, filename) = Qnil; - B_ (buf, undo_list) = Qt; + BVAR (buf, directory) = BVAR (current_buffer, directory); + BVAR (buf, read_only) = Qnil; + BVAR (buf, filename) = Qnil; + BVAR (buf, undo_list) = Qt; eassert (buf->overlays_before == NULL); eassert (buf->overlays_after == NULL); set_buffer_internal (buf); Ferase_buffer (); - B_ (buf, enable_multibyte_characters) = Qnil; + BVAR (buf, enable_multibyte_characters) = Qnil; insert_1_both ((char *) read_buf, nread, nread, 0, 0, 0); TEMP_SET_PT_BOTH (BEG, BEG_BYTE); @@ -3450,7 +3450,7 @@ variable `last-coding-system-used' to the coding system actually used. */) else CHECK_CODING_SYSTEM (coding_system); - if (NILP (B_ (current_buffer, enable_multibyte_characters))) + if (NILP (BVAR (current_buffer, enable_multibyte_characters))) /* We must suppress all character code conversion except for end-of-line conversion. */ coding_system = raw_text_coding_system (coding_system); @@ -3598,7 +3598,7 @@ variable `last-coding-system-used' to the coding system actually used. */) we cannot use this method; giveup and try the other. */ if (same_at_end > same_at_start && FETCH_BYTE (same_at_end - 1) >= 0200 - && ! NILP (B_ (current_buffer, enable_multibyte_characters)) + && ! NILP (BVAR (current_buffer, enable_multibyte_characters)) && (CODING_MAY_REQUIRE_DECODING (&coding))) giveup_match_end = 1; break; @@ -3617,14 +3617,14 @@ variable `last-coding-system-used' to the coding system actually used. */) /* Extend the start of non-matching text area to multibyte character boundary. */ - if (! NILP (B_ (current_buffer, enable_multibyte_characters))) + if (! NILP (BVAR (current_buffer, enable_multibyte_characters))) while (same_at_start > BEGV_BYTE && ! CHAR_HEAD_P (FETCH_BYTE (same_at_start))) same_at_start--; /* Extend the end of non-matching text area to multibyte character boundary. */ - if (! NILP (B_ (current_buffer, enable_multibyte_characters))) + if (! NILP (BVAR (current_buffer, enable_multibyte_characters))) while (same_at_end < ZV_BYTE && ! CHAR_HEAD_P (FETCH_BYTE (same_at_end))) same_at_end++; @@ -3673,7 +3673,7 @@ variable `last-coding-system-used' to the coding system actually used. */) unsigned char *decoded; EMACS_INT temp; int this_count = SPECPDL_INDEX (); - int multibyte = ! NILP (B_ (current_buffer, enable_multibyte_characters)); + int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); Lisp_Object conversion_buffer; conversion_buffer = code_conversion_save (1, multibyte); @@ -3778,7 +3778,7 @@ variable `last-coding-system-used' to the coding system actually used. */) /* Extend the start of non-matching text area to the previous multibyte character boundary. */ - if (! NILP (B_ (current_buffer, enable_multibyte_characters))) + if (! NILP (BVAR (current_buffer, enable_multibyte_characters))) while (same_at_start > BEGV_BYTE && ! CHAR_HEAD_P (FETCH_BYTE (same_at_start))) same_at_start--; @@ -3795,7 +3795,7 @@ variable `last-coding-system-used' to the coding system actually used. */) /* Extend the end of non-matching text area to the next multibyte character boundary. */ - if (! NILP (B_ (current_buffer, enable_multibyte_characters))) + if (! NILP (BVAR (current_buffer, enable_multibyte_characters))) while (same_at_end < ZV_BYTE && ! CHAR_HEAD_P (FETCH_BYTE (same_at_end))) same_at_end++; @@ -3870,9 +3870,9 @@ variable `last-coding-system-used' to the coding system actually used. */) if (NILP (visit) && inserted > 0) { #ifdef CLASH_DETECTION - if (!NILP (B_ (current_buffer, file_truename)) + if (!NILP (BVAR (current_buffer, file_truename)) /* Make binding buffer-file-name to nil effective. */ - && !NILP (B_ (current_buffer, filename)) + && !NILP (BVAR (current_buffer, filename)) && SAVE_MODIFF >= MODIFF) we_locked_file = 1; #endif /* CLASH_DETECTION */ @@ -3977,7 +3977,7 @@ variable `last-coding-system-used' to the coding system actually used. */) { #ifdef CLASH_DETECTION if (we_locked_file) - unlock_file (B_ (current_buffer, file_truename)); + unlock_file (BVAR (current_buffer, file_truename)); #endif Vdeactivate_mark = old_Vdeactivate_mark; } @@ -4028,11 +4028,11 @@ variable `last-coding-system-used' to the coding system actually used. */) Lisp_Object unwind_data; int count = SPECPDL_INDEX (); - unwind_data = Fcons (B_ (current_buffer, enable_multibyte_characters), - Fcons (B_ (current_buffer, undo_list), + unwind_data = Fcons (BVAR (current_buffer, enable_multibyte_characters), + Fcons (BVAR (current_buffer, undo_list), Fcurrent_buffer ())); - B_ (current_buffer, enable_multibyte_characters) = Qnil; - B_ (current_buffer, undo_list) = Qt; + BVAR (current_buffer, enable_multibyte_characters) = Qnil; + BVAR (current_buffer, undo_list) = Qt; record_unwind_protect (decide_coding_unwind, unwind_data); if (inserted > 0 && ! NILP (Vset_auto_coding_function)) @@ -4062,7 +4062,7 @@ variable `last-coding-system-used' to the coding system actually used. */) else CHECK_CODING_SYSTEM (coding_system); - if (NILP (B_ (current_buffer, enable_multibyte_characters))) + if (NILP (BVAR (current_buffer, enable_multibyte_characters))) /* We must suppress all character code conversion except for end-of-line conversion. */ coding_system = raw_text_coding_system (coding_system); @@ -4080,10 +4080,10 @@ variable `last-coding-system-used' to the coding system actually used. */) && NILP (replace)) /* Visiting a file with these coding system makes the buffer unibyte. */ - B_ (current_buffer, enable_multibyte_characters) = Qnil; + BVAR (current_buffer, enable_multibyte_characters) = Qnil; } - coding.dst_multibyte = ! NILP (B_ (current_buffer, enable_multibyte_characters)); + coding.dst_multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); if (CODING_MAY_REQUIRE_DECODING (&coding) && (inserted > 0 || CODING_REQUIRE_FLUSHING (&coding))) { @@ -4110,9 +4110,9 @@ variable `last-coding-system-used' to the coding system actually used. */) if ((VECTORP (CODING_ID_EOL_TYPE (coding.id)) || EQ (CODING_ID_EOL_TYPE (coding.id), Qunix)) && ! CODING_REQUIRE_DECODING (&coding)) - B_ (current_buffer, buffer_file_type) = Qt; + BVAR (current_buffer, buffer_file_type) = Qt; else - B_ (current_buffer, buffer_file_type) = Qnil; + BVAR (current_buffer, buffer_file_type) = Qnil; #endif handled: @@ -4124,24 +4124,24 @@ variable `last-coding-system-used' to the coding system actually used. */) if (!NILP (visit)) { - if (!EQ (B_ (current_buffer, undo_list), Qt) && !nochange) - B_ (current_buffer, undo_list) = Qnil; + if (!EQ (BVAR (current_buffer, undo_list), Qt) && !nochange) + BVAR (current_buffer, undo_list) = Qnil; if (NILP (handler)) { current_buffer->modtime = st.st_mtime; current_buffer->modtime_size = st.st_size; - B_ (current_buffer, filename) = orig_filename; + BVAR (current_buffer, filename) = orig_filename; } SAVE_MODIFF = MODIFF; BUF_AUTOSAVE_MODIFF (current_buffer) = MODIFF; - XSETFASTINT (B_ (current_buffer, save_length), Z - BEG); + XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG); #ifdef CLASH_DETECTION if (NILP (handler)) { - if (!NILP (B_ (current_buffer, file_truename))) - unlock_file (B_ (current_buffer, file_truename)); + if (!NILP (BVAR (current_buffer, file_truename))) + unlock_file (BVAR (current_buffer, file_truename)); unlock_file (filename); } #endif /* CLASH_DETECTION */ @@ -4174,8 +4174,8 @@ variable `last-coding-system-used' to the coding system actually used. */) specbind (Qinhibit_modification_hooks, Qt); /* Save old undo list and don't record undo for decoding. */ - old_undo = B_ (current_buffer, undo_list); - B_ (current_buffer, undo_list) = Qt; + old_undo = BVAR (current_buffer, undo_list); + BVAR (current_buffer, undo_list) = Qt; if (NILP (replace)) { @@ -4263,7 +4263,7 @@ variable `last-coding-system-used' to the coding system actually used. */) if (NILP (visit)) { - B_ (current_buffer, undo_list) = old_undo; + BVAR (current_buffer, undo_list) = old_undo; if (CONSP (old_undo) && inserted != old_inserted) { /* Adjust the last undo record for the size change during @@ -4278,7 +4278,7 @@ variable `last-coding-system-used' to the coding system actually used. */) else /* If undo_list was Qt before, keep it that way. Otherwise start with an empty undo_list. */ - B_ (current_buffer, undo_list) = EQ (old_undo, Qt) ? Qt : Qnil; + BVAR (current_buffer, undo_list) = EQ (old_undo, Qt) ? Qt : Qnil; unbind_to (count, Qnil); } @@ -4332,8 +4332,8 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file Lisp_Object eol_parent = Qnil; if (auto_saving - && NILP (Fstring_equal (B_ (current_buffer, filename), - B_ (current_buffer, auto_save_file_name)))) + && NILP (Fstring_equal (BVAR (current_buffer, filename), + BVAR (current_buffer, auto_save_file_name)))) { val = Qutf_8_emacs; eol_parent = Qunix; @@ -4362,12 +4362,12 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file int using_default_coding = 0; int force_raw_text = 0; - val = B_ (current_buffer, buffer_file_coding_system); + val = BVAR (current_buffer, buffer_file_coding_system); if (NILP (val) || NILP (Flocal_variable_p (Qbuffer_file_coding_system, Qnil))) { val = Qnil; - if (NILP (B_ (current_buffer, enable_multibyte_characters))) + if (NILP (BVAR (current_buffer, enable_multibyte_characters))) force_raw_text = 1; } @@ -4388,7 +4388,7 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file { /* If we still have not decided a coding system, use the default value of buffer-file-coding-system. */ - val = B_ (current_buffer, buffer_file_coding_system); + val = BVAR (current_buffer, buffer_file_coding_system); using_default_coding = 1; } @@ -4412,9 +4412,9 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file format, we use that of `default-buffer-file-coding-system'. */ if (! using_default_coding - && ! NILP (B_ (&buffer_defaults, buffer_file_coding_system))) + && ! NILP (BVAR (&buffer_defaults, buffer_file_coding_system))) val = (coding_inherit_eol_type - (val, B_ (&buffer_defaults, buffer_file_coding_system))); + (val, BVAR (&buffer_defaults, buffer_file_coding_system))); /* If we decide not to encode text, use `raw-text' or one of its subsidiaries. */ @@ -4425,7 +4425,7 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file val = coding_inherit_eol_type (val, eol_parent); setup_coding_system (val, coding); - if (!STRINGP (start) && !NILP (B_ (current_buffer, selective_display))) + if (!STRINGP (start) && !NILP (BVAR (current_buffer, selective_display))) coding->mode |= CODING_MODE_SELECTIVE_DISPLAY; return val; } @@ -4529,8 +4529,8 @@ This calls `write-region-annotate-functions' at the start, and if (visiting) { SAVE_MODIFF = MODIFF; - XSETFASTINT (B_ (current_buffer, save_length), Z - BEG); - B_ (current_buffer, filename) = visit_file; + XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG); + BVAR (current_buffer, filename) = visit_file; } UNGCPRO; return val; @@ -4743,15 +4743,15 @@ This calls `write-region-annotate-functions' at the start, and if (visiting) { SAVE_MODIFF = MODIFF; - XSETFASTINT (B_ (current_buffer, save_length), Z - BEG); - B_ (current_buffer, filename) = visit_file; + XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG); + BVAR (current_buffer, filename) = visit_file; update_mode_lines++; } else if (quietly) { if (auto_saving - && ! NILP (Fstring_equal (B_ (current_buffer, filename), - B_ (current_buffer, auto_save_file_name)))) + && ! NILP (Fstring_equal (BVAR (current_buffer, filename), + BVAR (current_buffer, auto_save_file_name)))) SAVE_MODIFF = MODIFF; return Qnil; @@ -4833,10 +4833,10 @@ build_annotations (Lisp_Object start, Lisp_Object end) } /* Now do the same for annotation functions implied by the file-format */ - if (auto_saving && (!EQ (B_ (current_buffer, auto_save_file_format), Qt))) - p = B_ (current_buffer, auto_save_file_format); + if (auto_saving && (!EQ (BVAR (current_buffer, auto_save_file_format), Qt))) + p = BVAR (current_buffer, auto_save_file_format); else - p = B_ (current_buffer, file_format); + p = BVAR (current_buffer, file_format); for (i = 0; CONSP (p); p = XCDR (p), ++i) { struct buffer *given_buffer = current_buffer; @@ -5015,17 +5015,17 @@ See Info node `(elisp)Modification Time' for more details. */) b = XBUFFER (buf); } - if (!STRINGP (B_ (b, filename))) return Qt; + if (!STRINGP (BVAR (b, filename))) return Qt; if (b->modtime == 0) return Qt; /* If the file name has special constructs in it, call the corresponding file handler. */ - handler = Ffind_file_name_handler (B_ (b, filename), + handler = Ffind_file_name_handler (BVAR (b, filename), Qverify_visited_file_modtime); if (!NILP (handler)) return call2 (handler, Qverify_visited_file_modtime, buf); - filename = ENCODE_FILE (B_ (b, filename)); + filename = ENCODE_FILE (BVAR (b, filename)); if (stat (SSDATA (filename), &st) < 0) { @@ -5093,7 +5093,7 @@ An argument specifies the modification time value to use struct stat st; Lisp_Object handler; - filename = Fexpand_file_name (B_ (current_buffer, filename), Qnil); + filename = Fexpand_file_name (BVAR (current_buffer, filename), Qnil); /* If the file name has special constructs in it, call the corresponding file handler. */ @@ -5128,7 +5128,7 @@ auto_save_error (Lisp_Object error) ring_bell (XFRAME (selected_frame)); args[0] = build_string ("Auto-saving %s: %s"); - args[1] = B_ (current_buffer, name); + args[1] = BVAR (current_buffer, name); args[2] = Ferror_message_string (error); msg = Fformat (3, args); GCPRO1 (msg); @@ -5159,19 +5159,19 @@ auto_save_1 (void) auto_save_mode_bits = 0666; /* Get visited file's mode to become the auto save file's mode. */ - if (! NILP (B_ (current_buffer, filename))) + if (! NILP (BVAR (current_buffer, filename))) { - if (stat (SSDATA (B_ (current_buffer, filename)), &st) >= 0) + if (stat (SSDATA (BVAR (current_buffer, filename)), &st) >= 0) /* But make sure we can overwrite it later! */ auto_save_mode_bits = st.st_mode | 0600; - else if ((modes = Ffile_modes (B_ (current_buffer, filename)), + else if ((modes = Ffile_modes (BVAR (current_buffer, filename)), INTEGERP (modes))) /* Remote files don't cooperate with stat. */ auto_save_mode_bits = XINT (modes) | 0600; } return - Fwrite_region (Qnil, Qnil, B_ (current_buffer, auto_save_file_name), Qnil, + Fwrite_region (Qnil, Qnil, BVAR (current_buffer, auto_save_file_name), Qnil, NILP (Vauto_save_visited_file_name) ? Qlambda : Qt, Qnil, Qnil); } @@ -5312,18 +5312,18 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */) /* Record all the buffers that have auto save mode in the special file that lists them. For each of these buffers, Record visited name (if any) and auto save name. */ - if (STRINGP (B_ (b, auto_save_file_name)) + if (STRINGP (BVAR (b, auto_save_file_name)) && stream != NULL && do_handled_files == 0) { BLOCK_INPUT; - if (!NILP (B_ (b, filename))) + if (!NILP (BVAR (b, filename))) { - fwrite (SDATA (B_ (b, filename)), 1, - SBYTES (B_ (b, filename)), stream); + fwrite (SDATA (BVAR (b, filename)), 1, + SBYTES (BVAR (b, filename)), stream); } putc ('\n', stream); - fwrite (SDATA (B_ (b, auto_save_file_name)), 1, - SBYTES (B_ (b, auto_save_file_name)), stream); + fwrite (SDATA (BVAR (b, auto_save_file_name)), 1, + SBYTES (BVAR (b, auto_save_file_name)), stream); putc ('\n', stream); UNBLOCK_INPUT; } @@ -5340,13 +5340,13 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */) /* Check for auto save enabled and file changed since last auto save and file changed since last real save. */ - if (STRINGP (B_ (b, auto_save_file_name)) + if (STRINGP (BVAR (b, auto_save_file_name)) && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b) && BUF_AUTOSAVE_MODIFF (b) < BUF_MODIFF (b) /* -1 means we've turned off autosaving for a while--see below. */ - && XINT (B_ (b, save_length)) >= 0 + && XINT (BVAR (b, save_length)) >= 0 && (do_handled_files - || NILP (Ffind_file_name_handler (B_ (b, auto_save_file_name), + || NILP (Ffind_file_name_handler (BVAR (b, auto_save_file_name), Qwrite_region)))) { EMACS_TIME before_time, after_time; @@ -5360,23 +5360,23 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */) set_buffer_internal (b); if (NILP (Vauto_save_include_big_deletions) - && (XFASTINT (B_ (b, save_length)) * 10 + && (XFASTINT (BVAR (b, save_length)) * 10 > (BUF_Z (b) - BUF_BEG (b)) * 13) /* A short file is likely to change a large fraction; spare the user annoying messages. */ - && XFASTINT (B_ (b, save_length)) > 5000 + && XFASTINT (BVAR (b, save_length)) > 5000 /* These messages are frequent and annoying for `*mail*'. */ - && !EQ (B_ (b, filename), Qnil) + && !EQ (BVAR (b, filename), Qnil) && NILP (no_message)) { /* It has shrunk too much; turn off auto-saving here. */ minibuffer_auto_raise = orig_minibuffer_auto_raise; message_with_string ("Buffer %s has shrunk a lot; auto save disabled in that buffer until next real save", - B_ (b, name), 1); + BVAR (b, name), 1); minibuffer_auto_raise = 0; /* Turn off auto-saving until there's a real save, and prevent any more warnings. */ - XSETINT (B_ (b, save_length), -1); + XSETINT (BVAR (b, save_length), -1); Fsleep_for (make_number (1), Qnil); continue; } @@ -5385,7 +5385,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */) internal_condition_case (auto_save_1, Qt, auto_save_error); auto_saved++; BUF_AUTOSAVE_MODIFF (b) = BUF_MODIFF (b); - XSETFASTINT (B_ (current_buffer, save_length), Z - BEG); + XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG); set_buffer_internal (old); EMACS_GET_TIME (after_time); @@ -5432,7 +5432,7 @@ No auto-save file will be written until the buffer changes again. */) /* FIXME: This should not be called in indirect buffers, since they're not autosaved. */ BUF_AUTOSAVE_MODIFF (current_buffer) = MODIFF; - XSETFASTINT (B_ (current_buffer, save_length), Z - BEG); + XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG); current_buffer->auto_save_failure_time = -1; return Qnil; } diff --git a/src/filelock.c b/src/filelock.c index 6802880c985..8e18bb7b650 100644 --- a/src/filelock.c +++ b/src/filelock.c @@ -637,9 +637,9 @@ unlock_all_files (void) for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail)) { b = XBUFFER (XCDR (XCAR (tail))); - if (STRINGP (B_ (b, file_truename)) && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)) + if (STRINGP (BVAR (b, file_truename)) && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)) { - unlock_file(B_ (b, file_truename)); + unlock_file(BVAR (b, file_truename)); } } } @@ -652,7 +652,7 @@ or else nothing is done if current buffer isn't visiting a file. */) (Lisp_Object file) { if (NILP (file)) - file = B_ (current_buffer, file_truename); + file = BVAR (current_buffer, file_truename); else CHECK_STRING (file); if (SAVE_MODIFF < MODIFF @@ -669,8 +669,8 @@ should not be locked in that case. */) (void) { if (SAVE_MODIFF < MODIFF - && STRINGP (B_ (current_buffer, file_truename))) - unlock_file (B_ (current_buffer, file_truename)); + && STRINGP (BVAR (current_buffer, file_truename))) + unlock_file (BVAR (current_buffer, file_truename)); return Qnil; } @@ -680,8 +680,8 @@ void unlock_buffer (struct buffer *buffer) { if (BUF_SAVE_MODIFF (buffer) < BUF_MODIFF (buffer) - && STRINGP (B_ (buffer, file_truename))) - unlock_file (B_ (buffer, file_truename)); + && STRINGP (BVAR (buffer, file_truename))) + unlock_file (BVAR (buffer, file_truename)); } DEFUN ("file-locked-p", Ffile_locked_p, Sfile_locked_p, 1, 1, 0, diff --git a/src/fns.c b/src/fns.c index a9632914d67..b54d52e3003 100644 --- a/src/fns.c +++ b/src/fns.c @@ -2984,7 +2984,7 @@ into shorter lines. */) SAFE_ALLOCA (encoded, char *, allength); encoded_length = base64_encode_1 ((char *) BYTE_POS_ADDR (ibeg), encoded, length, NILP (no_line_break), - !NILP (B_ (current_buffer, enable_multibyte_characters))); + !NILP (BVAR (current_buffer, enable_multibyte_characters))); if (encoded_length > allength) abort (); @@ -3166,7 +3166,7 @@ If the region can't be decoded, signal an error and don't modify the buffer. */ EMACS_INT old_pos = PT; EMACS_INT decoded_length; EMACS_INT inserted_chars; - int multibyte = !NILP (B_ (current_buffer, enable_multibyte_characters)); + int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); USE_SAFE_ALLOCA; validate_region (&beg, &end); @@ -4684,12 +4684,12 @@ guesswork fails. Normally, an error is signaled in such case. */) { int force_raw_text = 0; - coding_system = B_ (XBUFFER (object), buffer_file_coding_system); + coding_system = BVAR (XBUFFER (object), buffer_file_coding_system); if (NILP (coding_system) || NILP (Flocal_variable_p (Qbuffer_file_coding_system, Qnil))) { coding_system = Qnil; - if (NILP (B_ (current_buffer, enable_multibyte_characters))) + if (NILP (BVAR (current_buffer, enable_multibyte_characters))) force_raw_text = 1; } @@ -4706,11 +4706,11 @@ guesswork fails. Normally, an error is signaled in such case. */) } if (NILP (coding_system) - && !NILP (B_ (XBUFFER (object), buffer_file_coding_system))) + && !NILP (BVAR (XBUFFER (object), buffer_file_coding_system))) { /* If we still have not decided a coding system, use the default value of buffer-file-coding-system. */ - coding_system = B_ (XBUFFER (object), buffer_file_coding_system); + coding_system = BVAR (XBUFFER (object), buffer_file_coding_system); } if (!force_raw_text diff --git a/src/font.c b/src/font.c index d67e8465b6a..d77eafb6ad2 100644 --- a/src/font.c +++ b/src/font.c @@ -3637,7 +3637,7 @@ font_at (int c, EMACS_INT pos, struct face *face, struct window *w, Lisp_Object font_object; multibyte = (NILP (string) - ? ! NILP (B_ (current_buffer, enable_multibyte_characters)) + ? ! NILP (BVAR (current_buffer, enable_multibyte_characters)) : STRING_MULTIBYTE (string)); if (c < 0) { diff --git a/src/frame.c b/src/frame.c index ac223ac4da0..edbd45a2a34 100644 --- a/src/frame.c +++ b/src/frame.c @@ -1817,7 +1817,7 @@ make_frame_visible_1 (Lisp_Object window) w = XWINDOW (window); if (!NILP (w->buffer)) - B_ (XBUFFER (w->buffer), display_time) = Fcurrent_time (); + BVAR (XBUFFER (w->buffer), display_time) = Fcurrent_time (); if (!NILP (w->vchild)) make_frame_visible_1 (w->vchild); diff --git a/src/fringe.c b/src/fringe.c index 5b7f8833069..d42d6467f31 100644 --- a/src/fringe.c +++ b/src/fringe.c @@ -660,7 +660,7 @@ get_logical_cursor_bitmap (struct window *w, Lisp_Object cursor) { Lisp_Object cmap, bm = Qnil; - if ((cmap = B_ (XBUFFER (w->buffer), fringe_cursor_alist)), !NILP (cmap)) + if ((cmap = BVAR (XBUFFER (w->buffer), fringe_cursor_alist)), !NILP (cmap)) { bm = Fassq (cursor, cmap); if (CONSP (bm)) @@ -670,9 +670,9 @@ get_logical_cursor_bitmap (struct window *w, Lisp_Object cursor) return lookup_fringe_bitmap (bm); } } - if (EQ (cmap, B_ (&buffer_defaults, fringe_cursor_alist))) + if (EQ (cmap, BVAR (&buffer_defaults, fringe_cursor_alist))) return NO_FRINGE_BITMAP; - bm = Fassq (cursor, B_ (&buffer_defaults, fringe_cursor_alist)); + bm = Fassq (cursor, BVAR (&buffer_defaults, fringe_cursor_alist)); if (!CONSP (bm) || ((bm = XCDR (bm)), NILP (bm))) return NO_FRINGE_BITMAP; return lookup_fringe_bitmap (bm); @@ -697,7 +697,7 @@ get_logical_fringe_bitmap (struct window *w, Lisp_Object bitmap, int right_p, in If partial, lookup partial bitmap in default value if not found here. If not partial, or no partial spec is present, use non-partial bitmap. */ - if ((cmap = B_ (XBUFFER (w->buffer), fringe_indicator_alist)), !NILP (cmap)) + if ((cmap = BVAR (XBUFFER (w->buffer), fringe_indicator_alist)), !NILP (cmap)) { bm1 = Fassq (bitmap, cmap); if (CONSP (bm1)) @@ -731,10 +731,10 @@ get_logical_fringe_bitmap (struct window *w, Lisp_Object bitmap, int right_p, in } } - if (!EQ (cmap, B_ (&buffer_defaults, fringe_indicator_alist)) - && !NILP (B_ (&buffer_defaults, fringe_indicator_alist))) + if (!EQ (cmap, BVAR (&buffer_defaults, fringe_indicator_alist)) + && !NILP (BVAR (&buffer_defaults, fringe_indicator_alist))) { - bm2 = Fassq (bitmap, B_ (&buffer_defaults, fringe_indicator_alist)); + bm2 = Fassq (bitmap, BVAR (&buffer_defaults, fringe_indicator_alist)); if (CONSP (bm2)) { if ((bm2 = XCDR (bm2)), !NILP (bm2)) @@ -919,7 +919,7 @@ update_window_fringes (struct window *w, int keep_current_p) return 0; if (!MINI_WINDOW_P (w) - && (ind = B_ (XBUFFER (w->buffer), indicate_buffer_boundaries), !NILP (ind))) + && (ind = BVAR (XBUFFER (w->buffer), indicate_buffer_boundaries), !NILP (ind))) { if (EQ (ind, Qleft) || EQ (ind, Qright)) boundary_top = boundary_bot = arrow_top = arrow_bot = ind; @@ -988,7 +988,7 @@ update_window_fringes (struct window *w, int keep_current_p) } } - empty_pos = B_ (XBUFFER (w->buffer), indicate_empty_lines); + empty_pos = BVAR (XBUFFER (w->buffer), indicate_empty_lines); if (!NILP (empty_pos) && !EQ (empty_pos, Qright)) empty_pos = WINDOW_LEFT_FRINGE_WIDTH (w) == 0 ? Qright : Qleft; diff --git a/src/indent.c b/src/indent.c index b0195b3dec8..85d26520cfb 100644 --- a/src/indent.c +++ b/src/indent.c @@ -70,7 +70,7 @@ buffer_display_table (void) { Lisp_Object thisbuf; - thisbuf = B_ (current_buffer, display_table); + thisbuf = BVAR (current_buffer, display_table); if (DISP_TABLE_P (thisbuf)) return XCHAR_TABLE (thisbuf); if (DISP_TABLE_P (Vstandard_display_table)) @@ -140,9 +140,9 @@ recompute_width_table (struct buffer *buf, struct Lisp_Char_Table *disptab) int i; struct Lisp_Vector *widthtab; - if (!VECTORP (B_ (buf, width_table))) - B_ (buf, width_table) = Fmake_vector (make_number (256), make_number (0)); - widthtab = XVECTOR (B_ (buf, width_table)); + if (!VECTORP (BVAR (buf, width_table))) + BVAR (buf, width_table) = Fmake_vector (make_number (256), make_number (0)); + widthtab = XVECTOR (BVAR (buf, width_table)); if (widthtab->size != 256) abort (); @@ -156,17 +156,17 @@ recompute_width_table (struct buffer *buf, struct Lisp_Char_Table *disptab) static void width_run_cache_on_off (void) { - if (NILP (B_ (current_buffer, cache_long_line_scans)) + if (NILP (BVAR (current_buffer, cache_long_line_scans)) /* And, for the moment, this feature doesn't work on multibyte characters. */ - || !NILP (B_ (current_buffer, enable_multibyte_characters))) + || !NILP (BVAR (current_buffer, enable_multibyte_characters))) { /* It should be off. */ if (current_buffer->width_run_cache) { free_region_cache (current_buffer->width_run_cache); current_buffer->width_run_cache = 0; - B_ (current_buffer, width_table) = Qnil; + BVAR (current_buffer, width_table) = Qnil; } } else @@ -329,8 +329,8 @@ current_column (void) register int tab_seen; int post_tab; register int c; - register int tab_width = XINT (B_ (current_buffer, tab_width)); - int ctl_arrow = !NILP (B_ (current_buffer, ctl_arrow)); + register int tab_width = XINT (BVAR (current_buffer, tab_width)); + int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow)); register struct Lisp_Char_Table *dp = buffer_display_table (); if (PT == last_known_column_point @@ -417,7 +417,7 @@ current_column (void) col++; else if (c == '\n' || (c == '\r' - && EQ (B_ (current_buffer, selective_display), Qt))) + && EQ (BVAR (current_buffer, selective_display), Qt))) { ptr++; goto start_of_line_found; @@ -512,10 +512,10 @@ check_display_width (EMACS_INT pos, EMACS_INT col, EMACS_INT *endpos) static void scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol) { - register EMACS_INT tab_width = XINT (B_ (current_buffer, tab_width)); - register int ctl_arrow = !NILP (B_ (current_buffer, ctl_arrow)); + register EMACS_INT tab_width = XINT (BVAR (current_buffer, tab_width)); + register int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow)); register struct Lisp_Char_Table *dp = buffer_display_table (); - int multibyte = !NILP (B_ (current_buffer, enable_multibyte_characters)); + int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); struct composition_it cmp_it; Lisp_Object window; struct window *w; @@ -637,7 +637,7 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol) if (c == '\n') goto endloop; - if (c == '\r' && EQ (B_ (current_buffer, selective_display), Qt)) + if (c == '\r' && EQ (BVAR (current_buffer, selective_display), Qt)) goto endloop; if (c == '\t') { @@ -655,7 +655,7 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol) if (c == '\n') goto endloop; - if (c == '\r' && EQ (B_ (current_buffer, selective_display), Qt)) + if (c == '\r' && EQ (BVAR (current_buffer, selective_display), Qt)) goto endloop; if (c == '\t') { @@ -809,7 +809,7 @@ The return value is COLUMN. */) { int mincol; register int fromcol; - register int tab_width = XINT (B_ (current_buffer, tab_width)); + register int tab_width = XINT (BVAR (current_buffer, tab_width)); CHECK_NUMBER (column); if (NILP (minimum)) @@ -872,7 +872,7 @@ static double position_indentation (register int pos_byte) { register EMACS_INT column = 0; - register EMACS_INT tab_width = XINT (B_ (current_buffer, tab_width)); + register EMACS_INT tab_width = XINT (BVAR (current_buffer, tab_width)); register unsigned char *p; register unsigned char *stop; unsigned char *start; @@ -924,7 +924,7 @@ position_indentation (register int pos_byte) switch (*p++) { case 0240: - if (! NILP (B_ (current_buffer, enable_multibyte_characters))) + if (! NILP (BVAR (current_buffer, enable_multibyte_characters))) return column; case ' ': column++; @@ -934,7 +934,7 @@ position_indentation (register int pos_byte) break; default: if (ASCII_BYTE_P (p[-1]) - || NILP (B_ (current_buffer, enable_multibyte_characters))) + || NILP (BVAR (current_buffer, enable_multibyte_characters))) return column; { int c; @@ -1123,13 +1123,13 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_ register EMACS_INT pos; EMACS_INT pos_byte; register int c = 0; - register EMACS_INT tab_width = XFASTINT (B_ (current_buffer, tab_width)); - register int ctl_arrow = !NILP (B_ (current_buffer, ctl_arrow)); + register EMACS_INT tab_width = XFASTINT (BVAR (current_buffer, tab_width)); + register int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow)); register struct Lisp_Char_Table *dp = window_display_table (win); int selective - = (INTEGERP (B_ (current_buffer, selective_display)) - ? XINT (B_ (current_buffer, selective_display)) - : !NILP (B_ (current_buffer, selective_display)) ? -1 : 0); + = (INTEGERP (BVAR (current_buffer, selective_display)) + ? XINT (BVAR (current_buffer, selective_display)) + : !NILP (BVAR (current_buffer, selective_display)) ? -1 : 0); int selective_rlen = (selective && dp && VECTORP (DISP_INVIS_VECTOR (dp)) ? XVECTOR (DISP_INVIS_VECTOR (dp))->size : 0); @@ -1151,7 +1151,7 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_ EMACS_INT next_width_run = from; Lisp_Object window; - int multibyte = !NILP (B_ (current_buffer, enable_multibyte_characters)); + int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); /* If previous char scanned was a wide character, this is the column where it ended. Otherwise, this is 0. */ EMACS_INT wide_column_end_hpos = 0; @@ -1170,8 +1170,8 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_ width_run_cache_on_off (); if (dp == buffer_display_table ()) - width_table = (VECTORP (B_ (current_buffer, width_table)) - ? XVECTOR (B_ (current_buffer, width_table))->contents + width_table = (VECTORP (BVAR (current_buffer, width_table)) + ? XVECTOR (BVAR (current_buffer, width_table))->contents : 0); else /* If the window has its own display table, we can't use the width @@ -1337,7 +1337,7 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_ } if (hscroll || truncate - || !NILP (B_ (current_buffer, truncate_lines))) + || !NILP (BVAR (current_buffer, truncate_lines))) { /* Truncating: skip to newline, unless we are already past TO (we need to go back below). */ @@ -1838,9 +1838,9 @@ vmotion (register EMACS_INT from, register EMACS_INT vtarget, struct window *w) EMACS_INT from_byte; EMACS_INT lmargin = hscroll > 0 ? 1 - hscroll : 0; int selective - = (INTEGERP (B_ (current_buffer, selective_display)) - ? XINT (B_ (current_buffer, selective_display)) - : !NILP (B_ (current_buffer, selective_display)) ? -1 : 0); + = (INTEGERP (BVAR (current_buffer, selective_display)) + ? XINT (BVAR (current_buffer, selective_display)) + : !NILP (BVAR (current_buffer, selective_display)) ? -1 : 0); Lisp_Object window; EMACS_INT start_hpos = 0; int did_motion; diff --git a/src/insdel.c b/src/insdel.c index db997fc938e..7fcf9522a33 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -78,7 +78,7 @@ void check_markers (void) { register struct Lisp_Marker *tail; - int multibyte = ! NILP (B_ (current_buffer, enable_multibyte_characters)); + int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); for (tail = BUF_MARKERS (current_buffer); tail; tail = tail->next) { @@ -703,7 +703,7 @@ insert_char (int c) unsigned char str[MAX_MULTIBYTE_LENGTH]; int len; - if (! NILP (B_ (current_buffer, enable_multibyte_characters))) + if (! NILP (BVAR (current_buffer, enable_multibyte_characters))) len = CHAR_STRING (c, str); else { @@ -891,7 +891,7 @@ insert_1_both (const char *string, if (nchars == 0) return; - if (NILP (B_ (current_buffer, enable_multibyte_characters))) + if (NILP (BVAR (current_buffer, enable_multibyte_characters))) nchars = nbytes; if (prepare) @@ -1011,7 +1011,7 @@ insert_from_string_1 (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte, /* Make OUTGOING_NBYTES describe the text as it will be inserted in this buffer. */ - if (NILP (B_ (current_buffer, enable_multibyte_characters))) + if (NILP (BVAR (current_buffer, enable_multibyte_characters))) outgoing_nbytes = nchars; else if (! STRING_MULTIBYTE (string)) outgoing_nbytes @@ -1034,7 +1034,7 @@ insert_from_string_1 (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte, between single-byte and multibyte. */ copy_text (SDATA (string) + pos_byte, GPT_ADDR, nbytes, STRING_MULTIBYTE (string), - ! NILP (B_ (current_buffer, enable_multibyte_characters))); + ! NILP (BVAR (current_buffer, enable_multibyte_characters))); #ifdef BYTE_COMBINING_DEBUG /* We have copied text into the gap, but we have not altered @@ -1094,7 +1094,7 @@ insert_from_string_1 (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte, void insert_from_gap (EMACS_INT nchars, EMACS_INT nbytes) { - if (NILP (B_ (current_buffer, enable_multibyte_characters))) + if (NILP (BVAR (current_buffer, enable_multibyte_characters))) nchars = nbytes; record_insert (GPT, nchars); @@ -1162,9 +1162,9 @@ insert_from_buffer_1 (struct buffer *buf, /* Make OUTGOING_NBYTES describe the text as it will be inserted in this buffer. */ - if (NILP (B_ (current_buffer, enable_multibyte_characters))) + if (NILP (BVAR (current_buffer, enable_multibyte_characters))) outgoing_nbytes = nchars; - else if (NILP (B_ (buf, enable_multibyte_characters))) + else if (NILP (BVAR (buf, enable_multibyte_characters))) { EMACS_INT outgoing_before_gap = 0; EMACS_INT outgoing_after_gap = 0; @@ -1215,8 +1215,8 @@ insert_from_buffer_1 (struct buffer *buf, chunk_expanded = copy_text (BUF_BYTE_ADDRESS (buf, from_byte), GPT_ADDR, chunk, - ! NILP (B_ (buf, enable_multibyte_characters)), - ! NILP (B_ (current_buffer, enable_multibyte_characters))); + ! NILP (BVAR (buf, enable_multibyte_characters)), + ! NILP (BVAR (current_buffer, enable_multibyte_characters))); } else chunk_expanded = chunk = 0; @@ -1224,8 +1224,8 @@ insert_from_buffer_1 (struct buffer *buf, if (chunk < incoming_nbytes) copy_text (BUF_BYTE_ADDRESS (buf, from_byte + chunk), GPT_ADDR + chunk_expanded, incoming_nbytes - chunk, - ! NILP (B_ (buf, enable_multibyte_characters)), - ! NILP (B_ (current_buffer, enable_multibyte_characters))); + ! NILP (BVAR (buf, enable_multibyte_characters)), + ! NILP (BVAR (current_buffer, enable_multibyte_characters))); #ifdef BYTE_COMBINING_DEBUG /* We have copied text into the gap, but we have not altered @@ -1320,7 +1320,7 @@ adjust_after_replace (EMACS_INT from, EMACS_INT from_byte, adjust_markers_for_insert (from, from_byte, from + len, from_byte + len_byte, 0); - if (! EQ (B_ (current_buffer, undo_list), Qt)) + if (! EQ (BVAR (current_buffer, undo_list), Qt)) { if (nchars_del > 0) record_delete (from, prev_text); @@ -1481,7 +1481,7 @@ replace_range (EMACS_INT from, EMACS_INT to, Lisp_Object new, /* Make OUTGOING_INSBYTES describe the text as it will be inserted in this buffer. */ - if (NILP (B_ (current_buffer, enable_multibyte_characters))) + if (NILP (BVAR (current_buffer, enable_multibyte_characters))) outgoing_insbytes = inschars; else if (! STRING_MULTIBYTE (new)) outgoing_insbytes @@ -1503,7 +1503,7 @@ replace_range (EMACS_INT from, EMACS_INT to, Lisp_Object new, /* Even if we don't record for undo, we must keep the original text because we may have to recover it because of inappropriate byte combining. */ - if (! EQ (B_ (current_buffer, undo_list), Qt)) + if (! EQ (BVAR (current_buffer, undo_list), Qt)) deletion = make_buffer_string_both (from, from_byte, to, to_byte, 1); GAP_SIZE += nbytes_del; @@ -1530,7 +1530,7 @@ replace_range (EMACS_INT from, EMACS_INT to, Lisp_Object new, between single-byte and multibyte. */ copy_text (SDATA (new), GPT_ADDR, insbytes, STRING_MULTIBYTE (new), - ! NILP (B_ (current_buffer, enable_multibyte_characters))); + ! NILP (BVAR (current_buffer, enable_multibyte_characters))); #ifdef BYTE_COMBINING_DEBUG /* We have copied text into the gap, but we have not marked @@ -1543,7 +1543,7 @@ replace_range (EMACS_INT from, EMACS_INT to, Lisp_Object new, abort (); #endif - if (! EQ (B_ (current_buffer, undo_list), Qt)) + if (! EQ (BVAR (current_buffer, undo_list), Qt)) { /* Record the insertion first, so that when we undo, the deletion will be undone first. Thus, undo @@ -1886,7 +1886,7 @@ del_range_2 (EMACS_INT from, EMACS_INT from_byte, abort (); #endif - if (ret_string || ! EQ (B_ (current_buffer, undo_list), Qt)) + if (ret_string || ! EQ (BVAR (current_buffer, undo_list), Qt)) deletion = make_buffer_string_both (from, from_byte, to, to_byte, 1); else deletion = Qnil; @@ -1897,7 +1897,7 @@ del_range_2 (EMACS_INT from, EMACS_INT from_byte, so that undo handles this after reinserting the text. */ adjust_markers_for_delete (from, from_byte, to, to_byte); - if (! EQ (B_ (current_buffer, undo_list), Qt)) + if (! EQ (BVAR (current_buffer, undo_list), Qt)) record_delete (from, deletion); MODIFF++; CHARS_MODIFF = MODIFF; @@ -1968,7 +1968,7 @@ modify_region (struct buffer *buffer, EMACS_INT start, EMACS_INT end, if (! preserve_chars_modiff) CHARS_MODIFF = MODIFF; - B_ (buffer, point_before_scroll) = Qnil; + BVAR (buffer, point_before_scroll) = Qnil; if (buffer != old_buffer) set_buffer_internal (old_buffer); @@ -1990,7 +1990,7 @@ prepare_to_modify_buffer (EMACS_INT start, EMACS_INT end, { struct buffer *base_buffer; - if (!NILP (B_ (current_buffer, read_only))) + if (!NILP (BVAR (current_buffer, read_only))) Fbarf_if_buffer_read_only (); /* Let redisplay consider other windows than selected_window @@ -2022,32 +2022,32 @@ prepare_to_modify_buffer (EMACS_INT start, EMACS_INT end, base_buffer = current_buffer; #ifdef CLASH_DETECTION - if (!NILP (B_ (base_buffer, file_truename)) + if (!NILP (BVAR (base_buffer, file_truename)) /* Make binding buffer-file-name to nil effective. */ - && !NILP (B_ (base_buffer, filename)) + && !NILP (BVAR (base_buffer, filename)) && SAVE_MODIFF >= MODIFF) - lock_file (B_ (base_buffer, file_truename)); + lock_file (BVAR (base_buffer, file_truename)); #else /* At least warn if this file has changed on disk since it was visited. */ - if (!NILP (B_ (base_buffer, filename)) + if (!NILP (BVAR (base_buffer, filename)) && SAVE_MODIFF >= MODIFF && NILP (Fverify_visited_file_modtime (Fcurrent_buffer ())) - && !NILP (Ffile_exists_p (B_ (base_buffer, filename)))) + && !NILP (Ffile_exists_p (BVAR (base_buffer, filename)))) call1 (intern ("ask-user-about-supersession-threat"), - B_ (base_buffer,filename)); + BVAR (base_buffer,filename)); #endif /* not CLASH_DETECTION */ /* If `select-active-regions' is non-nil, save the region text. */ - if (!NILP (B_ (current_buffer, mark_active)) + if (!NILP (BVAR (current_buffer, mark_active)) && !inhibit_modification_hooks - && XMARKER (B_ (current_buffer, mark))->buffer + && XMARKER (BVAR (current_buffer, mark))->buffer && NILP (Vsaved_region_selection) && (EQ (Vselect_active_regions, Qonly) ? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly) : (!NILP (Vselect_active_regions) && !NILP (Vtransient_mark_mode)))) { - EMACS_INT b = XMARKER (B_ (current_buffer, mark))->charpos; + EMACS_INT b = XMARKER (BVAR (current_buffer, mark))->charpos; EMACS_INT e = PT; if (b < e) Vsaved_region_selection = make_buffer_string (b, e, 0); @@ -2290,7 +2290,7 @@ DEFUN ("combine-after-change-execute", Fcombine_after_change_execute, non-nil, and insertion calls a file handler (e.g. through lock_file) which scribbles into a temp file -- cyd */ if (!BUFFERP (combine_after_change_buffer) - || NILP (B_ (XBUFFER (combine_after_change_buffer), name))) + || NILP (BVAR (XBUFFER (combine_after_change_buffer), name))) { combine_after_change_list = Qnil; return Qnil; diff --git a/src/intervals.c b/src/intervals.c index de5faf6ce75..6aee6e9d7fa 100644 --- a/src/intervals.c +++ b/src/intervals.c @@ -1978,7 +1978,7 @@ set_point_both (EMACS_INT charpos, EMACS_INT bytepos) int have_overlays; EMACS_INT original_position; - B_ (current_buffer, point_before_scroll) = Qnil; + BVAR (current_buffer, point_before_scroll) = Qnil; if (charpos == PT) return; @@ -2342,7 +2342,7 @@ get_local_map (register EMACS_INT position, register struct buffer *buffer, if (EQ (type, Qkeymap)) return Qnil; else - return B_ (buffer, keymap); + return BVAR (buffer, keymap); } /* Produce an interval tree reflecting the intervals in diff --git a/src/intervals.h b/src/intervals.h index 3c46c50db79..f6c1c002ce0 100644 --- a/src/intervals.h +++ b/src/intervals.h @@ -236,9 +236,9 @@ struct interval and 2 if it is invisible but with an ellipsis. */ #define TEXT_PROP_MEANS_INVISIBLE(prop) \ - (EQ (B_ (current_buffer, invisibility_spec), Qt) \ + (EQ (BVAR (current_buffer, invisibility_spec), Qt) \ ? !NILP (prop) \ - : invisible_p (prop, B_ (current_buffer, invisibility_spec))) + : invisible_p (prop, BVAR (current_buffer, invisibility_spec))) /* Declared in alloc.c */ diff --git a/src/keyboard.c b/src/keyboard.c index 339d32a838a..a1d851408e3 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -1577,7 +1577,7 @@ command_loop_1 (void) this_single_command_key_start = 0; } - if (!NILP (B_ (current_buffer, mark_active)) + if (!NILP (BVAR (current_buffer, mark_active)) && !NILP (Vrun_hooks)) { /* In Emacs 22, setting transient-mark-mode to `only' was a @@ -1599,7 +1599,7 @@ command_loop_1 (void) if (!NILP (Fwindow_system (Qnil)) /* Even if mark_active is non-nil, the actual buffer marker may not have been set yet (Bug#7044). */ - && XMARKER (B_ (current_buffer, mark))->buffer + && XMARKER (BVAR (current_buffer, mark))->buffer && (EQ (Vselect_active_regions, Qonly) ? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly) : (!NILP (Vselect_active_regions) @@ -1607,7 +1607,7 @@ command_loop_1 (void) && !EQ (Vthis_command, Qhandle_switch_frame)) { EMACS_INT beg = - XINT (Fmarker_position (B_ (current_buffer, mark))); + XINT (Fmarker_position (BVAR (current_buffer, mark))); EMACS_INT end = PT; if (beg < end) call2 (Qx_set_selection, QPRIMARY, @@ -8608,7 +8608,7 @@ read_char_minibuf_menu_prompt (int commandflag, int nmaps, Lisp_Object *maps) /* Prompt with that and read response. */ message2_nolog (menu, strlen (menu), - ! NILP (B_ (current_buffer, enable_multibyte_characters))); + ! NILP (BVAR (current_buffer, enable_multibyte_characters))); /* Make believe its not a keyboard macro in case the help char is pressed. Help characters are not recorded because menu prompting @@ -9870,7 +9870,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, /* Treat uppercase keys as shifted. */ || (INTEGERP (key) && (KEY_TO_CHAR (key) - < XCHAR_TABLE (B_ (current_buffer, downcase_table))->size) + < XCHAR_TABLE (BVAR (current_buffer, downcase_table))->size) && UPPERCASEP (KEY_TO_CHAR (key)))) { Lisp_Object new_key diff --git a/src/keymap.c b/src/keymap.c index b694deadcba..d9de2bc804b 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -1883,7 +1883,7 @@ bindings; see the description of `lookup-key' for more details about this. */) (Lisp_Object keys, Lisp_Object accept_default) { register Lisp_Object map; - map = B_ (current_buffer, keymap); + map = BVAR (current_buffer, keymap); if (NILP (map)) return Qnil; return Flookup_key (map, keys, accept_default); @@ -1988,7 +1988,7 @@ If KEYMAP is nil, that means no local keymap. */) if (!NILP (keymap)) keymap = get_keymap (keymap, 1, 1); - B_ (current_buffer, keymap) = keymap; + BVAR (current_buffer, keymap) = keymap; return Qnil; } @@ -1998,7 +1998,7 @@ DEFUN ("current-local-map", Fcurrent_local_map, Scurrent_local_map, 0, 0, 0, Normally the local keymap is set by the major mode with `use-local-map'. */) (void) { - return B_ (current_buffer, keymap); + return BVAR (current_buffer, keymap); } DEFUN ("current-global-map", Fcurrent_global_map, Scurrent_global_map, 0, 0, 0, @@ -2379,7 +2379,7 @@ push_key_description (register unsigned int c, register char *p, int force_multi *p++ = 'C'; } else if (c < 128 - || (NILP (B_ (current_buffer, enable_multibyte_characters)) + || (NILP (BVAR (current_buffer, enable_multibyte_characters)) && SINGLE_BYTE_CHAR_P (c) && !force_multibyte)) { @@ -2388,7 +2388,7 @@ push_key_description (register unsigned int c, register char *p, int force_multi else { /* Now we are sure that C is a valid character code. */ - if (NILP (B_ (current_buffer, enable_multibyte_characters)) + if (NILP (BVAR (current_buffer, enable_multibyte_characters)) && ! force_multibyte) *p++ = multibyte_char_to_unibyte (c, Qnil); else @@ -3048,7 +3048,7 @@ You type Translation\n\ XBUFFER (buffer), Qlocal_map); if (!NILP (start1)) { - if (EQ (start1, B_ (XBUFFER (buffer), keymap))) + if (EQ (start1, BVAR (XBUFFER (buffer), keymap))) describe_map_tree (start1, 1, shadow, prefix, "\f\nMajor Mode Bindings", nomenu, 0, 0, 0); else diff --git a/src/lisp.h b/src/lisp.h index 0efadd675b0..bd1595bce0b 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2047,11 +2047,11 @@ extern Lisp_Object case_temp2; /* Current buffer's map from characters to lower-case characters. */ -#define DOWNCASE_TABLE B_ (current_buffer, downcase_table) +#define DOWNCASE_TABLE BVAR (current_buffer, downcase_table) /* Current buffer's map from characters to upper-case characters. */ -#define UPCASE_TABLE B_ (current_buffer, upcase_table) +#define UPCASE_TABLE BVAR (current_buffer, upcase_table) /* Downcase a character, or make no change if that cannot be done. */ diff --git a/src/lread.c b/src/lread.c index de9c5db95ad..7e410fcc334 100644 --- a/src/lread.c +++ b/src/lread.c @@ -210,7 +210,7 @@ readchar (Lisp_Object readcharfun, int *multibyte) if (pt_byte >= BUF_ZV_BYTE (inbuffer)) return -1; - if (! NILP (B_ (inbuffer, enable_multibyte_characters))) + if (! NILP (BVAR (inbuffer, enable_multibyte_characters))) { /* Fetch the character code from the buffer. */ unsigned char *p = BUF_BYTE_ADDRESS (inbuffer, pt_byte); @@ -239,7 +239,7 @@ readchar (Lisp_Object readcharfun, int *multibyte) if (bytepos >= BUF_ZV_BYTE (inbuffer)) return -1; - if (! NILP (B_ (inbuffer, enable_multibyte_characters))) + if (! NILP (BVAR (inbuffer, enable_multibyte_characters))) { /* Fetch the character code from the buffer. */ unsigned char *p = BUF_BYTE_ADDRESS (inbuffer, bytepos); @@ -371,7 +371,7 @@ unreadchar (Lisp_Object readcharfun, int c) EMACS_INT bytepos = BUF_PT_BYTE (b); BUF_PT (b)--; - if (! NILP (B_ (b, enable_multibyte_characters))) + if (! NILP (BVAR (b, enable_multibyte_characters))) BUF_DEC_POS (b, bytepos); else bytepos--; @@ -384,7 +384,7 @@ unreadchar (Lisp_Object readcharfun, int c) EMACS_INT bytepos = XMARKER (readcharfun)->bytepos; XMARKER (readcharfun)->charpos--; - if (! NILP (B_ (b, enable_multibyte_characters))) + if (! NILP (BVAR (b, enable_multibyte_characters))) BUF_DEC_POS (b, bytepos); else bytepos--; @@ -1322,7 +1322,7 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, Lisp_Object *sto /* Of course, this could conceivably lose if luser sets default-directory to be something non-absolute... */ { - filename = Fexpand_file_name (filename, B_ (current_buffer, directory)); + filename = Fexpand_file_name (filename, BVAR (current_buffer, directory)); if (!complete_filename_p (filename)) /* Give up on this path element! */ continue; @@ -1581,7 +1581,7 @@ readevalloop (Lisp_Object readcharfun, { int count1 = SPECPDL_INDEX (); - if (b != 0 && NILP (B_ (b, name))) + if (b != 0 && NILP (BVAR (b, name))) error ("Reading from killed buffer"); if (!NILP (start)) @@ -1721,7 +1721,7 @@ This function preserves the position of point. */) tem = printflag; if (NILP (filename)) - filename = B_ (XBUFFER (buf), filename); + filename = BVAR (XBUFFER (buf), filename); specbind (Qeval_buffer_list, Fcons (buf, Veval_buffer_list)); specbind (Qstandard_output, tem); @@ -1761,7 +1761,7 @@ This function does not move point. */) specbind (Qeval_buffer_list, Fcons (cbuf, Veval_buffer_list)); /* readevalloop calls functions which check the type of start and end. */ - readevalloop (cbuf, 0, B_ (XBUFFER (cbuf), filename), Feval, + readevalloop (cbuf, 0, BVAR (XBUFFER (cbuf), filename), Feval, !NILP (printflag), Qnil, read_function, start, end); diff --git a/src/marker.c b/src/marker.c index 9b841835646..72c564f420f 100644 --- a/src/marker.c +++ b/src/marker.c @@ -439,7 +439,7 @@ Returns nil if MARKER points into a dead buffer. */) does not preserve the buffer from being GC'd (it's weak), so markers have to be unlinked from their buffer as soon as the buffer is killed. */ - eassert (!NILP (B_ (XBUFFER (buf), name))); + eassert (!NILP (BVAR (XBUFFER (buf), name))); return buf; } return Qnil; @@ -488,7 +488,7 @@ Returns MARKER. */) CHECK_BUFFER (buffer); b = XBUFFER (buffer); /* If buffer is dead, set marker to point nowhere. */ - if (EQ (B_ (b, name), Qnil)) + if (EQ (BVAR (b, name), Qnil)) { unchain_marker (m); return marker; @@ -563,7 +563,7 @@ set_marker_restricted (Lisp_Object marker, Lisp_Object pos, Lisp_Object buffer) CHECK_BUFFER (buffer); b = XBUFFER (buffer); /* If buffer is dead, set marker to point nowhere. */ - if (EQ (B_ (b, name), Qnil)) + if (EQ (BVAR (b, name), Qnil)) { unchain_marker (m); return marker; @@ -628,7 +628,7 @@ set_marker_both (Lisp_Object marker, Lisp_Object buffer, EMACS_INT charpos, EMAC CHECK_BUFFER (buffer); b = XBUFFER (buffer); /* If buffer is dead, set marker to point nowhere. */ - if (EQ (B_ (b, name), Qnil)) + if (EQ (BVAR (b, name), Qnil)) { unchain_marker (m); return marker; @@ -676,7 +676,7 @@ set_marker_restricted_both (Lisp_Object marker, Lisp_Object buffer, EMACS_INT ch CHECK_BUFFER (buffer); b = XBUFFER (buffer); /* If buffer is dead, set marker to point nowhere. */ - if (EQ (B_ (b, name), Qnil)) + if (EQ (BVAR (b, name), Qnil)) { unchain_marker (m); return marker; @@ -731,7 +731,7 @@ unchain_marker (register struct Lisp_Marker *marker) if (b == 0) return; - if (EQ (B_ (b, name), Qnil)) + if (EQ (BVAR (b, name), Qnil)) abort (); marker->buffer = 0; diff --git a/src/minibuf.c b/src/minibuf.c index 3ed8630c845..4b709bd9cbd 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -415,7 +415,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, CHECK_STRING (initial); } val = Qnil; - ambient_dir = B_ (current_buffer, directory); + ambient_dir = BVAR (current_buffer, directory); input_method = Qnil; enable_multibyte = Qnil; @@ -525,7 +525,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, /* `current-input-method' is buffer local. So, remember it in INPUT_METHOD before changing the current buffer. */ input_method = Fsymbol_value (Qcurrent_input_method); - enable_multibyte = B_ (current_buffer, enable_multibyte_characters); + enable_multibyte = BVAR (current_buffer, enable_multibyte_characters); } /* Switch to the minibuffer. */ @@ -535,7 +535,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, /* If appropriate, copy enable-multibyte-characters into the minibuffer. */ if (inherit_input_method) - B_ (current_buffer, enable_multibyte_characters) = enable_multibyte; + BVAR (current_buffer, enable_multibyte_characters) = enable_multibyte; /* The current buffer's default directory is usually the right thing for our minibuffer here. However, if you're typing a command at @@ -546,7 +546,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, you think of something better to do? Find another buffer with a better directory, and use that one instead. */ if (STRINGP (ambient_dir)) - B_ (current_buffer, directory) = ambient_dir; + BVAR (current_buffer, directory) = ambient_dir; else { Lisp_Object buf_list; @@ -558,9 +558,9 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, Lisp_Object other_buf; other_buf = XCDR (XCAR (buf_list)); - if (STRINGP (B_ (XBUFFER (other_buf), directory))) + if (STRINGP (BVAR (XBUFFER (other_buf), directory))) { - B_ (current_buffer, directory) = B_ (XBUFFER (other_buf), directory); + BVAR (current_buffer, directory) = BVAR (XBUFFER (other_buf), directory); break; } } @@ -603,7 +603,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, specbind (Qinhibit_modification_hooks, Qt); Ferase_buffer (); - if (!NILP (B_ (current_buffer, enable_multibyte_characters)) + if (!NILP (BVAR (current_buffer, enable_multibyte_characters)) && ! STRING_MULTIBYTE (minibuf_prompt)) minibuf_prompt = Fstring_make_multibyte (minibuf_prompt); @@ -633,7 +633,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, } clear_message (1, 1); - B_ (current_buffer, keymap) = map; + BVAR (current_buffer, keymap) = map; /* Turn on an input method stored in INPUT_METHOD if any. */ if (STRINGP (input_method) && !NILP (Ffboundp (Qactivate_input_method))) @@ -647,7 +647,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, call1 (Vrun_hooks, Qminibuffer_setup_hook); /* Don't allow the user to undo past this point. */ - B_ (current_buffer, undo_list) = Qnil; + BVAR (current_buffer, undo_list) = Qnil; recursive_edit_1 (); @@ -764,7 +764,7 @@ get_minibuffer (int depth) Vminibuffer_list = nconc2 (Vminibuffer_list, tail); } buf = Fcar (tail); - if (NILP (buf) || NILP (B_ (XBUFFER (buf), name))) + if (NILP (buf) || NILP (BVAR (XBUFFER (buf), name))) { sprintf (name, " *Minibuf-%d*", depth); buf = Fget_buffer_create (build_string (name)); @@ -1096,7 +1096,7 @@ function, instead of the usual behavior. */) int count = SPECPDL_INDEX (); if (BUFFERP (def)) - def = B_ (XBUFFER (def), name); + def = BVAR (XBUFFER (def), name); specbind (Qcompletion_ignore_case, read_buffer_completion_ignore_case ? Qt : Qnil); diff --git a/src/msdos.c b/src/msdos.c index d37200e700a..4fdfa64e367 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -1317,12 +1317,12 @@ IT_frame_up_to_date (struct frame *f) { struct buffer *b = XBUFFER (sw->buffer); - if (EQ (B_ (b,cursor_type), Qt)) + if (EQ (BVAR (b,cursor_type), Qt)) new_cursor = frame_desired_cursor; - else if (NILP (B_ (b, cursor_type))) /* nil means no cursor */ + else if (NILP (BVAR (b, cursor_type))) /* nil means no cursor */ new_cursor = Fcons (Qbar, make_number (0)); else - new_cursor = B_ (b, cursor_type); + new_cursor = BVAR (b, cursor_type); } IT_set_cursor_type (f, new_cursor); diff --git a/src/print.c b/src/print.c index beb14a8b679..299cfd41814 100644 --- a/src/print.c +++ b/src/print.c @@ -111,7 +111,7 @@ int print_output_debug_flag EXTERNALLY_VISIBLE = 1; EMACS_INT old_point_byte = -1, start_point_byte = -1; \ int specpdl_count = SPECPDL_INDEX (); \ int free_print_buffer = 0; \ - int multibyte = !NILP (B_ (current_buffer, enable_multibyte_characters)); \ + int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); \ Lisp_Object original #define PRINTPREPARE \ @@ -144,10 +144,10 @@ int print_output_debug_flag EXTERNALLY_VISIBLE = 1; if (NILP (printcharfun)) \ { \ Lisp_Object string; \ - if (NILP (B_ (current_buffer, enable_multibyte_characters)) \ + if (NILP (BVAR (current_buffer, enable_multibyte_characters)) \ && ! print_escape_multibyte) \ specbind (Qprint_escape_multibyte, Qt); \ - if (! NILP (B_ (current_buffer, enable_multibyte_characters)) \ + if (! NILP (BVAR (current_buffer, enable_multibyte_characters)) \ && ! print_escape_nonascii) \ specbind (Qprint_escape_nonascii, Qt); \ if (print_buffer != 0) \ @@ -173,7 +173,7 @@ int print_output_debug_flag EXTERNALLY_VISIBLE = 1; if (NILP (printcharfun)) \ { \ if (print_buffer_pos != print_buffer_pos_byte \ - && NILP (B_ (current_buffer, enable_multibyte_characters))) \ + && NILP (BVAR (current_buffer, enable_multibyte_characters))) \ { \ unsigned char *temp \ = (unsigned char *) alloca (print_buffer_pos + 1); \ @@ -250,7 +250,7 @@ printchar (unsigned int ch, Lisp_Object fun) else { int multibyte_p - = !NILP (B_ (current_buffer, enable_multibyte_characters)); + = !NILP (BVAR (current_buffer, enable_multibyte_characters)); setup_echo_area_for_printing (multibyte_p); insert_char (ch); @@ -302,7 +302,7 @@ strout (const char *ptr, EMACS_INT size, EMACS_INT size_byte, job. */ int i; int multibyte_p - = !NILP (B_ (current_buffer, enable_multibyte_characters)); + = !NILP (BVAR (current_buffer, enable_multibyte_characters)); setup_echo_area_for_printing (multibyte_p); message_dolog (ptr, size_byte, 0, multibyte_p); @@ -371,8 +371,8 @@ print_string (Lisp_Object string, Lisp_Object printcharfun) chars = SCHARS (string); else if (! print_escape_nonascii && (EQ (printcharfun, Qt) - ? ! NILP (B_ (&buffer_defaults, enable_multibyte_characters)) - : ! NILP (B_ (current_buffer, enable_multibyte_characters)))) + ? ! NILP (BVAR (&buffer_defaults, enable_multibyte_characters)) + : ! NILP (BVAR (current_buffer, enable_multibyte_characters)))) { /* If unibyte string STRING contains 8-bit codes, we must convert STRING to a multibyte string containing the same @@ -504,14 +504,14 @@ temp_output_buffer_setup (const char *bufname) Fkill_all_local_variables (); delete_all_overlays (current_buffer); - B_ (current_buffer, directory) = B_ (old, directory); - B_ (current_buffer, read_only) = Qnil; - B_ (current_buffer, filename) = Qnil; - B_ (current_buffer, undo_list) = Qt; + BVAR (current_buffer, directory) = BVAR (old, directory); + BVAR (current_buffer, read_only) = Qnil; + BVAR (current_buffer, filename) = Qnil; + BVAR (current_buffer, undo_list) = Qt; eassert (current_buffer->overlays_before == NULL); eassert (current_buffer->overlays_after == NULL); - B_ (current_buffer, enable_multibyte_characters) - = B_ (&buffer_defaults, enable_multibyte_characters); + BVAR (current_buffer, enable_multibyte_characters) + = BVAR (&buffer_defaults, enable_multibyte_characters); specbind (Qinhibit_read_only, Qt); specbind (Qinhibit_modification_hooks, Qt); Ferase_buffer (); @@ -1856,7 +1856,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag if (!NILP (XWINDOW (obj)->buffer)) { strout (" on ", -1, -1, printcharfun, 0); - print_string (B_ (XBUFFER (XWINDOW (obj)->buffer), name), printcharfun); + print_string (BVAR (XBUFFER (XWINDOW (obj)->buffer), name), printcharfun); } PRINTCHAR ('>'); } @@ -1957,16 +1957,16 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag } else if (BUFFERP (obj)) { - if (NILP (B_ (XBUFFER (obj), name))) + if (NILP (BVAR (XBUFFER (obj), name))) strout ("#", -1, -1, printcharfun, 0); else if (escapeflag) { strout ("#'); } else - print_string (B_ (XBUFFER (obj), name), printcharfun); + print_string (BVAR (XBUFFER (obj), name), printcharfun); } else if (WINDOW_CONFIGURATIONP (obj)) { @@ -2078,7 +2078,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag sprintf (buf, "at %ld", (long)marker_position (obj)); strout (buf, -1, -1, printcharfun, 0); strout (" in ", -1, -1, printcharfun, 0); - print_string (B_ (XMARKER (obj)->buffer, name), printcharfun); + print_string (BVAR (XMARKER (obj)->buffer, name), printcharfun); } PRINTCHAR ('>'); break; @@ -2093,7 +2093,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag (long)marker_position (OVERLAY_START (obj)), (long)marker_position (OVERLAY_END (obj))); strout (buf, -1, -1, printcharfun, 0); - print_string (B_ (XMARKER (OVERLAY_START (obj))->buffer, name), + print_string (BVAR (XMARKER (OVERLAY_START (obj))->buffer, name), printcharfun); } PRINTCHAR ('>'); diff --git a/src/process.c b/src/process.c index ec929a919f8..4a145f7376a 100644 --- a/src/process.c +++ b/src/process.c @@ -719,7 +719,7 @@ get_process (register Lisp_Object name) { proc = Fget_buffer_process (obj); if (NILP (proc)) - error ("Buffer %s has no process", SDATA (B_ (XBUFFER (obj), name))); + error ("Buffer %s has no process", SDATA (BVAR (XBUFFER (obj), name))); } else { @@ -1283,12 +1283,12 @@ list_processes_1 (Lisp_Object query_only) w_proc = i; if (!NILP (p->buffer)) { - if (NILP (B_ (XBUFFER (p->buffer), name))) + if (NILP (BVAR (XBUFFER (p->buffer), name))) { if (w_buffer < 8) w_buffer = 8; /* (Killed) */ } - else if ((i = SCHARS (B_ (XBUFFER (p->buffer), name)), (i > w_buffer))) + else if ((i = SCHARS (BVAR (XBUFFER (p->buffer), name)), (i > w_buffer))) w_buffer = i; } if (STRINGP (p->tty_name) @@ -1312,9 +1312,9 @@ list_processes_1 (Lisp_Object query_only) XSETFASTINT (minspace, 1); set_buffer_internal (XBUFFER (Vstandard_output)); - B_ (current_buffer, undo_list) = Qt; + BVAR (current_buffer, undo_list) = Qt; - B_ (current_buffer, truncate_lines) = Qt; + BVAR (current_buffer, truncate_lines) = Qt; write_string ("Proc", -1); Findent_to (i_status, minspace); write_string ("Status", -1); @@ -1397,10 +1397,10 @@ list_processes_1 (Lisp_Object query_only) Findent_to (i_buffer, minspace); if (NILP (p->buffer)) insert_string ("(none)"); - else if (NILP (B_ (XBUFFER (p->buffer), name))) + else if (NILP (BVAR (XBUFFER (p->buffer), name))) insert_string ("(Killed)"); else - Finsert (1, &B_ (XBUFFER (p->buffer), name)); + Finsert (1, &BVAR (XBUFFER (p->buffer), name)); if (!NILP (i_tty)) { @@ -1548,7 +1548,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) { struct gcpro gcpro1, gcpro2; - current_dir = B_ (current_buffer, directory); + current_dir = BVAR (current_buffer, directory); GCPRO2 (buffer, current_dir); @@ -1560,7 +1560,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) current_dir = expand_and_dir_to_file (current_dir, Qnil); if (NILP (Ffile_accessible_directory_p (current_dir))) report_file_error ("Setting current directory", - Fcons (B_ (current_buffer, directory), Qnil)); + Fcons (BVAR (current_buffer, directory), Qnil)); UNGCPRO; } @@ -2898,8 +2898,8 @@ usage: (make-serial-process &rest ARGS) */) } else if (!NILP (Vcoding_system_for_read)) val = Vcoding_system_for_read; - else if ((!NILP (buffer) && NILP (B_ (XBUFFER (buffer), enable_multibyte_characters))) - || (NILP (buffer) && NILP (B_ (&buffer_defaults, enable_multibyte_characters)))) + else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters))) + || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters)))) val = Qnil; p->decode_coding_system = val; @@ -2912,8 +2912,8 @@ usage: (make-serial-process &rest ARGS) */) } else if (!NILP (Vcoding_system_for_write)) val = Vcoding_system_for_write; - else if ((!NILP (buffer) && NILP (B_ (XBUFFER (buffer), enable_multibyte_characters))) - || (NILP (buffer) && NILP (B_ (&buffer_defaults, enable_multibyte_characters)))) + else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters))) + || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters)))) val = Qnil; p->encode_coding_system = val; @@ -3723,8 +3723,8 @@ usage: (make-network-process &rest ARGS) */) } else if (!NILP (Vcoding_system_for_read)) val = Vcoding_system_for_read; - else if ((!NILP (buffer) && NILP (B_ (XBUFFER (buffer), enable_multibyte_characters))) - || (NILP (buffer) && NILP (B_ (&buffer_defaults, enable_multibyte_characters)))) + else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters))) + || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters)))) /* We dare not decode end-of-line format by setting VAL to Qraw_text, because the existing Emacs Lisp libraries assume that they receive bare code including a sequene of @@ -3759,7 +3759,7 @@ usage: (make-network-process &rest ARGS) */) } else if (!NILP (Vcoding_system_for_write)) val = Vcoding_system_for_write; - else if (NILP (B_ (current_buffer, enable_multibyte_characters))) + else if (NILP (BVAR (current_buffer, enable_multibyte_characters))) val = Qnil; else { @@ -5268,7 +5268,7 @@ read_process_output (Lisp_Object proc, register int channel) /* No need to gcpro these, because all we do with them later is test them for EQness, and none of them should be a string. */ XSETBUFFER (obuffer, current_buffer); - okeymap = B_ (current_buffer, keymap); + okeymap = BVAR (current_buffer, keymap); /* We inhibit quit here instead of just catching it so that hitting ^G when a filter happens to be running won't screw @@ -5359,7 +5359,7 @@ read_process_output (Lisp_Object proc, register int channel) } /* If no filter, write into buffer if it isn't dead. */ - else if (!NILP (p->buffer) && !NILP (B_ (XBUFFER (p->buffer), name))) + else if (!NILP (p->buffer) && !NILP (BVAR (XBUFFER (p->buffer), name))) { Lisp_Object old_read_only; EMACS_INT old_begv, old_zv; @@ -5372,13 +5372,13 @@ read_process_output (Lisp_Object proc, register int channel) Fset_buffer (p->buffer); opoint = PT; opoint_byte = PT_BYTE; - old_read_only = B_ (current_buffer, read_only); + old_read_only = BVAR (current_buffer, read_only); old_begv = BEGV; old_zv = ZV; old_begv_byte = BEGV_BYTE; old_zv_byte = ZV_BYTE; - B_ (current_buffer, read_only) = Qnil; + BVAR (current_buffer, read_only) = Qnil; /* Insert new output into buffer at the current end-of-output marker, @@ -5423,7 +5423,7 @@ read_process_output (Lisp_Object proc, register int channel) p->decoding_carryover = coding->carryover_bytes; } /* Adjust the multibyteness of TEXT to that of the buffer. */ - if (NILP (B_ (current_buffer, enable_multibyte_characters)) + if (NILP (BVAR (current_buffer, enable_multibyte_characters)) != ! STRING_MULTIBYTE (text)) text = (STRING_MULTIBYTE (text) ? Fstring_as_unibyte (text) @@ -5467,7 +5467,7 @@ read_process_output (Lisp_Object proc, register int channel) Fnarrow_to_region (make_number (old_begv), make_number (old_zv)); - B_ (current_buffer, read_only) = old_read_only; + BVAR (current_buffer, read_only) = old_read_only; SET_PT_BOTH (opoint, opoint_byte); } /* Handling the process output should not deactivate the mark. */ @@ -5525,7 +5525,7 @@ send_process (volatile Lisp_Object proc, const char *volatile buf, if ((STRINGP (object) && STRING_MULTIBYTE (object)) || (BUFFERP (object) - && !NILP (B_ (XBUFFER (object), enable_multibyte_characters))) + && !NILP (BVAR (XBUFFER (object), enable_multibyte_characters))) || EQ (object, Qt)) { p->encode_coding_system @@ -6564,7 +6564,7 @@ exec_sentinel (Lisp_Object proc, Lisp_Object reason) is test them for EQness, and none of them should be a string. */ odeactivate = Vdeactivate_mark; XSETBUFFER (obuffer, current_buffer); - okeymap = B_ (current_buffer, keymap); + okeymap = BVAR (current_buffer, keymap); /* There's no good reason to let sentinels change the current buffer, and many callers of accept-process-output, sit-for, and @@ -6714,7 +6714,7 @@ status_notify (struct Lisp_Process *deleting_process) /* Avoid error if buffer is deleted (probably that's why the process is dead, too) */ - if (NILP (B_ (XBUFFER (buffer), name))) + if (NILP (BVAR (XBUFFER (buffer), name))) continue; Fset_buffer (buffer); @@ -6731,13 +6731,13 @@ status_notify (struct Lisp_Process *deleting_process) before = PT; before_byte = PT_BYTE; - tem = B_ (current_buffer, read_only); - B_ (current_buffer, read_only) = Qnil; + tem = BVAR (current_buffer, read_only); + BVAR (current_buffer, read_only) = Qnil; insert_string ("\nProcess "); Finsert (1, &p->name); insert_string (" "); Finsert (1, &msg); - B_ (current_buffer, read_only) = tem; + BVAR (current_buffer, read_only) = tem; set_marker_both (p->mark, p->buffer, PT, PT_BYTE); if (opoint >= before) @@ -7136,7 +7136,7 @@ setup_process_coding_systems (Lisp_Object process) ; else if (BUFFERP (p->buffer)) { - if (NILP (B_ (XBUFFER (p->buffer), enable_multibyte_characters))) + if (NILP (BVAR (XBUFFER (p->buffer), enable_multibyte_characters))) coding_system = raw_text_coding_system (coding_system); } setup_coding_system (coding_system, proc_decode_coding_system[inch]); diff --git a/src/search.c b/src/search.c index a80e20a8a8a..1e2036f6dc2 100644 --- a/src/search.c +++ b/src/search.c @@ -157,7 +157,7 @@ compile_pattern_1 (struct regexp_cache *cp, Lisp_Object pattern, Lisp_Object tra /* If the compiled pattern hard codes some of the contents of the syntax-table, it can only be reused with *this* syntax table. */ - cp->syntax_table = cp->buf.used_syntax ? B_ (current_buffer, syntax_table) : Qt; + cp->syntax_table = cp->buf.used_syntax ? BVAR (current_buffer, syntax_table) : Qt; re_set_whitespace_regexp (NULL); @@ -236,7 +236,7 @@ compile_pattern (Lisp_Object pattern, struct re_registers *regp, Lisp_Object tra && EQ (cp->buf.translate, (! NILP (translate) ? translate : make_number (0))) && cp->posix == posix && (EQ (cp->syntax_table, Qt) - || EQ (cp->syntax_table, B_ (current_buffer, syntax_table))) + || EQ (cp->syntax_table, BVAR (current_buffer, syntax_table))) && !NILP (Fequal (cp->whitespace_regexp, Vsearch_spaces_regexp)) && cp->buf.charset_unibyte == charset_unibyte) break; @@ -285,17 +285,17 @@ looking_at_1 (Lisp_Object string, int posix) save_search_regs (); /* This is so set_image_of_range_1 in regex.c can find the EQV table. */ - XCHAR_TABLE (B_ (current_buffer, case_canon_table))->extras[2] - = B_ (current_buffer, case_eqv_table); + XCHAR_TABLE (BVAR (current_buffer, case_canon_table))->extras[2] + = BVAR (current_buffer, case_eqv_table); CHECK_STRING (string); bufp = compile_pattern (string, (NILP (Vinhibit_changing_match_data) ? &search_regs : NULL), - (!NILP (B_ (current_buffer, case_fold_search)) - ? B_ (current_buffer, case_canon_table) : Qnil), + (!NILP (BVAR (current_buffer, case_fold_search)) + ? BVAR (current_buffer, case_canon_table) : Qnil), posix, - !NILP (B_ (current_buffer, enable_multibyte_characters))); + !NILP (BVAR (current_buffer, enable_multibyte_characters))); immediate_quit = 1; QUIT; /* Do a pending quit right away, to avoid paradoxical behavior */ @@ -400,14 +400,14 @@ string_match_1 (Lisp_Object regexp, Lisp_Object string, Lisp_Object start, int p } /* This is so set_image_of_range_1 in regex.c can find the EQV table. */ - XCHAR_TABLE (B_ (current_buffer, case_canon_table))->extras[2] - = B_ (current_buffer, case_eqv_table); + XCHAR_TABLE (BVAR (current_buffer, case_canon_table))->extras[2] + = BVAR (current_buffer, case_eqv_table); bufp = compile_pattern (regexp, (NILP (Vinhibit_changing_match_data) ? &search_regs : NULL), - (!NILP (B_ (current_buffer, case_fold_search)) - ? B_ (current_buffer, case_canon_table) : Qnil), + (!NILP (BVAR (current_buffer, case_fold_search)) + ? BVAR (current_buffer, case_canon_table) : Qnil), posix, STRING_MULTIBYTE (string)); immediate_quit = 1; @@ -586,7 +586,7 @@ fast_looking_at (Lisp_Object regexp, EMACS_INT pos, EMACS_INT pos_byte, EMACS_IN s2 = 0; } re_match_object = Qnil; - multibyte = ! NILP (B_ (current_buffer, enable_multibyte_characters)); + multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); } buf = compile_pattern (regexp, 0, Qnil, 0, multibyte); @@ -608,7 +608,7 @@ fast_looking_at (Lisp_Object regexp, EMACS_INT pos, EMACS_INT pos_byte, EMACS_IN static void newline_cache_on_off (struct buffer *buf) { - if (NILP (B_ (buf, cache_long_line_scans))) + if (NILP (BVAR (buf, cache_long_line_scans))) { /* It should be off. */ if (buf->newline_cache) @@ -996,15 +996,15 @@ search_command (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror, } /* This is so set_image_of_range_1 in regex.c can find the EQV table. */ - XCHAR_TABLE (B_ (current_buffer, case_canon_table))->extras[2] - = B_ (current_buffer, case_eqv_table); + XCHAR_TABLE (BVAR (current_buffer, case_canon_table))->extras[2] + = BVAR (current_buffer, case_eqv_table); np = search_buffer (string, PT, PT_BYTE, lim, lim_byte, n, RE, - (!NILP (B_ (current_buffer, case_fold_search)) - ? B_ (current_buffer, case_canon_table) + (!NILP (BVAR (current_buffer, case_fold_search)) + ? BVAR (current_buffer, case_canon_table) : Qnil), - (!NILP (B_ (current_buffer, case_fold_search)) - ? B_ (current_buffer, case_eqv_table) + (!NILP (BVAR (current_buffer, case_fold_search)) + ? BVAR (current_buffer, case_eqv_table) : Qnil), posix); if (np <= 0) @@ -1133,7 +1133,7 @@ search_buffer (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte, (NILP (Vinhibit_changing_match_data) ? &search_regs : &search_regs_1), trt, posix, - !NILP (B_ (current_buffer, enable_multibyte_characters))); + !NILP (BVAR (current_buffer, enable_multibyte_characters))); immediate_quit = 1; /* Quit immediately if user types ^G, because letting this function finish @@ -1254,7 +1254,7 @@ search_buffer (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte, EMACS_INT raw_pattern_size; EMACS_INT raw_pattern_size_byte; unsigned char *patbuf; - int multibyte = !NILP (B_ (current_buffer, enable_multibyte_characters)); + int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); unsigned char *base_pat; /* Set to positive if we find a non-ASCII char that need translation. Otherwise set to zero later. */ @@ -1451,7 +1451,7 @@ simple_search (EMACS_INT n, unsigned char *pat, EMACS_INT pos, EMACS_INT pos_byte, EMACS_INT lim, EMACS_INT lim_byte) { - int multibyte = ! NILP (B_ (current_buffer, enable_multibyte_characters)); + int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); int forward = n > 0; /* Number of buffer bytes matched. Note that this may be different from len_byte in a multibyte buffer. */ @@ -1671,7 +1671,7 @@ boyer_moore (EMACS_INT n, unsigned char *base_pat, register EMACS_INT i; register int j; unsigned char *pat, *pat_end; - int multibyte = ! NILP (B_ (current_buffer, enable_multibyte_characters)); + int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); unsigned char simple_translate[0400]; /* These are set to the preceding bytes of a byte to be translated @@ -2639,7 +2639,7 @@ since only regular expressions have distinguished subexpressions. */) EMACS_INT length = SBYTES (newtext); unsigned char *substed; EMACS_INT substed_alloc_size, substed_len; - int buf_multibyte = !NILP (B_ (current_buffer, enable_multibyte_characters)); + int buf_multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); int str_multibyte = STRING_MULTIBYTE (newtext); Lisp_Object rev_tbl; int really_changed = 0; diff --git a/src/syntax.c b/src/syntax.c index 9aa34014f91..707c2c19f31 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -277,7 +277,7 @@ update_syntax_table (EMACS_INT charpos, int count, int init, else { gl_state.use_global = 0; - gl_state.current_syntax_table = B_ (current_buffer, syntax_table); + gl_state.current_syntax_table = BVAR (current_buffer, syntax_table); } } @@ -363,7 +363,7 @@ char_quoted (EMACS_INT charpos, EMACS_INT bytepos) static INLINE EMACS_INT dec_bytepos (EMACS_INT bytepos) { - if (NILP (B_ (current_buffer, enable_multibyte_characters))) + if (NILP (BVAR (current_buffer, enable_multibyte_characters))) return bytepos - 1; DEC_POS (bytepos); @@ -779,7 +779,7 @@ DEFUN ("syntax-table", Fsyntax_table, Ssyntax_table, 0, 0, 0, This is the one specified by the current buffer. */) (void) { - return B_ (current_buffer, syntax_table); + return BVAR (current_buffer, syntax_table); } DEFUN ("standard-syntax-table", Fstandard_syntax_table, @@ -824,7 +824,7 @@ One argument, a syntax table. */) { int idx; check_syntax_table (table); - B_ (current_buffer, syntax_table) = table; + BVAR (current_buffer, syntax_table) = table; /* Indicate that this buffer now has a specified syntax table. */ idx = PER_BUFFER_VAR_IDX (syntax_table); SET_PER_BUFFER_VALUE_P (current_buffer, idx, 1); @@ -1035,7 +1035,7 @@ usage: (modify-syntax-entry CHAR NEWENTRY &optional SYNTAX-TABLE) */) CHECK_CHARACTER (c); if (NILP (syntax_table)) - syntax_table = B_ (current_buffer, syntax_table); + syntax_table = BVAR (current_buffer, syntax_table); else check_syntax_table (syntax_table); @@ -1450,7 +1450,7 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl if (XINT (lim) < BEGV) XSETFASTINT (lim, BEGV); - multibyte = (!NILP (B_ (current_buffer, enable_multibyte_characters)) + multibyte = (!NILP (BVAR (current_buffer, enable_multibyte_characters)) && (XINT (lim) - PT != CHAR_TO_BYTE (XINT (lim)) - PT_BYTE)); string_multibyte = SBYTES (string) > SCHARS (string); @@ -1936,7 +1936,7 @@ skip_syntaxes (int forwardp, Lisp_Object string, Lisp_Object lim) if (forwardp ? (PT >= XFASTINT (lim)) : (PT <= XFASTINT (lim))) return make_number (0); - multibyte = (!NILP (B_ (current_buffer, enable_multibyte_characters)) + multibyte = (!NILP (BVAR (current_buffer, enable_multibyte_characters)) && (XINT (lim) - PT != CHAR_TO_BYTE (XINT (lim)) - PT_BYTE)); memset (fastmap, 0, sizeof fastmap); @@ -2703,7 +2703,7 @@ scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpf while (from > stop) { temp_pos = from_byte; - if (! NILP (B_ (current_buffer, enable_multibyte_characters))) + if (! NILP (BVAR (current_buffer, enable_multibyte_characters))) DEC_POS (temp_pos); else temp_pos--; diff --git a/src/syntax.h b/src/syntax.h index 75937a7c121..e8726bb28a4 100644 --- a/src/syntax.h +++ b/src/syntax.h @@ -24,7 +24,7 @@ extern void update_syntax_table (EMACS_INT, int, int, Lisp_Object); /* The standard syntax table is stored where it will automatically be used in all new buffers. */ -#define Vstandard_syntax_table B_ (&buffer_defaults, syntax_table) +#define Vstandard_syntax_table BVAR (&buffer_defaults, syntax_table) /* A syntax table is a chartable whose elements are cons cells (CODE+FLAGS . MATCHING-CHAR). MATCHING-CHAR can be nil if the char @@ -79,7 +79,7 @@ enum syntaxcode # define CURRENT_SYNTAX_TABLE gl_state.current_syntax_table #else # define SYNTAX_ENTRY SYNTAX_ENTRY_INT -# define CURRENT_SYNTAX_TABLE B_ (current_buffer, syntax_table) +# define CURRENT_SYNTAX_TABLE BVAR (current_buffer, syntax_table) #endif #define SYNTAX_ENTRY_INT(c) CHAR_TABLE_REF (CURRENT_SYNTAX_TABLE, (c)) @@ -204,7 +204,7 @@ extern char syntax_code_spec[16]; do \ { \ gl_state.use_global = 0; \ - gl_state.current_syntax_table = B_ (current_buffer, syntax_table); \ + gl_state.current_syntax_table = BVAR (current_buffer, syntax_table); \ } while (0) /* This macro should be called with FROM at the start of forward diff --git a/src/undo.c b/src/undo.c index f6953fabfec..d11cd6f5570 100644 --- a/src/undo.c +++ b/src/undo.c @@ -73,12 +73,12 @@ record_point (EMACS_INT pt) Fundo_boundary (); last_undo_buffer = current_buffer; - if (CONSP (B_ (current_buffer, undo_list))) + if (CONSP (BVAR (current_buffer, undo_list))) { /* Set AT_BOUNDARY to 1 only when we have nothing other than marker adjustment before undo boundary. */ - Lisp_Object tail = B_ (current_buffer, undo_list), elt; + Lisp_Object tail = BVAR (current_buffer, undo_list), elt; while (1) { @@ -103,8 +103,8 @@ record_point (EMACS_INT pt) if (at_boundary && current_buffer == last_boundary_buffer && last_boundary_position != pt) - B_ (current_buffer, undo_list) - = Fcons (make_number (last_boundary_position), B_ (current_buffer, undo_list)); + BVAR (current_buffer, undo_list) + = Fcons (make_number (last_boundary_position), BVAR (current_buffer, undo_list)); } /* Record an insertion that just happened or is about to happen, @@ -117,17 +117,17 @@ record_insert (EMACS_INT beg, EMACS_INT length) { Lisp_Object lbeg, lend; - if (EQ (B_ (current_buffer, undo_list), Qt)) + if (EQ (BVAR (current_buffer, undo_list), Qt)) return; record_point (beg); /* If this is following another insertion and consecutive with it in the buffer, combine the two. */ - if (CONSP (B_ (current_buffer, undo_list))) + if (CONSP (BVAR (current_buffer, undo_list))) { Lisp_Object elt; - elt = XCAR (B_ (current_buffer, undo_list)); + elt = XCAR (BVAR (current_buffer, undo_list)); if (CONSP (elt) && INTEGERP (XCAR (elt)) && INTEGERP (XCDR (elt)) @@ -140,8 +140,8 @@ record_insert (EMACS_INT beg, EMACS_INT length) XSETFASTINT (lbeg, beg); XSETINT (lend, beg + length); - B_ (current_buffer, undo_list) = Fcons (Fcons (lbeg, lend), - B_ (current_buffer, undo_list)); + BVAR (current_buffer, undo_list) = Fcons (Fcons (lbeg, lend), + BVAR (current_buffer, undo_list)); } /* Record that a deletion is about to take place, @@ -152,7 +152,7 @@ record_delete (EMACS_INT beg, Lisp_Object string) { Lisp_Object sbeg; - if (EQ (B_ (current_buffer, undo_list), Qt)) + if (EQ (BVAR (current_buffer, undo_list), Qt)) return; if (PT == beg + SCHARS (string)) @@ -166,8 +166,8 @@ record_delete (EMACS_INT beg, Lisp_Object string) record_point (beg); } - B_ (current_buffer, undo_list) - = Fcons (Fcons (string, sbeg), B_ (current_buffer, undo_list)); + BVAR (current_buffer, undo_list) + = Fcons (Fcons (string, sbeg), BVAR (current_buffer, undo_list)); } /* Record the fact that MARKER is about to be adjusted by ADJUSTMENT. @@ -178,7 +178,7 @@ record_delete (EMACS_INT beg, Lisp_Object string) void record_marker_adjustment (Lisp_Object marker, EMACS_INT adjustment) { - if (EQ (B_ (current_buffer, undo_list), Qt)) + if (EQ (BVAR (current_buffer, undo_list), Qt)) return; /* Allocate a cons cell to be the undo boundary after this command. */ @@ -189,9 +189,9 @@ record_marker_adjustment (Lisp_Object marker, EMACS_INT adjustment) Fundo_boundary (); last_undo_buffer = current_buffer; - B_ (current_buffer, undo_list) + BVAR (current_buffer, undo_list) = Fcons (Fcons (marker, make_number (adjustment)), - B_ (current_buffer, undo_list)); + BVAR (current_buffer, undo_list)); } /* Record that a replacement is about to take place, @@ -215,7 +215,7 @@ record_first_change (void) Lisp_Object high, low; struct buffer *base_buffer = current_buffer; - if (EQ (B_ (current_buffer, undo_list), Qt)) + if (EQ (BVAR (current_buffer, undo_list), Qt)) return; if (current_buffer != last_undo_buffer) @@ -227,7 +227,7 @@ record_first_change (void) XSETFASTINT (high, (base_buffer->modtime >> 16) & 0xffff); XSETFASTINT (low, base_buffer->modtime & 0xffff); - B_ (current_buffer, undo_list) = Fcons (Fcons (Qt, Fcons (high, low)), B_ (current_buffer, undo_list)); + BVAR (current_buffer, undo_list) = Fcons (Fcons (Qt, Fcons (high, low)), BVAR (current_buffer, undo_list)); } /* Record a change in property PROP (whose old value was VAL) @@ -242,7 +242,7 @@ record_property_change (EMACS_INT beg, EMACS_INT length, struct buffer *obuf = current_buffer, *buf = XBUFFER (buffer); int boundary = 0; - if (EQ (B_ (buf, undo_list), Qt)) + if (EQ (BVAR (buf, undo_list), Qt)) return; /* Allocate a cons cell to be the undo boundary after this command. */ @@ -265,7 +265,7 @@ record_property_change (EMACS_INT beg, EMACS_INT length, XSETINT (lbeg, beg); XSETINT (lend, beg + length); entry = Fcons (Qnil, Fcons (prop, Fcons (value, Fcons (lbeg, lend)))); - B_ (current_buffer, undo_list) = Fcons (entry, B_ (current_buffer, undo_list)); + BVAR (current_buffer, undo_list) = Fcons (entry, BVAR (current_buffer, undo_list)); current_buffer = obuf; } @@ -277,9 +277,9 @@ but another undo command will undo to the previous boundary. */) (void) { Lisp_Object tem; - if (EQ (B_ (current_buffer, undo_list), Qt)) + if (EQ (BVAR (current_buffer, undo_list), Qt)) return Qnil; - tem = Fcar (B_ (current_buffer, undo_list)); + tem = Fcar (BVAR (current_buffer, undo_list)); if (!NILP (tem)) { /* One way or another, cons nil onto the front of the undo list. */ @@ -287,12 +287,12 @@ but another undo command will undo to the previous boundary. */) { /* If we have preallocated the cons cell to use here, use that one. */ - XSETCDR (pending_boundary, B_ (current_buffer, undo_list)); - B_ (current_buffer, undo_list) = pending_boundary; + XSETCDR (pending_boundary, BVAR (current_buffer, undo_list)); + BVAR (current_buffer, undo_list) = pending_boundary; pending_boundary = Qnil; } else - B_ (current_buffer, undo_list) = Fcons (Qnil, B_ (current_buffer, undo_list)); + BVAR (current_buffer, undo_list) = Fcons (Qnil, BVAR (current_buffer, undo_list)); } last_boundary_position = PT; last_boundary_buffer = current_buffer; @@ -321,7 +321,7 @@ truncate_undo_list (struct buffer *b) record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ()); set_buffer_internal (b); - list = B_ (b, undo_list); + list = BVAR (b, undo_list); prev = Qnil; next = list; @@ -433,7 +433,7 @@ truncate_undo_list (struct buffer *b) XSETCDR (last_boundary, Qnil); /* There's nothing we decided to keep, so clear it out. */ else - B_ (b, undo_list) = Qnil; + BVAR (b, undo_list) = Qnil; unbind_to (count, Qnil); } @@ -470,13 +470,13 @@ Return what remains of the list. */) /* In a writable buffer, enable undoing read-only text that is so because of text properties. */ - if (NILP (B_ (current_buffer, read_only))) + if (NILP (BVAR (current_buffer, read_only))) specbind (Qinhibit_read_only, Qt); /* Don't let `intangible' properties interfere with undo. */ specbind (Qinhibit_point_motion_hooks, Qt); - oldlist = B_ (current_buffer, undo_list); + oldlist = BVAR (current_buffer, undo_list); while (arg > 0) { @@ -631,9 +631,9 @@ Return what remains of the list. */) so the test in `undo' for continuing an undo series will work right. */ if (did_apply - && EQ (oldlist, B_ (current_buffer, undo_list))) - B_ (current_buffer, undo_list) - = Fcons (list3 (Qapply, Qcdr, Qnil), B_ (current_buffer, undo_list)); + && EQ (oldlist, BVAR (current_buffer, undo_list))) + BVAR (current_buffer, undo_list) + = Fcons (list3 (Qapply, Qcdr, Qnil), BVAR (current_buffer, undo_list)); UNGCPRO; return unbind_to (count, list); diff --git a/src/w32fns.c b/src/w32fns.c index 64e073bedb7..3f350c2f591 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -5225,7 +5225,7 @@ x_create_tip_frame (struct w32_display_info *dpyinfo, Fset_window_buffer (FRAME_ROOT_WINDOW (f), buffer, Qnil); old_buffer = current_buffer; set_buffer_internal_1 (XBUFFER (buffer)); - B_ (current_buffer, truncate_lines) = Qnil; + BVAR (current_buffer, truncate_lines) = Qnil; specbind (Qinhibit_read_only, Qt); specbind (Qinhibit_modification_hooks, Qt); Ferase_buffer (); @@ -5655,7 +5655,7 @@ Text larger than the specified size is clipped. */) /* Display the tooltip text in a temporary buffer. */ old_buffer = current_buffer; set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer)); - B_ (current_buffer, truncate_lines) = Qnil; + BVAR (current_buffer, truncate_lines) = Qnil; clear_glyph_matrix (w->desired_matrix); clear_glyph_matrix (w->current_matrix); SET_TEXT_POS (pos, BEGV, BEGV_BYTE); @@ -6162,7 +6162,7 @@ an integer representing a ShowWindow flag: CHECK_STRING (document); /* Encode filename, current directory and parameters. */ - current_dir = ENCODE_FILE (B_ (current_buffer, directory)); + current_dir = ENCODE_FILE (BVAR (current_buffer, directory)); document = ENCODE_FILE (document); if (STRINGP (parameters)) parameters = ENCODE_SYSTEM (parameters); diff --git a/src/window.c b/src/window.c index 4d700cfad5e..675a493e18e 100644 --- a/src/window.c +++ b/src/window.c @@ -1359,8 +1359,8 @@ window_display_table (struct window *w) { struct buffer *b = XBUFFER (w->buffer); - if (DISP_TABLE_P (B_ (b, display_table))) - dp = XCHAR_TABLE (B_ (b, display_table)); + if (DISP_TABLE_P (BVAR (b, display_table))) + dp = XCHAR_TABLE (BVAR (b, display_table)); else if (DISP_TABLE_P (Vstandard_display_table)) dp = XCHAR_TABLE (Vstandard_display_table); } @@ -1414,9 +1414,9 @@ unshow_buffer (register struct window *w) So don't clobber point in that buffer. */ if (! EQ (buf, XWINDOW (selected_window)->buffer) /* This line helps to fix Horsley's testbug.el bug. */ - && !(WINDOWP (B_ (b, last_selected_window)) - && w != XWINDOW (B_ (b, last_selected_window)) - && EQ (buf, XWINDOW (B_ (b, last_selected_window))->buffer))) + && !(WINDOWP (BVAR (b, last_selected_window)) + && w != XWINDOW (BVAR (b, last_selected_window)) + && EQ (buf, XWINDOW (BVAR (b, last_selected_window))->buffer))) temp_set_point_both (b, clip_to_bounds (BUF_BEGV (b), XMARKER (w->pointm)->charpos, @@ -1425,9 +1425,9 @@ unshow_buffer (register struct window *w) marker_byte_position (w->pointm), BUF_ZV_BYTE (b))); - if (WINDOWP (B_ (b, last_selected_window)) - && w == XWINDOW (B_ (b, last_selected_window))) - B_ (b, last_selected_window) = Qnil; + if (WINDOWP (BVAR (b, last_selected_window)) + && w == XWINDOW (BVAR (b, last_selected_window))) + BVAR (b, last_selected_window) = Qnil; } /* Put replacement into the window structure in place of old. */ @@ -2325,7 +2325,7 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame /* Check for a window that has a killed buffer. */ case CHECK_ALL_WINDOWS: if (! NILP (w->buffer) - && NILP (B_ (XBUFFER (w->buffer), name))) + && NILP (BVAR (XBUFFER (w->buffer), name))) abort (); break; @@ -2729,7 +2729,7 @@ window_min_size_2 (struct window *w, int width_p, int safe_p) { int safe_size = (MIN_SAFE_WINDOW_HEIGHT + ((BUFFERP (w->buffer) - && !NILP (B_ (XBUFFER (w->buffer), mode_line_format))) + && !NILP (BVAR (XBUFFER (w->buffer), mode_line_format))) ? 1 : 0)); return safe_p ? safe_size : max (window_min_height, safe_size); @@ -3360,15 +3360,15 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int w->buffer = buffer; if (EQ (window, selected_window)) - B_ (b, last_selected_window) = window; + BVAR (b, last_selected_window) = window; /* Let redisplay errors through. */ b->display_error_modiff = 0; /* Update time stamps of buffer display. */ - if (INTEGERP (B_ (b, display_count))) - XSETINT (B_ (b, display_count), XINT (B_ (b, display_count)) + 1); - B_ (b, display_time) = Fcurrent_time (); + if (INTEGERP (BVAR (b, display_count))) + XSETINT (BVAR (b, display_count), XINT (BVAR (b, display_count)) + 1); + BVAR (b, display_time) = Fcurrent_time (); XSETFASTINT (w->window_end_pos, 0); XSETFASTINT (w->window_end_vpos, 0); @@ -3421,18 +3421,18 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int w->left_margin_cols = w->right_margin_cols = Qnil; Fset_window_fringes (window, - B_ (b, left_fringe_width), B_ (b, right_fringe_width), - B_ (b, fringes_outside_margins)); + BVAR (b, left_fringe_width), BVAR (b, right_fringe_width), + BVAR (b, fringes_outside_margins)); Fset_window_scroll_bars (window, - B_ (b, scroll_bar_width), - B_ (b, vertical_scroll_bar_type), Qnil); + BVAR (b, scroll_bar_width), + BVAR (b, vertical_scroll_bar_type), Qnil); w->left_margin_cols = save_left; w->right_margin_cols = save_right; Fset_window_margins (window, - B_ (b, left_margin_cols), B_ (b, right_margin_cols)); + BVAR (b, left_margin_cols), BVAR (b, right_margin_cols)); } if (run_hooks_p) @@ -3469,7 +3469,7 @@ This function runs `window-scroll-functions' before running XSETWINDOW (window, w); buffer = Fget_buffer (buffer_or_name); CHECK_BUFFER (buffer); - if (NILP (B_ (XBUFFER (buffer), name))) + if (NILP (BVAR (XBUFFER (buffer), name))) error ("Attempt to display deleted buffer"); tem = w->buffer; @@ -3481,7 +3481,7 @@ This function runs `window-scroll-functions' before running if (EQ (tem, buffer)) return Qnil; else if (EQ (w->dedicated, Qt)) - error ("Window is dedicated to `%s'", SDATA (B_ (XBUFFER (tem), name))); + error ("Window is dedicated to `%s'", SDATA (BVAR (XBUFFER (tem), name))); else w->dedicated = Qnil; @@ -3552,7 +3552,7 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap) Fset_buffer (w->buffer); - B_ (XBUFFER (w->buffer), last_selected_window) = window; + BVAR (XBUFFER (w->buffer), last_selected_window) = window; /* Go to the point recorded in the window. This is important when the buffer is in more @@ -3640,7 +3640,7 @@ displaying that buffer. */) if (STRINGP (object)) object = Fget_buffer (object); - if (BUFFERP (object) && !NILP (B_ (XBUFFER (object), name))) + if (BUFFERP (object) && !NILP (BVAR (XBUFFER (object), name))) { /* Walk all windows looking for buffer, and force update of each of those windows. */ @@ -3663,7 +3663,7 @@ temp_output_buffer_show (register Lisp_Object buf) register Lisp_Object window; register struct window *w; - B_ (XBUFFER (buf), directory) = B_ (current_buffer, directory); + BVAR (XBUFFER (buf), directory) = BVAR (current_buffer, directory); Fset_buffer (buf); BUF_SAVE_MODIFF (XBUFFER (buf)) = MODIFF; @@ -5878,7 +5878,7 @@ the return value is nil. Otherwise the value is t. */) saved_windows = XVECTOR (data->saved_windows); new_current_buffer = data->current_buffer; - if (NILP (B_ (XBUFFER (new_current_buffer), name))) + if (NILP (BVAR (XBUFFER (new_current_buffer), name))) new_current_buffer = Qnil; else { @@ -6063,14 +6063,14 @@ the return value is nil. Otherwise the value is t. */) w->buffer = p->buffer; else { - if (!NILP (B_ (XBUFFER (p->buffer), name))) + if (!NILP (BVAR (XBUFFER (p->buffer), name))) /* If saved buffer is alive, install it. */ { w->buffer = p->buffer; w->start_at_line_beg = p->start_at_line_beg; set_marker_restricted (w->start, p->start, w->buffer); set_marker_restricted (w->pointm, p->pointm, w->buffer); - Fset_marker (B_ (XBUFFER (w->buffer), mark), + Fset_marker (BVAR (XBUFFER (w->buffer), mark), p->mark, w->buffer); /* As documented in Fcurrent_window_configuration, don't @@ -6080,7 +6080,7 @@ the return value is nil. Otherwise the value is t. */) && XBUFFER (p->buffer) == current_buffer) Fgoto_char (w->pointm); } - else if (NILP (w->buffer) || NILP (B_ (XBUFFER (w->buffer), name))) + else if (NILP (w->buffer) || NILP (BVAR (XBUFFER (w->buffer), name))) /* Else unless window has a live buffer, get one. */ { w->buffer = Fcdr (Fcar (Vbuffer_alist)); @@ -6121,7 +6121,7 @@ the return value is nil. Otherwise the value is t. */) has been restored into it. We already swapped out that point from that window's old buffer. */ select_window (data->current_window, Qnil, 1); - B_ (XBUFFER (XWINDOW (selected_window)->buffer), last_selected_window) + BVAR (XBUFFER (XWINDOW (selected_window)->buffer), last_selected_window) = selected_window; if (NILP (data->focus_frame) @@ -6322,7 +6322,7 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i) p->start = Fcopy_marker (w->start, Qnil); p->start_at_line_beg = w->start_at_line_beg; - tem = B_ (XBUFFER (w->buffer), mark); + tem = BVAR (XBUFFER (w->buffer), mark); p->mark = Fcopy_marker (tem, Qnil); } else diff --git a/src/xdisp.c b/src/xdisp.c index 147f2965d0e..1cb4f7350c6 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -1210,12 +1210,12 @@ pos_visible_p (struct window *w, EMACS_INT charpos, int *x, int *y, if (WINDOW_WANTS_MODELINE_P (w)) current_mode_line_height = display_mode_line (w, CURRENT_MODE_LINE_FACE_ID (w), - B_ (current_buffer, mode_line_format)); + BVAR (current_buffer, mode_line_format)); if (WINDOW_WANTS_HEADER_LINE_P (w)) current_header_line_height = display_mode_line (w, HEADER_LINE_FACE_ID, - B_ (current_buffer, header_line_format)); + BVAR (current_buffer, header_line_format)); start_display (&it, w, top); move_it_to (&it, charpos, -1, it.last_visible_y-1, -1, @@ -2405,10 +2405,10 @@ init_iterator (struct it *it, struct window *w, if (base_face_id == DEFAULT_FACE_ID && FRAME_WINDOW_P (it->f)) { - if (NATNUMP (B_ (current_buffer, extra_line_spacing))) - it->extra_line_spacing = XFASTINT (B_ (current_buffer, extra_line_spacing)); - else if (FLOATP (B_ (current_buffer, extra_line_spacing))) - it->extra_line_spacing = (XFLOAT_DATA (B_ (current_buffer, extra_line_spacing)) + if (NATNUMP (BVAR (current_buffer, extra_line_spacing))) + it->extra_line_spacing = XFASTINT (BVAR (current_buffer, extra_line_spacing)); + else if (FLOATP (BVAR (current_buffer, extra_line_spacing))) + it->extra_line_spacing = (XFLOAT_DATA (BVAR (current_buffer, extra_line_spacing)) * FRAME_LINE_HEIGHT (it->f)); else if (it->f->extra_line_spacing > 0) it->extra_line_spacing = it->f->extra_line_spacing; @@ -2431,36 +2431,36 @@ init_iterator (struct it *it, struct window *w, it->override_ascent = -1; /* Are control characters displayed as `^C'? */ - it->ctl_arrow_p = !NILP (B_ (current_buffer, ctl_arrow)); + it->ctl_arrow_p = !NILP (BVAR (current_buffer, ctl_arrow)); /* -1 means everything between a CR and the following line end is invisible. >0 means lines indented more than this value are invisible. */ - it->selective = (INTEGERP (B_ (current_buffer, selective_display)) - ? XFASTINT (B_ (current_buffer, selective_display)) - : (!NILP (B_ (current_buffer, selective_display)) + it->selective = (INTEGERP (BVAR (current_buffer, selective_display)) + ? XFASTINT (BVAR (current_buffer, selective_display)) + : (!NILP (BVAR (current_buffer, selective_display)) ? -1 : 0)); it->selective_display_ellipsis_p - = !NILP (B_ (current_buffer, selective_display_ellipses)); + = !NILP (BVAR (current_buffer, selective_display_ellipses)); /* Display table to use. */ it->dp = window_display_table (w); /* Are multibyte characters enabled in current_buffer? */ - it->multibyte_p = !NILP (B_ (current_buffer, enable_multibyte_characters)); + it->multibyte_p = !NILP (BVAR (current_buffer, enable_multibyte_characters)); /* Do we need to reorder bidirectional text? Not if this is a unibyte buffer: by definition, none of the single-byte characters are strong R2L, so no reordering is needed. And bidi.c doesn't support unibyte buffers anyway. */ it->bidi_p - = !NILP (B_ (current_buffer, bidi_display_reordering)) && it->multibyte_p; + = !NILP (BVAR (current_buffer, bidi_display_reordering)) && it->multibyte_p; /* Non-zero if we should highlight the region. */ highlight_region_p = (!NILP (Vtransient_mark_mode) - && !NILP (B_ (current_buffer, mark_active)) - && XMARKER (B_ (current_buffer, mark))->buffer != 0); + && !NILP (BVAR (current_buffer, mark_active)) + && XMARKER (BVAR (current_buffer, mark))->buffer != 0); /* Set IT->region_beg_charpos and IT->region_end_charpos to the start and end of a visible region in window IT->w. Set both to @@ -2477,7 +2477,7 @@ init_iterator (struct it *it, struct window *w, && WINDOWP (minibuf_selected_window) && w == XWINDOW (minibuf_selected_window)))) { - EMACS_INT charpos = marker_position (B_ (current_buffer, mark)); + EMACS_INT charpos = marker_position (BVAR (current_buffer, mark)); it->region_beg_charpos = min (PT, charpos); it->region_end_charpos = max (PT, charpos); } @@ -2494,7 +2494,7 @@ init_iterator (struct it *it, struct window *w, it->redisplay_end_trigger_charpos = XINT (w->redisplay_end_trigger); /* Correct bogus values of tab_width. */ - it->tab_width = XINT (B_ (current_buffer, tab_width)); + it->tab_width = XINT (BVAR (current_buffer, tab_width)); if (it->tab_width <= 0 || it->tab_width > 1000) it->tab_width = 8; @@ -2508,8 +2508,8 @@ init_iterator (struct it *it, struct window *w, && (WINDOW_TOTAL_COLS (it->w) < XINT (Vtruncate_partial_width_windows)))))) it->line_wrap = TRUNCATE; - else if (NILP (B_ (current_buffer, truncate_lines))) - it->line_wrap = NILP (B_ (current_buffer, word_wrap)) + else if (NILP (BVAR (current_buffer, truncate_lines))) + it->line_wrap = NILP (BVAR (current_buffer, word_wrap)) ? WINDOW_WRAP : WORD_WRAP; else it->line_wrap = TRUNCATE; @@ -2611,9 +2611,9 @@ init_iterator (struct it *it, struct window *w, { /* Note the paragraph direction that this buffer wants to use. */ - if (EQ (B_ (current_buffer, bidi_paragraph_direction), Qleft_to_right)) + if (EQ (BVAR (current_buffer, bidi_paragraph_direction), Qleft_to_right)) it->paragraph_embedding = L2R; - else if (EQ (B_ (current_buffer, bidi_paragraph_direction), Qright_to_left)) + else if (EQ (BVAR (current_buffer, bidi_paragraph_direction), Qright_to_left)) it->paragraph_embedding = R2L; else it->paragraph_embedding = NEUTRAL_DIR; @@ -5411,7 +5411,7 @@ reseat_1 (struct it *it, struct text_pos pos, int set_stop_p) it->method = GET_FROM_BUFFER; it->object = it->w->buffer; it->area = TEXT_AREA; - it->multibyte_p = !NILP (B_ (current_buffer, enable_multibyte_characters)); + it->multibyte_p = !NILP (BVAR (current_buffer, enable_multibyte_characters)); it->sp = 0; it->string_from_display_prop_p = 0; it->face_before_selective_p = 0; @@ -7919,7 +7919,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte) old_deactivate_mark = Vdeactivate_mark; oldbuf = current_buffer; Fset_buffer (Fget_buffer_create (Vmessages_buffer_name)); - B_ (current_buffer, undo_list) = Qt; + BVAR (current_buffer, undo_list) = Qt; oldpoint = message_dolog_marker1; set_marker_restricted (oldpoint, make_number (PT), Qnil); @@ -7943,7 +7943,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte) /* Insert the string--maybe converting multibyte to single byte or vice versa, so that all the text fits the buffer. */ if (multibyte - && NILP (B_ (current_buffer, enable_multibyte_characters))) + && NILP (BVAR (current_buffer, enable_multibyte_characters))) { EMACS_INT i; int c, char_bytes; @@ -7961,7 +7961,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte) } } else if (! multibyte - && ! NILP (B_ (current_buffer, enable_multibyte_characters))) + && ! NILP (BVAR (current_buffer, enable_multibyte_characters))) { EMACS_INT i; int c, char_bytes; @@ -8460,7 +8460,7 @@ update_echo_area (void) Lisp_Object string; string = Fcurrent_message (); message3 (string, SBYTES (string), - !NILP (B_ (current_buffer, enable_multibyte_characters))); + !NILP (BVAR (current_buffer, enable_multibyte_characters))); } } @@ -8475,7 +8475,7 @@ ensure_echo_area_buffers (void) for (i = 0; i < 2; ++i) if (!BUFFERP (echo_buffer[i]) - || NILP (B_ (XBUFFER (echo_buffer[i]), name))) + || NILP (BVAR (XBUFFER (echo_buffer[i]), name))) { char name[30]; Lisp_Object old_buffer; @@ -8484,7 +8484,7 @@ ensure_echo_area_buffers (void) old_buffer = echo_buffer[i]; sprintf (name, " *Echo Area %d*", i); echo_buffer[i] = Fget_buffer_create (build_string (name)); - B_ (XBUFFER (echo_buffer[i]), truncate_lines) = Qnil; + BVAR (XBUFFER (echo_buffer[i]), truncate_lines) = Qnil; /* to force word wrap in echo area - it was decided to postpone this*/ /* XBUFFER (echo_buffer[i])->word_wrap = Qt; */ @@ -8577,8 +8577,8 @@ with_echo_area_buffer (struct window *w, int which, set_marker_both (w->pointm, buffer, BEG, BEG_BYTE); } - B_ (current_buffer, undo_list) = Qt; - B_ (current_buffer, read_only) = Qnil; + BVAR (current_buffer, undo_list) = Qt; + BVAR (current_buffer, read_only) = Qnil; specbind (Qinhibit_read_only, Qt); specbind (Qinhibit_modification_hooks, Qt); @@ -8691,7 +8691,7 @@ setup_echo_area_for_printing (int multibyte_p) /* Switch to that buffer and clear it. */ set_buffer_internal (XBUFFER (echo_area_buffer[0])); - B_ (current_buffer, truncate_lines) = Qnil; + BVAR (current_buffer, truncate_lines) = Qnil; if (Z > BEG) { @@ -8705,7 +8705,7 @@ setup_echo_area_for_printing (int multibyte_p) /* Set up the buffer for the multibyteness we need. */ if (multibyte_p - != !NILP (B_ (current_buffer, enable_multibyte_characters))) + != !NILP (BVAR (current_buffer, enable_multibyte_characters))) Fset_buffer_multibyte (multibyte_p ? Qt : Qnil); /* Raise the frame containing the echo area. */ @@ -8734,7 +8734,7 @@ setup_echo_area_for_printing (int multibyte_p) { /* Someone switched buffers between print requests. */ set_buffer_internal (XBUFFER (echo_area_buffer[0])); - B_ (current_buffer, truncate_lines) = Qnil; + BVAR (current_buffer, truncate_lines) = Qnil; } } } @@ -9177,12 +9177,12 @@ set_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT nbytes, EMACS_INT multiby /* Change multibyteness of the echo buffer appropriately. */ if (message_enable_multibyte - != !NILP (B_ (current_buffer, enable_multibyte_characters))) + != !NILP (BVAR (current_buffer, enable_multibyte_characters))) Fset_buffer_multibyte (message_enable_multibyte ? Qt : Qnil); - B_ (current_buffer, truncate_lines) = message_truncate_lines ? Qt : Qnil; - if (!NILP (B_ (current_buffer, bidi_display_reordering))) - B_ (current_buffer, bidi_paragraph_direction) = Qleft_to_right; + BVAR (current_buffer, truncate_lines) = message_truncate_lines ? Qt : Qnil; + if (!NILP (BVAR (current_buffer, bidi_display_reordering))) + BVAR (current_buffer, bidi_paragraph_direction) = Qleft_to_right; /* Insert new message at BEG. */ TEMP_SET_PT_BOTH (BEG, BEG_BYTE); @@ -9205,7 +9205,7 @@ set_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT nbytes, EMACS_INT multiby if (nbytes == 0) nbytes = strlen (s); - if (multibyte_p && NILP (B_ (current_buffer, enable_multibyte_characters))) + if (multibyte_p && NILP (BVAR (current_buffer, enable_multibyte_characters))) { /* Convert from multi-byte to single-byte. */ EMACS_INT i; @@ -9223,7 +9223,7 @@ set_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT nbytes, EMACS_INT multiby } } else if (!multibyte_p - && !NILP (B_ (current_buffer, enable_multibyte_characters))) + && !NILP (BVAR (current_buffer, enable_multibyte_characters))) { /* Convert from single-byte to multi-byte. */ EMACS_INT i; @@ -9808,7 +9808,7 @@ update_menu_bar (struct frame *f, int save_match_data, int hooks_run) < BUF_MODIFF (XBUFFER (w->buffer))) != !NILP (w->last_had_star)) || ((!NILP (Vtransient_mark_mode) - && !NILP (B_ (XBUFFER (w->buffer), mark_active))) + && !NILP (BVAR (XBUFFER (w->buffer), mark_active))) != !NILP (w->region_showing))) { struct buffer *prev = current_buffer; @@ -10006,7 +10006,7 @@ update_tool_bar (struct frame *f, int save_match_data) < BUF_MODIFF (XBUFFER (w->buffer))) != !NILP (w->last_had_star)) || ((!NILP (Vtransient_mark_mode) - && !NILP (B_ (XBUFFER (w->buffer), mark_active))) + && !NILP (BVAR (XBUFFER (w->buffer), mark_active))) != !NILP (w->region_showing))) { struct buffer *prev = current_buffer; @@ -11097,8 +11097,8 @@ text_outside_line_unchanged_p (struct window *w, /* If selective display, can't optimize if changes start at the beginning of the line. */ if (unchanged_p - && INTEGERP (B_ (current_buffer, selective_display)) - && XINT (B_ (current_buffer, selective_display)) > 0 + && INTEGERP (BVAR (current_buffer, selective_display)) + && XINT (BVAR (current_buffer, selective_display)) > 0 && (BEG_UNCHANGED < start || GPT <= start)) unchanged_p = 0; @@ -11126,8 +11126,8 @@ text_outside_line_unchanged_p (struct window *w, require to redisplay the whole paragraph. It might be worthwhile to find the paragraph limits and widen the range of redisplayed lines to that, but for now just give up this optimization. */ - if (!NILP (B_ (XBUFFER (w->buffer), bidi_display_reordering)) - && NILP (B_ (XBUFFER (w->buffer), bidi_paragraph_direction))) + if (!NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering)) + && NILP (BVAR (XBUFFER (w->buffer), bidi_paragraph_direction))) unchanged_p = 0; } @@ -11674,11 +11674,11 @@ redisplay_internal (int preserve_echo_area) the whole window. The assignment to this_line_start_pos prevents the optimization directly below this if-statement. */ if (((!NILP (Vtransient_mark_mode) - && !NILP (B_ (XBUFFER (w->buffer), mark_active))) + && !NILP (BVAR (XBUFFER (w->buffer), mark_active))) != !NILP (w->region_showing)) || (!NILP (w->region_showing) && !EQ (w->region_showing, - Fmarker_position (B_ (XBUFFER (w->buffer), mark))))) + Fmarker_position (BVAR (XBUFFER (w->buffer), mark))))) CHARPOS (this_line_start_pos) = 0; /* Optimize the case that only the line containing the cursor in the @@ -11842,8 +11842,8 @@ redisplay_internal (int preserve_echo_area) /* If highlighting the region, or if the cursor is in the echo area, then we can't just move the cursor. */ else if (! (!NILP (Vtransient_mark_mode) - && !NILP (B_ (current_buffer, mark_active))) - && (EQ (selected_window, B_ (current_buffer, last_selected_window)) + && !NILP (BVAR (current_buffer, mark_active))) + && (EQ (selected_window, BVAR (current_buffer, last_selected_window)) || highlight_nonselected_windows) && NILP (w->region_showing) && NILP (Vshow_trailing_whitespace) @@ -13050,8 +13050,8 @@ try_scrolling (Lisp_Object window, int just_this_one_p, scroll_max = (max (scroll_step, max (arg_scroll_conservatively, temp_scroll_step)) * FRAME_LINE_HEIGHT (f)); - else if (NUMBERP (B_ (current_buffer, scroll_down_aggressively)) - || NUMBERP (B_ (current_buffer, scroll_up_aggressively))) + else if (NUMBERP (BVAR (current_buffer, scroll_down_aggressively)) + || NUMBERP (BVAR (current_buffer, scroll_up_aggressively))) /* We're trying to scroll because of aggressive scrolling but no scroll_step is set. Choose an arbitrary one. */ scroll_max = 10 * FRAME_LINE_HEIGHT (f); @@ -13116,7 +13116,7 @@ try_scrolling (Lisp_Object window, int just_this_one_p, amount_to_scroll = scroll_max; else { - aggressive = B_ (current_buffer, scroll_up_aggressively); + aggressive = BVAR (current_buffer, scroll_up_aggressively); height = WINDOW_BOX_TEXT_HEIGHT (w); if (NUMBERP (aggressive)) { @@ -13199,7 +13199,7 @@ try_scrolling (Lisp_Object window, int just_this_one_p, amount_to_scroll = scroll_max; else { - aggressive = B_ (current_buffer, scroll_down_aggressively); + aggressive = BVAR (current_buffer, scroll_down_aggressively); height = WINDOW_BOX_TEXT_HEIGHT (w); if (NUMBERP (aggressive)) { @@ -13380,7 +13380,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste region exists, cursor movement has to do more than just set the cursor. */ && !(!NILP (Vtransient_mark_mode) - && !NILP (B_ (current_buffer, mark_active))) + && !NILP (BVAR (current_buffer, mark_active))) && NILP (w->region_showing) && NILP (Vshow_trailing_whitespace) /* Right after splitting windows, last_point may be nil. */ @@ -13535,7 +13535,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste must_scroll = 1; } else if (rc != CURSOR_MOVEMENT_SUCCESS - && !NILP (B_ (XBUFFER (w->buffer), bidi_display_reordering))) + && !NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering))) { /* If rows are bidi-reordered and point moved, back up until we find a row that does not belong to a @@ -13593,7 +13593,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste else if (scroll_p) rc = CURSOR_MOVEMENT_MUST_SCROLL; else if (rc != CURSOR_MOVEMENT_SUCCESS - && !NILP (B_ (XBUFFER (w->buffer), bidi_display_reordering))) + && !NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering))) { /* With bidi-reordered rows, there could be more than one candidate row whose start and end positions @@ -13893,7 +13893,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) struct Lisp_Char_Table *disptab = buffer_display_table (); if (! disptab_matches_widthtab (disptab, - XVECTOR (B_ (current_buffer, width_table)))) + XVECTOR (BVAR (current_buffer, width_table)))) { invalidate_region_cache (current_buffer, current_buffer->width_run_cache, @@ -14015,7 +14015,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) /* If we are highlighting the region, then we just changed the region, so redisplay to show it. */ if (!NILP (Vtransient_mark_mode) - && !NILP (B_ (current_buffer, mark_active))) + && !NILP (BVAR (current_buffer, mark_active))) { clear_glyph_matrix (w->desired_matrix); if (!try_window (window, startp, 0)) @@ -14178,8 +14178,8 @@ redisplay_window (Lisp_Object window, int just_this_one_p) if ((scroll_conservatively || emacs_scroll_step || temp_scroll_step - || NUMBERP (B_ (current_buffer, scroll_up_aggressively)) - || NUMBERP (B_ (current_buffer, scroll_down_aggressively))) + || NUMBERP (BVAR (current_buffer, scroll_up_aggressively)) + || NUMBERP (BVAR (current_buffer, scroll_down_aggressively))) && !current_buffer->clip_changed && CHARPOS (startp) >= BEGV && CHARPOS (startp) <= ZV) @@ -14622,7 +14622,7 @@ try_window_reusing_current_matrix (struct window *w) /* Can't do this if region may have changed. */ if ((!NILP (Vtransient_mark_mode) - && !NILP (B_ (current_buffer, mark_active))) + && !NILP (BVAR (current_buffer, mark_active))) || !NILP (w->region_showing) || !NILP (Vshow_trailing_whitespace)) return 0; @@ -14965,7 +14965,7 @@ try_window_reusing_current_matrix (struct window *w) /* Can't use this optimization with bidi-reordered glyph rows, unless cursor is already at point. */ - if (!NILP (B_ (XBUFFER (w->buffer), bidi_display_reordering))) + if (!NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering))) { if (!(w->cursor.hpos >= 0 && w->cursor.hpos < row->used[TEXT_AREA] @@ -15279,7 +15279,7 @@ row_containing_pos (struct window *w, EMACS_INT charpos, { struct glyph *g; - if (NILP (B_ (XBUFFER (w->buffer), bidi_display_reordering)) + if (NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering)) || (!best_row && !row->continued_p)) return row; /* In bidi-reordered rows, there could be several rows @@ -15426,7 +15426,7 @@ try_window_id (struct window *w) /* Can't use this if highlighting a region because a cursor movement will do more than just set the cursor. */ if (!NILP (Vtransient_mark_mode) - && !NILP (B_ (current_buffer, mark_active))) + && !NILP (BVAR (current_buffer, mark_active))) GIVE_UP (9); /* Likewise if highlighting trailing whitespace. */ @@ -15446,7 +15446,7 @@ try_window_id (struct window *w) wrapped line can change the wrap position, altering the line above it. It might be worthwhile to handle this more intelligently, but for now just redisplay from scratch. */ - if (!NILP (B_ (XBUFFER (w->buffer), word_wrap))) + if (!NILP (BVAR (XBUFFER (w->buffer), word_wrap))) GIVE_UP (21); /* Under bidi reordering, adding or deleting a character in the @@ -15457,8 +15457,8 @@ try_window_id (struct window *w) to find the paragraph limits and widen the range of redisplayed lines to that, but for now just give up this optimization and redisplay from scratch. */ - if (!NILP (B_ (XBUFFER (w->buffer), bidi_display_reordering)) - && NILP (B_ (XBUFFER (w->buffer), bidi_paragraph_direction))) + if (!NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering)) + && NILP (BVAR (XBUFFER (w->buffer), bidi_paragraph_direction))) GIVE_UP (22); /* Make sure beg_unchanged and end_unchanged are up to date. Do it @@ -16429,7 +16429,7 @@ get_overlay_arrow_glyph_row (struct window *w, Lisp_Object overlay_arrow_string) it.glyph_row->used[TEXT_AREA] = 0; SET_TEXT_POS (it.position, 0, 0); - multibyte_p = !NILP (B_ (buffer, enable_multibyte_characters)); + multibyte_p = !NILP (BVAR (buffer, enable_multibyte_characters)); p = arrow_string; while (p < arrow_end) { @@ -17364,7 +17364,7 @@ display_line (struct it *it) row->glyphs[TEXT_AREA]->charpos = -1; row->displays_text_p = 0; - if (!NILP (B_ (XBUFFER (it->w->buffer), indicate_empty_lines)) + if (!NILP (BVAR (XBUFFER (it->w->buffer), indicate_empty_lines)) && (!MINI_WINDOW_P (it->w) || (minibuf_level && EQ (it->window, minibuf_window)))) row->indicate_empty_line_p = 1; @@ -17942,10 +17942,10 @@ See also `bidi-paragraph-direction'. */) old = current_buffer; } - if (NILP (B_ (buf, bidi_display_reordering))) + if (NILP (BVAR (buf, bidi_display_reordering))) return Qleft_to_right; - else if (!NILP (B_ (buf, bidi_paragraph_direction))) - return B_ (buf, bidi_paragraph_direction); + else if (!NILP (BVAR (buf, bidi_paragraph_direction))) + return BVAR (buf, bidi_paragraph_direction); else { /* Determine the direction from buffer text. We could try to @@ -18204,14 +18204,14 @@ display_mode_lines (struct window *w) /* Select mode line face based on the real selected window. */ display_mode_line (w, CURRENT_MODE_LINE_FACE_ID_3 (sel_w, sel_w, w), - B_ (current_buffer, mode_line_format)); + BVAR (current_buffer, mode_line_format)); ++n; } if (WINDOW_WANTS_HEADER_LINE_P (w)) { display_mode_line (w, HEADER_LINE_FACE_ID, - B_ (current_buffer, header_line_format)); + BVAR (current_buffer, header_line_format)); ++n; } @@ -19146,7 +19146,7 @@ static char * decode_mode_spec_coding (Lisp_Object coding_system, register char *buf, int eol_flag) { Lisp_Object val; - int multibyte = !NILP (B_ (current_buffer, enable_multibyte_characters)); + int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); const unsigned char *eol_str; int eol_str_len; /* The EOL conversion we are using. */ @@ -19242,7 +19242,7 @@ decode_mode_spec (struct window *w, register int c, int field_width, switch (c) { case '*': - if (!NILP (B_ (b, read_only))) + if (!NILP (BVAR (b, read_only))) return "%"; if (BUF_MODIFF (b) > BUF_SAVE_MODIFF (b)) return "*"; @@ -19252,7 +19252,7 @@ decode_mode_spec (struct window *w, register int c, int field_width, /* This differs from %* only for a modified read-only buffer. */ if (BUF_MODIFF (b) > BUF_SAVE_MODIFF (b)) return "*"; - if (!NILP (B_ (b, read_only))) + if (!NILP (BVAR (b, read_only))) return "%"; return "-"; @@ -19314,7 +19314,7 @@ decode_mode_spec (struct window *w, register int c, int field_width, } case 'b': - obj = B_ (b, name); + obj = BVAR (b, name); break; case 'c': @@ -19354,7 +19354,7 @@ decode_mode_spec (struct window *w, register int c, int field_width, return "Emacs"; case 'f': - obj = B_ (b, filename); + obj = BVAR (b, filename); break; case 'i': @@ -19490,7 +19490,7 @@ decode_mode_spec (struct window *w, register int c, int field_width, break; case 'm': - obj = B_ (b, mode_name); + obj = BVAR (b, mode_name); break; case 'n': @@ -19575,7 +19575,7 @@ decode_mode_spec (struct window *w, register int c, int field_width, { int count = inhibit_garbage_collection (); Lisp_Object val = call1 (intern ("file-remote-p"), - B_ (current_buffer, directory)); + BVAR (current_buffer, directory)); unbind_to (count, Qnil); if (NILP (val)) @@ -19610,7 +19610,7 @@ decode_mode_spec (struct window *w, register int c, int field_width, (FRAME_TERMINAL_CODING (f)->id), p, 0); } - p = decode_mode_spec_coding (B_ (b, buffer_file_coding_system), + p = decode_mode_spec_coding (BVAR (b, buffer_file_coding_system), p, eol_flag); #if 0 /* This proves to be annoying; I think we can do without. -- rms. */ @@ -19660,8 +19660,8 @@ display_count_lines (EMACS_INT start, EMACS_INT start_byte, /* If we are not in selective display mode, check only for newlines. */ - int selective_display = (!NILP (B_ (current_buffer, selective_display)) - && !INTEGERP (B_ (current_buffer, selective_display))); + int selective_display = (!NILP (BVAR (current_buffer, selective_display)) + && !INTEGERP (BVAR (current_buffer, selective_display))); if (count > 0) { @@ -23308,13 +23308,13 @@ get_window_cursor_type (struct window *w, struct glyph *glyph, int *width, { if (w == XWINDOW (echo_area_window)) { - if (EQ (B_ (b, cursor_type), Qt) || NILP (B_ (b, cursor_type))) + if (EQ (BVAR (b, cursor_type), Qt) || NILP (BVAR (b, cursor_type))) { *width = FRAME_CURSOR_WIDTH (f); return FRAME_DESIRED_CURSOR (f); } else - return get_specified_cursor_type (B_ (b, cursor_type), width); + return get_specified_cursor_type (BVAR (b, cursor_type), width); } *active_cursor = 0; @@ -23334,23 +23334,23 @@ get_window_cursor_type (struct window *w, struct glyph *glyph, int *width, } /* Never display a cursor in a window in which cursor-type is nil. */ - if (NILP (B_ (b, cursor_type))) + if (NILP (BVAR (b, cursor_type))) return NO_CURSOR; /* Get the normal cursor type for this window. */ - if (EQ (B_ (b, cursor_type), Qt)) + if (EQ (BVAR (b, cursor_type), Qt)) { cursor_type = FRAME_DESIRED_CURSOR (f); *width = FRAME_CURSOR_WIDTH (f); } else - cursor_type = get_specified_cursor_type (B_ (b, cursor_type), width); + cursor_type = get_specified_cursor_type (BVAR (b, cursor_type), width); /* Use cursor-in-non-selected-windows instead for non-selected window or frame. */ if (non_selected) { - alt_cursor = B_ (b, cursor_in_non_selected_windows); + alt_cursor = BVAR (b, cursor_in_non_selected_windows); if (!EQ (Qt, alt_cursor)) return get_specified_cursor_type (alt_cursor, width); /* t means modify the normal cursor type. */ @@ -23397,7 +23397,7 @@ get_window_cursor_type (struct window *w, struct glyph *glyph, int *width, /* Cursor is blinked off, so determine how to "toggle" it. */ /* First look for an entry matching the buffer's cursor-type in blink-cursor-alist. */ - if ((alt_cursor = Fassoc (B_ (b, cursor_type), Vblink_cursor_alist), !NILP (alt_cursor))) + if ((alt_cursor = Fassoc (BVAR (b, cursor_type), Vblink_cursor_alist), !NILP (alt_cursor))) return get_specified_cursor_type (XCDR (alt_cursor), width); /* Then see if frame has specified a specific blink off cursor type. */ @@ -25513,11 +25513,11 @@ note_mouse_highlight (struct frame *f, int x, int y) necessarily display the character whose position is the smallest. */ Lisp_Object lim1 = - NILP (B_ (XBUFFER (buffer), bidi_display_reordering)) + NILP (BVAR (XBUFFER (buffer), bidi_display_reordering)) ? Fmarker_position (w->start) : Qnil; Lisp_Object lim2 = - NILP (B_ (XBUFFER (buffer), bidi_display_reordering)) + NILP (BVAR (XBUFFER (buffer), bidi_display_reordering)) ? make_number (BUF_Z (XBUFFER (buffer)) - XFASTINT (w->window_end_pos)) : Qnil; diff --git a/src/xfaces.c b/src/xfaces.c index 9ae35a74bd1..4cc47c85050 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -5970,7 +5970,7 @@ compute_char_face (struct frame *f, int ch, Lisp_Object prop) { int face_id; - if (NILP (B_ (current_buffer, enable_multibyte_characters))) + if (NILP (BVAR (current_buffer, enable_multibyte_characters))) ch = 0; if (NILP (prop)) diff --git a/src/xfns.c b/src/xfns.c index 062bb105d0a..d8d4a8ca772 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -4610,7 +4610,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo, Fset_window_buffer (FRAME_ROOT_WINDOW (f), buffer, Qnil); old_buffer = current_buffer; set_buffer_internal_1 (XBUFFER (buffer)); - B_ (current_buffer, truncate_lines) = Qnil; + BVAR (current_buffer, truncate_lines) = Qnil; specbind (Qinhibit_read_only, Qt); specbind (Qinhibit_modification_hooks, Qt); Ferase_buffer (); @@ -5106,7 +5106,7 @@ Text larger than the specified size is clipped. */) /* Display the tooltip text in a temporary buffer. */ old_buffer = current_buffer; set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer)); - B_ (current_buffer, truncate_lines) = Qnil; + BVAR (current_buffer, truncate_lines) = Qnil; clear_glyph_matrix (w->desired_matrix); clear_glyph_matrix (w->current_matrix); SET_TEXT_POS (pos, BEGV, BEGV_BYTE); From eb4916d71a6a4293b1dd51deb19cf267bb62b7ae Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 16 Feb 2011 08:20:08 -0700 Subject: [PATCH 10/46] * lisp.h (DEFVAR_BUFFER_DEFAULTS): Use BVAR. --- src/ChangeLog | 4 ++++ src/lisp.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 58f2d9b0c6e..1f4e23b7504 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2011-02-16 Tom Tromey + + * lisp.h (DEFVAR_BUFFER_DEFAULTS): Use BVAR. + 2011-02-16 Tom Tromey * xfns.c (x_create_tip_frame, Fx_show_tip): Replace B_ with BVAR. diff --git a/src/lisp.h b/src/lisp.h index bd1595bce0b..b82f1b2f722 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -1882,7 +1882,7 @@ extern void defvar_kboard (struct Lisp_Kboard_Objfwd *, const char *, int); #define DEFVAR_BUFFER_DEFAULTS(lname, vname, doc) \ do { \ static struct Lisp_Objfwd o_fwd; \ - defvar_lisp_nopro (&o_fwd, lname, &buffer_defaults.vname ## _); \ + defvar_lisp_nopro (&o_fwd, lname, &BVAR (&buffer_defaults, vname)); \ } while (0) #define DEFVAR_KBOARD(lname, vname, doc) \ From 1344aad491d0951920efef6cae1c6934f92cd59b Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 16 Feb 2011 09:35:16 -0700 Subject: [PATCH 11/46] Hide implementation of `struct kboard' * callint.c (Fcall_interactively): Update. * doc.c (Fsubstitute_command_keys): Update. * cmds.c (Fself_insert_command): Update. * keymap.c (Fcurrent_active_maps, Fkey_binding) (Fdescribe_buffer_bindings): Update. * macros.c (Fstart_kbd_macro, end_kbd_macro, Fend_kbd_macro) (store_kbd_macro_char, Fcall_last_kbd_macro, Fexecute_kbd_macro): Update. * keyboard.c (echo_char, echo_dash, echo_now, cancel_echoing) (echo_length, echo_truncate, cmd_error, command_loop_1) (read_char, kbd_buffer_store_event_hold, make_lispy_event) (menu_bar_items, tool_bar_items, read_char_minibuf_menu_prompt) (read_key_sequence, Fcommand_execute, Fexecute_extended_command) (Fdiscard_input, init_kboard, init_keyboard, mark_kboards): Update. * xfns.c (Fx_create_frame): Update. * xterm.c (x_connection_closed, x_term_init): Update. * term.c (term_get_fkeys_1, CONDITIONAL_REASSIGN, init_tty): Update. * window.c (window_scroll_pixel_based, window_scroll_line_based): Update. * frame.c (make_frame_without_minibuffer, Fhandle_switch_frame) (delete_frame): Update. * lisp.h (DEFVAR_KBOARD): Update for change to field names. * keyboard.h (struct kboard): Rename all Lisp_Object fields. (KBOARD_INTERNAL_FIELD, KVAR): New macros. --- src/ChangeLog | 29 ++++++ src/callint.c | 6 +- src/cmds.c | 2 +- src/doc.c | 2 +- src/frame.c | 16 ++-- src/keyboard.c | 240 ++++++++++++++++++++++++------------------------- src/keyboard.h | 43 +++++---- src/keymap.c | 28 +++--- src/lisp.h | 2 +- src/macros.c | 42 ++++----- src/term.c | 18 ++-- src/window.c | 8 +- src/xfns.c | 6 +- src/xterm.c | 6 +- 14 files changed, 243 insertions(+), 205 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 1f4e23b7504..13b19453562 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,32 @@ +2011-02-16 Tom Tromey + + * callint.c (Fcall_interactively): Update. + * doc.c (Fsubstitute_command_keys): Update. + * cmds.c (Fself_insert_command): Update. + * keymap.c (Fcurrent_active_maps, Fkey_binding) + (Fdescribe_buffer_bindings): Update. + * macros.c (Fstart_kbd_macro, end_kbd_macro, Fend_kbd_macro) + (store_kbd_macro_char, Fcall_last_kbd_macro, Fexecute_kbd_macro): + Update. + * keyboard.c (echo_char, echo_dash, echo_now, cancel_echoing) + (echo_length, echo_truncate, cmd_error, command_loop_1) + (read_char, kbd_buffer_store_event_hold, make_lispy_event) + (menu_bar_items, tool_bar_items, read_char_minibuf_menu_prompt) + (read_key_sequence, Fcommand_execute, Fexecute_extended_command) + (Fdiscard_input, init_kboard, init_keyboard, mark_kboards): + Update. + * xfns.c (Fx_create_frame): Update. + * xterm.c (x_connection_closed, x_term_init): Update. + * term.c (term_get_fkeys_1, CONDITIONAL_REASSIGN, init_tty): + Update. + * window.c (window_scroll_pixel_based, window_scroll_line_based): + Update. + * frame.c (make_frame_without_minibuffer, Fhandle_switch_frame) + (delete_frame): Update. + * lisp.h (DEFVAR_KBOARD): Update for change to field names. + * keyboard.h (struct kboard): Rename all Lisp_Object fields. + (KBOARD_INTERNAL_FIELD, KVAR): New macros. + 2011-02-16 Tom Tromey * lisp.h (DEFVAR_BUFFER_DEFAULTS): Use BVAR. diff --git a/src/callint.c b/src/callint.c index b998c70187d..21dd3cd4d9d 100644 --- a/src/callint.c +++ b/src/callint.c @@ -280,7 +280,7 @@ invoke it. If KEYS is omitted or nil, the return value of save_this_command = Vthis_command; save_this_original_command = Vthis_original_command; save_real_this_command = real_this_command; - save_last_command = current_kboard->Vlast_command; + save_last_command = KVAR (current_kboard, Vlast_command); if (NILP (keys)) keys = this_command_keys, key_count = this_command_key_count; @@ -363,7 +363,7 @@ invoke it. If KEYS is omitted or nil, the return value of Vthis_command = save_this_command; Vthis_original_command = save_this_original_command; real_this_command= save_real_this_command; - current_kboard->Vlast_command = save_last_command; + KVAR (current_kboard, Vlast_command) = save_last_command; temporarily_switch_to_single_kboard (NULL); return unbind_to (speccount, apply1 (function, specs)); @@ -832,7 +832,7 @@ invoke it. If KEYS is omitted or nil, the return value of Vthis_command = save_this_command; Vthis_original_command = save_this_original_command; real_this_command= save_real_this_command; - current_kboard->Vlast_command = save_last_command; + KVAR (current_kboard, Vlast_command) = save_last_command; { Lisp_Object val; diff --git a/src/cmds.c b/src/cmds.c index 253b8d6a5ec..336bf1154f9 100644 --- a/src/cmds.c +++ b/src/cmds.c @@ -277,7 +277,7 @@ After insertion, the value of `auto-fill-function' is called if the int remove_boundary = 1; CHECK_NATNUM (n); - if (!EQ (Vthis_command, current_kboard->Vlast_command)) + if (!EQ (Vthis_command, KVAR (current_kboard, Vlast_command))) nonundocount = 0; if (NILP (Vexecuting_kbd_macro) diff --git a/src/doc.c b/src/doc.c index 31f1e5a9175..e572d43dbf4 100644 --- a/src/doc.c +++ b/src/doc.c @@ -719,7 +719,7 @@ a new string, without any text properties, is returned. */) or a specified local map (which means search just that and the global map). If non-nil, it might come from Voverriding_local_map, or from a \\ construct in STRING itself.. */ - keymap = current_kboard->Voverriding_terminal_local_map; + keymap = KVAR (current_kboard, Voverriding_terminal_local_map); if (NILP (keymap)) keymap = Voverriding_local_map; diff --git a/src/frame.c b/src/frame.c index edbd45a2a34..56e0e7ec919 100644 --- a/src/frame.c +++ b/src/frame.c @@ -428,20 +428,20 @@ make_frame_without_minibuffer (register Lisp_Object mini_window, KBOARD *kb, Lis if (NILP (mini_window)) { /* Use default-minibuffer-frame if possible. */ - if (!FRAMEP (kb->Vdefault_minibuffer_frame) - || ! FRAME_LIVE_P (XFRAME (kb->Vdefault_minibuffer_frame))) + if (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame)) + || ! FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame)))) { Lisp_Object frame_dummy; XSETFRAME (frame_dummy, f); GCPRO1 (frame_dummy); /* If there's no minibuffer frame to use, create one. */ - kb->Vdefault_minibuffer_frame = + KVAR (kb, Vdefault_minibuffer_frame) = call1 (intern ("make-initial-minibuffer-frame"), display); UNGCPRO; } - mini_window = XFRAME (kb->Vdefault_minibuffer_frame)->minibuffer_window; + mini_window = XFRAME (KVAR (kb, Vdefault_minibuffer_frame))->minibuffer_window; } f->minibuffer_window = mini_window; @@ -889,7 +889,7 @@ to that frame. */) (Lisp_Object event) { /* Preserve prefix arg that the command loop just cleared. */ - current_kboard->Vprefix_arg = Vcurrent_prefix_arg; + KVAR (current_kboard, Vprefix_arg) = Vcurrent_prefix_arg; call1 (Vrun_hooks, Qmouse_leave_buffer_hook); return do_switch_frame (event, 0, 0, Qnil); } @@ -1526,7 +1526,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force) /* If we've deleted this keyboard's default_minibuffer_frame, try to find another one. Prefer minibuffer-only frames, but also notice frames with other windows. */ - if (kb != NULL && EQ (frame, kb->Vdefault_minibuffer_frame)) + if (kb != NULL && EQ (frame, KVAR (kb, Vdefault_minibuffer_frame))) { Lisp_Object frames; @@ -1575,11 +1575,11 @@ delete_frame (Lisp_Object frame, Lisp_Object force) if (NILP (frame_with_minibuf)) abort (); - kb->Vdefault_minibuffer_frame = frame_with_minibuf; + KVAR (kb, Vdefault_minibuffer_frame) = frame_with_minibuf; } else /* No frames left on this kboard--say no minibuffer either. */ - kb->Vdefault_minibuffer_frame = Qnil; + KVAR (kb, Vdefault_minibuffer_frame) = Qnil; } /* Cause frame titles to update--necessary if we now have just one frame. */ diff --git a/src/keyboard.c b/src/keyboard.c index a1d851408e3..e9c6d508fa2 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -461,7 +461,7 @@ echo_char (Lisp_Object c) char *ptr = buffer; Lisp_Object echo_string; - echo_string = current_kboard->echo_string; + echo_string = KVAR (current_kboard, echo_string); /* If someone has passed us a composite event, use its head symbol. */ c = EVENT_HEAD (c); @@ -528,7 +528,7 @@ echo_char (Lisp_Object c) else if (STRINGP (echo_string)) echo_string = concat2 (echo_string, build_string (" ")); - current_kboard->echo_string + KVAR (current_kboard, echo_string) = concat2 (echo_string, make_string (buffer, ptr - buffer)); echo_now (); @@ -542,31 +542,31 @@ void echo_dash (void) { /* Do nothing if not echoing at all. */ - if (NILP (current_kboard->echo_string)) + if (NILP (KVAR (current_kboard, echo_string))) return; if (this_command_key_count == 0) return; if (!current_kboard->immediate_echo - && SCHARS (current_kboard->echo_string) == 0) + && SCHARS (KVAR (current_kboard, echo_string)) == 0) return; /* Do nothing if we just printed a prompt. */ if (current_kboard->echo_after_prompt - == SCHARS (current_kboard->echo_string)) + == SCHARS (KVAR (current_kboard, echo_string))) return; /* Do nothing if we have already put a dash at the end. */ - if (SCHARS (current_kboard->echo_string) > 1) + if (SCHARS (KVAR (current_kboard, echo_string)) > 1) { Lisp_Object last_char, prev_char, idx; - idx = make_number (SCHARS (current_kboard->echo_string) - 2); - prev_char = Faref (current_kboard->echo_string, idx); + idx = make_number (SCHARS (KVAR (current_kboard, echo_string)) - 2); + prev_char = Faref (KVAR (current_kboard, echo_string), idx); - idx = make_number (SCHARS (current_kboard->echo_string) - 1); - last_char = Faref (current_kboard->echo_string, idx); + idx = make_number (SCHARS (KVAR (current_kboard, echo_string)) - 1); + last_char = Faref (KVAR (current_kboard, echo_string), idx); if (XINT (last_char) == '-' && XINT (prev_char) != ' ') return; @@ -574,7 +574,7 @@ echo_dash (void) /* Put a dash at the end of the buffer temporarily, but make it go away when the next character is added. */ - current_kboard->echo_string = concat2 (current_kboard->echo_string, + KVAR (current_kboard, echo_string) = concat2 (KVAR (current_kboard, echo_string), build_string ("-")); echo_now (); } @@ -617,9 +617,9 @@ echo_now (void) } echoing = 1; - message3_nolog (current_kboard->echo_string, - SBYTES (current_kboard->echo_string), - STRING_MULTIBYTE (current_kboard->echo_string)); + message3_nolog (KVAR (current_kboard, echo_string), + SBYTES (KVAR (current_kboard, echo_string)), + STRING_MULTIBYTE (KVAR (current_kboard, echo_string))); echoing = 0; /* Record in what buffer we echoed, and from which kboard. */ @@ -637,7 +637,7 @@ cancel_echoing (void) { current_kboard->immediate_echo = 0; current_kboard->echo_after_prompt = -1; - current_kboard->echo_string = Qnil; + KVAR (current_kboard, echo_string) = Qnil; ok_to_echo_at_next_pause = NULL; echo_kboard = NULL; echo_message_buffer = Qnil; @@ -648,8 +648,8 @@ cancel_echoing (void) static int echo_length (void) { - return (STRINGP (current_kboard->echo_string) - ? SCHARS (current_kboard->echo_string) + return (STRINGP (KVAR (current_kboard, echo_string)) + ? SCHARS (KVAR (current_kboard, echo_string)) : 0); } @@ -660,9 +660,9 @@ echo_length (void) static void echo_truncate (EMACS_INT nchars) { - if (STRINGP (current_kboard->echo_string)) - current_kboard->echo_string - = Fsubstring (current_kboard->echo_string, + if (STRINGP (KVAR (current_kboard, echo_string))) + KVAR (current_kboard, echo_string) + = Fsubstring (KVAR (current_kboard, echo_string), make_number (0), make_number (nchars)); truncate_echo_area (nchars); } @@ -993,8 +993,8 @@ cmd_error (Lisp_Object data) Vstandard_input = Qt; Vexecuting_kbd_macro = Qnil; executing_kbd_macro = Qnil; - current_kboard->Vprefix_arg = Qnil; - current_kboard->Vlast_prefix_arg = Qnil; + KVAR (current_kboard, Vprefix_arg) = Qnil; + KVAR (current_kboard, Vlast_prefix_arg) = Qnil; cancel_echoing (); /* Avoid unquittable loop if data contains a circular list. */ @@ -1302,8 +1302,8 @@ command_loop_1 (void) #endif int already_adjusted = 0; - current_kboard->Vprefix_arg = Qnil; - current_kboard->Vlast_prefix_arg = Qnil; + KVAR (current_kboard, Vprefix_arg) = Qnil; + KVAR (current_kboard, Vlast_prefix_arg) = Qnil; Vdeactivate_mark = Qnil; waiting_for_input = 0; cancel_echoing (); @@ -1331,10 +1331,10 @@ command_loop_1 (void) } /* Do this after running Vpost_command_hook, for consistency. */ - current_kboard->Vlast_command = Vthis_command; - current_kboard->Vreal_last_command = real_this_command; + KVAR (current_kboard, Vlast_command) = Vthis_command; + KVAR (current_kboard, Vreal_last_command) = real_this_command; if (!CONSP (last_command_event)) - current_kboard->Vlast_repeatable_command = real_this_command; + KVAR (current_kboard, Vlast_repeatable_command) = real_this_command; while (1) { @@ -1504,9 +1504,9 @@ command_loop_1 (void) keys = Fkey_description (keys, Qnil); bitch_at_user (); message_with_string ("%s is undefined", keys, 0); - current_kboard->defining_kbd_macro = Qnil; + KVAR (current_kboard, defining_kbd_macro) = Qnil; update_mode_lines = 1; - current_kboard->Vprefix_arg = Qnil; + KVAR (current_kboard, Vprefix_arg) = Qnil; } else { @@ -1523,7 +1523,7 @@ command_loop_1 (void) } #endif - if (NILP (current_kboard->Vprefix_arg)) /* FIXME: Why? --Stef */ + if (NILP (KVAR (current_kboard, Vprefix_arg))) /* FIXME: Why? --Stef */ Fundo_boundary (); Fcommand_execute (Vthis_command, Qnil, Qnil, Qnil); @@ -1537,7 +1537,7 @@ command_loop_1 (void) unbind_to (scount, Qnil); #endif } - current_kboard->Vlast_prefix_arg = Vcurrent_prefix_arg; + KVAR (current_kboard, Vlast_prefix_arg) = Vcurrent_prefix_arg; /* Note that the value cell will never directly contain nil if the symbol is a local variable. */ @@ -1565,12 +1565,12 @@ command_loop_1 (void) If the command didn't actually create a prefix arg, but is merely a frame event that is transparent to prefix args, then the above doesn't apply. */ - if (NILP (current_kboard->Vprefix_arg) || CONSP (last_command_event)) + if (NILP (KVAR (current_kboard, Vprefix_arg)) || CONSP (last_command_event)) { - current_kboard->Vlast_command = Vthis_command; - current_kboard->Vreal_last_command = real_this_command; + KVAR (current_kboard, Vlast_command) = Vthis_command; + KVAR (current_kboard, Vreal_last_command) = real_this_command; if (!CONSP (last_command_event)) - current_kboard->Vlast_repeatable_command = real_this_command; + KVAR (current_kboard, Vlast_repeatable_command) = real_this_command; cancel_echoing (); this_command_key_count = 0; this_command_key_count_reset = 0; @@ -1649,8 +1649,8 @@ command_loop_1 (void) /* Install chars successfully executed in kbd macro. */ - if (!NILP (current_kboard->defining_kbd_macro) - && NILP (current_kboard->Vprefix_arg)) + if (!NILP (KVAR (current_kboard, defining_kbd_macro)) + && NILP (KVAR (current_kboard, Vprefix_arg))) finalize_kbd_macro_chars (); #if 0 /* This shouldn't be necessary anymore. --lorentey */ if (!was_locked) @@ -2461,7 +2461,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event KBOARD *kb = FRAME_KBOARD (XFRAME (selected_frame)); if (kb != current_kboard) { - Lisp_Object link = kb->kbd_queue; + Lisp_Object link = KVAR (kb, kbd_queue); /* We shouldn't get here if we were in single-kboard mode! */ if (single_kboard) abort (); @@ -2473,7 +2473,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event abort (); } if (!CONSP (link)) - kb->kbd_queue = Fcons (c, Qnil); + KVAR (kb, kbd_queue) = Fcons (c, Qnil); else XSETCDR (link, Fcons (c, Qnil)); kb->kbd_queue_has_data = 1; @@ -2645,12 +2645,12 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event { if (current_kboard->kbd_queue_has_data) { - if (!CONSP (current_kboard->kbd_queue)) + if (!CONSP (KVAR (current_kboard, kbd_queue))) abort (); - c = XCAR (current_kboard->kbd_queue); - current_kboard->kbd_queue - = XCDR (current_kboard->kbd_queue); - if (NILP (current_kboard->kbd_queue)) + c = XCAR (KVAR (current_kboard, kbd_queue)); + KVAR (current_kboard, kbd_queue) + = XCDR (KVAR (current_kboard, kbd_queue)); + if (NILP (KVAR (current_kboard, kbd_queue))) current_kboard->kbd_queue_has_data = 0; input_pending = readable_events (0); if (EVENT_HAS_PARAMETERS (c) @@ -2712,7 +2712,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event if (! NILP (c) && (kb != current_kboard)) { - Lisp_Object link = kb->kbd_queue; + Lisp_Object link = KVAR (kb, kbd_queue); if (CONSP (link)) { while (CONSP (XCDR (link))) @@ -2721,7 +2721,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event abort (); } if (!CONSP (link)) - kb->kbd_queue = Fcons (c, Qnil); + KVAR (kb, kbd_queue) = Fcons (c, Qnil); else XSETCDR (link, Fcons (c, Qnil)); kb->kbd_queue_has_data = 1; @@ -2829,15 +2829,15 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event if (XINT (c) == -1) goto exit; - if ((STRINGP (current_kboard->Vkeyboard_translate_table) - && SCHARS (current_kboard->Vkeyboard_translate_table) > (unsigned) XFASTINT (c)) - || (VECTORP (current_kboard->Vkeyboard_translate_table) - && XVECTOR (current_kboard->Vkeyboard_translate_table)->size > (unsigned) XFASTINT (c)) - || (CHAR_TABLE_P (current_kboard->Vkeyboard_translate_table) + if ((STRINGP (KVAR (current_kboard, Vkeyboard_translate_table)) + && SCHARS (KVAR (current_kboard, Vkeyboard_translate_table)) > (unsigned) XFASTINT (c)) + || (VECTORP (KVAR (current_kboard, Vkeyboard_translate_table)) + && XVECTOR (KVAR (current_kboard, Vkeyboard_translate_table))->size > (unsigned) XFASTINT (c)) + || (CHAR_TABLE_P (KVAR (current_kboard, Vkeyboard_translate_table)) && CHARACTERP (c))) { Lisp_Object d; - d = Faref (current_kboard->Vkeyboard_translate_table, c); + d = Faref (KVAR (current_kboard, Vkeyboard_translate_table), c); /* nil in keyboard-translate-table means no translation. */ if (!NILP (d)) c = d; @@ -2918,7 +2918,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event /* Save the echo status. */ int saved_immediate_echo = current_kboard->immediate_echo; struct kboard *saved_ok_to_echo = ok_to_echo_at_next_pause; - Lisp_Object saved_echo_string = current_kboard->echo_string; + Lisp_Object saved_echo_string = KVAR (current_kboard, echo_string); int saved_echo_after_prompt = current_kboard->echo_after_prompt; #if 0 @@ -2973,7 +2973,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event cancel_echoing (); ok_to_echo_at_next_pause = saved_ok_to_echo; - current_kboard->echo_string = saved_echo_string; + KVAR (current_kboard, echo_string) = saved_echo_string; current_kboard->echo_after_prompt = saved_echo_after_prompt; if (saved_immediate_echo) echo_now (); @@ -3459,7 +3459,7 @@ kbd_buffer_store_event_hold (register struct input_event *event, if (single_kboard && kb != current_kboard) { - kb->kbd_queue + KVAR (kb, kbd_queue) = Fcons (make_lispy_switch_frame (event->frame_or_window), Fcons (make_number (c), Qnil)); kb->kbd_queue_has_data = 1; @@ -5322,13 +5322,13 @@ make_lispy_event (struct input_event *event) { /* We need to use an alist rather than a vector as the cache since we can't make a vector long enuf. */ - if (NILP (current_kboard->system_key_syms)) - current_kboard->system_key_syms = Fcons (Qnil, Qnil); + if (NILP (KVAR (current_kboard, system_key_syms))) + KVAR (current_kboard, system_key_syms) = Fcons (Qnil, Qnil); return modify_event_symbol (event->code, event->modifiers, Qfunction_key, - current_kboard->Vsystem_key_alist, - 0, ¤t_kboard->system_key_syms, + KVAR (current_kboard, Vsystem_key_alist), + 0, &KVAR (current_kboard, system_key_syms), (unsigned) -1); } @@ -7360,8 +7360,8 @@ menu_bar_items (Lisp_Object old) /* Yes, use them (if non-nil) as well as the global map. */ maps = (Lisp_Object *) alloca (3 * sizeof (maps[0])); nmaps = 0; - if (!NILP (current_kboard->Voverriding_terminal_local_map)) - maps[nmaps++] = current_kboard->Voverriding_terminal_local_map; + if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map))) + maps[nmaps++] = KVAR (current_kboard, Voverriding_terminal_local_map); if (!NILP (Voverriding_local_map)) maps[nmaps++] = Voverriding_local_map; } @@ -7897,8 +7897,8 @@ tool_bar_items (Lisp_Object reuse, int *nitems) /* Yes, use them (if non-nil) as well as the global map. */ maps = (Lisp_Object *) alloca (3 * sizeof (maps[0])); nmaps = 0; - if (!NILP (current_kboard->Voverriding_terminal_local_map)) - maps[nmaps++] = current_kboard->Voverriding_terminal_local_map; + if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map))) + maps[nmaps++] = KVAR (current_kboard, Voverriding_terminal_local_map); if (!NILP (Voverriding_local_map)) maps[nmaps++] = Voverriding_local_map; } @@ -8614,12 +8614,12 @@ read_char_minibuf_menu_prompt (int commandflag, int nmaps, Lisp_Object *maps) is pressed. Help characters are not recorded because menu prompting is not used on replay. */ - orig_defn_macro = current_kboard->defining_kbd_macro; - current_kboard->defining_kbd_macro = Qnil; + orig_defn_macro = KVAR (current_kboard, defining_kbd_macro); + KVAR (current_kboard, defining_kbd_macro) = Qnil; do obj = read_char (commandflag, 0, 0, Qt, 0, NULL); while (BUFFERP (obj)); - current_kboard->defining_kbd_macro = orig_defn_macro; + KVAR (current_kboard, defining_kbd_macro) = orig_defn_macro; if (!INTEGERP (obj)) return obj; @@ -8632,7 +8632,7 @@ read_char_minibuf_menu_prompt (int commandflag, int nmaps, Lisp_Object *maps) && (!INTEGERP (menu_prompt_more_char) || ! EQ (obj, make_number (Ctl (XINT (menu_prompt_more_char)))))) { - if (!NILP (current_kboard->defining_kbd_macro)) + if (!NILP (KVAR (current_kboard, defining_kbd_macro))) store_kbd_macro_char (obj); return obj; } @@ -8974,7 +8974,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, /* Install the string STR as the beginning of the string of echoing, so that it serves as a prompt for the next character. */ - current_kboard->echo_string = prompt; + KVAR (current_kboard, echo_string) = prompt; current_kboard->echo_after_prompt = SCHARS (prompt); echo_now (); } @@ -9012,8 +9012,8 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, happens if we switch keyboards between rescans. */ replay_entire_sequence: - indec.map = indec.parent = current_kboard->Vinput_decode_map; - fkey.map = fkey.parent = current_kboard->Vlocal_function_key_map; + indec.map = indec.parent = KVAR (current_kboard, Vinput_decode_map); + fkey.map = fkey.parent = KVAR (current_kboard, Vlocal_function_key_map); keytran.map = keytran.parent = Vkey_translation_map; indec.start = indec.end = 0; fkey.start = fkey.end = 0; @@ -9034,7 +9034,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, the initial keymaps from the current buffer. */ nmaps = 0; - if (!NILP (current_kboard->Voverriding_terminal_local_map)) + if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map))) { if (2 > nmaps_allocated) { @@ -9042,7 +9042,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, defs = (Lisp_Object *) alloca (2 * sizeof (defs[0])); nmaps_allocated = 2; } - submaps[nmaps++] = current_kboard->Voverriding_terminal_local_map; + submaps[nmaps++] = KVAR (current_kboard, Voverriding_terminal_local_map); } else if (!NILP (Voverriding_local_map)) { @@ -9218,29 +9218,29 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, if (!NILP (delayed_switch_frame)) { - interrupted_kboard->kbd_queue + KVAR (interrupted_kboard, kbd_queue) = Fcons (delayed_switch_frame, - interrupted_kboard->kbd_queue); + KVAR (interrupted_kboard, kbd_queue)); delayed_switch_frame = Qnil; } while (t > 0) - interrupted_kboard->kbd_queue - = Fcons (keybuf[--t], interrupted_kboard->kbd_queue); + KVAR (interrupted_kboard, kbd_queue) + = Fcons (keybuf[--t], KVAR (interrupted_kboard, kbd_queue)); /* If the side queue is non-empty, ensure it begins with a switch-frame, so we'll replay it in the right context. */ - if (CONSP (interrupted_kboard->kbd_queue) - && (key = XCAR (interrupted_kboard->kbd_queue), + if (CONSP (KVAR (interrupted_kboard, kbd_queue)) + && (key = XCAR (KVAR (interrupted_kboard, kbd_queue)), !(EVENT_HAS_PARAMETERS (key) && EQ (EVENT_HEAD_KIND (EVENT_HEAD (key)), Qswitch_frame)))) { Lisp_Object frame; XSETFRAME (frame, interrupted_frame); - interrupted_kboard->kbd_queue + KVAR (interrupted_kboard, kbd_queue) = Fcons (make_lispy_switch_frame (frame), - interrupted_kboard->kbd_queue); + KVAR (interrupted_kboard, kbd_queue)); } mock_input = 0; orig_local_map = get_local_map (PT, current_buffer, Qlocal_map); @@ -10115,9 +10115,9 @@ a special event, so ignore the prefix argument and don't clear it. */) if (NILP (special)) { - prefixarg = current_kboard->Vprefix_arg; + prefixarg = KVAR (current_kboard, Vprefix_arg); Vcurrent_prefix_arg = prefixarg; - current_kboard->Vprefix_arg = Qnil; + KVAR (current_kboard, Vprefix_arg) = Qnil; } else prefixarg = Qnil; @@ -10251,7 +10251,7 @@ give to the command you invoke, if it asks for an argument. */) UNGCPRO; function = Fintern (function, Qnil); - current_kboard->Vprefix_arg = prefixarg; + KVAR (current_kboard, Vprefix_arg) = prefixarg; Vthis_command = function; real_this_command = function; @@ -10574,7 +10574,7 @@ DEFUN ("discard-input", Fdiscard_input, Sdiscard_input, 0, 0, 0, Also end any kbd macro being defined. */) (void) { - if (!NILP (current_kboard->defining_kbd_macro)) + if (!NILP (KVAR (current_kboard, defining_kbd_macro))) { /* Discard the last command from the macro. */ Fcancel_kbd_macro_events (); @@ -11224,30 +11224,30 @@ The `posn-' functions access elements of such lists. */) void init_kboard (KBOARD *kb) { - kb->Voverriding_terminal_local_map = Qnil; - kb->Vlast_command = Qnil; - kb->Vreal_last_command = Qnil; - kb->Vkeyboard_translate_table = Qnil; - kb->Vlast_repeatable_command = Qnil; - kb->Vprefix_arg = Qnil; - kb->Vlast_prefix_arg = Qnil; - kb->kbd_queue = Qnil; + KVAR (kb, Voverriding_terminal_local_map) = Qnil; + KVAR (kb, Vlast_command) = Qnil; + KVAR (kb, Vreal_last_command) = Qnil; + KVAR (kb, Vkeyboard_translate_table) = Qnil; + KVAR (kb, Vlast_repeatable_command) = Qnil; + KVAR (kb, Vprefix_arg) = Qnil; + KVAR (kb, Vlast_prefix_arg) = Qnil; + KVAR (kb, kbd_queue) = Qnil; kb->kbd_queue_has_data = 0; kb->immediate_echo = 0; - kb->echo_string = Qnil; + KVAR (kb, echo_string) = Qnil; kb->echo_after_prompt = -1; kb->kbd_macro_buffer = 0; kb->kbd_macro_bufsize = 0; - kb->defining_kbd_macro = Qnil; - kb->Vlast_kbd_macro = Qnil; + KVAR (kb, defining_kbd_macro) = Qnil; + KVAR (kb, Vlast_kbd_macro) = Qnil; kb->reference_count = 0; - kb->Vsystem_key_alist = Qnil; - kb->system_key_syms = Qnil; - kb->Vwindow_system = Qt; /* Unset. */ - kb->Vinput_decode_map = Fmake_sparse_keymap (Qnil); - kb->Vlocal_function_key_map = Fmake_sparse_keymap (Qnil); - Fset_keymap_parent (kb->Vlocal_function_key_map, Vfunction_key_map); - kb->Vdefault_minibuffer_frame = Qnil; + KVAR (kb, Vsystem_key_alist) = Qnil; + KVAR (kb, system_key_syms) = Qnil; + KVAR (kb, Vwindow_system) = Qt; /* Unset. */ + KVAR (kb, Vinput_decode_map) = Fmake_sparse_keymap (Qnil); + KVAR (kb, Vlocal_function_key_map) = Fmake_sparse_keymap (Qnil); + Fset_keymap_parent (KVAR (kb, Vlocal_function_key_map), Vfunction_key_map); + KVAR (kb, Vdefault_minibuffer_frame) = Qnil; } /* @@ -11323,7 +11323,7 @@ init_keyboard (void) init_kboard (current_kboard); /* A value of nil for Vwindow_system normally means a tty, but we also use it for the initial terminal since there is no window system there. */ - current_kboard->Vwindow_system = Qnil; + KVAR (current_kboard, Vwindow_system) = Qnil; if (!noninteractive) { @@ -12266,23 +12266,23 @@ mark_kboards (void) if (kb->kbd_macro_buffer) for (p = kb->kbd_macro_buffer; p < kb->kbd_macro_ptr; p++) mark_object (*p); - mark_object (kb->Voverriding_terminal_local_map); - mark_object (kb->Vlast_command); - mark_object (kb->Vreal_last_command); - mark_object (kb->Vkeyboard_translate_table); - mark_object (kb->Vlast_repeatable_command); - mark_object (kb->Vprefix_arg); - mark_object (kb->Vlast_prefix_arg); - mark_object (kb->kbd_queue); - mark_object (kb->defining_kbd_macro); - mark_object (kb->Vlast_kbd_macro); - mark_object (kb->Vsystem_key_alist); - mark_object (kb->system_key_syms); - mark_object (kb->Vwindow_system); - mark_object (kb->Vinput_decode_map); - mark_object (kb->Vlocal_function_key_map); - mark_object (kb->Vdefault_minibuffer_frame); - mark_object (kb->echo_string); + mark_object (KVAR (kb, Voverriding_terminal_local_map)); + mark_object (KVAR (kb, Vlast_command)); + mark_object (KVAR (kb, Vreal_last_command)); + mark_object (KVAR (kb, Vkeyboard_translate_table)); + mark_object (KVAR (kb, Vlast_repeatable_command)); + mark_object (KVAR (kb, Vprefix_arg)); + mark_object (KVAR (kb, Vlast_prefix_arg)); + mark_object (KVAR (kb, kbd_queue)); + mark_object (KVAR (kb, defining_kbd_macro)); + mark_object (KVAR (kb, Vlast_kbd_macro)); + mark_object (KVAR (kb, Vsystem_key_alist)); + mark_object (KVAR (kb, system_key_syms)); + mark_object (KVAR (kb, Vwindow_system)); + mark_object (KVAR (kb, Vinput_decode_map)); + mark_object (KVAR (kb, Vlocal_function_key_map)); + mark_object (KVAR (kb, Vdefault_minibuffer_frame)); + mark_object (KVAR (kb, echo_string)); } { struct input_event *event; diff --git a/src/keyboard.h b/src/keyboard.h index 7b3374ac3bd..10bf16d5c5c 100644 --- a/src/keyboard.h +++ b/src/keyboard.h @@ -19,6 +19,15 @@ along with GNU Emacs. If not, see . */ #include "systime.h" /* for EMACS_TIME */ #include "coding.h" /* for ENCODE_UTF_8 and ENCODE_SYSTEM */ +/* Lisp fields in struct keyboard are hidden from most code and accessed + via the KVAR macro, below. Only select pieces of code, like the GC, + are allowed to use KBOARD_INTERNAL_FIELD. */ +#define KBOARD_INTERNAL_FIELD(field) field ## _ + +/* Most code should use this macro to access Lisp fields in struct + kboard. */ +#define KVAR(kboard, field) ((kboard)->KBOARD_INTERNAL_FIELD (field)) + /* Each KBOARD represents one logical input stream from which Emacs gets input. If we are using ordinary terminals, it has one KBOARD object for each terminal device. @@ -70,32 +79,32 @@ struct kboard can effectively wait for input in the any-kboard state, and hence avoid blocking out the other KBOARDs. See universal-argument in lisp/simple.el for an example. */ - Lisp_Object Voverriding_terminal_local_map; + Lisp_Object KBOARD_INTERNAL_FIELD (Voverriding_terminal_local_map); /* Last command executed by the editor command loop, not counting commands that set the prefix argument. */ - Lisp_Object Vlast_command; + Lisp_Object KBOARD_INTERNAL_FIELD (Vlast_command); /* Normally same as last-command, but never modified by other commands. */ - Lisp_Object Vreal_last_command; + Lisp_Object KBOARD_INTERNAL_FIELD (Vreal_last_command); /* User-supplied table to translate input characters through. */ - Lisp_Object Vkeyboard_translate_table; + Lisp_Object KBOARD_INTERNAL_FIELD (Vkeyboard_translate_table); /* Last command that may be repeated by `repeat'. */ - Lisp_Object Vlast_repeatable_command; + Lisp_Object KBOARD_INTERNAL_FIELD (Vlast_repeatable_command); /* The prefix argument for the next command, in raw form. */ - Lisp_Object Vprefix_arg; + Lisp_Object KBOARD_INTERNAL_FIELD (Vprefix_arg); /* Saved prefix argument for the last command, in raw form. */ - Lisp_Object Vlast_prefix_arg; + Lisp_Object KBOARD_INTERNAL_FIELD (Vlast_prefix_arg); /* Unread events specific to this kboard. */ - Lisp_Object kbd_queue; + Lisp_Object KBOARD_INTERNAL_FIELD (kbd_queue); /* Non-nil while a kbd macro is being defined. */ - Lisp_Object defining_kbd_macro; + Lisp_Object KBOARD_INTERNAL_FIELD (defining_kbd_macro); /* The start of storage for the current keyboard macro. */ Lisp_Object *kbd_macro_buffer; @@ -117,28 +126,28 @@ struct kboard int kbd_macro_bufsize; /* Last anonymous kbd macro defined. */ - Lisp_Object Vlast_kbd_macro; + Lisp_Object KBOARD_INTERNAL_FIELD (Vlast_kbd_macro); /* Alist of system-specific X windows key symbols. */ - Lisp_Object Vsystem_key_alist; + Lisp_Object KBOARD_INTERNAL_FIELD (Vsystem_key_alist); /* Cache for modify_event_symbol. */ - Lisp_Object system_key_syms; + Lisp_Object KBOARD_INTERNAL_FIELD (system_key_syms); /* The kind of display: x, w32, ... */ - Lisp_Object Vwindow_system; + Lisp_Object KBOARD_INTERNAL_FIELD (Vwindow_system); /* Keymap mapping keys to alternative preferred forms. See the DEFVAR for more documentation. */ - Lisp_Object Vlocal_function_key_map; + Lisp_Object KBOARD_INTERNAL_FIELD (Vlocal_function_key_map); /* Keymap mapping ASCII function key sequences onto their preferred forms. Initialized by the terminal-specific lisp files. See the DEFVAR for more documentation. */ - Lisp_Object Vinput_decode_map; + Lisp_Object KBOARD_INTERNAL_FIELD (Vinput_decode_map); /* Minibufferless frames on this display use this frame's minibuffer. */ - Lisp_Object Vdefault_minibuffer_frame; + Lisp_Object KBOARD_INTERNAL_FIELD (Vdefault_minibuffer_frame); /* Number of displays using this KBOARD. Normally 1, but can be larger when you have multiple screens on a single X display. */ @@ -146,7 +155,7 @@ struct kboard /* The text we're echoing in the modeline - partial key sequences, usually. This is nil when not echoing. */ - Lisp_Object echo_string; + Lisp_Object KBOARD_INTERNAL_FIELD (echo_string); /* This flag indicates that events were put into kbd_queue while Emacs was running for some other KBOARD. diff --git a/src/keymap.c b/src/keymap.c index d9de2bc804b..0e4715e4b8b 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -1565,8 +1565,8 @@ like in the respective argument of `key-binding'. */) if (!NILP (olp)) { - if (!NILP (current_kboard->Voverriding_terminal_local_map)) - keymaps = Fcons (current_kboard->Voverriding_terminal_local_map, keymaps); + if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map))) + keymaps = Fcons (KVAR (current_kboard, Voverriding_terminal_local_map), keymaps); /* The doc said that overriding-terminal-local-map should override overriding-local-map. The code used them both, but it seems clearer to use just one. rms, jan 2005. */ @@ -1745,9 +1745,9 @@ specified buffer position instead of point are used. } } - if (! NILP (current_kboard->Voverriding_terminal_local_map)) + if (! NILP (KVAR (current_kboard, Voverriding_terminal_local_map))) { - value = Flookup_key (current_kboard->Voverriding_terminal_local_map, + value = Flookup_key (KVAR (current_kboard, Voverriding_terminal_local_map), key, accept_default); if (! NILP (value) && !INTEGERP (value)) goto done; @@ -2941,11 +2941,11 @@ You type Translation\n\ outbuf = Fcurrent_buffer (); /* Report on alternates for keys. */ - if (STRINGP (current_kboard->Vkeyboard_translate_table) && !NILP (prefix)) + if (STRINGP (KVAR (current_kboard, Vkeyboard_translate_table)) && !NILP (prefix)) { int c; - const unsigned char *translate = SDATA (current_kboard->Vkeyboard_translate_table); - int translate_len = SCHARS (current_kboard->Vkeyboard_translate_table); + const unsigned char *translate = SDATA (KVAR (current_kboard, Vkeyboard_translate_table)); + int translate_len = SCHARS (KVAR (current_kboard, Vkeyboard_translate_table)); for (c = 0; c < translate_len; c++) if (translate[c] != c) @@ -2968,7 +2968,7 @@ You type Translation\n\ insert ("\n", 1); /* Insert calls signal_after_change which may GC. */ - translate = SDATA (current_kboard->Vkeyboard_translate_table); + translate = SDATA (KVAR (current_kboard, Vkeyboard_translate_table)); } insert ("\n", 1); @@ -2981,8 +2981,8 @@ You type Translation\n\ /* Print the (major mode) local map. */ start1 = Qnil; - if (!NILP (current_kboard->Voverriding_terminal_local_map)) - start1 = current_kboard->Voverriding_terminal_local_map; + if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map))) + start1 = KVAR (current_kboard, Voverriding_terminal_local_map); else if (!NILP (Voverriding_local_map)) start1 = Voverriding_local_map; @@ -3064,13 +3064,13 @@ You type Translation\n\ "\f\nGlobal Bindings", nomenu, 0, 1, 0); /* Print the function-key-map translations under this prefix. */ - if (!NILP (current_kboard->Vlocal_function_key_map)) - describe_map_tree (current_kboard->Vlocal_function_key_map, 0, Qnil, prefix, + if (!NILP (KVAR (current_kboard, Vlocal_function_key_map))) + describe_map_tree (KVAR (current_kboard, Vlocal_function_key_map), 0, Qnil, prefix, "\f\nFunction key map translations", nomenu, 1, 0, 0); /* Print the input-decode-map translations under this prefix. */ - if (!NILP (current_kboard->Vinput_decode_map)) - describe_map_tree (current_kboard->Vinput_decode_map, 0, Qnil, prefix, + if (!NILP (KVAR (current_kboard, Vinput_decode_map))) + describe_map_tree (KVAR (current_kboard, Vinput_decode_map), 0, Qnil, prefix, "\f\nInput decoding map translations", nomenu, 1, 0, 0); UNGCPRO; diff --git a/src/lisp.h b/src/lisp.h index b82f1b2f722..7cc2a8e7d45 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -1890,7 +1890,7 @@ extern void defvar_kboard (struct Lisp_Kboard_Objfwd *, const char *, int); static struct Lisp_Kboard_Objfwd ko_fwd; \ defvar_kboard (&ko_fwd, \ lname, \ - (int)((char *)(¤t_kboard->vname) \ + (int)((char *)(¤t_kboard->vname ## _) \ - (char *)current_kboard)); \ } while (0) diff --git a/src/macros.c b/src/macros.c index 34ac08c3284..d90b31b503f 100644 --- a/src/macros.c +++ b/src/macros.c @@ -56,7 +56,7 @@ If optional second arg, NO-EXEC, is non-nil, do not re-execute last macro before appending to it. */) (Lisp_Object append, Lisp_Object no_exec) { - if (!NILP (current_kboard->defining_kbd_macro)) + if (!NILP (KVAR (current_kboard, defining_kbd_macro))) error ("Already defining kbd macro"); if (!current_kboard->kbd_macro_buffer) @@ -85,9 +85,9 @@ macro before appending to it. */) int cvt; /* Check the type of last-kbd-macro in case Lisp code changed it. */ - CHECK_VECTOR_OR_STRING (current_kboard->Vlast_kbd_macro); + CHECK_VECTOR_OR_STRING (KVAR (current_kboard, Vlast_kbd_macro)); - len = XINT (Flength (current_kboard->Vlast_kbd_macro)); + len = XINT (Flength (KVAR (current_kboard, Vlast_kbd_macro))); /* Copy last-kbd-macro into the buffer, in case the Lisp code has put another macro there. */ @@ -100,11 +100,11 @@ macro before appending to it. */) } /* Must convert meta modifier when copying string to vector. */ - cvt = STRINGP (current_kboard->Vlast_kbd_macro); + cvt = STRINGP (KVAR (current_kboard, Vlast_kbd_macro)); for (i = 0; i < len; i++) { Lisp_Object c; - c = Faref (current_kboard->Vlast_kbd_macro, make_number (i)); + c = Faref (KVAR (current_kboard, Vlast_kbd_macro), make_number (i)); if (cvt && NATNUMP (c) && (XFASTINT (c) & 0x80)) XSETFASTINT (c, CHAR_META | (XFASTINT (c) & ~0x80)); current_kboard->kbd_macro_buffer[i] = c; @@ -116,12 +116,12 @@ macro before appending to it. */) /* Re-execute the macro we are appending to, for consistency of behavior. */ if (NILP (no_exec)) - Fexecute_kbd_macro (current_kboard->Vlast_kbd_macro, + Fexecute_kbd_macro (KVAR (current_kboard, Vlast_kbd_macro), make_number (1), Qnil); message ("Appending to kbd macro..."); } - current_kboard->defining_kbd_macro = Qt; + KVAR (current_kboard, defining_kbd_macro) = Qt; return Qnil; } @@ -131,9 +131,9 @@ macro before appending to it. */) void end_kbd_macro (void) { - current_kboard->defining_kbd_macro = Qnil; + KVAR (current_kboard, defining_kbd_macro) = Qnil; update_mode_lines++; - current_kboard->Vlast_kbd_macro + KVAR (current_kboard, Vlast_kbd_macro) = make_event_array ((current_kboard->kbd_macro_end - current_kboard->kbd_macro_buffer), current_kboard->kbd_macro_buffer); @@ -154,7 +154,7 @@ In Lisp, optional second arg LOOPFUNC may be a function that is called prior to each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */) (Lisp_Object repeat, Lisp_Object loopfunc) { - if (NILP (current_kboard->defining_kbd_macro)) + if (NILP (KVAR (current_kboard, defining_kbd_macro))) error ("Not defining kbd macro"); if (NILP (repeat)) @@ -162,19 +162,19 @@ each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */) else CHECK_NUMBER (repeat); - if (!NILP (current_kboard->defining_kbd_macro)) + if (!NILP (KVAR (current_kboard, defining_kbd_macro))) { end_kbd_macro (); message ("Keyboard macro defined"); } if (XFASTINT (repeat) == 0) - Fexecute_kbd_macro (current_kboard->Vlast_kbd_macro, repeat, loopfunc); + Fexecute_kbd_macro (KVAR (current_kboard, Vlast_kbd_macro), repeat, loopfunc); else { XSETINT (repeat, XINT (repeat)-1); if (XINT (repeat) > 0) - Fexecute_kbd_macro (current_kboard->Vlast_kbd_macro, repeat, loopfunc); + Fexecute_kbd_macro (KVAR (current_kboard, Vlast_kbd_macro), repeat, loopfunc); } return Qnil; } @@ -186,7 +186,7 @@ store_kbd_macro_char (Lisp_Object c) { struct kboard *kb = current_kboard; - if (!NILP (kb->defining_kbd_macro)) + if (!NILP (KVAR (kb, defining_kbd_macro))) { if (kb->kbd_macro_ptr - kb->kbd_macro_buffer == kb->kbd_macro_bufsize) { @@ -248,21 +248,21 @@ each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */) { /* Don't interfere with recognition of the previous command from before this macro started. */ - Vthis_command = current_kboard->Vlast_command; + Vthis_command = KVAR (current_kboard, Vlast_command); /* C-x z after the macro should repeat the macro. */ - real_this_command = current_kboard->Vlast_kbd_macro; + real_this_command = KVAR (current_kboard, Vlast_kbd_macro); - if (! NILP (current_kboard->defining_kbd_macro)) + if (! NILP (KVAR (current_kboard, defining_kbd_macro))) error ("Can't execute anonymous macro while defining one"); - else if (NILP (current_kboard->Vlast_kbd_macro)) + else if (NILP (KVAR (current_kboard, Vlast_kbd_macro))) error ("No kbd macro has been defined"); else - Fexecute_kbd_macro (current_kboard->Vlast_kbd_macro, prefix, loopfunc); + Fexecute_kbd_macro (KVAR (current_kboard, Vlast_kbd_macro), prefix, loopfunc); /* command_loop_1 sets this to nil before it returns; get back the last command within the macro so that it can be last, again, after we return. */ - Vthis_command = current_kboard->Vlast_command; + Vthis_command = KVAR (current_kboard, Vlast_command); return Qnil; } @@ -322,7 +322,7 @@ each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */) executing_kbd_macro = final; executing_kbd_macro_index = 0; - current_kboard->Vprefix_arg = Qnil; + KVAR (current_kboard, Vprefix_arg) = Qnil; if (!NILP (loopfunc)) { diff --git a/src/term.c b/src/term.c index 1aefe02421f..21ed163c934 100644 --- a/src/term.c +++ b/src/term.c @@ -1350,14 +1350,14 @@ term_get_fkeys_1 (void) KBOARD *kboard = term_get_fkeys_kboard; /* This can happen if CANNOT_DUMP or with strange options. */ - if (!KEYMAPP (kboard->Vinput_decode_map)) - kboard->Vinput_decode_map = Fmake_sparse_keymap (Qnil); + if (!KEYMAPP (KVAR (kboard, Vinput_decode_map))) + KVAR (kboard, Vinput_decode_map) = Fmake_sparse_keymap (Qnil); for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++) { char *sequence = tgetstr (keys[i].cap, address); if (sequence) - Fdefine_key (kboard->Vinput_decode_map, build_string (sequence), + Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (sequence), Fmake_vector (make_number (1), intern (keys[i].name))); } @@ -1377,13 +1377,13 @@ term_get_fkeys_1 (void) if (k0) /* Define f0 first, so that f10 takes precedence in case the key sequences happens to be the same. */ - Fdefine_key (kboard->Vinput_decode_map, build_string (k0), + Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (k0), Fmake_vector (make_number (1), intern ("f0"))); - Fdefine_key (kboard->Vinput_decode_map, build_string (k_semi), + Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (k_semi), Fmake_vector (make_number (1), intern ("f10"))); } else if (k0) - Fdefine_key (kboard->Vinput_decode_map, build_string (k0), + Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (k0), Fmake_vector (make_number (1), intern (k0_name))); } @@ -1406,7 +1406,7 @@ term_get_fkeys_1 (void) if (sequence) { sprintf (fkey, "f%d", i); - Fdefine_key (kboard->Vinput_decode_map, build_string (sequence), + Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (sequence), Fmake_vector (make_number (1), intern (fkey))); } @@ -1423,7 +1423,7 @@ term_get_fkeys_1 (void) { \ char *sequence = tgetstr (cap2, address); \ if (sequence) \ - Fdefine_key (kboard->Vinput_decode_map, build_string (sequence), \ + Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (sequence), \ Fmake_vector (make_number (1), \ intern (sym))); \ } @@ -3418,7 +3418,7 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\ terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); init_kboard (terminal->kboard); - terminal->kboard->Vwindow_system = Qnil; + KVAR (terminal->kboard, Vwindow_system) = Qnil; terminal->kboard->next_kboard = all_kboards; all_kboards = terminal->kboard; terminal->kboard->reference_count++; diff --git a/src/window.c b/src/window.c index 675a493e18e..7965269f0e7 100644 --- a/src/window.c +++ b/src/window.c @@ -4834,8 +4834,8 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) possibility of point becoming "stuck" on a tall line when scrolling by one line. */ if (window_scroll_pixel_based_preserve_y < 0 - || !SYMBOLP (current_kboard->Vlast_command) - || NILP (Fget (current_kboard->Vlast_command, Qscroll_command))) + || !SYMBOLP (KVAR (current_kboard, Vlast_command)) + || NILP (Fget (KVAR (current_kboard, Vlast_command), Qscroll_command))) { start_display (&it, w, start); move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS); @@ -5091,8 +5091,8 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror) if (!NILP (Vscroll_preserve_screen_position)) { if (window_scroll_preserve_vpos <= 0 - || !SYMBOLP (current_kboard->Vlast_command) - || NILP (Fget (current_kboard->Vlast_command, Qscroll_command))) + || !SYMBOLP (KVAR (current_kboard, Vlast_command)) + || NILP (Fget (KVAR (current_kboard, Vlast_command), Qscroll_command))) { struct position posit = *compute_motion (startpos, 0, 0, 0, diff --git a/src/xfns.c b/src/xfns.c index d8d4a8ca772..deb0e192a54 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -3473,9 +3473,9 @@ This function is an internal primitive--use `make-frame' instead. */) /* Initialize `default-minibuffer-frame' in case this is the first frame on this terminal. */ if (FRAME_HAS_MINIBUF_P (f) - && (!FRAMEP (kb->Vdefault_minibuffer_frame) - || !FRAME_LIVE_P (XFRAME (kb->Vdefault_minibuffer_frame)))) - kb->Vdefault_minibuffer_frame = frame; + && (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame)) + || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame))))) + KVAR (kb, Vdefault_minibuffer_frame) = frame; /* All remaining specified parameters, which have not been "used" by x_get_arg and friends, now go in the misc. alist of the frame. */ diff --git a/src/xterm.c b/src/xterm.c index 52d79e8dad7..909b6978f5a 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -7727,7 +7727,7 @@ x_connection_closed (Display *dpy, const char *error_message) { /* Set this to t so that delete_frame won't get confused trying to find a replacement. */ - FRAME_KBOARD (XFRAME (frame))->Vdefault_minibuffer_frame = Qt; + KVAR (FRAME_KBOARD (XFRAME (frame)), Vdefault_minibuffer_frame) = Qt; delete_frame (frame, Qnoelisp); } @@ -9966,7 +9966,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) { terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); init_kboard (terminal->kboard); - terminal->kboard->Vwindow_system = Qx; + KVAR (terminal->kboard, Vwindow_system) = Qx; /* Add the keyboard to the list before running Lisp code (via Qvendor_specific_keysyms below), since these are not traced @@ -9988,7 +9988,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) /* Temporarily hide the partially initialized terminal. */ terminal_list = terminal->next_terminal; UNBLOCK_INPUT; - terminal->kboard->Vsystem_key_alist + KVAR (terminal->kboard, Vsystem_key_alist) = call1 (Qvendor_specific_keysyms, vendor ? build_string (vendor) : empty_unibyte_string); BLOCK_INPUT; From 689743a20ba5883750ab24192ec955941f2b9752 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Wed, 16 Feb 2011 17:55:21 +0100 Subject: [PATCH 12/46] play/doctor.el: bugfix for `doctor-mode'. * play/doctor.el (doctor-mode): Bugfix: escape the "," character in a `doctor-type' argument. --- lisp/ChangeLog | 5 +++++ lisp/play/doctor.el | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5d346845e58..ce58c47ad12 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2011-02-16 Bastien Guerry + + * play/doctor.el (doctor-mode): Bugfix: escape the "," character + in a `doctor-type' argument. + 2011-02-16 Alex Harsanyi * net/soap-client.el: diff --git a/lisp/play/doctor.el b/lisp/play/doctor.el index 5b3b4aba0fe..c60472e9386 100644 --- a/lisp/play/doctor.el +++ b/lisp/play/doctor.el @@ -141,7 +141,7 @@ reads the sentence before point, and prints the Doctor's answer." (turn-on-auto-fill) (doctor-type '(i am the psychotherapist \. (doc$ doctor--please) (doc$ doctor--describe) your (doc$ doctor--problems) \. - each time you are finished talking, type \R\E\T twice \.)) + each time you are finished talking\, type \R\E\T twice \.)) (insert "\n")) (defun make-doctor-variables () From 05c652517317d10690aaf0a6aa0bc876382b9d82 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 16 Feb 2011 20:39:46 +0200 Subject: [PATCH 13/46] Use KVAR in MS-Windows build, remove buffer-file-type. w32fns.c (Fx_create_frame): Use KVAR. w32term.c (w32_create_terminal): Use KVAR. s/ms-w32.h (MODE_LINE_BINARY_TEXT): Remove. xdisp.c (decode_mode_spec): Don't use MODE_LINE_BINARY_TEXT. fileio.c (Finsert_file_contents, Fwrite_region): Remove references to buffer_file_type. (syms_of_fileio): Don't intern and staticpro find-buffer-file-type. callproc.c (syms_of_callproc): Remove references to buffer_file_type. buffer.c (reset_buffer_local_variables): Don't set buffer_file_type. (init_buffer_once): Likewise. (syms_of_buffer): Don't define buffer-file-type. buffer.h (struct buffer): Remove buffer_file_type. --- src/ChangeLog | 25 +++++++++++++++++++++++++ src/buffer.c | 28 ---------------------------- src/buffer.h | 6 ------ src/callproc.c | 9 --------- src/fileio.c | 28 ++-------------------------- src/s/ms-w32.h | 2 -- src/w32fns.c | 6 +++--- src/w32term.c | 2 +- src/xdisp.c | 4 ---- 9 files changed, 31 insertions(+), 79 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 13b19453562..20a85d87113 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,28 @@ +2011-02-16 Eli Zaretskii + + * w32fns.c (Fx_create_frame): Use KVAR. + + * w32term.c (w32_create_terminal): Use KVAR. + + * s/ms-w32.h (MODE_LINE_BINARY_TEXT): Remove. + + * xdisp.c (decode_mode_spec): Don't use MODE_LINE_BINARY_TEXT. + + * fileio.c (Finsert_file_contents, Fwrite_region): Remove + references to buffer_file_type. + (syms_of_fileio): Don't intern and staticpro + find-buffer-file-type. + + * callproc.c (syms_of_callproc): Remove references to + buffer_file_type. + + * buffer.c (reset_buffer_local_variables): Don't set + buffer_file_type. + (init_buffer_once): Likewise. + (syms_of_buffer): Don't define buffer-file-type. + + * buffer.h (struct buffer): Remove buffer_file_type. + 2011-02-16 Tom Tromey * callint.c (Fcall_interactively): Update. diff --git a/src/buffer.c b/src/buffer.c index d05fe1754c2..c95fbb5f516 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -715,9 +715,6 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too) BVAR (b, case_canon_table) = XCHAR_TABLE (Vascii_downcase_table)->extras[1]; BVAR (b, case_eqv_table) = XCHAR_TABLE (Vascii_downcase_table)->extras[2]; BVAR (b, invisibility_spec) = Qt; -#ifndef DOS_NT - BVAR (b, buffer_file_type) = Qnil; -#endif /* Reset all (or most) per-buffer variables to their defaults. */ if (permanent_too) @@ -5040,9 +5037,6 @@ init_buffer_once (void) BVAR (&buffer_defaults, extra_line_spacing) = Qnil; BVAR (&buffer_defaults, cursor_in_non_selected_windows) = Qt; -#ifdef DOS_NT - BVAR (&buffer_defaults, buffer_file_type) = Qnil; /* TEXT */ -#endif BVAR (&buffer_defaults, enable_multibyte_characters) = Qt; BVAR (&buffer_defaults, buffer_file_coding_system) = Qnil; XSETFASTINT (BVAR (&buffer_defaults, fill_column), 70); @@ -5112,11 +5106,6 @@ init_buffer_once (void) XSETFASTINT (BVAR (&buffer_local_flags, left_margin), idx); ++idx; XSETFASTINT (BVAR (&buffer_local_flags, abbrev_table), idx); ++idx; XSETFASTINT (BVAR (&buffer_local_flags, display_table), idx); ++idx; -#ifdef DOS_NT - XSETFASTINT (BVAR (&buffer_local_flags, buffer_file_type), idx); - /* Make this one a permanent local. */ - buffer_permanent_local_flags[idx++] = 1; -#endif XSETFASTINT (BVAR (&buffer_local_flags, syntax_table), idx); ++idx; XSETFASTINT (BVAR (&buffer_local_flags, cache_long_line_scans), idx); ++idx; XSETFASTINT (BVAR (&buffer_local_flags, category_table), idx); ++idx; @@ -5415,14 +5404,6 @@ This is the same as (default-value 'tab-width). */); doc: /* Default value of `case-fold-search' for buffers that don't override it. This is the same as (default-value 'case-fold-search). */); -#ifdef DOS_NT - DEFVAR_BUFFER_DEFAULTS ("default-buffer-file-type", - buffer_file_type, - doc: /* Default file type for buffers that do not override it. -This is the same as (default-value 'buffer-file-type). -The file type is nil for text, t for binary. */); -#endif - DEFVAR_BUFFER_DEFAULTS ("default-left-margin-width", left_margin_cols, doc: /* Default value of `left-margin-width' for buffers that don't override it. @@ -5673,15 +5654,6 @@ word-wrapping, you might want to reduce the value of `truncate-partial-width-windows', since wrapping can make text readable in narrower windows. */); -#ifdef DOS_NT - DEFVAR_PER_BUFFER ("buffer-file-type", &BVAR (current_buffer, buffer_file_type), - Qnil, - doc: /* Non-nil if the visited file is a binary file. -This variable is meaningful on MS-DOG and Windows NT. -On those systems, it is automatically local in every buffer. -On other systems, this variable is normally always nil. */); -#endif - DEFVAR_PER_BUFFER ("default-directory", &BVAR (current_buffer, directory), make_number (Lisp_String), doc: /* Name of default directory of current buffer. Should end with slash. diff --git a/src/buffer.h b/src/buffer.h index 19a7c0b4632..65c7168d60a 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -662,12 +662,6 @@ struct buffer Lisp_Object BUFFER_INTERNAL_FIELD (left_margin); /* Function to call when insert space past fill column. */ Lisp_Object BUFFER_INTERNAL_FIELD (auto_fill_function); - /* nil: text, t: binary. - This value is meaningful only on certain operating systems. */ - /* Actually, we don't need this flag any more because end-of-line - is handled correctly according to the buffer-file-coding-system - of the buffer. Just keeping it for backward compatibility. */ - Lisp_Object BUFFER_INTERNAL_FIELD (buffer_file_type); /* Case table for case-conversion in this buffer. This char-table maps each char into its lower-case version. */ diff --git a/src/callproc.c b/src/callproc.c index 20018c688c9..c53a92bbaf8 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -74,10 +74,6 @@ extern char **environ; /* Pattern used by call-process-region to make temp files. */ static Lisp_Object Vtemp_file_name_pattern; -#ifdef DOS_NT -Lisp_Object Qbuffer_file_type; -#endif /* DOS_NT */ - /* True if we are about to fork off a synchronous process or if we are waiting for it. */ int synch_process_alive; @@ -1535,11 +1531,6 @@ set_initial_environment (void) void syms_of_callproc (void) { -#ifdef DOS_NT - Qbuffer_file_type = intern_c_string ("buffer-file-type"); - staticpro (&Qbuffer_file_type); -#endif /* DOS_NT */ - #ifndef DOS_NT Vtemp_file_name_pattern = build_string ("emacsXXXXXX"); #elif defined (WINDOWSNT) diff --git a/src/fileio.c b/src/fileio.c index 3112d7620c6..2ccad83f668 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -3075,10 +3075,6 @@ otherwise, if FILE2 does not exist, the answer is t. */) return (mtime1 > st.st_mtime) ? Qt : Qnil; } -#ifdef DOS_NT -Lisp_Object Qfind_buffer_file_type; -#endif /* DOS_NT */ - #ifndef READ_BUF_SIZE #define READ_BUF_SIZE (64 << 10) #endif @@ -4103,18 +4099,6 @@ variable `last-coding-system-used' to the coding system actually used. */) /* Now INSERTED is measured in characters. */ -#ifdef DOS_NT - /* Use the conversion type to determine buffer-file-type - (find-buffer-file-type is now used to help determine the - conversion). */ - if ((VECTORP (CODING_ID_EOL_TYPE (coding.id)) - || EQ (CODING_ID_EOL_TYPE (coding.id), Qunix)) - && ! CODING_REQUIRE_DECODING (&coding)) - BVAR (current_buffer, buffer_file_type) = Qt; - else - BVAR (current_buffer, buffer_file_type) = Qnil; -#endif - handled: if (deferred_remove_unwind_protect) @@ -4484,9 +4468,6 @@ This calls `write-region-annotate-functions' at the start, and int quietly = !NILP (visit); struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; struct buffer *given_buffer; -#ifdef DOS_NT - int buffer_file_type = O_BINARY; -#endif /* DOS_NT */ struct coding_system coding; if (current_buffer->base_buffer && visiting) @@ -4596,7 +4577,7 @@ This calls `write-region-annotate-functions' at the start, and desc = -1; if (!NILP (append)) #ifdef DOS_NT - desc = emacs_open (fn, O_WRONLY | buffer_file_type, 0); + desc = emacs_open (fn, O_WRONLY | O_BINARY, 0); #else /* not DOS_NT */ desc = emacs_open (fn, O_WRONLY, 0); #endif /* not DOS_NT */ @@ -4604,7 +4585,7 @@ This calls `write-region-annotate-functions' at the start, and if (desc < 0 && (NILP (append) || errno == ENOENT)) #ifdef DOS_NT desc = emacs_open (fn, - O_WRONLY | O_CREAT | buffer_file_type + O_WRONLY | O_CREAT | O_BINARY | (EQ (mustbenew, Qexcl) ? O_EXCL : O_TRUNC), S_IREAD | S_IWRITE); #else /* not DOS_NT */ @@ -5586,11 +5567,6 @@ syms_of_fileio (void) Qexcl = intern_c_string ("excl"); staticpro (&Qexcl); -#ifdef DOS_NT - Qfind_buffer_file_type = intern_c_string ("find-buffer-file-type"); - staticpro (&Qfind_buffer_file_type); -#endif /* DOS_NT */ - DEFVAR_LISP ("file-name-coding-system", Vfile_name_coding_system, doc: /* *Coding system for encoding file names. If it is nil, `default-file-name-coding-system' (which see) is used. */); diff --git a/src/s/ms-w32.h b/src/s/ms-w32.h index 34814687597..be16866eaf5 100644 --- a/src/s/ms-w32.h +++ b/src/s/ms-w32.h @@ -181,8 +181,6 @@ struct sigaction { #define HAVE_MENUS 1 #endif -#define MODE_LINE_BINARY_TEXT(_b_) (NILP (B_(_b_,buffer_file_type)) ? "T" : "B") - /* Get some redefinitions in place. */ #ifdef emacs diff --git a/src/w32fns.c b/src/w32fns.c index 3f350c2f591..ec48397657a 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -4348,9 +4348,9 @@ This function is an internal primitive--use `make-frame' instead. */) /* Initialize `default-minibuffer-frame' in case this is the first frame on this terminal. */ if (FRAME_HAS_MINIBUF_P (f) - && (!FRAMEP (kb->Vdefault_minibuffer_frame) - || !FRAME_LIVE_P (XFRAME (kb->Vdefault_minibuffer_frame)))) - kb->Vdefault_minibuffer_frame = frame; + && (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame)) + || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame))))) + KVAR (kb, Vdefault_minibuffer_frame) = frame; /* All remaining specified parameters, which have not been "used" by x_get_arg and friends, now go in the misc. alist of the frame. */ diff --git a/src/w32term.c b/src/w32term.c index cd4ee54fd2c..692130b5140 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -6082,7 +6082,7 @@ w32_create_terminal (struct w32_display_info *dpyinfo) terminal like X does. */ terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); init_kboard (terminal->kboard); - terminal->kboard->Vwindow_system = intern ("w32"); + KVAR (terminal->kboard, Vwindow_system) = intern ("w32"); terminal->kboard->next_kboard = all_kboards; all_kboards = terminal->kboard; /* Don't let the initial kboard remain current longer than necessary. diff --git a/src/xdisp.c b/src/xdisp.c index 1cb4f7350c6..37fd9e4aaab 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -19585,11 +19585,7 @@ decode_mode_spec (struct window *w, register int c, int field_width, } case 't': /* indicate TEXT or BINARY */ -#ifdef MODE_LINE_BINARY_TEXT - return MODE_LINE_BINARY_TEXT (b); -#else return "T"; -#endif case 'z': /* coding-system (not including end-of-line format) */ From eef5ce6ecc1207beb0fcd6c87647249e354831c4 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 16 Feb 2011 20:47:21 +0200 Subject: [PATCH 14/46] src/s/ms-w32.h (getloadavg): Declare prototype which was removed from lisp.h. --- src/ChangeLog | 1 + src/s/ms-w32.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index 20a85d87113..35d154a3807 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -5,6 +5,7 @@ * w32term.c (w32_create_terminal): Use KVAR. * s/ms-w32.h (MODE_LINE_BINARY_TEXT): Remove. + (getloadavg): Declare prototype which was removed from lisp.h. * xdisp.c (decode_mode_spec): Don't use MODE_LINE_BINARY_TEXT. diff --git a/src/s/ms-w32.h b/src/s/ms-w32.h index be16866eaf5..8b189baea46 100644 --- a/src/s/ms-w32.h +++ b/src/s/ms-w32.h @@ -346,6 +346,8 @@ extern char *get_emacs_configuration_options (void); #endif #include +extern int getloadavg (double *, int); + /* We need a little extra space, see ../../lisp/loadup.el. */ #define SYSTEM_PURESIZE_EXTRA 50000 From 15f58304c4037eb162cc96273e50ca3c82452290 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 16 Feb 2011 20:49:57 +0200 Subject: [PATCH 15/46] Fix formatting of src/ChangeLog entries. --- src/ChangeLog | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 35d154a3807..f55ca56caef 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -26,29 +26,30 @@ 2011-02-16 Tom Tromey - * callint.c (Fcall_interactively): Update. - * doc.c (Fsubstitute_command_keys): Update. - * cmds.c (Fself_insert_command): Update. + * callint.c (Fcall_interactively): Update for change to field names. + * doc.c (Fsubstitute_command_keys): Update for change to field names. + * cmds.c (Fself_insert_command): Update for change to field names. * keymap.c (Fcurrent_active_maps, Fkey_binding) - (Fdescribe_buffer_bindings): Update. + (Fdescribe_buffer_bindings): Update for change to field names. * macros.c (Fstart_kbd_macro, end_kbd_macro, Fend_kbd_macro) (store_kbd_macro_char, Fcall_last_kbd_macro, Fexecute_kbd_macro): - Update. + Update for change to field names. * keyboard.c (echo_char, echo_dash, echo_now, cancel_echoing) (echo_length, echo_truncate, cmd_error, command_loop_1) (read_char, kbd_buffer_store_event_hold, make_lispy_event) (menu_bar_items, tool_bar_items, read_char_minibuf_menu_prompt) (read_key_sequence, Fcommand_execute, Fexecute_extended_command) (Fdiscard_input, init_kboard, init_keyboard, mark_kboards): - Update. - * xfns.c (Fx_create_frame): Update. - * xterm.c (x_connection_closed, x_term_init): Update. + Update for change to field names. + * xfns.c (Fx_create_frame): Update for change to field names. + * xterm.c (x_connection_closed, x_term_init): Update for change to + field names. * term.c (term_get_fkeys_1, CONDITIONAL_REASSIGN, init_tty): - Update. + Update for change to field names. * window.c (window_scroll_pixel_based, window_scroll_line_based): - Update. + Update for change to field names. * frame.c (make_frame_without_minibuffer, Fhandle_switch_frame) - (delete_frame): Update. + (delete_frame): Update for change to field names. * lisp.h (DEFVAR_KBOARD): Update for change to field names. * keyboard.h (struct kboard): Rename all Lisp_Object fields. (KBOARD_INTERNAL_FIELD, KVAR): New macros. From 026d69ecec7ec7cb19470779126041e065aea6b1 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 16 Feb 2011 21:09:20 +0200 Subject: [PATCH 16/46] Use KVAR in the MS-DOS build. msdos.c (internal_terminal_init): Use KVAR. --- src/ChangeLog | 2 ++ src/msdos.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index f55ca56caef..ff950f4d9fd 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-02-16 Eli Zaretskii + * msdos.c (internal_terminal_init): Use KVAR. + * w32fns.c (Fx_create_frame): Use KVAR. * w32term.c (w32_create_terminal): Use KVAR. diff --git a/src/msdos.c b/src/msdos.c index 4fdfa64e367..8f0f6776aaa 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -1793,7 +1793,7 @@ internal_terminal_init (void) } tty = FRAME_TTY (sf); - current_kboard->Vwindow_system = Qpc; + KVAR (current_kboard, Vwindow_system) = Qpc; sf->output_method = output_msdos_raw; if (init_needed) { From 88ae2870cbcd5d15729e1c53baa58eb037c2c99b Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Wed, 16 Feb 2011 20:33:35 +0100 Subject: [PATCH 17/46] * net/soap-client.el: Add "comm" and "hypermedia" to the keywords. Reflow too long lines. * net/soap-inspect.el: Ditto. Require 'cl. --- lisp/ChangeLog | 7 ++ lisp/net/soap-client.el | 189 ++++++++++++++++++++++++--------------- lisp/net/soap-inspect.el | 24 ++--- 3 files changed, 139 insertions(+), 81 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ce58c47ad12..fa0820d23ac 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2011-02-16 Michael Albinus + + * net/soap-client.el: Add "comm" and "hypermedia" to the + keywords. Reflow too long lines. + + * net/soap-inspect.el: Ditto. Require 'cl. + 2011-02-16 Bastien Guerry * play/doctor.el (doctor-mode): Bugfix: escape the "," character diff --git a/lisp/net/soap-client.el b/lisp/net/soap-client.el index c43c17dc9ef..68067d69314 100644 --- a/lisp/net/soap-client.el +++ b/lisp/net/soap-client.el @@ -1,4 +1,4 @@ -;;;; soap.el -- Access SOAP web services from Emacs +;;;; soap-client.el -- Access SOAP web services from Emacs ;; Copyright (C) 2009-2011 Alex Harsanyi @@ -17,12 +17,12 @@ ;; Author: Alexandru Harsanyi (AlexHarsanyi@gmail.com) ;; Created: December, 2009 -;; Keywords: soap, web-services +;; Keywords: soap, web-services, comm, hypermedia ;; Homepage: http://code.google.com/p/emacs-soap-client ;; ;;; Commentary: -;; +;; ;; To use the SOAP client, you first need to load the WSDL document for the ;; service you want to access, using `soap-load-wsdl-from-url'. A WSDL ;; document describes the available operations of the SOAP service, how their @@ -157,14 +157,13 @@ namespace of LOCAL-NAME." nil))) ;; if no namespace is defined, just return the unqualified name name))) - + (defun soap-l2fq (local-name &optional use-tns) "Convert LOCAL-NAME into a fully qualified name. A fully qualified name is a cons of the namespace name and the name of the element itself. For example \"xsd:string\" is -converted to \(\"http://www.w3.org/2001/XMLSchema\" . \"string\" -\). +converted to \(\"http://www.w3.org/2001/XMLSchema\" . \"string\"\). The USE-TNS argument specifies what to do when LOCAL-NAME has no namespace tag. If USE-TNS is non-nil, the `*soap-target-xmlns*' @@ -201,14 +200,15 @@ different namespace aliases for the same element." (setq default-ns value)) ((string-match "^xmlns:\\(.*\\)$" name) (push (cons (match-string 1 name) value) xmlns))))) - + (let ((tns (assoc "tns" xmlns))) (cond ((and tns target-ns) - ;; If a tns alias is defined for this node, it must match the target - ;; namespace. + ;; If a tns alias is defined for this node, it must match + ;; the target namespace. (unless (equal target-ns (cdr tns)) - (soap-warning "soap-extract-xmlns(%s): tns alias and targetNamespace mismatch" - (xml-node-name node)))) + (soap-warning + "soap-extract-xmlns(%s): tns alias and targetNamespace mismatch" + (xml-node-name node)))) ((and tns (not target-ns)) (setq target-ns (cdr tns))) ((and (not tns) target-ns) @@ -217,7 +217,7 @@ different namespace aliases for the same element." ;; that we might override an existing tns alias in XMLNS-TABLE, ;; but that is intended. (push (cons "tns" target-ns) xmlns)))) - + (list default-ns target-ns (append xmlns xmlns-table)))) (defmacro soap-with-local-xmlns (node &rest body) @@ -248,7 +248,8 @@ namespace tag." ;; We use `ignore-errors' here because we want to silently ;; skip nodes for which we cannot convert them to a ;; well-known name. - (eq (ignore-errors (soap-l2wk (xml-node-name c))) child-name))) + (eq (ignore-errors (soap-l2wk (xml-node-name c))) + child-name))) (push c result))) (nreverse result))) @@ -346,7 +347,9 @@ binding) but the same name." (throw 'found e))))) ((= (length elements) 1) (car elements)) ((> (length elements) 1) - (error "Soap-namespace-get(%s): multiple elements, discriminant needed" name)) + (error + "Soap-namespace-get(%s): multiple elements, discriminant needed" + name)) (t nil)))) @@ -389,7 +392,8 @@ binding) but the same name." (defstruct soap-bound-operation operation ; SOAP-OPERATION soap-action ; value for SOAPAction HTTP header - use ; 'literal or 'encoded, see http://www.w3.org/TR/wsdl#_soap:body + use ; 'literal or 'encoded, see + ; http://www.w3.org/TR/wsdl#_soap:body ) (defstruct (soap-binding (:include soap-element)) @@ -412,7 +416,8 @@ binding) but the same name." (defun soap-default-soapenc-types () "Return a namespace containing some of the SOAPEnc types." - (let ((ns (make-soap-namespace :name "http://schemas.xmlsoap.org/soap/encoding/"))) + (let ((ns (make-soap-namespace + :name "http://schemas.xmlsoap.org/soap/encoding/"))) (dolist (type '("string" "dateTime" "boolean" "long" "int" "float" "base64Binary" "anyType" "Array" "byte[]")) (soap-namespace-put @@ -425,7 +430,7 @@ binding) but the same name." (or (soap-basic-type-p element) (soap-sequence-type-p element) (soap-array-type-p element))) - + ;;;;; The WSDL document @@ -482,7 +487,7 @@ used to resolve the namespace alias." (when use-local-alias-table (setq alias-table (append *soap-local-xmlns* alias-table))) - + (cond ((consp name) ; a fully qualified name, as returned by `soap-l2fq' (setq element-name (cdr name)) (when (symbolp element-name) @@ -490,19 +495,21 @@ used to resolve the namespace alias." (setq namespace (soap-wsdl-find-namespace (car name) wsdl)) (unless namespace (error "Soap-wsdl-get(%s): unknown namespace: %s" name namespace))) - + ((string-match "^\\(.*\\):\\(.*\\)$" name) (setq element-name (match-string 2 name)) (let* ((ns-alias (match-string 1 name)) (ns-name (cdr (assoc ns-alias alias-table)))) (unless ns-name - (error "Soap-wsdl-get(%s): cannot find namespace alias %s" name ns-alias)) - + (error "Soap-wsdl-get(%s): cannot find namespace alias %s" + name ns-alias)) + (setq namespace (soap-wsdl-find-namespace ns-name wsdl)) (unless namespace - (error "Soap-wsdl-get(%s): unknown namespace %s, referenced by alias %s" - name ns-name ns-alias)))) + (error + "Soap-wsdl-get(%s): unknown namespace %s, referenced by alias %s" + name ns-name ns-alias)))) (t (error "Soap-wsdl-get(%s): bad name" name))) @@ -513,10 +520,10 @@ used to resolve the namespace alias." (or (funcall 'soap-namespace-link-p e) (funcall predicate e))) nil))) - + (unless element (error "Soap-wsdl-get(%s): cannot find element" name)) - + (if (soap-namespace-link-p element) ;; NOTE: don't use the local alias table here (soap-wsdl-get (soap-namespace-link-target element) wsdl predicate) @@ -597,7 +604,8 @@ See also `soap-resolve-references-for-element' and (setq name (format "in%d" (incf counter)))) (when (or (consp message) (stringp message)) (setf (soap-operation-input operation) - (cons (intern name) (soap-wsdl-get message wsdl 'soap-message-p)))))) + (cons (intern name) + (soap-wsdl-get message wsdl 'soap-message-p)))))) (let ((output (soap-operation-output operation)) (counter 0)) @@ -607,7 +615,8 @@ See also `soap-resolve-references-for-element' and (setq name (format "out%d" (incf counter)))) (when (or (consp message) (stringp message)) (setf (soap-operation-output operation) - (cons (intern name) (soap-wsdl-get message wsdl 'soap-message-p)))))) + (cons (intern name) + (soap-wsdl-get message wsdl 'soap-message-p)))))) (let ((resolved-faults nil) (counter 0)) @@ -617,7 +626,8 @@ See also `soap-resolve-references-for-element' and (when (or (null name) (equal name "")) (setq name (format "fault%d" (incf counter)))) (if (or (consp message) (stringp message)) - (push (cons (intern name) (soap-wsdl-get message wsdl 'soap-message-p)) + (push (cons (intern name) + (soap-wsdl-get message wsdl 'soap-message-p)) resolved-faults) (push fault resolved-faults)))) (setf (soap-operation-faults operation) resolved-faults)) @@ -626,7 +636,7 @@ See also `soap-resolve-references-for-element' and (setf (soap-operation-parameter-order operation) (mapcar 'car (soap-message-parts (cdr (soap-operation-input operation)))))) - + (setf (soap-operation-parameter-order operation) (mapcar (lambda (p) (if (stringp p) @@ -641,7 +651,8 @@ See also `soap-resolve-references-for-element' and (when (or (consp (soap-binding-port-type binding)) (stringp (soap-binding-port-type binding))) (setf (soap-binding-port-type binding) - (soap-wsdl-get (soap-binding-port-type binding) wsdl 'soap-port-type-p))) + (soap-wsdl-get (soap-binding-port-type binding) + wsdl 'soap-port-type-p))) (let ((port-ops (soap-port-type-operations (soap-binding-port-type binding)))) (maphash (lambda (k v) @@ -801,7 +812,8 @@ calls." (dolist (node (soap-xml-get-children1 node 'wsdl:portType)) (let ((port-type (soap-parse-port-type node))) (soap-namespace-put port-type ns) - (soap-wsdl-add-namespace (soap-port-type-operations port-type) wsdl))) + (soap-wsdl-add-namespace + (soap-port-type-operations port-type) wsdl))) (dolist (node (soap-xml-get-children1 node 'wsdl:binding)) (soap-namespace-put (soap-parse-binding node) ns)) @@ -810,10 +822,12 @@ calls." (dolist (node (soap-xml-get-children1 node 'wsdl:port)) (let ((name (xml-get-attribute node 'name)) (binding (xml-get-attribute node 'binding)) - (url (let ((n (car (soap-xml-get-children1 node 'wsdlsoap:address)))) + (url (let ((n (car (soap-xml-get-children1 + node 'wsdlsoap:address)))) (xml-get-attribute n 'location)))) (let ((port (make-soap-port - :name name :binding (soap-l2fq binding 'tns) :service-url url))) + :name name :binding (soap-l2fq binding 'tns) + :service-url url))) (soap-namespace-put port ns) (push port (soap-wsdl-ports wsdl)))))) @@ -854,7 +868,8 @@ Return a SOAP-NAMESPACE containing the elements." ;; construct the actual complex type for it. (let ((type-node (soap-xml-get-children1 node 'xsd:complexType))) (when (> (length type-node) 0) - (assert (= (length type-node) 1)) ; only one complex type definition per element + (assert (= (length type-node) 1)) ; only one complex type + ; definition per element (setq type (soap-parse-complex-type (car type-node))))) (setf (soap-element-name type) name) type)) @@ -919,7 +934,8 @@ A list of these types is returned." (setq type (soap-parse-complex-type (car type-node)))))) (push (make-soap-sequence-element - :name (intern name) :type type :nillable? nillable? :multiple? multiple?) + :name (intern name) :type type :nillable? nillable? + :multiple? multiple?) elements))) (nreverse elements))) @@ -938,12 +954,14 @@ contents." (soap-l2wk (xml-node-name node))) (let (array? parent elements) (let ((extension (car-safe (soap-xml-get-children1 node 'xsd:extension))) - (restriction (car-safe (soap-xml-get-children1 node 'xsd:restriction)))) + (restriction (car-safe + (soap-xml-get-children1 node 'xsd:restriction)))) ;; a complex content node is either an extension or a restriction (cond (extension (setq parent (xml-get-attribute-or-nil extension 'base)) (setq elements (soap-parse-sequence - (car (soap-xml-get-children1 extension 'xsd:sequence))))) + (car (soap-xml-get-children1 + extension 'xsd:sequence))))) (restriction (let ((base (xml-get-attribute-or-nil restriction 'base))) (assert (equal base "soapenc:Array") @@ -951,8 +969,10 @@ contents." "restrictions supported only for soapenc:Array types, this is a %s" base)) (setq array? t) - (let ((attribute (car (soap-xml-get-children1 restriction 'xsd:attribute)))) - (let ((array-type (soap-xml-get-attribute-or-nil1 attribute 'wsdl:arrayType))) + (let ((attribute (car (soap-xml-get-children1 + restriction 'xsd:attribute)))) + (let ((array-type (soap-xml-get-attribute-or-nil1 + attribute 'wsdl:arrayType))) (when (string-match "^\\(.*\\)\\[\\]$" array-type) (setq parent (match-string 1 array-type)))))) @@ -961,7 +981,7 @@ contents." (if parent (setq parent (soap-l2fq parent 'tns))) - + (if array? (make-soap-array-type :element-type parent) (make-soap-sequence-type :parent parent :elements elements)))) @@ -999,11 +1019,13 @@ contents." (dolist (node (soap-xml-get-children1 node 'wsdl:operation)) (let ((o (soap-parse-operation node))) - (let ((other-operation (soap-namespace-get (soap-element-name o) ns 'soap-operation-p))) + (let ((other-operation (soap-namespace-get + (soap-element-name o) ns 'soap-operation-p))) (if other-operation ;; Unfortunately, the Confluence WSDL defines two operations ;; named "search" which differ only in parameter names... - (soap-warning "Discarding duplicate operation: %s" (soap-element-name o)) + (soap-warning "Discarding duplicate operation: %s" + (soap-element-name o)) (progn (soap-namespace-put o ns) @@ -1032,7 +1054,8 @@ contents." "soap-parse-operation: expecting wsdl:operation node, got %s" (soap-l2wk (xml-node-name node))) (let ((name (xml-get-attribute node 'name)) - (parameter-order (split-string (xml-get-attribute node 'parameterOrder))) + (parameter-order (split-string + (xml-get-attribute node 'parameterOrder))) input output faults) (dolist (n (xml-node-children node)) (when (consp n) ; skip string nodes which are whitespace @@ -1065,7 +1088,8 @@ contents." (soap-l2wk (xml-node-name node))) (let ((name (xml-get-attribute node 'name)) (type (xml-get-attribute node 'type))) - (let ((binding (make-soap-binding :name name :port-type (soap-l2fq type 'tns)))) + (let ((binding (make-soap-binding :name name + :port-type (soap-l2fq type 'tns)))) (dolist (wo (soap-xml-get-children1 node 'wsdl:operation)) (let ((name (xml-get-attribute wo 'name)) soap-action @@ -1144,7 +1168,8 @@ decode function to perform the actual decoding." (if (equal (soap-xml-get-attribute-or-nil1 node 'xsi:nil) "true") nil (let ((decoder (get (aref type 0) 'soap-decoder))) - (assert decoder nil "no soap-decoder for %s type" (aref type 0)) + (assert decoder nil "no soap-decoder for %s type" + (aref type 0)) (funcall decoder type node)))))))) (defun soap-decode-any-type (node) @@ -1282,9 +1307,11 @@ WSDL is used to decode the NODE" (let ((fault (car (soap-xml-get-children1 body 'soap:Fault)))) (when fault - (let ((fault-code (let ((n (car (xml-get-children fault 'faultcode)))) + (let ((fault-code (let ((n (car (xml-get-children + fault 'faultcode)))) (car-safe (xml-node-children n)))) - (fault-string (let ((n (car (xml-get-children fault 'faultstring)))) + (fault-string (let ((n (car (xml-get-children + fault 'faultstring)))) (car-safe (xml-node-children n))))) (while t (signal 'soap-error (list fault-code fault-string)))))) @@ -1319,7 +1346,8 @@ reference multiRef parts which are external to RESPONSE-NODE." (when (eq use 'encoded) (let* ((received-message-name (soap-l2fq (xml-node-name response-node))) - (received-message (soap-wsdl-get received-message-name wsdl 'soap-message-p))) + (received-message (soap-wsdl-get + received-message-name wsdl 'soap-message-p))) (unless (eq received-message message) (error "Unexpected message: got %s, expecting %s" received-message-name @@ -1342,12 +1370,15 @@ reference multiRef parts which are external to RESPONSE-NODE." ((eq use 'literal) (catch 'found (let* ((ns-aliases (soap-wsdl-alias-table wsdl)) - (ns-name (cdr (assoc (soap-element-namespace-tag type) ns-aliases))) + (ns-name (cdr (assoc + (soap-element-namespace-tag type) + ns-aliases))) (fqname (cons ns-name (soap-element-name type)))) (dolist (c (xml-node-children response-node)) (when (consp c) (soap-with-local-xmlns c - (when (equal (soap-l2fq (xml-node-name c)) fqname) + (when (equal (soap-l2fq (xml-node-name c)) + fqname) (throw 'found c)))))))))) (unless node @@ -1402,8 +1433,9 @@ instead." ((memq value '(t nil)) (setq xsi-type "xsd:boolean" basic-type 'boolean)) (t - (error "Soap-encode-basic-type(%s, %s, %s): cannot classify anyType value" - xml-tag value xsi-type)))) + (error + "Soap-encode-basic-type(%s, %s, %s): cannot classify anyType value" + xml-tag value xsi-type)))) (insert "<" xml-tag " xsi:type=\"" xsi-type "\"") @@ -1425,13 +1457,15 @@ instead." (>= (length value) 2) (numberp (nth 0 value)) (numberp (nth 1 value))) - ;; Value is a (current-time) style value, convert to a string + ;; Value is a (current-time) style value, convert + ;; to a string (insert (format-time-string "%Y-%m-%dT%H:%M:%S" value))) ((stringp value) (insert (url-insert-entities-in-string value))) (t - (error "Soap-encode-basic-type(%s, %s, %s): not a dateTime value" - xml-tag value xsi-type)))) + (error + "Soap-encode-basic-type(%s, %s, %s): not a dateTime value" + xml-tag value xsi-type)))) (boolean (unless (memq value '(t nil)) @@ -1444,7 +1478,7 @@ instead." (error "Soap-encode-basic-type(%s, %s, %s): not an integer value" xml-tag value xsi-type)) (insert (number-to-string value))) - + (base64Binary (unless (stringp value) (error "Soap-encode-basic-type(%s, %s, %s): not a string value" @@ -1452,9 +1486,10 @@ instead." (insert (base64-encode-string value))) (otherwise - (error "Soap-encode-basic-type(%s, %s, %s): don't know how to encode" - xml-tag value xsi-type)))) - + (error + "Soap-encode-basic-type(%s, %s, %s): don't know how to encode" + xml-tag value xsi-type)))) + (insert " xsi:nil=\"true\">")) (insert "\n"))) @@ -1487,12 +1522,14 @@ instead." ;; Do some sanity checking (cond ((and (= instance-count 0) (not (soap-sequence-element-nillable? element))) - (soap-warning "While encoding %s: missing non-nillable slot %s" - (soap-element-name type) e-name)) + (soap-warning + "While encoding %s: missing non-nillable slot %s" + (soap-element-name type) e-name)) ((and (> instance-count 1) (not (soap-sequence-element-multiple? element))) - (soap-warning "While encoding %s: multiple slots named %s" - (soap-element-name type) e-name)))))))) + (soap-warning + "While encoding %s: multiple slots named %s" + (soap-element-name type) e-name)))))))) (insert " xsi:nil=\"true\">")) (insert "\n"))) @@ -1563,7 +1600,8 @@ document." (goto-char start-pos) (when (re-search-forward " ") (let* ((ns (soap-element-namespace-tag type)) - (namespace (cdr (assoc ns (soap-wsdl-alias-table wsdl))))) + (namespace (cdr (assoc ns + (soap-wsdl-alias-table wsdl))))) (when namespace (insert "xmlns=\"" namespace "\" "))))))))) @@ -1632,7 +1670,8 @@ operations in a WSDL document." (error "Unknown SOAP service: %s" service)) (let* ((binding (soap-port-binding port)) - (operation (gethash operation-name (soap-binding-operations binding)))) + (operation (gethash operation-name + (soap-binding-operations binding)))) (unless operation (error "No operation %s for SOAP service %s" operation-name service)) @@ -1645,9 +1684,13 @@ operations in a WSDL document." (url-request-coding-system 'utf-8) (url-http-attempt-keepalives t) (url-request-extra-headers (list - (cons "SOAPAction" (soap-bound-operation-soap-action operation)) - (cons "Content-Type" "text/xml; charset=utf-8")))) - (let ((buffer (url-retrieve-synchronously (soap-port-service-url port)))) + (cons "SOAPAction" + (soap-bound-operation-soap-action + operation)) + (cons "Content-Type" + "text/xml; charset=utf-8")))) + (let ((buffer (url-retrieve-synchronously + (soap-port-service-url port)))) (condition-case err (with-current-buffer buffer (declare (special url-http-response-status)) @@ -1657,9 +1700,12 @@ operations in a WSDL document." ;; This is a warning because some SOAP errors come ;; back with a HTTP response 500 (internal server ;; error) - (warn "Error in SOAP response: HTTP code %s" url-http-response-status)) + (warn "Error in SOAP response: HTTP code %s" + url-http-response-status)) (when (> (buffer-size) 1000000) - (soap-warning "Received large message: %s bytes" (buffer-size))) + (soap-warning + "Received large message: %s bytes" + (buffer-size))) (let ((mime-part (mm-dissect-buffer t t))) (unless mime-part (error "Failed to decode response from server")) @@ -1667,7 +1713,8 @@ operations in a WSDL document." (error "Server response is not an XML document")) (with-temp-buffer (mm-insert-part mime-part) - (let ((response (car (xml-parse-region (point-min) (point-max))))) + (let ((response (car (xml-parse-region + (point-min) (point-max))))) (prog1 (soap-parse-envelope response operation wsdl) (kill-buffer buffer) diff --git a/lisp/net/soap-inspect.el b/lisp/net/soap-inspect.el index 4ea6bef0d8c..163ba13b05b 100644 --- a/lisp/net/soap-inspect.el +++ b/lisp/net/soap-inspect.el @@ -17,12 +17,12 @@ ;; Author: Alexandru Harsanyi (AlexHarsanyi@gmail.com) ;; Created: October 2010 -;; Keywords: soap, web-services +;; Keywords: soap, web-services, comm, hypermedia ;; Homepage: http://code.google.com/p/emacs-soap-client ;; ;;; Commentary: -;; +;; ;; This package provides an inspector for a WSDL document loaded with ;; `soap-load-wsdl' or `soap-load-wsdl-from-url'. To use it, evaluate: ;; @@ -32,11 +32,13 @@ ;; and types to explore the structure of the wsdl document. ;; -(require 'soap-client) - ;;; Code: +(eval-when-compile (require 'cl)) + +(require 'soap-client) + ;;; sample-value (defun soap-sample-value (type) @@ -148,12 +150,12 @@ entire WSDL can be inspected." (setq buffer-read-only t) (let ((inhibit-read-only t)) (erase-buffer) - + (when soap-inspect-current-item (push soap-inspect-current-item soap-inspect-previous-items)) (setq soap-inspect-current-item element) - + (funcall inspect element) (unless (null soap-inspect-previous-items) @@ -252,11 +254,13 @@ entire WSDL can be inspected." (insert "\tOutput: " (symbol-name (car output)) " (") (soap-insert-describe-button (cdr output)) (insert ")\n")) - + (insert "\n\nSample invocation:\n") - (let ((sample-message-value (soap-sample-value (cdr (soap-operation-input operation)))) + (let ((sample-message-value + (soap-sample-value (cdr (soap-operation-input operation)))) (funcall (list 'soap-invoke '*WSDL* "SomeService" (soap-element-name operation)))) - (let ((sample-invocation (append funcall (mapcar 'cdr sample-message-value)))) + (let ((sample-invocation + (append funcall (mapcar 'cdr sample-message-value)))) (pp sample-invocation (current-buffer))))) (defun soap-inspect-port-type (port-type) @@ -335,7 +339,7 @@ entire WSDL can be inspected." 'soap-inspect-message) (put (aref (make-soap-operation) 0) 'soap-inspect 'soap-inspect-operation) - + (put (aref (make-soap-port-type) 0) 'soap-inspect 'soap-inspect-port-type) From 12fe5bcc834428825cb182f77c4e58ed317b33f8 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Wed, 16 Feb 2011 20:41:31 +0100 Subject: [PATCH 18/46] * NEWS: Add soap-client.el and soap-inspect.el. --- etc/ChangeLog | 4 ++++ etc/NEWS | 3 +++ 2 files changed, 7 insertions(+) diff --git a/etc/ChangeLog b/etc/ChangeLog index 520a12ba15f..bf6d10ec255 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,7 @@ +2011-02-16 Michael Albinus + + * NEWS: Add soap-client.el and soap-inspect.el. + 2011-02-13 Michael Albinus * NEWS: Tramp methods "imap" and "imaps" are discontinued. diff --git a/etc/NEWS b/etc/NEWS index 3cc463db4a8..96cc97ac795 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -639,6 +639,9 @@ secrets. ** notifications.el provides an implementation of the Desktop Notifications API. It requires D-Bus for communication. +** soap-client.el supports access to SOAP web services from Emacs. +soap-inspect.el is an interactive inspector for SOAP WSDL structures. + * Incompatible Lisp Changes in Emacs 24.1 From 274c2d34f170815260af2339c52cfc52ea1de3f7 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Wed, 16 Feb 2011 20:56:31 +0100 Subject: [PATCH 19/46] * soap-client.el (soap-well-known-xmlns, soap-local-xmlns) (soap-default-xmlns, soap-target-xmlns, soap-multi-refs) (soap-decoded-multi-refs, soap-current-wsdl) (soap-encoded-namespaces): Rename CL-style *...* variables. --- lisp/ChangeLog | 7 ++++ lisp/net/soap-client.el | 88 ++++++++++++++++++++--------------------- 2 files changed, 51 insertions(+), 44 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index fa0820d23ac..d8831d56c0e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2011-02-16 Alex Harsanyi + + * soap-client.el (soap-well-known-xmlns, soap-local-xmlns) + (soap-default-xmlns, soap-target-xmlns, soap-multi-refs) + (soap-decoded-multi-refs, soap-current-wsdl) + (soap-encoded-namespaces): Rename CL-style *...* variables. + 2011-02-16 Michael Albinus * net/soap-client.el: Add "comm" and "hypermedia" to the diff --git a/lisp/net/soap-client.el b/lisp/net/soap-client.el index 68067d69314..bad6ca1e431 100644 --- a/lisp/net/soap-client.el +++ b/lisp/net/soap-client.el @@ -63,7 +63,7 @@ ;; "well known" namespace tag and the local namespace tag in the document ;; being parsed. -(defconst *soap-well-known-xmlns* +(defconst soap-well-known-xmlns '(("apachesoap" . "http://xml.apache.org/xml-soap") ("soapenc" . "http://schemas.xmlsoap.org/soap/encoding/") ("wsdl" . "http://schemas.xmlsoap.org/wsdl/") @@ -76,18 +76,18 @@ ("mime" . "http://schemas.xmlsoap.org/wsdl/mime/")) "A list of well known xml namespaces and their aliases.") -(defvar *soap-local-xmlns* nil +(defvar soap-local-xmlns nil "A list of local namespace aliases. This is a dynamically bound variable, controlled by `soap-with-local-xmlns'.") -(defvar *soap-default-xmlns* nil +(defvar soap-default-xmlns nil "The default XML namespaces. Names in this namespace will be unqualified. This is a dynamically bound variable, controlled by `soap-with-local-xmlns'") -(defvar *soap-target-xmlns* nil +(defvar soap-target-xmlns nil "The target XML namespace. New XSD elements will be defined in this namespace, unless they are fully qualified for a different namespace. This is a @@ -97,9 +97,9 @@ dynamically bound variable, controlled by (defun soap-wk2l (well-known-name) "Return local variant of WELL-KNOWN-NAME. This is done by looking up the namespace in the -`*soap-well-known-xmlns*' table and resolving the namespace to +`soap-well-known-xmlns' table and resolving the namespace to the local name based on the current local translation table -`*soap-local-xmlns*'. See also `soap-with-local-xmlns'." +`soap-local-xmlns'. See also `soap-with-local-xmlns'." (let ((wk-name-1 (if (symbolp well-known-name) (symbol-name well-known-name) well-known-name))) @@ -107,14 +107,14 @@ the local name based on the current local translation table ((string-match "^\\(.*\\):\\(.*\\)$" wk-name-1) (let ((ns (match-string 1 wk-name-1)) (name (match-string 2 wk-name-1))) - (let ((namespace (cdr (assoc ns *soap-well-known-xmlns*)))) - (cond ((equal namespace *soap-default-xmlns*) + (let ((namespace (cdr (assoc ns soap-well-known-xmlns)))) + (cond ((equal namespace soap-default-xmlns) ;; Name is unqualified in the default namespace (if (symbolp well-known-name) (intern name) name)) (t - (let* ((local-ns (car (rassoc namespace *soap-local-xmlns*))) + (let* ((local-ns (car (rassoc namespace soap-local-xmlns))) (local-name (concat local-ns ":" name))) (if (symbolp well-known-name) (intern local-name) @@ -124,7 +124,7 @@ the local name based on the current local translation table (defun soap-l2wk (local-name) "Convert LOCAL-NAME into a well known name. The namespace of LOCAL-NAME is looked up in the -`*soap-well-known-xmlns*' table and a well known namespace tag is +`soap-well-known-xmlns' table and a well known namespace tag is used in the name. nil is returned if there is no well-known namespace for the @@ -137,15 +137,15 @@ namespace of LOCAL-NAME." ((string-match "^\\(.*\\):\\(.*\\)$" l-name-1) (setq name (match-string 2 l-name-1)) (let ((ns (match-string 1 l-name-1))) - (setq namespace (cdr (assoc ns *soap-local-xmlns*))) + (setq namespace (cdr (assoc ns soap-local-xmlns))) (unless namespace (error "Soap-l2wk(%s): no namespace for alias %s" local-name ns)))) (t (setq name l-name-1) - (setq namespace *soap-default-xmlns*))) + (setq namespace soap-default-xmlns))) (if namespace - (let ((well-known-ns (car (rassoc namespace *soap-well-known-xmlns*)))) + (let ((well-known-ns (car (rassoc namespace soap-well-known-xmlns)))) (if well-known-ns (let ((well-known-name (concat well-known-ns ":" name))) (if (symbol-name local-name) @@ -166,9 +166,9 @@ name of the element itself. For example \"xsd:string\" is converted to \(\"http://www.w3.org/2001/XMLSchema\" . \"string\"\). The USE-TNS argument specifies what to do when LOCAL-NAME has no -namespace tag. If USE-TNS is non-nil, the `*soap-target-xmlns*' +namespace tag. If USE-TNS is non-nil, the `soap-target-xmlns' will be used as the element's namespace, otherwise -`*soap-default-xmlns*' will be used. +`soap-default-xmlns' will be used. This is needed because different parts of a WSDL document can use different namespace aliases for the same element." @@ -178,14 +178,14 @@ different namespace aliases for the same element." (cond ((string-match "^\\(.*\\):\\(.*\\)$" local-name-1) (let ((ns (match-string 1 local-name-1)) (name (match-string 2 local-name-1))) - (let ((namespace (cdr (assoc ns *soap-local-xmlns*)))) + (let ((namespace (cdr (assoc ns soap-local-xmlns)))) (if namespace (cons namespace name) (error "Soap-l2fq(%s): unknown alias %s" local-name ns))))) (t (cons (if use-tns - *soap-target-xmlns* - *soap-default-xmlns*) + soap-target-xmlns + soap-default-xmlns) local-name))))) (defun soap-extract-xmlns (node &optional xmlns-table) @@ -224,18 +224,18 @@ different namespace aliases for the same element." "Install a local alias table from NODE and execute BODY." (declare (debug (form &rest form)) (indent 1)) (let ((xmlns (make-symbol "xmlns"))) - `(let ((,xmlns (soap-extract-xmlns ,node *soap-local-xmlns*))) - (let ((*soap-default-xmlns* (or (nth 0 ,xmlns) *soap-default-xmlns*)) - (*soap-target-xmlns* (or (nth 1 ,xmlns) *soap-target-xmlns*)) - (*soap-local-xmlns* (nth 2 ,xmlns))) + `(let ((,xmlns (soap-extract-xmlns ,node soap-local-xmlns))) + (let ((soap-default-xmlns (or (nth 0 ,xmlns) soap-default-xmlns)) + (soap-target-xmlns (or (nth 1 ,xmlns) soap-target-xmlns)) + (soap-local-xmlns (nth 2 ,xmlns))) ,@body)))) (defun soap-get-target-namespace (node) "Return the target namespace of NODE. This is the namespace in which new elements will be defined." (or (xml-get-attribute-or-nil node 'targetNamespace) - (cdr (assoc "tns" *soap-local-xmlns*)) - *soap-target-xmlns*)) + (cdr (assoc "tns" soap-local-xmlns)) + soap-target-xmlns)) (defun soap-xml-get-children1 (node child-name) "Return the children of NODE named CHILD-NAME. @@ -477,7 +477,7 @@ elements named \"foo\" exist in the WSDL you could use: (soap-wsdl-get \"foo\" WSDL 'soap-message-p) -If USE-LOCAL-ALIAS-TABLE is not nil, `*soap-local-xmlns*` will be +If USE-LOCAL-ALIAS-TABLE is not nil, `soap-local-xmlns` will be used to resolve the namespace alias." (let ((alias-table (soap-wsdl-alias-table wsdl)) namespace element-name element) @@ -486,7 +486,7 @@ used to resolve the namespace alias." (setq name (symbol-name name))) (when use-local-alias-table - (setq alias-table (append *soap-local-xmlns* alias-table))) + (setq alias-table (append soap-local-xmlns alias-table))) (cond ((consp name) ; a fully qualified name, as returned by `soap-l2fq' (setq element-name (cdr name)) @@ -780,7 +780,7 @@ calls." ;; Add the local alias table to the wsdl document -- it will be used for ;; all types in this document even after we finish parsing it. - (setf (soap-wsdl-alias-table wsdl) *soap-local-xmlns*) + (setf (soap-wsdl-alias-table wsdl) soap-local-xmlns) ;; Add the XSD types to the wsdl document (let ((ns (soap-default-xsd-types))) @@ -1121,17 +1121,17 @@ contents." ;;;; SOAP type decoding -(defvar *soap-multi-refs* nil +(defvar soap-multi-refs nil "The list of multi-ref nodes in the current SOAP response. This is a dynamically bound variable used during decoding the SOAP response.") -(defvar *soap-decoded-multi-refs* nil +(defvar soap-decoded-multi-refs nil "List of decoded multi-ref nodes in the current SOAP response. This is a dynamically bound variable used during decoding the SOAP response.") -(defvar *soap-current-wsdl* nil +(defvar soap-current-wsdl nil "The current WSDL document used when decoding the SOAP response. This is a dynamically bound variable.") @@ -1148,19 +1148,19 @@ decode function to perform the actual decoding." ;; NODE is actually a HREF, find the target and decode that. ;; Check first if we already decoded this multiref. - (let ((decoded (cdr (assoc href *soap-decoded-multi-refs*)))) + (let ((decoded (cdr (assoc href soap-decoded-multi-refs)))) (when decoded (throw 'done decoded))) (string-match "^#\\(.*\\)$" href) ; TODO: check that it matched (let ((id (match-string 1 href))) - (dolist (mr *soap-multi-refs*) + (dolist (mr soap-multi-refs) (let ((mrid (xml-get-attribute mr 'id))) (when (equal id mrid) ;; recurse here, in case there are multiple HREF's (let ((decoded (soap-decode-type type mr))) - (push (cons href decoded) *soap-decoded-multi-refs*) + (push (cons href decoded) soap-decoded-multi-refs) (throw 'done decoded))))) (error "Cannot find href %s" href)))) (t @@ -1177,7 +1177,7 @@ decode function to perform the actual decoding." ;; If the NODE has type information, we use that... (let ((type (soap-xml-get-attribute-or-nil1 node 'xsi:type))) (if type - (let ((wtype (soap-wsdl-get type *soap-current-wsdl* 'soap-type-p))) + (let ((wtype (soap-wsdl-get type soap-current-wsdl 'soap-type-p))) (if wtype (soap-decode-type wtype node) ;; The node has type info encoded in it, but we don't know how @@ -1210,7 +1210,7 @@ decode function to perform the actual decoding." ;; Type is in the format "someType[NUM]" where NUM is the number of ;; elements in the array. We discard the [NUM] part. (setq type (replace-regexp-in-string "\\[[0-9]+\\]\\'" "" type)) - (setq wtype (soap-wsdl-get type *soap-current-wsdl* 'soap-type-p)) + (setq wtype (soap-wsdl-get type soap-current-wsdl 'soap-type-p)) (unless wtype ;; The node has type info encoded in it, but we don't know how to ;; decode it... @@ -1337,7 +1337,7 @@ WSDL is used to decode the NODE. SOAP-BODY is the body of the SOAP envelope (of which RESPONSE-NODE is a sub-node). It is used in case RESPONSE-NODE reference multiRef parts which are external to RESPONSE-NODE." - (let* ((*soap-current-wsdl* wsdl) + (let* ((soap-current-wsdl wsdl) (op (soap-bound-operation-operation operation)) (use (soap-bound-operation-use operation)) (message (cdr (soap-operation-output op)))) @@ -1354,8 +1354,8 @@ reference multiRef parts which are external to RESPONSE-NODE." (soap-element-name message))))) (let ((decoded-parts nil) - (*soap-multi-refs* (xml-get-children soap-body 'multiRef)) - (*soap-decoded-multi-refs* nil)) + (soap-multi-refs (xml-get-children soap-body 'multiRef)) + (soap-decoded-multi-refs nil)) (dolist (part (soap-message-parts message)) (let ((tag (car part)) @@ -1390,7 +1390,7 @@ reference multiRef parts which are external to RESPONSE-NODE." ;;;; SOAP type encoding -(defvar *soap-encoded-namespaces* nil +(defvar soap-encoded-namespaces nil "A list of namespace tags used during encoding a message. This list is populated by `soap-encode-value' and used by `soap-create-envelope' to add aliases for these namespace to the @@ -1414,7 +1414,7 @@ work." (when (symbolp xml-tag) (setq xml-tag (symbol-name xml-tag))) (funcall encoder xml-tag value type)) - (add-to-list '*soap-encoded-namespaces* (soap-element-namespace-tag type))) + (add-to-list 'soap-encoded-namespaces (soap-element-namespace-tag type))) (defun soap-encode-basic-type (xml-tag value type) "Encode inside XML-TAG the LISP VALUE according to TYPE. @@ -1577,7 +1577,7 @@ document." (insert "\n") (when (eq use 'encoded) - (add-to-list '*soap-encoded-namespaces* (soap-element-namespace-tag op)) + (add-to-list 'soap-encoded-namespaces (soap-element-namespace-tag op)) (insert "<" (soap-element-fq-name op) ">\n")) (let ((param-table (loop for formal in parameter-order @@ -1613,7 +1613,7 @@ document." "Create a SOAP request envelope for OPERATION using PARAMETERS. WSDL is the wsdl document used to encode the PARAMETERS." (with-temp-buffer - (let ((*soap-encoded-namespaces* '("xsi" "soap" "soapenc")) + (let ((soap-encoded-namespaces '("xsi" "soap" "soapenc")) (use (soap-bound-operation-use operation))) ;; Create the request body @@ -1624,9 +1624,9 @@ WSDL is the wsdl document used to encode the PARAMETERS." (insert "\n Date: Wed, 16 Feb 2011 22:06:23 +0100 Subject: [PATCH 20/46] * lisp/simple.el (just-one-space): Remove useless `or' call. --- lisp/ChangeLog | 4 ++++ lisp/simple.el | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d8831d56c0e..3b8354c9b0f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2011-02-16 Deniz Dogan + + * simple.el (just-one-space): Remove useless `or' call. + 2011-02-16 Alex Harsanyi * soap-client.el (soap-well-known-xmlns, soap-local-xmlns) diff --git a/lisp/simple.el b/lisp/simple.el index 4d2a0e69836..531c9212e34 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -778,7 +778,7 @@ If N is negative, delete newlines as well." (n (abs n))) (skip-chars-backward skip-characters) (constrain-to-field nil orig-pos) - (dotimes (i (or n 1)) + (dotimes (i n) (if (= (following-char) ?\s) (forward-char 1) (insert ?\s))) From 96497653538b909d541ece0707448b08ea99ee2f Mon Sep 17 00:00:00 2001 From: Ken Manheimer Date: Wed, 16 Feb 2011 16:29:32 -0500 Subject: [PATCH 21/46] Include PGP and GnuPG in Keywords, and other commentary refinements. (allout-abbreviate-flattened-numbering): Rename to allout-flattened-numbering-abbreviation, and define-obsolete-variable-alias the old name. (allout-flattened-numbering-abbreviation): Rename from allout-abbreviate-flattened-numbering. (allout-mode-p): Include among autoloads, for use by other modes with impunity. (allout-listify-exposed): Use allout-flattened-numbering-abbreviation. (allout-encrypt-string): Use set-buffer-multibyte directly. (allout-set-buffer-multibyte): Remove. --- lisp/ChangeLog | 16 ++++++++++++++++ lisp/allout.el | 35 +++++++++++++++-------------------- 2 files changed, 31 insertions(+), 20 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3b8354c9b0f..b6cbc91fb37 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,19 @@ +2011-02-16 Ken Manheimer + + * allout.el: Include PGP and GnuPG in Keywords, and other + commentary refinements. + (allout-abbreviate-flattened-numbering): Rename to + allout-flattened-numbering-abbreviation, and + define-obsolete-variable-alias the old name. + (allout-flattened-numbering-abbreviation): Rename from + allout-abbreviate-flattened-numbering. + (allout-mode-p): Include among autoloads, for use by other modes + with impunity. + (allout-listify-exposed): Use + allout-flattened-numbering-abbreviation. + (allout-encrypt-string): Use set-buffer-multibyte directly. + (allout-set-buffer-multibyte): Remove. + 2011-02-16 Deniz Dogan * simple.el (just-one-space): Remove useless `or' call. diff --git a/lisp/allout.el b/lisp/allout.el index 5d87415a57f..f77fb0b47bd 100644 --- a/lisp/allout.el +++ b/lisp/allout.el @@ -6,7 +6,7 @@ ;; Maintainer: Ken Manheimer ;; Created: Dec 1991 -- first release to usenet ;; Version: 2.3 -;; Keywords: outlines wp languages +;; Keywords: outlines, wp, languages, PGP, GnuPG ;; Website: http://myriadicity.net/Sundry/EmacsAllout ;; This file is part of GNU Emacs. @@ -59,8 +59,8 @@ ;; See the `allout-mode' function's docstring for an introduction to the ;; mode. ;; -;; The latest development version and helpful notes are available at -;; http://myriadicity.net/Sundry/EmacsAllout . +;; Directions to the latest development version and helpful notes are +;; available at http://myriadicity.net/Sundry/EmacsAllout . ;; ;; The outline menubar additions provide quick reference to many of the ;; features. See the docstring of the variables `allout-layout' and @@ -76,7 +76,7 @@ ;;; Code: -;;;_* Dependency autoloads +;;;_* Dependency loads (require 'overlay) (eval-when-compile ;; Most of the requires here are for stuff covered by autoloads, which @@ -94,7 +94,9 @@ ;;;_ > defgroup allout, allout-keybindings (defgroup allout nil - "Extensive outline mode for use alone and with other modes." + "Extensive outline minor-mode, for use stand-alone and with other modes. + +See Allout Auto Activation for automatic activation." :prefix "allout-" :group 'outlines) (defgroup allout-keybindings nil @@ -308,9 +310,7 @@ performing auto-layout is asked of the user each time. With value \"activate\", only auto-mode-activation is enabled. Auto-layout is not. -With value nil, neither auto-mode-activation nor auto-layout are -enabled, and allout auto-activation processing is removed from -file visiting activities." +With value nil, inhibit any automatic allout-mode activation." :set 'allout-auto-activation-helper :type '(choice (const :tag "On" t) (const :tag "Ask about layout" "ask") @@ -752,8 +752,10 @@ Set this var to the bullet you want to use for file cross-references." ;;;###autoload (put 'allout-presentation-padding 'safe-local-variable 'integerp) -;;;_ = allout-abbreviate-flattened-numbering -(defcustom allout-abbreviate-flattened-numbering nil +;;;_ = allout-flattened-numbering-abbreviation +(define-obsolete-variable-alias 'allout-abbreviate-flattened-numbering + 'allout-flattened-numbering-abbreviation "24.0") +(defcustom allout-flattened-numbering-abbreviation nil "If non-nil, `allout-flatten-exposed-to-buffer' abbreviates topic numbers to minimal amount with some context. Otherwise, entire numbers are always used." @@ -1553,6 +1555,7 @@ See `allout-encryption-ciphertext-rejection-regexps' for rejection reasons.") ;;;_ > allout-mode-p () ;; Must define this macro above any uses, or byte compilation will lack ;; proper def, if file isn't loaded -- eg, during emacs build! +;;;###autoload (defmacro allout-mode-p () "Return t if `allout-mode' is active in current buffer." 'allout-mode) @@ -5410,7 +5413,7 @@ header and body. The elements of that list are: bullet))) (cond ((listp format) (list depth - (if allout-abbreviate-flattened-numbering + (if allout-flattened-numbering-abbreviation (allout-stringify-flat-index format gone-out) (allout-stringify-flat-index-plain @@ -6054,7 +6057,7 @@ signal." (with-temp-buffer (insert text) ;; convey the text characteristics of the original buffer: - (allout-set-buffer-multibyte multibyte) + (set-buffer-multibyte multibyte) (when encoding (set-buffer-file-coding-system encoding) (if (not decrypt) @@ -6673,14 +6676,6 @@ To ignore intangibility, bind `inhibit-point-motion-hooks' to t." 'previous-single-property-change) ;; No docstring because xemacs defalias doesn't support it. ) -;;;_ > allout-set-buffer-multibyte -(if (fboundp 'set-buffer-multibyte) - (defalias 'allout-set-buffer-multibyte 'set-buffer-multibyte) - (with-no-warnings - ;; this definition is used only in older or alternative emacs, where - ;; the setting is our only recourse. - (defun allout-set-buffer-multibyte (is-multibyte) - (set enable-multibyte-characters is-multibyte)))) ;;;_ > allout-select-safe-coding-system (defalias 'allout-select-safe-coding-system (if (fboundp 'select-safe-coding-system) From aac7a93503c664ba0d117a904597ecf21b0f0c2f Mon Sep 17 00:00:00 2001 From: Ken Manheimer Date: Wed, 16 Feb 2011 17:10:43 -0500 Subject: [PATCH 22/46] * lisp/allout-widgets.el: New allout extension that shows allout outline structure with graphical widgets. 'allout-widgets' customize group is an 'allout' subgroup, for easy discovery. * etc/images/icons/allout-widgets-dark-bg, etc/images/icons/allout-widgets-light-bg: Icons for new allout-widgets.el. * etc/images/icons/README: Include coypright and GPL 3 license for new icons. --- etc/ChangeLog | 9 + etc/images/icons/README | 49 + .../icons/allout-widgets-dark-bg/closed.png | Bin 0 -> 232 bytes .../icons/allout-widgets-dark-bg/closed.xpm | 30 + .../icons/allout-widgets-dark-bg/empty.png | Bin 0 -> 231 bytes .../icons/allout-widgets-dark-bg/empty.xpm | 29 + .../encrypted-locked.png | Bin 0 -> 210 bytes .../encrypted-locked.xpm | 26 + .../encrypted-unlocked.png | Bin 0 -> 202 bytes .../encrypted-unlocked.xpm | 26 + .../allout-widgets-dark-bg/end-connector.png | Bin 0 -> 107 bytes .../allout-widgets-dark-bg/end-connector.xpm | 22 + .../extender-connector.png | Bin 0 -> 92 bytes .../extender-connector.xpm | 22 + .../icons/allout-widgets-dark-bg/leaf.png | Bin 0 -> 211 bytes .../icons/allout-widgets-dark-bg/leaf.xpm | 33 + .../allout-widgets-dark-bg/mid-connector.png | Bin 0 -> 125 bytes .../allout-widgets-dark-bg/mid-connector.xpm | 22 + .../icons/allout-widgets-dark-bg/opened.png | Bin 0 -> 206 bytes .../icons/allout-widgets-dark-bg/opened.xpm | 25 + .../allout-widgets-dark-bg/skip-descender.png | Bin 0 -> 84 bytes .../allout-widgets-dark-bg/skip-descender.xpm | 21 + .../through-descender.png | Bin 0 -> 92 bytes .../through-descender.xpm | 22 + .../icons/allout-widgets-light-bg/closed.png | Bin 0 -> 212 bytes .../icons/allout-widgets-light-bg/closed.xpm | 24 + .../icons/allout-widgets-light-bg/empty.png | Bin 0 -> 214 bytes .../icons/allout-widgets-light-bg/empty.xpm | 24 + .../encrypted-locked.png | Bin 0 -> 210 bytes .../encrypted-locked.xpm | 26 + .../encrypted-unlocked.png | Bin 0 -> 202 bytes .../encrypted-unlocked.xpm | 26 + .../allout-widgets-light-bg/end-connector.png | Bin 0 -> 111 bytes .../allout-widgets-light-bg/end-connector.xpm | 22 + .../extender-connector.png | Bin 0 -> 105 bytes .../extender-connector.xpm | 22 + .../icons/allout-widgets-light-bg/leaf.png | Bin 0 -> 211 bytes .../icons/allout-widgets-light-bg/leaf.xpm | 33 + .../allout-widgets-light-bg/mid-connector.png | Bin 0 -> 115 bytes .../allout-widgets-light-bg/mid-connector.xpm | 22 + .../icons/allout-widgets-light-bg/opened.png | Bin 0 -> 212 bytes .../icons/allout-widgets-light-bg/opened.xpm | 24 + .../skip-descender.png | Bin 0 -> 84 bytes .../skip-descender.xpm | 21 + .../through-descender.png | Bin 0 -> 105 bytes .../through-descender.xpm | 22 + lisp/ChangeLog | 4 + lisp/allout-widgets.el | 2365 +++++++++++++++++ 48 files changed, 2971 insertions(+) create mode 100644 etc/images/icons/allout-widgets-dark-bg/closed.png create mode 100644 etc/images/icons/allout-widgets-dark-bg/closed.xpm create mode 100644 etc/images/icons/allout-widgets-dark-bg/empty.png create mode 100644 etc/images/icons/allout-widgets-dark-bg/empty.xpm create mode 100644 etc/images/icons/allout-widgets-dark-bg/encrypted-locked.png create mode 100644 etc/images/icons/allout-widgets-dark-bg/encrypted-locked.xpm create mode 100644 etc/images/icons/allout-widgets-dark-bg/encrypted-unlocked.png create mode 100644 etc/images/icons/allout-widgets-dark-bg/encrypted-unlocked.xpm create mode 100644 etc/images/icons/allout-widgets-dark-bg/end-connector.png create mode 100644 etc/images/icons/allout-widgets-dark-bg/end-connector.xpm create mode 100644 etc/images/icons/allout-widgets-dark-bg/extender-connector.png create mode 100644 etc/images/icons/allout-widgets-dark-bg/extender-connector.xpm create mode 100644 etc/images/icons/allout-widgets-dark-bg/leaf.png create mode 100644 etc/images/icons/allout-widgets-dark-bg/leaf.xpm create mode 100644 etc/images/icons/allout-widgets-dark-bg/mid-connector.png create mode 100644 etc/images/icons/allout-widgets-dark-bg/mid-connector.xpm create mode 100644 etc/images/icons/allout-widgets-dark-bg/opened.png create mode 100644 etc/images/icons/allout-widgets-dark-bg/opened.xpm create mode 100644 etc/images/icons/allout-widgets-dark-bg/skip-descender.png create mode 100644 etc/images/icons/allout-widgets-dark-bg/skip-descender.xpm create mode 100644 etc/images/icons/allout-widgets-dark-bg/through-descender.png create mode 100644 etc/images/icons/allout-widgets-dark-bg/through-descender.xpm create mode 100644 etc/images/icons/allout-widgets-light-bg/closed.png create mode 100644 etc/images/icons/allout-widgets-light-bg/closed.xpm create mode 100644 etc/images/icons/allout-widgets-light-bg/empty.png create mode 100644 etc/images/icons/allout-widgets-light-bg/empty.xpm create mode 100755 etc/images/icons/allout-widgets-light-bg/encrypted-locked.png create mode 100644 etc/images/icons/allout-widgets-light-bg/encrypted-locked.xpm create mode 100755 etc/images/icons/allout-widgets-light-bg/encrypted-unlocked.png create mode 100644 etc/images/icons/allout-widgets-light-bg/encrypted-unlocked.xpm create mode 100644 etc/images/icons/allout-widgets-light-bg/end-connector.png create mode 100644 etc/images/icons/allout-widgets-light-bg/end-connector.xpm create mode 100644 etc/images/icons/allout-widgets-light-bg/extender-connector.png create mode 100644 etc/images/icons/allout-widgets-light-bg/extender-connector.xpm create mode 100755 etc/images/icons/allout-widgets-light-bg/leaf.png create mode 100755 etc/images/icons/allout-widgets-light-bg/leaf.xpm create mode 100644 etc/images/icons/allout-widgets-light-bg/mid-connector.png create mode 100644 etc/images/icons/allout-widgets-light-bg/mid-connector.xpm create mode 100644 etc/images/icons/allout-widgets-light-bg/opened.png create mode 100644 etc/images/icons/allout-widgets-light-bg/opened.xpm create mode 100644 etc/images/icons/allout-widgets-light-bg/skip-descender.png create mode 100644 etc/images/icons/allout-widgets-light-bg/skip-descender.xpm create mode 100644 etc/images/icons/allout-widgets-light-bg/through-descender.png create mode 100644 etc/images/icons/allout-widgets-light-bg/through-descender.xpm create mode 100644 lisp/allout-widgets.el diff --git a/etc/ChangeLog b/etc/ChangeLog index bf6d10ec255..2ab549b4606 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,12 @@ +2011-02-16 Ken Manheimer + + * etc/images/icons/allout-widgets-dark-bg, + etc/images/icons/allout-widgets-light-bg: Icons for new + allout-widgets.el. + + * etc/images/icons/README: Include coypright and GPL 3 license for + new icons. + 2011-02-16 Michael Albinus * NEWS: Add soap-client.el and soap-inspect.el. diff --git a/etc/images/icons/README b/etc/images/icons/README index 7855f401bb1..b11b88781e8 100644 --- a/etc/images/icons/README +++ b/etc/images/icons/README @@ -15,3 +15,52 @@ Files: hicolor/16x16/apps/emacs22.png hicolor/24x24/apps/emacs22.png Author: Andrew Zhilin Copyright (C) 2005-2011 Free Software Foundation, Inc. License: GNU General Public License version 3 or later (see COPYING) + +Files: allout-widgets-dark-bg/closed.png + allout-widgets-dark-bg/closed.xpm + allout-widgets-dark-bg/empty.png + allout-widgets-dark-bg/empty.xpm + allout-widgets-dark-bg/encrypted-locked.png + allout-widgets-dark-bg/encrypted-locked.xpm + allout-widgets-dark-bg/encrypted-unlocked.png + allout-widgets-dark-bg/encrypted-unlocked.xpm + allout-widgets-dark-bg/end-connector.png + allout-widgets-dark-bg/end-connector.xpm + allout-widgets-dark-bg/extender-connector.png + allout-widgets-dark-bg/extender-connector.xpm + allout-widgets-dark-bg/leaf.png + allout-widgets-dark-bg/leaf.xpm + allout-widgets-dark-bg/mid-connector.png + allout-widgets-dark-bg/mid-connector.xpm + allout-widgets-dark-bg/opened.png + allout-widgets-dark-bg/opened.xpm + allout-widgets-dark-bg/skip-descender.png + allout-widgets-dark-bg/skip-descender.xpm + allout-widgets-dark-bg/through-descender.png + allout-widgets-dark-bg/through-descender.xpm + allout-widgets-light-bg/closed.png + allout-widgets-light-bg/closed.xpm + allout-widgets-light-bg/empty.png + allout-widgets-light-bg/empty.xpm + allout-widgets-light-bg/encrypted-locked.png + allout-widgets-light-bg/encrypted-locked.xpm + allout-widgets-light-bg/encrypted-unlocked.png + allout-widgets-light-bg/encrypted-unlocked.xpm + allout-widgets-light-bg/end-connector.png + allout-widgets-light-bg/end-connector.xpm + allout-widgets-light-bg/extender-connector.png + allout-widgets-light-bg/extender-connector.xpm + allout-widgets-light-bg/leaf.png + allout-widgets-light-bg/leaf.xpm + allout-widgets-light-bg/mid-connector.png + allout-widgets-light-bg/mid-connector.xpm + allout-widgets-light-bg/opened.png + allout-widgets-light-bg/opened.xpm + allout-widgets-light-bg/skip-descender.png + allout-widgets-light-bg/skip-descender.xpm + allout-widgets-light-bg/through-descender.png + allout-widgets-light-bg/through-descender.xpm + +Author: Ken Manheimer +Copyright (C) 2011 Free Software Foundation, Inc. +License: GNU General Public License version 3 or later (see COPYING) diff --git a/etc/images/icons/allout-widgets-dark-bg/closed.png b/etc/images/icons/allout-widgets-dark-bg/closed.png new file mode 100644 index 0000000000000000000000000000000000000000..b49fd4ad6c9b3f573b77d325229eace44e6b8156 GIT binary patch literal 232 zcmVP)`8+35KMSi*(&bEL|Wpw2DbaO!D&o%+Hu4 z`fAim422AePCqHPw*hrE6lw>P#OgK;YCfT9CX};du(1LuH z5p1f902a$V0I92S=_Y`#Jbx`7!SasFsvk;E0AL(^Upu9)2A@R0tO!uHy@um_0`LJy ixed!{NaFV2FL(eL+c~)zK=ccW=TAz_#XXL=YTR`&qj|SpqpLHBUtHa?zZ%b|AlK9O*o`n_ h!1xSgB%Q-#2Di(++hA2b{2{VT&dv_^;s z6L19J7}BlQyZ2d=;Y^LS%kwkE1@dV#XX!BIsCao6&9^q0z}vAQKcjoL zx7KWAJqKb6Mw<&;$UU Cw@-@z literal 0 HcmV?d00001 diff --git a/etc/images/icons/allout-widgets-dark-bg/encrypted-unlocked.xpm b/etc/images/icons/allout-widgets-dark-bg/encrypted-unlocked.xpm new file mode 100644 index 00000000000..2baa1e81211 --- /dev/null +++ b/etc/images/icons/allout-widgets-dark-bg/encrypted-unlocked.xpm @@ -0,0 +1,26 @@ +/* XPM */ +static char *dummy[]={ +"10 17 6 1", +". c None", +"c c #333300", +"a c #666600", +"b c #999933", +"# c #999966", +"d c #ffff00", +"..........", +"..........", +"..........", +"...####...", +"..#a#a###.", +"..a#...##.", +".a#.....#.", +".##.......", +"..##......", +"b###c###bc", +"bddddddddc", +"#d#ddddddc", +"#d#ddddddc", +"b##ddddd#c", +"#ddddddddc", +"cccccccccc", +".........."}; diff --git a/etc/images/icons/allout-widgets-dark-bg/end-connector.png b/etc/images/icons/allout-widgets-dark-bg/end-connector.png new file mode 100644 index 0000000000000000000000000000000000000000..696c17ea9a93c5d48911e1788cb21012a11312bc GIT binary patch literal 107 zcmeAS@N?(olHy`uVBq!ia0vp^+(0bI!3JVI47&}aj67W&Lo_BP|M>skp4ljF_m>;> zC594dNeYZTK1W|qll|ZCJLlv7dY{5cB9ou=1Rg!Yz%b*muG^Bl3u!>z44$rjF6*2U FngC|dBys=% literal 0 HcmV?d00001 diff --git a/etc/images/icons/allout-widgets-dark-bg/end-connector.xpm b/etc/images/icons/allout-widgets-dark-bg/end-connector.xpm new file mode 100644 index 00000000000..511d3a4015c --- /dev/null +++ b/etc/images/icons/allout-widgets-dark-bg/end-connector.xpm @@ -0,0 +1,22 @@ +/* XPM */ +static char *dummy[]={ +"11 17 2 1", +". c None", +"# c #ada5c6", +"....#......", +"....#......", +"....#......", +"....#......", +"....#......", +"....#......", +"....#......", +"....##.....", +".....######", +"...........", +"...........", +"...........", +"...........", +"...........", +"...........", +"...........", +"..........."}; diff --git a/etc/images/icons/allout-widgets-dark-bg/extender-connector.png b/etc/images/icons/allout-widgets-dark-bg/extender-connector.png new file mode 100644 index 0000000000000000000000000000000000000000..8559f4884d04824043d8c0422c395a88efa51bb1 GIT binary patch literal 92 zcmeAS@N?(olHy`uVBq!ia0vp^+(0bI!3JVI47&}als#P>Lo_BP|M~ylo_S+KXU5dU qT^AWn?@B%1$(M2LqQ}DSBnCY{PV<(mWpjbb89ZJ6T-G@yGywomW*l<> literal 0 HcmV?d00001 diff --git a/etc/images/icons/allout-widgets-dark-bg/extender-connector.xpm b/etc/images/icons/allout-widgets-dark-bg/extender-connector.xpm new file mode 100644 index 00000000000..cd9ecc4c5f2 --- /dev/null +++ b/etc/images/icons/allout-widgets-dark-bg/extender-connector.xpm @@ -0,0 +1,22 @@ +/* XPM */ +static char *dummy[]={ +"11 17 2 1", +". c None", +"# c #ada5c6", +"...........", +"...........", +"...........", +"...........", +"...........", +"...........", +"...........", +"...........", +"###########", +"...........", +"...........", +"...........", +"...........", +"...........", +"...........", +"...........", +"..........."}; diff --git a/etc/images/icons/allout-widgets-dark-bg/leaf.png b/etc/images/icons/allout-widgets-dark-bg/leaf.png new file mode 100644 index 0000000000000000000000000000000000000000..e2d7b189e849eaf6a7539e87d17b5c07682c16c4 GIT binary patch literal 211 zcmV;^04)EBP)yjeP@@-QC5WdhShNfFf0){P7QW(eVZKJycCch0CgMc)Ph==xx0 zn@Unj@>K#e^JQ7cIg@inRZ-Pl(~UueLkIx$eGfngfngY$CJzxggzJnkGELKS97o$t z(1O>qxq}v5@Af3_j+wct9>ViHAGXoKyQ)&k&+sQf)j#h*?(cj7gBRbtLrB2&yYv76 N002ovPDHLkV1lr2S6l!9 literal 0 HcmV?d00001 diff --git a/etc/images/icons/allout-widgets-dark-bg/leaf.xpm b/etc/images/icons/allout-widgets-dark-bg/leaf.xpm new file mode 100644 index 00000000000..f25bf40a258 --- /dev/null +++ b/etc/images/icons/allout-widgets-dark-bg/leaf.xpm @@ -0,0 +1,33 @@ +/* XPM */ +static char *dummy[]={ +"16 21 9 1", +". c None", +"a c #737373", +"b c #7b7b7b", +"# c #808080", +"c c #848484", +"d c #8c8c8c", +"e c #949494", +"f c #9c9c9c", +"g c #a5a5a5", +"................", +"................", +"................", +"................", +"................", +"................", +"...#####........", +"..#abbcc#.......", +".#abbccdd#......", +"#abbccddee#.....", +"#bbccddeef#.....", +"#bccddeefg#.....", +".#cddeefg#......", +"..#deefg#.......", +"...#####........", +"................", +"................", +"................", +"................", +"................", +"................"}; diff --git a/etc/images/icons/allout-widgets-dark-bg/mid-connector.png b/etc/images/icons/allout-widgets-dark-bg/mid-connector.png new file mode 100644 index 0000000000000000000000000000000000000000..5ad503ed54db79d44a75657ea0984dde697bb09f GIT binary patch literal 125 zcmeAS@N?(olHy`uVBq!ia0vp^+(0bI!3JVI47&}aTs&PILo_BP|M>skp4ljF_m>;> zC594dNeYZTK1W|qll|ZCJBM|4LckPNWi#Fg(e=?~f9gS;z;g$d2`o>FNw}fS#t}}+Y*oUYz)V4 zbbi^*zvQ}v_36;<`<9%xiTzk}q(3?0XkEnqFq0RDl6J_4?btBo!@Xmdwc7vq3aL2i zZ4uMlzL)z(+23Q8Dk&d$o@cNZ*SN4wX{qF5ofNWvruhDQ%eZ+u;^qP!$l&Sf=d#Wz Gp$PzLZBq0A literal 0 HcmV?d00001 diff --git a/etc/images/icons/allout-widgets-dark-bg/opened.xpm b/etc/images/icons/allout-widgets-dark-bg/opened.xpm new file mode 100644 index 00000000000..e86fd9ecf7e --- /dev/null +++ b/etc/images/icons/allout-widgets-dark-bg/opened.xpm @@ -0,0 +1,25 @@ +/* XPM */ +static char *dummy[]={ +"10 17 5 1", +". c None", +"a c #000080", +"b c #63c639", +"c c #ada5c6", +"# c #ffff00", +"..........", +"..........", +"..........", +"..........", +"#.......#a", +"#ba...ab#a", +"#ba...ab#a", +"#bccccab#a", +"#bacccab#a", +"#bbacabb#a", +"##bacab##a", +"a##bbb##a.", +".a#####a..", +"..a###a...", +"...a#a....", +"....c.....", +"....c....."}; diff --git a/etc/images/icons/allout-widgets-dark-bg/skip-descender.png b/etc/images/icons/allout-widgets-dark-bg/skip-descender.png new file mode 100644 index 0000000000000000000000000000000000000000..6e3cb00160fd0f44a11200b79e263e6f7732b2ac GIT binary patch literal 84 zcmeAS@N?(olHy`uVBq!ia0vp^+(0bK!3HEJ6o{M!QqrC-jv*QolmGnxZ_m83p)+IZ i;x2d5eywG#Nesc~nAI=KbSwudWAJqKb6Mw<&;$T7P8VYU literal 0 HcmV?d00001 diff --git a/etc/images/icons/allout-widgets-dark-bg/skip-descender.xpm b/etc/images/icons/allout-widgets-dark-bg/skip-descender.xpm new file mode 100644 index 00000000000..26ae40d57d5 --- /dev/null +++ b/etc/images/icons/allout-widgets-dark-bg/skip-descender.xpm @@ -0,0 +1,21 @@ +/* XPM */ +static char *dummy[]={ +"11 17 1 1", +". c None", +"...........", +"...........", +"...........", +"...........", +"...........", +"...........", +"...........", +"...........", +"...........", +"...........", +"...........", +"...........", +"...........", +"...........", +"...........", +"...........", +"..........."}; diff --git a/etc/images/icons/allout-widgets-dark-bg/through-descender.png b/etc/images/icons/allout-widgets-dark-bg/through-descender.png new file mode 100644 index 0000000000000000000000000000000000000000..93410e033400c241c481a9cbf1dd65fb760e2b84 GIT binary patch literal 92 zcmeAS@N?(olHy`uVBq!ia0vp^+(0bK!3HEJ6o{M!Qp%n#jv*QolYjjGZ_jKLxBJVD q`VvElv?K+_9xb_0n^iMjbupSuQdHtno9qu%&fw|l=d#Wzp$P!xb{Ojb literal 0 HcmV?d00001 diff --git a/etc/images/icons/allout-widgets-dark-bg/through-descender.xpm b/etc/images/icons/allout-widgets-dark-bg/through-descender.xpm new file mode 100644 index 00000000000..7f375b4fd6c --- /dev/null +++ b/etc/images/icons/allout-widgets-dark-bg/through-descender.xpm @@ -0,0 +1,22 @@ +/* XPM */ +static char *dummy[]={ +"11 17 2 1", +". c None", +"# c #ada5c6", +"....#......", +"....#......", +"....#......", +"....#......", +"....#......", +"....#......", +"....#......", +"....#......", +"....#......", +"....#......", +"....#......", +"....#......", +"....#......", +"....#......", +"....#......", +"....#......", +"....#......"}; diff --git a/etc/images/icons/allout-widgets-light-bg/closed.png b/etc/images/icons/allout-widgets-light-bg/closed.png new file mode 100644 index 0000000000000000000000000000000000000000..591a11adbb01485f9bae18d1c401978ee65d3cf5 GIT binary patch literal 212 zcmeAS@N?(olHy`uVBq!ia0vp^oIotd!3-oVPL*8&QuYBpA+GVetmbF3==vI!4>XR!)78&q Iol`;+0J%wN5C8xG literal 0 HcmV?d00001 diff --git a/etc/images/icons/allout-widgets-light-bg/closed.xpm b/etc/images/icons/allout-widgets-light-bg/closed.xpm new file mode 100644 index 00000000000..20710b42822 --- /dev/null +++ b/etc/images/icons/allout-widgets-light-bg/closed.xpm @@ -0,0 +1,24 @@ +/* XPM */ +static char *dummy[]={ +"9 17 4 1", +". c None", +"# c #00ff00", +"b c #00ffff", +"a c #606060", +".........", +".........", +".........", +"######...", +"aaaaaa#..", +".bbbbaa#.", +"....bbaa#", +"..aa..baa", +"aaaaa..ba", +"..aa..baa", +"....bbaa#", +".bbbbaa#.", +"aaaaaa#..", +"######...", +".........", +".........", +"........."}; diff --git a/etc/images/icons/allout-widgets-light-bg/empty.png b/etc/images/icons/allout-widgets-light-bg/empty.png new file mode 100644 index 0000000000000000000000000000000000000000..1c02d26ea41b342ea80cbcadd58c7993eeb39376 GIT binary patch literal 214 zcmeAS@N?(olHy`uVBq!ia0vp^AhsX}GmyOe_w02bWgp-Z;`$#4XlQ5v$}r%Ng$ozy z*ZTmCVk`;r3ubV5b|VeQarJa@4B?oWoS?vDU}U&?!=}cFH!=wfDTPG^1&oXnj`Ais ziZDegFr9hQw9-ZFspE>&2d%RY95}#kKE1Iq-XXvvqGiKshI9E$>1lRrnScf|c)I$z JtaD0e0suteYSsV% literal 0 HcmV?d00001 diff --git a/etc/images/icons/allout-widgets-light-bg/empty.xpm b/etc/images/icons/allout-widgets-light-bg/empty.xpm new file mode 100644 index 00000000000..0ed70256f3e --- /dev/null +++ b/etc/images/icons/allout-widgets-light-bg/empty.xpm @@ -0,0 +1,24 @@ +/* XPM */ +static char *dummy[]={ +"10 17 4 1", +". c None", +"# c #00ff00", +"b c #00ffff", +"a c #606060", +"..........", +"..........", +"..........", +"...######.", +"..#aaaaaa.", +".#aabbbb..", +"#aabb.....", +"aab..aa...", +"abaaaaa...", +"aab..aa...", +"#aabb.....", +".#aabbbb..", +"..#aaaaaa.", +"...######.", +"..........", +"..........", +".........."}; diff --git a/etc/images/icons/allout-widgets-light-bg/encrypted-locked.png b/etc/images/icons/allout-widgets-light-bg/encrypted-locked.png new file mode 100755 index 0000000000000000000000000000000000000000..a6bc3e99a7a860f5f5c176eff02d9ab0174f3b9b GIT binary patch literal 210 zcmV;@04@KCP)!1xSgB%Q-#2Di(++hA2b{2{VT&dv_^;s z6L19J7}BlQyZ2d=;Y^LS%kwkE1@dV#XX!BIsCao6&9^q0z}vAQKcjoL zx7KWAJqKb6Mw<&;$UU Cw@-@z literal 0 HcmV?d00001 diff --git a/etc/images/icons/allout-widgets-light-bg/encrypted-unlocked.xpm b/etc/images/icons/allout-widgets-light-bg/encrypted-unlocked.xpm new file mode 100644 index 00000000000..2baa1e81211 --- /dev/null +++ b/etc/images/icons/allout-widgets-light-bg/encrypted-unlocked.xpm @@ -0,0 +1,26 @@ +/* XPM */ +static char *dummy[]={ +"10 17 6 1", +". c None", +"c c #333300", +"a c #666600", +"b c #999933", +"# c #999966", +"d c #ffff00", +"..........", +"..........", +"..........", +"...####...", +"..#a#a###.", +"..a#...##.", +".a#.....#.", +".##.......", +"..##......", +"b###c###bc", +"bddddddddc", +"#d#ddddddc", +"#d#ddddddc", +"b##ddddd#c", +"#ddddddddc", +"cccccccccc", +".........."}; diff --git a/etc/images/icons/allout-widgets-light-bg/end-connector.png b/etc/images/icons/allout-widgets-light-bg/end-connector.png new file mode 100644 index 0000000000000000000000000000000000000000..b865b40bfeb120ca84c2b45aecfffd35ea499908 GIT binary patch literal 111 zcmeAS@N?(olHy`uVBq!ia0vp^+(0bI!3-pA?3cX+QfvV}A+G=b|8Hn$NIG+QDo}*6 zB*-tA!Qt7BG$2RZ)5S4_V`g#!1CtvY%K|Cssmx3~CTt8G)eHg*>=~6nB@CXfelF{r G5}E*x7#cbN literal 0 HcmV?d00001 diff --git a/etc/images/icons/allout-widgets-light-bg/end-connector.xpm b/etc/images/icons/allout-widgets-light-bg/end-connector.xpm new file mode 100644 index 00000000000..0c9c1c7820d --- /dev/null +++ b/etc/images/icons/allout-widgets-light-bg/end-connector.xpm @@ -0,0 +1,22 @@ +/* XPM */ +static char *dummy[]={ +"11 17 2 1", +". c None", +"# c #606060", +"....#......", +"....#......", +"....#......", +"....#......", +"....#......", +"....#......", +"....#......", +"....##.....", +".....######", +"...........", +"...........", +"...........", +"...........", +"...........", +"...........", +"...........", +"..........."}; diff --git a/etc/images/icons/allout-widgets-light-bg/extender-connector.png b/etc/images/icons/allout-widgets-light-bg/extender-connector.png new file mode 100644 index 0000000000000000000000000000000000000000..4023a456776af7ce1577e04c46085e8495940c39 GIT binary patch literal 105 zcmeAS@N?(olHy`uVBq!ia0vp^+(0bI!3-pA?3cX+QfvV}A+G=b|8Hn$NIG+QDo}*6 zB*-tA!Qt7BG>}?P7sn8enaK$Y3=>=!qM}(DSoIiq&K|j|1e9d(boFyt=akR{04ft3 AumAu6 literal 0 HcmV?d00001 diff --git a/etc/images/icons/allout-widgets-light-bg/extender-connector.xpm b/etc/images/icons/allout-widgets-light-bg/extender-connector.xpm new file mode 100644 index 00000000000..36ea8f93093 --- /dev/null +++ b/etc/images/icons/allout-widgets-light-bg/extender-connector.xpm @@ -0,0 +1,22 @@ +/* XPM */ +static char *dummy[]={ +"11 17 2 1", +". c None", +"# c #606060", +"...........", +"...........", +"...........", +"...........", +"...........", +"...........", +"...........", +"...........", +"###########", +"...........", +"...........", +"...........", +"...........", +"...........", +"...........", +"...........", +"..........."}; diff --git a/etc/images/icons/allout-widgets-light-bg/leaf.png b/etc/images/icons/allout-widgets-light-bg/leaf.png new file mode 100755 index 0000000000000000000000000000000000000000..e2d7b189e849eaf6a7539e87d17b5c07682c16c4 GIT binary patch literal 211 zcmV;^04)EBP)yjeP@@-QC5WdhShNfFf0){P7QW(eVZKJycCch0CgMc)Ph==xx0 zn@Unj@>K#e^JQ7cIg@inRZ-Pl(~UueLkIx$eGfngfngY$CJzxggzJnkGELKS97o$t z(1O>qxq}v5@Af3_j+wct9>ViHAGXoKyQ)&k&+sQf)j#h*?(cj7gBRbtLrB2&yYv76 N002ovPDHLkV1lr2S6l!9 literal 0 HcmV?d00001 diff --git a/etc/images/icons/allout-widgets-light-bg/leaf.xpm b/etc/images/icons/allout-widgets-light-bg/leaf.xpm new file mode 100755 index 00000000000..f25bf40a258 --- /dev/null +++ b/etc/images/icons/allout-widgets-light-bg/leaf.xpm @@ -0,0 +1,33 @@ +/* XPM */ +static char *dummy[]={ +"16 21 9 1", +". c None", +"a c #737373", +"b c #7b7b7b", +"# c #808080", +"c c #848484", +"d c #8c8c8c", +"e c #949494", +"f c #9c9c9c", +"g c #a5a5a5", +"................", +"................", +"................", +"................", +"................", +"................", +"...#####........", +"..#abbcc#.......", +".#abbccdd#......", +"#abbccddee#.....", +"#bbccddeef#.....", +"#bccddeefg#.....", +".#cddeefg#......", +"..#deefg#.......", +"...#####........", +"................", +"................", +"................", +"................", +"................", +"................"}; diff --git a/etc/images/icons/allout-widgets-light-bg/mid-connector.png b/etc/images/icons/allout-widgets-light-bg/mid-connector.png new file mode 100644 index 0000000000000000000000000000000000000000..658f340ca80773a0bdd7d3ceee13f85b2cd57cd5 GIT binary patch literal 115 zcmeAS@N?(olHy`uVBq!ia0vp^+(0bI!3-pA?3cX+QfvV}A+G=b|8Hn$NIG+QDo}*6 zB*-tA!Qt7BG$2RX)5S4_V`g#!1CtvY%L1v{f{}9sSvGV8PvvFcier%6yzJ&)pfUze LS3j3^P6`O+X=eZc literal 0 HcmV?d00001 diff --git a/etc/images/icons/allout-widgets-light-bg/opened.xpm b/etc/images/icons/allout-widgets-light-bg/opened.xpm new file mode 100644 index 00000000000..ce3e98fea4b --- /dev/null +++ b/etc/images/icons/allout-widgets-light-bg/opened.xpm @@ -0,0 +1,24 @@ +/* XPM */ +static char *dummy[]={ +"10 17 4 1", +". c None", +"a c #00ff00", +"b c #00ffff", +"# c #606060", +"..........", +"..........", +"..........", +"..........", +"#.......#a", +"#b.....b#a", +"#b.....b#a", +"#b####.b#a", +"#b.###.b#a", +"#bb.#.bb#a", +"##b.#.b##a", +"a##b#b##a.", +".a##b##a..", +"..a###a...", +"...a#a....", +"....#.....", +"....#....."}; diff --git a/etc/images/icons/allout-widgets-light-bg/skip-descender.png b/etc/images/icons/allout-widgets-light-bg/skip-descender.png new file mode 100644 index 0000000000000000000000000000000000000000..6e3cb00160fd0f44a11200b79e263e6f7732b2ac GIT binary patch literal 84 zcmeAS@N?(olHy`uVBq!ia0vp^+(0bK!3HEJ6o{M!QqrC-jv*QolmGnxZ_m83p)+IZ i;x2d5eywG#Nesc~nAI=KbSwudWAJqKb6Mw<&;$T7P8VYU literal 0 HcmV?d00001 diff --git a/etc/images/icons/allout-widgets-light-bg/skip-descender.xpm b/etc/images/icons/allout-widgets-light-bg/skip-descender.xpm new file mode 100644 index 00000000000..26ae40d57d5 --- /dev/null +++ b/etc/images/icons/allout-widgets-light-bg/skip-descender.xpm @@ -0,0 +1,21 @@ +/* XPM */ +static char *dummy[]={ +"11 17 1 1", +". c None", +"...........", +"...........", +"...........", +"...........", +"...........", +"...........", +"...........", +"...........", +"...........", +"...........", +"...........", +"...........", +"...........", +"...........", +"...........", +"...........", +"..........."}; diff --git a/etc/images/icons/allout-widgets-light-bg/through-descender.png b/etc/images/icons/allout-widgets-light-bg/through-descender.png new file mode 100644 index 0000000000000000000000000000000000000000..bdf08b80193a0f69aab412598cb02b9fb4dd38bd GIT binary patch literal 105 zcmeAS@N?(olHy`uVBq!ia0vp^+(0bI!3-pA?3cX+QfvV}A+G=b|8Hn$NIG+QDo}*6 zB*-tA!Qt7BG>}?P7sn8enaK$ZOm1u}5{Gga*cUShO%`>04wPi@boFyt=akR{021jM A)&Kwi literal 0 HcmV?d00001 diff --git a/etc/images/icons/allout-widgets-light-bg/through-descender.xpm b/etc/images/icons/allout-widgets-light-bg/through-descender.xpm new file mode 100644 index 00000000000..d94c6f675c4 --- /dev/null +++ b/etc/images/icons/allout-widgets-light-bg/through-descender.xpm @@ -0,0 +1,22 @@ +/* XPM */ +static char *dummy[]={ +"11 17 2 1", +". c None", +"# c #606060", +"....#......", +"....#......", +"....#......", +"....#......", +"....#......", +"....#......", +"....#......", +"....#......", +"....#......", +"....#......", +"....#......", +"....#......", +"....#......", +"....#......", +"....#......", +"....#......", +"....#......"}; diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b6cbc91fb37..fafb931b3c7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,9 @@ 2011-02-16 Ken Manheimer + * allout-widgets.el: New allout extension that shows allout + outline structure with graphical widgets. 'allout-widgets' + customize group is an 'allout' subgroup, for easy discovery. + * allout.el: Include PGP and GnuPG in Keywords, and other commentary refinements. (allout-abbreviate-flattened-numbering): Rename to diff --git a/lisp/allout-widgets.el b/lisp/allout-widgets.el new file mode 100644 index 00000000000..1d2523f2026 --- /dev/null +++ b/lisp/allout-widgets.el @@ -0,0 +1,2365 @@ +;; allout-widgets.el --- Show allout outline structure with graphical widgets. + +;; Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Ken Manheimer + +;; Author: Ken Manheimer +;; Maintainer: Ken Manheimer +;; Version: 1.0 +;; Created: Dec 2005 +;; Version: 1.0 +;; Keywords: outlines +;; Website: http://myriadicity.net/Sundry/EmacsAllout + +;;; Commentary: + +;; This is an allout outline-mode add-on that highlights outline structure +;; with graphical widgets. +;; +;; To activate, customize `allout-widgets-auto-activation'. You can also +;; invoke allout-widgets-mode in a particular allout buffer. When +;; auto-enabled, you can inhibit widget operation in particular allout +;; buffers by setting the variable `allout-widgets-mode-inhibit' non-nil in +;; that file's buffer. Use emacs *file local variables* to generally +;; inhibit for a file. +;; +;; See the `allout-widgets-mode' docstring for more details. +;; +;; Info about allout and allout-widgets development are available at +;; http://myriadicity.net/Sundry/EmacsAllout +;; +;; The graphics include: +;; +;; - icons for item bullets, varying to distinguish whether the item either +;; lacks any subitems, the subitems are currently collapsed within the +;; item, or the item is currently expanded. +;; +;; - guide lines connecting item bullet-icons with those of their subitems. +;; +;; - cue area between the bullet-icon and the start of the body headline, +;; for item numbering, encryption indicator, and distinctive bullets. +;; +;; The bullet-icon and guide line graphics provide keybindings and mouse +;; bindings for easy outline navigation and exposure control, extending +;; outline hot-spot navigation (see `allout-mode' docstring for details). +;; +;; Developers note: Our use of emacs widgets is unconventional. We +;; decorate existing text rather than substituting for it, to +;; piggy-back on existing allout operation. This employs the C-coded +;; efficiencies of widget-apply, widget-get, and widget-put, along +;; with the basic object-oriented organization of widget-create, to +;; systematically couple overlays, graphics, and other features with +;; allout-governed text. + +;;;_: Code (structured with comments that delinieate an allout outline) + +;;;_ : General Environment +(require 'allout) +(require 'widget) +(require 'wid-edit) + +(eval-when-compile + (progn + (require 'overlay) + (require 'cl) + )) + +;;;_ : internal variables needed before user-customization variables +;;; In order to enable activation of allout-widgets-mode via customization, +;;; allout-widgets-auto-activation uses a setting function. That function +;;; is invoked when the customization variable definition is evaluated, +;;; during file load, so the involved code must reside above that +;;; definition in the file. +;;;_ = allout-widgets-mode +(defvar allout-widgets-mode nil + "Allout mode enhanced with graphical widgets.") +(make-variable-buffer-local 'allout-widgets-mode) + +;;;_ : USER CUSTOMIZATION VARIABLES and incidental functions: +;;;_ > defgroup allout-widgets +;;;###autoload +(defgroup allout-widgets nil + "Allout extension that highlights outline structure graphically. + +Customize `allout-widgets-auto-activation' to activate allout-widgets +with allout-mode." + :group 'allout) +;;;_ > defgroup allout-widgets-developer +(defgroup allout-widgets-developer nil + "Settings for development of allout widgets extension." + :group 'allout-widgets) +;;;_ ; some functions a bit early, for allout-auto-activation dependency: +;;;_ > allout-widgets-mode-enable +(defun allout-widgets-mode-enable () + "Enable allout-widgets-mode in allout-mode buffers. + +See `allout-widgets-mode-inhibit' for per-file/per-buffer +inhibition of allout-widgets-mode." + (add-hook 'allout-mode-off-hook 'allout-widgets-mode-off) + (add-hook 'allout-mode-on-hook 'allout-widgets-mode-on) + t) +;;;_ > allout-widgets-mode-disable +(defun allout-widgets-mode-disable () + "Disable allout-widgets-mode in allout-mode buffers. + +See `allout-widgets-mode-inhibit' for per-file/per-buffer +inhibition of allout-widgets-mode." + (remove-hook 'allout-mode-off-hook 'allout-widgets-mode-off) + (remove-hook 'allout-mode-on-hook 'allout-widgets-mode-on) + t) +;;;_ > allout-widgets-setup (varname value) +;;;###autoload +(defun allout-widgets-setup (varname value) + "Commission or decommision allout-widgets-mode along with allout-mode. + +Meant to be used by customization of `allout-widgets-auto-activation'." + (set-default varname value) + (if allout-widgets-auto-activation + (allout-widgets-mode-enable) + (allout-widgets-mode-disable))) +;;;_ = allout-widgets-auto-activation +;;;###autoload +(defcustom allout-widgets-auto-activation nil + "Activate to enable allout icon graphics wherever allout mode is active. + +Also enable `allout-auto-activation' for this to take effect upon +visiting an outline. + +When this is set you can disable allout widgets in select files +by setting `allout-widgets-mode-inhibit' + +Instead of setting `allout-widgets-auto-activation' you can +explicitly invoke `allout-widgets-mode' in allout buffers where +you want allout widgets operation. + +See `allout-widgets-mode' for allout widgets mode features." + :type 'boolean + :group 'allout-widgets + :set 'allout-widgets-setup + ) +;; ;;;_ = allout-widgets-allow-unruly-edits +;; (defcustom allout-widgets-allow-unruly-edits nil +;; "*Control whether manual edits are restricted to maintain outline integrity. + +;; When nil, manual edits must either be within an item's body or encompass +;; one or more items completely - eg, killing topics as entities, rather than +;; deleting from the middle of one to the middle of another. + +;; If you only occasionally need to make unrestricted change, you can set this +;; variable in the specific buffer using set-variable, or just deactivate +;; `allout-mode' temporarily. You can customize this to always allow unruly +;; edits, but you will be able to create outlines that are unnavigable in +;; principle, and not just for allout's navigation and exposure mechanisms." +;; :type 'boolean +;; :group allout-widgets) +;; (make-variable-buffer-local 'allout-widgets-allow-unruly-edits) +;;;_ = allout-widgets-auto-activation - below, for eval-order dependencies +;;;_ = allout-widgets-icons-dark-subdir +(defcustom allout-widgets-icons-dark-subdir "icons/allout-widgets-dark-bg/" + "Directory on `image-load-path' holding allout icons for dark backgrounds." + :type 'string + :group 'allout-widgets) +;;;_ = allout-widgets-icons-light-subdir +(defcustom allout-widgets-icons-light-subdir "icons/allout-widgets-light-bg/" + "Directory on `image-load-path' holding allout icons for light backgrounds." + :type 'string + :group 'allout-widgets) +;;;_ = allout-widgets-icon-types +(defcustom allout-widgets-icon-types '(xpm png) + "File extensions for the icon graphic format types, in order of preference." + :type '(repeat symbol) + :group 'allout-widgets) + +;;;_ . Decoration format +;;;_ = allout-widgets-theme-dark-background +(defcustom allout-widgets-theme-dark-background "allout-dark-bg" + "Identify the outline's icon theme to use with a dark background." + :type '(string) + :group 'allout-widgets) +;;;_ = allout-widgets-theme-light-background +(defcustom allout-widgets-theme-light-background "allout-light-bg" + "Identify the outline's icon theme to use with a light background." + :type '(string) + :group 'allout-widgets) +;;;_ = allout-widgets-item-image-properties-emacs +(defcustom allout-widgets-item-image-properties-emacs + '(:ascent center :mask (heuristic t)) + "*Default properties item widget images in mainline Emacs." + :type 'plist + :group 'allout-widgets) +;;;_ = allout-widgets-item-image-properties-xemacs +(defcustom allout-widgets-item-image-properties-xemacs + nil + "*Default properties item widget images in XEmacs." + :type 'plist + :group 'allout-widgets) +;;;_ . Developer +;;;_ = allout-widgets-run-unit-tests-on-load +(defcustom allout-widgets-run-unit-tests-on-load nil + "*When non-nil, unit tests will be run at end of loading allout-widgets. + +Generally, allout widgets code developers are the only ones who'll want to +set this. + +\(If set, this makes it an even better practice to exercise changes by +doing byte-compilation with a repeat count, so the file is loaded after +compilation.) + +See `allout-widgets-run-unit-tests' to see what's run." + :type 'boolean + :group 'allout-widgets-developer) +;;;_ = allout-widgets-time-decoration-activity +(defcustom allout-widgets-time-decoration-activity nil + "*Retain timing info of the last cooperative redecoration. + +The details are retained as the value of +`allout-widgets-last-decoration-timing'. + +Generally, allout widgets code developers are the only ones who'll want to +set this." + :type 'boolean + :group 'allout-widgets-developer) +;;;_ = allout-widgets-hook-error-post-time 0 +(defcustom allout-widgets-hook-error-post-time 0 + "*Amount of time to sit showing hook error messages. + +0 is minimal, or nil to not post to the message area. + +This is for debugging purposes." + :type 'integer + :group 'allout-widgets-developer) +;;;_ = allout-widgets-maintain-tally nil +(defcustom allout-widgets-maintain-tally nil + "*If non-nil, maintain a collection of widgets, `allout-widgets-tally'. + +This is for debugging purposes. + +The tally shows the total number of item widgets in the current +buffer, and tracking increases as new widgets are added and +decreases as obsolete widgets are garbage collected." + :type 'boolean + :group 'allout-widgets-developer) +(defvar allout-widgets-tally nil + "Hash-table of existing allout widgets, for debugging. + +Table is maintained iff `allout-widgets-maintain-tally' is non-nil. + +The table contents will be out of sync if any widgets are created +or deleted while this variable is nil.") +(make-variable-buffer-local 'allout-widgets-tally) +;;;_ > allout-widgets-tally-string +(defun allout-widgets-tally-string () + "Return a string giving the number of tracked widgets, or empty string if not tracking. + +The string is formed for appending to the allout-mode mode-line lighter. + +An empty string is also returned if tracking is inhibited or +widgets are locally inhibited. + +The number varies according to the evanescence of objects on a + hash table with weak keys, so tracking of widget erasures is often delayed." + (when (and allout-widgets-maintain-tally (not allout-widgets-mode-inhibit)) + (format ":%s" (hash-table-count allout-widgets-tally)))) +;;;_ = allout-widgets-track-decoration nil +(defcustom allout-widgets-track-decoration nil + "*If non-nil, show cursor position of each item decoration. + +This is for debugging purposes, and generally set at need in a +buffer rather than as a prevailing configuration \(but it's handy +to publicize it by making it a customization variable\)." + :type 'boolean + :group 'allout-widgets-developer) +(make-variable-buffer-local 'allout-widgets-track-decoration) + +;;;_ : Mode context - variables, hookup, and hooks +;;;_ . internal mode variables +;;;_ , Mode activation and environment +;;;_ = allout-widgets-version +(defvar allout-widgets-version "1.0" + "Version of currently loaded allout-widgets extension.") +;;;_ > allout-widgets-version +(defun allout-widgets-version (&optional here) + "Return string describing the loaded outline version." + (interactive "P") + (let ((msg (concat "Allout Outline Widgets Extension v " + allout-widgets-version))) + (if here (insert msg)) + (message "%s" msg) + msg)) +;;;_ = allout-widgets-mode-inhibit +(defvar allout-widgets-mode-inhibit nil + "Inhibit `allout-widgets-mode' from activating widgets. + +This also inhibits automatic adjustment of widgets to track allout outline +changes. + +You can use this as a file local variable setting to disable +allout widgets enhancements in selected buffers while generally +enabling widgets by customizing `allout-widgets-auto-activation'. + +In addition, you can invoked `allout-widgets-mode' allout-mode +buffers where this is set to enable and disable widget +enhancements, directly.") +;;;###autoload +(put 'allout-widgets-mode-inhibit 'safe-local-variable + (if (fboundp 'booleanp) 'booleanp '(lambda (x) (member x '(t nil))))) +(make-variable-buffer-local 'allout-widgets-mode-inhibit) +;;;_ = allout-inhibit-body-modification-hook +(defvar allout-inhibit-body-modification-hook nil + "Override de-escaping of text-prefixes in item bodies during specific changes. + +This is used by `allout-buffer-modification-handler' to signal such changes +to `allout-body-modification-handler', and is always reset by +`allout-post-command-business'.") +(make-variable-buffer-local 'allout-inhibit-body-modification-hook) +;;;_ = allout-widgets-icons-cache +(defvar allout-widgets-icons-cache nil + "Cache allout icon images, as an association list. + +`allout-fetch-icon-image' uses this cache transparently, keying +images with lists containing the name of the icon directory \(as +found on the `load-path') and the icon name. + +Set this variable to `nil' to empty the cache, and have it replenish from the +filesystem.") +;;;_ = allout-widgets-unset-inhibit-read-only +(defvar allout-widgets-unset-inhibit-read-only nil + "Tell `allout-widgets-post-command-business' to unset `inhibit-read-only'. + +Used by `allout-graphics-modification-handler'") +;;;_ = allout-widgets-reenable-before-change-handler +(defvar allout-widgets-reenable-before-change-handler nil + "Tell `allout-widgets-post-command-business' to reequip the handler. + +Necessary because the handler sometimes deliberately raises an +error, causing it to be disabled.") +;;;_ , State for hooks +;;;_ = allout-unresolved-body-mod-workroster +(defvar allout-unresolved-body-mod-workroster (make-hash-table :size 16) + "List of body-overlays that did before-change business but not after-change. + +See `allout-post-command-business' and `allout-body-modification-handler'.") +;;;_ = allout-structure-unruly-deletion-message +(defvar allout-structure-unruly-deletion-message + "Unruly edit prevented -- +To change the bullet character: \\[allout-rebullet-current-heading] +To promote this item: \\[allout-shift-out] +To demote it: \\[allout-shift-in] +To delete it and offspring: \\[allout-kill-topic] +See \\[describe-mode] for many more options." + "Informative message presented on improper editing of outline structure. + +The structure includes the guides lines, bullet, and bullet cue.") +;;;_ = allout-widgets-changes-record +(defvar allout-widgets-changes-record nil + "Record outline changes for processing by post-command hook. + +Entries on the list are lists whose first element is a symbol indicating +the change type and subsequent elements are data specific to that change +type. Specifically: + + 'exposure `allout-exposure-from' `allout-exposure-to' `allout-exposure-flag' + +The changes are recorded in reverse order, with new values pushed +onto the front.") +(make-variable-buffer-local 'allout-widgets-changes-record) +;;;_ = allout-widgets-undo-exposure-record +(defvar allout-widgets-undo-exposure-record nil + "Record outline undo traces for processing by post-command hook. + +The changes are recorded in reverse order, with new values pushed +onto the front.") +(make-variable-buffer-local 'allout-widgets-undo-exposure-record) +;;;_ = allout-widgets-last-hook-error +(defvar allout-widgets-last-hook-error nil + "String holding last error string, for debugging purposes.") +;;;_ = allout-widgets-adjust-message-length-threshold 100 +(defvar allout-widgets-adjust-message-length-threshold 100 + "Display \"Adjusting widgets\" message above this number of pending changes." + ) +;;;_ = allout-widgets-adjust-message-size-threshold 10000 +(defvar allout-widgets-adjust-message-size-threshold 10000 + "Display \"Adjusting widgets\" message above this size of pending changes." + ) +;;;_ = allout-doing-exposure-undo-processor nil +(defvar allout-undo-exposure-in-progress nil + "Maintained true during `allout-widgets-exposure-undo-processor'") +;;;_ , Widget-specific outline text format +;;;_ = allout-escaped-prefix-regexp +(defvar allout-escaped-prefix-regexp "" + "*Regular expression for body text that would look like an item prefix if +not altered with an escape sequence.") +(make-variable-buffer-local 'allout-escaped-prefix-regexp) +;;;_ , Widget element formatting +;;;_ = allout-item-icon-keymap +(defvar allout-item-icon-keymap + (let ((km (make-sparse-keymap))) + (dolist (digit '("0" "1" "2" "3" + "4" "5" "6" "7" "8" "9")) + (define-key km digit 'digit-argument)) + (define-key km "-" 'negative-argument) +;; (define-key km [(return)] 'allout-tree-expand-command) +;; (define-key km [(meta return)] 'allout-toggle-torso-command) +;; (define-key km [(down-mouse-1)] 'allout-item-button-click) +;; (define-key km [(down-mouse-2)] 'allout-toggle-torso-event-command) + ;; Override underlying mouse-1 and mouse-2 bindings in icon territory: + (define-key km [(mouse-1)] (lambda () (interactive) nil)) + (define-key km [(mouse-2)] (lambda () (interactive) nil)) + + ;; Catchall, handles actual keybindings, dynamically doing keymap lookups: + (define-key km [t] 'allout-item-icon-key-handler) + + km) + "General tree-node key bindings.") +;;;_ = allout-item-body-keymap +(defvar allout-item-body-keymap + (let ((km (make-sparse-keymap)) + (local-map (current-local-map))) +;; (define-key km [(control return)] 'allout-tree-expand-command) +;; (define-key km [(meta return)] 'allout-toggle-torso-command) + ;; XXX We need to reset this per buffer's mode; we do so in + ;; allout-widgets-mode. + (if local-map + (set-keymap-parent km local-map)) + + km) + "General key bindings for the text content of outline items.") +(make-variable-buffer-local 'allout-item-body-keymap) +;;;_ = allout-body-span-category +(defvar allout-body-span-category nil + "Symbol carrying allout body-text overlay properties.") +;;;_ = allout-cue-span-keymap +(defvar allout-cue-span-keymap + (let ((km (make-sparse-keymap))) + (set-keymap-parent km allout-item-icon-keymap) + km) + "Keymap used in the item cue area - the space between the icon and headline.") +;;;_ = allout-escapes-category +(defvar allout-escapes-category nil + "Symbol for category of text property used to hide escapes of prefix-like +text in allout item bodies.") +;;;_ = allout-guides-category +(defvar allout-guides-category nil + "Symbol carrying allout icon-guides overlay properties.") +;;;_ = allout-guides-span-category +(defvar allout-guides-span-category nil + "Symbol carrying allout icon and guide lines overlay properties.") +;;;_ = allout-icon-span-category +(defvar allout-icon-span-category nil + "Symbol carrying allout icon and guide lines overlay properties.") +;;;_ = allout-cue-span-category +(defvar allout-cue-span-category nil + "Symbol carrying common properties of the space following the outline icon. + +\(That space is used to convey selected cues indicating body qualities, +including things like: + - encryption '~' + - numbering '#' + - indirect reference '@' + - distinctive bullets - see `allout-distinctive-bullets-string'.\)") +;;;_ = allout-span-to-category +(defvar allout-span-to-category + '((:guides-span . allout-guides-span-category) + (:cue-span . allout-cue-span-category) + (:icon-span . allout-icon-span-category) + (:body-span . allout-body-span-category)) + "Association list mapping span identifier to category identifier.") +;;;_ = allout-trailing-category +(defvar allout-trailing-category nil + "Symbol carrying common properties of an overlay's trailing newline.") +;;;_ , Developer +(defvar allout-widgets-last-decoration-timing nil + "Timing details for the last cooperative decoration action. + +This is maintained when `allout-widgets-time-decoration-activity' is set. + +The value is a list containing two elements: + - the elapsed time as a number of seconds + - the list of changes processed, a la `allout-widgets-changes-record'. + +When active, the value is revised each time automatic decoration activity +happens in the buffer.") +(make-variable-buffer-local 'allout-widgets-last-decoration-timing) +;;;_ . mode hookup +;;;_ > define-minor-mode allout-widgets-mode (arg) +;;;###autoload +(define-minor-mode allout-widgets-mode + "Allout-mode extension, providing graphical decoration of outline structure. + +This is meant to operate along with allout-mode, via `allout-mode-hook'. + +If optional argument ARG is greater than 0, enable. +If optional argument ARG is less than 0, disable. +Anything else, toggle between active and inactive. + +The graphics include: + +- guide lines connecting item bullet-icons with those of their subitems. + +- icons for item bullets, varying to indicate whether or not the item + has subitems, and if so, whether or not the item is expanded. + +- cue area between the bullet-icon and the start of the body headline, + for item numbering, encryption indicator, and distinctive bullets. + +The bullet-icon and guide line graphics provide keybindings and mouse +bindings for easy outline navigation and exposure control, extending +outline hot-spot navigation \(see `allout-mode')." + + :lighter nil + :keymap nil + + ;; define-minor-mode handles any provided argument according to emacs + ;; minor-mode conventions - '(elisp) Minor Mode Conventions' - and sets + ;; allout-widgets-mode accordingly *before* running the body code, so we + ;; cue on that. + (if allout-widgets-mode + ;; Activating: + (progn + (allout-add-resumptions + ;; XXX user may need say in line-truncation/hscrolling - an option + ;; that abstracts mode. + ;; truncate text lines to keep guide lines intact: + '(truncate-lines t) + ;; and enable autoscrolling to ease view of text + '(auto-hscroll-mode t) + '(line-move-ignore-fields t) + '(widget-push-button-prefix "") + '(widget-push-button-suffix "") + ;; allout-escaped-prefix-regexp depends on allout-regexp: + (list 'allout-escaped-prefix-regexp (concat "\\(\\\\\\)" + "\\(" allout-regexp "\\)"))) + (allout-add-resumptions + (list 'allout-widgets-tally allout-widgets-tally) + (list 'allout-widgets-escapes-sanitization-regexp-pair + (list (concat "\\(\n\\|\\`\\)" + allout-escaped-prefix-regexp + ) + ;; Include everything but the escape symbol. + "\\1\\3")) + ) + + (add-hook 'after-change-functions 'allout-widgets-after-change-handler + nil t) + + (allout-setup-text-properties) + (add-to-invisibility-spec '(allout-torso . t)) + (add-to-invisibility-spec 'allout-escapes) + + (if (current-local-map) + (set-keymap-parent allout-item-body-keymap (current-local-map))) + + (add-hook 'allout-exposure-change-hook + 'allout-widgets-exposure-change-recorder nil 'local) + (add-hook 'allout-structure-added-hook + 'allout-widgets-additions-recorder nil 'local) + (add-hook 'allout-structure-deleted-hook + 'allout-widgets-deletions-recorder nil 'local) + (add-hook 'allout-structure-shifted-hook + 'allout-widgets-shifts-recorder nil 'local) + (add-hook 'allout-after-copy-or-kill-hook + 'allout-widgets-after-copy-or-kill-function nil 'local) + + (add-hook 'before-change-functions 'allout-widgets-before-change-handler + nil 'local) + (add-hook 'post-command-hook 'allout-widgets-post-command-business + nil 'local) + (add-hook 'pre-command-hook 'allout-widgets-pre-command-business + nil 'local) + + ;; init the widgets tally for debugging: + (if (not allout-widgets-tally) + (setq allout-widgets-tally (make-hash-table + :test 'eq :weakness 'key))) + ;; add tally count display on minor-mode-alist just after + ;; allout-mode entry. + ;; (we use ternary condition form to keep condition simple for deletion.) + (let* ((mode-line-entry '(allout-widgets-mode-inhibit "" + (:eval (allout-widgets-tally-string)))) + (associated (assoc (car mode-line-entry) minor-mode-alist)) + ;; need location for it only if not already present: + (after (and (not associated) + (memq (assq 'allout-mode minor-mode-alist) minor-mode-alist)))) + (if after + (rplacd after (cons mode-line-entry (cdr after))))) + (allout-widgets-prepopulate-buffer) + t) + ;; Deactivating: + (let ((inhibit-read-only t) + (was-modified (buffer-modified-p))) + + (allout-widgets-undecorate-region (point-min)(point-max)) + (remove-from-invisibility-spec '(allout-torso . t)) + (remove-from-invisibility-spec 'allout-escapes) + + (remove-hook 'after-change-functions + 'allout-widgets-after-change-handler 'local) + (remove-hook 'allout-exposure-change-hook + 'allout-widgets-exposure-change-recorder 'local) + (remove-hook 'allout-structure-added-hook + 'allout-widgets-additions-recorder 'local) + (remove-hook 'allout-structure-deleted-hook + 'allout-widgets-deletions-recorder 'local) + (remove-hook 'allout-structure-shifted-hook + 'allout-widgets-shifts-recorder 'local) + (remove-hook 'allout-after-copy-or-kill-hook + 'allout-widgets-after-copy-or-kill-function 'local) + (remove-hook 'before-change-functions + 'allout-widgets-before-change-handler 'local) + (remove-hook 'post-command-hook + 'allout-widgets-post-command-business 'local) + (remove-hook 'pre-command-hook + 'allout-widgets-pre-command-business 'local) + (assq-delete-all 'allout-widgets-mode-inhibit minor-mode-alist) + (set-buffer-modified-p was-modified)))) +;;;_ > allout-widgets-mode-off +(defun allout-widgets-mode-off () + "Explicitly disable allout-widgets-mode." + (allout-widgets-mode -1)) +;;;_ > allout-widgets-mode-off +(defun allout-widgets-mode-on () + "Explicitly disable allout-widgets-mode." + (allout-widgets-mode 1)) +;;;_ > allout-setup-text-properties () +(defun allout-setup-text-properties () + "Configure category and literal text properties." + + ;; XXX body - before-change, entry, keymap + + (setplist 'allout-guides-span-category nil) + (put 'allout-guides-span-category + 'modification-hooks '(allout-graphics-modification-handler)) + (put 'allout-guides-span-category 'local-map allout-item-icon-keymap) + (put 'allout-guides-span-category 'mouse-face widget-button-face) + (put 'allout-guides-span-category 'field 'structure) +;; (put 'allout-guides-span-category 'face 'widget-button) + + (setplist 'allout-icon-span-category + (allout-widgets-copy-list (symbol-plist + 'allout-guides-span-category))) + (put 'allout-icon-span-category 'field 'structure) + + ;; XXX for body text we're instead going to use the buffer-wide + ;; resources, like before/after-change-functions hooks and the + ;; buffer's key map. that way we won't have to do painful provisions + ;; to fixup things after edits, catch outlier interstitial + ;; characters, like newline and empty lines after hidden subitems, + ;; etc. + (setplist 'allout-body-span-category nil) + (put 'allout-body-span-category 'evaporate t) + (put 'allout-body-span-category 'local-map allout-item-body-keymap) + ;;(put 'allout-body-span-category + ;; 'modification-hooks '(allout-body-modification-handler)) + ;;(put 'allout-body-span-category 'field 'body) + + (setplist 'allout-cue-span-category nil) + (put 'allout-cue-span-category 'evaporate t) + (put 'allout-cue-span-category + 'modification-hooks '(allout-body-modification-handler)) + (put 'allout-cue-span-category 'local-map allout-cue-span-keymap) + (put 'allout-cue-span-category 'mouse-face widget-button-face) + (put 'allout-cue-span-category 'pointer 'arrow) + (put 'allout-cue-span-category 'field 'structure) + + (setplist 'allout-trailing-category nil) + (put 'allout-trailing-category 'evaporate t) + (put 'allout-trailing-category 'local-map allout-item-body-keymap) + + (setplist 'allout-escapes-category nil) + (put 'allout-escapes-category 'invisible 'allout-escapes) + (put 'allout-escapes-category 'evaporate t)) +;;;_ > allout-widgets-prepopulate-buffer () +(defun allout-widgets-prepopulate-buffer () + "Step over the current buffers exposed items to do initial widgetizing." + (if (not allout-widgets-mode-inhibit) + (save-excursion + (goto-char (point-min)) + (while (allout-next-visible-heading 1) + (when (not (widget-at (point))) + (allout-get-or-create-item-widget)))))) +;;;_ . settings context +;;;_ = allout-container-item +(defvar allout-container-item-widget nil + "A widget for the current outline's overarching container as an item. + +The item has settings \(of the file/connection\) and maybe a body, but no +icon/bullet.") +(make-variable-buffer-local 'allout-container-item-widget) +;;;_ . Hooks and hook helpers +;;;_ , major command-loop business: +;;;_ > allout-widgets-pre-command-business (&optional recursing) +(defun allout-widgets-pre-command-business (&optional recursing) + "Handle actions pending before allout-mode activity." +) +;;;_ > allout-widgets-post-command-business (&optional recursing) +(defun allout-widgets-post-command-business (&optional recursing) + "Handle actions pending after any allout-mode commands. + +Optional RECURSING is for internal use, to limit recursion." + ;; - check changed text for nesting discontinuities and escape anything + ;; that's: (1) asterisks at bol or (2) excessively nested. + (condition-case failure + + (when (and (boundp 'allout-mode) allout-mode) + + (if allout-widgets-unset-inhibit-read-only + (setq inhibit-read-only nil + allout-widgets-unset-inhibit-read-only nil)) + + (when allout-widgets-reenable-before-change-handler + (add-hook 'before-change-functions + 'allout-widgets-before-change-handler + nil 'local) + (setq allout-widgets-reenable-before-change-handler nil)) + + (when (or allout-widgets-undo-exposure-record + allout-widgets-changes-record) + (let* ((debug-on-signal t) + (debug-on-error t) + ;; inhibit recording new undo records when processing + ;; effects of undo-exposure: + (debugger 'allout-widgets-hook-error-handler) + (adjusting-message " Adjusting widgets...") + (replaced-message (allout-widgets-adjusting-message + adjusting-message)) + (start-time (current-time))) + + (if allout-widgets-undo-exposure-record + ;; inhibit undo recording iff undoing exposure stuff. + ;; XXX we might need to inhibit per respective + ;; change-record, rather than assuming that some undo + ;; activity during a command is all undo activity. + (let ((buffer-undo-list t)) + (allout-widgets-exposure-undo-processor) + (allout-widgets-changes-dispatcher)) + (allout-widgets-exposure-undo-processor) + (allout-widgets-changes-dispatcher)) + + (if allout-widgets-time-decoration-activity + (setq allout-widgets-last-decoration-timing + (list (allout-elapsed-time-seconds (current-time) + start-time) + allout-widgets-changes-record))) + + (setq allout-widgets-changes-record nil) + + (if replaced-message + (if (stringp replaced-message) + (message replaced-message) + (message ""))))) + + ;; Detect undecorated items, eg during isearch into previously + ;; unexposed topics, and decorate "economically". Some + ;; undecorated stuff is often exposed, to reduce lag, but the + ;; item containing the cursor is decorated. We constrain + ;; recursion to avoid being trapped by unexpectedly undecoratable + ;; items. + (when (and (not recursing) + (not (allout-current-decorated-p)) + (or (not (equal (allout-depth) 0)) + (not allout-container-item-widget))) + (let ((buffer-undo-list t)) + (allout-widgets-exposure-change-recorder + allout-recent-prefix-beginning allout-recent-prefix-end nil) + (allout-widgets-post-command-business 'recursing))) + + ;; Detect and rectify fouled outline structure - decorated item + ;; not at beginning of line. + (let ((this-widget (or (widget-at (point)) + ;; XXX we really should be checking across + ;; edited span, not just point and point+1 + (and (not (eq (point) (point-max))) + (widget-at (1+ (point)))))) + inserted-at) + (save-excursion + (if (and this-widget + (goto-char (widget-get this-widget :from)) + (not (bolp))) + (if (not + (condition-case err + (yes-or-no-p + (concat "Misplaced item won't be recognizable " + " as part of outline - rectify? ")) + (quit nil))) + (progn + (if (allout-hidden-p (max (1- (point)) 1)) + (save-excursion + (goto-char (max (1- (point)) 1)) + (allout-show-to-offshoot))) + (allout-widgets-undecorate-item this-widget)) + ;; expose any hidden intervening items, so resulting + ;; position is clear: + (setq inserted-at (point)) + (allout-unprotected (insert-before-markers "\n")) + (forward-char -1) + ;; ensure the inserted newline is visible: + (allout-flag-region inserted-at (1+ inserted-at) nil) + (allout-widgets-post-command-business 'recursing) + (message (concat "outline structure corrected - item" + " moved to beginning of new line")) + ;; preserve cursor position in some cases: + (if (and inserted-at + (> (point) inserted-at)) + (forward-char -1))))))) + + (error + ;; zero work list so we don't get stuck futily retrying. + ;; error recording done by allout-widgets-hook-error-handler. + (setq allout-widgets-changes-record nil)))) +;;;_ , major change handlers: +;;;_ > allout-widgets-before-change-handler +(defun allout-widgets-before-change-handler (beg end) + "Business to be done before changes in a widgetized allout outline." + ;; protect against unruly edits to structure: + (cond + (undo-in-progress (when (eq (get-text-property beg 'category) + 'allout-icon-span-category) + (save-excursion + (goto-char beg) + (let* ((item-widget (allout-get-item-widget))) + (if item-widget + (allout-widgets-exposure-undo-recorder + item-widget)))))) + (inhibit-read-only t) + ((not (and (boundp 'allout-mode) allout-mode)) t) + ((equal this-command 'quoted-insert) t) + ((not (text-property-any beg (if (equal end beg) + (min (1+ beg) (point-max)) + end) + 'field 'structure)) + t) + ((yes-or-no-p "Unruly edit of outline structure - allow? ") + (setq allout-widgets-unset-inhibit-read-only (not inhibit-read-only) + inhibit-read-only t)) + (t + ;; tell the allout-widgets-post-command-business to reestablish the hook: + (setq allout-widgets-reenable-before-change-handler t) + ;; and raise an error to prevent the edit (and disable the hook): + (error + (substitute-command-keys allout-structure-unruly-deletion-message))))) +;;;_ > allout-widgets-after-change-handler +(defun allout-widgets-after-change-handler (beg end prelength) + "Reconcile what needs to be reconciled for allout widgets after edits." + ) +;;;_ > allout-current-decorated-p () +(defun allout-current-decorated-p () + "True if the current item is not decorated" + (save-excursion + (if (allout-back-to-current-heading) + (if (> allout-recent-depth 0) + (and (allout-get-item-widget) t) + allout-container-item-widget)))) + +;;;_ > allout-widgets-hook-error-handler +(defun allout-widgets-hook-error-handler (mode args) + "Process errors which occurred in the course of command hook operation. + +We store a backtrace of the error information in the variable, +`allout-widgets-last-hook-error', unset the error handlers, and +reraise the error, so that processing continues to the +encompassing condition-case." + ;; first deconstruct special error environment so errors here propagate + ;; to encompassing condition-case: + (setq debugger 'debug + debug-on-error nil + debug-on-signal nil) + (let* ((bt (with-output-to-string (backtrace))) + (this "allout-widgets-hook-error-handler") + (header + (format "allout-widgets-last-hook-error stored, %s/%s %s %s" + this mode args + (format-time-string "%e-%b-%Y %r" (current-time))))) + ;; post to *Messages* then immediately replace with more compact notice: + (message "%s" (setq allout-widgets-last-hook-error + (format "%s:\n%s" header bt))) + (message header) (sit-for allout-widgets-hook-error-post-time) + ;; reraise the error, or one concerning this function if unexpected: + (if (equal mode 'error) + (apply 'signal args) + (error "%s: unexpected mode, %s %s" this mode args)))) +;;;_ > allout-widgets-changes-exceed-threshold-p () +(defun allout-widgets-adjusting-message (message) + "Post MESSAGE when pending are likely to make a big enough delay. + +If posting of the MESSAGE is warranted and there already is a +`current-message' in the minibuffer, the MESSAGE is appended to +the current one, and the previously pending `current-message' is +returned for later posting on completion. + +If posting of the MESSAGE is warranted, but no `current-message' +is pending, then t is returned to indicate that case. + +If posting of the MESSAGE is not warranted, then nil is returned. + +See `allout-widgets-adjust-message-length-threshold', +`allout-widgets-adjust-message-size-threshold' for message +posting threshold criteria." + (if (or (> (length allout-widgets-changes-record) + allout-widgets-adjust-message-length-threshold) + ;; for size, use distance from start of first to end of last: + (let ((min (point-max)) + (max 0) + first second) + (mapc (function (lambda (entry) + (if (eq :undone-exposure (car entry)) + nil + (setq first (cadr entry) + second (caddr entry)) + (if (< (min first second) min) + (setq min (min first second))) + (if (> (max first second) max) + (setq max (max first second)))))) + allout-widgets-changes-record) + (> (- max min) allout-widgets-adjust-message-size-threshold))) + (let ((prior (current-message))) + (message (if prior (concat prior " - " message) message)) + (or prior t)))) +;;;_ > allout-widgets-changes-dispatcher () +(defun allout-widgets-changes-dispatcher () + "Dispatch CHANGES-RECORD items to respective widgets change processors." + + (if (not allout-widgets-mode-inhibit) + (let* ((changes-record allout-widgets-changes-record) + (changes-pending (and changes-record t)) + entry + exposures + additions + deletions + shifts) + + (when changes-pending + (while changes-record + (setq entry (pop changes-record)) + (case (car entry) + (:exposed (push entry exposures)) + (:added (push entry additions)) + (:deleted (push entry deletions)) + (:shifted (push entry shifts)))) + + (if exposures + (allout-widgets-exposure-change-processor exposures)) + (if additions + (allout-widgets-additions-processor additions)) + (if deletions + (allout-widgets-deletions-processor deletions)) + (if shifts + (allout-widgets-shifts-processor shifts)))) + (when (not (equal allout-widgets-mode-inhibit 'undecorated)) + (allout-widgets-undecorate-region (point-min)(point-max)) + (setq allout-widgets-mode-inhibit 'undecorated)))) +;;;_ > allout-widgets-exposure-change-recorder (from to flag) +(defun allout-widgets-exposure-change-recorder (from to flag) + "Record allout exposure changes for tracking during post-command processing. + +Records changes in `allout-widgets-changes-record'." + (push (list :exposed from to flag) allout-widgets-changes-record)) +;;;_ > allout-widgets-exposure-change-processor (changes) +(defun allout-widgets-exposure-change-processor (changes) + "Widgetize and adjust item widgets tracking allout outline exposure changes. + +Generally invoked via `allout-exposure-change-hook'." + + (let ((changes (sort changes (function (lambda (this next) + (< (cadr this) (cadr next)))))) + ;; have to distinguish between concealing and exposing so that, eg, + ;; `allout-expose-topic's mix is handled properly. + handled-expose + handled-conceal + covered + deactivate-mark) + + (dolist (change changes) + (let (handling + (from (cadr change)) + bucket got + (to (caddr change)) + (flag (cadddr change)) + parent) + + ;; swap from and to: + (if (< to from) (setq bucket to + to from + from bucket)) + + ;; have we already handled exposure changes in this region? + (setq handling (if flag 'handled-conceal 'handled-expose) + got (allout-range-overlaps from to (symbol-value handling)) + covered (car got)) + (set handling (cadr got)) + + (when (not covered) + (save-excursion + (goto-char from) + (cond + + ;; collapsing: + (flag + (allout-widgets-undecorate-region from to) + (allout-beginning-of-current-line) + (let ((widget (allout-get-item-widget))) + (if (not widget) + (allout-get-or-create-item-widget) + (widget-apply widget :redecorate)))) + + ;; expanding: + (t + (while (< (point) to) + (allout-beginning-of-current-line) + (setq parent (allout-get-item-widget)) + (if (not parent) + (setq parent (allout-get-or-create-item-widget)) + (widget-apply parent :redecorate)) + (allout-next-visible-heading 1) + (if (widget-get parent :has-subitems) + (allout-redecorate-visible-subtree parent)) + (if (> (point) to) + ;; subtree may be well beyond to - incorporate in ranges: + (setq handled-expose + (allout-range-overlaps from (point) handled-expose) + covered (car handled-expose) + handled-expose (cadr handled-expose))) + (allout-next-visible-heading 1)))))))))) + +;;;_ > allout-widgets-additions-recorder (from to) +(defun allout-widgets-additions-recorder (from to) + "Record allout item additions for tracking during post-command processing. + +Intended for use on `allout-structure-added-hook'. + +FROM point at the start of the first new item and TO is point at the start +of the last one. + +Records changes in `allout-widgets-changes-record'." + (push (list :added from to) allout-widgets-changes-record)) +;;;_ > allout-widgets-additions-processor (changes) +(defun allout-widgets-additions-processor (changes) + "Widgetize and adjust items tracking allout outline structure additions. + +Dispatched by `allout-widgets-post-command-business' in response to +:added entries recorded by `allout-widgets-additions-recorder'." + (save-excursion + (let (handled + covered) + (dolist (change changes) + (let ((from (cadr change)) + bucket + (to (caddr change))) + (if (< to from) (setq bucket to to from from bucket)) + ;; have we already handled exposure changes in this region? + (setq handled (allout-range-overlaps from to handled) + covered (car handled) + handled (cadr handled)) + (when (not covered) + (goto-char from) + ;; Prior sibling and parent can both be affected. + (if (allout-ascend) + (allout-redecorate-visible-subtree + (allout-get-or-create-item-widget 'redecorate))) + (if (< (point) from) + (goto-char from)) + (while (and (< (point) to) (not (eobp))) + (allout-beginning-of-current-line) + (allout-redecorate-visible-subtree + (allout-get-or-create-item-widget)) + (allout-next-visible-heading 1)) + (if (> (point) to) + ;; subtree may be well beyond to - incorporate in ranges: + (setq handled (allout-range-overlaps from (point) handled) + covered (car handled) + handled (cadr handled))))))))) + +;;;_ > allout-widgets-deletions-recorder (depth from) +(defun allout-widgets-deletions-recorder (depth from) + "Record allout item deletions for tracking during post-command processing. + +Intended for use on `allout-structure-deleted-hook'. + +DEPTH is the depth of the deleted subtree, and FROM is the point from which +the subtree was deleted. + +Records changes in `allout-widgets-changes-record'." + (push (list :deleted depth from) allout-widgets-changes-record)) +;;;_ > allout-widgets-deletions-processor (changes) +(defun allout-widgets-deletions-processor (changes) + "Adjust items tracking allout outline structure deletions. + +Dispatched by `allout-widgets-post-command-business' in response to +:deleted entries recorded by `allout-widgets-deletions-recorder'." + (save-excursion + (dolist (change changes) + (let ((depth (cadr change)) + (from (caddr change))) + (goto-char from) + (when (allout-previous-visible-heading 1) + (if (> depth 1) + (allout-ascend-to-depth (1- depth))) + (allout-redecorate-visible-subtree + (allout-get-or-create-item-widget 'redecorate))))))) + +;;;_ > allout-widgets-shifts-recorder (shifted-amount at) +(defun allout-widgets-shifts-recorder (shifted-amount at) + "Record outline subtree shifts for tracking during post-command processing. + +Intended for use on `allout-structure-shifted-hook'. + +SHIFTED-AMOUNT is the depth change and AT is the point at the start of the +subtree that's been shifted. + +Records changes in `allout-widgets-changes-record'." + (push (list :shifted shifted-amount at) allout-widgets-changes-record)) +;;;_ > allout-widgets-shifts-processor (changes) +(defun allout-widgets-shifts-processor (changes) + "Widgetize and adjust items tracking allout outline structure additions. + +Dispatched by `allout-widgets-post-command-business' in response to +:shifted entries recorded by `allout-widgets-shifts-recorder'." + (save-excursion + (dolist (change changes) + (goto-char (caddr change)) + (allout-ascend) + (allout-redecorate-visible-subtree)))) +;;;_ > allout-widgets-after-copy-or-kill-function () +(defun allout-widgets-after-copy-or-kill-function () + "Do allout-widgets processing of text just placed in the kill ring. + +Intended for use on allout-after-copy-or-kill-hook." + (if (car kill-ring) + (setcar kill-ring (allout-widgets-undecorate-text (car kill-ring))))) + +;;;_ > allout-widgets-exposure-undo-recorder (widget from-state) +(defun allout-widgets-exposure-undo-recorder (widget) + "Record outline exposure undo for tracking during post-command processing. + +Intended for use by `allout-graphics-modification-handler'. + +WIDGET is the widget being changed. + +Records changes in `allout-widgets-changes-record'." + ;; disregard the events if we're currently processing them. + (if (not allout-undo-exposure-in-progress) + (push widget allout-widgets-undo-exposure-record))) +;;;_ > allout-widgets-exposure-undo-processor () +(defun allout-widgets-exposure-undo-processor () + "Adjust items tracking undo of allout outline structure exposure. + +Dispatched by `allout-widgets-post-command-business' in response to +:undone-exposure entries recorded by `allout-widgets-exposure-undo-recorder'." + (let* ((allout-undo-exposure-in-progress t) + ;; inhibit undo recording while twiddling exposure to track undo: + (widgets allout-widgets-undo-exposure-record) + widget widget-start-marker widget-end-marker + from-state icon-start-point to-state + handled covered) + (setq allout-widgets-undo-exposure-record nil) + (save-excursion + (dolist (widget widgets) + (setq widget-start-marker (widget-get widget :from) + widget-end-marker (widget-get widget :to) + from-state (widget-get widget :icon-state) + icon-start-point (widget-apply widget :actual-position + :icon-start) + to-state (get-text-property icon-start-point + :icon-state)) + (setq handled (allout-range-overlaps widget-start-marker + widget-end-marker + handled) + covered (car handled) + handled (cadr handled)) + (when (not covered) + (goto-char (widget-get widget :from)) + (when (not (allout-hidden-p)) + ;; adjust actual exposure to that of to-state viz from-state + (cond ((and (eq to-state 'closed) (eq from-state 'opened)) + (allout-hide-current-subtree) + (allout-decorate-item-and-context widget)) + ((and (eq to-state 'opened) (eq from-state 'closed)) + (save-excursion + (dolist + (expose-to (allout-chart-exposure-contour-by-icon)) + (goto-char expose-to) + (allout-show-to-offshoot))))))))))) +;;;_ > allout-chart-exposure-contour-by-icon (&optional from-depth) +(defun allout-chart-exposure-contour-by-icon (&optional from-depth) + "Return points of subtree items to which exposure should be extended. + +The qualifying items are ones with a widget icon that is in the closed or +empty state, or items with undecorated subitems. + +The resulting list of points is in reverse order. + +Optional FROM-DEPTH is for internal use." + ;; During internal recursion, we return a pair: (at-end . result) + ;; Otherwise we just return the result. + (let ((from-depth from-depth) + start-point + at-end level-depth + this-widget + got subgot) + (if from-depth + (setq level-depth (allout-depth)) + ;; at containing item: + (setq start-point (point)) + (setq from-depth (allout-depth)) + (setq at-end (not (allout-next-heading)) + level-depth allout-recent-depth)) + + ;; traverse the level, recursing on deeper levels: + (while (and (not at-end) + (> allout-recent-depth from-depth) + (setq this-widget (allout-get-item-widget))) + (if (< level-depth allout-recent-depth) + ;; recurse: + (progn + (setq subgot (allout-chart-exposure-contour-by-icon level-depth) + at-end (car subgot) + subgot (cdr subgot)) + (if subgot (setq got (append subgot got)))) + ;; progress at this level: + (when (memq (widget-get this-widget :icon-state) '(closed empty)) + (push (point) got) + (allout-end-of-subtree)) + (setq at-end (not (allout-next-heading))))) + + ;; tailor result depending on whether or not we're a recursion: + (if (not start-point) + (cons at-end got) + (goto-char start-point) + got))) +;;;_ > allout-range-overlaps (from to ranges) +(defun allout-range-overlaps (from to ranges) + "Return a pair indicating overlap of FROM and TO subtree range in RANGES. + +First element of result indicates whether candadate range FROM, TO +overlapped any of the existing ranges. + +Second element of result is a new version of RANGES incorporating the +candidate range with overlaps consolidated. + +FROM and TO must be in increasing order, as must be the pairs in RANGES." + ;; to append to the end: (rplacd next-to-last-cdr (list 'f)) + (let (new-ranges + entry + ;; the start of the range that includes the candidate from: + included-from + ;; the end of the range that includes the candidate to: + included-to + ;; the candidates were inserted: + done) + (while (and ranges (not done)) + (setq entry (car ranges) + ranges (cdr ranges)) + + (cond + + (included-from + ;; some entry included the candidate from. + (cond ((> (car entry) to) + ;; current entry exceeds end of candidate range - done. + (push (list included-from to) new-ranges) + (push entry new-ranges) + (setq included-to to + done t)) + ((>= (cadr entry) to) + ;; current entry includes end of candidate range - done. + (push (list included-from (cadr entry)) new-ranges) + (setq included-to (cadr entry) + done t)) + ;; current entry contained in candidate range - ditch, continue: + (t nil))) + + ((> (car entry) to) + ;; current entry start exceeds candidate end - done, placed as new entry + (push (list from to) new-ranges) + (push entry new-ranges) + (setq included-to to + done t)) + + ((>= (car entry) from) + ;; current entry start is above candidate start, but not above + ;; candidate end (by prior case). + (setq included-from from) + ;; now we have to check on whether this entry contains to, or continue: + (when (>= (cadr entry) to) + ;; current entry contains only candidate end - done: + (push (list included-from (cadr entry)) new-ranges) + (setq included-to (cadr entry) + done t)) + ;; otherwise, we will continue to look for placement of candidate end. + ) + + ((>= (cadr entry) to) + ;; current entry properly contains candidate range. + (push entry new-ranges) + (setq included-from (car entry) + included-to (cadr entry) + done t)) + + ((>= (cadr entry) from) + ;; current entry contains start of candidate range. + (setq included-from (car entry))) + + (t + ;; current entry is below the candidate range. + (push entry new-ranges)))) + + (cond ((and included-from included-to) + ;; candidates placed. + nil) + ((not (or included-from included-to)) + ;; candidates found no place, must be at the end: + (push (list from to) new-ranges)) + (included-from + ;; candidate start placed but end not: + (push (list included-from to) new-ranges)) + ;; might be included-to and not included-from, indicating new entry. + ) + (setq new-ranges (nreverse new-ranges)) + (if ranges (setq new-ranges (append new-ranges ranges))) + (list (if included-from t) new-ranges))) +;;;_ > allout-test-range-overlaps () +(defun allout-test-range-overlaps () + "allout-range-overlaps unit tests." + (let* (ranges + got + (try (lambda (from to) + (setq got (allout-range-overlaps from to ranges)) + (setq ranges (cadr got)) + got))) +;; ;; biggie: +;; (setq ranges nil) +;; ;; ~ .02 to .1 seconds for just repeated listing args instead of funcall +;; ;; ~ 13 seconds for doing repeated funcall +;; (message "time-trial: %s, resulting size %s" +;; (time-trial +;; '(let ((size 10000) +;; doing) +;; (random t) +;; (dotimes (count size) +;; (setq doing (random size)) +;; (funcall try doing (+ doing (random 5))) +;; ;;(list doing (+ doing (random 5))) +;; ))) +;; (length ranges)) +;; (sit-for 2) + + ;; fresh: + (setq ranges nil) + (assert (equal (funcall try 3 5) '(nil ((3 5))))) + ;; add range at end: + (assert (equal (funcall try 10 12) '(nil ((3 5) (10 12))))) + ;; add range at beginning: + (assert (equal (funcall try 1 2) '(nil ((1 2) (3 5) (10 12))))) + ;; insert range somewhere in the middle: + (assert (equal (funcall try 7 9) '(nil ((1 2) (3 5) (7 9) (10 12))))) + ;; consolidate some: + (assert (equal (funcall try 5 8) '(t ((1 2) (3 9) (10 12))))) + ;; add more: + (assert (equal (funcall try 15 17) '(nil ((1 2) (3 9) (10 12) (15 17))))) + ;; add more: + (assert (equal (funcall try 20 22) + '(nil ((1 2) (3 9) (10 12) (15 17) (20 22))))) + ;; encompass more: + (assert (equal (funcall try 4 11) '(t ((1 2) (3 12) (15 17) (20 22))))) + ;; encompass all: + (assert (equal (funcall try 2 25) '(t ((1 25))))) + + ;; fresh slate: + (setq ranges nil) + (assert (equal (funcall try 20 25) '(nil ((20 25))))) + (assert (equal (funcall try 30 35) '(nil ((20 25) (30 35))))) + (assert (equal (funcall try 26 28) '(nil ((20 25) (26 28) (30 35))))) + (assert (equal (funcall try 15 20) '(t ((15 25) (26 28) (30 35))))) + (assert (equal (funcall try 10 30) '(t ((10 35))))) + (assert (equal (funcall try 5 6) '(nil ((5 6) (10 35))))) + (assert (equal (funcall try 2 100) '(t ((2 100))))) + + (setq ranges nil) + )) +;;;_ > allout-widgetize-buffer (&optional doing) +(defun allout-widgetize-buffer (&optional doing) + "EXAMPLE FUNCTION. Widgetize items in buffer using allout-chart-subtree. + +We economize by just focusing on the first of local-maximum depth siblings. + +Optional DOING is for internal use - a chart of the current level, for +recursive operation." + + (interactive) + (if (not doing) + + (save-excursion + (goto-char (point-min)) + ;; Construct the chart by scanning the siblings: + (dolist (top-level-sibling (allout-chart-siblings)) + (goto-char top-level-sibling) + (let ((subchart (allout-chart-subtree))) + (if subchart + (allout-widgetize-buffer subchart))))) + + ;; save-excursion was done on recursion entry, not necessary here. + (let (have-sublists) + (dolist (sibling doing) + (when (listp sibling) + (setq have-sublists t) + (allout-widgetize-buffer sibling))) + (when (and (not have-sublists) (not (widget-at (car doing)))) + (goto-char (car doing)) + (allout-get-or-create-item-widget))))) + +;;;_ : Item widget and constructors + +;;;_ $ allout-item-widget +(define-widget 'allout-item-widget 'default + "A widget presenting an allout outline item." + + 'button nil + ;; widget-field-at respects this to get item if 'field is unused. + ;; we don't use field to avoid collision with end-of-line, etc, on which + ;; allout depends. + 'real-field nil + + ;; data fields: + + + ;; tailor the widget for a specific item + :create 'allout-decorate-item-and-context + :value-delete 'allout-widgets-undecorate-item + ;; Not Yet Converted (from original, tree-widget stab) + :expander 'allout-tree-event-dispatcher ; get children when nil :args + :expander-p 'identity ; always engage the :expander + :action 'allout-tree-widget-action + ;; :notify "when item changes" + + ;; force decoration of item but not context, unless already done this tick: + :redecorate 'allout-redecorate-item + :last-decorated-tick nil + ;; recognize the actual situation of the item's text: + :parse-item 'allout-parse-item-at-point + ;; decorate the entirety of the item, sans offspring: + :decorate-item-span 'allout-decorate-item-span + ;; decorate the various item elements: + :decorate-guides 'allout-decorate-item-guides + :decorate-icon 'allout-decorate-item-icon + :decorate-cue 'allout-decorate-item-cue + :decorate-body 'allout-decorate-item-body + :actual-position 'allout-item-actual-position + + ;; Layout parameters: + :is-container nil ; is this actually the encompassing file/connection? + + :from nil ; item beginning - marker + :to nil ; item end - marker + :span-overlay nil ; overlay by which actual postion is determined + + ;; also serves as guide-end: + :icon-start nil + :icon-end nil + :distinctive-start nil + ;; also serves as cue-start: + :distinctive-end nil + ;; also serves as cue-end: + :body-start nil + :body-end nil + :depth nil + :has-subitems nil + :was-has-subitems 'init + :expanded nil + :was-expanded 'init + :brief nil + :was-brief 'init + + :does-encrypt nil ; pending encryption when :is-encrypted false. + :is-encrypted nil + + ;; the actual location of the item text: + :location 'allout-item-location + + :button-keymap allout-item-icon-keymap ; XEmacs + :keymap allout-item-icon-keymap ; Emacs + + ;; Element regions: + :guides-span nil + :icon-span nil + :cue-span nil + :bullet nil + :was-bullet nil + :body-span nil + + :body-brevity-p 'allout-body-brevity-p + + ;; :guide-column-flags indicate (in reverse order) whether or not the + ;; item's ancestor at the depth corresponding to the column has a + ;; subsequent sibling - ie, whether or not the corresponding column needs + ;; a descender line to connect that ancestor with its sibling. + :guide-column-flags nil + :was-guide-column-flags 'init + + ;; ie, has subitems: + :populous-p 'allout-item-populous-p + :help-echo 'allout-tree-widget-help-echo + ) +;;;_ > allout-new-item-widget () +(defsubst allout-new-item-widget () + "create a new item widget, not yet situated anywhere." + (if allout-widgets-maintain-tally + ;; all the extra overhead is incurred only when doing the + ;; maintenance, except the condition, which can't be avoided. + (let ((widget (widget-convert 'allout-item-widget))) + (puthash widget nil allout-widgets-tally) + widget) + (widget-convert 'allout-item-widget))) +;;;_ : Item decoration +;;;_ > allout-decorate-item-and-context (item-widget &optional redecorate +;;; blank-container parent) +(defun allout-decorate-item-and-context (item-widget &optional redecorate + blank-container parent) + "Create or adjust widget decorations for ITEM-WIDGET and neighbors at point. + +The neighbors include its siblings and parent. + +ITEM-WIDGET can be a created or converted allout-item-widget. + +If you're only trying to get or create a widget for an item, use +`allout-get-or-create-item-widget'. If you have the item-widget, applying +:redecorate will do the right thing. + +Optional BLANK-CONTAINER is for internal use. It is used to fabricate a +container widget for an empty-bodied container, in the course of decorating +a proper \(non-container\) item which starts at the beginning of the file. + +Optional REDECORATE causes redecoration of the item-widget and +its siblings, even if already decorated in this cycle of the command loop. + +Optional PARENT, when provided, bypasses some navigation and computation +necessary to obtain the parent of the items being processed. + +We return the item-widget corresponding to the item at point." + + (when (or redecorate + (not (equal (widget-get item-widget :last-decorated-tick) + allout-command-counter))) + (let* ((allout-inhibit-body-modification-hook t) + (was-modified (buffer-modified-p)) + (was-point (point)) + prefix-start + (is-container (or blank-container + (not (setq prefix-start (allout-goto-prefix))) + (< was-point prefix-start))) + ;; steady-point (set in two steps) is reliable across parent + ;; widget-creation. + (steady-point (progn (if is-container (goto-char 1)) + (point-marker))) + (steady-point (progn (set-marker-insertion-type steady-point t) + steady-point)) + (parent (and (not is-container) + (allout-get-or-create-parent-widget))) + parent-flags parent-depth + successor-sibling + body + doing-item + sub-item-widget + depth + reverse-siblings-chart + (buffer-undo-list t)) + + ;; At this point the parent is decorated and parent-flags indicate + ;; its guide lines. We will iterate over the siblings according to a + ;; chart we create at the start, and going from last to first so we + ;; don't have to worry about text displacement caused by widgetizing. + + (if is-container + (progn (widget-put item-widget :is-container t) + (setq reverse-siblings-chart (list 1))) + (goto-char (widget-apply parent :actual-position :from)) + (if (widget-get parent :is-container) + ;; `allout-goto-prefix' will go to first non-container item: + (allout-goto-prefix) + (allout-next-heading)) + (setq depth (allout-recent-depth)) + (setq reverse-siblings-chart (list allout-recent-prefix-beginning)) + (while (allout-next-sibling) + (push allout-recent-prefix-beginning reverse-siblings-chart))) + + (dolist (doing-at reverse-siblings-chart) + (goto-char doing-at) + (when allout-widgets-track-decoration + (sit-for 0)) + + (setq doing-item (if (= doing-at steady-point) + item-widget + (or (allout-get-item-widget) + (allout-new-item-widget)))) + + (when (or redecorate (not (equal (widget-get doing-item + :last-decorated-tick) + allout-command-counter))) + (widget-apply doing-item :parse-item t blank-container) + (widget-apply doing-item :decorate-item-span) + + (widget-apply doing-item :decorate-guides + parent (and successor-sibling t)) + (widget-apply doing-item :decorate-icon) + (widget-apply doing-item :decorate-cue) + (widget-apply doing-item :decorate-body) + + (widget-put doing-item :last-decorated-tick allout-command-counter)) + + (setq successor-sibling doing-at)) + + (set-buffer-modified-p was-modified) + (goto-char steady-point) + ;; must null the marker or the buffer gets clogged with impedence: + (set-marker steady-point nil) + + item-widget))) +;;;_ > allout-redecorate-item (item) +(defun allout-redecorate-item (item-widget) + "Resituate ITEM-WIDGET decorations, disregarding context. + +Use this to redecorate only the item, when you know that it's +situation with respect to siblings, parent, and offspring is +unchanged from its last decoration. Use +`allout-decorate-item-and-context' instead to reassess and adjust +relevent context, when suitable." + (if (not (equal (widget-get item-widget :last-decorated-tick) + allout-command-counter)) + (let ((was-modified (buffer-modified-p)) + (buffer-undo-list t)) + (widget-apply item-widget :parse-item) + (widget-apply item-widget :decorate-guides) + (widget-apply item-widget :decorate-icon) + (widget-apply item-widget :decorate-cue) + (widget-apply item-widget :decorate-body) + (set-buffer-modified-p was-modified)))) +;;;_ > allout-redecorate-visible-subtree (&optional parent-widget +;;; depth chart) +(defun allout-redecorate-visible-subtree (&optional parent-widget depth chart) + "Redecorate all visible items in subtree at point. + +Optional PARENT-WIDGET is for optimization, when the parent +widget is already available. + +Optional DEPTH restricts the excursion depth of covered. + +Optional CHART is for internal recursion, to carry a chart of the +target items. + +Point is left at the last sibling in the visible subtree." + ;; using a treatment that takes care of all the siblings on a level, we + ;; only need apply it to the first sibling on the level, and we can + ;; collect and pass the parent of the lower levels to recursive calls as + ;; we go. + (let ((parent-widget + (if (and parent-widget (widget-apply parent-widget + :actual-position :from)) + (progn (goto-char (widget-apply parent-widget + :actual-position :from)) + parent-widget) + (let ((got (allout-get-item-widget))) + (if got + (allout-decorate-item-and-context got 'redecorate) + (allout-get-or-create-item-widget 'redecorate))))) + (pending-chart (or chart (allout-chart-subtree nil 'visible))) + item-widget + previous-sibling-point + previous-sibling + recent-sibling-point) + (setq pending-chart (nreverse pending-chart)) + (dolist (sibling-point pending-chart) + (cond ((integerp sibling-point) + (when (not previous-sibling-point) + (goto-char sibling-point) + (if (setq item-widget (allout-get-item-widget nil)) + (allout-decorate-item-and-context item-widget 'redecorate + nil parent-widget) + (allout-get-or-create-item-widget))) + (setq previous-sibling-point sibling-point + recent-sibling-point sibling-point)) + ((listp sibling-point) + (if (or (not depth) + (> depth 1)) + (allout-redecorate-visible-subtree + (if (not previous-sibling-point) + ;; containment discontinuity - sigh + parent-widget + (allout-get-or-create-item-widget 'redecorate)) + (if depth (1- depth)) + sibling-point))))) + (if (and recent-sibling-point (< (point) recent-sibling-point)) + (goto-char recent-sibling-point)))) +;;;_ > allout-parse-item-at-point (item-widget &optional at-beginning +;;; blank-container) +(defun allout-parse-item-at-point (item-widget &optional at-beginning + blank-container) + "Set widget ITEM-WIDGET layout parameters per item-at-point's actual layout. + +If optional AT-BEGINNING is t, then point is assumed to be at the start of +the item prefix. + +If optional BLANK-CONTAINER is true, then the parameters of a container +which has an empty body are set. \(Though the body is blank, the object +may have subitems.\)" + + ;; Uncomment this sit-for to notice where decoration is happening: +;; (sit-for .1) + (let* ((depth (allout-depth)) + (depth (if blank-container 0 depth)) + (is-container (or blank-container (zerop depth))) + + (does-encrypt (and (not is-container) + (allout-encrypted-type-prefix))) + (is-encrypted (and does-encrypt (allout-encrypted-topic-p))) + (icon-end allout-recent-prefix-end) + (icon-start (1- icon-end)) + body-start + body-end + bullet + has-subitems + (contents-depth (1+ depth)) + ) + (widget-put item-widget :depth depth) + (if is-container + + (progn + (widget-put item-widget :from (allout-set-boundary-marker + :from (point-min) + (widget-get item-widget :from))) + (widget-put item-widget :icon-end nil) + (widget-put item-widget :icon-start nil) + (setq body-start (widget-put item-widget :body-start 1))) + + ;; not container: + + (widget-put item-widget :from (allout-set-boundary-marker + :from (if at-beginning + (point) + allout-recent-prefix-beginning) + (widget-get item-widget :from))) + (widget-put item-widget :icon-start icon-start) + (widget-put item-widget :icon-end icon-end) + (when does-encrypt + (widget-put item-widget :does-encrypt t) + (widget-put item-widget :is-encrypted is-encrypted)) + + ;; cue area: + (setq body-start icon-end) + (widget-put item-widget :bullet (setq bullet (allout-get-bullet))) + (if (equal (char-after body-start) ? ) + (setq body-start (1+ body-start))) + (widget-put item-widget :body-start body-start) + ) + + ;; Both container and regular items: + + ;; :body-end (doesn't include a trailing blank line, if any) - + (widget-put item-widget :body-end (setq body-end + (if blank-container + 1 + (allout-end-of-entry)))) + + (widget-put item-widget :to (allout-set-boundary-marker + :to (if blank-container + (point-min) + (or (allout-pre-next-prefix) + (goto-char (point-max)))) + (widget-get item-widget :to))) + (widget-put item-widget :has-subitems + (setq has-subitems + (and + ;; has a subsequent item: + (not (= body-end (point-max))) + ;; subsequent item is deeper: + (< depth (setq contents-depth (allout-recent-depth)))))) + ;; note :expanded - true if widget item's content is currently visible? + (widget-put item-widget :expanded + (and has-subitems + ;; subsequent item is or isn't visible: + (save-excursion + (goto-char allout-recent-prefix-beginning) + (not (allout-hidden-p))))))) +;;;_ > allout-set-boundary-marker (boundary position &optional current-marker) +(defun allout-set-boundary-marker (boundary position &optional current-marker) + "Set or create item widget BOUNDARY type marker at POSITION. + +Optional CURRENT-MARKER is the marker currently being used for +the boundary, if any. + +BOUNDARY type is either :from or :to, determining the marker insertion type." + (if (not position) (setq position (point))) + (if current-marker + (set-marker current-marker position) + (let ((marker (make-marker))) + ;; XXX dang - would like for :from boundary to advance after inserted + ;; text, but that would omit new header prefixes when allout + ;; relevels, etc. this competes with ad-hoc edits, which would + ;; better be omitted + (set-marker-insertion-type marker nil) + (set-marker marker position)))) +;;;_ > allout-decorate-item-span (item-widget) +(defun allout-decorate-item-span (item-widget) + "Equip the item with a span, as an entirety. + +This span is implemented so it can be used to detect displacement +of the widget in absolute terms, and provides an offset bias for +the various element spans." + + (if (and (widget-get item-widget :is-container) + ;; the only case where the span could be empty. + (eq (widget-get item-widget :from) + (widget-get item-widget :to))) + nil + (allout-item-span item-widget + (widget-get item-widget :from) + (widget-get item-widget :to)))) +;;;_ > allout-decorate-item-guides (item-widget +;;; &optional parent-widget has-successor) +(defun allout-decorate-item-guides (item-widget + &optional parent-widget has-successor) + "Add ITEM-WIDGET guide icon-prefix descender and connector text properties. + +Optional arguments provide context for deriving the guides. In +their absence, the current guide column flags are used. + +Optional PARENT-WIDGET is the widget for the item's parent item. + +Optional HAS-SUCCESSOR is true iff the item is followed by a sibling. + +We also hide the header-prefix string. + +Guides are established according to the item-widget's :guide-column-flags, +when different than :was-guide-column-flags. Changing that property and +reapplying this method will rectify the glyphs." + + (when (not (widget-get item-widget :is-container)) + (let* ((depth (widget-get item-widget :depth)) + (parent-depth (and parent-widget + (widget-get parent-widget :depth))) + (parent-flags (and parent-widget + (widget-get parent-widget :guide-column-flags))) + (parent-flags-depth (length parent-flags)) + (extender-length (- depth (+ parent-flags-depth 2))) + (flags (or (and (> depth 1) + parent-widget + (widget-put item-widget :guide-column-flags + (append (list has-successor) + (if (< 0 extender-length) + (make-list extender-length + '-)) + parent-flags))) + (widget-get item-widget :guide-column-flags))) + (was-flags (widget-get item-widget :was-guide-column-flags)) + (guides-start (widget-get item-widget :from)) + (guides-end (widget-get item-widget :icon-start)) + (position guides-start) + (increment (length allout-header-prefix)) + reverse-flags + guide-name + extenders paint-extenders + (inhibit-read-only t)) + + (when (not (equal was-flags flags)) + + (setq reverse-flags (reverse flags)) + (while reverse-flags + (setq guide-name + (cond ((null (cdr reverse-flags)) + (if (car reverse-flags) + 'mid-connector + 'end-connector)) + ((eq (car reverse-flags) '-) + ;; accumulate extenders tally, to be painted on next + ;; non-extender flag, according to the flag type. + (setq extenders (1+ (or extenders 0))) + nil) + ((car reverse-flags) + 'through-descender) + (t 'skip-descender))) + (when guide-name + (put-text-property position (setq position (+ position increment)) + 'display (allout-fetch-icon-image guide-name)) + (if (> increment 1) (setq increment 1)) + (when extenders + ;; paint extenders after a connector, else leave spaces. + (dotimes (i extenders) + (put-text-property + position (setq position (1+ position)) + 'display (allout-fetch-icon-image + (if (memq guide-name '(mid-connector end-connector)) + 'extender-connector + 'skip-descender)))) + (setq extenders nil))) + (setq reverse-flags (cdr reverse-flags))) + (widget-put item-widget :was-guide-column-flags flags)) + + (allout-item-element-span-is item-widget :guides-span + guides-start guides-end)))) +;;;_ > allout-decorate-item-icon (item-widget) +(defun allout-decorate-item-icon (item-widget) + "Add item icon glyph and distinctive bullet text properties to ITEM-WIDGET." + + (when (not (widget-get item-widget :is-container)) + (let* ((icon-start (widget-get item-widget :icon-start)) + (icon-end (widget-get item-widget :icon-end)) + (bullet (widget-get item-widget :bullet)) + (use-bullet bullet) + (was-bullet (widget-get item-widget :was-bullet)) + (distinctive (allout-distinctive-bullet bullet)) + (distinctive-start (widget-get item-widget :distinctive-start)) + (distinctive-end (widget-get item-widget :distinctive-end)) + (does-encrypt (widget-get item-widget :does-encrypt)) + (is-encrypted (and does-encrypt (widget-get item-widget + :is-encrypted))) + (expanded (widget-get item-widget :expanded)) + (has-subitems (widget-get item-widget :has-subitems)) + (inhibit-read-only t) + icon-state) + + (when (not (and (equal (widget-get item-widget :was-expanded) expanded) + (equal (widget-get item-widget :was-has-subitems) + has-subitems) + (equal (widget-get item-widget :was-does-encrypt) + does-encrypt) + (equal (widget-get item-widget :was-is-encrypted) + is-encrypted))) + + (setq icon-state + (cond (does-encrypt (if is-encrypted + 'encrypted-locked + 'encrypted-unlocked)) + (expanded 'opened) + (has-subitems 'closed) + (t 'empty))) + (put-text-property icon-start (1+ icon-start) + 'display (allout-fetch-icon-image icon-state)) + (widget-put item-widget :was-expanded expanded) + (widget-put item-widget :was-has-subitems has-subitems) + (widget-put item-widget :was-does-encrypt does-encrypt) + (widget-put item-widget :was-is-encrypted is-encrypted) + ;; preserve as a widget property to track last known: + (widget-put item-widget :icon-state icon-state) + ;; preserve as a text property to track undo: + (put-text-property icon-start icon-end :icon-state icon-state)) + (allout-item-element-span-is item-widget :icon-span + icon-start icon-end) + (when (not (string= was-bullet bullet)) + (cond ((not distinctive) + ;; XXX we strip the prior properties without even checking if + ;; the prior bullet was distinctive, because the widget + ;; provisions to convey that info is disappearing, sigh. + (remove-text-properties icon-end (1+ icon-end) '(display)) + (setq distinctive-start icon-end distinctive-end icon-end) + (widget-put item-widget :distinctive-start distinctive-start) + (widget-put item-widget :distinctive-end distinctive-end)) + + ((not (string= bullet allout-numbered-bullet)) + (setq distinctive-start icon-end distinctive-end (+ icon-end 1))) + + (does-encrypt + (setq distinctive-start icon-end distinctive-end (+ icon-end 1))) + + (t + (goto-char icon-end) + (looking-at "[0-9]+") + (setq use-bullet (buffer-substring icon-end (match-end 0))) + (setq distinctive-start icon-end + distinctive-end (match-end 0)))) + (put-text-property distinctive-start distinctive-end 'display + use-bullet) + (widget-put item-widget :was-bullet bullet) + (widget-put item-widget :distinctive-start distinctive-start) + (widget-put item-widget :distinctive-end distinctive-end))))) +;;;_ > allout-decorate-item-cue (item-widget) +(defun allout-decorate-item-cue (item-widget) + "Incorporate space between bullet icon and body to the ITEM-WIDGET." + ;; NOTE: most of the cue-area + + (when (not (widget-get item-widget :is-container)) + (let* ((cue-start (or (widget-get item-widget :distinctive-end) + (widget-get item-widget :icon-end))) + (body-start (widget-get item-widget :body-start)) + (expanded (widget-get item-widget :expanded)) + (has-subitems (widget-get item-widget :has-subitems)) + (inhibit-read-only t)) + + (allout-item-element-span-is item-widget :cue-span cue-start body-start) + (put-text-property (1- body-start) body-start 'rear-nonsticky t)))) +;;;_ > allout-decorate-item-body (item-widget &optional force) +(defun allout-decorate-item-body (item-widget &optional force) + "Incorporate item body text as part the ITEM-WIDGET. + +Optional FORCE means force reassignment of the region property." + + (let* ((allout-inhibit-body-modification-hook t) + (body-start (widget-get item-widget :body-start)) + (body-end (widget-get item-widget :body-end)) + (body-text-end body-end) + (inhibit-read-only t)) + + (allout-item-element-span-is item-widget :body-span + body-start (min (1+ body-end) (point-max)) + force))) +;;;_ > allout-item-actual-position (item-widget field) +(defun allout-item-actual-position (item-widget field) + "Return ITEM-WIDGET FIELD position taking item displacement into account." + + ;; The item's sub-element positions (:icon-end, :body-start, etc) are + ;; accurate when the item is parsed, but some offsets from the start + ;; drift with text added in the body. + ;; + ;; Rather than reparse an item with every change (inefficient), or derive + ;; every position from a distinct field marker/overlay (prohibitive as + ;; the number of items grows), we use the displacement tracking of the + ;; :span-overlay's markers, against the registered :from or :body-end + ;; (depending on whether the requested field value is before or after the + ;; item body), to bias the registered values. + ;; + ;; This is not necessary/useful when the item is being decorated, because + ;; that always must be preceeded by a fresh item parse. + + (if (not (eq field :body-end)) + (widget-get item-widget :from) + + (let* ((span-overlay (widget-get item-widget :span-overlay)) + (body-end-position (widget-get item-widget :body-end)) + (ref-marker-position (and span-overlay + (overlay-end span-overlay))) + (offset (and body-end-position span-overlay + (- (or ref-marker-position 0) + body-end-position)))) + (+ (widget-get item-widget field) (or offset 0))))) +;;;_ : Item undecoration +;;;_ > allout-widgets-undecorate-region (start end) +(defun allout-widgets-undecorate-region (start end) + "Eliminate widgets and decorations for all items in region from START to END." + (let ((next start) + widget) + (save-excursion + (goto-char start) + (while (< (setq next (next-single-char-property-change next + 'display + (current-buffer) + end)) + end) + (goto-char next) + (when (setq widget (allout-get-item-widget)) + ;; if the next-property/overly progression got us to a widget: + (allout-widgets-undecorate-item widget t)))))) +;;;_ > allout-widgets-undecorate-text (text) +(defun allout-widgets-undecorate-text (text) + "Eliminate widgets and decorations for all items in TEXT." + (remove-text-properties 0 (length text) + '(display nil :icon-state nil rear-nonsticky nil + category nil button nil field nil) + text) + text) +;;;_ > allout-widgets-undecorate-item (item-widget &optional no-expose) +(defun allout-widgets-undecorate-item (item-widget &optional no-expose) + "Remove widget decorations from ITEM-WIDGET. + +Any concealed content head lines and item body is exposed, unless +optional NO-EXPOSE is non-nil." + (let ((from (widget-get item-widget :from)) + (to (widget-get item-widget :to)) + (text-properties-to-remove '(display nil + :icon-state nil + rear-nonsticky nil + category nil + button nil + field nil)) + (span-overlay (widget-get item-widget :span-overlay)) + (button-overlay (widget-get item-widget :button)) + (was-modified (buffer-modified-p)) + (buffer-undo-list t) + (inhibit-read-only t)) + (if (not no-expose) + (allout-flag-region from to nil)) + (allout-unprotected + (remove-text-properties from to text-properties-to-remove)) + (when span-overlay + (delete-overlay span-overlay) (widget-put item-widget :span-overlay nil)) + (when button-overlay + (delete-overlay button-overlay) (widget-put item-widget :button nil)) + (set-marker from nil) + (set-marker to nil) + (if (not was-modified) + (set-buffer-modified-p nil)))) + +;;;_ : Item decoration support +;;;_ > allout-item-span (item-widget &optional start end) +(defun allout-item-span (item-widget &optional start end) + "Return or register the location of an ITEM-WIDGET's actual START and END. + +If START and END are not passed in, return either a dotted pair +of the current span, if established, or nil if not yet set. + +When the START and END are passed, return the distance that the +start of the item moved. We return 0 if the span was not +previously established or is not moved." + (let ((overlay (widget-get item-widget :span-overlay)) + was-start was-end + changed) + (cond ((not overlay) (when start + (setq overlay (make-overlay start end nil t nil)) + (overlay-put overlay 'button item-widget) + (widget-put item-widget :span-overlay overlay) + t)) + ;; report: + ((not start) (cons (overlay-start overlay) (overlay-end overlay))) + ;; move: + ((or (not (equal (overlay-start overlay) start)) + (not (equal (overlay-end overlay) end))) + (move-overlay overlay start end) + t) + ;; specified span already set: + (t nil)))) +;;;_ > allout-item-element-span-is (item-widget element +;;; &optional start end force) +(defun allout-item-element-span-is (item-widget element + &optional start end force) + "Return or register the location of the indicated ITEM-WIDGET ELEMENT. + +ELEMENT is one of :guides-span, :icon-span, :cue-span, or :body-span. + +When optional START is specified, optional END must also be. + +START and END are the actual bounds of the region, if provided. + +If START and END are not passed in, we return either a dotted +pair of the current span, if established, or nil if not yet set. + +When the START and END are passed, we return t if the region +changed or nil if not. + +Optional FORCE means force assignment of the region's text +property, even if it's already set." + (let ((span (widget-get item-widget element))) + (cond ((or (not span) force) + (when start + (widget-put item-widget element (cons start end)) + (put-text-property start end 'category + (cdr (assoc element + allout-span-to-category))) + t)) + ;; report: + ((not start) span) + ;; move if necessary: + ((not (and (eq (car span) start) + (eq (cdr span) end))) + (widget-put item-widget element span) + t) + ;; specified span already set: + (t nil)))) +;;;_ : Item widget retrieval (/ high-level creation): +;;;_ > allout-get-item-widget (&optional container) +(defun allout-get-item-widget (&optional container) + "Return the widget for the item at point, or nil if no widget yet exists. + +Point must be situated *before* the start of the target item's +body, so we don't get an existing containing item when we're in +the process of creating an item in the middle of another. + +Optional CONTAINER is used to obtain the container item." + (if (or container (zerop (allout-depth))) + allout-container-item-widget + ;; allout-recent-* are calibrated by (allout-depth) if we got here. + (let ((got (widget-at allout-recent-prefix-beginning))) + (if (and got (listp got)) + (if (marker-position (widget-get got :from)) + (and + (>= (point) (widget-apply got :actual-position :from)) + (<= (point) (widget-apply got :actual-position :body-start)) + got) + ;; a wacky residual item - undecorate and disregard: + (allout-widgets-undecorate-item got) + nil))))) +;;;_ > allout-get-or-create-item-widget (&optional redecorate blank-container) +(defun allout-get-or-create-item-widget (&optional redecorate blank-container) + "Return a widget for the item at point, creating the widget if necessary. + +When creating a widget, we assume there has been a context change +and decorate its siblings and parent, as well. + +Optional BLANK-CONTAINER is for internal use, to fabricate a +meta-container item with an empty body when the first proper +\(non-container\) item starts at the beginning of the file. + +Optional REDECORATE, if non-nil, means to redecorate the widget +if it already exists." + (let ((widget (allout-get-item-widget blank-container)) + (buffer-undo-list t)) + (cond (widget (if redecorate + (allout-redecorate-item widget)) + widget) + ((or blank-container (zerop (allout-depth))) + (or allout-container-item-widget + (setq allout-container-item-widget + (allout-decorate-item-and-context + (widget-convert 'allout-item-widget) + nil blank-container)))) + ;; create a widget for a regular/non-container item: + (t (allout-decorate-item-and-context (widget-convert + 'allout-item-widget)))))) +;;;_ > allout-get-or-create-parent-widget (&optional redecorate) +(defun allout-get-or-create-parent-widget (&optional redecorate) + "Return widget for parent of item at point, decorating it if necessary. + +We return the container widget if we're above the first proper item in the +file. + +Optional REDECORATE, if non-nil, means to redecorate the widget if it +already exists. + +Point will wind up positioned on the beginning of the parent or beginning +of the buffer." + ;; use existing widget, if there, else establish it + (if (or (bobp) (and (not (allout-ascend)) + (looking-at allout-regexp))) + (allout-get-or-create-item-widget redecorate 'blank-container) + (allout-get-or-create-item-widget redecorate))) +;;;_ : X- Item ancillaries +;;;_ >X allout-body-modification-handler (beg end) +(defun allout-body-modification-handler (beg end) + "Do routine processing of body text before and after modification. + +Operation is inhibited by `allout-inhibit-body-modification-handler'." + +;; The primary duties are: +;; +;; - marking of escaped prefix-like text for delayed cleanup of escapes +;; - removal and replacement of the settings +;; - maintenance of beginning-of-line guide lines +;; +;; ?? Escapes removal \(before changes\) is not done when edits span multiple +;; items, recognizing that item structure is being preserved, including +;; escaping of item-prefix-like text within bodies. See +;; `allout-before-modification-handler' and +;; `allout-inhibit-body-modification-handler'. +;; +;; Adds the overlay to the `allout-unresolved-body-mod-workhash' during +;; before-change operation, and removes from that list during after-change +;; operation. + (cond (allout-inhibit-body-modification-hook nil))) +;;;_ >X allout-graphics-modification-handler (beg end) +(defun allout-graphics-modification-handler (beg end) + "Protect against incoherent deletion of decoration graphics. + +Deletes allowed only when inhibit-read-only is t." + (cond + (undo-in-progress (when (eq (get-text-property beg 'category) + 'allout-icon-span-category) + (save-excursion + (goto-char beg) + (let* ((item-widget (allout-get-item-widget))) + (if item-widget + (allout-widgets-exposure-undo-recorder + item-widget)))))) + (inhibit-read-only t) + ((not (and (boundp 'allout-mode) allout-mode)) t) + ((equal this-command 'quoted-insert) t) + ((yes-or-no-p "Unruly edit of outline structure - allow? ") + (setq allout-widgets-unset-inhibit-read-only (not inhibit-read-only) + inhibit-read-only t)) + (t (error + (substitute-command-keys allout-structure-unruly-deletion-message))))) +;;;_ > allout-item-icon-key-handler () +(defun allout-item-icon-key-handler () + "Catchall handling of key bindings in item icon/cue hot-spots. + +Applies `allout-hotspot-key-handler' and calls the result, if any, as an +interactive command." + + (interactive) + (let* ((mapped-binding (allout-hotspot-key-handler))) + (when mapped-binding + (call-interactively mapped-binding)))) + +;;;_ : Status +;;;_ . allout-item-location (item-widget) +(defun allout-item-location (item-widget) + "Location of the start of the item's text." + (overlay-start (widget-get item-widget :span-overlay))) + +;;;_ : Icon management +;;;_ > allout-fetch-icon-image (name) +(defun allout-fetch-icon-image (name) + "Fetch allout icon for symbol NAME. + +We use a caching strategy, so the caller doesn't need to do so." + (let* ((types allout-widgets-icon-types) + (use-dir (if (equal (allout-frame-property nil 'background-mode) + 'light) + allout-widgets-icons-light-subdir + allout-widgets-icons-dark-subdir)) + (key (list name use-dir)) + (got (assoc key allout-widgets-icons-cache))) + (if got + ;; display system shows only first of subsequent adjacent + ;; `eq'-identical repeats - use copies to avoid this problem. + (allout-widgets-copy-list (cadr got)) + (while (and types (not got)) + (setq got + (allout-find-image + (list (append (list :type (car types) + :file (concat use-dir + (symbol-name name) + "." (symbol-name + (car types)))) + (if (featurep 'xemacs) + allout-widgets-item-image-properties-xemacs + allout-widgets-item-image-properties-emacs) + )))) + (setq types (cdr types))) + (if got + (push (list key got) allout-widgets-icons-cache)) + got))) + +;;;_ : Miscellaneous +;;;_ > allout-elapsed-time-seconds (triple) +(defun allout-elapsed-time-seconds (end start) + "Return seconds between `current-time' style time START/END triples." + (let ((elapsed (time-subtract end start))) + (+ (* (car elapsed) (expt 2.0 16)) + (cadr elapsed) + (/ (caddr elapsed) (expt 10.0 6))))) +;;;_ > allout-frame-property (frame property) +(defalias 'allout-frame-property + (cond ((fboundp 'frame-parameter) + 'frame-parameter) + ((fboundp 'frame-property) + 'frame-property) + (t nil))) +;;;_ > allout-find-image (specs) +(defalias 'allout-find-image + (if (fboundp 'find-image) + 'find-image + nil) ; aka, not-yet-implemented for xemacs. +) +;;;_ > allout-widgets-copy-list (list) +(defun allout-widgets-copy-list (list) + ;; duplicated from cl.el 'copy-list' as of 2008-08-17 + "Return a copy of LIST, which may be a dotted list. +The elements of LIST are not copied, just the list structure itself." + (if (consp list) + (let ((res nil)) + (while (consp list) (push (pop list) res)) + (prog1 (nreverse res) (setcdr res list))) + (car list))) + +;;;_ : Run unit tests: +(defun allout-widgets-run-unit-tests () + (message "Running allout-widget tests...") + + (allout-test-range-overlaps) + + (message "Running allout-widget tests... Done.") + (sit-for .5)) + +(when allout-widgets-run-unit-tests-on-load + (allout-widgets-run-unit-tests)) + +;;;_ : provide +(provide 'allout-widgets) + +;;;_. Local emacs vars. +;;;_ , Local variables: +;;;_ , allout-layout: (-1 : 0) +;;;_ , End: From 584c9d3fd0784fac55fe46d98ccefa5eb461fed8 Mon Sep 17 00:00:00 2001 From: Gnus developers Date: Wed, 16 Feb 2011 23:12:47 +0000 Subject: [PATCH 23/46] Merge changes made in Gnus trunk. gnus-sum.el (gnus-propagate-marks): Change default to t again, since nil means that nnimap doesn't get updated. auth-source.el (auth-source-netrc-create): Return a synthetic search result when the user doesn't want to write to the file. (auth-source-netrc-search): Expect a synthetic result and proceed accordingly. (auth-source-cache-expiry): New variable to override `password-cache-expiry'. (auth-source-remember): Use it. nnimap.el (nnimap-credentials): Remove the `inhibit-create' parameter. Create entry if necessary by using :create t. (nnimap-open-connection-1): Don't pass `inhibit-create'. --- lisp/gnus/ChangeLog | 19 ++++++++++++ lisp/gnus/auth-source.el | 65 +++++++++++++++++++++++++++++----------- lisp/gnus/gnus-sum.el | 3 +- lisp/gnus/nnimap.el | 8 ++--- 4 files changed, 70 insertions(+), 25 deletions(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 91ba9e5a359..5891d4b6193 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,22 @@ +2011-02-16 Lars Ingebrigtsen + + * gnus-sum.el (gnus-propagate-marks): Change default to t again, since + nil means that nnimap doesn't get updated. + +2011-02-16 Teodor Zlatanov + + * auth-source.el (auth-source-netrc-create): Return a synthetic search + result when the user doesn't want to write to the file. + (auth-source-netrc-search): Expect a synthetic result and proceed + accordingly. + (auth-source-cache-expiry): New variable to override + `password-cache-expiry'. + (auth-source-remember): Use it. + + * nnimap.el (nnimap-credentials): Remove the `inhibit-create' + parameter. Create entry if necessary by using :create t. + (nnimap-open-connection-1): Don't pass `inhibit-create'. + 2011-02-15 Teodor Zlatanov * auth-source.el (auth-source-debug): Enable by default and don't diff --git a/lisp/gnus/auth-source.el b/lisp/gnus/auth-source.el index a259c5c2f0b..2b284e3729d 100644 --- a/lisp/gnus/auth-source.el +++ b/lisp/gnus/auth-source.el @@ -61,6 +61,18 @@ :version "23.1" ;; No Gnus :group 'gnus) +;;;###autoload +(defcustom auth-source-cache-expiry 7200 + "How many seconds passwords are cached, or nil to disable +expiring. Overrides `password-cache-expiry' through a +let-binding." + :group 'auth-source + :type '(choice (const :tag "Never" nil) + (const :tag "All Day" 86400) + (const :tag "2 Hours" 7200) + (const :tag "30 Minutes" 1800) + (integer :tag "Seconds"))) + (defclass auth-source-backend () ((type :initarg :type :initform 'netrc @@ -588,8 +600,9 @@ Returns the deleted entries." (defun auth-source-remember (spec found) "Remember FOUND search results for SPEC." - (password-cache-add - (concat auth-source-magic (format "%S" spec)) found)) + (let ((password-cache-expiry auth-source-cache-expiry)) + (password-cache-add + (concat auth-source-magic (format "%S" spec)) found))) (defun auth-source-recall (spec) "Recall FOUND search results for SPEC." @@ -808,14 +821,17 @@ See `auth-source-search' for details on SPEC." (when (and create (= 0 (length results))) - ;; create based on the spec - (apply (slot-value backend 'create-function) spec) - ;; turn off the :create key - (setq spec (plist-put spec :create nil)) - ;; run the search again to get the updated data - ;; the result will be returned, even if the search fails - (setq results (apply 'auth-source-netrc-search spec))) + ;; create based on the spec and record the value + (setq results (or + ;; if the user did not want to create the entry + ;; in the file, it will be returned + (apply (slot-value backend 'create-function) spec) + ;; if not, we do the search again without :create + ;; to get the updated data. + ;; the result will be returned, even if the search fails + (apply 'auth-source-netrc-search + (plist-put spec :create nil))))) results)) ;;; (auth-source-search :host "nonesuch" :type 'netrc :max 1 :create t) @@ -833,7 +849,9 @@ See `auth-source-search' for details on SPEC." (file (oref backend source)) (add "") ;; `valist' is an alist - valist) + valist + ;; `artificial' will be returned if no creation is needed + artificial) ;; only for base required elements (defined as function parameters): ;; fill in the valist with whatever data we may have from the search @@ -902,6 +920,14 @@ See `auth-source-search' for details on SPEC." nil nil default)) (t data)))) + (when data + (setq artificial (plist-put artificial + (intern (concat ":" (symbol-name r))) + (if (eq r 'secret) + (lexical-let ((data data)) + (lambda () data)) + data)))) + ;; when r is not an empty string... (when (and (stringp data) (< 0 (length data))) @@ -935,14 +961,17 @@ See `auth-source-search' for details on SPEC." (goto-char (point-max)) ;; ask AFTER we've successfully opened the file - (when (y-or-n-p (format "Add to file %s: line [%s]" file add)) - (unless (bolp) - (insert "\n")) - (insert add "\n") - (write-region (point-min) (point-max) file nil 'silent) - (auth-source-do-debug - "auth-source-netrc-create: wrote 1 new line to %s" - file))))) + (if (y-or-n-p (format "Add to file %s: line [%s]" file add)) + (progn + (unless (bolp) + (insert "\n")) + (insert add "\n") + (write-region (point-min) (point-max) file nil 'silent) + (auth-source-do-debug + "auth-source-netrc-create: wrote 1 new line to %s" + file) + nil) + (list artificial))))) ;;; Backend specific parsing: Secrets API backend diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 4dfc79a8883..619c8bd75fd 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -1234,11 +1234,10 @@ For example: ((1 . cn-gb-2312) (2 . big5))." :type 'boolean :group 'gnus-summary-marks) -(defcustom gnus-propagate-marks nil +(defcustom gnus-propagate-marks t "If non-nil, Gnus will store and retrieve marks from the backends. This means that marks will be stored both in .newsrc.eld and in the backend, and will slow operation down somewhat." - :version "24.1" :type 'boolean :group 'gnus-summary-marks) diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index a5a001f7e11..4e220bc7553 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el @@ -276,13 +276,11 @@ textual parts.") (push (current-buffer) nnimap-process-buffers) (current-buffer))) -(defun nnimap-credentials (address ports &optional inhibit-create) +(defun nnimap-credentials (address ports) (let* ((found (nth 0 (auth-source-search :max 1 :host address :port ports - :create (if inhibit-create - nil - (null ports))))) + :create t))) (user (plist-get found :user)) (secret (plist-get found :secret)) (secret (if (functionp secret) (funcall secret) secret))) @@ -389,7 +387,7 @@ textual parts.") (list (nnoo-current-server 'nnimap) nnimap-address) - ports t)))) + ports)))) (setq nnimap-object nil) (let ((nnimap-inhibit-logging t)) (setq login-result From 8551cb3203ce2a4a22f8ac336eb628c400a65021 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 16 Feb 2011 20:38:23 -0800 Subject: [PATCH 24/46] * lisp/dired-x.el (dired-filename-at-point): Fix 8-year old typo. Introduced in 2003-01-27T11:36:08Z!fx@gnu.org, 2003/01/27. --- lisp/ChangeLog | 4 ++++ lisp/dired-x.el | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index fafb931b3c7..c626dcd4b9e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2011-02-17 Glenn Morris + + * dired-x.el (dired-filename-at-point): Fix 8-year old typo. + 2011-02-16 Ken Manheimer * allout-widgets.el: New allout extension that shows allout diff --git a/lisp/dired-x.el b/lisp/dired-x.el index 0d16eef1c28..56b3c7b2888 100644 --- a/lisp/dired-x.el +++ b/lisp/dired-x.el @@ -1678,7 +1678,7 @@ Not perfect - point must be in middle of or end of filename." (setq prefix (and (string-match "^\\w+@" - (buffer-substring start (line-beginning-position))) + (buffer-substring start (line-end-position))) "/")) (goto-char start) (if (string-match "[/~]" (char-to-string (preceding-char))) From 4e358705210d9534de286344d9029199e318de8f Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 16 Feb 2011 20:41:29 -0800 Subject: [PATCH 25/46] Fix copyright, standardize header and licence. --- lisp/net/soap-client.el | 32 ++++++++++++++++---------------- lisp/net/soap-inspect.el | 31 ++++++++++++++++--------------- 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/lisp/net/soap-client.el b/lisp/net/soap-client.el index bad6ca1e431..b4307223ba8 100644 --- a/lisp/net/soap-client.el +++ b/lisp/net/soap-client.el @@ -1,25 +1,26 @@ ;;;; soap-client.el -- Access SOAP web services from Emacs -;; Copyright (C) 2009-2011 Alex Harsanyi - -;; 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 . +;; Copyright (C) 2009-2011 Free Software Foundation, Inc. ;; Author: Alexandru Harsanyi (AlexHarsanyi@gmail.com) ;; Created: December, 2009 ;; Keywords: soap, web-services, comm, hypermedia ;; Homepage: http://code.google.com/p/emacs-soap-client -;; + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . ;;; Commentary: ;; @@ -1733,7 +1734,6 @@ operations in a WSDL document." ;;; Local Variables: -;;; mode: emacs-lisp ;;; mode: outline-minor ;;; outline-regexp: ";;;;+" ;;; End: diff --git a/lisp/net/soap-inspect.el b/lisp/net/soap-inspect.el index 163ba13b05b..7cce9844d76 100644 --- a/lisp/net/soap-inspect.el +++ b/lisp/net/soap-inspect.el @@ -1,25 +1,26 @@ ;;;; soap-inspect.el -- Interactive inspector for soap WSDL structures -;; Copyright (C) 2010-2011 Alex Harsanyi - -;; 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 . +;; Copyright (C) 2010-2011 Free Software Foundation, Inc. ;; Author: Alexandru Harsanyi (AlexHarsanyi@gmail.com) ;; Created: October 2010 ;; Keywords: soap, web-services, comm, hypermedia ;; Homepage: http://code.google.com/p/emacs-soap-client -;; + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . ;;; Commentary: ;; From fc14288b7162d53f3a19799641d4384b377d1c6b Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 16 Feb 2011 20:50:47 -0800 Subject: [PATCH 26/46] More dired-x cleanup. * lisp/dired-x.el (dired-clean-up-after-deletion): kill-buffer does not need save-excursion. (dired-do-run-mail): Doc fix. (dired-filename-at-point): Doc fix. Use looking-at, and skip-chars rather than re search. (skip-chars were used prior to 2003-01-27T11:36:08Z!fx@gnu.org, and are ok to use again since Emacs 22.1, because char-classes are supported.) --- lisp/ChangeLog | 6 ++++++ lisp/dired-x.el | 38 ++++++++++++++------------------------ 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c626dcd4b9e..4b3f6d6f4cc 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,11 @@ 2011-02-17 Glenn Morris + * dired-x.el (dired-clean-up-after-deletion): + kill-buffer does not need save-excursion. + (dired-do-run-mail): Doc fix. + (dired-filename-at-point): Doc fix. + Use looking-at, and skip-chars rather than re search. + * dired-x.el (dired-filename-at-point): Fix 8-year old typo. 2011-02-16 Ken Manheimer diff --git a/lisp/dired-x.el b/lisp/dired-x.el index 56b3c7b2888..202b4e754d7 100644 --- a/lisp/dired-x.el +++ b/lisp/dired-x.el @@ -319,7 +319,6 @@ See also the functions: `dired-info' `dired-do-find-marked-files'" (interactive) - ;; These must be done in each new dired buffer. (dired-hack-local-variables) (dired-omit-startup)) @@ -341,17 +340,14 @@ Remove expanded subdir of deleted dir, if any." (funcall (function y-or-n-p) (format "Kill buffer of %s, too? " (file-name-nondirectory fn))) - (save-excursion ; you never know where kill-buffer leaves you - (kill-buffer buf)))) + (kill-buffer buf))) (let ((buf-list (dired-buffers-for-dir (expand-file-name fn)))) (and buf-list (y-or-n-p (format "Kill dired buffer%s of %s, too? " (dired-plural-s (length buf-list)) (file-name-nondirectory fn))) (dolist (buf buf-list) - (save-excursion (kill-buffer buf)))))) - ;; Anything else? - ) + (kill-buffer buf)))))) ;;; EXTENSION MARKING FUNCTIONS. @@ -1404,7 +1400,7 @@ Otherwise obeys the value of `dired-vm-read-only-folders'." (rmail (dired-get-filename))) (defun dired-do-run-mail () - "If `dired-bind-vm' is t, then function `dired-vm', otherwise `dired-rmail'." + "If `dired-bind-vm' is non-nil, call `dired-vm', else call `dired-rmail'." (interactive) (if dired-bind-vm ;; Read mail folder using vm. @@ -1655,38 +1651,32 @@ or to test if that file exists. Use minibuffer after snatching filename." ;; Fixme: This should probably use `thing-at-point'. -- fx (defun dired-filename-at-point () - "Get the filename closest to point, but do not change position. -Has a preference for looking backward when not directly on a symbol. -Not perfect - point must be in middle of or end of filename." - + "Return the filename closest to point, expanded. +Point should be in or after a filename." (let ((filename-chars "-.[:alnum:]_/:$+@") start end filename prefix) - (save-excursion ;; First see if just past a filename. - (or (eobp) + (or (eobp) ; why? (when (looking-at "[] \t\n[{}()]") ; whitespace or some parens (skip-chars-backward " \n\t\r({[]})") (or (bobp) (backward-char 1)))) - (if (string-match (concat "[" filename-chars "]") - (char-to-string (following-char))) + (if (looking-at (format "[%s]" filename-chars)) (progn - (if (re-search-backward (concat "[^" filename-chars "]") nil t) - (forward-char) - (goto-char (point-min))) - (setq start (point)) - (setq prefix + (skip-chars-backward filename-chars) + (setq start (point) + prefix + ;; This is something to do with ange-ftp filenames. + ;; It convert foo@bar to /foo@bar. + ;; But when does the former occur in dired buffers? (and (string-match "^\\w+@" (buffer-substring start (line-end-position))) "/")) - (goto-char start) (if (string-match "[/~]" (char-to-string (preceding-char))) (setq start (1- start))) - (re-search-forward (concat "\\=[" filename-chars "]*") nil t)) - + (skip-chars-forward filename-chars)) (error "No file found around point!")) - ;; Return string. (expand-file-name (concat prefix (buffer-substring start (point))))))) From 92e39d6fbfd29fc9773643a8af3c4870883e1863 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 16 Feb 2011 20:57:22 -0800 Subject: [PATCH 27/46] vc.el fix for bug#4496. * lisp/vc/vc.el (vc-default-previous-version): Remove broken alias that points nowhere. --- lisp/ChangeLog | 3 +++ lisp/vc/vc.el | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4b3f6d6f4cc..638b7a2d442 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2011-02-17 Glenn Morris + * vc/vc.el (vc-default-previous-version): + Remove alias that points nowhere. (Bug#4496) + * dired-x.el (dired-clean-up-after-deletion): kill-buffer does not need save-excursion. (dired-do-run-mail): Doc fix. diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 815bdbfc5bf..02743847800 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2614,9 +2614,6 @@ log entries should be gathered." (when index (substring rev 0 index)))) -(define-obsolete-function-alias - 'vc-default-previous-version 'vc-default-previous-revision "23.1") - (defun vc-default-responsible-p (backend file) "Indicate whether BACKEND is reponsible for FILE. The default is to return nil always." From 64a14c74cb9792c3674fa8d9277e998b85ba3b30 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 16 Feb 2011 21:02:02 -0800 Subject: [PATCH 28/46] shell.el fix for bug#8027 and friends. * lisp/shell.el (shell-delimiter-argument-list): Set it to nil. This is a test, to see if causes any issues. --- lisp/ChangeLog | 2 ++ lisp/shell.el | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 638b7a2d442..ca4fa798d15 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,7 @@ 2011-02-17 Glenn Morris + * shell.el (shell-delimiter-argument-list): Set it to nil. (Bug#8027) + * vc/vc.el (vc-default-previous-version): Remove alias that points nowhere. (Bug#4496) diff --git a/lisp/shell.el b/lisp/shell.el index fcffc2317d5..ea89ce765c3 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -151,12 +151,14 @@ This is a fine thing to set in your `.emacs' file." :type '(repeat (string :tag "Suffix")) :group 'shell) -(defvar shell-delimiter-argument-list '(?\| ?& ?< ?> ?\( ?\) ?\;) +(defcustom shell-delimiter-argument-list nil ; '(?\| ?& ?< ?> ?\( ?\) ?\;) "List of characters to recognize as separate arguments. This variable is used to initialize `comint-delimiter-argument-list' in the -shell buffer. The value may depend on the operating system or shell. - -This is a fine thing to set in your `.emacs' file.") +shell buffer. The value may depend on the operating system or shell." + :type '(choice (const nil) + (repeat :tag "List of characters" character)) + :version "24.1" ; changed to nil (bug#8027) + :group 'shell) (defvar shell-file-name-chars (if (memq system-type '(ms-dos windows-nt cygwin)) From d638ac9ecc2f2fcf7c000ef0aa237826f1a1cda1 Mon Sep 17 00:00:00 2001 From: Katsumi Yamaoka Date: Thu, 17 Feb 2011 05:09:02 +0000 Subject: [PATCH 29/46] auth-source.el (auth-source-secrets-search): Use mm-delete-duplicates instead of delete-dups that is not available in XEmacs 21.4. --- lisp/gnus/ChangeLog | 5 +++++ lisp/gnus/auth-source.el | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 5891d4b6193..c98c86d46f2 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,8 @@ +2011-02-17 Katsumi Yamaoka + + * auth-source.el (auth-source-secrets-search): Use mm-delete-duplicates + instead of delete-dups that is not available in XEmacs 21.4. + 2011-02-16 Lars Ingebrigtsen * gnus-sum.el (gnus-propagate-marks): Change default to t again, since diff --git a/lisp/gnus/auth-source.el b/lisp/gnus/auth-source.el index 2b284e3729d..c3f0f2d5ba5 100644 --- a/lisp/gnus/auth-source.el +++ b/lisp/gnus/auth-source.el @@ -40,6 +40,7 @@ ;;; Code: (require 'password-cache) +(require 'mm-util) (require 'gnus-util) (require 'netrc) (require 'assoc) @@ -1042,9 +1043,9 @@ authentication tokens: (list k (plist-get spec k)))) search-keys))) ;; needed keys (always including host, login, protocol, and secret) - (returned-keys (delete-dups (append - '(:host :login :protocol :secret) - search-keys))) + (returned-keys (mm-delete-duplicates (append + '(:host :login :protocol :secret) + search-keys))) (items (loop for item in (apply 'secrets-search-items coll search-spec) unless (and (stringp label) (not (string-match label item))) From 53ef76c7d3cd9932d8d3be981aef3a136cc8849d Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 16 Feb 2011 21:13:17 -0800 Subject: [PATCH 30/46] Convert some defvars to defcustoms. * lisp/speedbar.el (speedbar-ignored-modes, speedbar-file-unshown-regexp) (speedbar-update-flag, speedbar-fetch-etags-command) (speedbar-fetch-etags-arguments): * lisp/term.el (term-buffer-maximum-size, term-input-chunk-size) (term-completion-autolist, term-completion-addsuffix) (term-completion-recexact, term-completion-fignore): * lisp/term/sup-mouse.el (sup-mouse-fast-select-window): * lisp/term/x-win.el (x-select-request-type): Convert some defvars with "*" to defcustoms. --- lisp/ChangeLog | 10 +++++++++ lisp/speedbar.el | 51 +++++++++++++++++++++++++----------------- lisp/term.el | 51 +++++++++++++++++++++++++++--------------- lisp/term/sup-mouse.el | 7 ++++-- lisp/term/x-win.el | 22 ++++++++++++------ 5 files changed, 94 insertions(+), 47 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ca4fa798d15..399b1fff4e6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,15 @@ 2011-02-17 Glenn Morris + * speedbar.el (speedbar-ignored-modes, speedbar-file-unshown-regexp) + (speedbar-update-flag, speedbar-fetch-etags-command) + (speedbar-fetch-etags-arguments): + * term.el (term-buffer-maximum-size, term-input-chunk-size) + (term-completion-autolist, term-completion-addsuffix) + (term-completion-recexact, term-completion-fignore): + * term/sup-mouse.el (sup-mouse-fast-select-window): + * term/x-win.el (x-select-request-type): + Convert some defvars with "*" to defcustoms. + * shell.el (shell-delimiter-argument-list): Set it to nil. (Bug#8027) * vc/vc.el (vc-default-previous-version): diff --git a/lisp/speedbar.el b/lisp/speedbar.el index b84afd797d1..dad2a4c82ac 100644 --- a/lisp/speedbar.el +++ b/lisp/speedbar.el @@ -614,8 +614,11 @@ state data." :group 'speedbar :type 'hook) -(defvar speedbar-ignored-modes '(fundamental-mode) - "*List of major modes which speedbar will not switch directories for.") +(defcustom speedbar-ignored-modes '(fundamental-mode) + "List of major modes which speedbar will not switch directories for." + :group 'speedbar + :type '(choice (const nil) + (repeat :tag "List of modes" (symbol :tag "Major mode")))) (defun speedbar-extension-list-to-regex (extlist) "Takes EXTLIST, a list of extensions and transforms it into regexp. @@ -669,7 +672,7 @@ directories here; see `vc-directory-exclusion-list'." :group 'speedbar :type 'string) -(defvar speedbar-file-unshown-regexp +(defcustom speedbar-file-unshown-regexp (let ((nstr "") (noext completion-ignored-extensions)) (while noext (setq nstr (concat nstr (regexp-quote (car noext)) "\\'" @@ -677,8 +680,10 @@ directories here; see `vc-directory-exclusion-list'." noext (cdr noext))) ;; backup refdir lockfile (concat nstr "\\|#[^#]+#$\\|\\.\\.?\\'\\|\\.#")) - "*Regexp matching files we don't want displayed in a speedbar buffer. -It is generated from the variable `completion-ignored-extensions'.") + "Regexp matching files we don't want displayed in a speedbar buffer. +It is generated from the variable `completion-ignored-extensions'." + :group 'speedbar + :type 'string) (defvar speedbar-file-regexp nil "Regular expression matching files we know how to expand. @@ -755,14 +760,17 @@ DIRECTORY-EXPRESSION to `speedbar-ignored-directory-expressions'." speedbar-ignored-directory-regexp (speedbar-extension-list-to-regex speedbar-ignored-directory-expressions))) -(defvar speedbar-update-flag dframe-have-timer-flag - "*Non-nil means to automatically update the display. +(defcustom speedbar-update-flag dframe-have-timer-flag + "Non-nil means to automatically update the display. When this is nil then speedbar will not follow the attached frame's directory. -When speedbar is active, use: - -\\ `\\[speedbar-toggle-updates]' - -to toggle this value.") +If you want to change this while speedbar is active, either use +\\[customize] or call \\ `\\[speedbar-toggle-updates]'." + :group 'speedbar + :initialize 'custom-initialize-default + :set (lambda (sym val) + (set sym val) + (speedbar-toggle-updates)) + :type 'boolean) (defvar speedbar-update-flag-disable nil "Permanently disable changing of the update flag.") @@ -3643,17 +3651,20 @@ to be at the beginning of a line in the etags buffer. This variable is ignored if `speedbar-use-imenu-flag' is non-nil.") -(defvar speedbar-fetch-etags-command "etags" - "*Command used to create an etags file. +(defcustom speedbar-fetch-etags-command "etags" + "Command used to create an etags file. +This variable is ignored if `speedbar-use-imenu-flag' is t." + :group 'speedbar + :type 'string) -This variable is ignored if `speedbar-use-imenu-flag' is t.") - -(defvar speedbar-fetch-etags-arguments '("-D" "-I" "-o" "-") - "*List of arguments to use with `speedbar-fetch-etags-command'. +(defcustom speedbar-fetch-etags-arguments '("-D" "-I" "-o" "-") + "List of arguments to use with `speedbar-fetch-etags-command'. This creates an etags output buffer. Use `speedbar-toggle-etags' to modify this list conveniently. - -This variable is ignored if `speedbar-use-imenu-flag' is t.") +This variable is ignored if `speedbar-use-imenu-flag' is t." + :group 'speedbar + :type '(choice (const nil) + (repeat :tag "List of arguments" string))) (defun speedbar-toggle-etags (flag) "Toggle FLAG in `speedbar-fetch-etags-arguments'. diff --git a/lisp/term.el b/lisp/term.el index ea419234e0f..df95ca830ab 100644 --- a/lisp/term.el +++ b/lisp/term.el @@ -762,11 +762,13 @@ Buffer local variable.") "magenta3" "cyan3" "white"]) ;; Inspiration came from comint.el -mm -(defvar term-buffer-maximum-size 2048 - "*The maximum size in lines for term buffers. +(defcustom term-buffer-maximum-size 2048 + "The maximum size in lines for term buffers. Term buffers are truncated from the top to be no greater than this number. Notice that a setting of 0 means \"don't truncate anything\". This variable -is buffer-local.") +is buffer-local." + :group 'term + :type 'integer) (when (featurep 'xemacs) (defvar term-terminal-menu @@ -2209,9 +2211,11 @@ Security bug: your string can still be temporarily recovered with ;;; Low-level process communication -(defvar term-input-chunk-size 512 - "*Long inputs send to term processes are broken up into chunks of this size. -If your process is choking on big inputs, try lowering the value.") +(defcustom term-input-chunk-size 512 + "Long inputs send to term processes are broken up into chunks of this size. +If your process is choking on big inputs, try lowering the value." + :group 'term + :type 'integer) (defun term-send-string (proc str) "Send to PROC the contents of STR as input. @@ -3909,27 +3913,38 @@ This is a good place to put keybindings.") ;; Commands like this are fine things to put in load hooks if you ;; want them present in specific modes. -(defvar term-completion-autolist nil - "*If non-nil, automatically list possibilities on partial completion. -This mirrors the optional behavior of tcsh.") +(defcustom term-completion-autolist nil + "If non-nil, automatically list possibilities on partial completion. +This mirrors the optional behavior of tcsh." + :group 'term + :type 'boolean) -(defvar term-completion-addsuffix t - "*If non-nil, add a `/' to completed directories, ` ' to file names. +(defcustom term-completion-addsuffix t + "If non-nil, add a `/' to completed directories, ` ' to file names. If a cons pair, it should be of the form (DIRSUFFIX . FILESUFFIX) where DIRSUFFIX and FILESUFFIX are strings added on unambiguous or exact -completion. This mirrors the optional behavior of tcsh.") +completion. This mirrors the optional behavior of tcsh." + :group 'term + :type '(choice (const :tag "No suffix" nil) + (cons (string :tag "dirsuffix") (string :tag "filesuffix")) + (other :tag "Suffix" t))) -(defvar term-completion-recexact nil - "*If non-nil, use shortest completion if characters cannot be added. +(defcustom term-completion-recexact nil + "If non-nil, use shortest completion if characters cannot be added. This mirrors the optional behavior of tcsh. -A non-nil value is useful if `term-completion-autolist' is non-nil too.") +A non-nil value is useful if `term-completion-autolist' is non-nil too." + :group 'term + :type 'boolean) -(defvar term-completion-fignore nil - "*List of suffixes to be disregarded during file completion. +(defcustom term-completion-fignore nil + "List of suffixes to be disregarded during file completion. This mirrors the optional behavior of bash and tcsh. -Note that this applies to `term-dynamic-complete-filename' only.") +Note that this applies to `term-dynamic-complete-filename' only." + :group 'term + :type '(choice (const nil) + (repeat :tag "List of suffixes" string))) (defvar term-file-name-prefix "" "Prefix prepended to absolute file names taken from process input. diff --git a/lisp/term/sup-mouse.el b/lisp/term/sup-mouse.el index a8b78bb3e38..6d77241008c 100644 --- a/lisp/term/sup-mouse.el +++ b/lisp/term/sup-mouse.el @@ -30,8 +30,11 @@ ;;; User customization option: -(defvar sup-mouse-fast-select-window nil - "*Non-nil for mouse hits to select new window, then execute; else just select.") +(defcustom sup-mouse-fast-select-window nil + "Non-nil means mouse hits select new window, then execute. +Otherwise just select." + :type 'boolean + :group 'mouse) (defconst mouse-left 0) (defconst mouse-center 1) diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el index 1ec80d5c277..e3c42626a3f 100644 --- a/lisp/term/x-win.el +++ b/lisp/term/x-win.el @@ -1167,20 +1167,28 @@ pasted text.") :group 'killing :version "24.1") -(defvar x-select-request-type nil - "*Data type request for X selection. +(defcustom x-select-request-type nil + "Data type request for X selection. The value is one of the following data types, a list of them, or nil: `COMPOUND_TEXT', `UTF8_STRING', `STRING', `TEXT' -If the value is one of the above symbols, try only the specified -type. +If the value is one of the above symbols, try only the specified type. If the value is a list of them, try each of them in the specified order until succeed. -The value nil is the same as this list: - \(UTF8_STRING COMPOUND_TEXT STRING) -") +The value nil is the same as the list (UTF8_STRING COMPOUND_TEXT STRING)." + :type '(choice (const :tag "Default" nil) + (const COMPOUND_TEXT) + (const UTF8_STRING) + (const STRING) + (const TEXT) + (set :tag "List of values" + (const COMPOUND_TEXT) + (const UTF8_STRING) + (const STRING) + (const TEXT))) + :group 'killing) ;; Get a selection value of type TYPE by calling x-get-selection with ;; an appropriate DATA-TYPE argument decided by `x-select-request-type'. From df70a04b097296737a1128a4163f0dfec1c3d51e Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 16 Feb 2011 21:16:12 -0800 Subject: [PATCH 31/46] * lisp/progmodes/prolog.el: Header comment fix. --- lisp/progmodes/prolog.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el index fd79cfd2399..86553f9496e 100644 --- a/lisp/progmodes/prolog.el +++ b/lisp/progmodes/prolog.el @@ -5,8 +5,9 @@ ;; Authors: Emil Åström ;; Milan Zamazal -;; Stefan Bruda (current maintainer) +;; Stefan Bruda ;; * See below for more details +;; Maintainer: Stefan Bruda ;; Keywords: prolog major mode sicstus swi mercury (defvar prolog-mode-version "1.22" From 124c9ff0e5bd3502ab669d7669390fcdc5bd6122 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Dj=C3=A4rv?= Date: Thu, 17 Feb 2011 11:19:29 +0100 Subject: [PATCH 32/46] Fix KVAR/BVAR, * nsfns.m (Fx_create_frame, ns_set_name_as_filename) (Fns_read_file_name): Replace B_ with BVAR. * nsterm.m (ns_term_init): Use KVAR. --- src/ChangeLog | 7 +++++++ src/nsfns.m | 12 ++++++------ src/nsterm.m | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index ff950f4d9fd..048fc7f052d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2011-02-17 Jan Djärv + + * nsfns.m (Fx_create_frame, ns_set_name_as_filename) + (Fns_read_file_name): Replace B_ with BVAR. + + * nsterm.m (ns_term_init): Use KVAR. + 2011-02-16 Eli Zaretskii * msdos.c (internal_terminal_init): Use KVAR. diff --git a/src/nsfns.m b/src/nsfns.m index c480c834602..6a5adbd7bf3 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -605,8 +605,8 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side BLOCK_INPUT; pool = [[NSAutoreleasePool alloc] init]; - filename = B_ (XBUFFER (buf), filename); - name = B_ (XBUFFER (buf), name); + filename = BVAR (XBUFFER (buf), filename); + name = BVAR (XBUFFER (buf), name); if (NILP (name)) { @@ -1329,9 +1329,9 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side } if (FRAME_HAS_MINIBUF_P (f) - && (!FRAMEP (kb->Vdefault_minibuffer_frame) - || !FRAME_LIVE_P (XFRAME (kb->Vdefault_minibuffer_frame)))) - kb->Vdefault_minibuffer_frame = frame; + && (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame)) + || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame))))) + KVAR (kb, Vdefault_minibuffer_frame) = frame; /* All remaining specified parameters, which have not been "used" by x_get_arg and friends, now go in the misc. alist of the frame. */ @@ -1428,7 +1428,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side NSString *promptS = NILP (prompt) || !STRINGP (prompt) ? nil : [NSString stringWithUTF8String: SDATA (prompt)]; NSString *dirS = NILP (dir) || !STRINGP (dir) ? - [NSString stringWithUTF8String: SDATA (B_ (current_buffer, directory))] : + [NSString stringWithUTF8String: SDATA (BVAR (current_buffer, directory))] : [NSString stringWithUTF8String: SDATA (dir)]; NSString *initS = NILP (init) || !STRINGP (init) ? nil : [NSString stringWithUTF8String: SDATA (init)]; diff --git a/src/nsterm.m b/src/nsterm.m index 590a76ba16d..a09c95c7d01 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -3762,7 +3762,7 @@ Needs to be here because ns_initialize_display_info () uses AppKit classes. terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); init_kboard (terminal->kboard); - terminal->kboard->Vwindow_system = Qns; + KVAR (terminal->kboard, Vwindow_system) = Qns; terminal->kboard->next_kboard = all_kboards; all_kboards = terminal->kboard; /* Don't let the initial kboard remain current longer than necessary. From 73057ba922a026e5416d2e432c6bc1cce127648a Mon Sep 17 00:00:00 2001 From: Deniz Dogan Date: Thu, 17 Feb 2011 12:41:49 +0100 Subject: [PATCH 33/46] * lisp/net/rcirc.el (rcirc-float-time): New function. (rcirc-keepalive, rcirc-handler-ctcp-KEEPALIVE) (rcirc-ctcp-sender-PING): Use it. --- lisp/ChangeLog | 6 ++++++ lisp/net/rcirc.el | 17 ++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 399b1fff4e6..0ff975592ca 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2011-02-17 Deniz Dogan + + * net/rcirc.el (rcirc-float-time): New function. + (rcirc-keepalive, rcirc-handler-ctcp-KEEPALIVE) + (rcirc-ctcp-sender-PING): Use it. + 2011-02-17 Glenn Morris * speedbar.el (speedbar-ignored-modes, speedbar-file-unshown-regexp) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 8657dc58bf4..1d419dbfa18 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -556,6 +556,11 @@ If ARG is non-nil, instead prompt for connection parameters." `(with-current-buffer rcirc-server-buffer ,@body)) +(defun rcirc-float-time () + (if (featurep 'xemacs) + (time-to-seconds (current-time)) + (float-time))) + (defun rcirc-keepalive () "Send keep alive pings to active rcirc processes. Kill processes that have not received a server message since the @@ -567,10 +572,7 @@ last ping." (rcirc-send-ctcp process rcirc-nick (format "KEEPALIVE %f" - (if (featurep 'xemacs) - (time-to-seconds - (current-time)) - (float-time))))))) + (rcirc-float-time)))))) (rcirc-process-list)) ;; no processes, clean up timer (cancel-timer rcirc-keepalive-timer) @@ -578,10 +580,7 @@ last ping." (defun rcirc-handler-ctcp-KEEPALIVE (process target sender message) (with-rcirc-process-buffer process - (setq header-line-format (format "%f" (- (if (featurep 'xemacs) - (time-to-seconds - (current-time)) - (float-time)) + (setq header-line-format (format "%f" (- (rcirc-float-time) (string-to-number message)))))) (defvar rcirc-debug-buffer " *rcirc debug*") @@ -2209,7 +2208,7 @@ With a prefix arg, prompt for new topic." (defun rcirc-ctcp-sender-PING (process target request) "Send a CTCP PING message to TARGET." - (let ((timestamp (format "%.0f" (float-time)))) + (let ((timestamp (format "%.0f" (rcirc-float-time)))) (rcirc-send-ctcp process target "PING" timestamp))) (defun rcirc-cmd-me (args &optional process target) From 35123c042e9154a0f2b1ebfddba06ba01596f07d Mon Sep 17 00:00:00 2001 From: Teodor Zlatanov Date: Thu, 17 Feb 2011 12:08:48 +0000 Subject: [PATCH 34/46] auth.texi (Help for users): Use :port instead of :protocol for all auth-source docs. auth-source.el (auth-source-netrc-parse): Use :port instead of :protocol and accept a missing user, host, or port as a wildcard match. (auth-source-netrc-search, auth-source-netrc-create) (auth-source-secrets-search, auth-source-secrets-create) (auth-source-user-or-password, auth-source-backend, auth-sources) (auth-source-backend-parse-parameters, auth-source-search): Use :port instead of :protocol. nnimap.el (nnimap-credentials): Pass a port default to `auth-source-search' in case an entry needs to be created. (nnimap-open-connection-1): Use :port instead of :protocol. --- doc/misc/ChangeLog | 5 ++ doc/misc/auth.texi | 7 +-- lisp/gnus/ChangeLog | 15 +++++ lisp/gnus/auth-source.el | 120 ++++++++++++++++++++------------------- lisp/gnus/nnimap.el | 5 +- 5 files changed, 87 insertions(+), 65 deletions(-) diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 4a03caee911..9a292c03c8d 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,3 +1,8 @@ +2011-02-17 Teodor Zlatanov + + * auth.texi (Help for users): Use :port instead of :protocol for all + auth-source docs. + 2011-02-16 Glenn Morris * dired-x.texi: Use emacsver.texi to get Emacs version. diff --git a/doc/misc/auth.texi b/doc/misc/auth.texi index 020c582305c..0e19bce0b9f 100644 --- a/doc/misc/auth.texi +++ b/doc/misc/auth.texi @@ -105,8 +105,7 @@ It's known as @var{:host} in @code{auth-source-search} queries. You can also use @code{host}. The @code{port} is the connection port or protocol. It's known as -@var{:port} in @code{auth-source-search} queries. You can also use -@code{protocol}. +@var{:port} in @code{auth-source-search} queries. The @code{user} is the user name. It's known as @var{:user} in @code{auth-source-search} queries. You can also use @code{login} and @@ -155,8 +154,8 @@ particular host and protocol. While you can get fancy, the default and simplest configuration is: @lisp -;;; old default: required :host and :protocol, not needed anymore -(setq auth-sources '((:source "~/.authinfo.gpg" :host t :protocol t))) +;;; old default: required :host and :port, not needed anymore +(setq auth-sources '((:source "~/.authinfo.gpg" :host t :port t))) ;;; mostly equivalent (see below about fallbacks) but shorter: (setq auth-sources '((:source "~/.authinfo.gpg"))) ;;; even shorter and the @emph{default}: diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index c98c86d46f2..0e5a248c0b2 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,18 @@ +2011-02-17 Teodor Zlatanov + + * auth-source.el (auth-source-netrc-parse): Use :port instead of + :protocol and accept a missing user, host, or port as a wildcard match. + + (auth-source-netrc-search, auth-source-netrc-create) + (auth-source-secrets-search, auth-source-secrets-create) + (auth-source-user-or-password, auth-source-backend, auth-sources) + (auth-source-backend-parse-parameters, auth-source-search): Use :port + instead of :protocol. + + * nnimap.el (nnimap-credentials): Pass a port default to + `auth-source-search' in case an entry needs to be created. + (nnimap-open-connection-1): Use :port instead of :protocol. + 2011-02-17 Katsumi Yamaoka * auth-source.el (auth-source-secrets-search): Use mm-delete-duplicates diff --git a/lisp/gnus/auth-source.el b/lisp/gnus/auth-source.el index c3f0f2d5ba5..42386250c4f 100644 --- a/lisp/gnus/auth-source.el +++ b/lisp/gnus/auth-source.el @@ -94,11 +94,11 @@ let-binding." :type t :custom string :documentation "The backend user.") - (protocol :initarg :protocol - :initform t - :type t - :custom string - :documentation "The backend protocol.") + (port :initarg :port + :initform t + :type t + :custom string + :documentation "The backend protocol.") (create-function :initarg :create-function :initform ignore :type function @@ -213,7 +213,7 @@ can get pretty complex." :tag "Regular expression"))) (list :tag "Protocol" - (const :format "" :value :protocol) + (const :format "" :value :port) (choice :tag "Protocol" (const :tag "Any" t) @@ -266,19 +266,19 @@ If the value is not a list, symmetric encryption will be used." msg)) -;; (auth-source-pick nil :host "any" :protocol 'imap :user "joe") -;; (auth-source-pick t :host "any" :protocol 'imap :user "joe") -;; (setq auth-sources '((:source (:secrets default) :host t :protocol t :user "joe") -;; (:source (:secrets "session") :host t :protocol t :user "joe") -;; (:source (:secrets "Login") :host t :protocol t) -;; (:source "~/.authinfo.gpg" :host t :protocol t))) +;; (auth-source-pick nil :host "any" :port 'imap :user "joe") +;; (auth-source-pick t :host "any" :port 'imap :user "joe") +;; (setq auth-sources '((:source (:secrets default) :host t :port t :user "joe") +;; (:source (:secrets "session") :host t :port t :user "joe") +;; (:source (:secrets "Login") :host t :port t) +;; (:source "~/.authinfo.gpg" :host t :port t))) -;; (setq auth-sources '((:source (:secrets default) :host t :protocol t :user "joe") -;; (:source (:secrets "session") :host t :protocol t :user "joe") -;; (:source (:secrets "Login") :host t :protocol t) +;; (setq auth-sources '((:source (:secrets default) :host t :port t :user "joe") +;; (:source (:secrets "session") :host t :port t :user "joe") +;; (:source (:secrets "Login") :host t :port t) ;; )) -;; (setq auth-sources '((:source "~/.authinfo.gpg" :host t :protocol t))) +;; (setq auth-sources '((:source "~/.authinfo.gpg" :host t :port t))) ;; (auth-source-backend-parse "myfile.gpg") ;; (auth-source-backend-parse 'default) @@ -355,8 +355,8 @@ If the value is not a list, symmetric encryption will be used." (defun auth-source-backend-parse-parameters (entry backend) "Fills in the extra auth-source-backend parameters of ENTRY. -Using the plist ENTRY, get the :host, :protocol, and :user search -parameters. Accepts :port as an alias to :protocol." +Using the plist ENTRY, get the :host, :port, and :user search +parameters." (let ((entry (if (stringp entry) nil entry)) @@ -365,15 +365,14 @@ parameters. Accepts :port as an alias to :protocol." (oset backend host val)) (when (setq val (plist-get entry :user)) (oset backend user val)) - ;; accept :port as an alias for :protocol - (when (setq val (or (plist-get entry :protocol) (plist-get entry :port))) - (oset backend protocol val))) + (when (setq val (plist-get entry :port)) + (oset backend port val))) backend) ;; (mapcar 'auth-source-backend-parse auth-sources) (defun* auth-source-search (&rest spec - &key type max host user protocol secret + &key type max host user port secret create delete &allow-other-keys) "Search or modify authentication backends according to SPEC. @@ -386,7 +385,7 @@ other properties will always hold scalar values. Typically the :secret property, if present, contains a password. -Common search keys are :max, :host, :protocol, and :user. In +Common search keys are :max, :host, :port, and :user. In addition, :create specifies how tokens will be or created. Finally, :type can specify which backend types you want to check. @@ -400,7 +399,7 @@ any of the search terms matches). A new token will be created if no matching tokens were found. The new token will have only the keys the backend requires. For the netrc backend, for instance, that's the user, host, and -protocol keys. +port keys. Here's an example: @@ -416,11 +415,11 @@ which says: 'netrc', maximum one result. Create a new entry if you found none. The netrc backend will - automatically require host, user, and protocol. The host will be + automatically require host, user, and port. The host will be 'mine'. We prompt for the user with default 'defaultUser' and - for the protocol without a default. We will not prompt for A, Q, + for the port without a default. We will not prompt for A, Q, or P. The resulting token will only have keys user, host, and - protocol.\" + port.\" :create '(A B C) also means to create a token if possible. @@ -445,11 +444,11 @@ which says: or 'twosuch' in backends of type 'netrc', maximum one result. Create a new entry if you found none. The netrc backend will - automatically require host, user, and protocol. The host will be + automatically require host, user, and port. The host will be 'nonesuch' and Q will be 'qqqq'. We prompt for A with default - 'default A', for B and protocol with default nil, and for the + 'default A', for B and port with default nil, and for the user with default 'defaultUser'. We will not prompt for Q. The - resulting token will have keys user, host, protocol, A, B, and Q. + resulting token will have keys user, host, port, A, B, and Q. It will not have P with any value, even though P is used in the search to find only entries that have P set to 'pppp'.\" @@ -481,14 +480,14 @@ the match rules above. Defaults to t. :user (X Y Z) means to match only users X, Y, or Z according to the match rules above. Defaults to t. -:protocol (P Q R) means to match only protocols P, Q, or R. +:port (P Q R) means to match only protocols P, Q, or R. Defaults to t. :K (V1 V2 V3) for any other key K will match values V1, V2, or V3 (note the match rules above). The return value is a list with at most :max tokens. Each token -is a plist with keys :backend :host :protocol :user, plus any other +is a plist with keys :backend :host :port :user, plus any other keys provided by the backend (notably :secret). But note the exception for :max 0, which see above. @@ -662,7 +661,7 @@ while \(:host t) would find all host entries." ;;; (auth-source-netrc-parse "~/.authinfo.gpg") (defun* auth-source-netrc-parse (&rest spec - &key file max host user protocol delete + &key file max host user port delete &allow-other-keys) "Parse FILE and return a list of all entries in the file. Note that the MAX parameter is used so we can exit the parse early." @@ -724,18 +723,21 @@ Note that the MAX parameter is used so we can exit the parse early." host (or (aget alist "machine") - (aget alist "host"))) + (aget alist "host") + t)) (auth-source-search-collection user (or (aget alist "login") (aget alist "account") - (aget alist "user"))) + (aget alist "user") + t)) (auth-source-search-collection - protocol + port (or (aget alist "port") - (aget alist "protocol")))) + (aget alist "protocol") + t))) (decf max) (push (nreverse alist) result) ;; to delete a line, we just comment it out @@ -801,7 +803,7 @@ Note that the MAX parameter is used so we can exit the parse early." (defun* auth-source-netrc-search (&rest spec &key backend create delete - type max host user protocol + type max host user port &allow-other-keys) "Given a property list SPEC, return search matches from the :backend. See `auth-source-search' for details on SPEC." @@ -816,7 +818,7 @@ See `auth-source-search' for details on SPEC." :file (oref backend source) :host (or host t) :user (or user t) - :protocol (or protocol t))))) + :port (or port t))))) ;; if we need to create an entry AND none were found to match (when (and create @@ -840,9 +842,9 @@ See `auth-source-search' for details on SPEC." (defun* auth-source-netrc-create (&rest spec &key backend - secret host user protocol create + secret host user port create &allow-other-keys) - (let* ((base-required '(host user protocol secret)) + (let* ((base-required '(host user port secret)) ;; we know (because of an assertion in auth-source-search) that the ;; :create parameter is either t or a list (which includes nil) (create-extra (if (eq t create) nil create)) @@ -881,7 +883,7 @@ See `auth-source-search' for details on SPEC." ((and (not given-default) (eq r 'user)) (user-login-name)) ;; note we need this empty string - ((and (not given-default) (eq r 'protocol)) + ((and (not given-default) (eq r 'port)) "") (t given-default))) ;; the prompt's default string depends on the data so far @@ -891,20 +893,20 @@ See `auth-source-search' for details on SPEC." ;; the prompt should also show what's entered so far (user-value (aget valist 'user)) (host-value (aget valist 'host)) - (protocol-value (aget valist 'protocol)) + (port-value (aget valist 'port)) (info-so-far (concat (if user-value (format "%s@" user-value) "[USER?]") (if host-value (format "%s" host-value) "[HOST?]") - (if protocol-value + (if port-value ;; this distinguishes protocol between - (if (zerop (length protocol-value)) + (if (zerop (length port-value)) "" ; 'entered as "no default"' vs. - (format ":%s" protocol-value)) ; given + (format ":%s" port-value)) ; given ;; and this is when the protocol is unknown - "[PROTOCOL?]")))) + "[PORT?]")))) ;; now prompt if the search SPEC did not include a required key; ;; take the result and put it in `data' AND store it in `valist' @@ -942,7 +944,7 @@ See `auth-source-search' for details on SPEC." ('user "login") ('host "machine") ('secret "password") - ('protocol "port") + ('port "port") ; redundant but clearer (t (symbol-name r))) ;; the value will be printed in %S format data)))))) @@ -986,7 +988,7 @@ See `auth-source-search' for details on SPEC." (defun* auth-source-secrets-search (&rest spec &key backend create delete label - type max host user protocol + type max host user port &allow-other-keys) "Search the Secrets API; spec is like `auth-source'. @@ -1042,9 +1044,9 @@ authentication tokens: nil (list k (plist-get spec k)))) search-keys))) - ;; needed keys (always including host, login, protocol, and secret) + ;; needed keys (always including host, login, port, and secret) (returned-keys (mm-delete-duplicates (append - '(:host :login :protocol :secret) + '(:host :login :port :secret) search-keys))) (items (loop for item in (apply 'secrets-search-items coll search-spec) unless (and (stringp label) @@ -1081,7 +1083,7 @@ authentication tokens: (defun* auth-source-secrets-create (&rest spec - &key backend type max host user protocol + &key backend type max host user port &allow-other-keys) ;; TODO ;; (apply 'secrets-create-item (auth-get-source entry) name passwd spec) @@ -1098,8 +1100,8 @@ authentication tokens: 'auth-source-forget "Emacs 24.1") (defun auth-source-user-or-password - (mode host protocol &optional username create-missing delete-existing) - "Find MODE (string or list of strings) matching HOST and PROTOCOL. + (mode host port &optional username create-missing delete-existing) + "Find MODE (string or list of strings) matching HOST and PORT. DEPRECATED in favor of `auth-source-search'! @@ -1122,14 +1124,14 @@ stored in the password database which matches best (see MODE can be \"login\" or \"password\"." (auth-source-do-debug "auth-source-user-or-password: DEPRECATED get %s for %s (%s) + user=%s" - mode host protocol username) + mode host port username) (let* ((listy (listp mode)) (mode (if listy mode (list mode))) (cname (if username - (format "%s %s:%s %s" mode host protocol username) - (format "%s %s:%s" mode host protocol))) - (search (list :host host :protocol protocol)) + (format "%s %s:%s %s" mode host port username) + (format "%s %s:%s" mode host port))) + (search (list :host host :port port)) (search (if username (append search (list :user username)) search)) (search (if create-missing (append search (list :create t)) @@ -1151,7 +1153,7 @@ MODE can be \"login\" or \"password\"." (if (and (member "password" mode) t) "SECRET" found) - host protocol username) + host port username) found) ; return the found data ;; else, if not found, search with a max of 1 (let ((choice (nth 0 (apply 'auth-source-search diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index 4e220bc7553..fc8873ff565 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el @@ -277,7 +277,8 @@ textual parts.") (current-buffer))) (defun nnimap-credentials (address ports) - (let* ((found (nth 0 (auth-source-search :max 1 + (let* ((auth-source-creation-defaults `((port . ,(nth 0 ports)))) + (found (nth 0 (auth-source-search :max 1 :host address :port ports :create t))) @@ -398,7 +399,7 @@ textual parts.") (dolist (host (list (nnoo-current-server 'nnimap) nnimap-address)) (dolist (port ports) - (auth-source-forget+ :host host :protocol port))) + (auth-source-forget+ :host host :port port))) (delete-process (nnimap-process nnimap-object)) (setq nnimap-object nil)))) (when nnimap-object From a202ff49bf73e0c1be566f04b76282e4a3b8ac73 Mon Sep 17 00:00:00 2001 From: Teodor Zlatanov Date: Thu, 17 Feb 2011 12:50:01 +0000 Subject: [PATCH 35/46] auth-source.el (auth-source-debug): Default to off. --- lisp/gnus/ChangeLog | 1 + lisp/gnus/auth-source.el | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 0e5a248c0b2..cc405410db9 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -2,6 +2,7 @@ * auth-source.el (auth-source-netrc-parse): Use :port instead of :protocol and accept a missing user, host, or port as a wildcard match. + (auth-source-debug): Default to off. (auth-source-netrc-search, auth-source-netrc-create) (auth-source-secrets-search, auth-source-secrets-create) diff --git a/lisp/gnus/auth-source.el b/lisp/gnus/auth-source.el index 42386250c4f..29a3ca06707 100644 --- a/lisp/gnus/auth-source.el +++ b/lisp/gnus/auth-source.el @@ -148,7 +148,7 @@ let-binding." :version "23.2" ;; No Gnus :type `boolean) -(defcustom auth-source-debug t +(defcustom auth-source-debug nil "Whether auth-source should log debug messages. If the value is nil, debug messages are not logged. From 3a00a36316bcc52882c13351df11bcd39bad5c1a Mon Sep 17 00:00:00 2001 From: Ken Manheimer Date: Thu, 17 Feb 2011 16:47:18 -0500 Subject: [PATCH 36/46] * lisp/allout-widgets.el: (allout-widgets-icons-light-subdir) (allout-widgets-icons-dark-subdir): Track relocations of icons * lisp/allout.el: Remove commentary about remove encryption passphrase mnemonic support and verification. * etc/images/icons/allout-widgets/dark-bg, etc/images/icons/allout-widgets/light-bg, encrypted-locked.{xpm,png}, unlocked-encrypted.{xpm,png}: Reorganize icon directories and files to reconcile against windows short-filename clashes. --- etc/ChangeLog | 8 ++++++++ .../dark-bg}/closed.png | Bin .../dark-bg}/closed.xpm | 0 .../dark-bg}/empty.png | Bin .../dark-bg}/empty.xpm | 0 .../dark-bg}/end-connector.png | Bin .../dark-bg}/end-connector.xpm | 0 .../dark-bg}/extender-connector.png | Bin .../dark-bg}/extender-connector.xpm | 0 .../dark-bg}/leaf.png | Bin .../dark-bg}/leaf.xpm | 0 .../dark-bg/locked-encrypted.png} | Bin .../dark-bg/locked-encrypted.xpm} | 0 .../dark-bg}/mid-connector.png | Bin .../dark-bg}/mid-connector.xpm | 0 .../dark-bg}/opened.png | Bin .../dark-bg}/opened.xpm | 0 .../dark-bg}/skip-descender.png | Bin .../dark-bg}/skip-descender.xpm | 0 .../dark-bg}/through-descender.png | Bin .../dark-bg}/through-descender.xpm | 0 .../dark-bg/unlocked-encrypted.png} | Bin .../dark-bg/unlocked-encrypted.xpm} | 0 .../light-bg}/closed.png | Bin .../light-bg}/closed.xpm | 0 .../light-bg}/empty.png | Bin .../light-bg}/empty.xpm | 0 .../light-bg}/end-connector.png | Bin .../light-bg}/end-connector.xpm | 0 .../light-bg}/extender-connector.png | Bin .../light-bg}/extender-connector.xpm | 0 .../light-bg}/leaf.png | Bin .../light-bg}/leaf.xpm | 0 .../light-bg/locked-encrypted.png} | Bin .../light-bg/locked-encrypted.xpm} | 0 .../light-bg}/mid-connector.png | Bin .../light-bg}/mid-connector.xpm | 0 .../light-bg}/opened.png | Bin .../light-bg}/opened.xpm | 0 .../light-bg}/skip-descender.png | Bin .../light-bg}/skip-descender.xpm | 0 .../light-bg}/through-descender.png | Bin .../light-bg}/through-descender.xpm | 0 .../light-bg/unlocked-encrypted.png} | Bin .../light-bg/unlocked-encrypted.xpm} | 0 lisp/ChangeLog | 7 +++++++ lisp/allout-widgets.el | 8 ++++---- lisp/allout.el | 8 +++----- 48 files changed, 22 insertions(+), 9 deletions(-) rename etc/images/icons/{allout-widgets-dark-bg => allout-widgets/dark-bg}/closed.png (100%) rename etc/images/icons/{allout-widgets-dark-bg => allout-widgets/dark-bg}/closed.xpm (100%) rename etc/images/icons/{allout-widgets-dark-bg => allout-widgets/dark-bg}/empty.png (100%) rename etc/images/icons/{allout-widgets-dark-bg => allout-widgets/dark-bg}/empty.xpm (100%) rename etc/images/icons/{allout-widgets-dark-bg => allout-widgets/dark-bg}/end-connector.png (100%) rename etc/images/icons/{allout-widgets-dark-bg => allout-widgets/dark-bg}/end-connector.xpm (100%) rename etc/images/icons/{allout-widgets-dark-bg => allout-widgets/dark-bg}/extender-connector.png (100%) rename etc/images/icons/{allout-widgets-dark-bg => allout-widgets/dark-bg}/extender-connector.xpm (100%) rename etc/images/icons/{allout-widgets-dark-bg => allout-widgets/dark-bg}/leaf.png (100%) rename etc/images/icons/{allout-widgets-dark-bg => allout-widgets/dark-bg}/leaf.xpm (100%) rename etc/images/icons/{allout-widgets-dark-bg/encrypted-locked.png => allout-widgets/dark-bg/locked-encrypted.png} (100%) rename etc/images/icons/{allout-widgets-dark-bg/encrypted-locked.xpm => allout-widgets/dark-bg/locked-encrypted.xpm} (100%) rename etc/images/icons/{allout-widgets-dark-bg => allout-widgets/dark-bg}/mid-connector.png (100%) rename etc/images/icons/{allout-widgets-dark-bg => allout-widgets/dark-bg}/mid-connector.xpm (100%) rename etc/images/icons/{allout-widgets-dark-bg => allout-widgets/dark-bg}/opened.png (100%) rename etc/images/icons/{allout-widgets-dark-bg => allout-widgets/dark-bg}/opened.xpm (100%) rename etc/images/icons/{allout-widgets-dark-bg => allout-widgets/dark-bg}/skip-descender.png (100%) rename etc/images/icons/{allout-widgets-dark-bg => allout-widgets/dark-bg}/skip-descender.xpm (100%) rename etc/images/icons/{allout-widgets-dark-bg => allout-widgets/dark-bg}/through-descender.png (100%) rename etc/images/icons/{allout-widgets-dark-bg => allout-widgets/dark-bg}/through-descender.xpm (100%) rename etc/images/icons/{allout-widgets-dark-bg/encrypted-unlocked.png => allout-widgets/dark-bg/unlocked-encrypted.png} (100%) rename etc/images/icons/{allout-widgets-dark-bg/encrypted-unlocked.xpm => allout-widgets/dark-bg/unlocked-encrypted.xpm} (100%) rename etc/images/icons/{allout-widgets-light-bg => allout-widgets/light-bg}/closed.png (100%) rename etc/images/icons/{allout-widgets-light-bg => allout-widgets/light-bg}/closed.xpm (100%) rename etc/images/icons/{allout-widgets-light-bg => allout-widgets/light-bg}/empty.png (100%) rename etc/images/icons/{allout-widgets-light-bg => allout-widgets/light-bg}/empty.xpm (100%) rename etc/images/icons/{allout-widgets-light-bg => allout-widgets/light-bg}/end-connector.png (100%) rename etc/images/icons/{allout-widgets-light-bg => allout-widgets/light-bg}/end-connector.xpm (100%) rename etc/images/icons/{allout-widgets-light-bg => allout-widgets/light-bg}/extender-connector.png (100%) rename etc/images/icons/{allout-widgets-light-bg => allout-widgets/light-bg}/extender-connector.xpm (100%) rename etc/images/icons/{allout-widgets-light-bg => allout-widgets/light-bg}/leaf.png (100%) rename etc/images/icons/{allout-widgets-light-bg => allout-widgets/light-bg}/leaf.xpm (100%) rename etc/images/icons/{allout-widgets-light-bg/encrypted-locked.png => allout-widgets/light-bg/locked-encrypted.png} (100%) rename etc/images/icons/{allout-widgets-light-bg/encrypted-locked.xpm => allout-widgets/light-bg/locked-encrypted.xpm} (100%) rename etc/images/icons/{allout-widgets-light-bg => allout-widgets/light-bg}/mid-connector.png (100%) rename etc/images/icons/{allout-widgets-light-bg => allout-widgets/light-bg}/mid-connector.xpm (100%) rename etc/images/icons/{allout-widgets-light-bg => allout-widgets/light-bg}/opened.png (100%) rename etc/images/icons/{allout-widgets-light-bg => allout-widgets/light-bg}/opened.xpm (100%) rename etc/images/icons/{allout-widgets-light-bg => allout-widgets/light-bg}/skip-descender.png (100%) rename etc/images/icons/{allout-widgets-light-bg => allout-widgets/light-bg}/skip-descender.xpm (100%) rename etc/images/icons/{allout-widgets-light-bg => allout-widgets/light-bg}/through-descender.png (100%) rename etc/images/icons/{allout-widgets-light-bg => allout-widgets/light-bg}/through-descender.xpm (100%) rename etc/images/icons/{allout-widgets-light-bg/encrypted-unlocked.png => allout-widgets/light-bg/unlocked-encrypted.png} (100%) rename etc/images/icons/{allout-widgets-light-bg/encrypted-unlocked.xpm => allout-widgets/light-bg/unlocked-encrypted.xpm} (100%) diff --git a/etc/ChangeLog b/etc/ChangeLog index 2ab549b4606..ac6ac7df00e 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,11 @@ +2011-02-17 Ken Manheimer + + * etc/images/icons/allout-widgets/dark-bg, + etc/images/icons/allout-widgets/light-bg, + encrypted-locked.{xpm,png}, unlocked-encrypted.{xpm,png}: + Reorganize icon directories and files to reconcile against windows + short-filename clashes. + 2011-02-16 Ken Manheimer * etc/images/icons/allout-widgets-dark-bg, diff --git a/etc/images/icons/allout-widgets-dark-bg/closed.png b/etc/images/icons/allout-widgets/dark-bg/closed.png similarity index 100% rename from etc/images/icons/allout-widgets-dark-bg/closed.png rename to etc/images/icons/allout-widgets/dark-bg/closed.png diff --git a/etc/images/icons/allout-widgets-dark-bg/closed.xpm b/etc/images/icons/allout-widgets/dark-bg/closed.xpm similarity index 100% rename from etc/images/icons/allout-widgets-dark-bg/closed.xpm rename to etc/images/icons/allout-widgets/dark-bg/closed.xpm diff --git a/etc/images/icons/allout-widgets-dark-bg/empty.png b/etc/images/icons/allout-widgets/dark-bg/empty.png similarity index 100% rename from etc/images/icons/allout-widgets-dark-bg/empty.png rename to etc/images/icons/allout-widgets/dark-bg/empty.png diff --git a/etc/images/icons/allout-widgets-dark-bg/empty.xpm b/etc/images/icons/allout-widgets/dark-bg/empty.xpm similarity index 100% rename from etc/images/icons/allout-widgets-dark-bg/empty.xpm rename to etc/images/icons/allout-widgets/dark-bg/empty.xpm diff --git a/etc/images/icons/allout-widgets-dark-bg/end-connector.png b/etc/images/icons/allout-widgets/dark-bg/end-connector.png similarity index 100% rename from etc/images/icons/allout-widgets-dark-bg/end-connector.png rename to etc/images/icons/allout-widgets/dark-bg/end-connector.png diff --git a/etc/images/icons/allout-widgets-dark-bg/end-connector.xpm b/etc/images/icons/allout-widgets/dark-bg/end-connector.xpm similarity index 100% rename from etc/images/icons/allout-widgets-dark-bg/end-connector.xpm rename to etc/images/icons/allout-widgets/dark-bg/end-connector.xpm diff --git a/etc/images/icons/allout-widgets-dark-bg/extender-connector.png b/etc/images/icons/allout-widgets/dark-bg/extender-connector.png similarity index 100% rename from etc/images/icons/allout-widgets-dark-bg/extender-connector.png rename to etc/images/icons/allout-widgets/dark-bg/extender-connector.png diff --git a/etc/images/icons/allout-widgets-dark-bg/extender-connector.xpm b/etc/images/icons/allout-widgets/dark-bg/extender-connector.xpm similarity index 100% rename from etc/images/icons/allout-widgets-dark-bg/extender-connector.xpm rename to etc/images/icons/allout-widgets/dark-bg/extender-connector.xpm diff --git a/etc/images/icons/allout-widgets-dark-bg/leaf.png b/etc/images/icons/allout-widgets/dark-bg/leaf.png similarity index 100% rename from etc/images/icons/allout-widgets-dark-bg/leaf.png rename to etc/images/icons/allout-widgets/dark-bg/leaf.png diff --git a/etc/images/icons/allout-widgets-dark-bg/leaf.xpm b/etc/images/icons/allout-widgets/dark-bg/leaf.xpm similarity index 100% rename from etc/images/icons/allout-widgets-dark-bg/leaf.xpm rename to etc/images/icons/allout-widgets/dark-bg/leaf.xpm diff --git a/etc/images/icons/allout-widgets-dark-bg/encrypted-locked.png b/etc/images/icons/allout-widgets/dark-bg/locked-encrypted.png similarity index 100% rename from etc/images/icons/allout-widgets-dark-bg/encrypted-locked.png rename to etc/images/icons/allout-widgets/dark-bg/locked-encrypted.png diff --git a/etc/images/icons/allout-widgets-dark-bg/encrypted-locked.xpm b/etc/images/icons/allout-widgets/dark-bg/locked-encrypted.xpm similarity index 100% rename from etc/images/icons/allout-widgets-dark-bg/encrypted-locked.xpm rename to etc/images/icons/allout-widgets/dark-bg/locked-encrypted.xpm diff --git a/etc/images/icons/allout-widgets-dark-bg/mid-connector.png b/etc/images/icons/allout-widgets/dark-bg/mid-connector.png similarity index 100% rename from etc/images/icons/allout-widgets-dark-bg/mid-connector.png rename to etc/images/icons/allout-widgets/dark-bg/mid-connector.png diff --git a/etc/images/icons/allout-widgets-dark-bg/mid-connector.xpm b/etc/images/icons/allout-widgets/dark-bg/mid-connector.xpm similarity index 100% rename from etc/images/icons/allout-widgets-dark-bg/mid-connector.xpm rename to etc/images/icons/allout-widgets/dark-bg/mid-connector.xpm diff --git a/etc/images/icons/allout-widgets-dark-bg/opened.png b/etc/images/icons/allout-widgets/dark-bg/opened.png similarity index 100% rename from etc/images/icons/allout-widgets-dark-bg/opened.png rename to etc/images/icons/allout-widgets/dark-bg/opened.png diff --git a/etc/images/icons/allout-widgets-dark-bg/opened.xpm b/etc/images/icons/allout-widgets/dark-bg/opened.xpm similarity index 100% rename from etc/images/icons/allout-widgets-dark-bg/opened.xpm rename to etc/images/icons/allout-widgets/dark-bg/opened.xpm diff --git a/etc/images/icons/allout-widgets-dark-bg/skip-descender.png b/etc/images/icons/allout-widgets/dark-bg/skip-descender.png similarity index 100% rename from etc/images/icons/allout-widgets-dark-bg/skip-descender.png rename to etc/images/icons/allout-widgets/dark-bg/skip-descender.png diff --git a/etc/images/icons/allout-widgets-dark-bg/skip-descender.xpm b/etc/images/icons/allout-widgets/dark-bg/skip-descender.xpm similarity index 100% rename from etc/images/icons/allout-widgets-dark-bg/skip-descender.xpm rename to etc/images/icons/allout-widgets/dark-bg/skip-descender.xpm diff --git a/etc/images/icons/allout-widgets-dark-bg/through-descender.png b/etc/images/icons/allout-widgets/dark-bg/through-descender.png similarity index 100% rename from etc/images/icons/allout-widgets-dark-bg/through-descender.png rename to etc/images/icons/allout-widgets/dark-bg/through-descender.png diff --git a/etc/images/icons/allout-widgets-dark-bg/through-descender.xpm b/etc/images/icons/allout-widgets/dark-bg/through-descender.xpm similarity index 100% rename from etc/images/icons/allout-widgets-dark-bg/through-descender.xpm rename to etc/images/icons/allout-widgets/dark-bg/through-descender.xpm diff --git a/etc/images/icons/allout-widgets-dark-bg/encrypted-unlocked.png b/etc/images/icons/allout-widgets/dark-bg/unlocked-encrypted.png similarity index 100% rename from etc/images/icons/allout-widgets-dark-bg/encrypted-unlocked.png rename to etc/images/icons/allout-widgets/dark-bg/unlocked-encrypted.png diff --git a/etc/images/icons/allout-widgets-dark-bg/encrypted-unlocked.xpm b/etc/images/icons/allout-widgets/dark-bg/unlocked-encrypted.xpm similarity index 100% rename from etc/images/icons/allout-widgets-dark-bg/encrypted-unlocked.xpm rename to etc/images/icons/allout-widgets/dark-bg/unlocked-encrypted.xpm diff --git a/etc/images/icons/allout-widgets-light-bg/closed.png b/etc/images/icons/allout-widgets/light-bg/closed.png similarity index 100% rename from etc/images/icons/allout-widgets-light-bg/closed.png rename to etc/images/icons/allout-widgets/light-bg/closed.png diff --git a/etc/images/icons/allout-widgets-light-bg/closed.xpm b/etc/images/icons/allout-widgets/light-bg/closed.xpm similarity index 100% rename from etc/images/icons/allout-widgets-light-bg/closed.xpm rename to etc/images/icons/allout-widgets/light-bg/closed.xpm diff --git a/etc/images/icons/allout-widgets-light-bg/empty.png b/etc/images/icons/allout-widgets/light-bg/empty.png similarity index 100% rename from etc/images/icons/allout-widgets-light-bg/empty.png rename to etc/images/icons/allout-widgets/light-bg/empty.png diff --git a/etc/images/icons/allout-widgets-light-bg/empty.xpm b/etc/images/icons/allout-widgets/light-bg/empty.xpm similarity index 100% rename from etc/images/icons/allout-widgets-light-bg/empty.xpm rename to etc/images/icons/allout-widgets/light-bg/empty.xpm diff --git a/etc/images/icons/allout-widgets-light-bg/end-connector.png b/etc/images/icons/allout-widgets/light-bg/end-connector.png similarity index 100% rename from etc/images/icons/allout-widgets-light-bg/end-connector.png rename to etc/images/icons/allout-widgets/light-bg/end-connector.png diff --git a/etc/images/icons/allout-widgets-light-bg/end-connector.xpm b/etc/images/icons/allout-widgets/light-bg/end-connector.xpm similarity index 100% rename from etc/images/icons/allout-widgets-light-bg/end-connector.xpm rename to etc/images/icons/allout-widgets/light-bg/end-connector.xpm diff --git a/etc/images/icons/allout-widgets-light-bg/extender-connector.png b/etc/images/icons/allout-widgets/light-bg/extender-connector.png similarity index 100% rename from etc/images/icons/allout-widgets-light-bg/extender-connector.png rename to etc/images/icons/allout-widgets/light-bg/extender-connector.png diff --git a/etc/images/icons/allout-widgets-light-bg/extender-connector.xpm b/etc/images/icons/allout-widgets/light-bg/extender-connector.xpm similarity index 100% rename from etc/images/icons/allout-widgets-light-bg/extender-connector.xpm rename to etc/images/icons/allout-widgets/light-bg/extender-connector.xpm diff --git a/etc/images/icons/allout-widgets-light-bg/leaf.png b/etc/images/icons/allout-widgets/light-bg/leaf.png similarity index 100% rename from etc/images/icons/allout-widgets-light-bg/leaf.png rename to etc/images/icons/allout-widgets/light-bg/leaf.png diff --git a/etc/images/icons/allout-widgets-light-bg/leaf.xpm b/etc/images/icons/allout-widgets/light-bg/leaf.xpm similarity index 100% rename from etc/images/icons/allout-widgets-light-bg/leaf.xpm rename to etc/images/icons/allout-widgets/light-bg/leaf.xpm diff --git a/etc/images/icons/allout-widgets-light-bg/encrypted-locked.png b/etc/images/icons/allout-widgets/light-bg/locked-encrypted.png similarity index 100% rename from etc/images/icons/allout-widgets-light-bg/encrypted-locked.png rename to etc/images/icons/allout-widgets/light-bg/locked-encrypted.png diff --git a/etc/images/icons/allout-widgets-light-bg/encrypted-locked.xpm b/etc/images/icons/allout-widgets/light-bg/locked-encrypted.xpm similarity index 100% rename from etc/images/icons/allout-widgets-light-bg/encrypted-locked.xpm rename to etc/images/icons/allout-widgets/light-bg/locked-encrypted.xpm diff --git a/etc/images/icons/allout-widgets-light-bg/mid-connector.png b/etc/images/icons/allout-widgets/light-bg/mid-connector.png similarity index 100% rename from etc/images/icons/allout-widgets-light-bg/mid-connector.png rename to etc/images/icons/allout-widgets/light-bg/mid-connector.png diff --git a/etc/images/icons/allout-widgets-light-bg/mid-connector.xpm b/etc/images/icons/allout-widgets/light-bg/mid-connector.xpm similarity index 100% rename from etc/images/icons/allout-widgets-light-bg/mid-connector.xpm rename to etc/images/icons/allout-widgets/light-bg/mid-connector.xpm diff --git a/etc/images/icons/allout-widgets-light-bg/opened.png b/etc/images/icons/allout-widgets/light-bg/opened.png similarity index 100% rename from etc/images/icons/allout-widgets-light-bg/opened.png rename to etc/images/icons/allout-widgets/light-bg/opened.png diff --git a/etc/images/icons/allout-widgets-light-bg/opened.xpm b/etc/images/icons/allout-widgets/light-bg/opened.xpm similarity index 100% rename from etc/images/icons/allout-widgets-light-bg/opened.xpm rename to etc/images/icons/allout-widgets/light-bg/opened.xpm diff --git a/etc/images/icons/allout-widgets-light-bg/skip-descender.png b/etc/images/icons/allout-widgets/light-bg/skip-descender.png similarity index 100% rename from etc/images/icons/allout-widgets-light-bg/skip-descender.png rename to etc/images/icons/allout-widgets/light-bg/skip-descender.png diff --git a/etc/images/icons/allout-widgets-light-bg/skip-descender.xpm b/etc/images/icons/allout-widgets/light-bg/skip-descender.xpm similarity index 100% rename from etc/images/icons/allout-widgets-light-bg/skip-descender.xpm rename to etc/images/icons/allout-widgets/light-bg/skip-descender.xpm diff --git a/etc/images/icons/allout-widgets-light-bg/through-descender.png b/etc/images/icons/allout-widgets/light-bg/through-descender.png similarity index 100% rename from etc/images/icons/allout-widgets-light-bg/through-descender.png rename to etc/images/icons/allout-widgets/light-bg/through-descender.png diff --git a/etc/images/icons/allout-widgets-light-bg/through-descender.xpm b/etc/images/icons/allout-widgets/light-bg/through-descender.xpm similarity index 100% rename from etc/images/icons/allout-widgets-light-bg/through-descender.xpm rename to etc/images/icons/allout-widgets/light-bg/through-descender.xpm diff --git a/etc/images/icons/allout-widgets-light-bg/encrypted-unlocked.png b/etc/images/icons/allout-widgets/light-bg/unlocked-encrypted.png similarity index 100% rename from etc/images/icons/allout-widgets-light-bg/encrypted-unlocked.png rename to etc/images/icons/allout-widgets/light-bg/unlocked-encrypted.png diff --git a/etc/images/icons/allout-widgets-light-bg/encrypted-unlocked.xpm b/etc/images/icons/allout-widgets/light-bg/unlocked-encrypted.xpm similarity index 100% rename from etc/images/icons/allout-widgets-light-bg/encrypted-unlocked.xpm rename to etc/images/icons/allout-widgets/light-bg/unlocked-encrypted.xpm diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0ff975592ca..c6b67ccfd73 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2011-02-17 Ken Manheimer + + * lisp/allout-widgets.el: (allout-widgets-icons-light-subdir) + (allout-widgets-icons-dark-subdir): Track relocations of icons + * lisp/allout.el: Remove commentary about remove encryption + passphrase mnemonic support and verification. + 2011-02-17 Deniz Dogan * net/rcirc.el (rcirc-float-time): New function. diff --git a/lisp/allout-widgets.el b/lisp/allout-widgets.el index 1d2523f2026..75e1e5882f6 100644 --- a/lisp/allout-widgets.el +++ b/lisp/allout-widgets.el @@ -154,12 +154,12 @@ See `allout-widgets-mode' for allout widgets mode features." ;; (make-variable-buffer-local 'allout-widgets-allow-unruly-edits) ;;;_ = allout-widgets-auto-activation - below, for eval-order dependencies ;;;_ = allout-widgets-icons-dark-subdir -(defcustom allout-widgets-icons-dark-subdir "icons/allout-widgets-dark-bg/" +(defcustom allout-widgets-icons-dark-subdir "icons/allout-widgets/dark-bg/" "Directory on `image-load-path' holding allout icons for dark backgrounds." :type 'string :group 'allout-widgets) ;;;_ = allout-widgets-icons-light-subdir -(defcustom allout-widgets-icons-light-subdir "icons/allout-widgets-light-bg/" +(defcustom allout-widgets-icons-light-subdir "icons/allout-widgets/light-bg/" "Directory on `image-load-path' holding allout icons for light backgrounds." :type 'string :group 'allout-widgets) @@ -1923,8 +1923,8 @@ reapplying this method will rectify the glyphs." (setq icon-state (cond (does-encrypt (if is-encrypted - 'encrypted-locked - 'encrypted-unlocked)) + 'locked-encrypted + 'unlocked-encrypted)) (expanded 'opened) (has-subitems 'closed) (t 'empty))) diff --git a/lisp/allout.el b/lisp/allout.el index f77fb0b47bd..4496f9a9f00 100644 --- a/lisp/allout.el +++ b/lisp/allout.el @@ -39,11 +39,9 @@ ;; emacs local file variables need to be enabled when the ;; file was visited -- see `enable-local-variables'.) ;; - Configurable per-file initial exposure settings -;; - Symmetric-key and key-pair topic encryption, plus symmetric passphrase -;; mnemonic support, with verification against an established passphrase -;; (using a stashed encrypted dummy string) and user-supplied hint -;; maintenance. Encryption is via the Emacs 'epg' library. See -;; allout-toggle-current-subtree-encryption docstring. +;; - Symmetric-key and key-pair topic encryption. Encryption is via the +;; Emacs 'epg' library. See allout-toggle-current-subtree-encryption +;; docstring. ;; - Automatic topic-number maintenance ;; - "Hot-spot" operation, for single-keystroke maneuvering and ;; exposure control (see the allout-mode docstring) From 2a095cec7ae4b3e076bcb0aba542248c3660e158 Mon Sep 17 00:00:00 2001 From: Ken Manheimer Date: Thu, 17 Feb 2011 17:57:38 -0500 Subject: [PATCH 37/46] (allout-encrypt-string): Recognize epg failure to decrypt gpg2 armored text using gpg1, and add indication the gpg version *might* be the problem in the error message. --- lisp/ChangeLog | 3 +++ lisp/allout.el | 11 ++++++++--- lisp/dired.el | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c6b67ccfd73..c149e208634 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -4,6 +4,9 @@ (allout-widgets-icons-dark-subdir): Track relocations of icons * lisp/allout.el: Remove commentary about remove encryption passphrase mnemonic support and verification. + (allout-encrypt-string): (allout-encrypt-string): Recognize epg + failure to decrypt gpg2 armored text using gpg1, and indicate that + the gpg version *might* be the problem in the error message. 2011-02-17 Deniz Dogan diff --git a/lisp/allout.el b/lisp/allout.el index 4496f9a9f00..1a7d8cb1593 100644 --- a/lisp/allout.el +++ b/lisp/allout.el @@ -6086,9 +6086,14 @@ signal." (setq result-text (if decrypt - (epg-decrypt-string epg-context - (encode-coding-string massaged-text - (or encoding 'utf-8))) + (condition-case err + (epg-decrypt-string epg-context + (encode-coding-string massaged-text + (or encoding 'utf-8))) + (epg-error + (signal 'egp-error + (cons (concat (cadr err) " - gpg version problem?") + (cddr err))))) (replace-regexp-in-string "\n$" "" (epg-encrypt-string epg-context (encode-coding-string massaged-text diff --git a/lisp/dired.el b/lisp/dired.el index 058dbdc548a..22d9f91648c 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -4029,7 +4029,7 @@ true then the type of the file linked to by FILE is printed instead. ;;;*** ;;;### (autoloads (dired-do-relsymlink dired-jump) "dired-x" "dired-x.el" -;;;;;; "d35468f85920d324895b0c04bb703328") +;;;;;; "a2af6147cf06b53166d9e1a3bb200675") ;;; Generated autoloads from dired-x.el (autoload 'dired-jump "dired-x" "\ From 7ba93e94392a7a5ffe0c3c2d87f04f26b6054026 Mon Sep 17 00:00:00 2001 From: Gnus developers Date: Thu, 17 Feb 2011 23:46:18 +0000 Subject: [PATCH 38/46] Merge chagnes made in Gnus trunk. auth.texi (GnuPG and EasyPG Assistant Configuration): Mention the default now is to have two files in `auth-sources'. nnimap.el (nnimap-open-connection-1): Delete duplicate server names when getting credentials. gnus-util.el (gnus-delete-duplicates): New function. nnimap.el (nnimap-credentials): Instead of picking the first port as a creation default, pass the whole port list down. It will be completed. auth-source.el (auth-source-search): Updated docs to talk about multiple creation choices. (auth-source-netrc-create): Accept a list as a value (from the search parameters) and do completion on that list. Keep a separate netrc line with the password obscured for showing the user. nnimap.el (nnimap-open-connection-1): Make the `nnimap-address' the first choice to `auth-source-search' so it will be used for entry creation instead of the server's Gnus-specific name. (nnimap-credentials): Rely on the auth-source library to select which port is actually wanted in the new netrc entry, so don't override `auth-source-creation-defaults'. --- doc/misc/ChangeLog | 2 ++ doc/misc/auth.texi | 4 ++- lisp/gnus/ChangeLog | 24 ++++++++++++++++++ lisp/gnus/auth-source.el | 54 ++++++++++++++++++++++++++++------------ lisp/gnus/gnus-util.el | 9 +++++++ lisp/gnus/nnimap.el | 10 ++++---- 6 files changed, 81 insertions(+), 22 deletions(-) diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 9a292c03c8d..c075f1785d3 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -2,6 +2,8 @@ * auth.texi (Help for users): Use :port instead of :protocol for all auth-source docs. + (GnuPG and EasyPG Assistant Configuration): Mention the default now is + to have two files in `auth-sources'. 2011-02-16 Glenn Morris diff --git a/doc/misc/auth.texi b/doc/misc/auth.texi index 0e19bce0b9f..67f5b52b694 100644 --- a/doc/misc/auth.texi +++ b/doc/misc/auth.texi @@ -262,7 +262,9 @@ TODO: how to include docstring? @appendix GnuPG and EasyPG Assistant Configuration If you don't customize @code{auth-sources}, the auth-source library -reads @code{~/.authinfo.gpg}, which is a GnuPG encrypted file. +reads @code{~/.authinfo.gpg}, which is a GnuPG encrypted file. Then +it will check @code{~/.authinfo} but it's not recommended to use such +an unencrypted file. In Emacs 23 or later there is an option @code{auto-encryption-mode} to automatically decrypt @code{*.gpg} files. It is enabled by default. diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index cc405410db9..7b6aa86ac06 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,5 +1,29 @@ +2011-02-17 Lars Ingebrigtsen + + * nnimap.el (nnimap-open-connection-1): Delete duplicate server names + when getting credentials. + + * gnus-util.el (gnus-delete-duplicates): New function. + 2011-02-17 Teodor Zlatanov + * nnimap.el (nnimap-credentials): Instead of picking the first port as + a creation default, pass the whole port list down. It will be + completed. + + * auth-source.el (auth-source-search): Updated docs to talk about + multiple creation choices. + (auth-source-netrc-create): Accept a list as a value (from the search + parameters) and do completion on that list. Keep a separate netrc line + with the password obscured for showing the user. + + * nnimap.el (nnimap-open-connection-1): Make the `nnimap-address' the + first choice to `auth-source-search' so it will be used for entry + creation instead of the server's Gnus-specific name. + (nnimap-credentials): Rely on the auth-source library to select which + port is actually wanted in the new netrc entry, so don't override + `auth-source-creation-defaults'. + * auth-source.el (auth-source-netrc-parse): Use :port instead of :protocol and accept a missing user, host, or port as a wildcard match. (auth-source-debug): Default to off. diff --git a/lisp/gnus/auth-source.el b/lisp/gnus/auth-source.el index 29a3ca06707..338dd01e77b 100644 --- a/lisp/gnus/auth-source.el +++ b/lisp/gnus/auth-source.el @@ -453,8 +453,8 @@ which says: search to find only entries that have P set to 'pppp'.\" When multiple values are specified in the search parameter, the -first one is used for creation. So :host (X Y Z) would create a -token for host X, for instance. +user is prompted for which one. So :host (X Y Z) would ask the +user to choose between X, Y, and Z. This creation can fail if the search was not specific enough to create a new token (it's up to the backend to decide that). You @@ -851,6 +851,7 @@ See `auth-source-search' for details on SPEC." (required (append base-required create-extra)) (file (oref backend source)) (add "") + (show "") ;; `valist' is an alist valist ;; `artificial' will be returned if no creation is needed @@ -858,12 +859,16 @@ See `auth-source-search' for details on SPEC." ;; only for base required elements (defined as function parameters): ;; fill in the valist with whatever data we may have from the search - ;; we take the first value if it's a list, the whole value otherwise + ;; we complete the first value if it's a list and use the value otherwise (dolist (br base-required) (when (symbol-value br) - (aput 'valist br (if (listp (symbol-value br)) - (nth 0 (symbol-value br)) - (symbol-value br))))) + (let ((br-choice (cond + ;; all-accepting choice (predicate is t) + ((eq t (symbol-value br)) nil) + ;; just the value otherwise + (t (symbol-value br))))) + (when br-choice + (aput 'valist br br-choice))))) ;; for extra required elements, see if the spec includes a value for them (dolist (er create-extra) @@ -894,6 +899,8 @@ See `auth-source-search' for details on SPEC." (user-value (aget valist 'user)) (host-value (aget valist 'host)) (port-value (aget valist 'port)) + ;; note this handles lists by just printing them + ;; later we allow the user to use completing-read to pick (info-so-far (concat (if user-value (format "%s@" user-value) "[USER?]") @@ -921,6 +928,16 @@ See `auth-source-search' for details on SPEC." (format "Enter %s for %s%s: " r info-so-far default-string) nil nil default)) + ((listp data) + (completing-read + (format "Enter %s for %s (TAB to see the choices): " + r info-so-far) + data + nil ; no predicate + t ; require a match + ;; note the default is nil, but if the user + ;; hits RET we'll get "", which is handled OK later + nil)) (t data)))) (when data @@ -934,20 +951,25 @@ See `auth-source-search' for details on SPEC." ;; when r is not an empty string... (when (and (stringp data) (< 0 (length data))) - ;; append the key (the symbol name of r) and the value in r - (setq add (concat add - (format "%s%s %S" - ;; prepend a space - (if (zerop (length add)) "" " ") - ;; remap auth-source tokens to netrc - (case r + (let ((printer (lambda (hide) + ;; append the key (the symbol name of r) + ;; and the value in r + (format "%s%s %S" + ;; prepend a space + (if (zerop (length add)) "" " ") + ;; remap auth-source tokens to netrc + (case r ('user "login") ('host "machine") ('secret "password") ('port "port") ; redundant but clearer (t (symbol-name r))) - ;; the value will be printed in %S format - data)))))) + ;; the value will be printed in %S format + (if (and hide (eq r 'secret)) + "HIDDEN_SECRET" + data))))) + (setq add (concat add (funcall printer nil))) + (setq show (concat show (funcall printer t))))))) (with-temp-buffer (when (file-exists-p file) @@ -964,7 +986,7 @@ See `auth-source-search' for details on SPEC." (goto-char (point-max)) ;; ask AFTER we've successfully opened the file - (if (y-or-n-p (format "Add to file %s: line [%s]" file add)) + (if (y-or-n-p (format "Add to file %s: line [%s]" file show)) (progn (unless (bolp) (insert "\n")) diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el index 67c49096b92..42dbd5948cf 100644 --- a/lisp/gnus/gnus-util.el +++ b/lisp/gnus/gnus-util.el @@ -871,6 +871,15 @@ Bind `print-quoted' and `print-readably' to t, and `print-length' and (when (file-exists-p file) (delete-file file))) +(defun gnus-delete-duplicates (list) + "Remove duplicate entries from LIST." + (let ((result nil)) + (while list + (unless (member (car list) result) + (push (car list) result)) + (pop list)) + (nreverse result))) + (defun gnus-delete-directory (directory) "Delete files in DIRECTORY. Subdirectories remain. If there's no subdirectory, delete DIRECTORY as well." diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index fc8873ff565..7f8ecc1710f 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el @@ -277,8 +277,7 @@ textual parts.") (current-buffer))) (defun nnimap-credentials (address ports) - (let* ((auth-source-creation-defaults `((port . ,(nth 0 ports)))) - (found (nth 0 (auth-source-search :max 1 + (let* ((found (nth 0 (auth-source-search :max 1 :host address :port ports :create t))) @@ -385,9 +384,10 @@ textual parts.") ;; Look for the credentials based on ;; the virtual server name and the address (nnimap-credentials - (list - (nnoo-current-server 'nnimap) - nnimap-address) + (gnus-delete-duplicates + (list + nnimap-address + (nnoo-current-server 'nnimap))) ports)))) (setq nnimap-object nil) (let ((nnimap-inhibit-logging t)) From 1d2c4a492b42338c74e5970618a97fb477ab6ba7 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Thu, 17 Feb 2011 23:48:59 +0000 Subject: [PATCH 39/46] auth-source.el (auth-source-search): Do a two-phase search, one with no :create to get the responses from all backends. --- lisp/gnus/ChangeLog | 3 ++ lisp/gnus/auth-source.el | 71 +++++++++++++++++++++++++--------------- 2 files changed, 48 insertions(+), 26 deletions(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 7b6aa86ac06..9c4fc939d84 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,5 +1,8 @@ 2011-02-17 Lars Ingebrigtsen + * auth-source.el (auth-source-search): Do a two-phase search, one with + no :create to get the responses from all backends. + * nnimap.el (nnimap-open-connection-1): Delete duplicate server names when getting credentials. diff --git a/lisp/gnus/auth-source.el b/lisp/gnus/auth-source.el index 338dd01e77b..0bfb55aedd1 100644 --- a/lisp/gnus/auth-source.el +++ b/lisp/gnus/auth-source.el @@ -500,7 +500,7 @@ must call it to obtain the actual value." unless (memq (nth i spec) ignored-keys) collect (nth i spec))) (found (auth-source-recall spec)) - filtered-backends accessor-key found-here goal) + filtered-backends accessor-key found-here goal matches) (if (and found auth-source-do-cache) (auth-source-do-debug @@ -529,38 +529,57 @@ must call it to obtain the actual value." ;; (debug spec "filtered" filtered-backends) (setq goal max) - (dolist (backend filtered-backends) - (setq found-here (apply - (slot-value backend 'search-function) - :backend backend - :create create - :delete delete - spec)) + ;; First go through all the backends without :create, so we can + ;; query them all. + (let ((uspec (copy-sequence spec))) + (plist-put uspec :create nil) + (dolist (backend filtered-backends) + (let ((match (apply + (slot-value backend 'search-function) + :backend backend + uspec))) + (when match + (push (list backend match) matches))))) + ;; If we didn't find anything, then we allow the backend(s) to + ;; create the entries. + (unless matches + (let ((match (apply + (slot-value backend 'search-function) + :backend backend + :create create + :delete delete + spec))) + (when match + (push (list backend match) matches)))) - ;; if max is 0, as soon as we find something, return it - (when (and (zerop max) (> 0 (length found-here))) - (return t)) + (setq backend (caar matches) + found-here (cadar matches)) - ;; decrement the goal by the number of new results - (decf goal (length found-here)) - ;; and append the new results to the full list - (setq found (append found found-here)) + (block nil + ;; if max is 0, as soon as we find something, return it + (when (and (zerop max) (> 0 (length found-here))) + (return t)) - (auth-source-do-debug - "auth-source-search: found %d results (max %d/%d) in %S matching %S" - (length found-here) max goal backend spec) + ;; decrement the goal by the number of new results + (decf goal (length found-here)) + ;; and append the new results to the full list + (setq found (append found found-here)) - ;; return full list if the goal is 0 or negative - (when (zerop (max 0 goal)) - (return found)) + (auth-source-do-debug + "auth-source-search: found %d results (max %d/%d) in %S matching %S" + (length found-here) max goal backend spec) - ;; change the :max parameter in the spec to the goal - (setq spec (plist-put spec :max goal))) + ;; return full list if the goal is 0 or negative + (when (zerop (max 0 goal)) + (return found)) - (when (and found auth-source-do-cache) - (auth-source-remember spec found))) + ;; change the :max parameter in the spec to the goal + (setq spec (plist-put spec :max goal)) - found)) + (when (and found auth-source-do-cache) + (auth-source-remember spec found)))) + + found)) ;;; (auth-source-search :max 1) ;;; (funcall (plist-get (nth 0 (auth-source-search :max 1)) :secret)) From c13bc26baa86db1e95ea8a608958647a7b84084f Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Fri, 18 Feb 2011 00:41:50 +0000 Subject: [PATCH 40/46] nnimap.el (nnimap-log-command): Add a newline to the inhibited logging. (nnimap-credentials): Protect against auth-source-search returning nil. (nnimap-request-list): Protect against not being able to open the server. --- lisp/gnus/ChangeLog | 8 +++ lisp/gnus/nnimap.el | 125 +++++++++++++++++++++++--------------------- 2 files changed, 72 insertions(+), 61 deletions(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 9c4fc939d84..28533e9ab22 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,11 @@ +2011-02-18 Lars Ingebrigtsen + + * nnimap.el (nnimap-log-command): Add a newline to the inhibited + logging. + (nnimap-credentials): Protect against auth-source-search returning nil. + (nnimap-request-list): Protect against not being able to open the + server. + 2011-02-17 Lars Ingebrigtsen * auth-source.el (auth-source-search): Do a two-phase search, one with diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index 7f8ecc1710f..9c93ee8bbd9 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el @@ -277,15 +277,16 @@ textual parts.") (current-buffer))) (defun nnimap-credentials (address ports) - (let* ((found (nth 0 (auth-source-search :max 1 - :host address - :port ports - :create t))) - (user (plist-get found :user)) - (secret (plist-get found :secret)) - (secret (if (functionp secret) (funcall secret) secret))) + (let ((found (nth 0 (auth-source-search :max 1 + :host address + :port ports + :create t)))) (if found - (list user secret) + (list (plist-get found :user) + (let ((secret (plist-get found :secret))) + (if (functionp secret) + (funcall secret) + secret))) nil))) (defun nnimap-keepalive () @@ -1074,60 +1075,62 @@ textual parts.") (nreverse groups))) (deffoo nnimap-request-list (&optional server) - (nnimap-possibly-change-group nil server) - (with-current-buffer nntp-server-buffer - (erase-buffer) - (let ((groups - (with-current-buffer (nnimap-buffer) - (nnimap-get-groups))) - sequences responses) - (when groups - (with-current-buffer (nnimap-buffer) - (setf (nnimap-group nnimap-object) nil) - (dolist (group groups) - (setf (nnimap-examined nnimap-object) group) - (push (list (nnimap-send-command "EXAMINE %S" (utf7-encode group t)) - group) - sequences)) - (nnimap-wait-for-response (caar sequences)) - (setq responses - (nnimap-get-responses (mapcar #'car sequences)))) - (dolist (response responses) - (let* ((sequence (car response)) - (response (cadr response)) - (group (cadr (assoc sequence sequences)))) - (when (and group - (equal (caar response) "OK")) - (let ((uidnext (nnimap-find-parameter "UIDNEXT" response)) - highest exists) - (dolist (elem response) - (when (equal (cadr elem) "EXISTS") - (setq exists (string-to-number (car elem))))) - (when uidnext - (setq highest (1- (string-to-number (car uidnext))))) - (cond - ((null highest) - (insert (format "%S 0 1 y\n" (utf7-decode group t)))) - ((zerop exists) - ;; Empty group. - (insert (format "%S %d %d y\n" - (utf7-decode group t) highest (1+ highest)))) - (t - ;; Return the widest possible range. - (insert (format "%S %d 1 y\n" (utf7-decode group t) - (or highest exists))))))))) - t)))) + (when (nnimap-possibly-change-group nil server) + (with-current-buffer nntp-server-buffer + (erase-buffer) + (let ((groups + (with-current-buffer (nnimap-buffer) + (nnimap-get-groups))) + sequences responses) + (when groups + (with-current-buffer (nnimap-buffer) + (setf (nnimap-group nnimap-object) nil) + (dolist (group groups) + (setf (nnimap-examined nnimap-object) group) + (push (list (nnimap-send-command "EXAMINE %S" + (utf7-encode group t)) + group) + sequences)) + (nnimap-wait-for-response (caar sequences)) + (setq responses + (nnimap-get-responses (mapcar #'car sequences)))) + (dolist (response responses) + (let* ((sequence (car response)) + (response (cadr response)) + (group (cadr (assoc sequence sequences)))) + (when (and group + (equal (caar response) "OK")) + (let ((uidnext (nnimap-find-parameter "UIDNEXT" response)) + highest exists) + (dolist (elem response) + (when (equal (cadr elem) "EXISTS") + (setq exists (string-to-number (car elem))))) + (when uidnext + (setq highest (1- (string-to-number (car uidnext))))) + (cond + ((null highest) + (insert (format "%S 0 1 y\n" (utf7-decode group t)))) + ((zerop exists) + ;; Empty group. + (insert (format "%S %d %d y\n" + (utf7-decode group t) + highest (1+ highest)))) + (t + ;; Return the widest possible range. + (insert (format "%S %d 1 y\n" (utf7-decode group t) + (or highest exists))))))))) + t))))) (deffoo nnimap-request-newgroups (date &optional server) - (nnimap-possibly-change-group nil server) - (with-current-buffer nntp-server-buffer - (erase-buffer) - (dolist (group (with-current-buffer (nnimap-buffer) - (nnimap-get-groups))) - (unless (assoc group nnimap-current-infos) - ;; Insert dummy numbers here -- they don't matter. - (insert (format "%S 0 1 y\n" group)))) - t)) + (when (nnimap-possibly-change-group nil server) + (with-current-buffer nntp-server-buffer + (erase-buffer) + (dolist (group (with-current-buffer (nnimap-buffer) + (nnimap-get-groups))) + (unless (assoc group nnimap-current-infos) + ;; Insert dummy numbers here -- they don't matter. + (insert (format "%S 0 1 y\n" group)))) + t))) (deffoo nnimap-retrieve-group-data-early (server infos) (when (nnimap-possibly-change-group nil server) @@ -1588,7 +1591,7 @@ textual parts.") (goto-char (point-max)) (insert (format-time-string "%H:%M:%S") " " (if nnimap-inhibit-logging - "(inhibited)" + "(inhibited)\n" command))) command) From 3804652098c7c8824f332e92846a3b8896b9e683 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Fri, 18 Feb 2011 01:48:21 +0000 Subject: [PATCH 41/46] auth-source.el (auth-source-search): Don't try to create credentials if the caller doesn't want that. --- lisp/gnus/ChangeLog | 3 +++ lisp/gnus/auth-source.el | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 28533e9ab22..b40c6b7d60f 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,5 +1,8 @@ 2011-02-18 Lars Ingebrigtsen + * auth-source.el (auth-source-search): Don't try to create credentials + if the caller doesn't want that. + * nnimap.el (nnimap-log-command): Add a newline to the inhibited logging. (nnimap-credentials): Protect against auth-source-search returning nil. diff --git a/lisp/gnus/auth-source.el b/lisp/gnus/auth-source.el index 0bfb55aedd1..4fdf521b1a9 100644 --- a/lisp/gnus/auth-source.el +++ b/lisp/gnus/auth-source.el @@ -542,7 +542,8 @@ must call it to obtain the actual value." (push (list backend match) matches))))) ;; If we didn't find anything, then we allow the backend(s) to ;; create the entries. - (unless matches + (when (and create + (not matches)) (let ((match (apply (slot-value backend 'search-function) :backend backend From b286858c7a0d5dafa302b9e88970c13385358a6a Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 17 Feb 2011 21:07:36 -0500 Subject: [PATCH 42/46] Don't GC-scan stack data redundantly. * src/alloc.c (Fgarbage_collect): When using stack scanning, don't redundantly scan byte-code stacks, catchlist, and handlerlist. * src/bytecode.c (BYTE_MAINTAIN_TOP): New macros. (struct byte_stack): Only define `top' and `bottom' if used. (mark_byte_stack): Only define if used. (BEFORE_POTENTIAL_GC, AFTER_POTENTIAL_GC): Nullify if BYTE_MAINTAIN_TOP is not set. (Fbyte_code): Don't set `bottom' unless BYTE_MAINTAIN_TOP is set. * src/lisp.h (BYTE_MARK_STACK): New macro. (mark_byte_stack): Only declare if BYTE_MARK_STACK is set. * src/term.c (OUTPUT_IF): Use OUTPUT. --- src/ChangeLog | 83 ++++++++++++++++++++++++++++++-------------------- src/alloc.c | 10 +++--- src/bytecode.c | 19 ++++++++++-- src/lisp.h | 7 +++++ src/term.c | 5 +-- 5 files changed, 80 insertions(+), 44 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 048fc7f052d..9fbc83f6c0c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,20 @@ +2011-02-18 Stefan Monnier + + * lisp.h (BYTE_MARK_STACK): New macro. + (mark_byte_stack): Only declare if BYTE_MARK_STACK is set. + + * bytecode.c (BYTE_MAINTAIN_TOP): New macros. + (struct byte_stack): Only define `top' and `bottom' if used. + (mark_byte_stack): Only define if used. + (BEFORE_POTENTIAL_GC, AFTER_POTENTIAL_GC): Nullify if BYTE_MAINTAIN_TOP + is not set. + (Fbyte_code): Don't set `bottom' unless BYTE_MAINTAIN_TOP is set. + + * term.c (OUTPUT_IF): Use OUTPUT. + + * alloc.c (Fgarbage_collect): When using stack scanning, don't + redundantly scan byte-code stacks, catchlist, and handlerlist. + 2011-02-17 Jan Djärv * nsfns.m (Fx_create_frame, ns_set_name_as_filename) @@ -18,8 +35,8 @@ * xdisp.c (decode_mode_spec): Don't use MODE_LINE_BINARY_TEXT. - * fileio.c (Finsert_file_contents, Fwrite_region): Remove - references to buffer_file_type. + * fileio.c (Finsert_file_contents, Fwrite_region): + Remove references to buffer_file_type. (syms_of_fileio): Don't intern and staticpro find-buffer-file-type. @@ -112,8 +129,8 @@ (strout, print_string, temp_output_buffer_setup, print_object): Replace B_ with BVAR. * msdos.c (IT_frame_up_to_date): Replace B_ with BVAR. - * minibuf.c (read_minibuf, get_minibuffer, Fread_buffer): Replace - B_ with BVAR. + * minibuf.c (read_minibuf, get_minibuffer, Fread_buffer): + Replace B_ with BVAR. * marker.c (Fmarker_buffer, Fset_marker, set_marker_restricted) (set_marker_both, set_marker_restricted_both, unchain_marker): Replace B_ with BVAR. @@ -275,8 +292,8 @@ * xmenu.c (apply_systemfont_to_dialog): Apply to *dialog.font. (apply_systemfont_to_menu): Set resources *menubar*font and *popup*font. Remove defflt. - (set_frame_menubar, create_and_show_popup_menu): Call - apply_systemfont_to_menu before lw_create_widget. + (set_frame_menubar, create_and_show_popup_menu): + Call apply_systemfont_to_menu before lw_create_widget. 2011-02-14 Tom Tromey @@ -305,8 +322,8 @@ (PRINTPREPARE, PRINTFINISH, temp_output_buffer_setup) (print_object): Use B_. * font.c (font_at): Use B_. - * fns.c (Fbase64_encode_region, Fbase64_decode_region, Fmd5): Use - B_. + * fns.c (Fbase64_encode_region, Fbase64_decode_region, Fmd5): + Use B_. * callint.c (check_mark, Fcall_interactively): Use B_. * editfns.c (region_limit, Fmark_marker, save_excursion_save) (save_excursion_restore, Fprevious_char, Fchar_before) @@ -329,8 +346,8 @@ (Freplace_match): Use B_. * indent.c (buffer_display_table, recompute_width_table) (width_run_cache_on_off, current_column, scan_for_column) - (Findent_to, position_indentation, compute_motion, vmotion): Use - B_. + (Findent_to, position_indentation, compute_motion, vmotion): + Use B_. * casefiddle.c (casify_object, casify_region): Use B_. * casetab.c (Fcurrent_case_table, set_case_table): Use B_. * cmds.c (Fself_insert_command, internal_self_insert): Use B_. @@ -344,8 +361,8 @@ (Fdo_auto_save, Fset_buffer_auto_saved): Use B_. * minibuf.c (read_minibuf, get_minibuffer, Fread_buffer): Use B_. * marker.c (Fmarker_buffer, Fset_marker, set_marker_restricted) - (set_marker_both, set_marker_restricted_both, unchain_marker): Use - B_. + (set_marker_both, set_marker_restricted_both, unchain_marker): + Use B_. * insdel.c (check_markers, insert_char, insert_1_both) (insert_from_string_1, insert_from_gap, insert_from_buffer_1) (adjust_after_replace, replace_range, del_range_2) @@ -369,8 +386,8 @@ (make_conversion_work_buffer, decode_coding_gap) (decode_coding_object, encode_coding_object) (Fdetect_coding_region, Ffind_coding_systems_region_internal) - (Funencodable_char_position, Fcheck_coding_systems_region): Use - B_. + (Funencodable_char_position, Fcheck_coding_systems_region): + Use B_. * charset.c (Ffind_charset_region): Use B_. * window.c (window_display_table, unshow_buffer, window_loop) (window_min_size_2, set_window_buffer, Fset_window_buffer) @@ -601,8 +618,8 @@ callers changed. * editfns.c (general_insert_function): Change signature to match changes to insert functions' signatures. - * keymap.c (map_keymap_char_table_item, map_keymap_internal): Use - explicit cast when converting between void * and function pointer + * keymap.c (map_keymap_char_table_item, map_keymap_internal): + Use explicit cast when converting between void * and function pointer types, as C89 requires this. 2011-02-05 Paul Eggert @@ -722,7 +739,7 @@ 2011-02-01 Paul Eggert format-time-string now supports subsecond time stamp resolution - * editfns.c (emacs_nmemftime): Renamed from emacs_memftimeu, + * editfns.c (emacs_nmemftime): Rename from emacs_memftimeu, for consistency with its new argument and with gnulib nstrftime. All callers changed. New argument NS. (Fformat_time_string): Check that the time argument's microseconds @@ -1052,11 +1069,11 @@ (history_delete_duplicates, inhibit_x_resources) (last_nonmenu_event, load_in_progress, max_specpdl_size) (minibuffer_auto_raise, print_escape_newlines, scroll_margin) - (use_dialog_box, use_file_dialog): Remove declaration. Include - globals.h. + (use_dialog_box, use_file_dialog): Remove declaration. + Include globals.h. * keymap.h (Voverriding_local_map) - (Voverriding_local_map_menu_flag, meta_prefix_char): Remove - declaration. + (Voverriding_local_map_menu_flag, meta_prefix_char): + Remove declaration. * keyboard.h (Vdouble_click_time, Vfunction_key_map) (Vinput_method_function, Vkey_translation_map) (Vlucid_menu_bar_dirty_flag, Vthis_original_command) @@ -1074,16 +1091,16 @@ (focus_follows_mouse): Remove declaration. * fontset.h (Valternate_fontname_alist, Vfontset_alias_alist) (Vignore_relative_composition, Votf_script_alist) - (Vuse_default_ascent, Vvertical_centering_font_regexp): Remove - declaration. + (Vuse_default_ascent, Vvertical_centering_font_regexp): + Remove declaration. * font.h (Vfont_log): Remove declaration. * dosfns.h (Vdos_display_scancodes, Vdos_version) (Vdos_windows_version, dos_codepage, dos_country_code) (dos_decimal_point, dos_hyper_key, dos_keyboard_layout) - (dos_keypad_mode, dos_super_key, dos_timezone_offset): Remove - declaration. - * disptab.h (Vglyph_table, Vstandard_display_table): Remove - declaration. + (dos_keypad_mode, dos_super_key, dos_timezone_offset): + Remove declaration. + * disptab.h (Vglyph_table, Vstandard_display_table): + Remove declaration. * dispextern.h (Vface_remapping_alist, Vglyphless_char_display) (Vmouse_autoselect_window, Voverflow_newline_into_fringe) (Vshow_trailing_whitespace, Vtool_bar_button_margin) @@ -1111,10 +1128,10 @@ (Vselect_safe_coding_system_function) (Vtranslation_table_for_input, coding_system_require_warning) (eol_mnemonic_dos, eol_mnemonic_mac, eol_mnemonic_undecided) - (eol_mnemonic_unix, inherit_process_coding_system): Remove - declaration. - * charset.h (Vcharset_list, Vcurrent_iso639_language): Remove - declaration. + (eol_mnemonic_unix, inherit_process_coding_system): + Remove declaration. + * charset.h (Vcharset_list, Vcurrent_iso639_language): + Remove declaration. * character.h (Vauto_fill_chars, Vchar_direction_table) (Vchar_script_table, Vchar_width_table, Vprintable_chars) (Vscript_representative_chars, Vtranslation_table_vector) @@ -1229,8 +1246,8 @@ (w32_strict_fontnames, w32_strict_painting): Remove. (Vhourglass_delay, Vmenu_bar_mode, Vtool_bar_mode) (Vw32_recognize_altgr, Vwindow_system_version) - (w32_num_mouse_buttons, w32_use_visible_system_caret): Remove - declaration. + (w32_num_mouse_buttons, w32_use_visible_system_caret): + Remove declaration. * w32console.c (syms_of_ntterm): Update. (w32_use_full_screen_buffer): Remove. (Vtty_defined_color_alist): Remove declaration. diff --git a/src/alloc.c b/src/alloc.c index 566c6fe00b9..e8b8f45e9b1 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -4842,8 +4842,6 @@ returns nil, because real GC can't be done. */) (void) { register struct specbinding *bind; - struct catchtag *catch; - struct handler *handler; char stack_top_variable; register int i; int message_p; @@ -4972,9 +4970,11 @@ returns nil, because real GC can't be done. */) for (i = 0; i < tail->nvars; i++) mark_object (tail->var[i]); } -#endif - mark_byte_stack (); + { + struct catchtag *catch; + struct handler *handler; + for (catch = catchlist; catch; catch = catch->next) { mark_object (catch->tag); @@ -4985,7 +4985,9 @@ returns nil, because real GC can't be done. */) mark_object (handler->handler); mark_object (handler->var); } + } mark_backtrace (); +#endif #ifdef HAVE_WINDOW_SYSTEM mark_fringe_data (); diff --git a/src/bytecode.c b/src/bytecode.c index a88df080c5a..cf4a1fc225f 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -229,6 +229,8 @@ Lisp_Object Qbytecode; #define Bconstant 0300 #define CONSTANTLIM 0100 +/* Whether to maintain a `top' and `bottom' field in the stack frame. */ +#define BYTE_MAINTAIN_TOP (BYTE_CODE_SAFE || BYTE_MARK_STACK) /* Structure describing a value stack used during byte-code execution in Fbyte_code. */ @@ -241,7 +243,9 @@ struct byte_stack /* Top and bottom of stack. The bottom points to an area of memory allocated with alloca in Fbyte_code. */ +#if BYTE_MAINTAIN_TOP Lisp_Object *top, *bottom; +#endif /* The string containing the byte-code, and its current address. Storing this here protects it from GC because mark_byte_stack @@ -268,6 +272,7 @@ struct byte_stack *byte_stack_list; /* Mark objects on byte_stack_list. Called during GC. */ +#if BYTE_MARK_STACK void mark_byte_stack (void) { @@ -292,7 +297,7 @@ mark_byte_stack (void) mark_object (stack->constants); } } - +#endif /* Unmark objects in the stacks on byte_stack_list. Relocate program counters. Called when GC has completed. */ @@ -346,8 +351,13 @@ unmark_byte_stack (void) /* Actions that must be performed before and after calling a function that might GC. */ +#if !BYTE_MAINTAIN_TOP +#define BEFORE_POTENTIAL_GC() ((void)0) +#define AFTER_POTENTIAL_GC() ((void)0) +#else #define BEFORE_POTENTIAL_GC() stack.top = top #define AFTER_POTENTIAL_GC() stack.top = NULL +#endif /* Garbage collect if we have consed enough since the last time. We do this at every branch, to avoid loops that never GC. */ @@ -447,10 +457,13 @@ If the third argument is incorrect, Emacs may crash. */) stack.byte_string = bytestr; stack.pc = stack.byte_string_start = SDATA (bytestr); stack.constants = vector; - stack.bottom = (Lisp_Object *) alloca (XFASTINT (maxdepth) + top = (Lisp_Object *) alloca (XFASTINT (maxdepth) * sizeof (Lisp_Object)); - top = stack.bottom - 1; +#if BYTE_MAINTAIN_TOP + stack.bottom = top; stack.top = NULL; +#endif + top -= 1; stack.next = byte_stack_list; byte_stack_list = &stack; diff --git a/src/lisp.h b/src/lisp.h index 7cc2a8e7d45..82c4f65613d 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2145,6 +2145,11 @@ struct gcpro #define GC_MARK_STACK GC_USE_GCPROS_AS_BEFORE #endif +/* Whether we do the stack marking manually. */ +#define BYTE_MARK_STACK !(GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS \ + || GC_MARK_STACK == GC_MARK_STACK_CHECK_GCPROS) + + #if GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS /* Do something silly with gcproN vars just so gcc shuts up. */ @@ -3253,7 +3258,9 @@ extern Lisp_Object Qbytecode; EXFUN (Fbyte_code, 3); extern void syms_of_bytecode (void); extern struct byte_stack *byte_stack_list; +#ifdef BYTE_MARK_STACK extern void mark_byte_stack (void); +#endif extern void unmark_byte_stack (void); /* Defined in macros.c */ diff --git a/src/term.c b/src/term.c index 21ed163c934..f082bb40e89 100644 --- a/src/term.c +++ b/src/term.c @@ -112,10 +112,7 @@ static void vfatal (const char *str, va_list ap) NO_RETURN; #define OUTPUT_IF(tty, a) \ do { \ if (a) \ - emacs_tputs ((tty), a, \ - (int) (FRAME_LINES (XFRAME (selected_frame)) \ - - curY (tty) ), \ - cmputc); \ + OUTPUT (tty, a); \ } while (0) #define OUTPUT1_IF(tty, a) do { if (a) emacs_tputs ((tty), a, 1, cmputc); } while (0) From 5da16a864156ad03820d43cb36d5388373506bca Mon Sep 17 00:00:00 2001 From: Christian Ohler Date: Fri, 18 Feb 2011 15:20:36 +1100 Subject: [PATCH 43/46] Fix ERT. * lisp/emacs-lisp/ert.el (ert--setup-results-buffer) (ert-results-pop-to-backtrace-for-test-at-point) (ert-results-pop-to-messages-for-test-at-point) (ert-results-pop-to-should-forms-for-test-at-point) (ert-results-pop-to-timings): Revert parts of 2011-02-02T17:59:44Z!sds@gnu.org that were incorrect and unnecessary. This should make `make check' pass again. --- lisp/ChangeLog | 10 ++++++++++ lisp/emacs-lisp/ert.el | 22 +++++++++++----------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c149e208634..139bd5e432e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,13 @@ +2011-02-18 Christian Ohler + + * emacs-lisp/ert.el (ert--setup-results-buffer) + (ert-results-pop-to-backtrace-for-test-at-point) + (ert-results-pop-to-messages-for-test-at-point) + (ert-results-pop-to-should-forms-for-test-at-point) + (ert-results-pop-to-timings): Revert parts of change 2011-02-02T17:59:44Z!sds@gnu.org that + were incorrect and unnecessary. This should make `make check' + pass again. + 2011-02-17 Ken Manheimer * lisp/allout-widgets.el: (allout-widgets-icons-light-subdir) diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index 695dc1e2db6..b3c95fcc78f 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -1877,6 +1877,7 @@ BUFFER-NAME, if non-nil, is the buffer name to use." (let ((inhibit-read-only t)) (buffer-disable-undo) (erase-buffer) + (ert-results-mode) ;; Erase buffer again in case switching out of the previous ;; mode inserted anything. (This happens e.g. when switching ;; from ert-results-mode to ert-results-mode when @@ -1895,9 +1896,8 @@ BUFFER-NAME, if non-nil, is the buffer name to use." (ewoc-enter-last ewoc (make-ert--ewoc-entry :test test :hidden-p t))) (ert--results-update-ewoc-hf ert--results-ewoc ert--results-stats) - (goto-char (1- (point-max))))) - (ert-results-mode) - buffer))) + (goto-char (1- (point-max))) + buffer))))) (defvar ert--selector-history nil @@ -2343,6 +2343,7 @@ To be used in the ERT results buffer." (let ((inhibit-read-only t)) (buffer-disable-undo) (erase-buffer) + (ert-simple-view-mode) ;; Use unibyte because `debugger-setup-buffer' also does so. (set-buffer-multibyte nil) (setq truncate-lines t) @@ -2351,8 +2352,7 @@ To be used in the ERT results buffer." (goto-char (point-min)) (insert "Backtrace for test `") (ert-insert-test-name-button (ert-test-name test)) - (insert "':\n") - (ert-simple-view-mode))))))) + (insert "':\n"))))))) (defun ert-results-pop-to-messages-for-test-at-point () "Display the part of the *Messages* buffer generated during the test at point. @@ -2368,12 +2368,12 @@ To be used in the ERT results buffer." (let ((inhibit-read-only t)) (buffer-disable-undo) (erase-buffer) + (ert-simple-view-mode) (insert (ert-test-result-messages result)) (goto-char (point-min)) (insert "Messages for test `") (ert-insert-test-name-button (ert-test-name test)) - (insert "':\n") - (ert-simple-view-mode))))) + (insert "':\n"))))) (defun ert-results-pop-to-should-forms-for-test-at-point () "Display the list of `should' forms executed during the test at point. @@ -2389,6 +2389,7 @@ To be used in the ERT results buffer." (let ((inhibit-read-only t)) (buffer-disable-undo) (erase-buffer) + (ert-simple-view-mode) (if (null (ert-test-result-should-forms result)) (insert "\n(No should forms during this test.)\n") (loop for form-description in (ert-test-result-should-forms result) @@ -2406,8 +2407,7 @@ To be used in the ERT results buffer." (insert (concat "(Values are shallow copies and may have " "looked different during the test if they\n" "have been modified destructively.)\n")) - (forward-line 1) - (ert-simple-view-mode))))) + (forward-line 1))))) (defun ert-results-toggle-printer-limits-for-test-at-point () "Toggle how much of the condition to print for the test at point. @@ -2442,6 +2442,7 @@ To be used in the ERT results buffer." (let ((inhibit-read-only t)) (buffer-disable-undo) (erase-buffer) + (ert-simple-view-mode) (if (null data) (insert "(No data)\n") (insert (format "%-3s %8s %8s\n" "" "time" "cumul")) @@ -2454,8 +2455,7 @@ To be used in the ERT results buffer." (insert "\n")))) (goto-char (point-min)) (insert "Tests by run time (seconds):\n\n") - (forward-line 1) - (ert-simple-view-mode)))) + (forward-line 1)))) ;;;###autoload (defun ert-describe-test (test-or-test-name) From f9d554dd46f9fb76217023a359e8c7297b1dc1e0 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 17 Feb 2011 23:58:21 -0500 Subject: [PATCH 44/46] * lisp/emacs-lisp/pcase.el (pcase--u1): Understand non-linear patterns. --- lisp/ChangeLog | 4 ++++ lisp/emacs-lisp/pcase.el | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 139bd5e432e..8e850fb9409 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2011-02-18 Stefan Monnier + + * emacs-lisp/pcase.el (pcase--u1): Understand non-linear patterns. + 2011-02-18 Christian Ohler * emacs-lisp/ert.el (ert--setup-results-buffer) diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el index 24ea0a3e801..3179672a3ec 100644 --- a/lisp/emacs-lisp/pcase.el +++ b/lisp/emacs-lisp/pcase.el @@ -61,6 +61,8 @@ UPatterns can take the following forms: `QPAT matches if the QPattern QPAT matches. (pred PRED) matches if PRED applied to the object returns non-nil. (guard BOOLEXP) matches if BOOLEXP evaluates to non-nil. +If a SYMBOL is used twice in the same pattern (i.e. the pattern is +\"non-linear\"), then the second occurrence is turned into an `eq'uality test. QPatterns can take the following forms: (QPAT1 . QPAT2) matches if QPAT1 matches the car and QPAT2 the cdr. @@ -457,7 +459,12 @@ and otherwise defers to REST which is a list of branches of the form (pcase--u1 matches code vars then-rest) (pcase--u else-rest)))) ((symbolp upat) - (pcase--u1 matches code (cons (cons upat sym) vars) rest)) + (if (not (assq upat vars)) + (pcase--u1 matches code (cons (cons upat sym) vars) rest) + ;; Non-linear pattern. Turn it into an `eq' test. + (pcase--u1 (cons `(match ,sym . (pred (eq ,(cdr (assq upat vars))))) + matches) + code vars rest))) ((eq (car-safe upat) '\`) (pcase--q1 sym (cadr upat) matches code vars rest)) ((eq (car-safe upat) 'or) From b803a8094fb59410c5bb2cb421e5905e71a99b8b Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Thu, 17 Feb 2011 21:21:57 -0800 Subject: [PATCH 45/46] * lisp/.gitignore: Remove arch-tag. --- lisp/.gitignore | 2 -- 1 file changed, 2 deletions(-) diff --git a/lisp/.gitignore b/lisp/.gitignore index d8ab5055b4a..6d5166e1349 100644 --- a/lisp/.gitignore +++ b/lisp/.gitignore @@ -4,5 +4,3 @@ loaddefs.el subdirs.el finder-inf.el cus-load.el - -# arch-tag: ab6e8f91-fb95-4efe-9c1b-68e21561e68a From 7d315eb67800796d7d7f39030eb7682340d985e5 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 17 Feb 2011 23:41:43 -0800 Subject: [PATCH 46/46] Import IRIX 6.5 getloadavg fixes from gnulib. * configure, lib/getloadavg.c, m4/getloadavg.m4: Regenerate. --- ChangeLog | 5 +++++ configure | 2 ++ lib/getloadavg.c | 20 +++++++++++--------- m4/getloadavg.m4 | 2 ++ 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7a9252cb9f8..c574311d45c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-02-18 Paul Eggert + + Import IRIX 6.5 getloadavg fixes from gnulib. + * configure, lib/getloadavg.c, m4/getloadavg.m4: Regenerate. + 2011-02-16 Paul Eggert Import getloadavg module from gnulib. diff --git a/configure b/configure index df3d1f72eda..a9cec714412 100755 --- a/configure +++ b/configure @@ -14475,6 +14475,8 @@ test -f "$srcdir/$gl_source_base/getloadavg.c" || gl_save_LIBS=$LIBS +# getloadvg is present in libc on glibc >= 2.2, MacOS X, FreeBSD >= 2.0, +# NetBSD >= 0.9, OpenBSD >= 2.0, Solaris >= 7. ac_fn_c_check_func "$LINENO" "getloadavg" "ac_cv_func_getloadavg" if test "x$ac_cv_func_getloadavg" = xyes; then : diff --git a/lib/getloadavg.c b/lib/getloadavg.c index 28e2ea0164b..d324451ef15 100644 --- a/lib/getloadavg.c +++ b/lib/getloadavg.c @@ -508,7 +508,7 @@ getloadavg (double loadavg[], int nelem) elem = -1; # endif -# if !defined (LDAV_DONE) && defined (HAVE_LIBKSTAT) +# if !defined (LDAV_DONE) && defined (HAVE_LIBKSTAT) /* Solaris <= 2.6 */ /* Use libkstat because we don't have to be root. */ # define LDAV_DONE kstat_ctl_t *kc; @@ -559,6 +559,7 @@ getloadavg (double loadavg[], int nelem) # endif /* HAVE_LIBKSTAT */ # if !defined (LDAV_DONE) && defined (hpux) && defined (HAVE_PSTAT_GETDYNAMIC) + /* HP-UX */ /* Use pstat_getdynamic() because we don't have to be root. */ # define LDAV_DONE # undef LOAD_AVE_TYPE @@ -575,7 +576,7 @@ getloadavg (double loadavg[], int nelem) # endif /* hpux && HAVE_PSTAT_GETDYNAMIC */ -# if ! defined LDAV_DONE && defined HAVE_LIBPERFSTAT +# if ! defined LDAV_DONE && defined HAVE_LIBPERFSTAT /* AIX */ # define LDAV_DONE # undef LOAD_AVE_TYPE /* Use perfstat_cpu_total because we don't have to be root. */ @@ -592,6 +593,7 @@ getloadavg (double loadavg[], int nelem) # endif # if !defined (LDAV_DONE) && (defined (__linux__) || defined (__CYGWIN__)) + /* Linux without glibc, Cygwin */ # define LDAV_DONE # undef LOAD_AVE_TYPE @@ -648,7 +650,7 @@ getloadavg (double loadavg[], int nelem) # endif /* __linux__ || __CYGWIN__ */ -# if !defined (LDAV_DONE) && defined (__NetBSD__) +# if !defined (LDAV_DONE) && defined (__NetBSD__) /* NetBSD < 0.9 */ # define LDAV_DONE # undef LOAD_AVE_TYPE @@ -680,7 +682,7 @@ getloadavg (double loadavg[], int nelem) # endif /* __NetBSD__ */ -# if !defined (LDAV_DONE) && defined (NeXT) +# if !defined (LDAV_DONE) && defined (NeXT) /* NeXTStep */ # define LDAV_DONE /* The NeXT code was adapted from iscreen 3.2. */ @@ -842,6 +844,7 @@ getloadavg (double loadavg[], int nelem) # endif /* OSF_MIPS */ # if !defined (LDAV_DONE) && (defined (__MSDOS__) || defined (WINDOWS32)) + /* DJGPP */ # define LDAV_DONE /* A faithful emulation is going to have to be saved for a rainy day. */ @@ -851,7 +854,7 @@ getloadavg (double loadavg[], int nelem) } # endif /* __MSDOS__ || WINDOWS32 */ -# if !defined (LDAV_DONE) && defined (OSF_ALPHA) +# if !defined (LDAV_DONE) && defined (OSF_ALPHA) /* OSF/1 */ # define LDAV_DONE struct tbl_loadavg load_ave; @@ -863,7 +866,7 @@ getloadavg (double loadavg[], int nelem) : (load_ave.tl_avenrun.l[elem] / (double) load_ave.tl_lscale)); # endif /* OSF_ALPHA */ -# if ! defined LDAV_DONE && defined __VMS +# if ! defined LDAV_DONE && defined __VMS /* VMS */ /* VMS specific code -- read from the Load Ave driver. */ LOAD_AVE_TYPE load_ave[3]; @@ -907,6 +910,7 @@ getloadavg (double loadavg[], int nelem) # endif /* ! defined LDAV_DONE && defined __VMS */ # if ! defined LDAV_DONE && defined LOAD_AVE_TYPE && ! defined __VMS + /* IRIX, other old systems */ /* UNIX-specific code -- read the average from /dev/kmem. */ @@ -948,9 +952,7 @@ getloadavg (double loadavg[], int nelem) } # endif /* !SUNOS_5 */ # else /* sgi */ - int ldav_off; - - ldav_off = sysmp (MP_KERNADDR, MPKA_AVENRUN); + ptrdiff_t ldav_off = sysmp (MP_KERNADDR, MPKA_AVENRUN); if (ldav_off != -1) offset = (long int) ldav_off & 0x7fffffff; # endif /* sgi */ diff --git a/m4/getloadavg.m4 b/m4/getloadavg.m4 index 4aae158e963..e58d29b238f 100644 --- a/m4/getloadavg.m4 +++ b/m4/getloadavg.m4 @@ -26,6 +26,8 @@ test -f "$srcdir/$1/getloadavg.c" || gl_save_LIBS=$LIBS +# getloadvg is present in libc on glibc >= 2.2, MacOS X, FreeBSD >= 2.0, +# NetBSD >= 0.9, OpenBSD >= 2.0, Solaris >= 7. AC_CHECK_FUNC([getloadavg], [], [gl_have_func=no