aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog20
-rw-r--r--admin/ChangeLog6
-rw-r--r--admin/bzrmerge.el4
-rw-r--r--admin/notes/bzr39
-rw-r--r--doc/emacs/ChangeLog5
-rw-r--r--doc/emacs/xresources.texi25
-rw-r--r--doc/misc/ChangeLog33
-rw-r--r--doc/misc/ada-mode.texi1
-rw-r--r--doc/misc/auth.texi147
-rw-r--r--doc/misc/dired-x.texi1
-rw-r--r--doc/misc/ebrowse.texi1
-rw-r--r--doc/misc/ediff.texi2
-rw-r--r--doc/misc/eudc.texi1
-rw-r--r--doc/misc/idlwave.texi1
-rw-r--r--doc/misc/reftex.texi1
-rw-r--r--doc/misc/sc.texi3
-rw-r--r--doc/misc/speedbar.texi1
-rw-r--r--doc/misc/texinfo.tex280
-rw-r--r--doc/misc/tramp.texi44
-rw-r--r--doc/misc/trampver.texi5
-rw-r--r--doc/misc/url.texi1
-rw-r--r--etc/ChangeLog10
-rw-r--r--etc/NEWS19
-rw-r--r--etc/themes/light-blue-theme.el67
-rw-r--r--lib-src/.gitignore1
-rw-r--r--lib/gettext.h6
-rw-r--r--lib/ignore-value.h8
-rw-r--r--lisp/ChangeLog153
-rw-r--r--lisp/Makefile.in8
-rw-r--r--lisp/dired-aux.el4
-rw-r--r--lisp/dired-x.el168
-rw-r--r--lisp/dired.el4
-rw-r--r--lisp/emacs-lisp/checkdoc.el2
-rw-r--r--lisp/emacs-lisp/cl-loaddefs.el18
-rw-r--r--lisp/emacs-lisp/cl-seq.el16
-rw-r--r--lisp/emulation/cua-base.el2
-rw-r--r--lisp/faces.el20
-rw-r--r--lisp/gnus/ChangeLog141
-rw-r--r--lisp/gnus/ChangeLog.22
-rw-r--r--lisp/gnus/auth-source.el1234
-rw-r--r--lisp/gnus/gnus-art.el7
-rw-r--r--lisp/gnus/gnus-delay.el4
-rw-r--r--lisp/gnus/mail-source.el88
-rw-r--r--lisp/gnus/nnimap.el66
-rw-r--r--lisp/gnus/nntp.el16
-rw-r--r--lisp/gnus/sieve-manage.el18
-rw-r--r--lisp/makefile.w32-in6
-rw-r--r--lisp/mh-e/ChangeLog.12
-rw-r--r--lisp/net/imap-hash.el374
-rw-r--r--lisp/net/tramp-imap.el850
-rw-r--r--lisp/net/tramp.el15
-rw-r--r--lisp/password-cache.el7
-rw-r--r--lisp/progmodes/cc-engine.el88
-rw-r--r--lisp/progmodes/cc-fonts.el11
-rw-r--r--lisp/simple.el4
-rw-r--r--lisp/textmodes/reftex-index.el2
-rw-r--r--lisp/vc/ediff-mult.el2
-rw-r--r--lisp/vc/ediff-ptch.el2
-rw-r--r--lisp/vc/log-view.el198
-rw-r--r--lisp/vc/vc-bzr.el16
-rw-r--r--lisp/vc/vc-git.el101
-rw-r--r--lisp/vc/vc-hg.el80
-rw-r--r--lisp/vc/vc.el30
-rw-r--r--lwlib/ChangeLog33
-rw-r--r--lwlib/lwlib-Xaw.c19
-rw-r--r--lwlib/lwlib-utils.c7
-rw-r--r--lwlib/xlwmenu.c87
-rw-r--r--lwlib/xlwmenu.h4
-rw-r--r--lwlib/xlwmenuP.h2
-rwxr-xr-xmake-dist2
-rw-r--r--src/ChangeLog208
-rw-r--r--src/alloc.c16
-rw-r--r--src/buffer.c686
-rw-r--r--src/buffer.h151
-rw-r--r--src/bytecode.c2
-rw-r--r--src/callint.c16
-rw-r--r--src/callproc.c16
-rw-r--r--src/casefiddle.c12
-rw-r--r--src/casetab.c10
-rw-r--r--src/category.c8
-rw-r--r--src/category.h2
-rw-r--r--src/character.c4
-rw-r--r--src/character.h12
-rw-r--r--src/charset.c2
-rw-r--r--src/cmds.c22
-rw-r--r--src/coding.c36
-rw-r--r--src/composite.c8
-rw-r--r--src/data.c24
-rw-r--r--src/dired.c2
-rw-r--r--src/dispextern.h6
-rw-r--r--src/dispnew.c8
-rw-r--r--src/editfns.c74
-rw-r--r--src/fileio.c178
-rw-r--r--src/filelock.c14
-rw-r--r--src/fns.c12
-rw-r--r--src/font.c2
-rw-r--r--src/frame.c2
-rw-r--r--src/fringe.c18
-rw-r--r--src/gtkutil.c2
-rw-r--r--src/indent.c62
-rw-r--r--src/insdel.c62
-rw-r--r--src/intervals.c4
-rw-r--r--src/intervals.h4
-rw-r--r--src/keyboard.c10
-rw-r--r--src/keyboard.h2
-rw-r--r--src/keymap.c12
-rw-r--r--src/lisp.h6
-rw-r--r--src/lread.c16
-rw-r--r--src/marker.c12
-rw-r--r--src/minibuf.c22
-rw-r--r--src/msdos.c6
-rw-r--r--src/nsfns.m6
-rw-r--r--src/nsterm.m2
-rw-r--r--src/print.c48
-rw-r--r--src/process.c60
-rw-r--r--src/s/ms-w32.h2
-rw-r--r--src/s/msdos.h2
-rw-r--r--src/search.c48
-rw-r--r--src/syntax.c16
-rw-r--r--src/syntax.h6
-rw-r--r--src/undo.c62
-rw-r--r--src/w32fns.c6
-rw-r--r--src/window.c62
-rw-r--r--src/xdisp.c186
-rw-r--r--src/xfaces.c2
-rw-r--r--src/xfns.c4
-rw-r--r--src/xmenu.c42
-rw-r--r--src/xrdb.c6
-rw-r--r--test/ChangeLog5
-rw-r--r--test/automated/bytecomp-tests.el (renamed from test/bytecomp-testsuite.el)88
-rw-r--r--test/automated/font-parse-tests.el2
131 files changed, 3636 insertions, 3435 deletions
diff --git a/ChangeLog b/ChangeLog
index 85165338460..52db9f45cd6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
12011-02-15 Paul Eggert <eggert@cs.ucla.edu>
2
3 Merge from gnulib.
4
5 2011-02-13 Bruno Haible <bruno@clisp.org>
6
7 Consistent macro naming for macros that use GCC __attribute__.
8 * lib/ignore-value.h (_GL_ATTRIBUTE_DEPRECATED): Renamed from
9 ATTRIBUTE_DEPRECATED.
10
11 2011-02-12 Bruno Haible <bruno@clisp.org>
12
13 setlocale: Prefer gnulib's override over libintl's override.
14 * lib/gettext.h (setlocale): Redefine to rpl_setlocale if
15 GNULIB_defined_setlocale is set.
16
172011-02-13 Glenn Morris <rgm@gnu.org>
18
19 * make-dist: Exclude generated file src/globals.h.
20
12011-02-10 Paul Eggert <eggert@cs.ucla.edu> 212011-02-10 Paul Eggert <eggert@cs.ucla.edu>
2 22
3 Import getloadavg module from gnulib. 23 Import getloadavg module from gnulib.
diff --git a/admin/ChangeLog b/admin/ChangeLog
index ce7ff76aa2c..335fe1df921 100644
--- a/admin/ChangeLog
+++ b/admin/ChangeLog
@@ -1,9 +1,13 @@
12011-02-10 Paul Eggert <eggert@cs.ucla.edu> 12011-02-15 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 Remove no-longer needed getloadavg symbols. 3 Remove no-longer needed getloadavg symbols.
4 * CPP-DEFINES (LOAD_AVE_CVT, LOAD_AVE_TYPE, FSCALE, KERNEL_FILE): 4 * CPP-DEFINES (LOAD_AVE_CVT, LOAD_AVE_TYPE, FSCALE, KERNEL_FILE):
5 (LDAV_SYMBOL): Remove. 5 (LDAV_SYMBOL): Remove.
6 6
72011-02-12 Glenn Morris <rgm@gnu.org>
8
9 * bzrmerge.el (bzrmerge-resolve): Fix bzr revert call.
10
72011-02-05 Glenn Morris <rgm@gnu.org> 112011-02-05 Glenn Morris <rgm@gnu.org>
8 12
9 * bzrmerge.el (bzrmerge-warning-buffer): New constant. 13 * bzrmerge.el (bzrmerge-warning-buffer): New constant.
diff --git a/admin/bzrmerge.el b/admin/bzrmerge.el
index 061af80b6cf..77e64a862c8 100644
--- a/admin/bzrmerge.el
+++ b/admin/bzrmerge.el
@@ -187,7 +187,9 @@ are both lists of revnos, in oldest-first order."
187 (cond 187 (cond
188 ((member file '("configure" "lisp/ldefs-boot.el" 188 ((member file '("configure" "lisp/ldefs-boot.el"
189 "lisp/emacs-lisp/cl-loaddefs.el")) 189 "lisp/emacs-lisp/cl-loaddefs.el"))
190 (call-process "bzr" nil t nil "revert" file) 190 ;; We are in the file's buffer, so names are relative.
191 (call-process "bzr" nil t nil "revert"
192 (file-name-nondirectory file))
191 (revert-buffer nil 'noconfirm)) 193 (revert-buffer nil 'noconfirm))
192 (t 194 (t
193 (goto-char (point-max)) 195 (goto-char (point-max))
diff --git a/admin/notes/bzr b/admin/notes/bzr
index cb2a1bd4e4f..11f0af17a3b 100644
--- a/admin/notes/bzr
+++ b/admin/notes/bzr
@@ -65,11 +65,26 @@ removes a file, then remove the corresponding files by hand.
65The following description uses bound branches, presumably it works in 65The following description uses bound branches, presumably it works in
66a similar way with unbound ones. 66a similar way with unbound ones.
67 67
680) (First time only) Get the bzr changelog_merge plugin:
69
70cd ~/.bazaar/plugins
71bzr branch lp:bzr-changelog-merge
72mv bzr-changelog-merge changelog_merge
73
74This will make merging ChangeLogs a lot smoother. It merges new
75entries to the top of the file, rather than trying to fit them in
76mid-way through.
77
681) Get clean, up-to-date copies of the emacs-23 and trunk branches. 781) Get clean, up-to-date copies of the emacs-23 and trunk branches.
69Check for any uncommitted changes with bzr status. 79Check for any uncommitted changes with bzr status.
70 80
712) M-x cd /path/to/trunk 812) M-x cd /path/to/trunk
72 82
83The first time only, do this:
84cd .bzr/branch
85Add the following line to branch.conf:
86changelog_merge_files = ChangeLog
87
733) load admin/bzrmerge.el 883) load admin/bzrmerge.el
74 89
754) M-x bzrmerge RET /path/to/emacs-23 RET 904) M-x bzrmerge RET /path/to/emacs-23 RET
@@ -119,3 +134,27 @@ right thing to do is merge everything else, resolve the conflict by
119choosing either the trunk or branch version, then run `make -C lisp 134choosing either the trunk or branch version, then run `make -C lisp
120autoloads' to update the md5sums to the correct trunk value before 135autoloads' to update the md5sums to the correct trunk value before
121committing. 136committing.
137
138* Re-adding a file that has been removed from the repository
139
140It's easy to get this wrong. Let's suppose you've done:
141
142bzr remove file; bzr commit
143
144and now, sometime later, you realize this was a mistake and file needs
145to be brought back. DON'T just do:
146
147bzr add file; bzr commit
148
149This restores file, but without its history (`bzr log file' will be
150very short). This is because file gets re-added with a new file-id
151(use `bzr file-id file' to see the id).
152
153Insteading of adding the file, try:
154
155bzr revert -rN file; bzr commit
156
157where revision N+1 is the one where file was removed.
158
159You could also try `bzr add --file-ids-from', if you have a copy of
160another branch where file still exists.
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index d04c0322862..ec57887a154 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,3 +1,8 @@
12011-02-14 Jan Djärv <jan.h.d@swipnet.se>
2
3 * xresources.texi (X Resources): Remove *faceName and replace it with
4 *font for Lucid.
5
12011-02-05 Chong Yidong <cyd@stupidchicken.com> 62011-02-05 Chong Yidong <cyd@stupidchicken.com>
2 7
3 * rmail.texi (Rmail Display): Document Rmail MIME support more 8 * rmail.texi (Rmail Display): Document Rmail MIME support more
diff --git a/doc/emacs/xresources.texi b/doc/emacs/xresources.texi
index 1482bbd0469..41a09a5f713 100644
--- a/doc/emacs/xresources.texi
+++ b/doc/emacs/xresources.texi
@@ -428,29 +428,20 @@ and has its own resources. The resource specifications start with
428@end iftex 428@end iftex
429 429
430@example 430@example
431Emacs.pane.menubar.faceName: Courier-12 431Emacs.pane.menubar.font: Courier-12
432@end example 432@end example
433 433
434@noindent 434@noindent
435To specify a font, use fontconfig font names as values to the @code{faceName} 435To specify a font, use fontconfig font names as values to the @code{font}
436resource. 436resource, or old style names:
437
438If Emacs is not built with the Xft library, Lucid menus and dialogs
439can only display old style fonts. If Emacs is built with Xft and you
440prefer the old fonts, you have to specify @samp{none} to
441@code{faceName}:
442 437
443@example 438@example
444Emacs.pane.menubar.faceName: none 439Emacs.pane.menubar.font: lucidasanstypewriter-10
445Emacs.pane.dialog.faceName: none
446@end example 440@end example
447 441
448@noindent 442@noindent
449To specify a non-Xft font, use @code{font}. For example: 443Emacs first tries to open the font as an old style font, and if that fails
450 444as an fontconfig font. In rare cases, Emacs might do the wrong thing.
451@example
452Emacs.pane.menubar.font: lucidasanstypewriter-10
453@end example
454 445
455@noindent 446@noindent
456The Lucid menus can display multilingual text in your locale with old style 447The Lucid menus can display multilingual text in your locale with old style
@@ -480,7 +471,7 @@ Emacs.menu*.font: 8x16
480For dialog boxes, use @samp{dialog*}: 471For dialog boxes, use @samp{dialog*}:
481 472
482@example 473@example
483Emacs.dialog*.faceName: Sans-12 474Emacs.dialog*.font: Sans-12
484@end example 475@end example
485 476
486@noindent 477@noindent
@@ -495,8 +486,6 @@ approach should work on both kinds of systems.
495 Here is a list of the specific resources for menu bars and pop-up menus: 486 Here is a list of the specific resources for menu bars and pop-up menus:
496 487
497@table @code 488@table @code
498@item faceName
499Xft font for menu item text.
500@item font 489@item font
501Font for menu item text. 490Font for menu item text.
502@item fontSet 491@item fontSet
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog
index 61e05aaf332..20463724c79 100644
--- a/doc/misc/ChangeLog
+++ b/doc/misc/ChangeLog
@@ -1,3 +1,36 @@
12011-02-15 Paul Eggert <eggert@cs.ucla.edu>
2
3 Merge from gnulib.
4 * texinfo.tex: Update to version 2011-02-14.11.
5
62011-02-13 Michael Albinus <michael.albinus@gmx.de>
7
8 * tramp.texi (History): Remove IMAP support.
9 (External methods, Frequently Asked Questions): Remove `imap' and
10 `imaps' methods.
11 (Password handling): Remove IMAP entries for ~/.authinfo.gpg.
12
13 * trampver.texi: Remove default value of `emacsimap'.
14
152011-02-13 Glenn Morris <rgm@gnu.org>
16
17 * ada-mode.texi, dired-x.texi, ebrowse.texi, ediff.texi, eudc.texi:
18 * idlwave.texi, reftex.texi, sc.texi, speedbar.texi: Add @top.
19
202011-02-12 Glenn Morris <rgm@gnu.org>
21
22 * sc.texi (Getting Connected): Remove old index entries.
23
242011-02-12 Ulrich Mueller <ulm@gentoo.org>
25
26 * url.texi: Remove duplicate @dircategory (Bug#7942).
27
282011-02-11 Teodor Zlatanov <tzz@lifelogs.com>
29
30 * auth.texi (Overview, Help for users, Help for developers):
31 Update docs.
32 (Help for users): Talk about spaces.
33
12011-02-09 Paul Eggert <eggert@cs.ucla.edu> 342011-02-09 Paul Eggert <eggert@cs.ucla.edu>
2 35
3 * texinfo.tex: Update to version 2011-02-07.16. 36 * texinfo.tex: Update to version 2011-02-07.16.
diff --git a/doc/misc/ada-mode.texi b/doc/misc/ada-mode.texi
index 80949aefb33..4be88b40361 100644
--- a/doc/misc/ada-mode.texi
+++ b/doc/misc/ada-mode.texi
@@ -39,6 +39,7 @@ developing GNU and promoting software freedom.''
39@contents 39@contents
40 40
41@node Top, Overview, (dir), (dir) 41@node Top, Overview, (dir), (dir)
42@top Ada Mode
42 43
43@ifnottex 44@ifnottex
44@insertcopying 45@insertcopying
diff --git a/doc/misc/auth.texi b/doc/misc/auth.texi
index bad37dbe85a..2541dba9873 100644
--- a/doc/misc/auth.texi
+++ b/doc/misc/auth.texi
@@ -5,7 +5,7 @@
5@setfilename ../../info/auth 5@setfilename ../../info/auth
6@settitle Emacs auth-source Library @value{VERSION} 6@settitle Emacs auth-source Library @value{VERSION}
7 7
8@set VERSION 0.2 8@set VERSION 0.3
9 9
10@copying 10@copying
11This file describes the Emacs auth-source library. 11This file describes the Emacs auth-source library.
@@ -78,15 +78,19 @@ It is a way for multiple applications to share a single configuration
78@chapter Overview 78@chapter Overview
79 79
80The auth-source library is simply a way for Emacs and Gnus, among 80The auth-source library is simply a way for Emacs and Gnus, among
81others, to answer the old burning question ``I have a server name and 81others, to answer the old burning question ``What are my user name and
82a port, what are my user name and password?'' 82password?''
83 83
84The auth-source library actually supports more than just the user name 84(This is different from the old question about burning ``Where is the
85(known as the login) or the password, but only those two are in use 85fire extinguisher, please?''.)
86today in Emacs or Gnus. Similarly, the auth-source library supports 86
87multiple storage formats, currently either the classic ``netrc'' 87The auth-source library supports more than just the user name or the
88format, examples of which you can see later in this document, or the 88password (known as the secret).
89Secret Service API. 89
90Similarly, the auth-source library supports multiple storage backend,
91currently either the classic ``netrc'' backend, examples of which you
92can see later in this document, or the Secret Service API. This is
93done with EIEIO-based backends and you can write your own if you want.
90 94
91@node Help for users 95@node Help for users
92@chapter Help for users 96@chapter Help for users
@@ -96,25 +100,41 @@ Secret Service API.
96machine @var{mymachine} login @var{myloginname} password @var{mypassword} port @var{myport} 100machine @var{mymachine} login @var{myloginname} password @var{mypassword} port @var{myport}
97@end example 101@end example
98 102
99The machine is the server (either a DNS name or an IP address). 103The @code{machine} is the server (either a DNS name or an IP address).
104It's known as @var{:host} in @code{auth-source-search} queries. You
105can also use @code{host}.
106
107The @code{port} is the connection port or protocol. It's known as
108@var{:port} in @code{auth-source-search} queries. You can also use
109@code{protocol}.
110
111The @code{user} is the user name. It's known as @var{:user} in
112@code{auth-source-search} queries. You can also use @code{login} and
113@code{account}.
114
115Spaces are always OK as far as auth-source is concerned (but other
116programs may not like them). Just put the data in quotes, escaping
117quotes as you'd expect with @code{\}.
118
119All these are optional. You could just say (but we don't recommend
120it, we're just showing that it's possible)
100 121
101The port is optional. If it's missing, auth-source will assume any 122@example
102port is OK. Actually the port is a protocol name or a port number so 123password @var{mypassword}
103you can have separate entries for port @var{143} and for protocol 124@end example
104@var{imap} if you fancy that. Anyway, you can just omit the port if
105you don't need it.
106 125
107The login and password are simply your login credentials to the server. 126to use the same password everywhere. Again, @emph{DO NOT DO THIS} or
127you will be pwned as the kids say.
108 128
109``Netrc'' files are usually called @code{.authinfo} or @code{.netrc}; 129``Netrc'' files are usually called @code{.authinfo} or @code{.netrc};
110nowadays @code{.authinfo} seems to be more popular and the auth-source 130nowadays @code{.authinfo} seems to be more popular and the auth-source
111library encourages this confusion by making it the default, as you'll 131library encourages this confusion by making it the default, as you'll
112see later. 132see later.
113 133
114If you have problems with the port, set @code{auth-source-debug} to 134If you have problems with the search, set @code{auth-source-debug} to
115@code{t} and see what port the library is checking in the 135@code{t} and see what host, port, and user the library is checking in
116@code{*Messages*} buffer. Ditto for any other problems, your first 136the @code{*Messages*} buffer. Ditto for any other problems, your
117step is always to see what's being checked. The second step, of 137first step is always to see what's being checked. The second step, of
118course, is to write a blog entry about it and wait for the answer in 138course, is to write a blog entry about it and wait for the answer in
119the comments. 139the comments.
120 140
@@ -139,56 +159,36 @@ and simplest configuration is:
139(setq auth-sources '((:source "~/.authinfo.gpg" :host t :protocol t))) 159(setq auth-sources '((:source "~/.authinfo.gpg" :host t :protocol t)))
140;;; mostly equivalent (see below about fallbacks) but shorter: 160;;; mostly equivalent (see below about fallbacks) but shorter:
141(setq auth-sources '((:source "~/.authinfo.gpg"))) 161(setq auth-sources '((:source "~/.authinfo.gpg")))
162;;; even shorter and the @emph{default}:
163(setq auth-sources '("~/.authinfo.gpg" "~/.authinfo"))
164;;; use the Secrets API @var{login} collection (@pxref{Secret Service API})
165(setq auth-sources '("secrets:login"))
142@end lisp 166@end lisp
143 167
144This says ``for any host and any protocol, use just that one file.''
145Sweet simplicity. In fact, the latter is already the default, so
146unless you want to move your netrc file, it will just work if you have
147that file. Make sure it exists.
148
149By adding multiple entries to @code{auth-sources} with a particular 168By adding multiple entries to @code{auth-sources} with a particular
150host or protocol, you can have specific netrc files for that host or 169host or protocol, you can have specific netrc files for that host or
151protocol. Usually this is unnecessary but may make sense if you have 170protocol. Usually this is unnecessary but may make sense if you have
152shared netrc files or some other unusual setup (90% of Emacs users 171shared netrc files or some other unusual setup (90% of Emacs users
153have unusual setups and the remaining 10% are @emph{really} unusual). 172have unusual setups and the remaining 10% are @emph{really} unusual).
154 173
155Here's an example that uses the Secret Service API for all lookups, 174Here's a mixed example using two sources:
156using the default collection:
157
158@lisp
159(setq auth-sources '((:source (:secrets default))))
160@end lisp
161
162And here's a mixed example, using two sources:
163 175
164@lisp 176@lisp
165(setq auth-sources '((:source (:secrets default) :host "myserver" :user "joe") 177(setq auth-sources '((:source (:secrets default) :host "myserver" :user "joe")
166 (:source "~/.authinfo.gpg"))) 178 "~/.authinfo.gpg"))
167@end lisp 179@end lisp
168 180
169The best match is determined by order (starts from the bottom) only
170for the first pass, where things are checked exactly. In the example
171above, the first pass would find a single match for host
172@code{myserver}. The netrc choice would fail because it matches any
173host and protocol implicitly (as a @emph{fallback}). A specified
174value of @code{:host t} in @code{auth-sources} is considered a match
175on the first pass, unlike a missing @code{:host}.
176
177Now if you look for host @code{missing}, it won't match either source
178explicitly. The second pass (the @emph{fallback} pass) will look at
179all the implicit matches and collect them. They will be scored and
180returned sorted by score. The score is based on the number of
181explicit parameters that matched. See the @code{auth-pick} function
182for details.
183
184@end defvar 181@end defvar
185 182
186If you don't customize @code{auth-sources}, you'll have to live with 183If you don't customize @code{auth-sources}, you'll have to live with
187the defaults: any host and any port are looked up in the netrc 184the defaults: any host and any port are looked up in the netrc
188file @code{~/.authinfo.gpg}, which is a GnuPG encrypted file 185file @code{~/.authinfo.gpg}, which is a GnuPG encrypted file
189(@pxref{GnuPG and EasyPG Assistant Configuration}). 186(@pxref{GnuPG and EasyPG Assistant Configuration}).
187
188If that fails, the unencrypted netrc file @code{~/.authinfo} will
189be used.
190 190
191The simplest working netrc line example is one without a port. 191The typical netrc line example is without a port.
192 192
193@example 193@example
194machine YOURMACHINE login YOU password YOURPASSWORD 194machine YOURMACHINE login YOU password YOURPASSWORD
@@ -233,42 +233,29 @@ TODO: how does it work generally, how does secrets.el work, some examples.
233@node Help for developers 233@node Help for developers
234@chapter Help for developers 234@chapter Help for developers
235 235
236The auth-source library only has one function for external use. 236The auth-source library only has a few functions for external use.
237 237
238@defun auth-source-user-or-password mode host port &optional username 238@defun auth-source-search SPEC
239 239
240Retrieve appropriate authentication tokens, determined by @var{mode}, 240TODO: how to include docstring?
241for host @var{host} and @var{port}. If @var{username} is provided it
242will also be checked. If @code{auth-source-debug} is t, debugging
243messages will be printed. Set @code{auth-source-debug} to a function
244to use that function for logging. The parameters passed will be the
245same that the @code{message} function takes, that is, a string
246formatting spec and optional parameters.
247 241
248If @var{mode} is a list of strings, the function will return a list of 242@end defun
249strings or @code{nil} objects (thus you can avoid parsing the netrc
250file or checking the Secret Service API more than once). If it's a
251string, the function will return a string or a @code{nil} object.
252Currently only the modes ``login'' and ``password'' are recognized but
253more may be added in the future.
254 243
255@var{host} is a string containing the host name. 244@defun auth-source-delete SPEC
256 245
257@var{port} contains the protocol name (e.g. ``imap'') or 246TODO: how to include docstring?
258a port number. It must be a string, corresponding to the port in the
259users' netrc files.
260 247
261@var{username} contains the user name (e.g. ``joe'') as a string. 248@end defun
262 249
263@example 250@defun auth-source-forget SPEC
264;; IMAP example 251
265(setq auth (auth-source-user-or-password 252TODO: how to include docstring?
266 '("login" "password") 253
267 "anyhostnamehere" 254@end defun
268 "imap")) 255
269(nth 0 auth) ; the login name 256@defun auth-source-forget+ SPEC
270(nth 1 auth) ; the password 257
271@end example 258TODO: how to include docstring?
272 259
273@end defun 260@end defun
274 261
diff --git a/doc/misc/dired-x.texi b/doc/misc/dired-x.texi
index 21f91c9125e..9ae569c151c 100644
--- a/doc/misc/dired-x.texi
+++ b/doc/misc/dired-x.texi
@@ -69,6 +69,7 @@ developing GNU and promoting software freedom.''
69@ifnottex 69@ifnottex
70 70
71@node Top 71@node Top
72@top Dired Extra
72@comment node-name, next, previous, up 73@comment node-name, next, previous, up
73 74
74@noindent 75@noindent
diff --git a/doc/misc/ebrowse.texi b/doc/misc/ebrowse.texi
index 66a5e38443d..81a1ab0d29d 100644
--- a/doc/misc/ebrowse.texi
+++ b/doc/misc/ebrowse.texi
@@ -46,6 +46,7 @@ developing GNU and promoting software freedom.''
46 46
47@ifnottex 47@ifnottex
48@node Top, Overview, (dir), (dir) 48@node Top, Overview, (dir), (dir)
49@top Ebrowse
49 50
50You can browse C++ class hierarchies from within Emacs by using 51You can browse C++ class hierarchies from within Emacs by using
51Ebrowse. 52Ebrowse.
diff --git a/doc/misc/ediff.texi b/doc/misc/ediff.texi
index 2a55541bbfd..743a3460f9b 100644
--- a/doc/misc/ediff.texi
+++ b/doc/misc/ediff.texi
@@ -63,6 +63,7 @@ developing GNU and promoting software freedom.''
63@contents 63@contents
64 64
65@node Top, Introduction, (dir), (dir) 65@node Top, Introduction, (dir), (dir)
66@top Ediff
66 67
67@insertcopying 68@insertcopying
68 69
@@ -2540,4 +2541,3 @@ Eli Zaretskii (eliz at is.elta.co.il)
2540@printindex cp 2541@printindex cp
2541 2542
2542@bye 2543@bye
2543
diff --git a/doc/misc/eudc.texi b/doc/misc/eudc.texi
index b0652ab3f10..e21abcdb137 100644
--- a/doc/misc/eudc.texi
+++ b/doc/misc/eudc.texi
@@ -50,6 +50,7 @@ developing GNU and promoting software freedom.''
50 50
51@ifnottex 51@ifnottex
52@node Top, Overview, (dir), (dir) 52@node Top, Overview, (dir), (dir)
53@top Emacs Unified Directory Client
53@comment node-name, next, previous, up 54@comment node-name, next, previous, up
54 55
55@insertcopying 56@insertcopying
diff --git a/doc/misc/idlwave.texi b/doc/misc/idlwave.texi
index be518db6463..98da23768ec 100644
--- a/doc/misc/idlwave.texi
+++ b/doc/misc/idlwave.texi
@@ -57,6 +57,7 @@ developing GNU and promoting software freedom.''
57 57
58@ifnottex 58@ifnottex
59@node Top, Introduction, (dir), (dir) 59@node Top, Introduction, (dir), (dir)
60@top IDLWAVE
60 61
61IDLWAVE is a package which supports editing source code written in the 62IDLWAVE is a package which supports editing source code written in the
62Interactive Data Language (IDL), and running IDL as an inferior shell. 63Interactive Data Language (IDL), and running IDL as an inferior shell.
diff --git a/doc/misc/reftex.texi b/doc/misc/reftex.texi
index 880cfb988a3..8c1ab92032f 100644
--- a/doc/misc/reftex.texi
+++ b/doc/misc/reftex.texi
@@ -79,6 +79,7 @@ developing GNU and promoting software freedom.''
79 79
80@ifnottex 80@ifnottex
81@node Top,,,(dir) 81@node Top,,,(dir)
82@top RefTeX
82 83
83@b{Ref@TeX{}} is a package for managing Labels, References, 84@b{Ref@TeX{}} is a package for managing Labels, References,
84Citations and index entries with GNU Emacs. 85Citations and index entries with GNU Emacs.
diff --git a/doc/misc/sc.texi b/doc/misc/sc.texi
index 621d78b962f..fbeadb6a522 100644
--- a/doc/misc/sc.texi
+++ b/doc/misc/sc.texi
@@ -53,6 +53,7 @@ developing GNU and promoting software freedom.''
53 53
54@ifnottex 54@ifnottex
55@node Top, Introduction, (dir), (dir) 55@node Top, Introduction, (dir), (dir)
56@top Supercite
56@comment node-name, next, previous, up 57@comment node-name, next, previous, up
57 58
58@insertcopying 59@insertcopying
@@ -751,8 +752,6 @@ interface specifications, or if you are writing or maintaining an MUA,
751@cindex .emacs file 752@cindex .emacs file
752@findex sc-cite-original 753@findex sc-cite-original
753@findex cite-original (sc-) 754@findex cite-original (sc-)
754@findex sc-submit-bug-report
755@findex submit-bug-report (sc-)
756The first thing that everyone should do, regardless of the MUA you are 755The first thing that everyone should do, regardless of the MUA you are
757using is to set up Emacs so it will load Supercite at the appropriate 756using is to set up Emacs so it will load Supercite at the appropriate
758time. This happens automatically if Supercite is distributed with your 757time. This happens automatically if Supercite is distributed with your
diff --git a/doc/misc/speedbar.texi b/doc/misc/speedbar.texi
index 980839cdec9..280438195b5 100644
--- a/doc/misc/speedbar.texi
+++ b/doc/misc/speedbar.texi
@@ -40,6 +40,7 @@ developing GNU and promoting software freedom.''
40 40
41@node Top, , , (dir)Top 41@node Top, , , (dir)Top
42@comment node-name, next, previous, up 42@comment node-name, next, previous, up
43@top Speedbar
43 44
44Speedbar is a program for Emacs which can be used to summarize 45Speedbar is a program for Emacs which can be used to summarize
45information related to the current buffer. Its original inspiration 46information related to the current buffer. Its original inspiration
diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex
index 1fe8a1872f6..4467c1e860f 100644
--- a/doc/misc/texinfo.tex
+++ b/doc/misc/texinfo.tex
@@ -3,7 +3,7 @@
3% Load plain if necessary, i.e., if running under initex. 3% Load plain if necessary, i.e., if running under initex.
4\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi 4\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
5% 5%
6\def\texinfoversion{2011-02-07.16} 6\def\texinfoversion{2011-02-14.11}
7% 7%
8% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, 8% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
9% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 9% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
@@ -158,6 +158,7 @@
158\def\spaceisspace{\catcode`\ =\spacecat} 158\def\spaceisspace{\catcode`\ =\spacecat}
159 159
160% sometimes characters are active, so we need control sequences. 160% sometimes characters are active, so we need control sequences.
161\chardef\ampChar = `\&
161\chardef\colonChar = `\: 162\chardef\colonChar = `\:
162\chardef\commaChar = `\, 163\chardef\commaChar = `\,
163\chardef\dashChar = `\- 164\chardef\dashChar = `\-
@@ -547,7 +548,7 @@
547} 548}
548\def\inenvironment#1{% 549\def\inenvironment#1{%
549 \ifx#1\empty 550 \ifx#1\empty
550 out of any environment% 551 outside of any environment%
551 \else 552 \else
552 in environment \expandafter\string#1% 553 in environment \expandafter\string#1%
553 \fi 554 \fi
@@ -2491,22 +2492,8 @@ end
2491 \codex 2492 \codex
2492 } 2493 }
2493} 2494}
2494% Handle @url similarly to \code, but allows line breaks after .#?/ (only). 2495
2495{ 2496\def\codex #1{\tclose{#1}\endgroup}
2496 \catcode`\.=\active \catcode`\#=\active
2497 \catcode`\?=\active \catcode`\/=\active
2498 %
2499 \global\def\urefcode{\begingroup
2500 \setupmarkupstyle{code}%
2501 \catcode\dotChar=\active \catcode\hashChar=\active
2502 \catcode\questChar=\active \catcode\slashChar=\active
2503 \let.\urefcodedot
2504 \let#\urefcodehash
2505 \let?\urefcodequestion
2506 \let/\urefcodeslash
2507 \codex
2508 }
2509}
2510 2497
2511\def\realdash{-} 2498\def\realdash{-}
2512\def\codedash{-\discretionary{}{}{}} 2499\def\codedash{-\discretionary{}{}{}}
@@ -2521,25 +2508,6 @@ end
2521 \discretionary{}{}{}}% 2508 \discretionary{}{}{}}%
2522 {\_}% 2509 {\_}%
2523} 2510}
2524% we put a little stretch before and after the breakable chars, to help
2525% line breaking of long url's. The unequal skips make look better in
2526% cmtt at least, especially for dots.
2527\def\urefprestretch{\nobreak \hskip0pt plus.13em }
2528\def\urefpoststretch{\allowbreak \hskip0pt plus.1em }
2529\def\urefcodedot{\urefprestretch .\urefpoststretch}
2530\def\urefcodehash{\urefprestretch \#\urefpoststretch}
2531\def\urefcodequestion{\urefprestretch ?\urefpoststretch}
2532\def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
2533{
2534 \catcode`\/=\active
2535 \global\def\urefcodeslashfinish{%
2536 \urefprestretch \slashChar
2537 % Allow line break only after the final / in a sequence of
2538 % slashes, to avoid line break between the slashes in http://.
2539 \ifx\next/\else \urefpoststretch \fi
2540 }
2541}
2542\def\codex #1{\tclose{#1}\endgroup}
2543 2511
2544% An additional complication: the above will allow breaks after, e.g., 2512% An additional complication: the above will allow breaks after, e.g.,
2545% each of the four underscores in __typeof__. This is undesirable in 2513% each of the four underscores in __typeof__. This is undesirable in
@@ -2563,59 +2531,14 @@ end
2563 \fi\fi 2531 \fi\fi
2564} 2532}
2565 2533
2566% @kbd is like @code, except that if the argument is just one @key command,
2567% then @kbd has no effect.
2568\def\kbd#1{{\setupmarkupstyle{kbd}\def\look{#1}\expandafter\kbdfoo\look??\par}}
2569
2570% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
2571% `example' (@kbd uses ttsl only inside of @example and friends),
2572% or `code' (@kbd uses normal tty font always).
2573\parseargdef\kbdinputstyle{%
2574 \def\txiarg{#1}%
2575 \ifx\txiarg\worddistinct
2576 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
2577 \else\ifx\txiarg\wordexample
2578 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
2579 \else\ifx\txiarg\wordcode
2580 \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
2581 \else
2582 \errhelp = \EMsimple
2583 \errmessage{Unknown @kbdinputstyle option `\txiarg'}%
2584 \fi\fi\fi
2585}
2586\def\worddistinct{distinct}
2587\def\wordexample{example}
2588\def\wordcode{code}
2589
2590% Default is `distinct'.
2591\kbdinputstyle distinct
2592
2593\def\xkey{\key}
2594\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
2595\ifx\one\xkey\ifx\threex\three \key{#2}%
2596\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
2597\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi}
2598
2599% For @indicateurl, @env, @command quotes seem unnecessary, so use \code.
2600\let\indicateurl=\code
2601\let\env=\code
2602\let\command=\code
2603
2604% @clicksequence{File @click{} Open ...}
2605\def\clicksequence#1{\begingroup #1\endgroup}
2606
2607% @clickstyle @arrow (by default)
2608\parseargdef\clickstyle{\def\click{#1}}
2609\def\click{\arrow}
2610
2611% @uref (abbreviation for `urlref') takes an optional (comma-separated) 2534% @uref (abbreviation for `urlref') takes an optional (comma-separated)
2612% second argument specifying the text to display and an optional third 2535% second argument specifying the text to display and an optional third
2613% arg as text to display instead of (rather than in addition to) the url 2536% arg as text to display instead of (rather than in addition to) the url
2614% itself. First (mandatory) arg is the url. Perhaps eventually put in 2537% itself. First (mandatory) arg is the url.
2615% a hypertex \special here. 2538% (This \urefnobreak definition isn't used now, leaving it for a while
2616% 2539% for comparison.)
2617\def\uref#1{\douref #1,,,\finish} 2540\def\urefnobreak#1{\dourefnobreak #1,,,\finish}
2618\def\douref#1,#2,#3,#4\finish{\begingroup 2541\def\dourefnobreak#1,#2,#3,#4\finish{\begingroup
2619 \unsepspaces 2542 \unsepspaces
2620 \pdfurl{#1}% 2543 \pdfurl{#1}%
2621 \setbox0 = \hbox{\ignorespaces #3}% 2544 \setbox0 = \hbox{\ignorespaces #3}%
@@ -2636,7 +2559,11 @@ end
2636 \endlink 2559 \endlink
2637\endgroup} 2560\endgroup}
2638 2561
2639\def\nouref#1,#2,#3,#4\finish{\begingroup % doesn't work in @example 2562% This \urefbreak definition is the active one.
2563\def\urefbreak{\begingroup \urefcatcodes \dourefbreak}
2564\let\uref=\urefbreak
2565\def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
2566\def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example
2640 \unsepspaces 2567 \unsepspaces
2641 \pdfurl{#1}% 2568 \pdfurl{#1}%
2642 \setbox0 = \hbox{\ignorespaces #3}% 2569 \setbox0 = \hbox{\ignorespaces #3}%
@@ -2648,18 +2575,87 @@ end
2648 \ifpdf 2575 \ifpdf
2649 \unhbox0 % PDF: 2nd arg given, show only it 2576 \unhbox0 % PDF: 2nd arg given, show only it
2650 \else 2577 \else
2651 % \empty at the end of \scantokens arg gets rid of 2578 \unhbox0\ (\urefcode{#1})% DVI: 2nd arg given, show both it and url
2652 % trailing newline (and ultimate spurious whitespace).
2653 \unhbox0\ (\urefcode{\scantokens{#1\empty}})% DVI: 2nd arg given,
2654 % show both it and url
2655 \fi 2579 \fi
2656 \else 2580 \else
2657 \urefcode{\scantokens{#1\empty}}% only url given, so show it 2581 \urefcode{#1}% only url given, so show it
2658 \fi 2582 \fi
2659 \fi 2583 \fi
2660 \endlink 2584 \endlink
2661\endgroup} 2585\endgroup}
2662 2586
2587% Allow line breaks around only a few characters (only).
2588\def\urefcatcodes{%
2589 \catcode\ampChar=\active \catcode\dotChar=\active
2590 \catcode\hashChar=\active \catcode\questChar=\active
2591 \catcode\slashChar=\active
2592}
2593{
2594 \urefcatcodes
2595 %
2596 \global\def\urefcode{\begingroup
2597 \setupmarkupstyle{code}%
2598 \urefcatcodes
2599 \let&\urefcodeamp
2600 \let.\urefcodedot
2601 \let#\urefcodehash
2602 \let?\urefcodequest
2603 \let/\urefcodeslash
2604 \codex
2605 }
2606 %
2607 % By default, they are just regular characters.
2608 \global\def&{\normalamp}
2609 \global\def.{\normaldot}
2610 \global\def#{\normalhash}
2611 \global\def?{\normalquest}
2612 \global\def/{\normalslash}
2613}
2614
2615% we put a little stretch before and after the breakable chars, to help
2616% line breaking of long url's. The unequal skips make look better in
2617% cmtt at least, especially for dots.
2618\def\urefprestretch{\urefprebreak \hskip0pt plus.13em }
2619\def\urefpoststretch{\urefpostbreak \hskip0pt plus.1em }
2620%
2621\def\urefcodeamp{\urefprestretch \&\urefpoststretch}
2622\def\urefcodedot{\urefprestretch .\urefpoststretch}
2623\def\urefcodehash{\urefprestretch \#\urefpoststretch}
2624\def\urefcodequest{\urefprestretch ?\urefpoststretch}
2625\def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
2626{
2627 \catcode`\/=\active
2628 \global\def\urefcodeslashfinish{%
2629 \urefprestretch \slashChar
2630 % Allow line break only after the final / in a sequence of
2631 % slashes, to avoid line break between the slashes in http://.
2632 \ifx\next/\else \urefpoststretch \fi
2633 }
2634}
2635
2636% One more complication: by default we'll break after the special
2637% characters, but some people like to break before the special chars, so
2638% allow that. Also allow no breaking at all, for manual control.
2639%
2640\parseargdef\urefbreakstyle{%
2641 \def\txiarg{#1}%
2642 \ifx\txiarg\wordnone
2643 \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
2644 \else\ifx\txiarg\wordbefore
2645 \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak}
2646 \else\ifx\txiarg\wordafter
2647 \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak}
2648 \else
2649 \errhelp = \EMsimple
2650 \errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
2651 \fi\fi\fi
2652}
2653\def\wordafter{after}
2654\def\wordbefore{before}
2655\def\wordnone{none}
2656
2657\urefbreakstyle after
2658
2663% @url synonym for @uref, since that's how everyone uses it. 2659% @url synonym for @uref, since that's how everyone uses it.
2664% 2660%
2665\let\url=\uref 2661\let\url=\uref
@@ -2681,6 +2677,51 @@ end
2681 \let\email=\uref 2677 \let\email=\uref
2682\fi 2678\fi
2683 2679
2680% @kbd is like @code, except that if the argument is just one @key command,
2681% then @kbd has no effect.
2682\def\kbd#1{{\setupmarkupstyle{kbd}\def\look{#1}\expandafter\kbdfoo\look??\par}}
2683
2684% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
2685% `example' (@kbd uses ttsl only inside of @example and friends),
2686% or `code' (@kbd uses normal tty font always).
2687\parseargdef\kbdinputstyle{%
2688 \def\txiarg{#1}%
2689 \ifx\txiarg\worddistinct
2690 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
2691 \else\ifx\txiarg\wordexample
2692 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
2693 \else\ifx\txiarg\wordcode
2694 \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
2695 \else
2696 \errhelp = \EMsimple
2697 \errmessage{Unknown @kbdinputstyle setting `\txiarg'}%
2698 \fi\fi\fi
2699}
2700\def\worddistinct{distinct}
2701\def\wordexample{example}
2702\def\wordcode{code}
2703
2704% Default is `distinct'.
2705\kbdinputstyle distinct
2706
2707\def\xkey{\key}
2708\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
2709\ifx\one\xkey\ifx\threex\three \key{#2}%
2710\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
2711\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi}
2712
2713% For @indicateurl, @env, @command quotes seem unnecessary, so use \code.
2714\let\indicateurl=\code
2715\let\env=\code
2716\let\command=\code
2717
2718% @clicksequence{File @click{} Open ...}
2719\def\clicksequence#1{\begingroup #1\endgroup}
2720
2721% @clickstyle @arrow (by default)
2722\parseargdef\clickstyle{\def\click{#1}}
2723\def\click{\arrow}
2724
2684% Typeset a dimension, e.g., `in' or `pt'. The only reason for the 2725% Typeset a dimension, e.g., `in' or `pt'. The only reason for the
2685% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt. 2726% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
2686% 2727%
@@ -5677,6 +5718,8 @@ end
5677% 5718%
5678\def\sectionheading#1#2#3#4{% 5719\def\sectionheading#1#2#3#4{%
5679 {% 5720 {%
5721 \checkenv{}% should not be in an environment.
5722 %
5680 % Switch to the right set of fonts. 5723 % Switch to the right set of fonts.
5681 \csname #2fonts\endcsname \rmisbold 5724 \csname #2fonts\endcsname \rmisbold
5682 % 5725 %
@@ -9305,24 +9348,15 @@ directory should work if nowhere else does.}
9305\catcode`\^^? = 14 9348\catcode`\^^? = 14
9306 9349
9307% Define macros to output various characters with catcode for normal text. 9350% Define macros to output various characters with catcode for normal text.
9308\catcode`\"=\other 9351\catcode`\"=\other \def\normaldoublequote{"}
9309\catcode`\~=\other 9352\catcode`\$=\other \def\normaldollar{$}%$ font-lock fix
9310\catcode`\^=\other 9353\catcode`\+=\other \def\normalplus{+}
9311\catcode`\_=\other 9354\catcode`\<=\other \def\normalless{<}
9312\catcode`\|=\other 9355\catcode`\>=\other \def\normalgreater{>}
9313\catcode`\<=\other 9356\catcode`\^=\other \def\normalcaret{^}
9314\catcode`\>=\other 9357\catcode`\_=\other \def\normalunderscore{_}
9315\catcode`\+=\other 9358\catcode`\|=\other \def\normalverticalbar{|}
9316\catcode`\$=\other 9359\catcode`\~=\other \def\normaltilde{~}
9317\def\normaldoublequote{"}
9318\def\normaltilde{~}
9319\def\normalcaret{^}
9320\def\normalunderscore{_}
9321\def\normalverticalbar{|}
9322\def\normalless{<}
9323\def\normalgreater{>}
9324\def\normalplus{+}
9325\def\normaldollar{$}%$ font-lock fix
9326 9360
9327% This macro is used to make a character print one way in \tt 9361% This macro is used to make a character print one way in \tt
9328% (where it can probably be output as-is), and another way in other fonts, 9362% (where it can probably be output as-is), and another way in other fonts,
@@ -9415,16 +9449,16 @@ directory should work if nowhere else does.}
9415% the literal character `\'. 9449% the literal character `\'.
9416% 9450%
9417@def@normalturnoffactive{% 9451@def@normalturnoffactive{%
9418 @let\=@normalbackslash
9419 @let"=@normaldoublequote 9452 @let"=@normaldoublequote
9420 @let~=@normaltilde 9453 @let$=@normaldollar %$ font-lock fix
9454 @let+=@normalplus
9455 @let<=@normalless
9456 @let>=@normalgreater
9457 @let\=@normalbackslash
9421 @let^=@normalcaret 9458 @let^=@normalcaret
9422 @let_=@normalunderscore 9459 @let_=@normalunderscore
9423 @let|=@normalverticalbar 9460 @let|=@normalverticalbar
9424 @let<=@normalless 9461 @let~=@normaltilde
9425 @let>=@normalgreater
9426 @let+=@normalplus
9427 @let$=@normaldollar %$ font-lock fix
9428 @markupsetuplqdefault 9462 @markupsetuplqdefault
9429 @markupsetuprqdefault 9463 @markupsetuprqdefault
9430 @unsepspaces 9464 @unsepspaces
@@ -9456,10 +9490,16 @@ directory should work if nowhere else does.}
9456% Say @foo, not \foo, in error messages. 9490% Say @foo, not \foo, in error messages.
9457@escapechar = `@@ 9491@escapechar = `@@
9458 9492
9493% These (along with & and #) are made active for url-breaking, so need
9494% active definitions as the normal characters.
9495@def@normaldot{.}
9496@def@normalquest{?}
9497@def@normalslash{/}
9498
9459% These look ok in all fonts, so just make them not special. 9499% These look ok in all fonts, so just make them not special.
9460@catcode`@& = @other 9500@catcode`@& = @other @def@normalamp{&}
9461@catcode`@# = @other 9501@catcode`@# = @other @def@normalhash{#}
9462@catcode`@% = @other 9502@catcode`@% = @other @def@normalpercent{%}
9463 9503
9464@c Finally, make ` and ' active, so that txicodequoteundirected and 9504@c Finally, make ` and ' active, so that txicodequoteundirected and
9465@c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we 9505@c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi
index 6095d83d484..994a8f99676 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -443,9 +443,6 @@ Support of gateways exists since April 2007.
443@ifset emacsgvfs 443@ifset emacsgvfs
444GVFS integration started in February 2009. 444GVFS integration started in February 2009.
445@end ifset 445@end ifset
446@ifset emacsimap
447Storing files into IMAP mailboxes has been added in September 2009.
448@end ifset
449 446
450In December 2001, @value{tramp} has been added to the XEmacs package 447In December 2001, @value{tramp} has been added to the XEmacs package
451repository. Being part of the GNU Emacs repository happened in June 448repository. Being part of the GNU Emacs repository happened in June
@@ -1012,29 +1009,6 @@ Windows, this method isn't available. Instead, you can use UNC
1012file names like @file{//melancholia/daniel$$/.emacs}. The only 1009file names like @file{//melancholia/daniel$$/.emacs}. The only
1013disadvantage is that there's no possibility to specify another user 1010disadvantage is that there's no possibility to specify another user
1014name. 1011name.
1015
1016
1017@ifset emacsimap
1018@item @option{imap}
1019@cindex method imap
1020@cindex method imaps
1021@cindex imap method
1022@cindex imaps method
1023
1024Accessing an IMAP mailbox is intended to save files there as encrypted
1025messages. It could be used in case there are no other remote file
1026storages available.
1027
1028@value{tramp} supports both @option{imap} and @option{imaps} methods.
1029The latter one accesses the IMAP server over ssl.
1030
1031Both methods support the port number specification.
1032
1033Note that special handling is needed for declaring a passphrase for
1034encryption / decryption of the messages (@pxref{Using an
1035authentication file}).
1036
1037@end ifset
1038@end table 1012@end table
1039 1013
1040 1014
@@ -1625,18 +1599,6 @@ The port can be any @value{tramp} method (@pxref{Inline methods},
1625@pxref{External methods}), to match only this method. When you omit 1599@pxref{External methods}), to match only this method. When you omit
1626the port, you match all @value{tramp} methods. 1600the port, you match all @value{tramp} methods.
1627 1601
1628@ifset emacsimap
1629A special case are @option{imap}-like methods. Authentication with
1630the IMAP server is performed via @file{imap.el}, there is no special
1631need from @value{tramp} point of view. An additional passphrase, used
1632for symmetric encryption and decryption of the stored messages, should
1633be given with the special port indication @option{tramp-imap}:
1634
1635@example
1636machine melancholia port tramp-imap login daniel password ultrageheim
1637@end example
1638@end ifset
1639
1640@anchor{Caching passwords} 1602@anchor{Caching passwords}
1641@subsection Caching passwords 1603@subsection Caching passwords
1642 1604
@@ -2782,9 +2744,9 @@ The package has been used successfully on GNU Emacs 22, GNU Emacs 23,
2782XEmacs 21 (starting with 21.4), and SXEmacs 22. 2744XEmacs 21 (starting with 21.4), and SXEmacs 22.
2783 2745
2784The package was intended to work on Unix, and it really expects a 2746The package was intended to work on Unix, and it really expects a
2785Unix-like system on the remote end (except the @option{smb} and 2747Unix-like system on the remote end (except the @option{smb} method),
2786@option{imap} methods), but some people seemed to have some success 2748but some people seemed to have some success getting it to work on MS
2787getting it to work on MS Windows XP/Vista/7 @value{emacsname}. 2749Windows XP/Vista/7 @value{emacsname}.
2788 2750
2789 2751
2790@item 2752@item
diff --git a/doc/misc/trampver.texi b/doc/misc/trampver.texi
index c3e767bd228..2968642bcc2 100644
--- a/doc/misc/trampver.texi
+++ b/doc/misc/trampver.texi
@@ -28,11 +28,6 @@
28@set emacsgw 28@set emacsgw
29@end ifclear 29@end ifclear
30 30
31@c Whether or not describe IMAP support.
32@ifclear noemacsimap
33@set emacsimap
34@end ifclear
35
36@c Some flags which make the text independent on the (X)Emacs flavor. 31@c Some flags which make the text independent on the (X)Emacs flavor.
37@c "emacs" resp "xemacs" are set in the Makefile. Default is "emacs". 32@c "emacs" resp "xemacs" are set in the Makefile. Default is "emacs".
38@ifclear emacs 33@ifclear emacs
diff --git a/doc/misc/url.texi b/doc/misc/url.texi
index 5bfa96ec673..d337c82494c 100644
--- a/doc/misc/url.texi
+++ b/doc/misc/url.texi
@@ -12,7 +12,6 @@
12\overfullrule=0pt 12\overfullrule=0pt
13%\global\baselineskip 30pt % for printing in double space 13%\global\baselineskip 30pt % for printing in double space
14@end tex 14@end tex
15@dircategory World Wide Web
16@dircategory Emacs 15@dircategory Emacs
17@direntry 16@direntry
18* URL: (url). URL loading package. 17* URL: (url). URL loading package.
diff --git a/etc/ChangeLog b/etc/ChangeLog
index 45dfb211bb0..520a12ba15f 100644
--- a/etc/ChangeLog
+++ b/etc/ChangeLog
@@ -1,3 +1,11 @@
12011-02-13 Michael Albinus <michael.albinus@gmx.de>
2
3 * NEWS: Tramp methods "imap" and "imaps" are discontinued.
4
52011-02-12 Drew Adams <drew.adams@oracle.com>
6
7 * themes/light-blue-theme.el: New file.
8
12011-02-01 Paul Eggert <eggert@cs.ucla.edu> 92011-02-01 Paul Eggert <eggert@cs.ucla.edu>
2 10
3 format-time-string now supports subsecond time stamp resolution 11 format-time-string now supports subsecond time stamp resolution
@@ -382,7 +390,7 @@
382 * srecode/doc-default.srt (section-comment, function-comment) 390 * srecode/doc-default.srt (section-comment, function-comment)
383 (variable-same-line-comment, group-comment-start, group-comment-end): 391 (variable-same-line-comment, group-comment-start, group-comment-end):
384 * srecode/doc-java.srt (function-comment, variable-same-line-comment) 392 * srecode/doc-java.srt (function-comment, variable-same-line-comment)
385 (group-comment-start, gropu-comment-end): 393 (group-comment-start, group-comment-end):
386 Fix typos in template docstrings. 394 Fix typos in template docstrings.
387 395
3882010-01-14 Kenichi Handa <handa@m17n.org> 3962010-01-14 Kenichi Handa <handa@m17n.org>
diff --git a/etc/NEWS b/etc/NEWS
index 6e9171e55c8..3cc463db4a8 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -137,9 +137,8 @@ theme when Emacs is built with GTK.
137off by customizing x-gtk-use-system-tooltips. 137off by customizing x-gtk-use-system-tooltips.
138 138
139** Lucid menus and dialogs can display antialiased fonts if Emacs is built 139** Lucid menus and dialogs can display antialiased fonts if Emacs is built
140with Xft. To change font, use X resource faceName, for example: 140with Xft. To change font, use the X resource font, for example:
141Emacs.pane.menubar.faceName: Courier-12 141Emacs.pane.menubar.font: Courier-12
142Set faceName to none and use font to use the old X fonts.
143 142
144+++ 143+++
145** Enhanced support for characters that have no glyphs in available fonts 144** Enhanced support for characters that have no glyphs in available fonts
@@ -588,7 +587,7 @@ on a D-Bus without simultaneously registering a property or a method.
588*** There exists a new inline access method "ksu" (kerberized su). 587*** There exists a new inline access method "ksu" (kerberized su).
589 588
590*** The following access methods are discontinued: "ssh1_old", 589*** The following access methods are discontinued: "ssh1_old",
591"ssh2_old", "scp1_old", "scp2_old" and "fish". 590"ssh2_old", "scp1_old", "scp2_old", "imap", "imaps" and "fish".
592 591
593** VC and related modes 592** VC and related modes
594 593
@@ -606,7 +605,17 @@ The vc-merge command now runs a "merge" operation, if it is supported.
606This merges another branch into the current one. This command prompts 605This merges another branch into the current one. This command prompts
607the user for specifics, e.g. a merge source. 606the user for specifics, e.g. a merge source.
608 607
609**** Currently supported by Bzr, Git, and Mercurial. 608**** Currently supported for Bzr, Git, and Mercurial.
609
610*** Log entries in some Log View buffers can be toggled to display a
611longer description by typing RET (log-view-toggle-entry-display).
612In the Log View buffers made by `C-x v L' (vc-print-root-log), you can
613use this to display the full log entry for the revision at point.
614
615**** Currently supported for Bzr, Git, and Mercurial.
616
617**** Packages using Log View mode can enable this functionality by
618binding `log-view-expanded-log-entry-function' to a suitable function.
610 619
611** Miscellaneous 620** Miscellaneous
612 621
diff --git a/etc/themes/light-blue-theme.el b/etc/themes/light-blue-theme.el
new file mode 100644
index 00000000000..60f9fa8dc9d
--- /dev/null
+++ b/etc/themes/light-blue-theme.el
@@ -0,0 +1,67 @@
1;;; light-blue-theme.el --- Custom theme for faces
2
3;; Copyright (C) 2011 Free Software Foundation, Inc.
4
5;; Author: Drew Adams <drew.adams@oracle.com>
6
7;; This file is part of GNU Emacs.
8
9;; GNU Emacs is free software: you can redistribute it and/or modify
10;; it under the terms of the GNU General Public License as published by
11;; the Free Software Foundation, either version 3 of the License, or
12;; (at your option) any later version.
13
14;; GNU Emacs is distributed in the hope that it will be useful,
15;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;; GNU General Public License for more details.
18
19;; You should have received a copy of the GNU General Public License
20;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
21
22;;; Commentary:
23
24;; Extracted from the settings in oneonone.el by Drew Adams.
25
26;;; Code:
27
28(deftheme light-blue
29 "Theme with a light blue backgound.")
30
31(let ((class '((class color) (min-colors 89))))
32 (custom-theme-set-faces
33 'light-blue
34 `(default ((,class (:background "LightBlue" :foreground "black"))))
35 `(cursor ((,class (:background "red"))))
36 `(fringe ((,class (:background "gray85"))))
37 ;; Highlighting faces
38 `(highlight ((,class (:background "cyan"))))
39 `(region ((,class (:background "MediumAquamarine"))))
40 `(secondary-selection ((,class (:background "white" :foreground "black"))))
41 `(isearch ((,class (:background "green" :foreground "Black"))))
42 `(lazy-highlight ((,class (:background "dark turquoise"))))
43 `(query-replace ((,class (:inherit isearch :background "white" :foreground "black"))))
44 `(match ((,class (:background "SkyBlue"))))
45 ;; Mode line faces
46 `(mode-line ((,class (:background "PaleGoldenrod" :foreground "black" :box (:line-width -1 :style released-button)))))
47 `(mode-line-buffer-id ((,class (:overline "red" :underline "red"))))
48 `(mode-line-inactive ((,class (:inherit mode-line :background "LightGray" :foreground "grey20" :box (:line-width -1 :color "grey75") :weight light))))
49 ;; Escape and prompt faces
50 `(escape-glyph ((,class (:background "gold" :foreground "blue" :box (:line-width 1 :color "blue" :style released-button)))))
51 ;; Font lock faces
52 `(font-lock-builtin-face ((,class (:foreground "#b35caf"))))
53 `(font-lock-constant-face ((,class (:foreground "#00006DE06DE0"))))
54 `(font-lock-function-name-face ((,class (:foreground "red"))))
55 `(font-lock-keyword-face ((,class (:foreground "Blue3"))))
56 `(font-lock-string-face ((,class (:foreground "Magenta4"))))
57 `(font-lock-warning-face ((,class (:foreground "orange red" :weight bold))))
58 ;; Compilation faces
59 `(next-error ((,class (:inherit region :background "SkyBlue"))))))
60
61(provide-theme 'light-blue)
62
63;; Local Variables:
64;; no-byte-compile: t
65;; End:
66
67;;; light-blue-theme.el ends here
diff --git a/lib-src/.gitignore b/lib-src/.gitignore
index e1693b13c5e..c931a15d7b6 100644
--- a/lib-src/.gitignore
+++ b/lib-src/.gitignore
@@ -1,6 +1,5 @@
1DOC 1DOC
2ctags.c 2ctags.c
3getopt.h
4stamp_BLD 3stamp_BLD
5echolisp.tmp 4echolisp.tmp
6 5
diff --git a/lib/gettext.h b/lib/gettext.h
index eb74aecb9a8..458e3322177 100644
--- a/lib/gettext.h
+++ b/lib/gettext.h
@@ -93,6 +93,12 @@
93 93
94#endif 94#endif
95 95
96/* Prefer gnulib's setlocale override over libintl's setlocale override. */
97#ifdef GNULIB_defined_setlocale
98# undef setlocale
99# define setlocale rpl_setlocale
100#endif
101
96/* A pseudo function call that serves as a marker for the automated 102/* A pseudo function call that serves as a marker for the automated
97 extraction of messages, but does not call gettext(). The run-time 103 extraction of messages, but does not call gettext(). The run-time
98 translation is done at a different place in the code. 104 translation is done at a different place in the code.
diff --git a/lib/ignore-value.h b/lib/ignore-value.h
index 5e683bbb533..f021a1ac8ea 100644
--- a/lib/ignore-value.h
+++ b/lib/ignore-value.h
@@ -35,13 +35,13 @@
35#ifndef _GL_IGNORE_VALUE_H 35#ifndef _GL_IGNORE_VALUE_H
36# define _GL_IGNORE_VALUE_H 36# define _GL_IGNORE_VALUE_H
37 37
38# ifndef ATTRIBUTE_DEPRECATED 38# ifndef _GL_ATTRIBUTE_DEPRECATED
39/* The __attribute__((__deprecated__)) feature 39/* The __attribute__((__deprecated__)) feature
40 is available in gcc versions 3.1 and newer. */ 40 is available in gcc versions 3.1 and newer. */
41# if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 1) 41# if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 1)
42# define ATTRIBUTE_DEPRECATED /* empty */ 42# define _GL_ATTRIBUTE_DEPRECATED /* empty */
43# else 43# else
44# define ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__)) 44# define _GL_ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__))
45# endif 45# endif
46# endif 46# endif
47 47
@@ -56,7 +56,7 @@
56 56
57/* ignore_value works for scalars, pointers and aggregates; 57/* ignore_value works for scalars, pointers and aggregates;
58 deprecate ignore_ptr. */ 58 deprecate ignore_ptr. */
59static inline void ATTRIBUTE_DEPRECATED 59static inline void _GL_ATTRIBUTE_DEPRECATED
60ignore_ptr (void *p) { (void) p; } /* deprecated: use ignore_value */ 60ignore_ptr (void *p) { (void) p; } /* deprecated: use ignore_value */
61 61
62#endif 62#endif
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7cd39ae6d4b..742cbfc9267 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,111 @@
12011-02-14 Chong Yidong <cyd@stupidchicken.com>
2
3 * vc/vc-git.el (vc-git-root-log-format): New option for
4 customizing log format.
5 (vc-git-print-log, vc-git-log-outgoing, vc-git-log-incoming)
6 (vc-git-log-view-mode): Use it.
7 (vc-git-expanded-log-entry): New function.
8 (vc-git-log-view-mode): Use it. Truncate lines in root log.
9
10 * vc/vc-hg.el (vc-hg-root-log-template): New option for
11 customizing log format.
12 (vc-hg-print-log): Use it.
13 (vc-hg-expanded-log-entry): New function.
14 (vc-hg-log-view-mode): Use vc-hg-root-log-template and
15 vc-hg-expanded-log-entry. Truncate lines in root log.
16
17 * vc/vc-bzr.el (vc-bzr-log-view-mode): Truncate lines in root log.
18
19 * vc/log-view.el (log-view-mode-menu): Add
20 log-view-toggle-entry-display.
21
222011-02-14 Glenn Morris <rgm@gnu.org>
23
24 * dired-x.el: Don't require man when compiling.
25 (dired-omit-extensions, dired-local-variables-file)
26 (dired-x-hands-off-my-keys): Make them defcustoms.
27 (Man-support-local-filenames, Man-getpage-in-background): Declare.
28 (vm-visit-folder): Declare rather than defining.
29 (dired-x-help-address, dired-x-variable-list): Remove.
30 (dired-x-submit-report): Make it an obsolete alias.
31
322011-02-14 Juanma Barranquero <lekktu@gmail.com>
33
34 * makefile.w32-in (TRAMP_SRC): Remove tramp-imap.el.
35
362011-02-13 Teodor Zlatanov <tzz@lifelogs.com>
37
38 * net/imap.el: Bring it back.
39
402011-02-13 Alan Mackenzie <acm@muc.de>
41
42 * progmodes/cc-fonts.el (c-font-lock-declarations): Remove a
43 narrow-to-region call that cuts context off the end (Bug#7722).
44
45 * progmodes/cc-engine.el (c-forward-<>-arglist-recur): Refactor
46 nested if-forms with a simple cond.
47 (c-forward-<>-arglist): Revert 2011-01-31 change.
48
492011-02-13 Chong Yidong <cyd@stupidchicken.com>
50
51 * vc/log-view.el: New command log-view-toggle-entry-display for
52 toggling log entries between concise and detailed forms.
53 (log-view-toggle-entry-display): New command.
54 (log-view-mode-map): Bind RET to it.
55 (log-view-expanded-log-entry-function): New variable.
56 (log-view-current-entry, log-view-inside-comment-p)
57 (log-view-current-tag): New functions.
58 (log-view-toggle-mark-entry): Use log-view-current-entry and
59 log-view-end-of-defun instead of searching directly with
60 log-view-message-re.
61 (log-view-end-of-defun): Likewise. Add optional ARG for
62 compatibility with end-of-defun.
63 (log-view-end-of-defun): Ignore comments and VC buttons.
64
65 * vc/vc-bzr.el (vc-bzr-expanded-log-entry): New function.
66 (vc-bzr-log-view-mode): Use log-view-expanded-log-entry-function.
67
682011-02-13 Teodor Zlatanov <tzz@lifelogs.com>
69
70 * net/imap.el: Remove file. All the functionality is in nnimap.el.
71
72 * net/imap-hash.el: Remove file.
73
742011-02-13 Michael Albinus <michael.albinus@gmx.de>
75
76 * Makefile.in (TRAMP_SRC): Remove tramp-imap.el.
77
78 * net/tramp.el (tramp-read-passwd): Simplify `auth-source-search'
79 call.
80
81 * net/tramp-imap.el: Remove file.
82
832011-02-13 Chong Yidong <cyd@stupidchicken.com>
84
85 * vc/vc.el (vc-print-log-setup-buttons): Instead of using the
86 widget library for buttons, just use button.el.
87
88 * vc/log-view.el (log-view-mode-map): Don't inherit from
89 widget-keymap.
90
912011-02-12 Glenn Morris <rgm@gnu.org>
92
93 * emacs-lisp/cl-seq.el (union, nunion, intersection)
94 (nintersection, set-difference, nset-difference)
95 (set-exclusive-or, nset-exclusive-or): Doc fix.
96
97 * ediff-ptch.el (ediff-fixup-patch-map): Doc fix.
98
99 * faces.el (face-attr-match-p): Handle the obsolete :bold and
100 :italic props, so that frame-set-background-mode works. (Bug#7966)
101
102 * simple.el (next-error): Doc fix.
103
1042011-02-12 Thierry Volpiatto <thierry.volpiatto@gmail.com>
105
106 * dired-aux.el (dired-create-files): Adapt destination name to
107 match the new behavior of copy-directory.
108
12011-02-12 Chong Yidong <cyd@stupidchicken.com> 1092011-02-12 Chong Yidong <cyd@stupidchicken.com>
2 110
3 * mail/mail-utils.el (mail-dont-reply-to-names): New variable, 111 * mail/mail-utils.el (mail-dont-reply-to-names): New variable,
@@ -169,6 +277,11 @@
169 (allout-after-copy-or-kill-hook): No arguments - hook implementers 277 (allout-after-copy-or-kill-hook): No arguments - hook implementers
170 should concentrate on the kill ring. 278 should concentrate on the kill ring.
171 279
2802011-02-09 Teodor Zlatanov <tzz@lifelogs.com>
281
282 * password-cache.el (password-cache-remove): Accept secrets that are
283 not strings.
284
1722011-02-09 Stefan Monnier <monnier@iro.umontreal.ca> 2852011-02-09 Stefan Monnier <monnier@iro.umontreal.ca>
173 286
174 * progmodes/sh-script.el (sh-font-lock-open-heredoc): Fix case 287 * progmodes/sh-script.el (sh-font-lock-open-heredoc): Fix case
@@ -507,7 +620,7 @@
507 620
5082011-01-31 Deniz Dogan <deniz.a.m.dogan@gmail.com> 6212011-01-31 Deniz Dogan <deniz.a.m.dogan@gmail.com>
509 622
510 * net/rcirc.el: New customizable nick completion format. (Bug#6314) 623 * net/rcirc.el: New customizable nick completion format. (Bug#6314)
511 (rcirc-nick-completion-format): New defcustom. 624 (rcirc-nick-completion-format): New defcustom.
512 (rcirc-complete): Use it. 625 (rcirc-complete): Use it.
513 626
@@ -812,7 +925,7 @@
812 925
813 * calc/calc.el (calc-default-power-reference-level) 926 * calc/calc.el (calc-default-power-reference-level)
814 (calc-default-field-reference-level): New variables. 927 (calc-default-field-reference-level): New variables.
815 * calc/calc-units.el (math-standard-units): Add dB and Np. 928 * calc/calc-units.el (math-standard-units): Add dB and Np.
816 (math-logunits): New variable. 929 (math-logunits): New variable.
817 (math-extract-logunits, math-logcombine, calcFunc-luplus) 930 (math-extract-logunits, math-logcombine, calcFunc-luplus)
818 (calcFunc-luminus, calc-luplus, calc-luminus, math-logunit-level) 931 (calcFunc-luminus, calc-luplus, calc-luminus, math-logunit-level)
@@ -822,7 +935,7 @@
822 * calc/calc-help.el (calc-u-prefix-help): Add logarithmic help. 935 * calc/calc-help.el (calc-u-prefix-help): Add logarithmic help.
823 (calc-ul-prefix-help): New function. 936 (calc-ul-prefix-help): New function.
824 * calc/calc-ext.el (calc-init-extensions): Autoload new units 937 * calc/calc-ext.el (calc-init-extensions): Autoload new units
825 functions. Add keybindings for new units functions. 938 functions. Add keybindings for new units functions.
826 939
8272011-01-22 Giorgos Keramidas <keramida@ceid.upatras.gr> (tiny change) 9402011-01-22 Giorgos Keramidas <keramida@ceid.upatras.gr> (tiny change)
828 941
@@ -928,7 +1041,7 @@
928 1041
9292011-01-20 Ken Manheimer <ken.manheimer@gmail.com> 10422011-01-20 Ken Manheimer <ken.manheimer@gmail.com>
930 1043
931 * allout.el: (allout-institute-keymap): Use fset instead of 1044 * allout.el (allout-institute-keymap): Use fset instead of
932 reapplying defalias. 1045 reapplying defalias.
933 1046
934 (allout-hotspot-key-handler): Check for non-control-modified 1047 (allout-hotspot-key-handler): Check for non-control-modified
@@ -1056,7 +1169,7 @@
1056 (info-xref-output-heading): Rename from info-xref-filename-heading. 1169 (info-xref-output-heading): Rename from info-xref-filename-heading.
1057 (info-xref-good, info-xref-bad, info-xref-xfile-alist) 1170 (info-xref-good, info-xref-bad, info-xref-xfile-alist)
1058 (info-xref-filename-heading): Move to output managing section. 1171 (info-xref-filename-heading): Move to output managing section.
1059 (info-xref-docstrings): New command checking "Info node `(foo)Bar'" 1172 (info-xref-docstrings): New command checking "Info node `(foo)Bar'"
1060 (info-xref-lock-file-p, info-xref-with-file): New helpers for it. 1173 (info-xref-lock-file-p, info-xref-with-file): New helpers for it.
1061 (info-xref-subfile-p): Move to generic section with those two. 1174 (info-xref-subfile-p): Move to generic section with those two.
1062 (info-xref-check-node): New function split from 1175 (info-xref-check-node): New function split from
@@ -1066,7 +1179,7 @@
1066 (info-xref-check-node): Use it. 1179 (info-xref-check-node): Use it.
1067 (info-xref-with-output): Show count of unavailables at end of output. 1180 (info-xref-with-output): Show count of unavailables at end of output.
1068 (info-xref-all-info-files): Exclude ".*" dotfiles. Ignore broken 1181 (info-xref-all-info-files): Exclude ".*" dotfiles. Ignore broken
1069 symlinks. Exclude .texi files. Exclude Emacs backup files. 1182 symlinks. Exclude .texi files. Exclude Emacs backup files.
1070 (info-xref-check-all-custom): Fix quietening viper-mode and 1183 (info-xref-check-all-custom): Fix quietening viper-mode and
1071 gnus-registry-install -- use setq not let so as not to unbind 1184 gnus-registry-install -- use setq not let so as not to unbind
1072 after load. 1185 after load.
@@ -1646,7 +1759,7 @@
1646 (rmail-mime-insert-text): Call rmail-mime-insert-decoded-text. 1759 (rmail-mime-insert-text): Call rmail-mime-insert-decoded-text.
1647 (rmail-mime-insert-image): Argument changed. Caller changed. 1760 (rmail-mime-insert-image): Argument changed. Caller changed.
1648 (rmail-mime-image): Call rmail-mime-toggle-hidden. 1761 (rmail-mime-image): Call rmail-mime-toggle-hidden.
1649 (rmail-mime-set-bulk-data): New funciton. 1762 (rmail-mime-set-bulk-data): New function.
1650 (rmail-mime-insert-bulk): Argument changed. 1763 (rmail-mime-insert-bulk): Argument changed.
1651 (rmail-mime-multipart-handler): Return t. 1764 (rmail-mime-multipart-handler): Return t.
1652 (rmail-mime-process-multipart): Argument changed. 1765 (rmail-mime-process-multipart): Argument changed.
@@ -1911,7 +2024,7 @@
1911 (allout-toggle-subtree-encryption): Adjust docstrings to reflect 2024 (allout-toggle-subtree-encryption): Adjust docstrings to reflect
1912 defaulting policy and other changes. Change fetch-pass to keymode-cue, 2025 defaulting policy and other changes. Change fetch-pass to keymode-cue,
1913 for simpler universal argument interpretation. 2026 for simpler universal argument interpretation.
1914 (allout-toggle-subtree-encryption): Adjust docstring to describe 2027 (allout-toggle-subtree-encryption): Adjust docstring to describe
1915 changed encryption provisions. Change fetch-pass to keymode-cue, for 2028 changed encryption provisions. Change fetch-pass to keymode-cue, for
1916 simpler universal argument interpretation. Remove provisions for 2029 simpler universal argument interpretation. Remove provisions for
1917 handling key type and identity - they'll all be within 2030 handling key type and identity - they'll all be within
@@ -2527,8 +2640,8 @@
2527 and "psftp". Exchange "%k" marker with options. 2640 and "psftp". Exchange "%k" marker with options.
2528 (tramp-do-copy-or-rename-file, tramp-sh-handle-file-local-copy): 2641 (tramp-do-copy-or-rename-file, tramp-sh-handle-file-local-copy):
2529 Compute size of link target. 2642 Compute size of link target.
2530 (tramp-do-copy-or-rename-file-out-of-band). Move setting of 2643 (tramp-do-copy-or-rename-file-out-of-band): Move setting of
2531 `tramp-current-*' up due to gateway methods. Optimze computing of 2644 `tramp-current-*' up due to gateway methods. Optimize computing of
2532 copy arguments. Use `tramp-get-connection-name' and 2645 copy arguments. Use `tramp-get-connection-name' and
2533 `tramp-get-connection-buffer'. Improve debug messages. 2646 `tramp-get-connection-buffer'. Improve debug messages.
2534 (tramp-compute-multi-hops): Remove port determination. 2647 (tramp-compute-multi-hops): Remove port determination.
@@ -3780,7 +3893,7 @@
3780 3893
3781 * international/characters.el (char-acronym-table): New variable. 3894 * international/characters.el (char-acronym-table): New variable.
3782 (glyphless-char-control): New variable. 3895 (glyphless-char-control): New variable.
3783 (update-glyphless-char-display): New funciton. 3896 (update-glyphless-char-display): New function.
3784 3897
3785 * faces.el (glyphless-char): New face. 3898 * faces.el (glyphless-char): New face.
3786 3899
@@ -3851,7 +3964,7 @@
38512010-10-31 Jan Djärv <jan.h.d@swipnet.se> 39642010-10-31 Jan Djärv <jan.h.d@swipnet.se>
3852 3965
3853 * term/x-win.el (x-get-selection-value): New function that gets 3966 * term/x-win.el (x-get-selection-value): New function that gets
3854 PRIMARY with type as specified in x-select-request-type. (Bug#6802). 3967 PRIMARY with type as specified in x-select-request-type. (Bug#6802)
3855 3968
38562010-10-31 Michael Albinus <michael.albinus@gmx.de> 39692010-10-31 Michael Albinus <michael.albinus@gmx.de>
3857 3970
@@ -4140,7 +4253,7 @@
4140 is indented differently if it is after a begin..end clock. 4253 is indented differently if it is after a begin..end clock.
4141 (verilog-in-attribute-p, verilog-skip-backward-comments) 4254 (verilog-in-attribute-p, verilog-skip-backward-comments)
4142 (verilog-skip-forward-comment-p): Support proper treatment of 4255 (verilog-skip-forward-comment-p): Support proper treatment of
4143 attributes by indent code. Reported by Jeff Steele. 4256 attributes by indent code. Reported by Jeff Steele.
4144 (verilog-in-directive-p): Fix comment to correctly describe function. 4257 (verilog-in-directive-p): Fix comment to correctly describe function.
4145 (verilog-backward-up-list, verilog-in-struct-region-p) 4258 (verilog-backward-up-list, verilog-in-struct-region-p)
4146 (verilog-backward-token, verilog-in-struct-p) 4259 (verilog-backward-token, verilog-in-struct-p)
@@ -4151,9 +4264,9 @@
4151 (verilog-property-re, verilog-endcomment-reason-re) 4264 (verilog-property-re, verilog-endcomment-reason-re)
4152 (verilog-beg-of-statement, verilog-set-auto-endcomments) 4265 (verilog-beg-of-statement, verilog-set-auto-endcomments)
4153 (verilog-calc-1 ): Fix for assert a; else b; indentation (new form 4266 (verilog-calc-1 ): Fix for assert a; else b; indentation (new form
4154 of if). Reported by Max Bjurling and 4267 of if). Reported by Max Bjurling and
4155 (verilog-calc-1): Fix for clocking block in modport 4268 (verilog-calc-1): Fix for clocking block in modport
4156 declaration. Reported by Brian Hunter. 4269 declaration. Reported by Brian Hunter.
4157 4270
41582010-10-24 Wilson Snyder <wsnyder@wsnyder.org> 42712010-10-24 Wilson Snyder <wsnyder@wsnyder.org>
4159 4272
@@ -4169,7 +4282,7 @@
4169 (verilog-read-always-signals-recurse, verilog-read-decls): Fix not 4282 (verilog-read-always-signals-recurse, verilog-read-decls): Fix not
4170 treating `elsif similar to `endif inside AUTOSENSE. 4283 treating `elsif similar to `endif inside AUTOSENSE.
4171 (verilog-do-indent): Implement correct automatic or static task or 4284 (verilog-do-indent): Implement correct automatic or static task or
4172 function end comment highlight. Reported by Steve Pearlmutter. 4285 function end comment highlight. Reported by Steve Pearlmutter.
4173 (verilog-font-lock-keywords-2): Fix highlighting of single 4286 (verilog-font-lock-keywords-2): Fix highlighting of single
4174 character pins, bug264. Reported by Michael Laajanen. 4287 character pins, bug264. Reported by Michael Laajanen.
4175 (verilog-auto-inst, verilog-read-decls, verilog-read-sub-decls) 4288 (verilog-auto-inst, verilog-read-decls, verilog-read-sub-decls)
@@ -4180,7 +4293,7 @@
4180 Reported by Mark Johnson. 4293 Reported by Mark Johnson.
4181 (verilog-auto-tieoff, verilog-auto-tieoff-ignore-regexp): 4294 (verilog-auto-tieoff, verilog-auto-tieoff-ignore-regexp):
4182 Add 'verilog-auto-tieoff-ignore-regexp' for AUTOTIEOFF, 4295 Add 'verilog-auto-tieoff-ignore-regexp' for AUTOTIEOFF,
4183 bug269. Suggested by Gary Delp. 4296 bug269. Suggested by Gary Delp.
4184 (verilog-mode-map, verilog-preprocess, verilog-preprocess-history) 4297 (verilog-mode-map, verilog-preprocess, verilog-preprocess-history)
4185 (verilog-preprocessor, verilog-set-compile-command): 4298 (verilog-preprocessor, verilog-set-compile-command):
4186 Create verilog-preprocess and verilog-preprocessor to show 4299 Create verilog-preprocess and verilog-preprocessor to show
@@ -4188,7 +4301,7 @@
4188 (verilog-get-beg-of-line, verilog-get-end-of-line) 4301 (verilog-get-beg-of-line, verilog-get-end-of-line)
4189 (verilog-modi-file-or-buffer, verilog-modi-name) 4302 (verilog-modi-file-or-buffer, verilog-modi-name)
4190 (verilog-modi-point, verilog-within-string): Move defmacro's 4303 (verilog-modi-point, verilog-within-string): Move defmacro's
4191 before first use to avoid warning. Reported by Steve Pearlmutter. 4304 before first use to avoid warning. Reported by Steve Pearlmutter.
4192 (verilog-colorize-buffer, verilog-colorize-include-files-buffer) 4305 (verilog-colorize-buffer, verilog-colorize-include-files-buffer)
4193 (verilog-colorize-region, verilog-highlight-buffer) 4306 (verilog-colorize-region, verilog-highlight-buffer)
4194 (verilog-highlight-includes, verilog-highlight-modules) 4307 (verilog-highlight-includes, verilog-highlight-modules)
@@ -4220,7 +4333,7 @@
4220 (verilog-alw-get-temps, verilog-auto-reset) 4333 (verilog-alw-get-temps, verilog-auto-reset)
4221 (verilog-auto-sense-sigs, verilog-read-always-signals) 4334 (verilog-auto-sense-sigs, verilog-read-always-signals)
4222 (verilog-read-always-signals-recurse): Fix loop indexes being 4335 (verilog-read-always-signals-recurse): Fix loop indexes being
4223 AUTORESET. AUTORESET now assumes any variables in the 4336 AUTORESET. AUTORESET now assumes any variables in the
4224 initialization section of a for() should be ignored. 4337 initialization section of a for() should be ignored.
4225 Reported by Dan Dever. 4338 Reported by Dan Dever.
4226 (verilog-error-font-lock-keywords) 4339 (verilog-error-font-lock-keywords)
@@ -5633,7 +5746,7 @@
5633 (sql-postgres-login-params): Add user and database defaults. 5746 (sql-postgres-login-params): Add user and database defaults.
5634 (sql-buffer-live-p): Bug fix. 5747 (sql-buffer-live-p): Bug fix.
5635 (sql-product-history): New variable. 5748 (sql-product-history): New variable.
5636 (sql-read-product): New function. Use it. 5749 (sql-read-product): New function. Use it.
5637 (sql-set-product, sql-product-interactive): Use it. 5750 (sql-set-product, sql-product-interactive): Use it.
5638 (sql-connection-history): New variable. 5751 (sql-connection-history): New variable.
5639 (sql-read-connection): New function. Use it. 5752 (sql-read-connection): New function. Use it.
diff --git a/lisp/Makefile.in b/lisp/Makefile.in
index 2f92578b516..d99622944a3 100644
--- a/lisp/Makefile.in
+++ b/lisp/Makefile.in
@@ -329,16 +329,16 @@ $(MH_E_DIR)/mh-loaddefs.el: $(MH_E_SRC)
329 --eval "(setq make-backup-files nil)" \ 329 --eval "(setq make-backup-files nil)" \
330 -f batch-update-autoloads $(MH_E_DIR) 330 -f batch-update-autoloads $(MH_E_DIR)
331 331
332# Update TRAMP internal autoloads. Maybe we could move trmp*.el into 332# Update TRAMP internal autoloads. Maybe we could move tramp*.el into
333# an own subdirectory. OTOH, it does not hurt to keep them in 333# an own subdirectory. OTOH, it does not hurt to keep them in
334# lisp/net. 334# lisp/net.
335TRAMP_DIR = $(lisp)/net 335TRAMP_DIR = $(lisp)/net
336TRAMP_SRC = $(TRAMP_DIR)/tramp.el $(TRAMP_DIR)/tramp-cache.el \ 336TRAMP_SRC = $(TRAMP_DIR)/tramp.el $(TRAMP_DIR)/tramp-cache.el \
337 $(TRAMP_DIR)/tramp-cmds.el $(TRAMP_DIR)/tramp-compat.el \ 337 $(TRAMP_DIR)/tramp-cmds.el $(TRAMP_DIR)/tramp-compat.el \
338 $(TRAMP_DIR)/tramp-ftp.el $(TRAMP_DIR)/tramp-gvfs.el \ 338 $(TRAMP_DIR)/tramp-ftp.el $(TRAMP_DIR)/tramp-gvfs.el \
339 $(TRAMP_DIR)/tramp-gw.el $(TRAMP_DIR)/tramp-imap.el \ 339 $(TRAMP_DIR)/tramp-gw.el $(TRAMP_DIR)/tramp-sh.el \
340 $(TRAMP_DIR)/tramp-sh.el $(TRAMP_DIR)/tramp-smb.el \ 340 $(TRAMP_DIR)/tramp-smb.el $(TRAMP_DIR)/tramp-uu.el \
341 $(TRAMP_DIR)/tramp-uu.el $(TRAMP_DIR)/trampver.el 341 $(TRAMP_DIR)/trampver.el
342 342
343$(TRAMP_DIR)/tramp-loaddefs.el: $(TRAMP_SRC) 343$(TRAMP_DIR)/tramp-loaddefs.el: $(TRAMP_SRC)
344 $(emacs) -l autoload \ 344 $(emacs) -l autoload \
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 6f33831eb38..cb1324051a7 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -1383,6 +1383,10 @@ ESC or `q' to not overwrite any of the remaining files,
1383 (cond ((integerp marker-char) marker-char) 1383 (cond ((integerp marker-char) marker-char)
1384 (marker-char (dired-file-marker from)) ; slow 1384 (marker-char (dired-file-marker from)) ; slow
1385 (t nil)))) 1385 (t nil))))
1386 (when (and (file-directory-p from)
1387 (file-directory-p to)
1388 (eq file-creator 'dired-copy-file))
1389 (setq to (file-name-directory to)))
1386 (condition-case err 1390 (condition-case err
1387 (progn 1391 (progn
1388 (funcall file-creator from to dired-overwrite-confirmed) 1392 (funcall file-creator from to dired-overwrite-confirmed)
diff --git a/lisp/dired-x.el b/lisp/dired-x.el
index e0caae059b4..8011b4d32a4 100644
--- a/lisp/dired-x.el
+++ b/lisp/dired-x.el
@@ -25,91 +25,47 @@
25 25
26;;; Commentary: 26;;; Commentary:
27 27
28;; This is Sebastian Kremer's excellent dired-x.el (Dired Extra), version 28;; This is based on Sebastian Kremer's excellent dired-x.el (Dired Extra),
29;; 1.191, hacked up for GNU Emacs. Redundant or conflicting material has 29;; version 1.191, adapted for GNU Emacs. See the `dired-x' info pages.
30;; been removed or renamed in order to work properly with dired of GNU
31;; Emacs. All suggestions or comments are most welcomed.
32 30
33;; 31;; USAGE: In your ~/.emacs,
34;; Please, PLEASE, *PLEASE* see the info pages.
35;;
36
37;; BUGS: Type M-x dired-x-submit-report and a report will be generated.
38
39;; INSTALLATION: In your ~/.emacs,
40;; 32;;
41;; (add-hook 'dired-load-hook 33;; (add-hook 'dired-load-hook
42;; (function (lambda () 34;; (lambda ()
43;; (load "dired-x") 35;; (require 'dired-x)
44;; ;; Set global variables here. For example: 36;; ;; Set global variables here. For example:
45;; ;; (setq dired-guess-shell-gnutar "gtar") 37;; ;; (setq dired-guess-shell-gnutar "gtar")
46;; ))) 38;; ))
47;; (add-hook 'dired-mode-hook 39;; (add-hook 'dired-mode-hook
48;; (function (lambda () 40;; (lambda ()
49;; ;; Set buffer-local variables here. For example: 41;; ;; Set buffer-local variables here. For example:
50;; ;; (dired-omit-mode 1) 42;; ;; (dired-omit-mode 1)
51;; ))) 43;; ))
52;; 44;;
53;; At load time dired-x.el will install itself, redefine some functions, and 45;; At load time dired-x.el will install itself, redefine some functions, and
54;; bind some dired keys. *Please* see the info pages for more details. 46;; bind some dired keys.
55 47
56;; *Please* see the info pages for more details. 48;; User customization: M-x customize-group RET dired-x RET.
57 49
58;; User defined variables: 50;; When loaded this code redefines the following functions of GNU Emacs:
59;; 51;; From dired.el: dired-clean-up-after-deletion, dired-find-buffer-nocreate,
60;; dired-bind-vm 52;; and dired-initial-position.
61;; dired-vm-read-only-folders 53;; From dired-aux.el: dired-add-entry and dired-read-shell-command.
62;; dired-bind-jump
63;; dired-bind-info
64;; dired-bind-man
65;; dired-x-hands-off-my-keys
66;; dired-find-subdir
67;; dired-enable-local-variables
68;; dired-local-variables-file
69;; dired-guess-shell-gnutar
70;; dired-guess-shell-gzip-quiet
71;; dired-guess-shell-znew-switches
72;; dired-guess-shell-alist-user
73;; dired-clean-up-buffers-too
74;; dired-omit-mode
75;; dired-omit-files
76;; dired-omit-extensions
77;; dired-omit-size-limit
78;;
79;; To find out more about these variables, load this file, put your cursor at
80;; the end of any of the variable names, and hit C-h v [RET]. *Please* see
81;; the info pages for more details.
82 54
83;; When loaded this code redefines the following functions of GNU Emacs 55;; *Please* see the `dired-x' info pages for more details.
84;;
85;; Function Found in this file of GNU Emacs
86;; -------- -------------------------------
87;; dired-clean-up-after-deletion ../lisp/dired.el
88;; dired-find-buffer-nocreate ../lisp/dired.el
89;; dired-initial-position ../lisp/dired.el
90;;
91;; dired-add-entry ../lisp/dired-aux.el
92;; dired-read-shell-command ../lisp/dired-aux.el
93 56
94 57
95;;; Code: 58;;; Code:
96 59
97;; LOAD. 60;; LOAD.
98 61
99;; This is a no-op if dired-x is being loaded via `dired-load-hook'. It is 62;; This is a no-op if dired-x is being loaded via `dired-load-hook',
100;; here in case the user has autoloaded dired-x via the dired-jump key binding 63;; but maybe not if a dired-x function is being autoloaded.
101;; (instead of autoloading to dired as is suggested in the info-pages).
102
103(require 'dired) 64(require 'dired)
104 65
105;; We will redefine some functions and also need some macros so we need to 66;; We will redefine some functions and also need some macros.
106;; load dired stuff of GNU Emacs.
107
108(require 'dired-aux) 67(require 'dired-aux)
109 68
110(defvar vm-folder-directory)
111(eval-when-compile (require 'man))
112
113;;; User-defined variables. 69;;; User-defined variables.
114 70
115(defgroup dired-x nil 71(defgroup dired-x nil
@@ -340,10 +296,9 @@ to nil: a pipe using `zcat' or `gunzip -c' will be used."
340 'dashes))) 296 'dashes)))
341 297
342;;; GLOBAL BINDING. 298;;; GLOBAL BINDING.
343(if dired-bind-jump 299(when dired-bind-jump
344 (progn 300 (define-key global-map "\C-x\C-j" 'dired-jump)
345 (define-key global-map "\C-x\C-j" 'dired-jump) 301 (define-key global-map "\C-x4\C-j" 'dired-jump-other-window))
346 (define-key global-map "\C-x4\C-j" 'dired-jump-other-window)))
347 302
348 303
349;; Install into appropriate hooks. 304;; Install into appropriate hooks.
@@ -589,7 +544,7 @@ Should never be used as marker by the user or other packages.")
589 (let ((dired-omit-mode nil)) (revert-buffer)) ;; Show omitted files 544 (let ((dired-omit-mode nil)) (revert-buffer)) ;; Show omitted files
590 (dired-mark-unmarked-files (dired-omit-regexp) nil nil dired-omit-localp)) 545 (dired-mark-unmarked-files (dired-omit-regexp) nil nil dired-omit-localp))
591 546
592(defvar dired-omit-extensions 547(defcustom dired-omit-extensions
593 (append completion-ignored-extensions 548 (append completion-ignored-extensions
594 dired-latex-unclean-extensions 549 dired-latex-unclean-extensions
595 dired-bibtex-unclean-extensions 550 dired-bibtex-unclean-extensions
@@ -600,7 +555,9 @@ Defaults to elements of `completion-ignored-extensions',
600`dired-texinfo-unclean-extensions'. 555`dired-texinfo-unclean-extensions'.
601 556
602See interactive function `dired-omit-mode' \(\\[dired-omit-mode]\) and 557See interactive function `dired-omit-mode' \(\\[dired-omit-mode]\) and
603variables `dired-omit-mode' and `dired-omit-files'.") 558variables `dired-omit-mode' and `dired-omit-files'."
559 :type '(repeat string)
560 :group 'dired-x)
604 561
605(defun dired-omit-expunge (&optional regexp) 562(defun dired-omit-expunge (&optional regexp)
606 "Erases all unmarked files matching REGEXP. 563 "Erases all unmarked files matching REGEXP.
@@ -896,12 +853,15 @@ Knows about the special cases in variable `default-directory-alist'."
896;;; `dired-enable-local-variables' and run `hack-local-variables' on the 853;;; `dired-enable-local-variables' and run `hack-local-variables' on the
897;;; Dired Buffer. 854;;; Dired Buffer.
898 855
899(defvar dired-local-variables-file (convert-standard-filename ".dired") 856;; FIXME do standard dir-locals obsolete this?
857(defcustom dired-local-variables-file (convert-standard-filename ".dired")
900 "Filename, as string, containing local dired buffer variables to be hacked. 858 "Filename, as string, containing local dired buffer variables to be hacked.
901If this file found in current directory, then it will be inserted into dired 859If this file found in current directory, then it will be inserted into dired
902buffer and `hack-local-variables' will be run. See Info node 860buffer and `hack-local-variables' will be run. See Info node
903`(emacs)File Variables' for more information on local variables. 861`(emacs)File Variables' for more information on local variables.
904See also `dired-enable-local-variables'.") 862See also `dired-enable-local-variables'."
863 :type 'file
864 :group 'dired)
905 865
906(defun dired-hack-local-variables () 866(defun dired-hack-local-variables ()
907 "Evaluate local variables in `dired-local-variables-file' for dired buffer." 867 "Evaluate local variables in `dired-local-variables-file' for dired buffer."
@@ -980,6 +940,8 @@ dired."
980;; NOTE: Use `gunzip -c' instead of `zcat' on `.gz' files. Some do not 940;; NOTE: Use `gunzip -c' instead of `zcat' on `.gz' files. Some do not
981;; install GNU zip's version of zcat. 941;; install GNU zip's version of zcat.
982 942
943(declare-function Man-support-local-filenames "man" ())
944
983(defvar dired-guess-shell-alist-default 945(defvar dired-guess-shell-alist-default
984 (list 946 (list
985 (list "\\.tar$" 947 (list "\\.tar$"
@@ -1429,6 +1391,8 @@ NOSELECT the files are merely found but not selected."
1429 1391
1430;; Run man on files. 1392;; Run man on files.
1431 1393
1394(declare-function Man-getpage-in-background "man" (topic))
1395
1432(defun dired-man () 1396(defun dired-man ()
1433 "Run man on this file. Display old buffer if buffer name matches filename. 1397 "Run man on this file. Display old buffer if buffer name matches filename.
1434Uses `man.el' of \\[manual-entry] fame." 1398Uses `man.el' of \\[manual-entry] fame."
@@ -1449,11 +1413,8 @@ Uses `man.el' of \\[manual-entry] fame."
1449 1413
1450;; Run mail on mail folders. 1414;; Run mail on mail folders.
1451 1415
1452;; Avoid compiler warning. 1416(declare-function vm-visit-folder "ext:vm" (folder &optional read-only))
1453(eval-when-compile 1417(defvar vm-folder-directory)
1454 (when (not (fboundp 'vm-visit-folder))
1455 (defun vm-visit-folder (file &optional arg)
1456 nil)))
1457 1418
1458(defun dired-vm (&optional read-only) 1419(defun dired-vm (&optional read-only)
1459 "Run VM on this file. 1420 "Run VM on this file.
@@ -1659,11 +1620,17 @@ to mark all zero length files."
1659 1620
1660;;; FIND FILE AT POINT. 1621;;; FIND FILE AT POINT.
1661 1622
1662(defvar dired-x-hands-off-my-keys t 1623(defcustom dired-x-hands-off-my-keys t
1663 "*Non-nil means don't bind `dired-x-find-file' over `find-file' on keyboard. 1624 "Non-nil means don't bind `dired-x-find-file' over `find-file' on keyboard.
1664Similarly for `dired-x-find-file-other-window' over `find-file-other-window'. 1625Similarly for `dired-x-find-file-other-window' over `find-file-other-window'.
1665If you change this variable after `dired-x.el' is loaded then do 1626If you change this variable without using \\[customize] after `dired-x.el'
1666\\[dired-x-bind-find-file].") 1627is loaded then call \\[dired-x-bind-find-file]."
1628 :type 'boolean
1629 :initialize 'custom-initialize-default
1630 :set (lambda (sym val)
1631 (set sym val)
1632 (dired-x-bind-find-file))
1633 :group 'dired-x)
1667 1634
1668;; Bind `dired-x-find-file{-other-window}' over wherever 1635;; Bind `dired-x-find-file{-other-window}' over wherever
1669;; `find-file{-other-window}' is bound? 1636;; `find-file{-other-window}' is bound?
@@ -1777,48 +1744,7 @@ If `current-prefix-arg' is non-nil, uses name at point as guess."
1777 1744
1778;;; BUG REPORTS 1745;;; BUG REPORTS
1779 1746
1780;; Fixme: get rid of this later. 1747(define-obsolete-function-alias 'dired-x-submit-report 'report-emacs-bug "24.1")
1781
1782;; This section is provided for reports. It uses Barry A. Warsaw's
1783;; reporter.el which is bundled with GNU Emacs v19.
1784
1785(defconst dired-x-help-address "bug-gnu-emacs@gnu.org"
1786 "Address(es) accepting submission of reports on dired-x.el.")
1787
1788(defconst dired-x-variable-list
1789 (list
1790 'dired-bind-vm
1791 'dired-vm-read-only-folders
1792 'dired-bind-jump
1793 'dired-bind-info
1794 'dired-bind-man
1795 'dired-find-subdir
1796 'dired-enable-local-variables
1797 'dired-local-variables-file
1798 'dired-guess-shell-gnutar
1799 'dired-guess-shell-gzip-quiet
1800 'dired-guess-shell-znew-switches
1801 'dired-guess-shell-alist-user
1802 'dired-clean-up-buffers-too
1803 'dired-omit-mode
1804 'dired-omit-files
1805 'dired-omit-extensions
1806 )
1807 "List of variables to be appended to reports sent by `dired-x-submit-report'.")
1808
1809(defun dired-x-submit-report ()
1810 "Submit via `reporter.el' a bug report on program.
1811Send report on `dired-x-file' version `dired-x-version', to
1812`dired-x-maintainer' at address `dired-x-help-address' listing
1813variables `dired-x-variable-list' in the message."
1814 (interactive)
1815
1816 (reporter-submit-bug-report
1817 dired-x-help-address ; address
1818 "dired-x" ; pkgname
1819 dired-x-variable-list ; varlist
1820 nil nil ; pre-/post-hooks
1821 ""))
1822 1748
1823 1749
1824;; As Barry Warsaw would say: "This might be useful..." 1750;; As Barry Warsaw would say: "This might be useful..."
diff --git a/lisp/dired.el b/lisp/dired.el
index 3a76398e956..058dbdc548a 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -3570,7 +3570,7 @@ Ask means pop up a menu for the user to select one of copy, move or link."
3570;;;;;; dired-run-shell-command dired-do-shell-command dired-do-async-shell-command 3570;;;;;; dired-run-shell-command dired-do-shell-command dired-do-async-shell-command
3571;;;;;; dired-clean-directory dired-do-print dired-do-touch dired-do-chown 3571;;;;;; dired-clean-directory dired-do-print dired-do-touch dired-do-chown
3572;;;;;; dired-do-chgrp dired-do-chmod dired-compare-directories dired-backup-diff 3572;;;;;; dired-do-chgrp dired-do-chmod dired-compare-directories dired-backup-diff
3573;;;;;; dired-diff) "dired-aux" "dired-aux.el" "9f5fc434fa6c2607b6e66060862c9caf") 3573;;;;;; dired-diff) "dired-aux" "dired-aux.el" "e66465bcd1687d66cfb1202c9963d567")
3574;;; Generated autoloads from dired-aux.el 3574;;; Generated autoloads from dired-aux.el
3575 3575
3576(autoload 'dired-diff "dired-aux" "\ 3576(autoload 'dired-diff "dired-aux" "\
@@ -4029,7 +4029,7 @@ true then the type of the file linked to by FILE is printed instead.
4029;;;*** 4029;;;***
4030 4030
4031;;;### (autoloads (dired-do-relsymlink dired-jump) "dired-x" "dired-x.el" 4031;;;### (autoloads (dired-do-relsymlink dired-jump) "dired-x" "dired-x.el"
4032;;;;;; "fbac6ae123aaa2b2e9df8bb2cde61ceb") 4032;;;;;; "d35468f85920d324895b0c04bb703328")
4033;;; Generated autoloads from dired-x.el 4033;;; Generated autoloads from dired-x.el
4034 4034
4035(autoload 'dired-jump "dired-x" "\ 4035(autoload 'dired-jump "dired-x" "\
diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el
index 2d3b228cbd4..9880e2918b0 100644
--- a/lisp/emacs-lisp/checkdoc.el
+++ b/lisp/emacs-lisp/checkdoc.el
@@ -1797,7 +1797,7 @@ Replace with \"%s\"? " original replace)
1797 (let ((found nil) (start (point)) (msg nil) (ms nil)) 1797 (let ((found nil) (start (point)) (msg nil) (ms nil))
1798 (while (and (not msg) 1798 (while (and (not msg)
1799 (re-search-forward 1799 (re-search-forward
1800 ;; Ignore manual page refereces like 1800 ;; Ignore manual page references like
1801 ;; git-config(1). 1801 ;; git-config(1).
1802 "[^-([`':a-zA-Z]\\(\\w+[:-]\\(\\w\\|\\s_\\)+\\)[^](']" 1802 "[^-([`':a-zA-Z]\\(\\w+[:-]\\(\\w\\|\\s_\\)+\\)[^](']"
1803 e t)) 1803 e t))
diff --git a/lisp/emacs-lisp/cl-loaddefs.el b/lisp/emacs-lisp/cl-loaddefs.el
index e10dc10447c..8e192a18459 100644
--- a/lisp/emacs-lisp/cl-loaddefs.el
+++ b/lisp/emacs-lisp/cl-loaddefs.el
@@ -754,7 +754,7 @@ surrounded by (block NAME ...).
754;;;;;; find nsubstitute-if-not nsubstitute-if nsubstitute substitute-if-not 754;;;;;; find nsubstitute-if-not nsubstitute-if nsubstitute substitute-if-not
755;;;;;; substitute-if substitute delete-duplicates remove-duplicates 755;;;;;; substitute-if substitute delete-duplicates remove-duplicates
756;;;;;; delete-if-not delete-if delete* remove-if-not remove-if remove* 756;;;;;; delete-if-not delete-if delete* remove-if-not remove-if remove*
757;;;;;; replace fill reduce) "cl-seq" "cl-seq.el" "43e0c1183e738e1e1038cdd84fde8366") 757;;;;;; replace fill reduce) "cl-seq" "cl-seq.el" "df375ddc313f0c1c262cacab5cffd3e4")
758;;; Generated autoloads from cl-seq.el 758;;; Generated autoloads from cl-seq.el
759 759
760(autoload 'reduce "cl-seq" "\ 760(autoload 'reduce "cl-seq" "\
@@ -1080,7 +1080,7 @@ Keywords supported: :key
1080 1080
1081(autoload 'union "cl-seq" "\ 1081(autoload 'union "cl-seq" "\
1082Combine LIST1 and LIST2 using a set-union operation. 1082Combine LIST1 and LIST2 using a set-union operation.
1083The result list contains all items that appear in either LIST1 or LIST2. 1083The resulting list contains all items that appear in either LIST1 or LIST2.
1084This is a non-destructive function; it makes a copy of the data if necessary 1084This is a non-destructive function; it makes a copy of the data if necessary
1085to avoid corrupting the original LIST1 and LIST2. 1085to avoid corrupting the original LIST1 and LIST2.
1086 1086
@@ -1090,7 +1090,7 @@ Keywords supported: :test :test-not :key
1090 1090
1091(autoload 'nunion "cl-seq" "\ 1091(autoload 'nunion "cl-seq" "\
1092Combine LIST1 and LIST2 using a set-union operation. 1092Combine LIST1 and LIST2 using a set-union operation.
1093The result list contains all items that appear in either LIST1 or LIST2. 1093The resulting list contains all items that appear in either LIST1 or LIST2.
1094This is a destructive function; it reuses the storage of LIST1 and LIST2 1094This is a destructive function; it reuses the storage of LIST1 and LIST2
1095whenever possible. 1095whenever possible.
1096 1096
@@ -1100,7 +1100,7 @@ Keywords supported: :test :test-not :key
1100 1100
1101(autoload 'intersection "cl-seq" "\ 1101(autoload 'intersection "cl-seq" "\
1102Combine LIST1 and LIST2 using a set-intersection operation. 1102Combine LIST1 and LIST2 using a set-intersection operation.
1103The result list contains all items that appear in both LIST1 and LIST2. 1103The resulting list contains all items that appear in both LIST1 and LIST2.
1104This is a non-destructive function; it makes a copy of the data if necessary 1104This is a non-destructive function; it makes a copy of the data if necessary
1105to avoid corrupting the original LIST1 and LIST2. 1105to avoid corrupting the original LIST1 and LIST2.
1106 1106
@@ -1110,7 +1110,7 @@ Keywords supported: :test :test-not :key
1110 1110
1111(autoload 'nintersection "cl-seq" "\ 1111(autoload 'nintersection "cl-seq" "\
1112Combine LIST1 and LIST2 using a set-intersection operation. 1112Combine LIST1 and LIST2 using a set-intersection operation.
1113The result list contains all items that appear in both LIST1 and LIST2. 1113The resulting list contains all items that appear in both LIST1 and LIST2.
1114This is a destructive function; it reuses the storage of LIST1 and LIST2 1114This is a destructive function; it reuses the storage of LIST1 and LIST2
1115whenever possible. 1115whenever possible.
1116 1116
@@ -1120,7 +1120,7 @@ Keywords supported: :test :test-not :key
1120 1120
1121(autoload 'set-difference "cl-seq" "\ 1121(autoload 'set-difference "cl-seq" "\
1122Combine LIST1 and LIST2 using a set-difference operation. 1122Combine LIST1 and LIST2 using a set-difference operation.
1123The result list contains all items that appear in LIST1 but not LIST2. 1123The resulting list contains all items that appear in LIST1 but not LIST2.
1124This is a non-destructive function; it makes a copy of the data if necessary 1124This is a non-destructive function; it makes a copy of the data if necessary
1125to avoid corrupting the original LIST1 and LIST2. 1125to avoid corrupting the original LIST1 and LIST2.
1126 1126
@@ -1130,7 +1130,7 @@ Keywords supported: :test :test-not :key
1130 1130
1131(autoload 'nset-difference "cl-seq" "\ 1131(autoload 'nset-difference "cl-seq" "\
1132Combine LIST1 and LIST2 using a set-difference operation. 1132Combine LIST1 and LIST2 using a set-difference operation.
1133The result list contains all items that appear in LIST1 but not LIST2. 1133The resulting list contains all items that appear in LIST1 but not LIST2.
1134This is a destructive function; it reuses the storage of LIST1 and LIST2 1134This is a destructive function; it reuses the storage of LIST1 and LIST2
1135whenever possible. 1135whenever possible.
1136 1136
@@ -1140,7 +1140,7 @@ Keywords supported: :test :test-not :key
1140 1140
1141(autoload 'set-exclusive-or "cl-seq" "\ 1141(autoload 'set-exclusive-or "cl-seq" "\
1142Combine LIST1 and LIST2 using a set-exclusive-or operation. 1142Combine LIST1 and LIST2 using a set-exclusive-or operation.
1143The result list contains all items that appear in exactly one of LIST1, LIST2. 1143The resulting list contains all items appearing in exactly one of LIST1, LIST2.
1144This is a non-destructive function; it makes a copy of the data if necessary 1144This is a non-destructive function; it makes a copy of the data if necessary
1145to avoid corrupting the original LIST1 and LIST2. 1145to avoid corrupting the original LIST1 and LIST2.
1146 1146
@@ -1150,7 +1150,7 @@ Keywords supported: :test :test-not :key
1150 1150
1151(autoload 'nset-exclusive-or "cl-seq" "\ 1151(autoload 'nset-exclusive-or "cl-seq" "\
1152Combine LIST1 and LIST2 using a set-exclusive-or operation. 1152Combine LIST1 and LIST2 using a set-exclusive-or operation.
1153The result list contains all items that appear in exactly one of LIST1, LIST2. 1153The resulting list contains all items appearing in exactly one of LIST1, LIST2.
1154This is a destructive function; it reuses the storage of LIST1 and LIST2 1154This is a destructive function; it reuses the storage of LIST1 and LIST2
1155whenever possible. 1155whenever possible.
1156 1156
diff --git a/lisp/emacs-lisp/cl-seq.el b/lisp/emacs-lisp/cl-seq.el
index fcd21b73de7..1c578556835 100644
--- a/lisp/emacs-lisp/cl-seq.el
+++ b/lisp/emacs-lisp/cl-seq.el
@@ -770,7 +770,7 @@ Return the sublist of LIST whose car matches.
770;;;###autoload 770;;;###autoload
771(defun union (cl-list1 cl-list2 &rest cl-keys) 771(defun union (cl-list1 cl-list2 &rest cl-keys)
772 "Combine LIST1 and LIST2 using a set-union operation. 772 "Combine LIST1 and LIST2 using a set-union operation.
773The result list contains all items that appear in either LIST1 or LIST2. 773The resulting list contains all items that appear in either LIST1 or LIST2.
774This is a non-destructive function; it makes a copy of the data if necessary 774This is a non-destructive function; it makes a copy of the data if necessary
775to avoid corrupting the original LIST1 and LIST2. 775to avoid corrupting the original LIST1 and LIST2.
776\nKeywords supported: :test :test-not :key 776\nKeywords supported: :test :test-not :key
@@ -791,7 +791,7 @@ to avoid corrupting the original LIST1 and LIST2.
791;;;###autoload 791;;;###autoload
792(defun nunion (cl-list1 cl-list2 &rest cl-keys) 792(defun nunion (cl-list1 cl-list2 &rest cl-keys)
793 "Combine LIST1 and LIST2 using a set-union operation. 793 "Combine LIST1 and LIST2 using a set-union operation.
794The result list contains all items that appear in either LIST1 or LIST2. 794The resulting list contains all items that appear in either LIST1 or LIST2.
795This is a destructive function; it reuses the storage of LIST1 and LIST2 795This is a destructive function; it reuses the storage of LIST1 and LIST2
796whenever possible. 796whenever possible.
797\nKeywords supported: :test :test-not :key 797\nKeywords supported: :test :test-not :key
@@ -802,7 +802,7 @@ whenever possible.
802;;;###autoload 802;;;###autoload
803(defun intersection (cl-list1 cl-list2 &rest cl-keys) 803(defun intersection (cl-list1 cl-list2 &rest cl-keys)
804 "Combine LIST1 and LIST2 using a set-intersection operation. 804 "Combine LIST1 and LIST2 using a set-intersection operation.
805The result list contains all items that appear in both LIST1 and LIST2. 805The resulting list contains all items that appear in both LIST1 and LIST2.
806This is a non-destructive function; it makes a copy of the data if necessary 806This is a non-destructive function; it makes a copy of the data if necessary
807to avoid corrupting the original LIST1 and LIST2. 807to avoid corrupting the original LIST1 and LIST2.
808\nKeywords supported: :test :test-not :key 808\nKeywords supported: :test :test-not :key
@@ -825,7 +825,7 @@ to avoid corrupting the original LIST1 and LIST2.
825;;;###autoload 825;;;###autoload
826(defun nintersection (cl-list1 cl-list2 &rest cl-keys) 826(defun nintersection (cl-list1 cl-list2 &rest cl-keys)
827 "Combine LIST1 and LIST2 using a set-intersection operation. 827 "Combine LIST1 and LIST2 using a set-intersection operation.
828The result list contains all items that appear in both LIST1 and LIST2. 828The resulting list contains all items that appear in both LIST1 and LIST2.
829This is a destructive function; it reuses the storage of LIST1 and LIST2 829This is a destructive function; it reuses the storage of LIST1 and LIST2
830whenever possible. 830whenever possible.
831\nKeywords supported: :test :test-not :key 831\nKeywords supported: :test :test-not :key
@@ -835,7 +835,7 @@ whenever possible.
835;;;###autoload 835;;;###autoload
836(defun set-difference (cl-list1 cl-list2 &rest cl-keys) 836(defun set-difference (cl-list1 cl-list2 &rest cl-keys)
837 "Combine LIST1 and LIST2 using a set-difference operation. 837 "Combine LIST1 and LIST2 using a set-difference operation.
838The result list contains all items that appear in LIST1 but not LIST2. 838The resulting list contains all items that appear in LIST1 but not LIST2.
839This is a non-destructive function; it makes a copy of the data if necessary 839This is a non-destructive function; it makes a copy of the data if necessary
840to avoid corrupting the original LIST1 and LIST2. 840to avoid corrupting the original LIST1 and LIST2.
841\nKeywords supported: :test :test-not :key 841\nKeywords supported: :test :test-not :key
@@ -855,7 +855,7 @@ to avoid corrupting the original LIST1 and LIST2.
855;;;###autoload 855;;;###autoload
856(defun nset-difference (cl-list1 cl-list2 &rest cl-keys) 856(defun nset-difference (cl-list1 cl-list2 &rest cl-keys)
857 "Combine LIST1 and LIST2 using a set-difference operation. 857 "Combine LIST1 and LIST2 using a set-difference operation.
858The result list contains all items that appear in LIST1 but not LIST2. 858The resulting list contains all items that appear in LIST1 but not LIST2.
859This is a destructive function; it reuses the storage of LIST1 and LIST2 859This is a destructive function; it reuses the storage of LIST1 and LIST2
860whenever possible. 860whenever possible.
861\nKeywords supported: :test :test-not :key 861\nKeywords supported: :test :test-not :key
@@ -866,7 +866,7 @@ whenever possible.
866;;;###autoload 866;;;###autoload
867(defun set-exclusive-or (cl-list1 cl-list2 &rest cl-keys) 867(defun set-exclusive-or (cl-list1 cl-list2 &rest cl-keys)
868 "Combine LIST1 and LIST2 using a set-exclusive-or operation. 868 "Combine LIST1 and LIST2 using a set-exclusive-or operation.
869The result list contains all items that appear in exactly one of LIST1, LIST2. 869The resulting list contains all items appearing in exactly one of LIST1, LIST2.
870This is a non-destructive function; it makes a copy of the data if necessary 870This is a non-destructive function; it makes a copy of the data if necessary
871to avoid corrupting the original LIST1 and LIST2. 871to avoid corrupting the original LIST1 and LIST2.
872\nKeywords supported: :test :test-not :key 872\nKeywords supported: :test :test-not :key
@@ -879,7 +879,7 @@ to avoid corrupting the original LIST1 and LIST2.
879;;;###autoload 879;;;###autoload
880(defun nset-exclusive-or (cl-list1 cl-list2 &rest cl-keys) 880(defun nset-exclusive-or (cl-list1 cl-list2 &rest cl-keys)
881 "Combine LIST1 and LIST2 using a set-exclusive-or operation. 881 "Combine LIST1 and LIST2 using a set-exclusive-or operation.
882The result list contains all items that appear in exactly one of LIST1, LIST2. 882The resulting list contains all items appearing in exactly one of LIST1, LIST2.
883This is a destructive function; it reuses the storage of LIST1 and LIST2 883This is a destructive function; it reuses the storage of LIST1 and LIST2
884whenever possible. 884whenever possible.
885\nKeywords supported: :test :test-not :key 885\nKeywords supported: :test :test-not :key
diff --git a/lisp/emulation/cua-base.el b/lisp/emulation/cua-base.el
index 3bdd9565fb5..267317594b1 100644
--- a/lisp/emulation/cua-base.el
+++ b/lisp/emulation/cua-base.el
@@ -246,7 +246,7 @@
246;; [C-d] Moves (i.e. deletes and inserts) a single character to the 246;; [C-d] Moves (i.e. deletes and inserts) a single character to the
247;; global mark. 247;; global mark.
248;; [backspace] deletes the character before the global mark, while 248;; [backspace] deletes the character before the global mark, while
249;; [delete] deltes the character after the global mark. 249;; [delete] deletes the character after the global mark.
250 250
251;; [S-C-space] Jumps to and cancels the global mark. 251;; [S-C-space] Jumps to and cancels the global mark.
252;; [C-u S-C-space] Cancels the global mark (stays in current buffer). 252;; [C-u S-C-space] Cancels the global mark (stays in current buffer).
diff --git a/lisp/faces.el b/lisp/faces.el
index 2a0badab370..11c4108644a 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -1577,13 +1577,25 @@ Optional parameter FRAME is the frame whose definition of FACE
1577is used. If nil or omitted, use the selected frame." 1577is used. If nil or omitted, use the selected frame."
1578 (unless frame 1578 (unless frame
1579 (setq frame (selected-frame))) 1579 (setq frame (selected-frame)))
1580 (let ((list face-attribute-name-alist) 1580 (let* ((list face-attribute-name-alist)
1581 (match t)) 1581 (match t)
1582 (bold (and (plist-member attrs :bold)
1583 (not (plist-member attrs :weight))))
1584 (italic (and (plist-member attrs :italic)
1585 (not (plist-member attrs :slant))))
1586 (plist (if (or bold italic)
1587 (copy-sequence attrs)
1588 attrs)))
1589 ;; Handle the Emacs 20 :bold and :italic properties.
1590 (if bold
1591 (plist-put plist :weight (if bold 'bold 'normal)))
1592 (if italic
1593 (plist-put plist :slant (if italic 'italic 'normal)))
1582 (while (and match list) 1594 (while (and match list)
1583 (let* ((attr (caar list)) 1595 (let* ((attr (caar list))
1584 (specified-value 1596 (specified-value
1585 (if (plist-member attrs attr) 1597 (if (plist-member plist attr)
1586 (plist-get attrs attr) 1598 (plist-get plist attr)
1587 'unspecified)) 1599 'unspecified))
1588 (value-now (face-attribute face attr frame))) 1600 (value-now (face-attribute face attr frame)))
1589 (setq match (equal specified-value value-now)) 1601 (setq match (equal specified-value value-now))
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 8781ab3c0ec..747f71f835a 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,43 @@
12011-02-14 Teodor Zlatanov <tzz@lifelogs.com>
2
3 * auth-source.el (auth-source-backend-parse-parameters): Don't rely on
4 `plist-get' to accept non-list parameters (XEmacs issue). Fix
5 docstring.
6
72011-02-14 Lars Ingebrigtsen <larsi@gnus.org>
8
9 * nnimap.el (nnimap-inhibit-logging): New variable.
10 (nnimap-log-command): Don't log login commands.
11
12 * auth-source.el (auth-source-netrc-search): The asserts seem to want
13 to have more parameters.
14
15 * nnimap.el (nnimap-send-command): Mark the command time for each
16 command, so that we don't get NOOPs stepping on our toes.
17
18 * gnus-art.el (article-date-ut): Get the date from the Date header on
19 `t'.
20
212011-02-14 Katsumi Yamaoka <yamaoka@jpl.org>
22
23 * auth-source.el (auth-source-search): Use copy-sequence instead of
24 the cl.el copy-list.
25
262011-02-13 Adam Sjøgren <asjo@koldfront.dk>
27
28 * gnus-delay.el (gnus-delay-article) Fix number of seconds per day.
29 Improve prompt.
30
312011-02-13 Lars Ingebrigtsen <larsi@gnus.org>
32
33 * gnus-art.el (gnus-article-mode-line-format): Remove the article
34 washing status from the default format. It isn't very informative.
35
362011-02-13 Tassilo Horn <tassilo@member.fsf.org> (tiny change)
37
38 * nnimap.el (nnimap-request-accept-article, nnimap-process-quirk): Fix
39 Gcc processing on imap.
40
12011-02-10 Stefan Monnier <monnier@iro.umontreal.ca> 412011-02-10 Stefan Monnier <monnier@iro.umontreal.ca>
2 42
3 * message.el (message-bury): Don't pop up a new window when selected 43 * message.el (message-bury): Don't pop up a new window when selected
@@ -7,6 +47,30 @@
7 47
8 * gnus-sum.el (gnus-summary-save-parts): Use read-directory-name. 48 * gnus-sum.el (gnus-summary-save-parts): Use read-directory-name.
9 49
502011-02-10 Teodor Zlatanov <tzz@lifelogs.com>
51
52 * sieve-manage.el: Autoload `auth-source-search'.
53 (sieve-sasl-auth): Use it.
54
552011-02-09 Teodor Zlatanov <tzz@lifelogs.com>
56
57 * nnimap.el: Autoload `auth-source-forget+'.
58 (nnimap-open-connection-1): Use it if the connection fails.
59
60 * auth-source.el: Require `password-cache'.
61 (auth-source-hide-passwords, auth-source-cache): Remove and mark
62 obsolete.
63 (auth-source-magic): Marker for `password-cache' keys.
64 (auth-source-do-cache): Update docstring.
65 (auth-source-search): Use and check cache.
66 (auth-source-forget-all-cached, auth-source-remember)
67 (auth-source-recall, auth-source-forget, auth-source-forget+)
68 (auth-source-specmatchp): Caching support functions.
69 (auth-source-forget-user-or-password, auth-source-forget-all-cached):
70 Remove and obsolete.
71 (auth-source-user-or-password): Remove caching to further discourage
72 using it. Always hide passwords.
73
102011-02-09 Lars Ingebrigtsen <larsi@gnus.org> 742011-02-09 Lars Ingebrigtsen <larsi@gnus.org>
11 75
12 * nntp.el (nntp-retrieve-group-data-early-disabled): Disable the async 76 * nntp.el (nntp-retrieve-group-data-early-disabled): Disable the async
@@ -17,6 +81,22 @@
17 * message.el (message-options): Make message-options really buffer 81 * message.el (message-options): Make message-options really buffer
18 local. 82 local.
19 83
842011-02-08 Teodor Zlatanov <tzz@lifelogs.com>
85
86 * mail-source.el: Autoload `auth-source-search'.
87 (mail-source-keyword-map): Note order matters.
88 (mail-source-set-1): Get all the mail-source source values and
89 defaults and search auth-source on those if needed. This can all
90 probably be simplified.
91
92 * nnimap.el: Autoload `auth-source-search'.
93 (nnimap-credentials): Use it.
94 (nnimap-open-connection-1): Ask for the virtual server and physical
95 address in one shot.
96
97 * nntp.el: Autoload `auth-source-search'.
98 (nntp-send-authinfo): Use it. Note TODO.
99
202011-02-08 Julien Danjou <julien@danjou.info> 1002011-02-08 Julien Danjou <julien@danjou.info>
21 101
22 * shr.el (shr-tag-body): Add support for text attribute in body 102 * shr.el (shr-tag-body): Add support for text attribute in body
@@ -24,6 +104,13 @@
24 104
25 * message.el (message-options): Make message-options a local variable. 105 * message.el (message-options): Make message-options a local variable.
26 106
1072011-02-07 Teodor Zlatanov <tzz@lifelogs.com>
108
109 * auth-source.el (auth-source-secrets-search)
110 (auth-source-user-or-password): Use `append' instead of `nconc'.
111 (auth-source-user-or-password): Build return list better and protect
112 against nil :secret.
113
272011-02-07 Lars Ingebrigtsen <larsi@gnus.org> 1142011-02-07 Lars Ingebrigtsen <larsi@gnus.org>
28 115
29 * nnimap.el (nnimap-update-info): Refactor slightly. 116 * nnimap.el (nnimap-update-info): Refactor slightly.
@@ -35,6 +122,13 @@
35 (nnimap-update-info): Fix macrology bug-out. 122 (nnimap-update-info): Fix macrology bug-out.
36 (nnimap-update-info): Simplify split history test. 123 (nnimap-update-info): Simplify split history test.
37 124
1252011-02-06 Michael Albinus <michael.albinus@gmx.de>
126
127 * auth-source.el (top): Require 'eieio unconditionally. Autoload
128 `secrets-get-attributes' instead of `secrets-get-attribute'.
129 (auth-source-secrets-search): Limit search when `max' is greater than
130 number of results.
131
382011-02-06 Lars Ingebrigtsen <larsi@gnus.org> 1322011-02-06 Lars Ingebrigtsen <larsi@gnus.org>
39 133
40 * nntp.el (nntp-finish-retrieve-group-infos): Protect against the first 134 * nntp.el (nntp-finish-retrieve-group-infos): Protect against the first
@@ -42,11 +136,58 @@
42 136
43 * proto-stream.el (open-protocol-stream): Document the return value. 137 * proto-stream.el (open-protocol-stream): Document the return value.
44 138
1392011-02-06 Teodor Zlatanov <tzz@lifelogs.com>
140
141 * auth-source.el (auth-source-secrets-search): Add examples.
142
452011-02-06 Julien Danjou <julien@danjou.info> 1432011-02-06 Julien Danjou <julien@danjou.info>
46 144
47 * message.el (message-setup-1): Handle message-generate-headers-first 145 * message.el (message-setup-1): Handle message-generate-headers-first
48 set to t. 146 set to t.
49 147
1482011-02-06 Teodor Zlatanov <tzz@lifelogs.com>
149
150 * auth-source.el (auth-sources): Allow for simpler defaults for Secrets
151 API with a string "secrets:collection-name" and with 'default.
152 (auth-source-backend-parse): Parse "secrets:collection-name" and
153 'default. Recurse on parses instead of repeating code. Use the
154 Secrets API is the source is not nil and 'ignore otherwise. Emit a
155 message when ignoring a source.
156 (auth-source-search): List ignored search keys at the top level.
157 (auth-source-netrc-create): Use `case' instead of `cond'.
158 (auth-source-secrets-search): Created with TODOs.
159 (auth-source-secrets-create): Created with TODOs.
160 (auth-source-retrieve, auth-source-create, auth-source-delete)
161 (auth-source-protocol-defaults, auth-source-user-or-password-imap)
162 (auth-source-user-or-password-pop3, auth-source-user-or-password-ssh)
163 (auth-source-user-or-password-sftp)
164 (auth-source-user-or-password-smtp): Removed.
165 (auth-source-user-or-password): Deprecated and modified to be a wrapper
166 around `auth-source-search'. Not tested thoroughly.
167
1682011-02-04 Teodor Zlatanov <tzz@lifelogs.com>
169
170 * auth-source.el: Bring in assoc and eioeio libraries.
171 (secrets-enabled): New variable to track the status of the Secrets API.
172 (auth-source-backend): New EIOEIO class to represent a backend.
173 (auth-source-creation-defaults): New variable to set prompt defaults
174 during token creation (see the `auth-source-search' docstring for
175 details).
176 (auth-sources): Simplify to allow a simple string as a netrc backend
177 spec.
178 (auth-source-backend-parse): Parse a backend from an `auth-sources' spec.
179 (auth-source-backend-parse-parameters): Fill in the backend parameters.
180 (auth-source-search): Main auth-source API entry point.
181 (auth-source-delete): Wrapper around `auth-source-search' for deletion.
182 (auth-source-search-collection): Helper function for searching.
183 (auth-source-netrc-parse, auth-source-netrc-normalize)
184 (auth-source-netrc-search, auth-source-netrc-create): Netrc backend.
185 Supports search, create, and delete.
186 (auth-source-secrets-search, auth-source-secrets-create): Secrets API
187 backend stubs.
188 (auth-source-user-or-password): Call `auth-source-search' but it's not
189 ready yet.
190
502011-02-04 Lars Ingebrigtsen <larsi@gnus.org> 1912011-02-04 Lars Ingebrigtsen <larsi@gnus.org>
51 192
52 * message.el (message-setup-1): Remove the read-only stuff, since it 193 * message.el (message-setup-1): Remove the read-only stuff, since it
diff --git a/lisp/gnus/ChangeLog.2 b/lisp/gnus/ChangeLog.2
index 381ae544b24..4882032f284 100644
--- a/lisp/gnus/ChangeLog.2
+++ b/lisp/gnus/ChangeLog.2
@@ -6088,7 +6088,7 @@
6088 (nntp-retrieve-groups): Ditto for groups. 6088 (nntp-retrieve-groups): Ditto for groups.
6089 (nntp-retrieve-articles): Ditto for articles. 6089 (nntp-retrieve-articles): Ditto for articles.
6090 (*): Replaced nntp-possibly-change-group calls to 6090 (*): Replaced nntp-possibly-change-group calls to
6091 nntp-with-open-group forms in all, but one, occurrance. 6091 nntp-with-open-group forms in all, but one, occurrence.
6092 (nntp-accept-process-output): Bug fix. Detect when called with 6092 (nntp-accept-process-output): Bug fix. Detect when called with
6093 null process. 6093 null process.
6094 6094
diff --git a/lisp/gnus/auth-source.el b/lisp/gnus/auth-source.el
index e94cfb137b0..be698ad35d0 100644
--- a/lisp/gnus/auth-source.el
+++ b/lisp/gnus/auth-source.el
@@ -39,23 +39,64 @@
39 39
40;;; Code: 40;;; Code:
41 41
42(require 'password-cache)
42(require 'gnus-util) 43(require 'gnus-util)
43(require 'netrc) 44(require 'netrc)
44 45(require 'assoc)
45(eval-when-compile (require 'cl)) 46(eval-when-compile (require 'cl))
47(require 'eieio)
48
46(autoload 'secrets-create-item "secrets") 49(autoload 'secrets-create-item "secrets")
47(autoload 'secrets-delete-item "secrets") 50(autoload 'secrets-delete-item "secrets")
48(autoload 'secrets-get-alias "secrets") 51(autoload 'secrets-get-alias "secrets")
49(autoload 'secrets-get-attribute "secrets") 52(autoload 'secrets-get-attributes "secrets")
50(autoload 'secrets-get-secret "secrets") 53(autoload 'secrets-get-secret "secrets")
51(autoload 'secrets-list-collections "secrets") 54(autoload 'secrets-list-collections "secrets")
52(autoload 'secrets-search-items "secrets") 55(autoload 'secrets-search-items "secrets")
53 56
57(defvar secrets-enabled)
58
54(defgroup auth-source nil 59(defgroup auth-source nil
55 "Authentication sources." 60 "Authentication sources."
56 :version "23.1" ;; No Gnus 61 :version "23.1" ;; No Gnus
57 :group 'gnus) 62 :group 'gnus)
58 63
64(defclass auth-source-backend ()
65 ((type :initarg :type
66 :initform 'netrc
67 :type symbol
68 :custom symbol
69 :documentation "The backend type.")
70 (source :initarg :source
71 :type string
72 :custom string
73 :documentation "The backend source.")
74 (host :initarg :host
75 :initform t
76 :type t
77 :custom string
78 :documentation "The backend host.")
79 (user :initarg :user
80 :initform t
81 :type t
82 :custom string
83 :documentation "The backend user.")
84 (protocol :initarg :protocol
85 :initform t
86 :type t
87 :custom string
88 :documentation "The backend protocol.")
89 (create-function :initarg :create-function
90 :initform ignore
91 :type function
92 :custom function
93 :documentation "The create function.")
94 (search-function :initarg :search-function
95 :initform ignore
96 :type function
97 :custom function
98 :documentation "The search function.")))
99
59(defcustom auth-source-protocols '((imap "imap" "imaps" "143" "993") 100(defcustom auth-source-protocols '((imap "imap" "imaps" "143" "993")
60 (pop3 "pop3" "pop" "pop3s" "110" "995") 101 (pop3 "pop3" "pop" "pop3s" "110" "995")
61 (ssh "ssh" "22") 102 (ssh "ssh" "22")
@@ -81,11 +122,15 @@
81 p))) 122 p)))
82 auth-source-protocols)) 123 auth-source-protocols))
83 124
84(defvar auth-source-cache (make-hash-table :test 'equal) 125(defvar auth-source-creation-defaults nil
85 "Cache for auth-source data") 126 "Defaults for creating token values. Usually let-bound.")
127
128(make-obsolete 'auth-source-hide-passwords nil "Emacs 24.1")
129
130(defvar auth-source-magic "auth-source-magic ")
86 131
87(defcustom auth-source-do-cache t 132(defcustom auth-source-do-cache t
88 "Whether auth-source should cache information." 133 "Whether auth-source should cache information with `password-cache'."
89 :group 'auth-source 134 :group 'auth-source
90 :version "23.2" ;; No Gnus 135 :version "23.2" ;; No Gnus
91 :type `boolean) 136 :type `boolean)
@@ -108,65 +153,71 @@ If the value is a function, debug messages are logged by calling
108 (function :tag "Function that takes arguments like `message'") 153 (function :tag "Function that takes arguments like `message'")
109 (const :tag "Don't log anything" nil))) 154 (const :tag "Don't log anything" nil)))
110 155
111(defcustom auth-source-hide-passwords t 156(defcustom auth-sources '("~/.authinfo.gpg" "~/.authinfo")
112 "Whether auth-source should hide passwords in log messages.
113Only relevant if `auth-source-debug' is not nil."
114 :group 'auth-source
115 :version "23.2" ;; No Gnus
116 :type `boolean)
117
118(defcustom auth-sources '((:source "~/.authinfo.gpg")
119 (:source "~/.authinfo"))
120 "List of authentication sources. 157 "List of authentication sources.
121 158
122The default will get login and password information from a .gpg 159The default will get login and password information from
123file, which you should set up with the EPA/EPG packages to be 160\"~/.authinfo.gpg\", which you should set up with the EPA/EPG
124encrypted. See the auth.info manual for details. 161packages to be encrypted. If that file doesn't exist, it will
162try the unencrypted version \"~/.authinfo\".
163
164See the auth.info manual for details.
125 165
126Each entry is the authentication type with optional properties. 166Each entry is the authentication type with optional properties.
127 167
128It's best to customize this with `M-x customize-variable' because the choices 168It's best to customize this with `M-x customize-variable' because the choices
129can get pretty complex." 169can get pretty complex."
130 :group 'auth-source 170 :group 'auth-source
131 :version "23.2" ;; No Gnus 171 :version "24.1" ;; No Gnus
132 :type `(repeat :tag "Authentication Sources" 172 :type `(repeat :tag "Authentication Sources"
133 (list :tag "Source definition" 173 (choice
134 (const :format "" :value :source) 174 (string :tag "Just a file")
135 (choice :tag "Authentication backend choice" 175 (const :tag "Default Secrets API Collection" 'default)
136 (string :tag "Authentication Source (file)") 176 (const :tag "Login Secrets API Collection" "secrets:login")
137 (list :tag "secrets.el (Secret Service API/KWallet/GNOME Keyring)" 177 (const :tag "Temp Secrets API Collection" "secrets:session")
138 (const :format "" :value :secrets) 178 (list :tag "Source definition"
139 (choice :tag "Collection to use" 179 (const :format "" :value :source)
140 (string :tag "Collection name") 180 (choice :tag "Authentication backend choice"
141 (const :tag "Default" 'default) 181 (string :tag "Authentication Source (file)")
142 (const :tag "Login" "login") 182 (list
143 (const :tag "Temporary" "session")))) 183 :tag "Secret Service API/KWallet/GNOME Keyring"
144 (repeat :tag "Extra Parameters" :inline t 184 (const :format "" :value :secrets)
145 (choice :tag "Extra parameter" 185 (choice :tag "Collection to use"
146 (list :tag "Host (omit to match as a fallback)" 186 (string :tag "Collection name")
147 (const :format "" :value :host) 187 (const :tag "Default" 'default)
148 (choice :tag "Host (machine) choice" 188 (const :tag "Login" "login")
149 (const :tag "Any" t) 189 (const
150 (regexp :tag "Host (machine) regular expression"))) 190 :tag "Temporary" "session"))))
151 (list :tag "Protocol (omit to match as a fallback)" 191 (repeat :tag "Extra Parameters" :inline t
152 (const :format "" :value :protocol) 192 (choice :tag "Extra parameter"
153 (choice :tag "Protocol" 193 (list
154 (const :tag "Any" t) 194 :tag "Host"
155 ,@auth-source-protocols-customize)) 195 (const :format "" :value :host)
156 (list :tag "User (omit to match as a fallback)" :inline t 196 (choice :tag "Host (machine) choice"
157 (const :format "" :value :user) 197 (const :tag "Any" t)
158 (choice :tag "Personality or username" 198 (regexp
159 (const :tag "Any" t) 199 :tag "Regular expression")))
160 (string :tag "Specific user name")))))))) 200 (list
201 :tag "Protocol"
202 (const :format "" :value :protocol)
203 (choice
204 :tag "Protocol"
205 (const :tag "Any" t)
206 ,@auth-source-protocols-customize))
207 (list :tag "User" :inline t
208 (const :format "" :value :user)
209 (choice :tag "Personality/Username"
210 (const :tag "Any" t)
211 (string :tag "Name")))))))))
161 212
162(defcustom auth-source-gpg-encrypt-to t 213(defcustom auth-source-gpg-encrypt-to t
163 "List of recipient keys that `authinfo.gpg' encrypted to. 214 "List of recipient keys that `authinfo.gpg' encrypted to.
164If the value is not a list, symmetric encryption will be used." 215If the value is not a list, symmetric encryption will be used."
165 :group 'auth-source 216 :group 'auth-source
166 :version "23.2" ;; No Gnus 217 :version "24.1" ;; No Gnus
167 :type '(choice (const :tag "Symmetric encryption" t) 218 :type '(choice (const :tag "Symmetric encryption" t)
168 (repeat :tag "Recipient public keys" 219 (repeat :tag "Recipient public keys"
169 (string :tag "Recipient public key")))) 220 (string :tag "Recipient public key"))))
170 221
171;; temp for debugging 222;; temp for debugging
172;; (unintern 'auth-source-protocols) 223;; (unintern 'auth-source-protocols)
@@ -211,229 +262,801 @@ If the value is not a list, symmetric encryption will be used."
211 262
212;; (setq auth-sources '((:source "~/.authinfo.gpg" :host t :protocol t))) 263;; (setq auth-sources '((:source "~/.authinfo.gpg" :host t :protocol t)))
213 264
214(defun auth-get-source (entry) 265;; (auth-source-backend-parse "myfile.gpg")
215 "Return the source string of ENTRY, which is one entry in `auth-sources'. 266;; (auth-source-backend-parse 'default)
216If it is a Secret Service API, return the collection name, otherwise 267;; (auth-source-backend-parse "secrets:login")
217the file name." 268
218 (let ((source (plist-get entry :source))) 269(defun auth-source-backend-parse (entry)
219 (if (stringp source) 270 "Creates an auth-source-backend from an ENTRY in `auth-sources'."
220 source 271 (auth-source-backend-parse-parameters
221 ;; Secret Service API. 272 entry
222 (setq source (plist-get source :secrets)) 273 (cond
223 (when (eq source 'default) 274 ;; take 'default and recurse to get it as a Secrets API default collection
224 (setq source (or (secrets-get-alias "default") "login"))) 275 ;; matching any user, host, and protocol
225 (or source "session")))) 276 ((eq entry 'default)
226 277 (auth-source-backend-parse '(:source (:secrets default))))
227(defun auth-source-pick (&rest spec) 278 ;; take secrets:XYZ and recurse to get it as Secrets API collection "XYZ"
228 "Parse `auth-sources' for matches of the SPEC plist. 279 ;; matching any user, host, and protocol
229 280 ((and (stringp entry) (string-match "^secrets:\\(.+\\)" entry))
230Common keys are :host, :protocol, and :user. A value of t in 281 (auth-source-backend-parse `(:source (:secrets ,(match-string 1 entry)))))
231SPEC means to always succeed in the match. A string value is 282 ;; take just a file name and recurse to get it as a netrc file
232matched as a regex." 283 ;; matching any user, host, and protocol
233 (let ((keys (loop for i below (length spec) by 2 collect (nth i spec))) 284 ((stringp entry)
234 choices) 285 (auth-source-backend-parse `(:source ,entry)))
235 (dolist (choice (copy-tree auth-sources) choices) 286
236 (let ((source (plist-get choice :source)) 287 ;; a file name with parameters
237 (match t)) 288 ((stringp (plist-get entry :source))
238 (when 289 (auth-source-backend
239 (and 290 (plist-get entry :source)
240 ;; Check existence of source. 291 :source (plist-get entry :source)
241 (if (consp source) 292 :type 'netrc
242 ;; Secret Service API. 293 :search-function 'auth-source-netrc-search
243 (member (auth-get-source choice) (secrets-list-collections)) 294 :create-function 'auth-source-netrc-create))
244 ;; authinfo file. 295
245 (file-exists-p source)) 296 ;; the Secrets API. We require the package, in order to have a
246 297 ;; defined value for `secrets-enabled'.
247 ;; Check keywords. 298 ((and
248 (dolist (k keys match) 299 (not (null (plist-get entry :source))) ; the source must not be nil
249 (let* ((v (plist-get spec k)) 300 (listp (plist-get entry :source)) ; and it must be a list
250 (choicev (if (plist-member choice k) 301 (require 'secrets nil t) ; and we must load the Secrets API
251 (plist-get choice k) t))) 302 secrets-enabled) ; and that API must be enabled
252 (setq match 303
253 (and match 304 ;; the source is either the :secrets key in ENTRY or
254 (or 305 ;; if that's missing or nil, it's "session"
255 ;; source always matches spec key 306 (let ((source (or (plist-get (plist-get entry :source) :secrets)
256 (eq t choicev) 307 "session")))
257 ;; source key gives regex to match against spec 308
258 (and (stringp choicev) (string-match choicev v)) 309 ;; if the source is a symbol, we look for the alias named so,
259 ;; source key gives symbol to match against spec 310 ;; and if that alias is missing, we use "login"
260 (and (symbolp choicev) (eq choicev v)))))))) 311 (when (symbolp source)
261 312 (setq source (or (secrets-get-alias (symbol-name source))
262 (add-to-list 'choices choice 'append)))))) 313 "login")))
263 314
264(defun auth-source-retrieve (mode entry &rest spec) 315 (auth-source-backend
265 "Retrieve MODE credentials according to SPEC from ENTRY." 316 (format "Secrets API (%s)" source)
266 (catch 'no-password 317 :source source
267 (let ((host (plist-get spec :host)) 318 :type 'secrets
268 (user (plist-get spec :user)) 319 :search-function 'auth-source-secrets-search
269 (prot (plist-get spec :protocol)) 320 :create-function 'auth-source-secrets-create)))
270 (source (plist-get entry :source)) 321
271 result) 322 ;; none of them
272 (cond 323 (t
273 ;; Secret Service API. 324 (auth-source-do-debug
274 ((consp source) 325 "auth-source-backend-parse: invalid backend spec: %S" entry)
275 (let ((coll (auth-get-source entry)) 326 (auth-source-backend
276 item) 327 "Empty"
277 ;; Loop over candidates with a matching host attribute. 328 :source ""
278 (dolist (elt (secrets-search-items coll :host host) item) 329 :type 'ignore)))))
279 (when (and (or (not user) 330
280 (string-equal 331(defun auth-source-backend-parse-parameters (entry backend)
281 user (secrets-get-attribute coll elt :user))) 332 "Fills in the extra auth-source-backend parameters of ENTRY.
282 (or (not prot) 333Using the plist ENTRY, get the :host, :protocol, and :user search
283 (string-equal 334parameters. Accepts :port as an alias to :protocol."
284 prot (secrets-get-attribute coll elt :protocol)))) 335 (let ((entry (if (stringp entry)
285 (setq item elt) 336 nil
286 (return elt))) 337 entry))
287 ;; Compose result. 338 val)
288 (when item 339 (when (setq val (plist-get entry :host))
289 (setq result 340 (oset backend host val))
290 (mapcar (lambda (m) 341 (when (setq val (plist-get entry :user))
291 (if (string-equal "password" m) 342 (oset backend user val))
292 (or (secrets-get-secret coll item) 343 ;; accept :port as an alias for :protocol
293 ;; When we do not find a password, 344 (when (setq val (or (plist-get entry :protocol) (plist-get entry :port)))
294 ;; we return nil anyway. 345 (oset backend protocol val)))
295 (throw 'no-password nil)) 346 backend)
296 (or (secrets-get-attribute coll item :user) 347
297 user))) 348;; (mapcar 'auth-source-backend-parse auth-sources)
298 (if (consp mode) mode (list mode))))) 349
299 (if (consp mode) result (car result)))) 350(defun* auth-source-search (&rest spec
300 ;; Anything else is netrc. 351 &key type max host user protocol secret
301 (t 352 create delete
302 (let ((search (list source (list host) (list (format "%s" prot)) 353 &allow-other-keys)
303 (auth-source-protocol-defaults prot)))) 354 "Search or modify authentication backends according to SPEC.
304 (setq result 355
305 (mapcar (lambda (m) 356This function parses `auth-sources' for matches of the SPEC
306 (if (string-equal "password" m) 357plist. It can optionally create or update an authentication
307 (or (apply 358token if requested. A token is just a standard Emacs property
308 'netrc-machine-user-or-password m search) 359list with a :secret property that can be a function; all the
309 ;; When we do not find a password, we 360other properties will always hold scalar values.
310 ;; return nil anyway. 361
311 (throw 'no-password nil)) 362Typically the :secret property, if present, contains a password.
312 (or (apply 363
313 'netrc-machine-user-or-password m search) 364Common search keys are :max, :host, :protocol, and :user. In
314 user))) 365addition, :create specifies how tokens will be or created.
315 (if (consp mode) mode (list mode))))) 366Finally, :type can specify which backend types you want to check.
316 (if (consp mode) result (car result))))))) 367
317 368A string value is always matched literally. A symbol is matched
318(defun auth-source-create (mode entry &rest spec) 369as its string value, literally. All the SPEC values can be
319 "Create interactively credentials according to SPEC in ENTRY. 370single values (symbol or string) or lists thereof (in which case
320Return structure as specified by MODE." 371any of the search terms matches).
321 (let* ((host (plist-get spec :host)) 372
322 (user (plist-get spec :user)) 373:create t means to create a token if possible.
323 (prot (plist-get spec :protocol)) 374
324 (source (plist-get entry :source)) 375A new token will be created if no matching tokens were found.
325 (name (concat (if user (format "%s@" user)) 376The new token will have only the keys the backend requires. For
326 host 377the netrc backend, for instance, that's the user, host, and
327 (if prot (format ":%s" prot)))) 378protocol keys.
328 result) 379
329 (setq result 380Here's an example:
330 (mapcar 381
331 (lambda (m) 382\(let ((auth-source-creation-defaults '((user . \"defaultUser\")
332 (cons 383 (A . \"default A\"))))
333 m 384 (auth-source-search :host \"mine\" :type 'netrc :max 1
334 (cond 385 :P \"pppp\" :Q \"qqqq\"
335 ((equal "password" m) 386 :create t))
336 (let ((passwd (read-passwd 387
337 (format "Password for %s on %s: " prot host)))) 388which says:
338 (cond 389
339 ;; Secret Service API. 390\"Search for any entry matching host 'mine' in backends of type
340 ((consp source) 391 'netrc', maximum one result.
341 (apply 392
342 'secrets-create-item 393 Create a new entry if you found none. The netrc backend will
343 (auth-get-source entry) name passwd spec)) 394 automatically require host, user, and protocol. The host will be
344 (t)) ;; netrc not implemented yes. 395 'mine'. We prompt for the user with default 'defaultUser' and
345 passwd)) 396 for the protocol without a default. We will not prompt for A, Q,
346 ((equal "login" m) 397 or P. The resulting token will only have keys user, host, and
347 (or user 398 protocol.\"
348 (read-string 399
349 (format "User name for %s on %s (default %s): " prot host 400:create '(A B C) also means to create a token if possible.
350 (user-login-name)) 401
351 nil nil (user-login-name)))) 402The behavior is like :create t but if the list contains any
352 (t 403parameter, that parameter will be required in the resulting
353 "unknownuser")))) 404token. The value for that parameter will be obtained from the
354 (if (consp mode) mode (list mode)))) 405search parameters or from user input. If any queries are needed,
355 ;; Allow the source to save the data. 406the alist `auth-source-creation-defaults' will be checked for the
356 (cond 407default prompt.
357 ((consp source) 408
358 ;; Secret Service API -- not implemented. 409Here's an example:
359 ) 410
360 (t 411\(let ((auth-source-creation-defaults '((user . \"defaultUser\")
361 ;; netrc interface. 412 (A . \"default A\"))))
362 (when (y-or-n-p (format "Do you want to save this password in %s? " 413 (auth-source-search :host '(\"nonesuch\" \"twosuch\") :type 'netrc :max 1
363 source)) 414 :P \"pppp\" :Q \"qqqq\"
364 ;; the code below is almost same as `netrc-store-data' except 415 :create '(A B Q)))
365 ;; the `epa-file-encrypt-to' hack (see bug#7487). 416
366 (with-temp-buffer 417which says:
367 (when (file-exists-p source) 418
368 (insert-file-contents source)) 419\"Search for any entry matching host 'nonesuch'
369 (when auth-source-gpg-encrypt-to 420 or 'twosuch' in backends of type 'netrc', maximum one result.
370 ;; making `epa-file-encrypt-to' local to this buffer lets 421
371 ;; epa-file skip the key selection query (see the 422 Create a new entry if you found none. The netrc backend will
372 ;; `local-variable-p' check in `epa-file-write-region'). 423 automatically require host, user, and protocol. The host will be
373 (unless (local-variable-p 'epa-file-encrypt-to (current-buffer)) 424 'nonesuch' and Q will be 'qqqq'. We prompt for A with default
374 (make-local-variable 'epa-file-encrypt-to)) 425 'default A', for B and protocol with default nil, and for the
375 (if (listp auth-source-gpg-encrypt-to) 426 user with default 'defaultUser'. We will not prompt for Q. The
376 (setq epa-file-encrypt-to auth-source-gpg-encrypt-to))) 427 resulting token will have keys user, host, protocol, A, B, and Q.
377 (goto-char (point-max)) 428 It will not have P with any value, even though P is used in the
378 (unless (bolp) 429 search to find only entries that have P set to 'pppp'.\"
379 (insert "\n")) 430
380 (insert (format "machine %s login %s password %s port %s\n" 431When multiple values are specified in the search parameter, the
381 host 432first one is used for creation. So :host (X Y Z) would create a
382 (or user (cdr (assoc "login" result))) 433token for host X, for instance.
383 (cdr (assoc "password" result)) 434
384 prot)) 435This creation can fail if the search was not specific enough to
385 (write-region (point-min) (point-max) source nil 'silent))))) 436create a new token (it's up to the backend to decide that). You
386 (if (consp mode) 437should `catch' the backend-specific error as usual. Some
387 (mapcar #'cdr result) 438backends (netrc, at least) will prompt the user rather than throw
388 (cdar result)))) 439an error.
389 440
390(defun auth-source-delete (entry &rest spec) 441:delete t means to delete any found entries. nil by default.
391 "Delete credentials according to SPEC in ENTRY." 442Use `auth-source-delete' in ELisp code instead of calling
392 (let ((host (plist-get spec :host)) 443`auth-source-search' directly with this parameter.
393 (user (plist-get spec :user)) 444
394 (prot (plist-get spec :protocol)) 445:type (X Y Z) will check only those backend types. 'netrc and
395 (source (plist-get entry :source))) 446'secrets are the only ones supported right now.
396 (cond 447
397 ;; Secret Service API. 448:max N means to try to return at most N items (defaults to 1).
398 ((consp source) 449When 0 the function will return just t or nil to indicate if any
399 (let ((coll (auth-get-source entry))) 450matches were found. More than N items may be returned, depending
400 ;; Loop over candidates with a matching host attribute. 451on the search and the backend.
401 (dolist (elt (secrets-search-items coll :host host)) 452
402 (when (and (or (not user) 453:host (X Y Z) means to match only hosts X, Y, or Z according to
403 (string-equal 454the match rules above. Defaults to t.
404 user (secrets-get-attribute coll elt :user))) 455
405 (or (not prot) 456:user (X Y Z) means to match only users X, Y, or Z according to
406 (string-equal 457the match rules above. Defaults to t.
407 prot (secrets-get-attribute coll elt :protocol)))) 458
408 (secrets-delete-item coll elt))))) 459:protocol (P Q R) means to match only protocols P, Q, or R.
409 (t)))) ;; netrc not implemented yes. 460Defaults to t.
410 461
411(defun auth-source-forget-user-or-password 462:K (V1 V2 V3) for any other key K will match values V1, V2, or
412 (mode host protocol &optional username) 463V3 (note the match rules above).
413 "Remove cached authentication token." 464
414 (interactive "slogin/password: \nsHost: \nsProtocol: \n") ;for testing 465The return value is a list with at most :max tokens. Each token
415 (remhash 466is a plist with keys :backend :host :protocol :user, plus any other
416 (if username 467keys provided by the backend (notably :secret). But note the
417 (format "%s %s:%s %s" mode host protocol username) 468exception for :max 0, which see above.
418 (format "%s %s:%s" mode host protocol)) 469
419 auth-source-cache)) 470The token's :secret key can hold a function. In that case you
471must call it to obtain the actual value."
472 (let* ((backends (mapcar 'auth-source-backend-parse auth-sources))
473 (max (or max 1))
474 (ignored-keys '(:create :delete :max))
475 (keys (loop for i below (length spec) by 2
476 unless (memq (nth i spec) ignored-keys)
477 collect (nth i spec)))
478 (found (auth-source-recall spec))
479 filtered-backends accessor-key found-here goal)
480
481 (if (and found auth-source-do-cache)
482 (auth-source-do-debug
483 "auth-source-search: found %d CACHED results matching %S"
484 (length found) spec)
485
486 (assert
487 (or (eq t create) (listp create)) t
488 "Invalid auth-source :create parameter (must be nil, t, or a list): %s %s")
489
490 (setq filtered-backends (copy-sequence backends))
491 (dolist (backend backends)
492 (dolist (key keys)
493 ;; ignore invalid slots
494 (condition-case signal
495 (unless (eval `(auth-source-search-collection
496 (plist-get spec key)
497 (oref backend ,key)))
498 (setq filtered-backends (delq backend filtered-backends))
499 (return))
500 (invalid-slot-name))))
501
502 (auth-source-do-debug
503 "auth-source-search: found %d backends matching %S"
504 (length filtered-backends) spec)
505
506 ;; (debug spec "filtered" filtered-backends)
507 (setq goal max)
508 (dolist (backend filtered-backends)
509 (setq found-here (apply
510 (slot-value backend 'search-function)
511 :backend backend
512 :create create
513 :delete delete
514 spec))
515
516 ;; if max is 0, as soon as we find something, return it
517 (when (and (zerop max) (> 0 (length found-here)))
518 (return t))
519
520 ;; decrement the goal by the number of new results
521 (decf goal (length found-here))
522 ;; and append the new results to the full list
523 (setq found (append found found-here))
524
525 (auth-source-do-debug
526 "auth-source-search: found %d results (max %d/%d) in %S matching %S"
527 (length found-here) max goal backend spec)
528
529 ;; return full list if the goal is 0 or negative
530 (when (zerop (max 0 goal))
531 (return found))
532
533 ;; change the :max parameter in the spec to the goal
534 (setq spec (plist-put spec :max goal)))
535
536 (when (and found auth-source-do-cache)
537 (auth-source-remember spec found)))
538
539 found))
540
541;;; (auth-source-search :max 1)
542;;; (funcall (plist-get (nth 0 (auth-source-search :max 1)) :secret))
543;;; (auth-source-search :host "nonesuch" :type 'netrc :K 1)
544;;; (auth-source-search :host "nonesuch" :type 'secrets)
545
546(defun* auth-source-delete (&rest spec
547 &key delete
548 &allow-other-keys)
549 "Delete entries from the authentication backends according to SPEC.
550Calls `auth-source-search' with the :delete property in SPEC set to t.
551The backend may not actually delete the entries.
552
553Returns the deleted entries."
554 (auth-source-search (plist-put spec :delete t)))
555
556(defun auth-source-search-collection (collection value)
557 "Returns t is VALUE is t or COLLECTION is t or contains VALUE."
558 (when (and (atom collection) (not (eq t collection)))
559 (setq collection (list collection)))
560
561 ;; (debug :collection collection :value value)
562 (or (eq collection t)
563 (eq value t)
564 (equal collection value)
565 (member value collection)))
420 566
421(defun auth-source-forget-all-cached () 567(defun auth-source-forget-all-cached ()
422 "Forget all cached auth-source authentication tokens." 568 "Forget all cached auth-source data."
423 (interactive) 569 (interactive)
424 (setq auth-source-cache (make-hash-table :test 'equal))) 570 (loop for sym being the symbols of password-data
571 ;; when the symbol name starts with auth-source-magic
572 when (string-match (concat "^" auth-source-magic)
573 (symbol-name sym))
574 ;; remove that key
575 do (password-cache-remove (symbol-name sym))))
576
577(defun auth-source-remember (spec found)
578 "Remember FOUND search results for SPEC."
579 (password-cache-add
580 (concat auth-source-magic (format "%S" spec)) found))
581
582(defun auth-source-recall (spec)
583 "Recall FOUND search results for SPEC."
584 (password-read-from-cache
585 (concat auth-source-magic (format "%S" spec))))
586
587(defun auth-source-forget (spec)
588 "Forget any cached data matching SPEC exactly.
589
590This is the same SPEC you passed to `auth-source-search'.
591Returns t or nil for forgotten or not found."
592 (password-cache-remove (concat auth-source-magic (format "%S" spec))))
593
594;;; (loop for sym being the symbols of password-data when (string-match (concat "^" auth-source-magic) (symbol-name sym)) collect (symbol-name sym))
595
596;;; (auth-source-remember '(:host "wedd") '(4 5 6))
597;;; (auth-source-remember '(:host "xedd") '(1 2 3))
598;;; (auth-source-recall '(:host "xedd"))
599;;; (auth-source-recall '(:host t))
600;;; (auth-source-forget+ :host t)
601
602(defun* auth-source-forget+ (&rest spec &allow-other-keys)
603 "Forget any cached data matching SPEC. Returns forgotten count.
604
605This is not a full `auth-source-search' spec but works similarly.
606For instance, \(:host \"myhost\" \"yourhost\") would find all the
607cached data that was found with a search for those two hosts,
608while \(:host t) would find all host entries."
609 (let ((count 0)
610 sname)
611 (loop for sym being the symbols of password-data
612 ;; when the symbol name matches with auth-source-magic
613 when (and (setq sname (symbol-name sym))
614 (string-match (concat "^" auth-source-magic "\\(.+\\)")
615 sname)
616 ;; and the spec matches what was stored in the cache
617 (auth-source-specmatchp spec (read (match-string 1 sname))))
618 ;; remove that key
619 do (progn
620 (password-cache-remove sname)
621 (incf count)))
622 count))
623
624(defun auth-source-specmatchp (spec stored)
625 (let ((keys (loop for i below (length spec) by 2
626 collect (nth i spec))))
627 (not (eq
628 (dolist (key keys)
629 (unless (auth-source-search-collection (plist-get stored key)
630 (plist-get spec key))
631 (return 'no)))
632 'no))))
633
634;;; Backend specific parsing: netrc/authinfo backend
635
636;;; (auth-source-netrc-parse "~/.authinfo.gpg")
637(defun* auth-source-netrc-parse (&rest
638 spec
639 &key file max host user protocol delete
640 &allow-other-keys)
641 "Parse FILE and return a list of all entries in the file.
642Note that the MAX parameter is used so we can exit the parse early."
643 (if (listp file)
644 ;; We got already parsed contents; just return it.
645 file
646 (when (file-exists-p file)
647 (with-temp-buffer
648 (let ((tokens '("machine" "host" "default" "login" "user"
649 "password" "account" "macdef" "force"
650 "port" "protocol"))
651 (max (or max 5000)) ; sanity check: default to stop at 5K
652 (modified 0)
653 alist elem result pair)
654 (insert-file-contents file)
655 (goto-char (point-min))
656 ;; Go through the file, line by line.
657 (while (and (not (eobp))
658 (> max 0))
659
660 (narrow-to-region (point) (point-at-eol))
661 ;; For each line, get the tokens and values.
662 (while (not (eobp))
663 (skip-chars-forward "\t ")
664 ;; Skip lines that begin with a "#".
665 (if (eq (char-after) ?#)
666 (goto-char (point-max))
667 (unless (eobp)
668 (setq elem
669 (if (= (following-char) ?\")
670 (read (current-buffer))
671 (buffer-substring
672 (point) (progn (skip-chars-forward "^\t ")
673 (point)))))
674 (cond
675 ((equal elem "macdef")
676 ;; We skip past the macro definition.
677 (widen)
678 (while (and (zerop (forward-line 1))
679 (looking-at "$")))
680 (narrow-to-region (point) (point)))
681 ((member elem tokens)
682 ;; Tokens that don't have a following value are ignored,
683 ;; except "default".
684 (when (and pair (or (cdr pair)
685 (equal (car pair) "default")))
686 (push pair alist))
687 (setq pair (list elem)))
688 (t
689 ;; Values that haven't got a preceding token are ignored.
690 (when pair
691 (setcdr pair elem)
692 (push pair alist)
693 (setq pair nil)))))))
694
695 (when (and alist
696 (> max 0)
697 (auth-source-search-collection
698 host
699 (or
700 (aget alist "machine")
701 (aget alist "host")))
702 (auth-source-search-collection
703 user
704 (or
705 (aget alist "login")
706 (aget alist "account")
707 (aget alist "user")))
708 (auth-source-search-collection
709 protocol
710 (or
711 (aget alist "port")
712 (aget alist "protocol"))))
713 (decf max)
714 (push (nreverse alist) result)
715 ;; to delete a line, we just comment it out
716 (when delete
717 (goto-char (point-min))
718 (insert "#")
719 (incf modified)))
720 (setq alist nil
721 pair nil)
722 (widen)
723 (forward-line 1))
724
725 (when (< 0 modified)
726 (when auth-source-gpg-encrypt-to
727 ;; (see bug#7487) making `epa-file-encrypt-to' local to
728 ;; this buffer lets epa-file skip the key selection query
729 ;; (see the `local-variable-p' check in
730 ;; `epa-file-write-region').
731 (unless (local-variable-p 'epa-file-encrypt-to (current-buffer))
732 (make-local-variable 'epa-file-encrypt-to))
733 (if (listp auth-source-gpg-encrypt-to)
734 (setq epa-file-encrypt-to auth-source-gpg-encrypt-to)))
735
736 ;; ask AFTER we've successfully opened the file
737 (when (y-or-n-p (format "Save file %s? (%d modifications)"
738 file modified))
739 (write-region (point-min) (point-max) file nil 'silent)
740 (auth-source-do-debug
741 "auth-source-netrc-parse: modified %d lines in %s"
742 modified file)))
743
744 (nreverse result))))))
745
746(defun auth-source-netrc-normalize (alist)
747 (mapcar (lambda (entry)
748 (let (ret item)
749 (while (setq item (pop entry))
750 (let ((k (car item))
751 (v (cdr item)))
752
753 ;; apply key aliases
754 (setq k (cond ((member k '("machine")) "host")
755 ((member k '("login" "account")) "user")
756 ((member k '("protocol")) "port")
757 ((member k '("password")) "secret")
758 (t k)))
759
760 ;; send back the secret in a function (lexical binding)
761 (when (equal k "secret")
762 (setq v (lexical-let ((v v))
763 (lambda () v))))
764
765 (setq ret (plist-put ret
766 (intern (concat ":" k))
767 v))
768 ))
769 ret))
770 alist))
771
772;;; (setq secret (plist-get (nth 0 (auth-source-search :host t :type 'netrc :K 1 :max 1)) :secret))
773;;; (funcall secret)
774
775(defun* auth-source-netrc-search (&rest
776 spec
777 &key backend create delete
778 type max host user protocol
779 &allow-other-keys)
780"Given a property list SPEC, return search matches from the :backend.
781See `auth-source-search' for details on SPEC."
782 ;; just in case, check that the type is correct (null or same as the backend)
783 (assert (or (null type) (eq type (oref backend type)))
784 t "Invalid netrc search: %s %s")
785
786 (let ((results (auth-source-netrc-normalize
787 (auth-source-netrc-parse
788 :max max
789 :delete delete
790 :file (oref backend source)
791 :host (or host t)
792 :user (or user t)
793 :protocol (or protocol t)))))
794
795 ;; if we need to create an entry AND none were found to match
796 (when (and create
797 (= 0 (length results)))
798
799 ;; create based on the spec
800 (apply (slot-value backend 'create-function) spec)
801 ;; turn off the :create key
802 (setq spec (plist-put spec :create nil))
803 ;; run the search again to get the updated data
804 ;; the result will be returned, even if the search fails
805 (setq results (apply 'auth-source-netrc-search spec)))
806
807 results))
808
809;;; (auth-source-search :host "nonesuch" :type 'netrc :max 1 :create t)
810;;; (auth-source-search :host "nonesuch" :type 'netrc :max 1 :create t :create-extra-keys '((A "default A") (B)))
811
812(defun* auth-source-netrc-create (&rest spec
813 &key backend
814 secret host user protocol create
815 &allow-other-keys)
816 (let* ((base-required '(host user protocol secret))
817 ;; we know (because of an assertion in auth-source-search) that the
818 ;; :create parameter is either t or a list (which includes nil)
819 (create-extra (if (eq t create) nil create))
820 (required (append base-required create-extra))
821 (file (oref backend source))
822 (add "")
823 ;; `valist' is an alist
824 valist)
825
826 ;; only for base required elements (defined as function parameters):
827 ;; fill in the valist with whatever data we may have from the search
828 ;; we take the first value if it's a list, the whole value otherwise
829 (dolist (br base-required)
830 (when (symbol-value br)
831 (aput 'valist br (if (listp (symbol-value br))
832 (nth 0 (symbol-value br))
833 (symbol-value br)))))
834
835 ;; for extra required elements, see if the spec includes a value for them
836 (dolist (er create-extra)
837 (let ((name (concat ":" (symbol-name er)))
838 (keys (loop for i below (length spec) by 2
839 collect (nth i spec))))
840 (dolist (k keys)
841 (when (equal (symbol-name k) name)
842 (aput 'valist er (plist-get spec k))))))
843
844 ;; for each required element
845 (dolist (r required)
846 (let* ((data (aget valist r))
847 (given-default (aget auth-source-creation-defaults r))
848 ;; the defaults are simple
849 (default (cond
850 ((and (not given-default) (eq r 'user))
851 (user-login-name))
852 ;; note we need this empty string
853 ((and (not given-default) (eq r 'protocol))
854 "")
855 (t given-default)))
856 ;; the prompt's default string depends on the data so far
857 (default-string (if (and default (< 0 (length default)))
858 (format " (default %s)" default)
859 " (no default)"))
860 ;; the prompt should also show what's entered so far
861 (user-value (aget valist 'user))
862 (host-value (aget valist 'host))
863 (protocol-value (aget valist 'protocol))
864 (info-so-far (concat (if user-value
865 (format "%s@" user-value)
866 "[USER?]")
867 (if host-value
868 (format "%s" host-value)
869 "[HOST?]")
870 (if protocol-value
871 ;; this distinguishes protocol between
872 (if (zerop (length protocol-value))
873 "" ; 'entered as "no default"' vs.
874 (format ":%s" protocol-value)) ; given
875 ;; and this is when the protocol is unknown
876 "[PROTOCOL?]"))))
425 877
426;; (progn 878 ;; now prompt if the search SPEC did not include a required key;
427;; (auth-source-forget-all-cached) 879 ;; take the result and put it in `data' AND store it in `valist'
428;; (list 880 (aput 'valist r
429;; (auth-source-user-or-password '("login" "password") "imap.myhost.com" "other") 881 (setq data
430;; (auth-source-user-or-password '("login" "password") "imap.myhost.com" "other" "tzz") 882 (cond
431;; (auth-source-user-or-password '("login" "password") "imap.myhost.com" "other" "joe"))) 883 ((and (null data) (eq r 'secret))
884 ;; special case prompt for passwords
885 (read-passwd (format "Password for %s: " info-so-far)))
886 ((null data)
887 (read-string
888 (format "Enter %s for %s%s: "
889 r info-so-far default-string)
890 nil nil default))
891 (t data))))
892
893 ;; when r is not an empty string...
894 (when (and (stringp data)
895 (< 0 (length data)))
896 ;; append the key (the symbol name of r) and the value in r
897 (setq add (concat add
898 (format "%s%s %S"
899 ;; prepend a space
900 (if (zerop (length add)) "" " ")
901 ;; remap auth-source tokens to netrc
902 (case r
903 ('user "login")
904 ('host "machine")
905 ('secret "password")
906 ('protocol "port")
907 (t (symbol-name r)))
908 ;; the value will be printed in %S format
909 data))))))
910
911 (with-temp-buffer
912 (when (file-exists-p file)
913 (insert-file-contents file))
914 (when auth-source-gpg-encrypt-to
915 ;; (see bug#7487) making `epa-file-encrypt-to' local to
916 ;; this buffer lets epa-file skip the key selection query
917 ;; (see the `local-variable-p' check in
918 ;; `epa-file-write-region').
919 (unless (local-variable-p 'epa-file-encrypt-to (current-buffer))
920 (make-local-variable 'epa-file-encrypt-to))
921 (if (listp auth-source-gpg-encrypt-to)
922 (setq epa-file-encrypt-to auth-source-gpg-encrypt-to)))
923 (goto-char (point-max))
924
925 ;; ask AFTER we've successfully opened the file
926 (when (y-or-n-p (format "Add to file %s: line [%s]" file add))
927 (unless (bolp)
928 (insert "\n"))
929 (insert add "\n")
930 (write-region (point-min) (point-max) file nil 'silent)
931 (auth-source-do-debug
932 "auth-source-netrc-create: wrote 1 new line to %s"
933 file)))))
934
935;;; Backend specific parsing: Secrets API backend
936
937;;; (let ((auth-sources '(default))) (auth-source-search :max 1 :create t))
938;;; (let ((auth-sources '(default))) (auth-source-search :max 1 :delete t))
939;;; (let ((auth-sources '(default))) (auth-source-search :max 1))
940;;; (let ((auth-sources '(default))) (auth-source-search))
941;;; (let ((auth-sources '("secrets:login"))) (auth-source-search :max 1))
942;;; (let ((auth-sources '("secrets:login"))) (auth-source-search :max 1 :signon_realm "https://git.gnus.org/Git"))
943
944(defun* auth-source-secrets-search (&rest
945 spec
946 &key backend create delete label
947 type max host user protocol
948 &allow-other-keys)
949 "Search the Secrets API; spec is like `auth-source'.
950
951The :label key specifies the item's label. It is the only key
952that can specify a substring. Any :label value besides a string
953will allow any label.
954
955All other search keys must match exactly. If you need substring
956matching, do a wider search and narrow it down yourself.
957
958You'll get back all the properties of the token as a plist.
959
960Here's an example that looks for the first item in the 'login'
961Secrets collection:
962
963 \(let ((auth-sources '(\"secrets:login\")))
964 (auth-source-search :max 1)
965
966Here's another that looks for the first item in the 'login'
967Secrets collection whose label contains 'gnus':
968
969 \(let ((auth-sources '(\"secrets:login\")))
970 (auth-source-search :max 1 :label \"gnus\")
971
972And this one looks for the first item in the 'login' Secrets
973collection that's a Google Chrome entry for the git.gnus.org site
974login:
975
976 \(let ((auth-sources '(\"secrets:login\")))
977 (auth-source-search :max 1 :signon_realm \"https://git.gnus.org/Git\"))
978"
979
980 ;; TODO
981 (assert (not create) nil
982 "The Secrets API auth-source backend doesn't support creation yet")
983 ;; TODO
984 ;; (secrets-delete-item coll elt)
985 (assert (not delete) nil
986 "The Secrets API auth-source backend doesn't support deletion yet")
987
988 (let* ((coll (oref backend source))
989 (max (or max 5000)) ; sanity check: default to stop at 5K
990 (ignored-keys '(:create :delete :max :backend :label))
991 (search-keys (loop for i below (length spec) by 2
992 unless (memq (nth i spec) ignored-keys)
993 collect (nth i spec)))
994 ;; build a search spec without the ignored keys
995 ;; if a search key is nil or t (match anything), we skip it
996 (search-spec (mapcan (lambda (k) (if (or (null (plist-get spec k))
997 (eq t (plist-get spec k)))
998 nil
999 (list k (plist-get spec k))))
1000 search-keys))
1001 ;; needed keys (always including host, login, protocol, and secret)
1002 (returned-keys (remove-duplicates (append
1003 '(:host :login :protocol :secret)
1004 search-keys)))
1005 (items (loop for item in (apply 'secrets-search-items coll search-spec)
1006 unless (and (stringp label)
1007 (not (string-match label item)))
1008 collect item))
1009 ;; TODO: respect max in `secrets-search-items', not after the fact
1010 (items (subseq items 0 (min (length items) max)))
1011 ;; convert the item name to a full plist
1012 (items (mapcar (lambda (item)
1013 (append
1014 ;; make an entry for the secret (password) element
1015 (list
1016 :secret
1017 (lexical-let ((v (secrets-get-secret coll item)))
1018 (lambda () v)))
1019 ;; rewrite the entry from ((k1 v1) (k2 v2)) to plist
1020 (mapcan (lambda (entry)
1021 (list (car entry) (cdr entry)))
1022 (secrets-get-attributes coll item))))
1023 items))
1024 ;; ensure each item has each key in `returned-keys'
1025 (items (mapcar (lambda (plist)
1026 (append
1027 (mapcan (lambda (req)
1028 (if (plist-get plist req)
1029 nil
1030 (list req nil)))
1031 returned-keys)
1032 plist))
1033 items)))
1034 items))
1035
1036(defun* auth-source-secrets-create (&rest
1037 spec
1038 &key backend type max host user protocol
1039 &allow-other-keys)
1040 ;; TODO
1041 ;; (apply 'secrets-create-item (auth-get-source entry) name passwd spec)
1042 (debug spec))
1043
1044;;; older API
1045
1046;;; (auth-source-user-or-password '("login" "password") "imap.myhost.com" t "tzz")
1047
1048;; deprecate the old interface
1049(make-obsolete 'auth-source-user-or-password
1050 'auth-source-search "Emacs 24.1")
1051(make-obsolete 'auth-source-forget-user-or-password
1052 'auth-source-forget "Emacs 24.1")
432 1053
433(defun auth-source-user-or-password 1054(defun auth-source-user-or-password
434 (mode host protocol &optional username create-missing delete-existing) 1055 (mode host protocol &optional username create-missing delete-existing)
435 "Find MODE (string or list of strings) matching HOST and PROTOCOL. 1056 "Find MODE (string or list of strings) matching HOST and PROTOCOL.
436 1057
1058DEPRECATED in favor of `auth-source-search'!
1059
437USERNAME is optional and will be used as \"login\" in a search 1060USERNAME is optional and will be used as \"login\" in a search
438across the Secret Service API (see secrets.el) if the resulting 1061across the Secret Service API (see secrets.el) if the resulting
439items don't have a username. This means that if you search for 1062items don't have a username. This means that if you search for
@@ -452,8 +1075,9 @@ stored in the password database which matches best (see
452 1075
453MODE can be \"login\" or \"password\"." 1076MODE can be \"login\" or \"password\"."
454 (auth-source-do-debug 1077 (auth-source-do-debug
455 "auth-source-user-or-password: get %s for %s (%s) + user=%s" 1078 "auth-source-user-or-password: DEPRECATED get %s for %s (%s) + user=%s"
456 mode host protocol username) 1079 mode host protocol username)
1080
457 (let* ((listy (listp mode)) 1081 (let* ((listy (listp mode))
458 (mode (if listy mode (list mode))) 1082 (mode (if listy mode (list mode)))
459 (cname (if username 1083 (cname (if username
@@ -461,70 +1085,44 @@ MODE can be \"login\" or \"password\"."
461 (format "%s %s:%s" mode host protocol))) 1085 (format "%s %s:%s" mode host protocol)))
462 (search (list :host host :protocol protocol)) 1086 (search (list :host host :protocol protocol))
463 (search (if username (append search (list :user username)) search)) 1087 (search (if username (append search (list :user username)) search))
464 (found (if (not delete-existing) 1088 (search (if create-missing
465 (gethash cname auth-source-cache) 1089 (append search (list :create t))
466 (remhash cname auth-source-cache) 1090 search))
467 nil))) 1091 (search (if delete-existing
1092 (append search (list :delete t))
1093 search))
1094 ;; (found (if (not delete-existing)
1095 ;; (gethash cname auth-source-cache)
1096 ;; (remhash cname auth-source-cache)
1097 ;; nil)))
1098 (found nil))
468 (if found 1099 (if found
469 (progn 1100 (progn
470 (auth-source-do-debug 1101 (auth-source-do-debug
471 "auth-source-user-or-password: cached %s=%s for %s (%s) + %s" 1102 "auth-source-user-or-password: DEPRECATED cached %s=%s for %s (%s) + %s"
472 mode 1103 mode
473 ;; don't show the password 1104 ;; don't show the password
474 (if (and (member "password" mode) auth-source-hide-passwords) 1105 (if (and (member "password" mode) t)
475 "SECRET" 1106 "SECRET"
476 found) 1107 found)
477 host protocol username) 1108 host protocol username)
478 found) ; return the found data 1109 found) ; return the found data
479 ;; else, if not found 1110 ;; else, if not found, search with a max of 1
480 (let ((choices (apply 'auth-source-pick search))) 1111 (let ((choice (nth 0 (apply 'auth-source-search
481 (dolist (choice choices) 1112 (append '(:max 1) search)))))
482 (if delete-existing 1113 (when choice
483 (apply 'auth-source-delete choice search) 1114 (dolist (m mode)
484 (setq found (apply 'auth-source-retrieve mode choice search))) 1115 (cond
485 (and found (return found))) 1116 ((equal "password" m)
486 1117 (push (if (plist-get choice :secret)
487 ;; We haven't found something, so we will create it interactively. 1118 (funcall (plist-get choice :secret))
488 (when (and (not found) create-missing) 1119 nil) found))
489 (setq found (apply 'auth-source-create 1120 ((equal "login" m)
490 mode (if choices 1121 (push (plist-get choice :user) found)))))
491 (car choices) 1122 (setq found (nreverse found))
492 (car auth-sources)) 1123 (setq found (if listy found (car-safe found)))))
493 search)))
494
495 ;; Cache the result.
496 (when found
497 (auth-source-do-debug
498 "auth-source-user-or-password: found %s=%s for %s (%s) + %s"
499 mode
500 ;; don't show the password
501 (if (and (member "password" mode) auth-source-hide-passwords)
502 "SECRET" found)
503 host protocol username)
504 (setq found (if listy found (car-safe found)))
505 (when auth-source-do-cache
506 (puthash cname found auth-source-cache)))
507
508 found))))
509
510(defun auth-source-protocol-defaults (protocol)
511 "Return a list of default ports and names for PROTOCOL."
512 (cdr-safe (assoc protocol auth-source-protocols)))
513
514(defun auth-source-user-or-password-imap (mode host)
515 (auth-source-user-or-password mode host 'imap))
516
517(defun auth-source-user-or-password-pop3 (mode host)
518 (auth-source-user-or-password mode host 'pop3))
519
520(defun auth-source-user-or-password-ssh (mode host)
521 (auth-source-user-or-password mode host 'ssh))
522
523(defun auth-source-user-or-password-sftp (mode host)
524 (auth-source-user-or-password mode host 'sftp))
525 1124
526(defun auth-source-user-or-password-smtp (mode host) 1125 found))
527 (auth-source-user-or-password mode host 'smtp))
528 1126
529(provide 'auth-source) 1127(provide 'auth-source)
530 1128
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index 54797b2a518..3e1630804f7 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -683,7 +683,7 @@ beginning of a line."
683 :type 'regexp 683 :type 'regexp
684 :group 'gnus-article-various) 684 :group 'gnus-article-various)
685 685
686(defcustom gnus-article-mode-line-format "Gnus: %g [%w] %S%m" 686(defcustom gnus-article-mode-line-format "Gnus: %g %S%m"
687 "*The format specification for the article mode line. 687 "*The format specification for the article mode line.
688See `gnus-summary-mode-line-format' for a closer description. 688See `gnus-summary-mode-line-format' for a closer description.
689 689
@@ -691,6 +691,7 @@ The following additional specs are available:
691 691
692%w The article washing status. 692%w The article washing status.
693%m The number of MIME parts in the article." 693%m The number of MIME parts in the article."
694 :version "24.1"
694 :type 'string 695 :type 'string
695 :group 'gnus-article-various) 696 :group 'gnus-article-various)
696 697
@@ -3403,6 +3404,7 @@ possible values."
3403 (inhibit-read-only t) 3404 (inhibit-read-only t)
3404 (inhibit-point-motion-hooks t) 3405 (inhibit-point-motion-hooks t)
3405 (first t) 3406 (first t)
3407 (visible-date (mail-fetch-field "Date"))
3406 pos date bface eface) 3408 pos date bface eface)
3407 (save-excursion 3409 (save-excursion
3408 (save-restriction 3410 (save-restriction
@@ -3426,6 +3428,9 @@ possible values."
3426 (delete-region (point-at-bol) (progn 3428 (delete-region (point-at-bol) (progn
3427 (gnus-article-forward-header) 3429 (gnus-article-forward-header)
3428 (point)))) 3430 (point))))
3431 (when (and (not date)
3432 visible-date)
3433 (setq date visible-date))
3429 (when date 3434 (when date
3430 (article-transform-date date type bface eface))))))) 3435 (article-transform-date date type bface eface)))))))
3431 3436
diff --git a/lisp/gnus/gnus-delay.el b/lisp/gnus/gnus-delay.el
index a06a510ecdd..bfd17055ea5 100644
--- a/lisp/gnus/gnus-delay.el
+++ b/lisp/gnus/gnus-delay.el
@@ -78,7 +78,7 @@ DELAY is a string, giving the length of the time. Possible values are:
78 time, then the deadline is tomorrow, else today." 78 time, then the deadline is tomorrow, else today."
79 (interactive 79 (interactive
80 (list (read-string 80 (list (read-string
81 "Target date (YYYY-MM-DD) or length of delay (units in [mhdwMY]): " 81 "Target date (YYYY-MM-DD), time (hh:mm), or length of delay (units in [mhdwMY]): "
82 gnus-delay-default-delay))) 82 gnus-delay-default-delay)))
83 (let (num unit days year month day hour minute deadline) 83 (let (num unit days year month day hour minute deadline)
84 (cond ((string-match 84 (cond ((string-match
@@ -105,7 +105,7 @@ DELAY is a string, giving the length of the time. Possible values are:
105 (append deadline nil)))) 105 (append deadline nil))))
106 ;; If this time has passed already, add a day. 106 ;; If this time has passed already, add a day.
107 (when (< deadline (gnus-float-time)) 107 (when (< deadline (gnus-float-time))
108 (setq deadline (+ 3600 deadline))) ;3600 secs/day 108 (setq deadline (+ 86400 deadline))) ; 86400 secs/day
109 ;; Convert seconds to date header. 109 ;; Convert seconds to date header.
110 (setq deadline (message-make-date 110 (setq deadline (message-make-date
111 (seconds-to-time deadline)))) 111 (seconds-to-time deadline))))
diff --git a/lisp/gnus/mail-source.el b/lisp/gnus/mail-source.el
index f98c195eada..6e6ef76c0c1 100644
--- a/lisp/gnus/mail-source.el
+++ b/lisp/gnus/mail-source.el
@@ -32,7 +32,7 @@
32(eval-when-compile 32(eval-when-compile
33 (require 'cl) 33 (require 'cl)
34 (require 'imap)) 34 (require 'imap))
35(autoload 'auth-source-user-or-password "auth-source") 35(autoload 'auth-source-search "auth-source")
36(autoload 'pop3-movemail "pop3") 36(autoload 'pop3-movemail "pop3")
37(autoload 'pop3-get-message-count "pop3") 37(autoload 'pop3-get-message-count "pop3")
38(autoload 'nnheader-cancel-timer "nnheader") 38(autoload 'nnheader-cancel-timer "nnheader")
@@ -332,6 +332,7 @@ Common keywords should be listed here.")
332 (:prescript) 332 (:prescript)
333 (:prescript-delay) 333 (:prescript-delay)
334 (:postscript) 334 (:postscript)
335 ;; note server and port need to come before user and password
335 (:server (getenv "MAILHOST")) 336 (:server (getenv "MAILHOST"))
336 (:port 110) 337 (:port 110)
337 (:user (or (user-login-name) (getenv "LOGNAME") (getenv "USER"))) 338 (:user (or (user-login-name) (getenv "LOGNAME") (getenv "USER")))
@@ -345,6 +346,7 @@ Common keywords should be listed here.")
345 (:subdirs ("cur" "new")) 346 (:subdirs ("cur" "new"))
346 (:function)) 347 (:function))
347 (imap 348 (imap
349 ;; note server and port need to come before user and password
348 (:server (getenv "MAILHOST")) 350 (:server (getenv "MAILHOST"))
349 (:port) 351 (:port)
350 (:stream) 352 (:stream)
@@ -417,42 +419,66 @@ the `mail-source-keyword-map' variable."
417(put 'mail-source-bind 'lisp-indent-function 1) 419(put 'mail-source-bind 'lisp-indent-function 1)
418(put 'mail-source-bind 'edebug-form-spec '(sexp body)) 420(put 'mail-source-bind 'edebug-form-spec '(sexp body))
419 421
420;; TODO: use the list format for auth-source-user-or-password modes
421(defun mail-source-set-1 (source) 422(defun mail-source-set-1 (source)
422 (let* ((type (pop source)) 423 (let* ((type (pop source))
423 (defaults (cdr (assq type mail-source-keyword-map))) 424 (defaults (cdr (assq type mail-source-keyword-map)))
424 default value keyword auth-info user-auth pass-auth) 425 (search '(:max 1))
426 found default value keyword auth-info user-auth pass-auth)
427
428 ;; append to the search the useful info from the source and the defaults:
429 ;; user, host, and port
430
431 ;; the msname is the mail-source parameter
432 (dolist (msname '(:server :user :port))
433 ;; the asname is the auth-source parameter
434 (let* ((asname (case msname
435 (:server :host) ; auth-source uses :host
436 (t msname)))
437 ;; this is the mail-source default
438 (msdef1 (or (plist-get source msname)
439 (nth 1 (assoc msname defaults))))
440 ;; ...evaluated
441 (msdef (mail-source-value msdef1)))
442 (setq search (append (list asname
443 (if msdef msdef t))
444 search))))
445 ;; if the port is unknown yet, get it from the mail-source type
446 (unless (plist-get search :port)
447 (setq search (append (list :port (symbol-name type)))))
448
425 (while (setq default (pop defaults)) 449 (while (setq default (pop defaults))
426 ;; for each default :SYMBOL, set SYMBOL to the plist value for :SYMBOL 450 ;; for each default :SYMBOL, set SYMBOL to the plist value for :SYMBOL
427 ;; using `mail-source-value' to evaluate the plist value 451 ;; using `mail-source-value' to evaluate the plist value
428 (set (mail-source-strip-keyword (setq keyword (car default))) 452 (set (mail-source-strip-keyword (setq keyword (car default)))
429 ;; note the following reasons for this structure: 453 ;; note the following reasons for this structure:
430 ;; 1) the auth-sources user and password override everything 454 ;; 1) the auth-sources user and password override everything
431 ;; 2) it avoids macros, so it's cleaner 455 ;; 2) it avoids macros, so it's cleaner
432 ;; 3) it falls through to the mail-sources and then default values 456 ;; 3) it falls through to the mail-sources and then default values
433 (cond 457 (cond
434 ((and 458 ((and
435 (eq keyword :user) 459 (eq keyword :user)
436 (setq user-auth 460 (setq user-auth (plist-get
437 (nth 0 (auth-source-user-or-password 461 ;; cache the search result in `found'
438 '("login" "password") 462 (or found
439 ;; this is "host" in auth-sources 463 (setq found (nth 0 (apply 'auth-source-search
440 (if (boundp 'server) (symbol-value 'server) "") 464 search))))
441 type)))) 465 :user)))
442 user-auth) 466 user-auth)
443 ((and 467 ((and
444 (eq keyword :password) 468 (eq keyword :password)
445 (setq pass-auth 469 (setq pass-auth (plist-get
446 (nth 1 470 ;; cache the search result in `found'
447 (auth-source-user-or-password 471 (or found
448 '("login" "password") 472 (setq found (nth 0 (apply 'auth-source-search
449 ;; this is "host" in auth-sources 473 search))))
450 (if (boundp 'server) (symbol-value 'server) "") 474 :secret)))
451 type)))) 475 ;; maybe set the password to the return of the :secret function
452 pass-auth) 476 (if (functionp pass-auth)
453 (t (if (setq value (plist-get source keyword)) 477 (setq pass-auth (funcall pass-auth))
454 (mail-source-value value) 478 pass-auth))
455 (mail-source-value (cadr default))))))))) 479 (t (if (setq value (plist-get source keyword))
480 (mail-source-value value)
481 (mail-source-value (cadr default)))))))))
456 482
457(eval-and-compile 483(eval-and-compile
458 (defun mail-source-bind-common-1 () 484 (defun mail-source-bind-common-1 ()
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el
index a6fe6b1489b..a5a001f7e11 100644
--- a/lisp/gnus/nnimap.el
+++ b/lisp/gnus/nnimap.el
@@ -47,8 +47,8 @@
47(require 'nnmail) 47(require 'nnmail)
48(require 'proto-stream) 48(require 'proto-stream)
49 49
50(autoload 'auth-source-forget-user-or-password "auth-source") 50(autoload 'auth-source-forget+ "auth-source")
51(autoload 'auth-source-user-or-password "auth-source") 51(autoload 'auth-source-search "auth-source")
52 52
53(nnoo-declare nnimap) 53(nnoo-declare nnimap)
54 54
@@ -142,6 +142,8 @@ textual parts.")
142(defvar nnimap-quirks 142(defvar nnimap-quirks
143 '(("QRESYNC" "Zimbra" "QRESYNC "))) 143 '(("QRESYNC" "Zimbra" "QRESYNC ")))
144 144
145(defvar nnimap-inhibit-logging nil)
146
145(defun nnimap-buffer () 147(defun nnimap-buffer ()
146 (nnimap-find-process-buffer nntp-server-buffer)) 148 (nnimap-find-process-buffer nntp-server-buffer))
147 149
@@ -275,18 +277,18 @@ textual parts.")
275 (current-buffer))) 277 (current-buffer)))
276 278
277(defun nnimap-credentials (address ports &optional inhibit-create) 279(defun nnimap-credentials (address ports &optional inhibit-create)
278 (let (port credentials) 280 (let* ((found (nth 0 (auth-source-search :max 1
279 ;; Request the credentials from all ports, but only query on the 281 :host address
280 ;; last port if all the previous ones have failed. 282 :port ports
281 (while (and (null credentials) 283 :create (if inhibit-create
282 (setq port (pop ports))) 284 nil
283 (setq credentials 285 (null ports)))))
284 (auth-source-user-or-password 286 (user (plist-get found :user))
285 '("login" "password") address port nil 287 (secret (plist-get found :secret))
286 (if inhibit-create 288 (secret (if (functionp secret) (funcall secret) secret)))
287 nil 289 (if found
288 (null ports))))) 290 (list user secret)
289 credentials)) 291 nil)))
290 292
291(defun nnimap-keepalive () 293(defun nnimap-keepalive ()
292 (let ((now (current-time))) 294 (let ((now (current-time)))
@@ -381,26 +383,24 @@ textual parts.")
381 (if (eq nnimap-authenticator 'anonymous) 383 (if (eq nnimap-authenticator 'anonymous)
382 (list "anonymous" 384 (list "anonymous"
383 (message-make-address)) 385 (message-make-address))
384 (or 386 ;; Look for the credentials based on
385 ;; First look for the credentials based 387 ;; the virtual server name and the address
386 ;; on the virtual server name. 388 (nnimap-credentials
387 (nnimap-credentials 389 (list
388 (nnoo-current-server 'nnimap) ports t) 390 (nnoo-current-server 'nnimap)
389 ;; Then look them up based on the 391 nnimap-address)
390 ;; physical address. 392 ports t))))
391 (nnimap-credentials nnimap-address ports)))))
392 (setq nnimap-object nil) 393 (setq nnimap-object nil)
393 (setq login-result 394 (let ((nnimap-inhibit-logging t))
394 (nnimap-login (car credentials) (cadr credentials))) 395 (setq login-result
396 (nnimap-login (car credentials) (cadr credentials))))
395 (unless (car login-result) 397 (unless (car login-result)
396 ;; If the login failed, then forget the credentials 398 ;; If the login failed, then forget the credentials
397 ;; that are now possibly cached. 399 ;; that are now possibly cached.
398 (dolist (host (list (nnoo-current-server 'nnimap) 400 (dolist (host (list (nnoo-current-server 'nnimap)
399 nnimap-address)) 401 nnimap-address))
400 (dolist (port ports) 402 (dolist (port ports)
401 (dolist (element '("login" "password")) 403 (auth-source-forget+ :host host :protocol port)))
402 (auth-source-forget-user-or-password
403 element host port))))
404 (delete-process (nnimap-process nnimap-object)) 404 (delete-process (nnimap-process nnimap-object))
405 (setq nnimap-object nil)))) 405 (setq nnimap-object nil))))
406 (when nnimap-object 406 (when nnimap-object
@@ -969,7 +969,8 @@ textual parts.")
969 (nnimap-add-cr) 969 (nnimap-add-cr)
970 (setq message (buffer-substring-no-properties (point-min) (point-max))) 970 (setq message (buffer-substring-no-properties (point-min) (point-max)))
971 (with-current-buffer (nnimap-buffer) 971 (with-current-buffer (nnimap-buffer)
972 (when (setq message (nnimap-process-quirk "OK Gimap " 'append message)) 972 (when (setq message (or (nnimap-process-quirk "OK Gimap " 'append message)
973 message))
973 ;; If we have this group open read-only, then unselect it 974 ;; If we have this group open read-only, then unselect it
974 ;; before appending to it. 975 ;; before appending to it.
975 (when (equal (nnimap-examined nnimap-object) group) 976 (when (equal (nnimap-examined nnimap-object) group)
@@ -997,7 +998,7 @@ textual parts.")
997 998
998(defun nnimap-process-quirk (greeting-match type data) 999(defun nnimap-process-quirk (greeting-match type data)
999 (when (and (nnimap-greeting nnimap-object) 1000 (when (and (nnimap-greeting nnimap-object)
1000 (string-match "OK Gimap " (nnimap-greeting nnimap-object)) 1001 (string-match greeting-match (nnimap-greeting nnimap-object))
1001 (eq type 'append) 1002 (eq type 'append)
1002 (string-match "\000" data)) 1003 (string-match "\000" data))
1003 (let ((choice (gnus-multiple-choice 1004 (let ((choice (gnus-multiple-choice
@@ -1567,6 +1568,7 @@ textual parts.")
1567(defvar nnimap-sequence 0) 1568(defvar nnimap-sequence 0)
1568 1569
1569(defun nnimap-send-command (&rest args) 1570(defun nnimap-send-command (&rest args)
1571 (setf (nnimap-last-command-time nnimap-object) (current-time))
1570 (process-send-string 1572 (process-send-string
1571 (get-buffer-process (current-buffer)) 1573 (get-buffer-process (current-buffer))
1572 (nnimap-log-command 1574 (nnimap-log-command
@@ -1585,12 +1587,14 @@ textual parts.")
1585(defun nnimap-log-command (command) 1587(defun nnimap-log-command (command)
1586 (with-current-buffer (get-buffer-create "*imap log*") 1588 (with-current-buffer (get-buffer-create "*imap log*")
1587 (goto-char (point-max)) 1589 (goto-char (point-max))
1588 (insert (format-time-string "%H:%M:%S") " " command)) 1590 (insert (format-time-string "%H:%M:%S") " "
1591 (if nnimap-inhibit-logging
1592 "(inhibited)"
1593 command)))
1589 command) 1594 command)
1590 1595
1591(defun nnimap-command (&rest args) 1596(defun nnimap-command (&rest args)
1592 (erase-buffer) 1597 (erase-buffer)
1593 (setf (nnimap-last-command-time nnimap-object) (current-time))
1594 (let* ((sequence (apply #'nnimap-send-command args)) 1598 (let* ((sequence (apply #'nnimap-send-command args))
1595 (response (nnimap-get-response sequence))) 1599 (response (nnimap-get-response sequence)))
1596 (if (equal (caar response) "OK") 1600 (if (equal (caar response) "OK")
diff --git a/lisp/gnus/nntp.el b/lisp/gnus/nntp.el
index eb2dd004638..4b42637978e 100644
--- a/lisp/gnus/nntp.el
+++ b/lisp/gnus/nntp.el
@@ -40,7 +40,7 @@
40 40
41(eval-when-compile (require 'cl)) 41(eval-when-compile (require 'cl))
42 42
43(autoload 'auth-source-user-or-password "auth-source") 43(autoload 'auth-source-search "auth-source")
44 44
45(defgroup nntp nil 45(defgroup nntp nil
46 "NNTP access for Gnus." 46 "NNTP access for Gnus."
@@ -1231,10 +1231,16 @@ If SEND-IF-FORCE, only send authinfo to the server if the
1231 (let* ((list (netrc-parse nntp-authinfo-file)) 1231 (let* ((list (netrc-parse nntp-authinfo-file))
1232 (alist (netrc-machine list nntp-address "nntp")) 1232 (alist (netrc-machine list nntp-address "nntp"))
1233 (force (or (netrc-get alist "force") nntp-authinfo-force)) 1233 (force (or (netrc-get alist "force") nntp-authinfo-force))
1234 (auth-info 1234 (auth-info
1235 (auth-source-user-or-password '("login" "password") nntp-address "nntp")) 1235 (nth 0 (auth-source-search :max 1
1236 (auth-user (nth 0 auth-info)) 1236 ;; TODO: allow the virtual server name too
1237 (auth-passwd (nth 1 auth-info)) 1237 :host nntp-address
1238 :port '("119" "nntp"))))
1239 (auth-user (plist-get auth-info :user))
1240 (auth-passwd (plist-get auth-info :secret))
1241 (auth-passwd (if (functionp auth-passwd)
1242 (funcall auth-passwd)
1243 auth-passwd))
1238 (user (or 1244 (user (or
1239 ;; this is preferred to netrc-* 1245 ;; this is preferred to netrc-*
1240 auth-user 1246 auth-user
diff --git a/lisp/gnus/sieve-manage.el b/lisp/gnus/sieve-manage.el
index d115f40528b..c9a0df20590 100644
--- a/lisp/gnus/sieve-manage.el
+++ b/lisp/gnus/sieve-manage.el
@@ -83,7 +83,7 @@
83 (require 'starttls)) 83 (require 'starttls))
84(autoload 'sasl-find-mechanism "sasl") 84(autoload 'sasl-find-mechanism "sasl")
85(autoload 'starttls-open-stream "starttls") 85(autoload 'starttls-open-stream "starttls")
86(autoload 'auth-source-user-or-password "auth-source") 86(autoload 'auth-source-search "auth-source")
87 87
88;; User customizable variables: 88;; User customizable variables:
89 89
@@ -273,16 +273,20 @@ Valid states are `closed', `initial', `nonauth', and `auth'.")
273 "Login to server using the SASL MECH method." 273 "Login to server using the SASL MECH method."
274 (message "sieve: Authenticating using %s..." mech) 274 (message "sieve: Authenticating using %s..." mech)
275 (with-current-buffer buffer 275 (with-current-buffer buffer
276 (let* ((user-password (auth-source-user-or-password 276 (let* ((auth-info (auth-source-search :host sieve-manage-server
277 '("login" "password") 277 :port "sieve"
278 sieve-manage-server 278 :max 1))
279 "sieve" nil t)) 279 (user-name (plist-get (nth 0 auth-info) :user))
280 (user-password (plist-get (nth 0 auth-info) :secret))
281 (user-password (if (functionp user-password)
282 (funcall user-password)
283 user-password))
280 (client (sasl-make-client (sasl-find-mechanism (list mech)) 284 (client (sasl-make-client (sasl-find-mechanism (list mech))
281 (car user-password) "sieve" sieve-manage-server)) 285 user-name "sieve" sieve-manage-server))
282 (sasl-read-passphrase 286 (sasl-read-passphrase
283 ;; We *need* to copy the password, because sasl will modify it 287 ;; We *need* to copy the password, because sasl will modify it
284 ;; somehow. 288 ;; somehow.
285 `(lambda (prompt) ,(copy-sequence (cadr user-password)))) 289 `(lambda (prompt) ,(copy-sequence user-password)))
286 (step (sasl-next-step client nil)) 290 (step (sasl-next-step client nil))
287 (tag (sieve-manage-send 291 (tag (sieve-manage-send
288 (concat 292 (concat
diff --git a/lisp/makefile.w32-in b/lisp/makefile.w32-in
index eb65bb7a60f..0e3d54408fd 100644
--- a/lisp/makefile.w32-in
+++ b/lisp/makefile.w32-in
@@ -443,9 +443,9 @@ $(lisp)/mh-e/mh-loaddefs.el: $(MH_E_SRC)
443TRAMP_SRC = $(lisp)/net/tramp.el $(lisp)/net/tramp-cache.el \ 443TRAMP_SRC = $(lisp)/net/tramp.el $(lisp)/net/tramp-cache.el \
444 $(lisp)/net/tramp-cmds.el $(lisp)/net/tramp-compat.el \ 444 $(lisp)/net/tramp-cmds.el $(lisp)/net/tramp-compat.el \
445 $(lisp)/net/tramp-ftp.el $(lisp)/net/tramp-gvfs.el \ 445 $(lisp)/net/tramp-ftp.el $(lisp)/net/tramp-gvfs.el \
446 $(lisp)/net/tramp-gw.el $(lisp)/net/tramp-imap.el \ 446 $(lisp)/net/tramp-gw.el $(lisp)/net/tramp-sh.el \
447 $(lisp)/net/tramp-sh.el $(lisp)/net/tramp-smb.el \ 447 $(lisp)/net/tramp-smb.el $(lisp)/net/tramp-uu.el \
448 $(lisp)/net/tramp-uu.el $(lisp)/net/trampver.el 448 $(lisp)/net/trampver.el
449 449
450$(lisp)/net/tramp-loaddefs.el: $(TRAMP_SRC) 450$(lisp)/net/tramp-loaddefs.el: $(TRAMP_SRC)
451 "$(EMACS)" $(EMACSOPT) \ 451 "$(EMACS)" $(EMACSOPT) \
diff --git a/lisp/mh-e/ChangeLog.1 b/lisp/mh-e/ChangeLog.1
index 2abfea9ac6b..69ca927d5e7 100644
--- a/lisp/mh-e/ChangeLog.1
+++ b/lisp/mh-e/ChangeLog.1
@@ -3499,7 +3499,7 @@
3499 3499
35002003-05-08 Satyaki Das <satyakid@stanford.edu> 35002003-05-08 Satyaki Das <satyakid@stanford.edu>
3501 3501
3502 * mh-seq.el (mh-translate-range): Take into account differnt 3502 * mh-seq.el (mh-translate-range): Take into account different
3503 semantics of split-string in Emacs and XEmacs. 3503 semantics of split-string in Emacs and XEmacs.
3504 (mh-read-pick-regexp, mh-narrow-to-from, mh-narrow-to-cc) 3504 (mh-read-pick-regexp, mh-narrow-to-from, mh-narrow-to-cc)
3505 (mh-narrow-to-to, mh-narrow-to-header-field) 3505 (mh-narrow-to-to, mh-narrow-to-header-field)
diff --git a/lisp/net/imap-hash.el b/lisp/net/imap-hash.el
deleted file mode 100644
index a07277cee68..00000000000
--- a/lisp/net/imap-hash.el
+++ /dev/null
@@ -1,374 +0,0 @@
1;;; imap-hash.el --- Hashtable-like interface to an IMAP mailbox
2
3;; Copyright (C) 2009-2011 Free Software Foundation, Inc.
4
5;; Author: Teodor Zlatanov <tzz@lifelogs.com>
6;; Keywords: mail
7
8;; This program is free software; you can redistribute it and/or modify
9;; it under the terms of the GNU General Public License as published by
10;; the Free Software Foundation, either version 3 of the License, or
11;; (at your option) any later version.
12
13;; This program is distributed in the hope that it will be useful,
14;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;; GNU General Public License for more details.
17
18;; You should have received a copy of the GNU General Public License
19;; along with this program. If not, see <http://www.gnu.org/licenses/>.
20
21;;; Commentary:
22
23;; This module provides hashtable-like functions on top of imap.el
24;; functionality. All the authentication is handled by auth-source so
25;; there are no authentication options here, only the server and
26;; mailbox names are needed.
27
28;; Create a IHT (imap-hash table) object with `imap-hash-make'. Then
29;; use it with `imap-hash-map' to map a function across all the
30;; messages. Use `imap-hash-get' and `imap-hash-rem' to operate on
31;; individual messages. See the tramp-imap.el library in Tramp if you
32;; need to see practical examples.
33
34;; This only works with IMAP4r1. Sorry to everyone without it, but
35;; the compatibility code is too annoying and it's 2009.
36
37;; TODO: Use SEARCH instead of FETCH when a test is specified. List
38;; available mailboxes. Don't select an invalid mailbox.
39
40;;; Code:
41
42(require 'assoc)
43(require 'imap)
44(require 'sendmail) ; for mail-header-separator
45(require 'message)
46(autoload 'auth-source-search "auth-source")
47
48;; retrieve these headers
49(defvar imap-hash-headers
50 (append '(Subject From Date Message-Id References In-Reply-To Xref)))
51
52;; from nnheader.el
53(defsubst imap-hash-remove-cr-followed-by-lf ()
54 (goto-char (point-max))
55 (while (search-backward "\r\n" nil t)
56 (delete-char 1)))
57
58;; from nnheader.el
59(defun imap-hash-ms-strip-cr (&optional string)
60 "Strip ^M from the end of all lines in current buffer or STRING."
61 (if string
62 (with-temp-buffer
63 (insert string)
64 (imap-hash-remove-cr-followed-by-lf)
65 (buffer-string))
66 (save-excursion
67 (imap-hash-remove-cr-followed-by-lf))))
68
69(defun imap-hash-make (server port mailbox &optional user password ssl)
70 "Make a new imap-hash object using SERVER, PORT, and MAILBOX.
71USER, PASSWORD and SSL are optional.
72The test is set to t, meaning all messages are considered."
73 (when (and server port mailbox)
74 (list :server server :port port :mailbox mailbox
75 :ssl ssl :user user :password password
76 :test t)))
77
78(defun imap-hash-p (iht)
79 "Check whether IHT is a valid imap-hash."
80 (and
81 (imap-hash-server iht)
82 (imap-hash-port iht)
83 (imap-hash-mailbox iht)
84 (imap-hash-test iht)))
85
86(defmacro imap-hash-gather (uid)
87 `(imap-message-get ,uid 'BODYDETAIL))
88
89(defmacro imap-hash-data-body (details)
90 `(nth 2 (nth 1 ,details)))
91
92(defmacro imap-hash-data-headers (details)
93 `(nth 2 (nth 0 ,details)))
94
95(defun imap-hash-get (key iht &optional refetch)
96 "Get the value for KEY in the imap-hash IHT.
97Requires either `imap-hash-fetch' to be called beforehand
98\(e.g. by `imap-hash-map'), or REFETCH to be t.
99Returns a list of the headers (an alist, see `imap-hash-map') and
100the body of the message as a string.
101Also see `imap-hash-test'."
102 (with-current-buffer (imap-hash-get-buffer iht)
103 (when refetch
104 (imap-hash-fetch iht nil key))
105 (let ((details (imap-hash-gather key)))
106 (list
107 (imap-hash-get-headers
108 (imap-hash-data-headers details))
109 (imap-hash-get-body
110 (imap-hash-data-body details))))))
111
112(defun imap-hash-put (value iht &optional key)
113 "Put VALUE in the imap-hash IHT. Return the new key.
114If KEY is given, removes it.
115VALUE can be a list of the headers (an alist, see `imap-hash-map')
116and the body of the message as a string. It can also be a uid,
117in which case `imap-hash-get' will be called to get the value.
118Also see `imap-hash-test'."
119 (let ((server-buffer (imap-hash-get-buffer iht))
120 (value (if (listp value) value (imap-hash-get value iht)))
121 newuid)
122 (when value
123 (with-temp-buffer
124 (funcall 'imap-hash-make-message
125 (nth 0 value)
126 (nth 1 value)
127 nil)
128 (setq newuid (nth 1 (imap-message-append
129 (imap-hash-mailbox iht)
130 (current-buffer) nil nil server-buffer)))
131 (when key (imap-hash-rem key iht))))
132 newuid))
133
134(defun imap-hash-make-message (headers body &optional overrides)
135 "Make a message with HEADERS and BODY suitable for `imap-append',
136using `message-setup'.
137Look in the alist OVERRIDES for header overrides as per `imap-hash-headers'."
138 ;; don't insert a signature no matter what
139 (let (message-signature)
140 (message-setup
141 (append overrides headers))
142 (message-generate-headers message-required-mail-headers)
143 (message-remove-header "X-Draft-From")
144 (message-goto-body)
145 (insert (or (aget overrides 'body)
146 body
147 ""))
148 (goto-char (point-min))
149 ;; TODO: make this search better
150 (if (search-forward mail-header-separator nil t)
151 (delete-region (line-beginning-position) (line-end-position))
152 (error "Could not find the body separator in the encoded message!"))))
153
154(defun imap-hash-rem (key iht)
155 "Remove KEY in the imap-hash IHT.
156Also see `imap-hash-test'. Requires `imap-hash-fetch' to have
157been called and the imap-hash server buffer to be current,
158so it's best to use it inside `imap-hash-map'.
159The key will not be found on the next `imap-hash-map' call."
160 (with-current-buffer (imap-hash-get-buffer iht)
161 (imap-message-flags-add
162 (imap-range-to-message-set (list key))
163 "\\Deleted" 'silent)
164 (imap-mailbox-expunge t)))
165
166(defun imap-hash-clear (iht)
167 "Remove all keys in the imap-hash IHT.
168Also see `imap-hash-test'."
169 (imap-hash-map (lambda (uid b c) (imap-hash-rem uid iht)) iht))
170
171(defun imap-hash-get-headers (text-headers)
172 (with-temp-buffer
173 (insert (or text-headers ""))
174 (imap-hash-remove-cr-followed-by-lf)
175 (mapcar (lambda (header)
176 (cons header
177 (message-fetch-field (format "%s" header))))
178 imap-hash-headers)))
179
180(defun imap-hash-get-body (text)
181 (with-temp-buffer
182 (insert (or text ""))
183 (imap-hash-remove-cr-followed-by-lf)
184 (buffer-string)))
185
186(defun imap-hash-map (function iht &optional headers-only &rest messages)
187 "Call FUNCTION for all entries in IHT and pass it the message uid,
188the headers (an alist, see `imap-hash-headers'), and the body
189contents as a string. If HEADERS-ONLY is not nil, the body will be nil.
190Returns results of evaluating, as would `mapcar'.
191If MESSAGES are given, iterate only over those UIDs.
192Also see `imap-hash-test'."
193 (imap-hash-fetch iht headers-only)
194 (let ((test (imap-hash-test iht)))
195 (with-current-buffer (imap-hash-get-buffer iht)
196 (delq nil
197 (imap-message-map (lambda (message ignored-parameter)
198 (let* ((details (imap-hash-gather message))
199 (headers (imap-hash-data-headers details))
200 (hlist (imap-hash-get-headers headers))
201 (runit (cond
202 ((stringp test)
203 (string-match
204 test
205 (format "%s" (aget hlist 'Subject))))
206 ((functionp test)
207 (funcall test hlist))
208 ;; otherwise, return test itself
209 (t test))))
210 ;;(debug message headers)
211 (when runit
212 (funcall function
213 message
214 (imap-hash-get-headers
215 headers)
216 (imap-hash-get-body
217 (imap-hash-data-body details))))))
218 "UID")))))
219
220(defun imap-hash-count (iht)
221 "Count the number of messages in the imap-hash IHT.
222Also see `imap-hash-test'. It uses `imap-hash-map' so just use that
223function if you want to do more than count the elements."
224 (length (imap-hash-map (lambda (a b c)) iht t)))
225
226(defalias 'imap-hash-size 'imap-hash-count)
227
228(defun imap-hash-test (iht)
229 "Return the test used by `imap-hash-map' for IHT.
230When the test is t, any key will be a candidate.
231When the test is a string, messages will be filtered on that string as a
232regexp against the subject.
233When the test is a function, messages will be filtered with it.
234The function is passed the message headers (see `imap-hash-get-headers')."
235 (plist-get iht :test))
236
237(defun imap-hash-server (iht)
238 "Return the server used by the imap-hash IHT."
239 (plist-get iht :server))
240
241(defun imap-hash-port (iht)
242 "Return the port used by the imap-hash IHT."
243 (plist-get iht :port))
244
245(defun imap-hash-ssl (iht)
246 "Return the SSL need for the imap-hash IHT."
247 (plist-get iht :ssl))
248
249(defun imap-hash-mailbox (iht)
250 "Return the mailbox used by the imap-hash IHT."
251 (plist-get iht :mailbox))
252
253(defun imap-hash-user (iht)
254 "Return the username used by the imap-hash IHT."
255 (plist-get iht :user))
256
257(defun imap-hash-password (iht)
258 "Return the password used by the imap-hash IHT."
259 (plist-get iht :password))
260
261(defun imap-hash-open-connection (iht)
262 "Open the connection used for IMAP interactions with the imap-hash IHT."
263 (let* ((server (imap-hash-server iht))
264 (port (imap-hash-port iht))
265 (ssl-need (imap-hash-ssl iht))
266 (auth-need (not (and (imap-hash-user iht)
267 (imap-hash-password iht))))
268 ;; this will not be needed if auth-need is t
269 (auth-info (when auth-need
270 (nth 0 (auth-source-search :host server :port port))))
271 (auth-user (or (imap-hash-user iht)
272 (plist-get auth-info :user)))
273 (auth-passwd (or (imap-hash-password iht)
274 (plist-get auth-info :secret)))
275 (auth-passwd (if (functionp auth-passwd)
276 (funcall auth-passwd)
277 auth-passwd))
278 (imap-logout-timeout nil))
279
280 ;; (debug "opening server: opened+state" (imap-opened) imap-state)
281 ;; this is the only place where IMAP vs IMAPS matters
282 (if (imap-open server port (if ssl-need 'ssl nil) nil (current-buffer))
283 (progn
284 ;; (debug "after opening server: opened+state" (imap-opened (current-buffer)) imap-state)
285 ;; (debug "authenticating" auth-user auth-passwd)
286 (if (not (imap-capability 'IMAP4rev1))
287 (error "IMAP server does not support IMAP4r1, it won't work, sorry")
288 (imap-authenticate auth-user auth-passwd)
289 (imap-id)
290 ;; (debug "after authenticating: opened+state" (imap-opened (current-buffer)) imap-state)
291 (imap-opened (current-buffer))))
292 (error "Could not open the IMAP buffer"))))
293
294(defun imap-hash-get-buffer (iht)
295 "Get or create the connection buffer to be used for the imap-hash IHT."
296 (let* ((name (imap-hash-buffer-name iht))
297 (buffer (get-buffer name)))
298 (if (and buffer (imap-opened buffer))
299 buffer
300 (when buffer (kill-buffer buffer))
301 (with-current-buffer (get-buffer-create name)
302 (setq buffer-undo-list t)
303 (when (imap-hash-open-connection iht)
304 (current-buffer))))))
305
306(defun imap-hash-buffer-name (iht)
307 "Get the connection buffer to be used for the imap-hash IHT."
308 (when (imap-hash-p iht)
309 (let ((server (imap-hash-server iht))
310 (port (imap-hash-port iht))
311 (ssl-text (if (imap-hash-ssl iht) "SSL" "NoSSL")))
312 (format "*imap-hash/%s:%s:%s*" server port ssl-text))))
313
314(defun imap-hash-fetch (iht &optional headers-only &rest messages)
315 "Fetch all the messages for imap-hash IHT.
316Get only the headers if HEADERS-ONLY is not nil."
317 (with-current-buffer (imap-hash-get-buffer iht)
318 (let ((range (if messages
319 (list
320 (imap-range-to-message-set messages)
321 (imap-range-to-message-set messages))
322 '("1:*" . "1,*:*"))))
323
324 ;; (with-current-buffer "*imap-debug*"
325 ;; (erase-buffer))
326 (imap-mailbox-unselect)
327 (imap-mailbox-select (imap-hash-mailbox iht))
328 ;; (debug "after selecting mailbox: opened+state" (imap-opened) imap-state)
329 ;; (setq imap-message-data (make-vector imap-message-prime 0)
330 (imap-fetch-safe range
331 (concat (format "(UID RFC822.SIZE BODY %s "
332 (if headers-only "" "BODY.PEEK[TEXT]"))
333 (format "BODY.PEEK[HEADER.FIELDS %s])"
334 imap-hash-headers))))))
335
336(provide 'imap-hash)
337;;; imap-hash.el ends here
338
339;; ignore, for testing only
340
341;;; (setq iht (imap-hash-make "yourhosthere.com" "imap" "INBOX.test"))
342;;; (setq iht (imap-hash-make "yourhosthere.com" "imap" "test"))
343;;; (imap-hash-make "server1" "INBOX.mailbox2")
344;;; (imap-hash-p iht)
345;;; (imap-hash-get 35 iht)
346;;; (imap-hash-get 38 iht)
347;;; (imap-hash-get 37 iht t)
348;;; (mapc (lambda (buffer) (with-current-buffer buffer (erase-buffer))) '("*imap-debug*" "*imap-log*"))
349;;; (imap-hash-put (imap-hash-get 5 iht) iht)
350;;; (with-current-buffer (imap-hash-get-buffer iht) (let ((uid (imap-hash-put (imap-hash-get 5 iht) iht))) (imap-hash-put uid iht uid)))
351;;; (imap-hash-put (imap-hash-get 35 iht) iht)
352;;; (imap-hash-make-message '((Subject . "normal")) "normal body")
353;;; (imap-hash-make-message '((Subject . "old")) "old body" '((Subject . "new")))
354;;; (imap-hash-make-message '((Subject . "old")) "old body" '((body . "new body")) (lambda (subject) (concat "overwrite-" subject)))
355;;; (imap-hash-make-message '((Subject . "old")) "old body" '((Subject . "change this")) (lambda (subject) (concat "overwrite-" subject)))
356;;; (imap-hash-make-message '((Subject . "Twelcome")) "body here" nil)
357;; (with-current-buffer (imap-hash-get-buffer iht) (imap-hash-rem (imap-hash-put (imap-hash-get 5 iht) iht) iht))
358;;; (kill-buffer (imap-hash-buffer-name iht))
359;;; (imap-hash-map 'debug iht)
360;;; (imap-hash-map 'debug iht t)
361;;;(tramp-imap-handle-file-inode "/imap:yourhosthere.com:/test/welcome")
362;;;(imap-hash-count iht)
363;;; (mapc (lambda (buffer) (with-current-buffer buffer (erase-buffer))) '("*imap-debug*" "*imap-log*"))
364;;; (kill-buffer (imap-hash-buffer-name iht))
365;;; this should always return t if the server is up, automatically reopening if needed
366;;; (imap-opened (imap-hash-get-buffer iht))
367;;; (imap-hash-buffer-name iht)
368;;; (with-current-buffer (imap-hash-get-buffer iht) (debug "mailbox data, auth and state" imap-mailbox-data imap-auth imap-state))
369;;;(tramp-imap-handle-file-inode "/imap:yourhosthere.com:/test/welcome")
370;;; (imap-hash-fetch iht nil)
371;;; (imap-hash-fetch iht t)
372;;; (imap-hash-fetch iht nil 1 2 3)
373;;; (imap-hash-fetch iht t 1 2 3)
374
diff --git a/lisp/net/tramp-imap.el b/lisp/net/tramp-imap.el
deleted file mode 100644
index 4157265b0e1..00000000000
--- a/lisp/net/tramp-imap.el
+++ /dev/null
@@ -1,850 +0,0 @@
1;;; tramp-imap.el --- Tramp interface to IMAP through imap.el
2
3;; Copyright (C) 2009-2011 Free Software Foundation, Inc.
4
5;; Author: Teodor Zlatanov <tzz@lifelogs.com>
6;; Keywords: mail, comm
7;; Package: tramp
8
9;; This file is part of GNU Emacs.
10
11;; GNU Emacs is free software: you can redistribute it and/or modify
12;; it under the terms of the GNU General Public License as published by
13;; the Free Software Foundation, either version 3 of the License, or
14;; (at your option) any later version.
15
16;; GNU Emacs is distributed in the hope that it will be useful,
17;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;; GNU General Public License for more details.
20
21;; You should have received a copy of the GNU General Public License
22;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
23
24;;; Commentary:
25
26;; Package to provide Tramp over IMAP
27
28;;; Setup:
29
30;; just load and open files, e.g.
31;; /imaps:user@yourhosthere.com:/INBOX.test/1
32;; or
33;; /imap:user@yourhosthere.com:/INBOX.test/1
34
35;; where `imap' goes over IMAP, while `imaps' goes over IMAP+SSL
36
37;; This module will use imap-hash.el to access the IMAP mailbox.
38
39;; This module will use auth-source.el to authenticate against the
40;; IMAP server, PLUS it will use auth-source.el to get your passphrase
41;; for the symmetrically encrypted messages. For the former, use the
42;; usual IMAP ports. For the latter, use the port "tramp-imap".
43
44;; example .authinfo / .netrc file:
45
46;; machine yourhosthere.com port tramp-imap login USER password SYMMETRIC-PASSPHRASE
47
48;; note above is the symmetric encryption passphrase for GPG
49;; below is the regular password for IMAP itself and other things on that host
50
51;; machine yourhosthere.com login USER password NORMAL-PASSWORD
52
53
54;;; Code:
55
56(require 'assoc)
57(require 'tramp)
58
59(autoload 'auth-source-search "auth-source")
60(autoload 'epg-context-operation "epg")
61(autoload 'epg-context-set-armor "epg")
62(autoload 'epg-context-set-passphrase-callback "epg")
63(autoload 'epg-context-set-progress-callback "epg")
64(autoload 'epg-decrypt-string "epg")
65(autoload 'epg-encrypt-string "epg")
66(autoload 'epg-make-context "epg")
67(autoload 'imap-hash-get "imap-hash")
68(autoload 'imap-hash-make "imap-hash")
69(autoload 'imap-hash-map "imap-hash")
70(autoload 'imap-hash-put "imap-hash")
71(autoload 'imap-hash-rem "imap-hash")
72
73;; We use the additional header "X-Size" for encoding the size of a file.
74(eval-after-load "imap-hash"
75 '(add-to-list 'imap-hash-headers 'X-Size 'append))
76
77;; Define Tramp IMAP method ...
78;;;###tramp-autoload
79(defconst tramp-imap-method "imap"
80 "*Method to connect via IMAP protocol.")
81
82;;;###tramp-autoload
83(when (and (locate-library "epa") (locate-library "imap-hash"))
84 (add-to-list 'tramp-methods
85 (list tramp-imap-method '(tramp-default-port 143))))
86
87;; Define Tramp IMAPS method ...
88;;;###tramp-autoload
89(defconst tramp-imaps-method "imaps"
90 "*Method to connect via secure IMAP protocol.")
91
92;; ... and add it to the method list.
93;;;###tramp-autoload
94(when (and (locate-library "epa") (locate-library "imap-hash"))
95 (add-to-list 'tramp-methods
96 (list tramp-imaps-method '(tramp-default-port 993))))
97
98;; Add a default for `tramp-default-user-alist'. Default is the local user.
99;;;###tramp-autoload
100(add-to-list
101 'tramp-default-user-alist
102 (list (concat "\\`"
103 (regexp-opt (list tramp-imap-method tramp-imaps-method))
104 "\\'")
105 nil (user-login-name)))
106
107;; Add completion function for IMAP method.
108;; (tramp-set-completion-function
109;; tramp-imap-method tramp-completion-function-alist-ssh) ; TODO: test this
110;; tramp-imaps-method tramp-completion-function-alist-ssh) ; TODO: test this
111
112;; New handlers should be added here.
113(defconst tramp-imap-file-name-handler-alist
114 '(
115 ;; `access-file' performed by default handler
116 (add-name-to-file . ignore)
117 ;; `byte-compiler-base-file-name' performed by default handler
118 ;; `copy-directory' performed by default handler
119 (copy-file . tramp-imap-handle-copy-file)
120 (delete-directory . ignore) ;; tramp-imap-handle-delete-directory)
121 (delete-file . tramp-imap-handle-delete-file)
122 ;; `diff-latest-backup-file' performed by default handler
123 (directory-file-name . tramp-handle-directory-file-name)
124 (directory-files . tramp-handle-directory-files)
125 (directory-files-and-attributes
126 . tramp-handle-directory-files-and-attributes)
127 (dired-call-process . ignore)
128 ;; `dired-compress-file' performed by default handler
129 ;; `dired-uncache' performed by default handler
130 (expand-file-name . tramp-imap-handle-expand-file-name)
131 ;; `file-accessible-directory-p' performed by default handler
132 (file-attributes . tramp-imap-handle-file-attributes)
133 (file-directory-p . tramp-imap-handle-file-directory-p)
134 (file-executable-p . ignore)
135 (file-exists-p . tramp-handle-file-exists-p)
136 (file-local-copy . tramp-imap-handle-file-local-copy)
137 (file-modes . tramp-handle-file-modes)
138 (file-name-all-completions . tramp-imap-handle-file-name-all-completions)
139 (file-name-as-directory . tramp-handle-file-name-as-directory)
140 (file-name-completion . tramp-handle-file-name-completion)
141 (file-name-directory . tramp-handle-file-name-directory)
142 (file-name-nondirectory . tramp-handle-file-name-nondirectory)
143 ;; `file-name-sans-versions' performed by default handler
144 (file-newer-than-file-p . tramp-handle-file-newer-than-file-p)
145 (file-ownership-preserved-p . ignore)
146 (file-readable-p . tramp-handle-file-exists-p)
147 (file-regular-p . tramp-handle-file-regular-p)
148 (file-remote-p . tramp-handle-file-remote-p)
149 ;; `file-selinux-context' performed by default handler.
150 (file-symlink-p . tramp-handle-file-symlink-p)
151 ;; `file-truename' performed by default handler
152 (file-writable-p . tramp-imap-handle-file-writable-p)
153 (find-backup-file-name . tramp-handle-find-backup-file-name)
154 ;; `find-file-noselect' performed by default handler
155 ;; `get-file-buffer' performed by default handler
156 (insert-directory . tramp-imap-handle-insert-directory)
157 (insert-file-contents . tramp-imap-handle-insert-file-contents)
158 (load . tramp-handle-load)
159 (make-directory . ignore) ;; tramp-imap-handle-make-directory)
160 (make-directory-internal . ignore) ;; tramp-imap-handle-make-directory-internal)
161 (make-symbolic-link . ignore)
162 (rename-file . tramp-imap-handle-rename-file)
163 (set-file-modes . ignore)
164 ;; `set-file-selinux-context' performed by default handler.
165 (set-file-times . ignore) ;; tramp-imap-handle-set-file-times)
166 (set-visited-file-modtime . ignore)
167 (shell-command . ignore)
168 (substitute-in-file-name . tramp-handle-substitute-in-file-name)
169 (unhandled-file-name-directory . tramp-handle-unhandled-file-name-directory)
170 (vc-registered . ignore)
171 (verify-visited-file-modtime . ignore)
172 (write-region . tramp-imap-handle-write-region)
173 (executable-find . ignore)
174 (start-file-process . ignore)
175 (process-file . ignore)
176)
177 "Alist of handler functions for Tramp IMAP method.
178Operations not mentioned here will be handled by the default Emacs primitives.")
179
180(defgroup tramp-imap nil
181 "Tramp over IMAP configuration."
182 :version "23.2"
183 :group 'tramp)
184
185(defcustom tramp-imap-subject-marker "tramp-imap-subject-marker"
186 "The subject marker that Tramp-IMAP will use."
187 :type 'string
188 :version "23.2"
189 :group 'tramp-imap)
190
191;; TODO: these will be defcustoms later.
192(defvar tramp-imap-passphrase-cache nil) ;; can be t or 'never
193(defvar tramp-imap-passphrase nil)
194
195;;;###tramp-autoload
196(defsubst tramp-imap-file-name-p (filename)
197 "Check if it's a filename for IMAP protocol."
198 (let ((v (tramp-dissect-file-name filename)))
199 (or
200 (string= (tramp-file-name-method v) tramp-imap-method)
201 (string= (tramp-file-name-method v) tramp-imaps-method))))
202
203;;;###tramp-autoload
204(defun tramp-imap-file-name-handler (operation &rest args)
205 "Invoke the IMAP related OPERATION.
206First arg specifies the OPERATION, second arg is a list of arguments to
207pass to the OPERATION."
208 (let ((fn (assoc operation tramp-imap-file-name-handler-alist)))
209 (if fn
210 (save-match-data (apply (cdr fn) args))
211 (tramp-run-real-handler operation args))))
212
213;;;###tramp-autoload
214(when (and (locate-library "epa") (locate-library "imap-hash"))
215 (add-to-list 'tramp-foreign-file-name-handler-alist
216 (cons 'tramp-imap-file-name-p 'tramp-imap-file-name-handler)))
217
218(defun tramp-imap-handle-copy-file
219 (filename newname &optional ok-if-already-exists keep-date
220 preserve-uid-gid preserve-selinux-context)
221 "Like `copy-file' for Tramp files."
222 (tramp-imap-do-copy-or-rename-file
223 'copy filename newname ok-if-already-exists keep-date preserve-uid-gid))
224
225(defun tramp-imap-handle-rename-file
226 (filename newname &optional ok-if-already-exists)
227 "Like `rename-file' for Tramp files."
228 (tramp-imap-do-copy-or-rename-file
229 'rename filename newname ok-if-already-exists t t))
230
231(defun tramp-imap-do-copy-or-rename-file
232 (op filename newname &optional ok-if-already-exists keep-date preserve-uid-gid)
233 "Copy or rename a remote file.
234OP must be `copy' or `rename' and indicates the operation to perform.
235FILENAME specifies the file to copy or rename, NEWNAME is the name of
236the new file (for copy) or the new name of the file (for rename).
237OK-IF-ALREADY-EXISTS means don't barf if NEWNAME exists already.
238KEEP-DATE means to make sure that NEWNAME has the same timestamp
239as FILENAME. PRESERVE-UID-GID, when non-nil, instructs to keep
240the uid and gid if both files are on the same host.
241
242This function is invoked by `tramp-imap-handle-copy-file' and
243`tramp-imap-handle-rename-file'. It is an error if OP is neither
244of `copy' and `rename'."
245 (unless (memq op '(copy rename))
246 (error "Unknown operation `%s', must be `copy' or `rename'" op))
247 (setq filename (expand-file-name filename))
248 (setq newname (expand-file-name newname))
249 (when (file-directory-p newname)
250 (setq newname (expand-file-name (file-name-nondirectory filename) newname)))
251
252 (let ((t1 (and (tramp-tramp-file-p filename)
253 (tramp-imap-file-name-p filename)))
254 (t2 (and (tramp-tramp-file-p newname)
255 (tramp-imap-file-name-p newname))))
256
257 (with-parsed-tramp-file-name (if t1 filename newname) nil
258 (when (and (not ok-if-already-exists) (file-exists-p newname))
259 (tramp-error
260 v 'file-already-exists "File %s already exists" newname))
261
262 (with-progress-reporter
263 v 0 (format "%s %s to %s"
264 (if (eq op 'copy) "Copying" "Renaming")
265 filename newname)
266
267 ;; We just make a local copy of FILENAME, and write it then to
268 ;; NEWNAME. This must be optimized when both files are
269 ;; located on the same IMAP server.
270 (with-temp-buffer
271 (if (and t1 t2)
272 ;; We don't encrypt.
273 (with-parsed-tramp-file-name newname v1
274 (insert (tramp-imap-get-file filename nil))
275 (tramp-imap-put-file
276 v1 (current-buffer)
277 (tramp-imap-file-name-name v1)
278 nil nil (nth 7 (file-attributes filename))))
279 ;; One of them is not located on a IMAP mailbox.
280 (insert-file-contents filename)
281 (write-region (point-min) (point-max) newname)))))
282
283 (when (eq op 'rename) (delete-file filename))))
284
285;; TODO: revise this much
286(defun tramp-imap-handle-expand-file-name (name &optional dir)
287 "Like `expand-file-name' for Tramp files."
288 ;; If DIR is not given, use DEFAULT-DIRECTORY or "/".
289 (setq dir (or dir default-directory "/"))
290 ;; Unless NAME is absolute, concat DIR and NAME.
291 (unless (file-name-absolute-p name)
292 (setq name (concat (file-name-as-directory dir) name)))
293 ;; If NAME is not a Tramp file, run the real handler.
294 (if (or (tramp-completion-mode-p) (not (tramp-tramp-file-p name)))
295 (tramp-drop-volume-letter
296 (tramp-run-real-handler 'expand-file-name (list name nil)))
297 ;; Dissect NAME.
298 (with-parsed-tramp-file-name name nil
299 (unless (tramp-run-real-handler 'file-name-absolute-p (list localname))
300 (setq localname (concat "/" localname)))
301 ;; There might be a double slash, for example when "~/"
302 ;; expands to "/". Remove this.
303 (while (string-match "//" localname)
304 (setq localname (replace-match "/" t t localname)))
305 ;; Do normal `expand-file-name' (this does "/./" and "/../").
306 ;; We bind `directory-sep-char' here for XEmacs on Windows,
307 ;; which would otherwise use backslash. `default-directory' is
308 ;; bound, because on Windows there would be problems with UNC
309 ;; shares or Cygwin mounts.
310 (let ((default-directory (tramp-compat-temporary-file-directory)))
311 (tramp-make-tramp-file-name
312 method user host
313 (tramp-drop-volume-letter
314 (tramp-run-real-handler
315 'expand-file-name (list localname))))))))
316
317;; This function should return "foo/" for directories and "bar" for
318;; files.
319(defun tramp-imap-handle-file-name-all-completions (filename directory)
320 "Like `file-name-all-completions' for Tramp files."
321 (all-completions
322 filename
323 (with-parsed-tramp-file-name (expand-file-name directory) nil
324 (save-match-data
325 (let ((entries
326 (tramp-imap-get-file-entries v localname)))
327 (mapcar
328 (lambda (x)
329 (list
330 (if (string-match "d" (nth 9 x))
331 (file-name-as-directory (nth 0 x))
332 (nth 0 x))))
333 entries))))))
334
335(defun tramp-imap-get-file-entries (vec localname &optional exact)
336 "Read entries returned by IMAP server. EXACT limits to exact matches.
337Result is a list of (LOCALNAME LINK COUNT UID GID ATIME MTIME CTIME
338SIZE MODE WEIRD INODE DEVICE)."
339 (tramp-message vec 5 "working on %s" localname)
340 (let* ((name (tramp-imap-file-name-name vec))
341 (search-name (or name ""))
342 (search-name (if exact (concat search-name "$") search-name))
343 (iht (tramp-imap-make-iht vec search-name)))
344;; TODO: catch errors
345 ;; (tramp-error vec 'none "bad name %s or mailbox %s" name mbox))
346 (imap-hash-map (lambda (uid headers body)
347 (let ((subject (substring
348 (aget headers 'Subject "")
349 (length tramp-imap-subject-marker)))
350 (from (aget headers 'From ""))
351 (date (date-to-time (aget headers 'Date "")))
352 (size (string-to-number
353 (or (aget headers 'X-Size "0") "0"))))
354 (setq from
355 (if (string-match "<\\([^@]+\\)@" from)
356 (match-string 1 from)
357 "nobody"))
358 (list
359 subject
360 nil
361 -1
362 from
363 "nogroup"
364 date
365 date
366 date
367 size
368 "-rw-rw-rw-"
369 nil
370 uid
371 (tramp-get-device vec))))
372 iht t)))
373
374(defun tramp-imap-handle-write-region (start end filename &optional append visit lockname confirm)
375 "Like `write-region' for Tramp files."
376 (setq filename (expand-file-name filename))
377 (with-parsed-tramp-file-name filename nil
378 ;; XEmacs takes a coding system as the seventh argument, not `confirm'.
379 (when (and (not (featurep 'xemacs))
380 confirm (file-exists-p filename))
381 (unless (y-or-n-p (format "File %s exists; overwrite anyway? "
382 filename))
383 (tramp-error v 'file-error "File not overwritten")))
384 (tramp-flush-file-property v localname)
385 (let* ((old-buffer (current-buffer))
386 (inode (tramp-imap-get-file-inode filename))
387 (min 1)
388 (max (point-max))
389 ;; Make sure we have good start and end values.
390 (start (or start min))
391 (end (or end max))
392 temp-buffer)
393 (with-temp-buffer
394 (setq temp-buffer (if (and (eq start min) (eq end max))
395 old-buffer
396 ;; If this is a region write, insert the substring.
397 (insert
398 (with-current-buffer old-buffer
399 (buffer-substring-no-properties start end)))
400 (current-buffer)))
401 (tramp-imap-put-file v
402 temp-buffer
403 (tramp-imap-file-name-name v)
404 inode
405 t)))
406 (when (eq visit t)
407 (set-visited-file-modtime))))
408
409(defun tramp-imap-handle-insert-directory
410 (filename switches &optional wildcard full-directory-p)
411 "Like `insert-directory' for Tramp files."
412 (setq filename (expand-file-name filename))
413 (if full-directory-p
414 ;; Called from `dired-add-entry'.
415 (setq filename (file-name-as-directory filename))
416 (setq filename (directory-file-name filename)))
417 (with-parsed-tramp-file-name filename nil
418 (save-match-data
419 (let ((base (file-name-nondirectory localname))
420 (entries (copy-sequence
421 (tramp-imap-get-file-entries
422 v (file-name-directory localname)))))
423
424 (when wildcard
425 (when (string-match "\\." base)
426 (setq base (replace-match "\\\\." nil nil base)))
427 (when (string-match "\\*" base)
428 (setq base (replace-match ".*" nil nil base)))
429 (when (string-match "\\?" base)
430 (setq base (replace-match ".?" nil nil base))))
431
432 ;; Filter entries.
433 (setq entries
434 (delq
435 nil
436 (if (or wildcard (zerop (length base)))
437 ;; Check for matching entries.
438 (mapcar
439 (lambda (x)
440 (when (string-match
441 (format "^%s" base) (nth 0 x))
442 x))
443 entries)
444 ;; We just need the only and only entry FILENAME.
445 (list (assoc base entries)))))
446
447 ;; Sort entries.
448 (setq entries
449 (sort
450 entries
451 (lambda (x y)
452 (if (string-match "t" switches)
453 ;; Sort by date.
454 (tramp-time-less-p (nth 6 y) (nth 6 x))
455 ;; Sort by name.
456 (string-lessp (nth 0 x) (nth 0 y))))))
457
458 ;; Handle "-F" switch.
459 (when (string-match "F" switches)
460 (mapc
461 (lambda (x)
462 (when (not (zerop (length (car x))))
463 (cond
464 ((char-equal ?d (string-to-char (nth 9 x)))
465 (setcar x (concat (car x) "/")))
466 ((char-equal ?x (string-to-char (nth 9 x)))
467 (setcar x (concat (car x) "*"))))))
468 entries))
469
470 ;; Print entries.
471 (mapcar
472 (lambda (x)
473 (when (not (zerop (length (nth 0 x))))
474 (insert
475 (format
476 "%10s %3d %-8s %-8s %8s %s "
477 (nth 9 x) ; mode
478 (nth 11 x) ; inode
479 (nth 3 x) ; uid
480 (nth 4 x) ; gid
481 (nth 8 x) ; size
482 (format-time-string
483 (if (tramp-time-less-p
484 (tramp-time-subtract (current-time) (nth 6 x))
485 tramp-half-a-year)
486 "%b %e %R"
487 "%b %e %Y")
488 (nth 6 x)))) ; date
489 ;; For the file name, we set the `dired-filename'
490 ;; property. This allows to handle file names with
491 ;; leading or trailing spaces as well. The inserted name
492 ;; could be from somewhere else, so we use the relative
493 ;; file name of `default-directory'.
494 (let ((pos (point)))
495 (insert
496 (format
497 "%s\n"
498 (file-relative-name
499 (expand-file-name (nth 0 x) (file-name-directory filename)))))
500 (put-text-property pos (1- (point)) 'dired-filename t))
501 (forward-line)
502 (beginning-of-line)))
503 entries)))))
504
505(defun tramp-imap-handle-insert-file-contents
506 (filename &optional visit beg end replace)
507 "Like `insert-file-contents' for Tramp files."
508 (barf-if-buffer-read-only)
509 (when visit
510 (setq buffer-file-name (expand-file-name filename))
511 (set-visited-file-modtime)
512 (set-buffer-modified-p nil))
513 (with-parsed-tramp-file-name filename nil
514 (if (not (file-exists-p filename))
515 (tramp-error
516 v 'file-error "File `%s' not found on remote host" filename)
517 (let ((point (point))
518 size data)
519 (with-progress-reporter v 3 (format "Fetching file %s" filename)
520 (insert (tramp-imap-get-file filename t))
521 (setq size (- (point) point))
522;;; TODO: handle ranges.
523;;; (let ((beg (or beg (point-min)))
524;;; (end (min (or end (point-max)) (point-max))))
525;;; (setq size (- end beg))
526;;; (buffer-substring beg end))
527 (goto-char point)
528 (list (expand-file-name filename) size))))))
529
530(defun tramp-imap-handle-file-directory-p (filename)
531 "Like `file-directory-p' for Tramp-IMAP files."
532 ;; We allow only mailboxes to be a directory.
533 (with-parsed-tramp-file-name (expand-file-name filename default-directory) nil
534 (and (string-match "^/[^/]*$" (directory-file-name localname)) t)))
535
536(defun tramp-imap-handle-file-attributes (filename &optional id-format)
537 "Like `file-attributes' for Tramp-IMAP FILENAME."
538 (with-parsed-tramp-file-name (expand-file-name filename) nil
539 (let ((res (cdr-safe (nth 0 (tramp-imap-get-file-entries v localname)))))
540 (unless (or (null res) (eq id-format 'string))
541 (setcar (nthcdr 2 res) 1)
542 (setcar (nthcdr 3 res) 1))
543 res)))
544
545(defun tramp-imap-get-file-inode (filename &optional id-format)
546 "Get inode equivalent \(actually the UID) for Tramp-IMAP FILENAME."
547 (nth 10 (tramp-compat-file-attributes filename id-format)))
548
549(defun tramp-imap-handle-file-writable-p (filename)
550 "Like `file-writable-p' for Tramp files. True for IMAP."
551 ;; `file-exists-p' does not work yet for directories.
552 ;; (file-exists-p (file-name-directory filename)))
553 (file-directory-p (file-name-directory filename)))
554
555(defun tramp-imap-handle-delete-file (filename &optional trash)
556 "Like `delete-file' for Tramp files."
557 (cond
558 ((not (file-exists-p filename)) nil)
559 (t (with-parsed-tramp-file-name (expand-file-name filename) nil
560 (let ((iht (tramp-imap-make-iht v)))
561 (imap-hash-rem (tramp-imap-get-file-inode filename) iht))))))
562
563(defun tramp-imap-handle-file-local-copy (filename)
564 "Like `file-local-copy' for Tramp files."
565 (with-parsed-tramp-file-name (expand-file-name filename) nil
566 (unless (file-exists-p filename)
567 (tramp-error
568 v 'file-error
569 "Cannot make local copy of non-existing file `%s'" filename))
570 (let ((tmpfile (tramp-compat-make-temp-file filename)))
571 (with-progress-reporter
572 v 3 (format "Fetching %s to tmp file %s" filename tmpfile)
573 (with-temp-buffer
574 (insert-file-contents filename)
575 (write-region (point-min) (point-max) tmpfile)
576 tmpfile)))))
577
578(defun tramp-imap-put-file
579 (vec filename-or-buffer &optional subject inode encode size)
580 "Write contents of FILENAME-OR-BUFFER to Tramp-IMAP file VEC with name SUBJECT.
581When INODE is given, delete that old remote file after writing the new one
582\(normally this is the old file with the same name). A non-nil ENCODE
583forces the encoding of the buffer or file. SIZE, when available, indicates
584the file size; this is needed, if the file or buffer is already encoded."
585 ;; `tramp-current-host' is used in `tramp-imap-passphrase-callback-function'.
586 (let ((tramp-current-host (tramp-file-name-real-host vec))
587 (iht (tramp-imap-make-iht vec)))
588 (imap-hash-put (list
589 (list (cons
590 'Subject
591 (format
592 "%s%s"
593 tramp-imap-subject-marker
594 (or subject "no subject")))
595 (cons
596 'X-Size
597 (number-to-string
598 (cond
599 ((numberp size) size)
600 ((bufferp filename-or-buffer)
601 (buffer-size filename-or-buffer))
602 ((stringp filename-or-buffer)
603 (nth 7 (file-attributes filename-or-buffer)))
604 ;; We don't know the size.
605 (t -1)))))
606 (cond ((bufferp filename-or-buffer)
607 (with-current-buffer filename-or-buffer
608 (if encode
609 (tramp-imap-encode-buffer)
610 (buffer-string))))
611 ;; TODO: allow file names.
612 (t "No body available")))
613 iht
614 inode)))
615
616(defun tramp-imap-get-file (filename &optional decode)
617 ;; (debug (tramp-imap-get-file-inode filename))
618 (with-parsed-tramp-file-name (expand-file-name filename) nil
619 (condition-case ()
620 ;; `tramp-current-host' is used in
621 ;; `tramp-imap-passphrase-callback-function'.
622 (let* ((tramp-current-host (tramp-file-name-real-host v))
623 (iht (tramp-imap-make-iht v))
624 (inode (tramp-imap-get-file-inode filename))
625 (data (imap-hash-get inode iht t)))
626 (if decode
627 (with-temp-buffer
628 (insert (nth 1 data))
629 ;;(debug inode (buffer-string))
630 (tramp-imap-decode-buffer))
631 (nth 1 data)))
632 (error (tramp-error
633 v 'file-error "File `%s' could not be read" filename)))))
634
635(defun tramp-imap-passphrase-callback-function (context key-id handback)
636 "Called by EPG to get a passphrase for Tramp-IMAP.
637CONTEXT is the encryption/decryption EPG context.
638HANDBACK is just carried through.
639KEY-ID can be 'SYM or 'PIN among others."
640 (let* ((server tramp-current-host)
641 (port "tramp-imap") ; this is NOT the server password!
642 (auth-passwd (plist-get
643 (nth 0 (auth-source-search :max 1
644 :host server
645 :port port))
646 :secret))
647 (auth-passwd (if (functionp auth-passwd)
648 (funcall auth-passwd)
649 auth-passwd)))
650 (or
651 (copy-sequence auth-passwd)
652 ;; If we cache the passphrase and we have one.
653 (if (and (eq tramp-imap-passphrase-cache t)
654 tramp-imap-passphrase)
655 ;; Do we reuse it?
656 (if (y-or-n-p "Reuse the passphrase? ")
657 (copy-sequence tramp-imap-passphrase)
658 ;; Don't reuse: revert caching behavior to nil, erase passphrase,
659 ;; call ourselves again.
660 (setq tramp-imap-passphrase-cache nil)
661 (setq tramp-imap-passphrase nil)
662 (tramp-imap-passphrase-callback-function context key-id handback))
663 (let ((p (if (eq key-id 'SYM)
664 (read-passwd
665 "Tramp-IMAP passphrase for symmetric encryption: "
666 (eq (epg-context-operation context) 'encrypt)
667 tramp-imap-passphrase)
668 (read-passwd
669 (if (eq key-id 'PIN)
670 "Tramp-IMAP passphrase for PIN: "
671 (let ((entry (assoc key-id
672 (symbol-value 'epg-user-id-alist))))
673 (if entry
674 (format "Tramp-IMAP passphrase for %s %s: "
675 key-id (cdr entry))
676 (format "Tramp-IMAP passphrase for %s: " key-id))))
677 nil
678 tramp-imap-passphrase))))
679
680 ;; If we have an answer, the passphrase has changed,
681 ;; the user hasn't declined keeping the passphrase,
682 ;; and they answer yes to keep it now...
683 (when (and
684 p
685 (not (equal tramp-imap-passphrase p))
686 (not (eq tramp-imap-passphrase-cache 'never))
687 (y-or-n-p "Keep the passphrase? "))
688 (setq tramp-imap-passphrase (copy-sequence p))
689 (setq tramp-imap-passphrase-cache t))
690
691 ;; If we still don't have a passphrase, the user didn't want
692 ;; to keep it.
693 (when (and
694 p
695 (not tramp-imap-passphrase))
696 (setq tramp-imap-passphrase-cache 'never))
697
698 p)))))
699
700(defun tramp-imap-encode-buffer ()
701 (let ((context (epg-make-context 'OpenPGP))
702 cipher)
703 (epg-context-set-armor context t)
704 (epg-context-set-passphrase-callback context
705 #'tramp-imap-passphrase-callback-function)
706 (epg-context-set-progress-callback context
707 (cons #'epa-progress-callback-function
708 "Encrypting..."))
709 (message "Encrypting...")
710 (setq cipher (epg-encrypt-string
711 context
712 (encode-coding-string (buffer-string) 'utf-8)
713 nil))
714 (message "Encrypting...done")
715 cipher))
716
717(defun tramp-imap-decode-buffer ()
718 (let ((context (epg-make-context 'OpenPGP))
719 plain)
720 (epg-context-set-passphrase-callback context
721 #'tramp-imap-passphrase-callback-function)
722 (epg-context-set-progress-callback context
723 (cons #'epa-progress-callback-function
724 "Decrypting..."))
725 (message "Decrypting...")
726 (setq plain (decode-coding-string
727 (epg-decrypt-string context (buffer-string))
728 'utf-8))
729 (message "Decrypting...done")
730 plain))
731
732(defun tramp-imap-file-name-mailbox (vec)
733 (nth 0 (tramp-imap-file-name-parse vec)))
734
735(defun tramp-imap-file-name-name (vec)
736 (nth 1 (tramp-imap-file-name-parse vec)))
737
738(defun tramp-imap-file-name-localname (vec)
739 (nth 1 (tramp-imap-file-name-parse vec)))
740
741(defun tramp-imap-file-name-parse (vec)
742 (let ((name (substring-no-properties (tramp-file-name-localname vec))))
743 (if (string-match "^/\\([^/]+\\)/?\\(.*\\)$" name)
744 (list (match-string 1 name)
745 (match-string 2 name))
746 nil)))
747
748(defun tramp-imap-make-iht (vec &optional needed-subject)
749 "Translate the Tramp vector VEC to the imap-hash structure.
750With NEEDED-SUBJECT, alters the imap-hash test accordingly."
751 (let* ((mbox (tramp-imap-file-name-mailbox vec))
752 (server (tramp-file-name-real-host vec))
753 (method (tramp-file-name-method vec))
754 (user (tramp-file-name-user vec))
755 (ssl (string-equal method tramp-imaps-method))
756 (port (tramp-file-name-port vec))
757 (result (imap-hash-make server port mbox user nil ssl)))
758 ;; Return the IHT with a test override to look for the subject
759 ;; marker.
760 (plist-put
761 result
762 :test (format "^%s%s"
763 tramp-imap-subject-marker
764 (if needed-subject needed-subject "")))))
765
766(add-hook 'tramp-unload-hook
767 (lambda ()
768 (unload-feature 'tramp-imap 'force)))
769
770;;; TODO:
771
772;; * Implement `tramp-imap-handle-delete-directory',
773;; `tramp-imap-handle-make-directory',
774;; `tramp-imap-handle-make-directory-internal',
775;; `tramp-imap-handle-set-file-times'.
776
777;; * Encode the subject. If the filename has trailing spaces (like
778;; "test "), those characters get lost, for example in dired listings.
779
780;; * When opening a dired buffer, like "/imap::INBOX.test", there are
781;; several error messages:
782;; "Buffer has a running process; kill it? (yes or no) "
783;; "error in process filter: Internal error, tag 6 status BAD code nil text No mailbox selected."
784;; Afterwards, everything seems to be fine.
785
786;; * imaps works for local IMAP servers. Accessing
787;; "/imaps:imap.gmail.com:/INBOX.test/" results in error
788;; "error in process filter: Internal error, tag 5 status BAD code nil text UNSELECT not allowed now."
789
790;; * Improve `tramp-imap-handle-file-attributes' for directories.
791
792;; * Saving a file creates a second one, instead of overwriting.
793
794;; * Backup files: just *one* is kept.
795
796;; * Password requests shall have a descriptive prompt.
797
798;; * Exiting Emacs, there are running IMAP processes. Make them quiet
799;; by `set-process-query-on-exit-flag'.
800
801(provide 'tramp-imap)
802;;; tramp-imap.el ends here
803
804;; Ignore, for testing only.
805
806;;; (setq tramp-imap-subject-marker "T")
807;;; (tramp-imap-get-file-entries (tramp-dissect-file-name "/imap:yourhosthere.com:/INBOX.test/4") t)
808;;; (tramp-imap-get-file-entries (tramp-dissect-file-name "/imap:yourhosthere.com:/INBOX.test/") t)
809;;; (tramp-imap-get-file-entries (tramp-dissect-file-name "/imap:yourhosthere.com:/test/4") t)
810;;; (tramp-imap-get-file-entries (tramp-dissect-file-name "/imap:yourhosthere.com:/test/") t)
811;;; (tramp-imap-get-file-entries (tramp-dissect-file-name "/imap:yourhosthere.com:/test/welcommen") t)
812;;; (tramp-imap-get-file-entries (tramp-dissect-file-name "/imap:yourhosthere.com:/test/welcommen") t t)
813;;;(tramp-imap-get-file-inode "/imap:yourhosthere.com:/test/welcome")
814;;; (dired-copy-file "/etc/fstab" "/imap:yourhosthere.com:/test/welcome" t)
815;;; (write-region 1 100 "/imap:yourhosthere.com:/test/welcome")
816;;; (tramp-imap-get-file "/imap:yourhosthere.com:/test/welcome" t)
817;;(with-temp-buffer (insert "hello") (write-file "/imap:yourhosthere.com:/test/welcome"))
818;;(with-temp-buffer (insert "hello") (write-file "/imap:yourhosthere.com:/test/welcome2"))
819;;(file-writable-p "/imap:yourhosthere.com:/test/welcome2")
820;;(file-name-directory "/imap:yourhosthere.com:/test/welcome2")
821;;(with-temp-buffer (insert "hello") (delete-file "/tmp/hellotest") (write-file "/tmp/hellotest") (write-file "/imap:yourhosthere.com:/test/welcome2"))
822;;;(file-exists-p "/imap:yourhosthere.com:/INBOX.test/4")
823;;;(file-attributes "/imap:yourhosthere.com:/INBOX.test/4")
824;;;(setq vec (tramp-dissect-file-name "/imap:yourhosthere.com:/INBOX.test/4"))
825;;;(tramp-imap-handle-file-attributes "/imap:yourhosthere.com:/INBOX.test/4")
826;;; (tramp-imap-handle-insert-file-contents "/imap:user@yourhosthere.com:/INBOX.test/4" nil nil nil nil)
827;;;(insert-file-contents "/imap:yourhosthere.com:/INBOX.test/4")
828;;;(file-attributes "/imap:yourhosthere.com:/test/welcommen")
829;;;(insert-file-contents "/imap:yourhosthere.com:/test/welcome")
830;;;(file-exists-p "/imap:yourhosthere.com:/test/welcome2")
831;;;(tramp-imap-handle-file-attributes "/imap:yourhosthere.com:/test/welcome")
832;;;(tramp-imap-get-file-inode "/imap:yourhosthere.com:/test/welcommen")
833;;;(tramp-imap-get-file-inode "/imap:yourhosthere.com:/test/welcome")
834;;;(file-writable-p "/imap:yourhosthere.com:/test/welcome2")
835;;; (delete-file "/imap:yourhosthere.com:/test/welcome")
836;;; (tramp-imap-get-file "/imap:yourhosthere.com:/test/welcommen" t)
837;;; (tramp-imap-get-file "/imap:yourhosthere.com:/test/welcome" t)
838;;;(tramp-imap-file-name-mailbox (tramp-dissect-file-name "/imap:yourhosthere.com:/INBOX.test"))
839;;;(tramp-imap-file-name-mailbox (tramp-dissect-file-name "/imap:yourhosthere.com:/INBOX.test/new/old"))
840;;;(tramp-imap-file-name-mailbox (tramp-dissect-file-name "/imap:yourhosthere.com:/INBOX.test/new"))
841;;;(tramp-imap-file-name-parse (tramp-dissect-file-name "/imap:yourhosthere.com:/INBOX.test/new/two"))
842;;;(tramp-imap-file-name-parse (tramp-dissect-file-name "/imap:yourhosthere.com:/INBOX.test/new/one"))
843;;;(tramp-imap-file-name-parse (tramp-dissect-file-name "/imap:yourhosthere.com:/INBOX.test"))
844;;; (tramp-imap-file-name-parse (tramp-dissect-file-name "/imap:yourhosthere.com:/test/4"))
845;;; (tramp-imap-file-name-parse (tramp-dissect-file-name "/imap:yourhosthere.com:/test/"))
846;;; (tramp-imap-file-name-parse (tramp-dissect-file-name "/imap:yourhosthere.com:/test/welcommen"))
847;;; (tramp-imap-file-name-parse (tramp-dissect-file-name "/imap:yourhosthere.com:/test/welcommen"))
848;;; (tramp-imap-make-iht (tramp-dissect-file-name "/imap:yourhosthere.com:/test/welcommen"))
849;;; (tramp-imap-make-iht (tramp-dissect-file-name "/imap:yourhosthere.com:/INBOX.test/4"))
850;;; (tramp-imap-make-iht (tramp-dissect-file-name "/imap:yourhosthere.com:/INBOX.test/4") "extra")
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 5d0f3935884..9be093743b5 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -3526,23 +3526,24 @@ Invokes `password-read' if available, `read-passwd' else."
3526 (with-parsed-tramp-file-name key nil 3526 (with-parsed-tramp-file-name key nil
3527 (prog1 3527 (prog1
3528 (or 3528 (or
3529 ;; See if auth-sources contains something useful, if it's bound. 3529 ;; See if auth-sources contains something useful, if it's
3530 ;; bound. `auth-source-user-or-password' is an obsoleted
3531 ;; function, it has been replaced by `auth-source-search'.
3530 (and (boundp 'auth-sources) 3532 (and (boundp 'auth-sources)
3531 (tramp-get-connection-property v "first-password-request" nil) 3533 (tramp-get-connection-property v "first-password-request" nil)
3532 ;; Try with Tramp's current method. 3534 ;; Try with Tramp's current method.
3533 (if (fboundp 'auth-source-search) 3535 (if (fboundp 'auth-source-search)
3534 (progn 3536 (setq auth-info
3535 (setq auth-info
3536 (tramp-compat-funcall 3537 (tramp-compat-funcall
3537 'auth-source-search 3538 'auth-source-search
3538 :max 1 3539 :max 1
3539 :user (or tramp-current-user t) 3540 :user (or tramp-current-user t)
3540 :host tramp-current-host 3541 :host tramp-current-host
3541 :port tramp-current-method)) 3542 :port tramp-current-method)
3542 (setq auth-passwd (plist-get (nth 0 auth-info) :secret)) 3543 auth-passwd (plist-get (nth 0 auth-info) :secret)
3543 (setq auth-passwd (if (functionp auth-passwd) 3544 auth-passwd (if (functionp auth-passwd)
3544 (funcall auth-passwd) 3545 (funcall auth-passwd)
3545 auth-passwd))) 3546 auth-passwd))
3546 (tramp-compat-funcall 3547 (tramp-compat-funcall
3547 'auth-source-user-or-password 3548 'auth-source-user-or-password
3548 "password" tramp-current-host tramp-current-method))) 3549 "password" tramp-current-host tramp-current-method)))
diff --git a/lisp/password-cache.el b/lisp/password-cache.el
index fcae55ad597..8738aa65a9f 100644
--- a/lisp/password-cache.el
+++ b/lisp/password-cache.el
@@ -111,9 +111,10 @@ that a password is invalid, so that `password-read' query the
111user again." 111user again."
112 (let ((password (symbol-value (intern-soft key password-data)))) 112 (let ((password (symbol-value (intern-soft key password-data))))
113 (when password 113 (when password
114 (if (fboundp 'clear-string) 114 (when (stringp password)
115 (clear-string password) 115 (if (fboundp 'clear-string)
116 (fillarray password ?_)) 116 (clear-string password)
117 (fillarray password ?_)))
117 (unintern key password-data)))) 118 (unintern key password-data))))
118 119
119(defun password-cache-add (key password) 120(defun password-cache-add (key password)
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index f90d29bf009..de1debd6456 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -5371,8 +5371,6 @@ comment at the start of cc-engine.el for more info."
5371;; cc-mode requires cc-fonts. 5371;; cc-mode requires cc-fonts.
5372(declare-function c-fontify-recorded-types-and-refs "cc-fonts" ()) 5372(declare-function c-fontify-recorded-types-and-refs "cc-fonts" ())
5373 5373
5374(defvar c-forward-<>-arglist-recur-depth)
5375
5376(defun c-forward-<>-arglist (all-types) 5374(defun c-forward-<>-arglist (all-types)
5377 ;; The point is assumed to be at a "<". Try to treat it as the open 5375 ;; The point is assumed to be at a "<". Try to treat it as the open
5378 ;; paren of an angle bracket arglist and move forward to the 5376 ;; paren of an angle bracket arglist and move forward to the
@@ -5398,8 +5396,7 @@ comment at the start of cc-engine.el for more info."
5398 ;; If `c-record-type-identifiers' is set then activate 5396 ;; If `c-record-type-identifiers' is set then activate
5399 ;; recording of any found types that constitute an argument in 5397 ;; recording of any found types that constitute an argument in
5400 ;; the arglist. 5398 ;; the arglist.
5401 (c-record-found-types (if c-record-type-identifiers t)) 5399 (c-record-found-types (if c-record-type-identifiers t)))
5402 (c-forward-<>-arglist-recur--depth 0))
5403 (if (catch 'angle-bracket-arglist-escape 5400 (if (catch 'angle-bracket-arglist-escape
5404 (setq c-record-found-types 5401 (setq c-record-found-types
5405 (c-forward-<>-arglist-recur all-types))) 5402 (c-forward-<>-arglist-recur all-types)))
@@ -5416,14 +5413,6 @@ comment at the start of cc-engine.el for more info."
5416 nil))) 5413 nil)))
5417 5414
5418(defun c-forward-<>-arglist-recur (all-types) 5415(defun c-forward-<>-arglist-recur (all-types)
5419
5420 ;; Temporary workaround for Bug#7722.
5421 (when (boundp 'c-forward-<>-arglist-recur--depth)
5422 (if (> c-forward-<>-arglist-recur--depth 200)
5423 (error "Max recursion depth reached in <> arglist")
5424 (setq c-forward-<>-arglist-recur--depth
5425 (1+ c-forward-<>-arglist-recur--depth))))
5426
5427 ;; Recursive part of `c-forward-<>-arglist'. 5416 ;; Recursive part of `c-forward-<>-arglist'.
5428 ;; 5417 ;;
5429 ;; This function might do hidden buffer changes. 5418 ;; This function might do hidden buffer changes.
@@ -5455,9 +5444,11 @@ comment at the start of cc-engine.el for more info."
5455 (goto-char start) 5444 (goto-char start)
5456 nil)) 5445 nil))
5457 5446
5458 (forward-char) 5447 (forward-char) ; Forward over the opening '<'.
5459 5448
5460 (unless (looking-at c-<-op-cont-regexp) 5449 (unless (looking-at c-<-op-cont-regexp)
5450 ;; go forward one non-alphanumeric character (group) per iteration of
5451 ;; this loop.
5461 (while (and 5452 (while (and
5462 (progn 5453 (progn
5463 (c-forward-syntactic-ws) 5454 (c-forward-syntactic-ws)
@@ -5486,7 +5477,7 @@ comment at the start of cc-engine.el for more info."
5486 (c-forward-type) 5477 (c-forward-type)
5487 (c-forward-syntactic-ws)))))) 5478 (c-forward-syntactic-ws))))))
5488 5479
5489 (setq pos (point)) 5480 (setq pos (point)) ; e.g. first token inside the '<'
5490 5481
5491 ;; Note: These regexps exploit the match order in \| so 5482 ;; Note: These regexps exploit the match order in \| so
5492 ;; that "<>" is matched by "<" rather than "[^>:-]>". 5483 ;; that "<>" is matched by "<" rather than "[^>:-]>".
@@ -5522,37 +5513,35 @@ comment at the start of cc-engine.el for more info."
5522 ;; Either an operator starting with '<' or a nested arglist. 5513 ;; Either an operator starting with '<' or a nested arglist.
5523 (setq pos (point)) 5514 (setq pos (point))
5524 (let (id-start id-end subres keyword-match) 5515 (let (id-start id-end subres keyword-match)
5525 (if (if (looking-at c-<-op-cont-regexp) 5516 (cond
5526 (setq tmp (match-end 0)) 5517 ;; The '<' begins a multi-char operator.
5527 (setq tmp pos) 5518 ((looking-at c-<-op-cont-regexp)
5528 (backward-char) 5519 (setq tmp (match-end 0))
5529 (not 5520 (goto-char (match-end 0)))
5530 (and 5521 ;; We're at a nested <.....>
5531 5522 ((progn
5532 (save-excursion 5523 (setq tmp pos)
5533 ;; There's always an identifier before an angle 5524 (backward-char) ; to the '<'
5534 ;; bracket arglist, or a keyword in 5525 (and
5535 ;; `c-<>-type-kwds' or `c-<>-arglist-kwds'. 5526 (save-excursion
5536 (c-backward-syntactic-ws) 5527 ;; There's always an identifier before an angle
5537 (setq id-end (point)) 5528 ;; bracket arglist, or a keyword in `c-<>-type-kwds'
5538 (c-simple-skip-symbol-backward) 5529 ;; or `c-<>-arglist-kwds'.
5539 (when (or (setq keyword-match 5530 (c-backward-syntactic-ws)
5540 (looking-at c-opt-<>-sexp-key)) 5531 (setq id-end (point))
5541 (not (looking-at c-keywords-regexp))) 5532 (c-simple-skip-symbol-backward)
5542 (setq id-start (point)))) 5533 (when (or (setq keyword-match
5543 5534 (looking-at c-opt-<>-sexp-key))
5544 (setq subres 5535 (not (looking-at c-keywords-regexp)))
5545 (let ((c-promote-possible-types t) 5536 (setq id-start (point))))
5546 (c-record-found-types t)) 5537 (setq subres
5547 (c-forward-<>-arglist-recur 5538 (let ((c-promote-possible-types t)
5548 (and keyword-match 5539 (c-record-found-types t))
5549 (c-keyword-member 5540 (c-forward-<>-arglist-recur
5550 (c-keyword-sym (match-string 1)) 5541 (and keyword-match
5551 'c-<>-type-kwds))))) 5542 (c-keyword-member
5552 ))) 5543 (c-keyword-sym (match-string 1))
5553 5544 'c-<>-type-kwds)))))))
5554 ;; It was not an angle bracket arglist.
5555 (goto-char tmp)
5556 5545
5557 ;; It was an angle bracket arglist. 5546 ;; It was an angle bracket arglist.
5558 (setq c-record-found-types subres) 5547 (setq c-record-found-types subres)
@@ -5567,8 +5556,13 @@ comment at the start of cc-engine.el for more info."
5567 (c-forward-syntactic-ws) 5556 (c-forward-syntactic-ws)
5568 (looking-at c-opt-identifier-concat-key))) 5557 (looking-at c-opt-identifier-concat-key)))
5569 (c-record-ref-id (cons id-start id-end)) 5558 (c-record-ref-id (cons id-start id-end))
5570 (c-record-type-id (cons id-start id-end)))))) 5559 (c-record-type-id (cons id-start id-end)))))
5571 t) 5560
5561 ;; At a "less than" operator.
5562 (t
5563 (forward-char)
5564 )))
5565 t) ; carry on looping.
5572 5566
5573 ((and (not c-restricted-<>-arglists) 5567 ((and (not c-restricted-<>-arglists)
5574 (or (and (eq (char-before) ?&) 5568 (or (and (eq (char-before) ?&)
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index 0d738700cc7..c7bb93f73e7 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -1082,7 +1082,7 @@ casts and declarations are fontified. Used on level 2 and higher."
1082 (boundp 'parse-sexp-lookup-properties)))) 1082 (boundp 'parse-sexp-lookup-properties))))
1083 1083
1084 ;; Below we fontify a whole declaration even when it crosses the limit, 1084 ;; Below we fontify a whole declaration even when it crosses the limit,
1085 ;; to avoid gaps when lazy-lock fontifies the file a screenful at a 1085 ;; to avoid gaps when jit/lazy-lock fontifies the file a block at a
1086 ;; time. That is however annoying during editing, e.g. the following is 1086 ;; time. That is however annoying during editing, e.g. the following is
1087 ;; a common situation while the first line is being written: 1087 ;; a common situation while the first line is being written:
1088 ;; 1088 ;;
@@ -1094,9 +1094,9 @@ casts and declarations are fontified. Used on level 2 and higher."
1094 ;; "some_other_variable" as an identifier, and the latter will not 1094 ;; "some_other_variable" as an identifier, and the latter will not
1095 ;; correct itself until the second line is changed. To avoid that we 1095 ;; correct itself until the second line is changed. To avoid that we
1096 ;; narrow to the limit if the region to fontify is a single line. 1096 ;; narrow to the limit if the region to fontify is a single line.
1097 (narrow-to-region 1097 (if (<= limit (c-point 'bonl))
1098 (point-min) 1098 (narrow-to-region
1099 (if (<= limit (c-point 'bonl)) 1099 (point-min)
1100 (save-excursion 1100 (save-excursion
1101 ;; Narrow after any operator chars following the limit though, 1101 ;; Narrow after any operator chars following the limit though,
1102 ;; since those characters can be useful in recognizing a 1102 ;; since those characters can be useful in recognizing a
@@ -1104,8 +1104,7 @@ casts and declarations are fontified. Used on level 2 and higher."
1104 ;; after the header). 1104 ;; after the header).
1105 (goto-char limit) 1105 (goto-char limit)
1106 (skip-chars-forward c-nonsymbol-chars) 1106 (skip-chars-forward c-nonsymbol-chars)
1107 (point)) 1107 (point))))
1108 limit))
1109 1108
1110 (c-find-decl-spots 1109 (c-find-decl-spots
1111 limit 1110 limit
diff --git a/lisp/simple.el b/lisp/simple.el
index f19525aba4c..4d2a0e69836 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -304,8 +304,8 @@ runs `next-error-hook' with `run-hooks', and stays with that buffer
304until you use it in some other buffer which uses Compilation mode 304until you use it in some other buffer which uses Compilation mode
305or Compilation Minor mode. 305or Compilation Minor mode.
306 306
307See variables `compilation-parse-errors-function' and 307To control which errors are matched, customize the variable
308\`compilation-error-regexp-alist' for customization ideas." 308`compilation-error-regexp-alist'."
309 (interactive "P") 309 (interactive "P")
310 (if (consp arg) (setq reset t arg nil)) 310 (if (consp arg) (setq reset t arg nil))
311 (when (setq next-error-last-buffer (next-error-find-buffer)) 311 (when (setq next-error-last-buffer (next-error-find-buffer))
diff --git a/lisp/textmodes/reftex-index.el b/lisp/textmodes/reftex-index.el
index f75d8b57909..79df6135806 100644
--- a/lisp/textmodes/reftex-index.el
+++ b/lisp/textmodes/reftex-index.el
@@ -1957,7 +1957,7 @@ both ends."
1957 ((equal char ?\C-g) 1957 ((equal char ?\C-g)
1958 (keyboard-quit)) 1958 (keyboard-quit))
1959 ((member char '(?o ?O)) 1959 ((member char '(?o ?O))
1960 ;; Select a differnt macro 1960 ;; Select a different macro
1961 (let* ((nc (reftex-index-select-phrases-macro 2)) 1961 (let* ((nc (reftex-index-select-phrases-macro 2))
1962 (macro-data 1962 (macro-data
1963 (cdr (assoc nc reftex-index-phrases-macro-data))) 1963 (cdr (assoc nc reftex-index-phrases-macro-data)))
diff --git a/lisp/vc/ediff-mult.el b/lisp/vc/ediff-mult.el
index 2aea75aa427..cadcdec29b4 100644
--- a/lisp/vc/ediff-mult.el
+++ b/lisp/vc/ediff-mult.el
@@ -306,7 +306,7 @@ buffers."
306 (nth 3 elt)) 306 (nth 3 elt))
307(defsubst ediff-get-session-objC (elt) 307(defsubst ediff-get-session-objC (elt)
308 (nth 4 elt)) 308 (nth 4 elt))
309;; Take the "name" component of the object into acount. ObjA/C/B is of the form 309;; Take the "name" component of the object into account. ObjA/C/B is of the form
310;; (name . equality-indicator) 310;; (name . equality-indicator)
311(defsubst ediff-get-session-objA-name (elt) 311(defsubst ediff-get-session-objA-name (elt)
312 (car (nth 2 elt))) 312 (car (nth 2 elt)))
diff --git a/lisp/vc/ediff-ptch.el b/lisp/vc/ediff-ptch.el
index 468d12057ab..d930a1bec69 100644
--- a/lisp/vc/ediff-ptch.el
+++ b/lisp/vc/ediff-ptch.el
@@ -417,7 +417,7 @@ Ediff has inferred that
417are two possible targets for applying the patch. 417are two possible targets for applying the patch.
418Both files seem to be plausible alternatives. 418Both files seem to be plausible alternatives.
419 419
420Please advice: 420Please advise:
421 Type `y' to use %s as the target; 421 Type `y' to use %s as the target;
422 Type `n' to use %s as the target. 422 Type `n' to use %s as the target.
423" 423"
diff --git a/lisp/vc/log-view.el b/lisp/vc/log-view.el
index 11ffc9a5e36..fa731e77a6e 100644
--- a/lisp/vc/log-view.el
+++ b/lisp/vc/log-view.el
@@ -130,6 +130,7 @@
130 ("z" . kill-this-buffer) 130 ("z" . kill-this-buffer)
131 ("q" . quit-window) 131 ("q" . quit-window)
132 ("g" . revert-buffer) 132 ("g" . revert-buffer)
133 ("\C-m" . log-view-toggle-entry-display)
133 134
134 ("m" . log-view-toggle-mark-entry) 135 ("m" . log-view-toggle-mark-entry)
135 ("e" . log-view-modify-change-comment) 136 ("e" . log-view-modify-change-comment)
@@ -147,7 +148,6 @@
147 ("\M-n" . log-view-file-next) 148 ("\M-n" . log-view-file-next)
148 ("\M-p" . log-view-file-prev)) 149 ("\M-p" . log-view-file-prev))
149 "Log-View's keymap." 150 "Log-View's keymap."
150 :inherit widget-keymap
151 :group 'log-view) 151 :group 'log-view)
152 152
153(easy-menu-define log-view-mode-menu log-view-mode-map 153(easy-menu-define log-view-mode-menu log-view-mode-map
@@ -168,6 +168,8 @@
168 :help "Annotate the version at point"] 168 :help "Annotate the version at point"]
169 ["Modify Log Comment" log-view-modify-change-comment 169 ["Modify Log Comment" log-view-modify-change-comment
170 :help "Edit the change comment displayed at point"] 170 :help "Edit the change comment displayed at point"]
171 ["Toggle Details at Point" log-view-toggle-entry-display
172 :active log-view-expanded-log-entry-function]
171 "-----" 173 "-----"
172 ["Next Log Entry" log-view-msg-next 174 ["Next Log Entry" log-view-msg-next
173 :help "Go to the next count'th log message"] 175 :help "Go to the next count'th log message"]
@@ -181,6 +183,12 @@
181(defvar log-view-mode-hook nil 183(defvar log-view-mode-hook nil
182 "Hook run at the end of `log-view-mode'.") 184 "Hook run at the end of `log-view-mode'.")
183 185
186(defvar log-view-expanded-log-entry-function nil
187 "Function returning the detailed description of a Log View entry.
188It is called by the command `log-view-toggle-entry-display' with
189one arg, the revision tag (a string), and should return a string.
190If it is nil, `log-view-toggle-entry-display' does nothing.")
191
184(defface log-view-file 192(defface log-view-file
185 '((((class color) (background light)) 193 '((((class color) (background light))
186 (:background "grey70" :weight bold)) 194 (:background "grey70" :weight bold))
@@ -300,15 +308,36 @@ The match group number 1 should match the revision number itself.")
300 (when cvsdir (setq dir (expand-file-name cvsdir dir)))) 308 (when cvsdir (setq dir (expand-file-name cvsdir dir))))
301 (expand-file-name file dir)))) 309 (expand-file-name file dir))))
302 310
303(defun log-view-current-tag (&optional where) 311(defun log-view-current-entry (&optional pos move)
304 (save-excursion 312 "Return the position and revision tag of the Log View entry at POS.
305 (when where (goto-char where)) 313This is a list (BEG TAG), where BEG is a buffer position and TAG
306 (forward-line 1) 314is a string. If POS is nil or omitted, it defaults to point.
307 (let ((pt (point))) 315If there is no entry at POS, return nil.
308 (when (re-search-backward log-view-message-re nil t) 316
309 (let ((rev (match-string-no-properties 1))) 317If optional arg MOVE is non-nil, move point to BEG if found.
310 (unless (re-search-forward log-view-file-re pt t) 318Otherwise, don't move point."
311 rev)))))) 319 (let ((looping t)
320 result)
321 (save-excursion
322 (when pos (goto-char pos))
323 (forward-line 1)
324 (while looping
325 (setq pos (re-search-backward log-view-message-re nil 'move)
326 looping (and pos (log-view-inside-comment-p (point)))))
327 (when pos
328 (setq result
329 (list pos (match-string-no-properties 1)))))
330 (and move result (goto-char pos))
331 result))
332
333(defun log-view-inside-comment-p (pos)
334 "Return non-nil if POS lies inside an expanded log entry."
335 (eq (get-text-property pos 'log-view-comment) t))
336
337(defun log-view-current-tag (&optional pos)
338 "Return the revision tag (a string) of the Log View entry at POS.
339if POS is omitted or nil, it defaults to point."
340 (cadr (log-view-current-entry pos)))
312 341
313(defun log-view-toggle-mark-entry () 342(defun log-view-toggle-mark-entry ()
314 "Toggle the marked state for the log entry at point. 343 "Toggle the marked state for the log entry at point.
@@ -318,29 +347,24 @@ entries are denoted by changing their background color.
318log entries." 347log entries."
319 (interactive) 348 (interactive)
320 (save-excursion 349 (save-excursion
321 (forward-line 1) 350 (let* ((entry (log-view-current-entry nil t))
322 (let ((pt (point))) 351 (beg (car entry))
323 (when (re-search-backward log-view-message-re nil t) 352 found)
324 (let ((beg (match-beginning 0)) 353 (when entry
325 end ov ovlist found tag) 354 ;; Look to see if the current entry is marked.
326 (unless (re-search-forward log-view-file-re pt t) 355 (setq found (get-char-property beg 'log-view-self))
327 ;; Look to see if the current entry is marked. 356 (if found
328 (setq found (get-char-property (point) 'log-view-self)) 357 (delete-overlay found)
329 (if found 358 ;; Create an overlay covering this entry and change its color.
330 (delete-overlay found) 359 (let* ((end (if (get-text-property beg 'log-view-entry-expanded)
331 ;; Create an overlay that covers this entry and change 360 (next-single-property-change beg 'log-view-comment)
332 ;; its color. 361 (log-view-end-of-defun)
333 (setq tag (log-view-current-tag (point))) 362 (point)))
334 (forward-line 1) 363 (ov (make-overlay beg end)))
335 (setq end 364 (overlay-put ov 'face 'log-view-file)
336 (if (re-search-forward log-view-message-re nil t) 365 ;; This is used to check if the overlay is present.
337 (match-beginning 0) 366 (overlay-put ov 'log-view-self ov)
338 (point-max))) 367 (overlay-put ov 'log-view-marked (nth 1 entry))))))))
339 (setq ov (make-overlay beg end))
340 (overlay-put ov 'face 'log-view-file)
341 ;; This is used to check if the overlay is present.
342 (overlay-put ov 'log-view-self ov)
343 (overlay-put ov 'log-view-marked tag))))))))
344 368
345(defun log-view-get-marked () 369(defun log-view-get-marked ()
346 "Return the list of tags for the marked log entries." 370 "Return the list of tags for the marked log entries."
@@ -353,50 +377,74 @@ log entries."
353 (setq pos (overlay-end ov)))) 377 (setq pos (overlay-end ov))))
354 marked-list))) 378 marked-list)))
355 379
356(defun log-view-beginning-of-defun () 380(defun log-view-toggle-entry-display ()
357 ;; This assumes that a log entry starts with a line matching 381 (interactive)
358 ;; `log-view-message-re'. Modes that derive from `log-view-mode' 382 ;; Don't do anything unless `log-view-expanded-log-entry-function'
359 ;; for which this assumption is not valid will have to provide 383 ;; is defined in this mode.
360 ;; another implementation of this function. `log-view-msg-prev' 384 (when (functionp log-view-expanded-log-entry-function)
361 ;; does a similar job to this function, we can't use it here 385 (let* ((opoint (point))
362 ;; directly because it prints messages that are not appropriate in 386 (entry (log-view-current-entry nil t))
363 ;; this context and it does not move to the beginning of the buffer 387 (beg (car entry))
364 ;; when the point is before the first log entry. 388 (buffer-read-only nil))
365 389 (when entry
366 ;; `log-view-beginning-of-defun' and `log-view-end-of-defun' have 390 (if (get-text-property beg 'log-view-entry-expanded)
367 ;; been checked to work with logs produced by RCS, CVS, git, 391 ;; If the entry is expanded, collapse it.
368 ;; mercurial and subversion. 392 (let ((pos (next-single-property-change beg 'log-view-comment)))
369 393 (unless (and pos (log-view-inside-comment-p pos))
370 (re-search-backward log-view-message-re nil 'move)) 394 (error "Broken markup in `log-view-toggle-entry-display'"))
395 (delete-region pos
396 (next-single-property-change pos 'log-view-comment))
397 (put-text-property beg (1+ beg) 'log-view-entry-expanded nil)
398 (if (< opoint pos)
399 (goto-char opoint)))
400 ;; Otherwise, expand the entry.
401 (let ((long-entry (funcall log-view-expanded-log-entry-function
402 (nth 1 entry))))
403 (when long-entry
404 (put-text-property beg (1+ beg) 'log-view-entry-expanded t)
405 (log-view-end-of-defun)
406 (setq beg (point))
407 (insert long-entry "\n")
408 (add-text-properties
409 beg (point)
410 '(font-lock-face font-lock-comment-face log-view-comment t))
411 (goto-char opoint))))))))
412
413(defun log-view-beginning-of-defun (&optional arg)
414 "Move backward to the beginning of a Log View entry.
415With ARG, do it that many times. Negative ARG means move forward
416to the beginning of the ARGth following entry.
417
418This is Log View mode's default `beginning-of-defun-function'.
419It assumes that a log entry starts with a line matching
420`log-view-message-re'."
421 (if (or (null arg) (zerop arg))
422 (setq arg 1))
423 (if (< arg 0)
424 (dotimes (n (- arg))
425 (log-view-end-of-defun))
426 (catch 'beginning-of-buffer
427 (dotimes (n arg)
428 (or (log-view-current-entry nil t)
429 (throw 'beginning-of-buffer nil)))
430 (point))))
371 431
372(defun log-view-end-of-defun () 432(defun log-view-end-of-defun ()
373 ;; The idea in this function is to search for the beginning of the 433 "Move forward to the next Log View entry."
374 ;; next log entry using `log-view-message-re' and then go back one 434 (let ((looping t))
375 ;; line when finding it. Modes that derive from `log-view-mode' for 435 (if (looking-at log-view-message-re)
376 ;; which this assumption is not valid will have to provide another 436 (goto-char (match-end 0)))
377 ;; implementation of this function. 437 (while looping
378 438 (cond
379 ;; Look back and if there is no entry there it means we are before 439 ((re-search-forward log-view-message-re nil 'move)
380 ;; the first log entry, so go forward until finding one. 440 (unless (log-view-inside-comment-p (point))
381 (unless (save-excursion (re-search-backward log-view-message-re nil t)) 441 (setq looping nil)
382 (re-search-forward log-view-message-re nil t)) 442 (goto-char (match-beginning 0))))
383 443 ;; Don't advance past the end buttons inserted by
384 ;; In case we are at the end of log entry going forward a line will 444 ;; `vc-print-log-setup-buttons'.
385 ;; make us find the next entry when searching. If we are inside of 445 ((looking-back "Show 2X entries Show unlimited entries")
386 ;; an entry going forward a line will still keep the point inside 446 (setq looping nil)
387 ;; the same entry. 447 (forward-line -1))))))
388 (forward-line 1)
389
390 ;; In case we are at the beginning of an entry, move past it.
391 (when (looking-at log-view-message-re)
392 (goto-char (match-end 0))
393 (forward-line 1))
394
395 ;; Search for the start of the next log entry. Go to the end of the
396 ;; buffer if we could not find a next entry.
397 (when (re-search-forward log-view-message-re nil 'move)
398 (goto-char (match-beginning 0))
399 (forward-line -1)))
400 448
401(defvar cvs-minor-current-files) 449(defvar cvs-minor-current-files)
402(defvar cvs-branch-prefix) 450(defvar cvs-branch-prefix)
diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el
index 9f86a28a575..a36fdc60d15 100644
--- a/lisp/vc/vc-bzr.el
+++ b/lisp/vc/vc-bzr.el
@@ -590,6 +590,7 @@ REV non-nil gets an error."
590(defvar log-view-font-lock-keywords) 590(defvar log-view-font-lock-keywords)
591(defvar log-view-current-tag-function) 591(defvar log-view-current-tag-function)
592(defvar log-view-per-file-logs) 592(defvar log-view-per-file-logs)
593(defvar log-view-expanded-log-entry-function)
593 594
594(define-derived-mode vc-bzr-log-view-mode log-view-mode "Bzr-Log-View" 595(define-derived-mode vc-bzr-log-view-mode log-view-mode "Bzr-Log-View"
595 (remove-hook 'log-view-mode-hook 'vc-bzr-log-view-mode) ;Deactivate the hack. 596 (remove-hook 'log-view-mode-hook 'vc-bzr-log-view-mode) ;Deactivate the hack.
@@ -600,6 +601,11 @@ REV non-nil gets an error."
600 (if (eq vc-log-view-type 'short) 601 (if (eq vc-log-view-type 'short)
601 "^ *\\([0-9.]+\\): \\(.*?\\)[ \t]+\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}\\)\\( \\[merge\\]\\)?" 602 "^ *\\([0-9.]+\\): \\(.*?\\)[ \t]+\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}\\)\\( \\[merge\\]\\)?"
602 "^ *\\(?:revno: \\([0-9.]+\\)\\|merged: .+\\)")) 603 "^ *\\(?:revno: \\([0-9.]+\\)\\|merged: .+\\)"))
604 ;; Allow expanding short log entries
605 (when (eq vc-log-view-type 'short)
606 (setq truncate-lines t)
607 (set (make-local-variable 'log-view-expanded-log-entry-function)
608 'vc-bzr-expanded-log-entry))
603 (set (make-local-variable 'log-view-font-lock-keywords) 609 (set (make-local-variable 'log-view-font-lock-keywords)
604 ;; log-view-font-lock-keywords is careful to use the buffer-local 610 ;; log-view-font-lock-keywords is careful to use the buffer-local
605 ;; value of log-view-message-re only since Emacs-23. 611 ;; value of log-view-message-re only since Emacs-23.
@@ -637,6 +643,16 @@ REV non-nil gets an error."
637 (list vc-bzr-log-switches) 643 (list vc-bzr-log-switches)
638 vc-bzr-log-switches))))) 644 vc-bzr-log-switches)))))
639 645
646(defun vc-bzr-expanded-log-entry (revision)
647 (with-temp-buffer
648 (apply 'vc-bzr-command "log" t nil nil
649 (list (format "-r%s" revision)))
650 (goto-char (point-min))
651 (when (looking-at "^-+\n")
652 ;; Indent the expanded log entry.
653 (indent-region (match-end 0) (point-max) 2)
654 (buffer-substring (match-end 0) (point-max)))))
655
640(defun vc-bzr-log-incoming (buffer remote-location) 656(defun vc-bzr-log-incoming (buffer remote-location)
641 (apply 'vc-bzr-command "missing" buffer 'async nil 657 (apply 'vc-bzr-command "missing" buffer 'async nil
642 (list "--theirs-only" (unless (string= remote-location "") remote-location)))) 658 (list "--theirs-only" (unless (string= remote-location "") remote-location))))
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index de729c969ae..3b4d0e5f421 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -119,6 +119,27 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
119 :version "23.1" 119 :version "23.1"
120 :group 'vc) 120 :group 'vc)
121 121
122(defcustom vc-git-root-log-format
123 '("%d%h..: %an %ad %s"
124 ;; The first shy group matches the characters drawn by --graph.
125 ;; We use numbered groups because `log-view-message-re' wants the
126 ;; revision number to be group 1.
127 "^\\(?:[*/\\| ]+ \\)?\\(?2: ([^)]+)\\)?\\(?1:[0-9a-z]+\\)..: \
128\\(?3:.*?\\)[ \t]+\\(?4:[0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}\\)"
129 ((1 'log-view-message-face)
130 (2 'change-log-list nil lax)
131 (3 'change-log-name)
132 (4 'change-log-date)))
133 "Git log format for `vc-print-root-log'.
134This should be a list (FORMAT REGEXP KEYWORDS), where FORMAT is a
135format string (which is passed to \"git log\" via the argument
136\"--pretty=tformat:FORMAT\"), REGEXP is a regular expression
137matching the resulting Git log output, and KEYWORDS is a list of
138`font-lock-keywords' for highlighting the Log View buffer."
139 :type '(list string string (repeat sexp))
140 :group 'vc
141 :version "24.1")
142
122(defvar vc-git-commits-coding-system 'utf-8 143(defvar vc-git-commits-coding-system 'utf-8
123 "Default coding system for git commits.") 144 "Default coding system for git commits.")
124 145
@@ -666,8 +687,10 @@ for the --graph option."
666 (append 687 (append
667 '("log" "--no-color") 688 '("log" "--no-color")
668 (when shortlog 689 (when shortlog
669 '("--graph" "--decorate" "--date=short" 690 `("--graph" "--decorate" "--date=short"
670 "--pretty=tformat:%d%h %ad %s" "--abbrev-commit")) 691 ,(format "--pretty=tformat:%s"
692 (car vc-git-root-log-format))
693 "--abbrev-commit"))
671 (when limit (list "-n" (format "%s" limit))) 694 (when limit (list "-n" (format "%s" limit)))
672 (when start-revision (list start-revision)) 695 (when start-revision (list start-revision))
673 '("--"))))))) 696 '("--")))))))
@@ -678,7 +701,8 @@ for the --graph option."
678 buffer 0 nil 701 buffer 0 nil
679 "log" 702 "log"
680 "--no-color" "--graph" "--decorate" "--date=short" 703 "--no-color" "--graph" "--decorate" "--date=short"
681 "--pretty=tformat:%d%h %ad %s" "--abbrev-commit" 704 (format "--pretty=tformat:%s" (car vc-git-root-log-format))
705 "--abbrev-commit"
682 (concat (if (string= remote-location "") 706 (concat (if (string= remote-location "")
683 "@{upstream}" 707 "@{upstream}"
684 remote-location) 708 remote-location)
@@ -689,9 +713,10 @@ for the --graph option."
689 (vc-git-command nil 0 nil "fetch") 713 (vc-git-command nil 0 nil "fetch")
690 (vc-git-command 714 (vc-git-command
691 buffer 0 nil 715 buffer 0 nil
692 "log" 716 "log"
693 "--no-color" "--graph" "--decorate" "--date=short" 717 "--no-color" "--graph" "--decorate" "--date=short"
694 "--pretty=tformat:%d%h %ad %s" "--abbrev-commit" 718 (format "--pretty=tformat:%s" (car vc-git-root-log-format))
719 "--abbrev-commit"
695 (concat "HEAD.." (if (string= remote-location "") 720 (concat "HEAD.." (if (string= remote-location "")
696 "@{upstream}" 721 "@{upstream}"
697 remote-location)))) 722 remote-location))))
@@ -700,6 +725,7 @@ for the --graph option."
700(defvar log-view-file-re) 725(defvar log-view-file-re)
701(defvar log-view-font-lock-keywords) 726(defvar log-view-font-lock-keywords)
702(defvar log-view-per-file-logs) 727(defvar log-view-per-file-logs)
728(defvar log-view-expanded-log-entry-function)
703 729
704(define-derived-mode vc-git-log-view-mode log-view-mode "Git-Log-View" 730(define-derived-mode vc-git-log-view-mode log-view-mode "Git-Log-View"
705 (require 'add-log) ;; We need the faces add-log. 731 (require 'add-log) ;; We need the faces add-log.
@@ -708,37 +734,37 @@ for the --graph option."
708 (set (make-local-variable 'log-view-per-file-logs) nil) 734 (set (make-local-variable 'log-view-per-file-logs) nil)
709 (set (make-local-variable 'log-view-message-re) 735 (set (make-local-variable 'log-view-message-re)
710 (if (not (eq vc-log-view-type 'long)) 736 (if (not (eq vc-log-view-type 'long))
711 "^\\(?:[*/\\| ]+ \\)?\\(?: ([^)]+)\\)?\\([0-9a-z]+\\) \\([-a-z0-9]+\\) \\(.*\\)" 737 (cadr vc-git-root-log-format)
712 "^commit *\\([0-9a-z]+\\)")) 738 "^commit *\\([0-9a-z]+\\)"))
739 ;; Allow expanding short log entries
740 (when (eq vc-log-view-type 'short)
741 (setq truncate-lines t)
742 (set (make-local-variable 'log-view-expanded-log-entry-function)
743 'vc-git-expanded-log-entry))
713 (set (make-local-variable 'log-view-font-lock-keywords) 744 (set (make-local-variable 'log-view-font-lock-keywords)
714 (if (not (eq vc-log-view-type 'long)) 745 (if (not (eq vc-log-view-type 'long))
715 '( 746 (list (cons (nth 1 vc-git-root-log-format)
716 ;; Same as log-view-message-re, except that we don't 747 (nth 2 vc-git-root-log-format)))
717 ;; want the shy group for the tag name. 748 (append
718 ("^\\(?:[*/\\| ]+ \\)?\\( ([^)]+)\\)?\\([0-9a-z]+\\) \\([-a-z0-9]+\\) \\(.*\\)" 749 `((,log-view-message-re (1 'change-log-acknowledgement)))
719 (1 'highlight nil lax) 750 ;; Handle the case:
720 (2 'change-log-acknowledgement) 751 ;; user: foo@bar
721 (3 'change-log-date))) 752 '(("^Author:[ \t]+\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)"
722 (append 753 (1 'change-log-email))
723 `((,log-view-message-re (1 'change-log-acknowledgement))) 754 ;; Handle the case:
724 ;; Handle the case: 755 ;; user: FirstName LastName <foo@bar>
725 ;; user: foo@bar 756 ("^Author:[ \t]+\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]"
726 '(("^Author:[ \t]+\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)" 757 (1 'change-log-name)
727 (1 'change-log-email)) 758 (2 'change-log-email))
728 ;; Handle the case: 759 ("^ +\\(?:\\(?:[Aa]cked\\|[Ss]igned-[Oo]ff\\)-[Bb]y:\\)[ \t]+\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)"
729 ;; user: FirstName LastName <foo@bar> 760 (1 'change-log-name))
730 ("^Author:[ \t]+\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]" 761 ("^ +\\(?:\\(?:[Aa]cked\\|[Ss]igned-[Oo]ff\\)-[Bb]y:\\)[ \t]+\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]"
731 (1 'change-log-name) 762 (1 'change-log-name)
732 (2 'change-log-email)) 763 (2 'change-log-email))
733 ("^ +\\(?:\\(?:[Aa]cked\\|[Ss]igned-[Oo]ff\\)-[Bb]y:\\)[ \t]+\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)" 764 ("^Merge: \\([0-9a-z]+\\) \\([0-9a-z]+\\)"
734 (1 'change-log-name)) 765 (1 'change-log-acknowledgement)
735 ("^ +\\(?:\\(?:[Aa]cked\\|[Ss]igned-[Oo]ff\\)-[Bb]y:\\)[ \t]+\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]" 766 (2 'change-log-acknowledgement))
736 (1 'change-log-name) 767 ("^Date: \\(.+\\)" (1 'change-log-date))
737 (2 'change-log-email))
738 ("^Merge: \\([0-9a-z]+\\) \\([0-9a-z]+\\)"
739 (1 'change-log-acknowledgement)
740 (2 'change-log-acknowledgement))
741 ("^Date: \\(.+\\)" (1 'change-log-date))
742 ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message))))))) 768 ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message)))))))
743 769
744 770
@@ -758,6 +784,15 @@ or BRANCH^ (where \"^\" can be repeated)."
758 (t nil)))) 784 (t nil))))
759 (beginning-of-line))) 785 (beginning-of-line)))
760 786
787(defun vc-git-expanded-log-entry (revision)
788 (with-temp-buffer
789 (apply 'vc-git-command t nil nil (list "log" revision "-1"))
790 (goto-char (point-min))
791 (unless (eobp)
792 ;; Indent the expanded log entry.
793 (indent-region (point-min) (point-max) 2)
794 (buffer-string))))
795
761(defun vc-git-diff (files &optional rev1 rev2 buffer) 796(defun vc-git-diff (files &optional rev1 rev2 buffer)
762 "Get a difference report using Git between two revisions of FILES." 797 "Get a difference report using Git between two revisions of FILES."
763 (let (process-file-side-effects) 798 (let (process-file-side-effects)
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index 10348544357..d283c39362a 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -138,6 +138,24 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
138 "Name of the Mercurial executable (excluding any arguments)." 138 "Name of the Mercurial executable (excluding any arguments)."
139 :type 'string 139 :type 'string
140 :group 'vc) 140 :group 'vc)
141
142(defcustom vc-hg-root-log-format
143 '("{rev}:{tags}: {author|person} {date|shortdate} {desc|firstline}\\n"
144 "^\\([0-9]+\\):\\([^:]*\\): \\(.*?\\)[ \t]+\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}\\)"
145 ((1 'log-view-message-face)
146 (2 'change-log-list)
147 (3 'change-log-name)
148 (4 'change-log-date)))
149 "Mercurial log template for `vc-print-root-log'.
150This should be a list (TEMPLATE REGEXP KEYWORDS), where TEMPLATE
151is the \"--template\" argument string to pass to Mercurial,
152REGEXP is a regular expression matching the resulting Mercurial
153output, and KEYWORDS is a list of `font-lock-keywords' for
154highlighting the Log View buffer."
155 :type '(list string string (repeat sexp))
156 :group 'vc
157 :version "24.1")
158
141 159
142;;; Properties of the backend 160;;; Properties of the backend
143 161
@@ -266,13 +284,14 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
266 (nconc 284 (nconc
267 (when start-revision (list (format "-r%s:" start-revision))) 285 (when start-revision (list (format "-r%s:" start-revision)))
268 (when limit (list "-l" (format "%s" limit))) 286 (when limit (list "-l" (format "%s" limit)))
269 (when shortlog (list "--style" "compact")) 287 (when shortlog (list "--template" (car vc-hg-root-log-format)))
270 vc-hg-log-switches))))) 288 vc-hg-log-switches)))))
271 289
272(defvar log-view-message-re) 290(defvar log-view-message-re)
273(defvar log-view-file-re) 291(defvar log-view-file-re)
274(defvar log-view-font-lock-keywords) 292(defvar log-view-font-lock-keywords)
275(defvar log-view-per-file-logs) 293(defvar log-view-per-file-logs)
294(defvar log-view-expanded-log-entry-function)
276 295
277(define-derived-mode vc-hg-log-view-mode log-view-mode "Hg-Log-View" 296(define-derived-mode vc-hg-log-view-mode log-view-mode "Hg-Log-View"
278 (require 'add-log) ;; we need the add-log faces 297 (require 'add-log) ;; we need the add-log faces
@@ -280,33 +299,34 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
280 (set (make-local-variable 'log-view-per-file-logs) nil) 299 (set (make-local-variable 'log-view-per-file-logs) nil)
281 (set (make-local-variable 'log-view-message-re) 300 (set (make-local-variable 'log-view-message-re)
282 (if (eq vc-log-view-type 'short) 301 (if (eq vc-log-view-type 'short)
283 "^\\([0-9]+\\)\\(\\[.*\\]\\)? +\\([0-9a-z]\\{12\\}\\) +\\(\\(?:[0-9]+\\)-\\(?:[0-9]+\\)-\\(?:[0-9]+\\) \\(?:[0-9]+\\):\\(?:[0-9]+\\) \\(?:[-+0-9]+\\)\\) +\\(.*\\)$" 302 (cadr vc-hg-root-log-format)
284 "^changeset:[ \t]*\\([0-9]+\\):\\(.+\\)")) 303 "^changeset:[ \t]*\\([0-9]+\\):\\(.+\\)"))
304 ;; Allow expanding short log entries
305 (when (eq vc-log-view-type 'short)
306 (setq truncate-lines t)
307 (set (make-local-variable 'log-view-expanded-log-entry-function)
308 'vc-hg-expanded-log-entry))
285 (set (make-local-variable 'log-view-font-lock-keywords) 309 (set (make-local-variable 'log-view-font-lock-keywords)
286 (if (eq vc-log-view-type 'short) 310 (if (eq vc-log-view-type 'short)
287 (append `((,log-view-message-re 311 (list (cons (nth 1 vc-hg-root-log-format)
288 (1 'log-view-message-face) 312 (nth 2 vc-hg-root-log-format)))
289 (2 'highlight nil lax) 313 (append
290 (3 'log-view-message-face) 314 log-view-font-lock-keywords
291 (4 'change-log-date) 315 '(
292 (5 'change-log-name)))) 316 ;; Handle the case:
293 (append 317 ;; user: FirstName LastName <foo@bar>
294 log-view-font-lock-keywords 318 ("^user:[ \t]+\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]"
295 '( 319 (1 'change-log-name)
296 ;; Handle the case: 320 (2 'change-log-email))
297 ;; user: FirstName LastName <foo@bar> 321 ;; Handle the cases:
298 ("^user:[ \t]+\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]" 322 ;; user: foo@bar
299 (1 'change-log-name) 323 ;; and
300 (2 'change-log-email)) 324 ;; user: foo
301 ;; Handle the cases: 325 ("^user:[ \t]+\\([A-Za-z0-9_.+-]+\\(?:@[A-Za-z0-9_.-]+\\)?\\)"
302 ;; user: foo@bar 326 (1 'change-log-email))
303 ;; and 327 ("^date: \\(.+\\)" (1 'change-log-date))
304 ;; user: foo 328 ("^tag: +\\([^ ]+\\)$" (1 'highlight))
305 ("^user:[ \t]+\\([A-Za-z0-9_.+-]+\\(?:@[A-Za-z0-9_.-]+\\)?\\)" 329 ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message)))))))
306 (1 'change-log-email))
307 ("^date: \\(.+\\)" (1 'change-log-date))
308 ("^tag: +\\([^ ]+\\)$" (1 'highlight))
309 ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message)))))))
310 330
311(defun vc-hg-diff (files &optional oldvers newvers buffer) 331(defun vc-hg-diff (files &optional oldvers newvers buffer)
312 "Get a difference report using hg between two revisions of FILES." 332 "Get a difference report using hg between two revisions of FILES."
@@ -324,6 +344,16 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
324 (list "-r" oldvers "-r" newvers) 344 (list "-r" oldvers "-r" newvers)
325 (list "-r" oldvers))))))) 345 (list "-r" oldvers)))))))
326 346
347(defun vc-hg-expanded-log-entry (revision)
348 (with-temp-buffer
349 (vc-hg-command t nil nil "log" "-r" revision)
350 (goto-char (point-min))
351 (unless (eobp)
352 ;; Indent the expanded log entry.
353 (indent-region (point-min) (point-max) 2)
354 (goto-char (point-max))
355 (buffer-string))))
356
327(defun vc-hg-revision-table (files) 357(defun vc-hg-revision-table (files)
328 (let ((default-directory (file-name-directory (car files)))) 358 (let ((default-directory (file-name-directory (car files))))
329 (with-temp-buffer 359 (with-temp-buffer
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index be0f568d304..815bdbfc5bf 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -2014,22 +2014,20 @@ Not all VC backends support short logs!")
2014 (goto-char (point-max)) 2014 (goto-char (point-max))
2015 (lexical-let ((working-revision working-revision) 2015 (lexical-let ((working-revision working-revision)
2016 (limit limit)) 2016 (limit limit))
2017 (widget-create 'push-button 2017 (insert "\n")
2018 :notify (lambda (&rest ignore) 2018 (insert-text-button "Show 2X entries"
2019 (vc-print-log-internal 2019 'action (lambda (&rest ignore)
2020 log-view-vc-backend log-view-vc-fileset 2020 (vc-print-log-internal
2021 working-revision nil (* 2 limit))) 2021 log-view-vc-backend log-view-vc-fileset
2022 :help-echo "Show the log again, and double the number of log entries shown" 2022 working-revision nil (* 2 limit)))
2023 "Show 2X entries") 2023 'help-echo "Show the log again, and double the number of log entries shown")
2024 (widget-insert " ") 2024 (insert " ")
2025 (widget-create 'push-button 2025 (insert-text-button "Show unlimited entries"
2026 :notify (lambda (&rest ignore) 2026 'action (lambda (&rest ignore)
2027 (vc-print-log-internal 2027 (vc-print-log-internal
2028 log-view-vc-backend log-view-vc-fileset 2028 log-view-vc-backend log-view-vc-fileset
2029 working-revision nil nil)) 2029 working-revision nil nil))
2030 :help-echo "Show the log again, showing all entries" 2030 'help-echo "Show the log again, including all entries"))))
2031 "Show unlimited entries"))
2032 (widget-setup)))
2033 2031
2034(defun vc-print-log-internal (backend files working-revision 2032(defun vc-print-log-internal (backend files working-revision
2035 &optional is-start-revision limit) 2033 &optional is-start-revision limit)
diff --git a/lwlib/ChangeLog b/lwlib/ChangeLog
index 60defac0b18..9a9c1fd3369 100644
--- a/lwlib/ChangeLog
+++ b/lwlib/ChangeLog
@@ -1,3 +1,36 @@
12011-02-14 Jan Djärv <jan.h.d@swipnet.se>
2
3 * xlwmenu.h: Remove Xt[CN]faceName and Xt[NC]defaultFace.
4
5 * xlwmenuP.h (_XlwMenu_part): Remove faceName. Add fontName.
6
7 * xlwmenu.c (xlwmenu_default_font): Remove, does not work for
8 multi-display.
9 (xlwMenuResources): Remove XtNfaceName and XtNdefaultFace.
10 Make XtNFont a String resource.
11 (make_windows_if_needed): Call XFlush so later changes are seen by the
12 X server.
13 (remap_menubar): Use XtMoveWidget and then
14 XtResizeWidget/XtResizeWindow after XtPopup. Works better with
15 Compiz.
16 (make_drawing_gcs): Check if mw->menu.font is set.
17 (getDefaultXftFont): New function.
18 (openXftFont): faceName is now fontName. Try XLoadQueryFont first
19 and then XftFontOpenName.
20 (XlwMenuInitialize): Initialize mw->menu.font with XLoadQueryFont.
21 (XlwMenuClassInitialize): Remove initialization of
22 xlwmenu_default_font.
23 (fontname_changed): Renamed from facename_changed.
24 (XlwMenuSetValues): Use facename_changed.
25
26 * lwlib-Xaw.c (make_dialog): Use *font even for Xft fonts. Try
27 XLoadQueryFont first and then Xft fonts.
28
292011-02-13 Glenn Morris <rgm@gnu.org>
30
31 * lwlib-utils.c (index, rindex): Don't undef (neither used in lwlib/,
32 nor set in config.h).
33
12011-02-11 Glenn Morris <rgm@gnu.org> 342011-02-11 Glenn Morris <rgm@gnu.org>
2 35
3 * Makefile.in (USE_X_TOOLKIT, RM, TOOLKIT_DEFINES): Remove. 36 * Makefile.in (USE_X_TOOLKIT, RM, TOOLKIT_DEFINES): Remove.
diff --git a/lwlib/lwlib-Xaw.c b/lwlib/lwlib-Xaw.c
index 19c2440989d..9c9a007bc15 100644
--- a/lwlib/lwlib-Xaw.c
+++ b/lwlib/lwlib-Xaw.c
@@ -577,13 +577,20 @@ make_dialog (char* name,
577 if (w) 577 if (w)
578 { 578 {
579 XtResource rec[] = 579 XtResource rec[] =
580 { { "faceName", "FaceName", XtRString, sizeof(String), 0, XtRString, 580 { { "font", "Font", XtRString, sizeof(String), 0, XtRString,
581 (XtPointer)"Sans-14" }}; 581 (XtPointer)"Sans-10" }};
582 char *faceName; 582 char *fontName = NULL;
583 XtVaGetSubresources (dialog, &faceName, "Dialog", "dialog", 583 XtVaGetSubresources (dialog, &fontName, "Dialog", "dialog",
584 rec, 1, (String)NULL); 584 rec, 1, (String)NULL);
585 if (strcmp ("none", faceName) != 0) 585 if (fontName)
586 xft_font = openFont (dialog, faceName); 586 {
587 XFontStruct *xfn = XLoadQueryFont (XtDisplay (dialog), fontName);
588 if (!xfn)
589 xft_font = openFont (dialog, fontName);
590 else
591 XFreeFont (XtDisplay (dialog), xfn);
592 }
593
587 if (xft_font) 594 if (xft_font)
588 { 595 {
589 instance->nr_xft_data = left_buttons + right_buttons + 1; 596 instance->nr_xft_data = left_buttons + right_buttons + 1;
diff --git a/lwlib/lwlib-utils.c b/lwlib/lwlib-utils.c
index 7c9a56d2aeb..a3e1cb3b432 100644
--- a/lwlib/lwlib-utils.c
+++ b/lwlib/lwlib-utils.c
@@ -24,13 +24,6 @@ Boston, MA 02110-1301, USA. */
24#include <config.h> 24#include <config.h>
25#endif 25#endif
26 26
27/* Definitions of these in config.h can cause
28 declaration conflicts later on between declarations for index
29 and declarations for strchr. This file doesn't use
30 index and rindex, so cancel them. */
31#undef index
32#undef rindex
33
34#include <setjmp.h> 27#include <setjmp.h>
35#include <lisp.h> 28#include <lisp.h>
36 29
diff --git a/lwlib/xlwmenu.c b/lwlib/xlwmenu.c
index 065d81e1fde..5b97f2bf999 100644
--- a/lwlib/xlwmenu.c
+++ b/lwlib/xlwmenu.c
@@ -71,8 +71,6 @@ extern char *gray_bitmap_bits;
71static int pointer_grabbed; 71static int pointer_grabbed;
72static XEvent menu_post_event; 72static XEvent menu_post_event;
73 73
74static XFontStruct *xlwmenu_default_font;
75
76static char 74static char
77xlwMenuTranslations [] = 75xlwMenuTranslations [] =
78"<BtnDown>: start()\n\ 76"<BtnDown>: start()\n\
@@ -131,14 +129,12 @@ xlwMenuResources[] =
131 offset(menu.fontSet), XtRFontSet, NULL}, 129 offset(menu.fontSet), XtRFontSet, NULL},
132#endif 130#endif
133#ifdef HAVE_XFT 131#ifdef HAVE_XFT
134#define DEFAULT_FACENAME "Sans-10" 132#define DEFAULT_FONTNAME "Sans-10"
135 {XtNfaceName, XtCFaceName, XtRString, sizeof(String), 133#else
136 offset(menu.faceName), XtRString, DEFAULT_FACENAME}, 134#define DEFAULT_FONTNAME "XtDefaultFont"
137 {XtNdefaultFace, XtCDefaultFace, XtRInt, sizeof(int),
138 offset(menu.default_face), XtRImmediate, (XtPointer)1},
139#endif 135#endif
140 {XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *), 136 {XtNfont, XtCFont, XtRString, sizeof(String),
141 offset(menu.font), XtRString, "XtDefaultFont"}, 137 offset(menu.fontName), XtRString, DEFAULT_FONTNAME },
142 {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), 138 {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
143 offset(menu.foreground), XtRString, "XtDefaultForeground"}, 139 offset(menu.foreground), XtRString, "XtDefaultForeground"},
144 {XtNdisabledForeground, XtCDisabledForeground, XtRPixel, sizeof(Pixel), 140 {XtNdisabledForeground, XtCDisabledForeground, XtRPixel, sizeof(Pixel),
@@ -1352,6 +1348,7 @@ make_windows_if_needed (XlwMenuWidget mw, int n)
1352#endif 1348#endif
1353 set_window_type (windows [i].w, mw); 1349 set_window_type (windows [i].w, mw);
1354 } 1350 }
1351 XFlush (XtDisplay (mw));
1355} 1352}
1356 1353
1357/* Value is non-zero if WINDOW is part of menu bar widget W. */ 1354/* Value is non-zero if WINDOW is part of menu bar widget W. */
@@ -1534,10 +1531,12 @@ remap_menubar (XlwMenuWidget mw)
1534 1531
1535 fit_to_screen (mw, ws, previous_ws, mw->menu.horizontal && i == 1); 1532 fit_to_screen (mw, ws, previous_ws, mw->menu.horizontal && i == 1);
1536 1533
1537 XtVaSetValues (ws->w, XtNwidth, ws->width, XtNheight, ws->height,
1538 XtNx, ws->x, XtNy, ws->y, NULL);
1539 create_pixmap_for_menu (ws, mw); 1534 create_pixmap_for_menu (ws, mw);
1535 XtMoveWidget (ws->w, ws->x, ws->y);
1540 XtPopup (ws->w, XtGrabNone); 1536 XtPopup (ws->w, XtGrabNone);
1537 XtResizeWidget (ws->w, ws->width, ws->height,
1538 mw->core.border_width);
1539 XtResizeWindow (ws->w);
1541 display_menu (mw, i, False, &selection_position, NULL, NULL); 1540 display_menu (mw, i, False, &selection_position, NULL, NULL);
1542 } 1541 }
1543 1542
@@ -1613,14 +1612,17 @@ make_drawing_gcs (XlwMenuWidget mw)
1613 XtGCMask mask = GCForeground | GCBackground; 1612 XtGCMask mask = GCForeground | GCBackground;
1614 1613
1615#ifdef HAVE_X_I18N 1614#ifdef HAVE_X_I18N
1616 if (!mw->menu.fontSet) 1615 if (!mw->menu.fontSet && mw->menu.font)
1617 { 1616 {
1618 xgcv.font = mw->menu.font->fid; 1617 xgcv.font = mw->menu.font->fid;
1619 mask |= GCFont; 1618 mask |= GCFont;
1620 } 1619 }
1621#else 1620#else
1622 xgcv.font = mw->menu.font->fid; 1621 if (mw->menu.font)
1623 mask |= GCFont; 1622 {
1623 xgcv.font = mw->menu.font->fid;
1624 mask |= GCFont;
1625 }
1624#endif 1626#endif
1625 xgcv.foreground = mw->menu.foreground; 1627 xgcv.foreground = mw->menu.foreground;
1626 xgcv.background = mw->core.background_pixel; 1628 xgcv.background = mw->core.background_pixel;
@@ -1847,13 +1849,20 @@ release_shadow_gcs (XlwMenuWidget mw)
1847} 1849}
1848 1850
1849#ifdef HAVE_XFT 1851#ifdef HAVE_XFT
1852static XftFont *
1853getDefaultXftFont (XlwMenuWidget mw)
1854{
1855 int screen = XScreenNumberOfScreen (mw->core.screen);
1856 return XftFontOpenName (XtDisplay (mw), screen, DEFAULT_FONTNAME);
1857}
1858
1850static int 1859static int
1851openXftFont (XlwMenuWidget mw) 1860openXftFont (XlwMenuWidget mw)
1852{ 1861{
1853 char *fname = mw->menu.faceName; 1862 char *fname = mw->menu.fontName;
1854 1863
1855 mw->menu.xft_font = 0; 1864 mw->menu.xft_font = 0;
1856 mw->menu.default_face = fname && strcmp (fname, DEFAULT_FACENAME) == 0; 1865 mw->menu.default_face = fname && strcmp (fname, DEFAULT_FONTNAME) == 0;
1857 1866
1858 if (fname && strcmp (fname, "none") != 0) 1867 if (fname && strcmp (fname, "none") != 0)
1859 { 1868 {
@@ -1864,20 +1873,23 @@ openXftFont (XlwMenuWidget mw)
1864 --i; 1873 --i;
1865 if (fname[i] == ' ') 1874 if (fname[i] == ' ')
1866 { 1875 {
1867 fname = xstrdup (mw->menu.faceName); 1876 fname = xstrdup (mw->menu.fontName);
1868 fname[i] = '-'; 1877 fname[i] = '-';
1869 } 1878 }
1870 1879
1871 mw->menu.xft_font = XftFontOpenName (XtDisplay (mw), screen, fname); 1880 mw->menu.font = XLoadQueryFont (XtDisplay (mw), fname);
1872 if (!mw->menu.xft_font) 1881 if (!mw->menu.font)
1873 { 1882 {
1874 fprintf (stderr, "Can't find font '%s'\n", fname); 1883 mw->menu.xft_font = XftFontOpenName (XtDisplay (mw), screen, fname);
1875 mw->menu.xft_font = XftFontOpenName (XtDisplay (mw), screen, 1884 if (!mw->menu.xft_font)
1876 DEFAULT_FACENAME); 1885 {
1886 fprintf (stderr, "Can't find font '%s'\n", fname);
1887 mw->menu.xft_font = getDefaultXftFont (mw);
1888 }
1877 } 1889 }
1878 } 1890 }
1879 1891
1880 if (fname != mw->menu.faceName) free (fname); 1892 if (fname != mw->menu.fontName) free (fname);
1881 1893
1882 return mw->menu.xft_font != 0; 1894 return mw->menu.xft_font != 0;
1883} 1895}
@@ -1913,19 +1925,19 @@ XlwMenuInitialize (Widget request, Widget w, ArgList args, Cardinal *num_args)
1913 ; 1925 ;
1914 else 1926 else
1915#endif 1927#endif
1916
1917 if (!mw->menu.font)
1918 { 1928 {
1919 if (!xlwmenu_default_font) 1929 mw->menu.font = XLoadQueryFont (display, mw->menu.fontName);
1920 xlwmenu_default_font = XLoadQueryFont (display, "fixed"); 1930 if (!mw->menu.font)
1921 mw->menu.font = xlwmenu_default_font;
1922 if (!mw->menu.font)
1923 { 1931 {
1924 fprintf (stderr, "Menu font fixed not found, can't continue.\n"); 1932 mw->menu.font = XLoadQueryFont (display, "fixed");
1925 abort (); 1933 if (!mw->menu.font)
1934 {
1935 fprintf (stderr, "Menu font fixed not found, can't continue.\n");
1936 abort ();
1937 }
1926 } 1938 }
1927 } 1939 }
1928 1940
1929#ifdef HAVE_X_I18N 1941#ifdef HAVE_X_I18N
1930 if (mw->menu.fontSet) 1942 if (mw->menu.fontSet)
1931 mw->menu.font_extents = XExtentsOfFontSet (mw->menu.fontSet); 1943 mw->menu.font_extents = XExtentsOfFontSet (mw->menu.fontSet);
@@ -1966,7 +1978,6 @@ XlwMenuInitialize (Widget request, Widget w, ArgList args, Cardinal *num_args)
1966static void 1978static void
1967XlwMenuClassInitialize (void) 1979XlwMenuClassInitialize (void)
1968{ 1980{
1969 xlwmenu_default_font = 0;
1970} 1981}
1971 1982
1972static void 1983static void
@@ -2126,13 +2137,13 @@ XlwMenuDestroy (Widget w)
2126 2137
2127#ifdef HAVE_XFT 2138#ifdef HAVE_XFT
2128static int 2139static int
2129facename_changed (XlwMenuWidget newmw, 2140fontname_changed (XlwMenuWidget newmw,
2130 XlwMenuWidget oldmw) 2141 XlwMenuWidget oldmw)
2131{ 2142{
2132 /* This will fore a new XftFont even if the same string is set. 2143 /* This will force a new XftFont even if the same string is set.
2133 This is good, as rendering parameters may have changed and 2144 This is good, as rendering parameters may have changed and
2134 we just want to do a redisplay. */ 2145 we just want to do a redisplay. */
2135 return newmw->menu.faceName != oldmw->menu.faceName; 2146 return newmw->menu.fontName != oldmw->menu.fontName;
2136} 2147}
2137#endif 2148#endif
2138 2149
@@ -2158,7 +2169,7 @@ XlwMenuSetValues (Widget current, Widget request, Widget new,
2158 if (newmw->core.background_pixel != oldmw->core.background_pixel 2169 if (newmw->core.background_pixel != oldmw->core.background_pixel
2159 || newmw->menu.foreground != oldmw->menu.foreground 2170 || newmw->menu.foreground != oldmw->menu.foreground
2160#ifdef HAVE_XFT 2171#ifdef HAVE_XFT
2161 || facename_changed (newmw, oldmw) 2172 || fontname_changed (newmw, oldmw)
2162#endif 2173#endif
2163#ifdef HAVE_X_I18N 2174#ifdef HAVE_X_I18N
2164 || newmw->menu.fontSet != oldmw->menu.fontSet 2175 || newmw->menu.fontSet != oldmw->menu.fontSet
@@ -2193,7 +2204,7 @@ XlwMenuSetValues (Widget current, Widget request, Widget new,
2193 } 2204 }
2194 2205
2195#ifdef HAVE_XFT 2206#ifdef HAVE_XFT
2196 if (facename_changed (newmw, oldmw)) 2207 if (fontname_changed (newmw, oldmw))
2197 { 2208 {
2198 int i; 2209 int i;
2199 int screen = XScreenNumberOfScreen (newmw->core.screen); 2210 int screen = XScreenNumberOfScreen (newmw->core.screen);
diff --git a/lwlib/xlwmenu.h b/lwlib/xlwmenu.h
index 1f0f973d7b9..fad2aafb3d7 100644
--- a/lwlib/xlwmenu.h
+++ b/lwlib/xlwmenu.h
@@ -58,10 +58,6 @@ Boston, MA 02110-1301, USA. */
58#define XtCResizeToPreferred "ResizeToPreferred" 58#define XtCResizeToPreferred "ResizeToPreferred"
59#define XtNallowResize "allowResize" 59#define XtNallowResize "allowResize"
60#define XtCAllowResize "AllowResize" 60#define XtCAllowResize "AllowResize"
61#define XtNfaceName "faceName"
62#define XtCFaceName "FaceName"
63#define XtNdefaultFace "defaultFace"
64#define XtCDefaultFace "DefaultFace"
65 61
66/* Motif-compatible resource names */ 62/* Motif-compatible resource names */
67#define XmNshadowThickness "shadowThickness" 63#define XmNshadowThickness "shadowThickness"
diff --git a/lwlib/xlwmenuP.h b/lwlib/xlwmenuP.h
index b7ea9de54f7..0aca2f8ea89 100644
--- a/lwlib/xlwmenuP.h
+++ b/lwlib/xlwmenuP.h
@@ -59,11 +59,11 @@ typedef struct _XlwMenu_part
59 XFontSetExtents *font_extents; 59 XFontSetExtents *font_extents;
60#endif 60#endif
61#ifdef HAVE_XFT 61#ifdef HAVE_XFT
62 String faceName;
63 int default_face; 62 int default_face;
64 XftFont* xft_font; 63 XftFont* xft_font;
65 XftColor xft_fg, xft_bg, xft_disabled_fg; 64 XftColor xft_fg, xft_bg, xft_disabled_fg;
66#endif 65#endif
66 String fontName;
67 XFontStruct* font; 67 XFontStruct* font;
68 Pixel foreground; 68 Pixel foreground;
69 Pixel disabled_foreground; 69 Pixel disabled_foreground;
diff --git a/make-dist b/make-dist
index 37e0fb3e641..ee0efb04c3a 100755
--- a/make-dist
+++ b/make-dist
@@ -359,7 +359,7 @@ echo "Making links to \`src'"
359 ln makefile.w32-in ../${tempdir}/src 359 ln makefile.w32-in ../${tempdir}/src
360 ln .gdbinit .dbxinit ../${tempdir}/src 360 ln .gdbinit .dbxinit ../${tempdir}/src
361 cd ../${tempdir}/src 361 cd ../${tempdir}/src
362 rm -f config.h epaths.h Makefile buildobj.h) 362 rm -f globals.h config.h epaths.h Makefile buildobj.h)
363 363
364echo "Making links to \`src/bitmaps'" 364echo "Making links to \`src/bitmaps'"
365(cd src/bitmaps 365(cd src/bitmaps
diff --git a/src/ChangeLog b/src/ChangeLog
index b56a2ce8dff..b1f60025263 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,207 @@
12011-02-15 Eli Zaretskii <eliz@gnu.org>
2
3 * nsfns.m (ns_set_name_as_filename, Fns_read_file_name): Use B_.
4
52011-02-14 Michael Welsh Duggan <md5i@md5i.com>
6
7 * print.c (float_to_string): Ensure that a decimal point is
8 printed if using dtoastr (Bug#8033).
9
102011-02-14 Eli Zaretskii <eliz@gnu.org>
11
12 * msdos.c (IT_frame_up_to_date):
13 * s/msdos.h (MODE_LINE_BINARY_TEXT): Use B_ for the MS-DOS build.
14
15 * dired.c (directory_files_internal):
16 * fileio.c (Finsert_file_contents):
17 * insdel.c (prepare_to_modify_buffer):
18 * xdisp.c (pos_visible_p):
19 * s/ms-w32.h (MODE_LINE_BINARY_TEXT):
20 * w32fns.c (Fw32_shell_execute, Fx_show_tip, x_create_tip_frame):
21 Use B_ for the MS-Windows build.
22
232011-02-14 Jan Djärv <jan.h.d@swipnet.se>
24
25 * xrdb.c (x_load_resources): For LUCID and XFT, don't put a
26 resource that specifies helvetica for menus and dialogs.
27
28 * xmenu.c (apply_systemfont_to_dialog): Apply to *dialog.font.
29 (apply_systemfont_to_menu): Set resources *menubar*font and
30 *popup*font. Remove defflt.
31 (set_frame_menubar, create_and_show_popup_menu): Call
32 apply_systemfont_to_menu before lw_create_widget.
33
342011-02-14 Tom Tromey <tromey@redhat.com>
35
36 * buffer.c (init_buffer_once, syms_of_buffer): Use B_ in DOS_NT case.
37
38 * keyboard.h: Remove obsolete comment.
39
402011-02-14 Tom Tromey <tromey@parfait>
41
42 * composite.c (fill_gstring_header)
43 (composition_compute_stop_pos, composition_adjust_point)
44 (Ffind_composition_internal): Use B_.
45 * intervals.c (set_point_both, get_local_map): Use B_.
46 * callproc.c (Fcall_process, Fcall_process_region): Use B_.
47 * process.c (get_process, list_processes_1, Fstart_process)
48 (Fmake_serial_process, Fmake_network_process)
49 (read_process_output, send_process, exec_sentinel)
50 (status_notify, setup_process_coding_systems): Use B_.
51 * bytecode.c (Fbyte_code): Use B_.
52 * syntax.c (update_syntax_table, dec_bytepos, Fsyntax_table)
53 (Fset_syntax_table, Fmodify_syntax_entry, skip_chars)
54 (skip_syntaxes, scan_lists): Use B_.
55 * lread.c (readchar, unreadchar, openp, readevalloop)
56 (Feval_buffer, Feval_region): Use B_.
57 * print.c (printchar, strout, print_string, PRINTDECLARE)
58 (PRINTPREPARE, PRINTFINISH, temp_output_buffer_setup)
59 (print_object): Use B_.
60 * font.c (font_at): Use B_.
61 * fns.c (Fbase64_encode_region, Fbase64_decode_region, Fmd5): Use
62 B_.
63 * callint.c (check_mark, Fcall_interactively): Use B_.
64 * editfns.c (region_limit, Fmark_marker, save_excursion_save)
65 (save_excursion_restore, Fprevious_char, Fchar_before)
66 (general_insert_function, Finsert_char, Finsert_byte)
67 (make_buffer_string_both, Finsert_buffer_substring)
68 (Fcompare_buffer_substrings, subst_char_in_region_unwind)
69 (subst_char_in_region_unwind_1, Fsubst_char_in_region)
70 (Ftranslate_region_internal, save_restriction_restore)
71 (Fchar_equal): Use B_.
72 * data.c (swap_in_symval_forwarding, set_internal)
73 (Fmake_local_variable, Fkill_local_variable, Flocal_variable_p):
74 Use B_.
75 * undo.c (record_point, record_insert, record_delete)
76 (record_marker_adjustment, record_first_change)
77 (record_property_change, Fundo_boundary, truncate_undo_list)
78 (Fprimitive_undo): Use B_.
79 * search.c (compile_pattern_1, compile_pattern, looking_at_1)
80 (string_match_1, fast_looking_at, newline_cache_on_off)
81 (search_command, search_buffer, simple_search, boyer_moore)
82 (Freplace_match): Use B_.
83 * indent.c (buffer_display_table, recompute_width_table)
84 (width_run_cache_on_off, current_column, scan_for_column)
85 (Findent_to, position_indentation, compute_motion, vmotion): Use
86 B_.
87 * casefiddle.c (casify_object, casify_region): Use B_.
88 * casetab.c (Fcurrent_case_table, set_case_table): Use B_.
89 * cmds.c (Fself_insert_command, internal_self_insert): Use B_.
90 * fileio.c (Fexpand_file_name, Ffile_directory_p)
91 (Ffile_regular_p, Ffile_selinux_context)
92 (Fset_file_selinux_context, Ffile_modes, Fset_file_modes)
93 (Fset_file_times, Ffile_newer_than_file_p, decide_coding_unwind)
94 (Finsert_file_contents, choose_write_coding_system)
95 (Fwrite_region, build_annotations, Fverify_visited_file_modtime)
96 (Fset_visited_file_modtime, auto_save_error, auto_save_1)
97 (Fdo_auto_save, Fset_buffer_auto_saved): Use B_.
98 * minibuf.c (read_minibuf, get_minibuffer, Fread_buffer): Use B_.
99 * marker.c (Fmarker_buffer, Fset_marker, set_marker_restricted)
100 (set_marker_both, set_marker_restricted_both, unchain_marker): Use
101 B_.
102 * insdel.c (check_markers, insert_char, insert_1_both)
103 (insert_from_string_1, insert_from_gap, insert_from_buffer_1)
104 (adjust_after_replace, replace_range, del_range_2)
105 (modify_region, prepare_to_modify_buffer)
106 (Fcombine_after_change_execute): Use B_.
107 * filelock.c (unlock_all_files, Flock_buffer, Funlock_buffer)
108 (unlock_buffer): Use B_.
109 * keymap.c (Flocal_key_binding, Fuse_local_map)
110 (Fcurrent_local_map, push_key_description)
111 (Fdescribe_buffer_bindings): Use B_.
112 * keyboard.c (command_loop_1, read_char_minibuf_menu_prompt)
113 (read_key_sequence): Use B_.
114 * fringe.c (get_logical_cursor_bitmap)
115 (get_logical_fringe_bitmap, update_window_fringes): Use B_.
116 * xfns.c (x_create_tip_frame, Fx_show_tip): Use B_.
117 * xfaces.c (compute_char_face): Use B_.
118 * character.c (chars_in_text, Fget_byte): Use B_.
119 * category.c (check_category_table, Fcategory_table)
120 (Fset_category_table, char_category_set): Use B_.
121 * coding.c (decode_coding, encode_coding)
122 (make_conversion_work_buffer, decode_coding_gap)
123 (decode_coding_object, encode_coding_object)
124 (Fdetect_coding_region, Ffind_coding_systems_region_internal)
125 (Funencodable_char_position, Fcheck_coding_systems_region): Use
126 B_.
127 * charset.c (Ffind_charset_region): Use B_.
128 * window.c (window_display_table, unshow_buffer, window_loop)
129 (window_min_size_2, set_window_buffer, Fset_window_buffer)
130 (select_window, Fforce_window_update, temp_output_buffer_show)
131 (Fset_window_configuration, save_window_save): Use B_.
132 * xdisp.c (pos_visible_p, init_iterator, reseat_1)
133 (message_dolog, update_echo_area, ensure_echo_area_buffers)
134 (with_echo_area_buffer, setup_echo_area_for_printing)
135 (set_message_1, update_menu_bar, update_tool_bar)
136 (text_outside_line_unchanged_p, redisplay_internal)
137 (try_scrolling, try_cursor_movement, redisplay_window)
138 (try_window_reusing_current_matrix, row_containing_pos)
139 (try_window_id, get_overlay_arrow_glyph_row, display_line)
140 (Fcurrent_bidi_paragraph_direction, display_mode_lines)
141 (decode_mode_spec_coding, decode_mode_spec, display_count_lines)
142 (get_window_cursor_type, note_mouse_highlight): Use B_.
143 * frame.c (make_frame_visible_1): Use B_.
144 * dispnew.c (Fframe_or_buffer_changed_p): Use B_.
145 * dispextern.h (WINDOW_WANTS_HEADER_LINE_P)
146 (WINDOW_WANTS_MODELINE_P): Use B_.
147 * syntax.h (Vstandard_syntax_table): Update.
148 (CURRENT_SYNTAX_TABLE, SETUP_BUFFER_SYNTAX_TABLE): Use B_.
149 * intervals.h (TEXT_PROP_MEANS_INVISIBLE): Update.
150 (TEXT_PROP_MEANS_INVISIBLE): Use B_.
151 * character.h (FETCH_CHAR_ADVANCE): Update.
152 (INC_BOTH, ASCII_CHAR_WIDTH, DEC_BOTH): Use B_.
153 * category.h (Vstandard_category_table): Update.
154 * lisp.h (DEFVAR_BUFFER_DEFAULTS): Update for change to field
155 names.
156 (DOWNCASE_TABLE, UPCASE_TABLE): Use B_.
157 * buffer.c (swapfield_): New macro.
158 (Fbuffer_swap_text): Use swapfield_ where appropriate.
159 (Fbuffer_live_p, Fget_file_buffer, get_truename_buffer)
160 (Fget_buffer_create, clone_per_buffer_values)
161 (Fmake_indirect_buffer, reset_buffer)
162 (reset_buffer_local_variables, Fbuffer_name, Fbuffer_file_name)
163 (Fbuffer_local_value, buffer_lisp_local_variables)
164 (Fset_buffer_modified_p, Frestore_buffer_modified_p)
165 (Frename_buffer, Fother_buffer, Fbuffer_enable_undo)
166 (Fkill_buffer, Fset_buffer_major_mode, set_buffer_internal_1)
167 (set_buffer_temp, Fset_buffer, set_buffer_if_live)
168 (Fbarf_if_buffer_read_only, Fbury_buffer, Ferase_buffer)
169 (Fbuffer_swap_text, Fset_buffer_multibyte)
170 (swap_out_buffer_local_variables, record_overlay_string)
171 (overlay_strings, init_buffer_once, init_buffer, syms_of_buffer):
172 Use B_.
173 * buffer.h (struct buffer): Rename all Lisp_Object fields.
174 (BUFFER_INTERNAL_FIELD, B_): New macro.
175 (FETCH_CHAR, FETCH_CHAR_AS_MULTIBYTE): Use B_.
176
1772011-02-14 Jan Djärv <jan.h.d@swipnet.se>
178
179 * gtkutil.c (xg_tool_bar_menu_proxy): Handle case when tool bar label
180 is null.
181
1822011-02-13 Jan Djärv <jan.h.d@swipnet.se>
183
184 * callproc.c (Fcall_process):
185 * process.c (create_process): Replace Gtk with GConf in SIGPIPE
186 comment.
187
1882011-02-12 Martin Rudalics <rudalics@gmx.at>
189
190 * window.c (select_window): Check inhibit_point_swap argument when
191 deciding whether to return immediately.
192
1932011-02-12 Jan Djärv <jan.h.d@swipnet.se>
194
195 * nsterm.m (setFrame, initFrame): Make sure pixel_height doesn't become
196 zero (Bug#7348).
197
1982011-02-12 Chong Yidong <cyd@stupidchicken.com>
199
200 * config.in (TERMINFO): New definition.
201
202 * s/netbsd.h: Use it to choose between terminfo and termcap
203 (Bug#7642).
204
12011-02-12 Paul Eggert <eggert@cs.ucla.edu> 2052011-02-12 Paul Eggert <eggert@cs.ucla.edu>
2 206
3 * md5.c (md5_process_bytes): Use sizeof, not __alignof__. 207 * md5.c (md5_process_bytes): Use sizeof, not __alignof__.
@@ -1636,7 +1840,7 @@
1636 1840
1637 * gtkutil.c (menubar_map_cb): New function (Bug#7425). 1841 * gtkutil.c (menubar_map_cb): New function (Bug#7425).
1638 (xg_update_frame_menubar): Connect signal map to menubar_map_cb. 1842 (xg_update_frame_menubar): Connect signal map to menubar_map_cb.
1639 Use 23 as menubar height if 0. (Bug#7425). 1843 Use 23 as menubar height if 0. (Bug#7425).
1640 1844
16412010-11-26 Eli Zaretskii <eliz@gnu.org> 18452010-11-26 Eli Zaretskii <eliz@gnu.org>
1642 1846
@@ -2643,7 +2847,7 @@
2643 is more portable. 2847 is more portable.
2644 2848
2645 * keyboard.c (gobble_input): Move call of xd_read_queued_messages ... 2849 * keyboard.c (gobble_input): Move call of xd_read_queued_messages ...
2646 (kbd_buffer_get_event): ... here. This is needed for cygwin, which 2850 (kbd_buffer_get_event): ... here. This is needed for cygwin, which
2647 has not defined SIGIO. 2851 has not defined SIGIO.
2648 2852
26492010-10-08 Chong Yidong <cyd@stupidchicken.com> 28532010-10-08 Chong Yidong <cyd@stupidchicken.com>
diff --git a/src/alloc.c b/src/alloc.c
index f75903aab5a..566c6fe00b9 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -3886,7 +3886,7 @@ live_buffer_p (struct mem_node *m, void *p)
3886 must not have been killed. */ 3886 must not have been killed. */
3887 return (m->type == MEM_TYPE_BUFFER 3887 return (m->type == MEM_TYPE_BUFFER
3888 && p == m->start 3888 && p == m->start
3889 && !NILP (((struct buffer *) p)->name)); 3889 && !NILP (((struct buffer *) p)->BUFFER_INTERNAL_FIELD (name)));
3890} 3890}
3891 3891
3892#endif /* GC_MARK_STACK || defined GC_MALLOC_CHECK */ 3892#endif /* GC_MARK_STACK || defined GC_MALLOC_CHECK */
@@ -4872,11 +4872,11 @@ returns nil, because real GC can't be done. */)
4872 turned off in that buffer. Calling truncate_undo_list on 4872 turned off in that buffer. Calling truncate_undo_list on
4873 Qt tends to return NULL, which effectively turns undo back on. 4873 Qt tends to return NULL, which effectively turns undo back on.
4874 So don't call truncate_undo_list if undo_list is Qt. */ 4874 So don't call truncate_undo_list if undo_list is Qt. */
4875 if (! NILP (nextb->name) && ! EQ (nextb->undo_list, Qt)) 4875 if (! NILP (nextb->BUFFER_INTERNAL_FIELD (name)) && ! EQ (nextb->BUFFER_INTERNAL_FIELD (undo_list), Qt))
4876 truncate_undo_list (nextb); 4876 truncate_undo_list (nextb);
4877 4877
4878 /* Shrink buffer gaps, but skip indirect and dead buffers. */ 4878 /* Shrink buffer gaps, but skip indirect and dead buffers. */
4879 if (nextb->base_buffer == 0 && !NILP (nextb->name) 4879 if (nextb->base_buffer == 0 && !NILP (nextb->BUFFER_INTERNAL_FIELD (name))
4880 && ! nextb->text->inhibit_shrinking) 4880 && ! nextb->text->inhibit_shrinking)
4881 { 4881 {
4882 /* If a buffer's gap size is more than 10% of the buffer 4882 /* If a buffer's gap size is more than 10% of the buffer
@@ -5009,10 +5009,10 @@ returns nil, because real GC can't be done. */)
5009 turned off in that buffer. Calling truncate_undo_list on 5009 turned off in that buffer. Calling truncate_undo_list on
5010 Qt tends to return NULL, which effectively turns undo back on. 5010 Qt tends to return NULL, which effectively turns undo back on.
5011 So don't call truncate_undo_list if undo_list is Qt. */ 5011 So don't call truncate_undo_list if undo_list is Qt. */
5012 if (! EQ (nextb->undo_list, Qt)) 5012 if (! EQ (nextb->BUFFER_INTERNAL_FIELD (undo_list), Qt))
5013 { 5013 {
5014 Lisp_Object tail, prev; 5014 Lisp_Object tail, prev;
5015 tail = nextb->undo_list; 5015 tail = nextb->BUFFER_INTERNAL_FIELD (undo_list);
5016 prev = Qnil; 5016 prev = Qnil;
5017 while (CONSP (tail)) 5017 while (CONSP (tail))
5018 { 5018 {
@@ -5021,7 +5021,7 @@ returns nil, because real GC can't be done. */)
5021 && !XMARKER (XCAR (XCAR (tail)))->gcmarkbit) 5021 && !XMARKER (XCAR (XCAR (tail)))->gcmarkbit)
5022 { 5022 {
5023 if (NILP (prev)) 5023 if (NILP (prev))
5024 nextb->undo_list = tail = XCDR (tail); 5024 nextb->BUFFER_INTERNAL_FIELD (undo_list) = tail = XCDR (tail);
5025 else 5025 else
5026 { 5026 {
5027 tail = XCDR (tail); 5027 tail = XCDR (tail);
@@ -5037,7 +5037,7 @@ returns nil, because real GC can't be done. */)
5037 } 5037 }
5038 /* Now that we have stripped the elements that need not be in the 5038 /* Now that we have stripped the elements that need not be in the
5039 undo_list any more, we can finally mark the list. */ 5039 undo_list any more, we can finally mark the list. */
5040 mark_object (nextb->undo_list); 5040 mark_object (nextb->BUFFER_INTERNAL_FIELD (undo_list));
5041 5041
5042 nextb = nextb->next; 5042 nextb = nextb->next;
5043 } 5043 }
@@ -5595,7 +5595,7 @@ mark_buffer (Lisp_Object buf)
5595 5595
5596 /* buffer-local Lisp variables start at `undo_list', 5596 /* buffer-local Lisp variables start at `undo_list',
5597 tho only the ones from `name' on are GC'd normally. */ 5597 tho only the ones from `name' on are GC'd normally. */
5598 for (ptr = &buffer->name; 5598 for (ptr = &buffer->BUFFER_INTERNAL_FIELD (name);
5599 (char *)ptr < (char *)buffer + sizeof (struct buffer); 5599 (char *)ptr < (char *)buffer + sizeof (struct buffer);
5600 ptr++) 5600 ptr++)
5601 mark_object (*ptr); 5601 mark_object (*ptr);
diff --git a/src/buffer.c b/src/buffer.c
index 05cc12eea6f..49ae4bbede2 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,
162Value is nil if OBJECT is not a buffer or if it has been killed. */) 162Value is nil if OBJECT is not a buffer or if it has been killed. */)
163 (Lisp_Object object) 163 (Lisp_Object object)
164{ 164{
165 return ((BUFFERP (object) && ! NILP (XBUFFER (object)->name)) 165 return ((BUFFERP (object) && ! NILP (B_ (XBUFFER (object), name)))
166 ? Qt : Qnil); 166 ? Qt : Qnil);
167} 167}
168 168
@@ -266,8 +266,8 @@ See also `find-buffer-visiting'. */)
266 { 266 {
267 buf = Fcdr (XCAR (tail)); 267 buf = Fcdr (XCAR (tail));
268 if (!BUFFERP (buf)) continue; 268 if (!BUFFERP (buf)) continue;
269 if (!STRINGP (XBUFFER (buf)->filename)) continue; 269 if (!STRINGP (B_ (XBUFFER (buf), filename))) continue;
270 tem = Fstring_equal (XBUFFER (buf)->filename, filename); 270 tem = Fstring_equal (B_ (XBUFFER (buf), filename), filename);
271 if (!NILP (tem)) 271 if (!NILP (tem))
272 return buf; 272 return buf;
273 } 273 }
@@ -283,8 +283,8 @@ get_truename_buffer (register Lisp_Object filename)
283 { 283 {
284 buf = Fcdr (XCAR (tail)); 284 buf = Fcdr (XCAR (tail));
285 if (!BUFFERP (buf)) continue; 285 if (!BUFFERP (buf)) continue;
286 if (!STRINGP (XBUFFER (buf)->file_truename)) continue; 286 if (!STRINGP (B_ (XBUFFER (buf), file_truename))) continue;
287 tem = Fstring_equal (XBUFFER (buf)->file_truename, filename); 287 tem = Fstring_equal (B_ (XBUFFER (buf), file_truename), filename);
288 if (!NILP (tem)) 288 if (!NILP (tem))
289 return buf; 289 return buf;
290 } 290 }
@@ -353,7 +353,7 @@ even if it is dead. The return value is never nil. */)
353 353
354 b->newline_cache = 0; 354 b->newline_cache = 0;
355 b->width_run_cache = 0; 355 b->width_run_cache = 0;
356 b->width_table = Qnil; 356 B_ (b, width_table) = Qnil;
357 b->prevent_redisplay_optimizations_p = 1; 357 b->prevent_redisplay_optimizations_p = 1;
358 358
359 /* Put this on the chain of all buffers including killed ones. */ 359 /* 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. */)
362 362
363 /* An ordinary buffer normally doesn't need markers 363 /* An ordinary buffer normally doesn't need markers
364 to handle BEGV and ZV. */ 364 to handle BEGV and ZV. */
365 b->pt_marker = Qnil; 365 B_ (b, pt_marker) = Qnil;
366 b->begv_marker = Qnil; 366 B_ (b, begv_marker) = Qnil;
367 b->zv_marker = Qnil; 367 B_ (b, zv_marker) = Qnil;
368 368
369 name = Fcopy_sequence (buffer_or_name); 369 name = Fcopy_sequence (buffer_or_name);
370 STRING_SET_INTERVALS (name, NULL_INTERVAL); 370 STRING_SET_INTERVALS (name, NULL_INTERVAL);
371 b->name = name; 371 B_ (b, name) = name;
372 372
373 b->undo_list = (SREF (name, 0) != ' ') ? Qnil : Qt; 373 B_ (b, undo_list) = (SREF (name, 0) != ' ') ? Qnil : Qt;
374 374
375 reset_buffer (b); 375 reset_buffer (b);
376 reset_buffer_local_variables (b, 1); 376 reset_buffer_local_variables (b, 1);
377 377
378 b->mark = Fmake_marker (); 378 B_ (b, mark) = Fmake_marker ();
379 BUF_MARKERS (b) = NULL; 379 BUF_MARKERS (b) = NULL;
380 b->name = name; 380 B_ (b, name) = name;
381 381
382 /* Put this in the alist of all live buffers. */ 382 /* Put this in the alist of all live buffers. */
383 XSETBUFFER (buffer, b); 383 XSETBUFFER (buffer, b);
@@ -486,7 +486,7 @@ clone_per_buffer_values (struct buffer *from, struct buffer *to)
486 486
487 /* Get (a copy of) the alist of Lisp-level local variables of FROM 487 /* Get (a copy of) the alist of Lisp-level local variables of FROM
488 and install that in TO. */ 488 and install that in TO. */
489 to->local_var_alist = buffer_lisp_local_variables (from); 489 B_ (to, local_var_alist) = buffer_lisp_local_variables (from);
490} 490}
491 491
492DEFUN ("make-indirect-buffer", Fmake_indirect_buffer, Smake_indirect_buffer, 492DEFUN ("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. */)
512 base_buffer = Fget_buffer (base_buffer); 512 base_buffer = Fget_buffer (base_buffer);
513 if (NILP (base_buffer)) 513 if (NILP (base_buffer))
514 error ("No such buffer: `%s'", SDATA (tem)); 514 error ("No such buffer: `%s'", SDATA (tem));
515 if (NILP (XBUFFER (base_buffer)->name)) 515 if (NILP (B_ (XBUFFER (base_buffer), name)))
516 error ("Base buffer has been killed"); 516 error ("Base buffer has been killed");
517 517
518 if (SCHARS (name) == 0) 518 if (SCHARS (name) == 0)
@@ -536,7 +536,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
536 536
537 b->newline_cache = 0; 537 b->newline_cache = 0;
538 b->width_run_cache = 0; 538 b->width_run_cache = 0;
539 b->width_table = Qnil; 539 B_ (b, width_table) = Qnil;
540 540
541 /* Put this on the chain of all buffers including killed ones. */ 541 /* Put this on the chain of all buffers including killed ones. */
542 b->next = all_buffers; 542 b->next = all_buffers;
@@ -544,7 +544,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
544 544
545 name = Fcopy_sequence (name); 545 name = Fcopy_sequence (name);
546 STRING_SET_INTERVALS (name, NULL_INTERVAL); 546 STRING_SET_INTERVALS (name, NULL_INTERVAL);
547 b->name = name; 547 B_ (b, name) = name;
548 548
549 reset_buffer (b); 549 reset_buffer (b);
550 reset_buffer_local_variables (b, 1); 550 reset_buffer_local_variables (b, 1);
@@ -553,57 +553,57 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
553 XSETBUFFER (buf, b); 553 XSETBUFFER (buf, b);
554 Vbuffer_alist = nconc2 (Vbuffer_alist, Fcons (Fcons (name, buf), Qnil)); 554 Vbuffer_alist = nconc2 (Vbuffer_alist, Fcons (Fcons (name, buf), Qnil));
555 555
556 b->mark = Fmake_marker (); 556 B_ (b, mark) = Fmake_marker ();
557 b->name = name; 557 B_ (b, name) = name;
558 558
559 /* The multibyte status belongs to the base buffer. */ 559 /* The multibyte status belongs to the base buffer. */
560 b->enable_multibyte_characters = b->base_buffer->enable_multibyte_characters; 560 B_ (b, enable_multibyte_characters) = B_ (b->base_buffer, enable_multibyte_characters);
561 561
562 /* Make sure the base buffer has markers for its narrowing. */ 562 /* Make sure the base buffer has markers for its narrowing. */
563 if (NILP (b->base_buffer->pt_marker)) 563 if (NILP (B_ (b->base_buffer, pt_marker)))
564 { 564 {
565 b->base_buffer->pt_marker = Fmake_marker (); 565 B_ (b->base_buffer, pt_marker) = Fmake_marker ();
566 set_marker_both (b->base_buffer->pt_marker, base_buffer, 566 set_marker_both (B_ (b->base_buffer, pt_marker), base_buffer,
567 BUF_PT (b->base_buffer), 567 BUF_PT (b->base_buffer),
568 BUF_PT_BYTE (b->base_buffer)); 568 BUF_PT_BYTE (b->base_buffer));
569 } 569 }
570 if (NILP (b->base_buffer->begv_marker)) 570 if (NILP (B_ (b->base_buffer, begv_marker)))
571 { 571 {
572 b->base_buffer->begv_marker = Fmake_marker (); 572 B_ (b->base_buffer, begv_marker) = Fmake_marker ();
573 set_marker_both (b->base_buffer->begv_marker, base_buffer, 573 set_marker_both (B_ (b->base_buffer, begv_marker), base_buffer,
574 BUF_BEGV (b->base_buffer), 574 BUF_BEGV (b->base_buffer),
575 BUF_BEGV_BYTE (b->base_buffer)); 575 BUF_BEGV_BYTE (b->base_buffer));
576 } 576 }
577 if (NILP (b->base_buffer->zv_marker)) 577 if (NILP (B_ (b->base_buffer, zv_marker)))
578 { 578 {
579 b->base_buffer->zv_marker = Fmake_marker (); 579 B_ (b->base_buffer, zv_marker) = Fmake_marker ();
580 set_marker_both (b->base_buffer->zv_marker, base_buffer, 580 set_marker_both (B_ (b->base_buffer, zv_marker), base_buffer,
581 BUF_ZV (b->base_buffer), 581 BUF_ZV (b->base_buffer),
582 BUF_ZV_BYTE (b->base_buffer)); 582 BUF_ZV_BYTE (b->base_buffer));
583 XMARKER (b->base_buffer->zv_marker)->insertion_type = 1; 583 XMARKER (B_ (b->base_buffer, zv_marker))->insertion_type = 1;
584 } 584 }
585 585
586 if (NILP (clone)) 586 if (NILP (clone))
587 { 587 {
588 /* Give the indirect buffer markers for its narrowing. */ 588 /* Give the indirect buffer markers for its narrowing. */
589 b->pt_marker = Fmake_marker (); 589 B_ (b, pt_marker) = Fmake_marker ();
590 set_marker_both (b->pt_marker, buf, BUF_PT (b), BUF_PT_BYTE (b)); 590 set_marker_both (B_ (b, pt_marker), buf, BUF_PT (b), BUF_PT_BYTE (b));
591 b->begv_marker = Fmake_marker (); 591 B_ (b, begv_marker) = Fmake_marker ();
592 set_marker_both (b->begv_marker, buf, BUF_BEGV (b), BUF_BEGV_BYTE (b)); 592 set_marker_both (B_ (b, begv_marker), buf, BUF_BEGV (b), BUF_BEGV_BYTE (b));
593 b->zv_marker = Fmake_marker (); 593 B_ (b, zv_marker) = Fmake_marker ();
594 set_marker_both (b->zv_marker, buf, BUF_ZV (b), BUF_ZV_BYTE (b)); 594 set_marker_both (B_ (b, zv_marker), buf, BUF_ZV (b), BUF_ZV_BYTE (b));
595 XMARKER (b->zv_marker)->insertion_type = 1; 595 XMARKER (B_ (b, zv_marker))->insertion_type = 1;
596 } 596 }
597 else 597 else
598 { 598 {
599 struct buffer *old_b = current_buffer; 599 struct buffer *old_b = current_buffer;
600 600
601 clone_per_buffer_values (b->base_buffer, b); 601 clone_per_buffer_values (b->base_buffer, b);
602 b->filename = Qnil; 602 B_ (b, filename) = Qnil;
603 b->file_truename = Qnil; 603 B_ (b, file_truename) = Qnil;
604 b->display_count = make_number (0); 604 B_ (b, display_count) = make_number (0);
605 b->backed_up = Qnil; 605 B_ (b, backed_up) = Qnil;
606 b->auto_save_file_name = Qnil; 606 B_ (b, auto_save_file_name) = Qnil;
607 set_buffer_internal_1 (b); 607 set_buffer_internal_1 (b);
608 Fset (intern ("buffer-save-without-query"), Qnil); 608 Fset (intern ("buffer-save-without-query"), Qnil);
609 Fset (intern ("buffer-file-number"), Qnil); 609 Fset (intern ("buffer-file-number"), Qnil);
@@ -647,34 +647,34 @@ delete_all_overlays (struct buffer *b)
647void 647void
648reset_buffer (register struct buffer *b) 648reset_buffer (register struct buffer *b)
649{ 649{
650 b->filename = Qnil; 650 B_ (b, filename) = Qnil;
651 b->file_truename = Qnil; 651 B_ (b, file_truename) = Qnil;
652 b->directory = (current_buffer) ? current_buffer->directory : Qnil; 652 B_ (b, directory) = (current_buffer) ? B_ (current_buffer, directory) : Qnil;
653 b->modtime = 0; 653 b->modtime = 0;
654 b->modtime_size = -1; 654 b->modtime_size = -1;
655 XSETFASTINT (b->save_length, 0); 655 XSETFASTINT (B_ (b, save_length), 0);
656 b->last_window_start = 1; 656 b->last_window_start = 1;
657 /* It is more conservative to start out "changed" than "unchanged". */ 657 /* It is more conservative to start out "changed" than "unchanged". */
658 b->clip_changed = 0; 658 b->clip_changed = 0;
659 b->prevent_redisplay_optimizations_p = 1; 659 b->prevent_redisplay_optimizations_p = 1;
660 b->backed_up = Qnil; 660 B_ (b, backed_up) = Qnil;
661 BUF_AUTOSAVE_MODIFF (b) = 0; 661 BUF_AUTOSAVE_MODIFF (b) = 0;
662 b->auto_save_failure_time = -1; 662 b->auto_save_failure_time = -1;
663 b->auto_save_file_name = Qnil; 663 B_ (b, auto_save_file_name) = Qnil;
664 b->read_only = Qnil; 664 B_ (b, read_only) = Qnil;
665 b->overlays_before = NULL; 665 b->overlays_before = NULL;
666 b->overlays_after = NULL; 666 b->overlays_after = NULL;
667 b->overlay_center = BEG; 667 b->overlay_center = BEG;
668 b->mark_active = Qnil; 668 B_ (b, mark_active) = Qnil;
669 b->point_before_scroll = Qnil; 669 B_ (b, point_before_scroll) = Qnil;
670 b->file_format = Qnil; 670 B_ (b, file_format) = Qnil;
671 b->auto_save_file_format = Qt; 671 B_ (b, auto_save_file_format) = Qt;
672 b->last_selected_window = Qnil; 672 B_ (b, last_selected_window) = Qnil;
673 XSETINT (b->display_count, 0); 673 XSETINT (B_ (b, display_count), 0);
674 b->display_time = Qnil; 674 B_ (b, display_time) = Qnil;
675 b->enable_multibyte_characters = buffer_defaults.enable_multibyte_characters; 675 B_ (b, enable_multibyte_characters) = B_ (&buffer_defaults, enable_multibyte_characters);
676 b->cursor_type = buffer_defaults.cursor_type; 676 B_ (b, cursor_type) = B_ (&buffer_defaults, cursor_type);
677 b->extra_line_spacing = buffer_defaults.extra_line_spacing; 677 B_ (b, extra_line_spacing) = B_ (&buffer_defaults, extra_line_spacing);
678 678
679 b->display_error_modiff = 0; 679 b->display_error_modiff = 0;
680} 680}
@@ -698,10 +698,10 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too)
698 things that depend on the major mode. 698 things that depend on the major mode.
699 default-major-mode is handled at a higher level. 699 default-major-mode is handled at a higher level.
700 We ignore it here. */ 700 We ignore it here. */
701 b->major_mode = Qfundamental_mode; 701 B_ (b, major_mode) = Qfundamental_mode;
702 b->keymap = Qnil; 702 B_ (b, keymap) = Qnil;
703 b->mode_name = QSFundamental; 703 B_ (b, mode_name) = QSFundamental;
704 b->minor_modes = Qnil; 704 B_ (b, minor_modes) = Qnil;
705 705
706 /* If the standard case table has been altered and invalidated, 706 /* If the standard case table has been altered and invalidated,
707 fix up its insides first. */ 707 fix up its insides first. */
@@ -710,22 +710,22 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too)
710 && CHAR_TABLE_P (XCHAR_TABLE (Vascii_downcase_table)->extras[2]))) 710 && CHAR_TABLE_P (XCHAR_TABLE (Vascii_downcase_table)->extras[2])))
711 Fset_standard_case_table (Vascii_downcase_table); 711 Fset_standard_case_table (Vascii_downcase_table);
712 712
713 b->downcase_table = Vascii_downcase_table; 713 B_ (b, downcase_table) = Vascii_downcase_table;
714 b->upcase_table = XCHAR_TABLE (Vascii_downcase_table)->extras[0]; 714 B_ (b, upcase_table) = XCHAR_TABLE (Vascii_downcase_table)->extras[0];
715 b->case_canon_table = XCHAR_TABLE (Vascii_downcase_table)->extras[1]; 715 B_ (b, case_canon_table) = XCHAR_TABLE (Vascii_downcase_table)->extras[1];
716 b->case_eqv_table = XCHAR_TABLE (Vascii_downcase_table)->extras[2]; 716 B_ (b, case_eqv_table) = XCHAR_TABLE (Vascii_downcase_table)->extras[2];
717 b->invisibility_spec = Qt; 717 B_ (b, invisibility_spec) = Qt;
718#ifndef DOS_NT 718#ifndef DOS_NT
719 b->buffer_file_type = Qnil; 719 B_ (b, buffer_file_type) = Qnil;
720#endif 720#endif
721 721
722 /* Reset all (or most) per-buffer variables to their defaults. */ 722 /* Reset all (or most) per-buffer variables to their defaults. */
723 if (permanent_too) 723 if (permanent_too)
724 b->local_var_alist = Qnil; 724 B_ (b, local_var_alist) = Qnil;
725 else 725 else
726 { 726 {
727 Lisp_Object tmp, prop, last = Qnil; 727 Lisp_Object tmp, prop, last = Qnil;
728 for (tmp = b->local_var_alist; CONSP (tmp); tmp = XCDR (tmp)) 728 for (tmp = B_ (b, local_var_alist); CONSP (tmp); tmp = XCDR (tmp))
729 if (!NILP (prop = Fget (XCAR (XCAR (tmp)), Qpermanent_local))) 729 if (!NILP (prop = Fget (XCAR (XCAR (tmp)), Qpermanent_local)))
730 { 730 {
731 /* If permanent-local, keep it. */ 731 /* If permanent-local, keep it. */
@@ -755,7 +755,7 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too)
755 } 755 }
756 /* Delete this local variable. */ 756 /* Delete this local variable. */
757 else if (NILP (last)) 757 else if (NILP (last))
758 b->local_var_alist = XCDR (tmp); 758 B_ (b, local_var_alist) = XCDR (tmp);
759 else 759 else
760 XSETCDR (last, XCDR (tmp)); 760 XSETCDR (last, XCDR (tmp));
761 } 761 }
@@ -830,9 +830,9 @@ Return nil if BUFFER has been killed. */)
830 (register Lisp_Object buffer) 830 (register Lisp_Object buffer)
831{ 831{
832 if (NILP (buffer)) 832 if (NILP (buffer))
833 return current_buffer->name; 833 return B_ (current_buffer, name);
834 CHECK_BUFFER (buffer); 834 CHECK_BUFFER (buffer);
835 return XBUFFER (buffer)->name; 835 return B_ (XBUFFER (buffer), name);
836} 836}
837 837
838DEFUN ("buffer-file-name", Fbuffer_file_name, Sbuffer_file_name, 0, 1, 0, 838DEFUN ("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. */)
841 (register Lisp_Object buffer) 841 (register Lisp_Object buffer)
842{ 842{
843 if (NILP (buffer)) 843 if (NILP (buffer))
844 return current_buffer->filename; 844 return B_ (current_buffer, filename);
845 CHECK_BUFFER (buffer); 845 CHECK_BUFFER (buffer);
846 return XBUFFER (buffer)->filename; 846 return B_ (XBUFFER (buffer), filename);
847} 847}
848 848
849DEFUN ("buffer-base-buffer", Fbuffer_base_buffer, Sbuffer_base_buffer, 849DEFUN ("buffer-base-buffer", Fbuffer_base_buffer, Sbuffer_base_buffer,
@@ -895,7 +895,7 @@ is the default binding of the variable. */)
895 { /* Look in local_var_alist. */ 895 { /* Look in local_var_alist. */
896 struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym); 896 struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym);
897 XSETSYMBOL (variable, sym); /* Update In case of aliasing. */ 897 XSETSYMBOL (variable, sym); /* Update In case of aliasing. */
898 result = Fassoc (variable, buf->local_var_alist); 898 result = Fassoc (variable, B_ (buf, local_var_alist));
899 if (!NILP (result)) 899 if (!NILP (result))
900 { 900 {
901 if (blv->fwd) 901 if (blv->fwd)
@@ -944,7 +944,7 @@ buffer_lisp_local_variables (struct buffer *buf)
944{ 944{
945 Lisp_Object result = Qnil; 945 Lisp_Object result = Qnil;
946 register Lisp_Object tail; 946 register Lisp_Object tail;
947 for (tail = buf->local_var_alist; CONSP (tail); tail = XCDR (tail)) 947 for (tail = B_ (buf, local_var_alist); CONSP (tail); tail = XCDR (tail))
948 { 948 {
949 Lisp_Object val, elt; 949 Lisp_Object val, elt;
950 950
@@ -1043,9 +1043,9 @@ A non-nil FLAG means mark the buffer modified. */)
1043 /* If buffer becoming modified, lock the file. 1043 /* If buffer becoming modified, lock the file.
1044 If buffer becoming unmodified, unlock the file. */ 1044 If buffer becoming unmodified, unlock the file. */
1045 1045
1046 fn = current_buffer->file_truename; 1046 fn = B_ (current_buffer, file_truename);
1047 /* Test buffer-file-name so that binding it to nil is effective. */ 1047 /* Test buffer-file-name so that binding it to nil is effective. */
1048 if (!NILP (fn) && ! NILP (current_buffer->filename)) 1048 if (!NILP (fn) && ! NILP (B_ (current_buffer, filename)))
1049 { 1049 {
1050 already = SAVE_MODIFF < MODIFF; 1050 already = SAVE_MODIFF < MODIFF;
1051 if (!already && !NILP (flag)) 1051 if (!already && !NILP (flag))
@@ -1110,9 +1110,9 @@ state of the current buffer. Use with care. */)
1110 /* If buffer becoming modified, lock the file. 1110 /* If buffer becoming modified, lock the file.
1111 If buffer becoming unmodified, unlock the file. */ 1111 If buffer becoming unmodified, unlock the file. */
1112 1112
1113 fn = current_buffer->file_truename; 1113 fn = B_ (current_buffer, file_truename);
1114 /* Test buffer-file-name so that binding it to nil is effective. */ 1114 /* Test buffer-file-name so that binding it to nil is effective. */
1115 if (!NILP (fn) && ! NILP (current_buffer->filename)) 1115 if (!NILP (fn) && ! NILP (B_ (current_buffer, filename)))
1116 { 1116 {
1117 int already = SAVE_MODIFF < MODIFF; 1117 int already = SAVE_MODIFF < MODIFF;
1118 if (!already && !NILP (flag)) 1118 if (!already && !NILP (flag))
@@ -1199,14 +1199,14 @@ This does not change the name of the visited file (if any). */)
1199 with the original name. It makes UNIQUE equivalent to 1199 with the original name. It makes UNIQUE equivalent to
1200 (rename-buffer (generate-new-buffer-name NEWNAME)). */ 1200 (rename-buffer (generate-new-buffer-name NEWNAME)). */
1201 if (NILP (unique) && XBUFFER (tem) == current_buffer) 1201 if (NILP (unique) && XBUFFER (tem) == current_buffer)
1202 return current_buffer->name; 1202 return B_ (current_buffer, name);
1203 if (!NILP (unique)) 1203 if (!NILP (unique))
1204 newname = Fgenerate_new_buffer_name (newname, current_buffer->name); 1204 newname = Fgenerate_new_buffer_name (newname, B_ (current_buffer, name));
1205 else 1205 else
1206 error ("Buffer name `%s' is in use", SDATA (newname)); 1206 error ("Buffer name `%s' is in use", SDATA (newname));
1207 } 1207 }
1208 1208
1209 current_buffer->name = newname; 1209 B_ (current_buffer, name) = newname;
1210 1210
1211 /* Catch redisplay's attention. Unless we do this, the mode lines for 1211 /* Catch redisplay's attention. Unless we do this, the mode lines for
1212 any windows displaying current_buffer will stay unchanged. */ 1212 any windows displaying current_buffer will stay unchanged. */
@@ -1214,11 +1214,11 @@ This does not change the name of the visited file (if any). */)
1214 1214
1215 XSETBUFFER (buf, current_buffer); 1215 XSETBUFFER (buf, current_buffer);
1216 Fsetcar (Frassq (buf, Vbuffer_alist), newname); 1216 Fsetcar (Frassq (buf, Vbuffer_alist), newname);
1217 if (NILP (current_buffer->filename) 1217 if (NILP (B_ (current_buffer, filename))
1218 && !NILP (current_buffer->auto_save_file_name)) 1218 && !NILP (B_ (current_buffer, auto_save_file_name)))
1219 call0 (intern ("rename-auto-save-file")); 1219 call0 (intern ("rename-auto-save-file"));
1220 /* Refetch since that last call may have done GC. */ 1220 /* Refetch since that last call may have done GC. */
1221 return current_buffer->name; 1221 return B_ (current_buffer, name);
1222} 1222}
1223 1223
1224DEFUN ("other-buffer", Fother_buffer, Sother_buffer, 0, 3, 0, 1224DEFUN ("other-buffer", Fother_buffer, Sother_buffer, 0, 3, 0,
@@ -1263,9 +1263,9 @@ If BUFFER is omitted or nil, some interesting buffer is returned. */)
1263 continue; 1263 continue;
1264 if (NILP (buf)) 1264 if (NILP (buf))
1265 continue; 1265 continue;
1266 if (NILP (XBUFFER (buf)->name)) 1266 if (NILP (B_ (XBUFFER (buf), name)))
1267 continue; 1267 continue;
1268 if (SREF (XBUFFER (buf)->name, 0) == ' ') 1268 if (SREF (B_ (XBUFFER (buf), name), 0) == ' ')
1269 continue; 1269 continue;
1270 /* If the selected frame has a buffer_predicate, 1270 /* If the selected frame has a buffer_predicate,
1271 disregard buffers that don't fit the predicate. */ 1271 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. */)
1313 nsberror (buffer); 1313 nsberror (buffer);
1314 } 1314 }
1315 1315
1316 if (EQ (XBUFFER (real_buffer)->undo_list, Qt)) 1316 if (EQ (B_ (XBUFFER (real_buffer), undo_list), Qt))
1317 XBUFFER (real_buffer)->undo_list = Qnil; 1317 B_ (XBUFFER (real_buffer), undo_list) = Qnil;
1318 1318
1319 return Qnil; 1319 return Qnil;
1320} 1320}
@@ -1359,16 +1359,16 @@ with SIGHUP. */)
1359 b = XBUFFER (buffer); 1359 b = XBUFFER (buffer);
1360 1360
1361 /* Avoid trouble for buffer already dead. */ 1361 /* Avoid trouble for buffer already dead. */
1362 if (NILP (b->name)) 1362 if (NILP (B_ (b, name)))
1363 return Qnil; 1363 return Qnil;
1364 1364
1365 /* Query if the buffer is still modified. */ 1365 /* Query if the buffer is still modified. */
1366 if (INTERACTIVE && !NILP (b->filename) 1366 if (INTERACTIVE && !NILP (B_ (b, filename))
1367 && BUF_MODIFF (b) > BUF_SAVE_MODIFF (b)) 1367 && BUF_MODIFF (b) > BUF_SAVE_MODIFF (b))
1368 { 1368 {
1369 GCPRO1 (buffer); 1369 GCPRO1 (buffer);
1370 tem = do_yes_or_no_p (format2 ("Buffer %s modified; kill anyway? ", 1370 tem = do_yes_or_no_p (format2 ("Buffer %s modified; kill anyway? ",
1371 b->name, make_number (0))); 1371 B_ (b, name), make_number (0)));
1372 UNGCPRO; 1372 UNGCPRO;
1373 if (NILP (tem)) 1373 if (NILP (tem))
1374 return Qnil; 1374 return Qnil;
@@ -1402,7 +1402,7 @@ with SIGHUP. */)
1402 if (EQ (buffer, XWINDOW (minibuf_window)->buffer)) 1402 if (EQ (buffer, XWINDOW (minibuf_window)->buffer))
1403 return Qnil; 1403 return Qnil;
1404 1404
1405 if (NILP (b->name)) 1405 if (NILP (B_ (b, name)))
1406 return Qnil; 1406 return Qnil;
1407 1407
1408 /* When we kill a base buffer, kill all its indirect buffers. 1408 /* When we kill a base buffer, kill all its indirect buffers.
@@ -1417,7 +1417,7 @@ with SIGHUP. */)
1417 for (other = all_buffers; other; other = other->next) 1417 for (other = all_buffers; other; other = other->next)
1418 /* all_buffers contains dead buffers too; 1418 /* all_buffers contains dead buffers too;
1419 don't re-kill them. */ 1419 don't re-kill them. */
1420 if (other->base_buffer == b && !NILP (other->name)) 1420 if (other->base_buffer == b && !NILP (B_ (other, name)))
1421 { 1421 {
1422 Lisp_Object buffer; 1422 Lisp_Object buffer;
1423 XSETBUFFER (buffer, other); 1423 XSETBUFFER (buffer, other);
@@ -1462,7 +1462,7 @@ with SIGHUP. */)
1462 /* Killing buffer processes may run sentinels which may 1462 /* Killing buffer processes may run sentinels which may
1463 have called kill-buffer. */ 1463 have called kill-buffer. */
1464 1464
1465 if (NILP (b->name)) 1465 if (NILP (B_ (b, name)))
1466 return Qnil; 1466 return Qnil;
1467 1467
1468 clear_charpos_cache (b); 1468 clear_charpos_cache (b);
@@ -1476,7 +1476,7 @@ with SIGHUP. */)
1476 1476
1477 /* Delete any auto-save file, if we saved it in this session. 1477 /* Delete any auto-save file, if we saved it in this session.
1478 But not if the buffer is modified. */ 1478 But not if the buffer is modified. */
1479 if (STRINGP (b->auto_save_file_name) 1479 if (STRINGP (B_ (b, auto_save_file_name))
1480 && BUF_AUTOSAVE_MODIFF (b) != 0 1480 && BUF_AUTOSAVE_MODIFF (b) != 0
1481 && BUF_SAVE_MODIFF (b) < BUF_AUTOSAVE_MODIFF (b) 1481 && BUF_SAVE_MODIFF (b) < BUF_AUTOSAVE_MODIFF (b)
1482 && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b) 1482 && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)
@@ -1485,7 +1485,7 @@ with SIGHUP. */)
1485 Lisp_Object tem; 1485 Lisp_Object tem;
1486 tem = Fsymbol_value (intern ("delete-auto-save-files")); 1486 tem = Fsymbol_value (intern ("delete-auto-save-files"));
1487 if (! NILP (tem)) 1487 if (! NILP (tem))
1488 internal_delete_file (b->auto_save_file_name); 1488 internal_delete_file (B_ (b, auto_save_file_name));
1489 } 1489 }
1490 1490
1491 if (b->base_buffer) 1491 if (b->base_buffer)
@@ -1525,7 +1525,7 @@ with SIGHUP. */)
1525 swap_out_buffer_local_variables (b); 1525 swap_out_buffer_local_variables (b);
1526 reset_buffer_local_variables (b, 1); 1526 reset_buffer_local_variables (b, 1);
1527 1527
1528 b->name = Qnil; 1528 B_ (b, name) = Qnil;
1529 1529
1530 BLOCK_INPUT; 1530 BLOCK_INPUT;
1531 if (! b->base_buffer) 1531 if (! b->base_buffer)
@@ -1541,9 +1541,9 @@ with SIGHUP. */)
1541 free_region_cache (b->width_run_cache); 1541 free_region_cache (b->width_run_cache);
1542 b->width_run_cache = 0; 1542 b->width_run_cache = 0;
1543 } 1543 }
1544 b->width_table = Qnil; 1544 B_ (b, width_table) = Qnil;
1545 UNBLOCK_INPUT; 1545 UNBLOCK_INPUT;
1546 b->undo_list = Qnil; 1546 B_ (b, undo_list) = Qnil;
1547 1547
1548 return Qt; 1548 return Qt;
1549} 1549}
@@ -1637,15 +1637,15 @@ the current buffer's major mode. */)
1637 1637
1638 CHECK_BUFFER (buffer); 1638 CHECK_BUFFER (buffer);
1639 1639
1640 if (STRINGP (XBUFFER (buffer)->name) 1640 if (STRINGP (B_ (XBUFFER (buffer), name))
1641 && strcmp (SSDATA (XBUFFER (buffer)->name), "*scratch*") == 0) 1641 && strcmp (SSDATA (B_ (XBUFFER (buffer), name)), "*scratch*") == 0)
1642 function = find_symbol_value (intern ("initial-major-mode")); 1642 function = find_symbol_value (intern ("initial-major-mode"));
1643 else 1643 else
1644 { 1644 {
1645 function = buffer_defaults.major_mode; 1645 function = B_ (&buffer_defaults, major_mode);
1646 if (NILP (function) 1646 if (NILP (function)
1647 && NILP (Fget (current_buffer->major_mode, Qmode_class))) 1647 && NILP (Fget (B_ (current_buffer, major_mode), Qmode_class)))
1648 function = current_buffer->major_mode; 1648 function = B_ (current_buffer, major_mode);
1649 } 1649 }
1650 1650
1651 if (NILP (function) || EQ (function, Qfundamental_mode)) 1651 if (NILP (function) || EQ (function, Qfundamental_mode))
@@ -1795,29 +1795,29 @@ set_buffer_internal_1 (register struct buffer *b)
1795 /* Put the undo list back in the base buffer, so that it appears 1795 /* Put the undo list back in the base buffer, so that it appears
1796 that an indirect buffer shares the undo list of its base. */ 1796 that an indirect buffer shares the undo list of its base. */
1797 if (old_buf->base_buffer) 1797 if (old_buf->base_buffer)
1798 old_buf->base_buffer->undo_list = old_buf->undo_list; 1798 B_ (old_buf->base_buffer, undo_list) = B_ (old_buf, undo_list);
1799 1799
1800 /* If the old current buffer has markers to record PT, BEGV and ZV 1800 /* If the old current buffer has markers to record PT, BEGV and ZV
1801 when it is not current, update them now. */ 1801 when it is not current, update them now. */
1802 if (! NILP (old_buf->pt_marker)) 1802 if (! NILP (B_ (old_buf, pt_marker)))
1803 { 1803 {
1804 Lisp_Object obuf; 1804 Lisp_Object obuf;
1805 XSETBUFFER (obuf, old_buf); 1805 XSETBUFFER (obuf, old_buf);
1806 set_marker_both (old_buf->pt_marker, obuf, 1806 set_marker_both (B_ (old_buf, pt_marker), obuf,
1807 BUF_PT (old_buf), BUF_PT_BYTE (old_buf)); 1807 BUF_PT (old_buf), BUF_PT_BYTE (old_buf));
1808 } 1808 }
1809 if (! NILP (old_buf->begv_marker)) 1809 if (! NILP (B_ (old_buf, begv_marker)))
1810 { 1810 {
1811 Lisp_Object obuf; 1811 Lisp_Object obuf;
1812 XSETBUFFER (obuf, old_buf); 1812 XSETBUFFER (obuf, old_buf);
1813 set_marker_both (old_buf->begv_marker, obuf, 1813 set_marker_both (B_ (old_buf, begv_marker), obuf,
1814 BUF_BEGV (old_buf), BUF_BEGV_BYTE (old_buf)); 1814 BUF_BEGV (old_buf), BUF_BEGV_BYTE (old_buf));
1815 } 1815 }
1816 if (! NILP (old_buf->zv_marker)) 1816 if (! NILP (B_ (old_buf, zv_marker)))
1817 { 1817 {
1818 Lisp_Object obuf; 1818 Lisp_Object obuf;
1819 XSETBUFFER (obuf, old_buf); 1819 XSETBUFFER (obuf, old_buf);
1820 set_marker_both (old_buf->zv_marker, obuf, 1820 set_marker_both (B_ (old_buf, zv_marker), obuf,
1821 BUF_ZV (old_buf), BUF_ZV_BYTE (old_buf)); 1821 BUF_ZV (old_buf), BUF_ZV_BYTE (old_buf));
1822 } 1822 }
1823 } 1823 }
@@ -1825,24 +1825,24 @@ set_buffer_internal_1 (register struct buffer *b)
1825 /* Get the undo list from the base buffer, so that it appears 1825 /* Get the undo list from the base buffer, so that it appears
1826 that an indirect buffer shares the undo list of its base. */ 1826 that an indirect buffer shares the undo list of its base. */
1827 if (b->base_buffer) 1827 if (b->base_buffer)
1828 b->undo_list = b->base_buffer->undo_list; 1828 B_ (b, undo_list) = B_ (b->base_buffer, undo_list);
1829 1829
1830 /* If the new current buffer has markers to record PT, BEGV and ZV 1830 /* If the new current buffer has markers to record PT, BEGV and ZV
1831 when it is not current, fetch them now. */ 1831 when it is not current, fetch them now. */
1832 if (! NILP (b->pt_marker)) 1832 if (! NILP (B_ (b, pt_marker)))
1833 { 1833 {
1834 BUF_PT (b) = marker_position (b->pt_marker); 1834 BUF_PT (b) = marker_position (B_ (b, pt_marker));
1835 BUF_PT_BYTE (b) = marker_byte_position (b->pt_marker); 1835 BUF_PT_BYTE (b) = marker_byte_position (B_ (b, pt_marker));
1836 } 1836 }
1837 if (! NILP (b->begv_marker)) 1837 if (! NILP (B_ (b, begv_marker)))
1838 { 1838 {
1839 BUF_BEGV (b) = marker_position (b->begv_marker); 1839 BUF_BEGV (b) = marker_position (B_ (b, begv_marker));
1840 BUF_BEGV_BYTE (b) = marker_byte_position (b->begv_marker); 1840 BUF_BEGV_BYTE (b) = marker_byte_position (B_ (b, begv_marker));
1841 } 1841 }
1842 if (! NILP (b->zv_marker)) 1842 if (! NILP (B_ (b, zv_marker)))
1843 { 1843 {
1844 BUF_ZV (b) = marker_position (b->zv_marker); 1844 BUF_ZV (b) = marker_position (B_ (b, zv_marker));
1845 BUF_ZV_BYTE (b) = marker_byte_position (b->zv_marker); 1845 BUF_ZV_BYTE (b) = marker_byte_position (B_ (b, zv_marker));
1846 } 1846 }
1847 1847
1848 /* Look down buffer's list of local Lisp variables 1848 /* Look down buffer's list of local Lisp variables
@@ -1850,7 +1850,7 @@ set_buffer_internal_1 (register struct buffer *b)
1850 1850
1851 do 1851 do
1852 { 1852 {
1853 for (tail = b->local_var_alist; CONSP (tail); tail = XCDR (tail)) 1853 for (tail = B_ (b, local_var_alist); CONSP (tail); tail = XCDR (tail))
1854 { 1854 {
1855 Lisp_Object var = XCAR (XCAR (tail)); 1855 Lisp_Object var = XCAR (XCAR (tail));
1856 struct Lisp_Symbol *sym = XSYMBOL (var); 1856 struct Lisp_Symbol *sym = XSYMBOL (var);
@@ -1883,45 +1883,45 @@ set_buffer_temp (struct buffer *b)
1883 { 1883 {
1884 /* If the old current buffer has markers to record PT, BEGV and ZV 1884 /* If the old current buffer has markers to record PT, BEGV and ZV
1885 when it is not current, update them now. */ 1885 when it is not current, update them now. */
1886 if (! NILP (old_buf->pt_marker)) 1886 if (! NILP (B_ (old_buf, pt_marker)))
1887 { 1887 {
1888 Lisp_Object obuf; 1888 Lisp_Object obuf;
1889 XSETBUFFER (obuf, old_buf); 1889 XSETBUFFER (obuf, old_buf);
1890 set_marker_both (old_buf->pt_marker, obuf, 1890 set_marker_both (B_ (old_buf, pt_marker), obuf,
1891 BUF_PT (old_buf), BUF_PT_BYTE (old_buf)); 1891 BUF_PT (old_buf), BUF_PT_BYTE (old_buf));
1892 } 1892 }
1893 if (! NILP (old_buf->begv_marker)) 1893 if (! NILP (B_ (old_buf, begv_marker)))
1894 { 1894 {
1895 Lisp_Object obuf; 1895 Lisp_Object obuf;
1896 XSETBUFFER (obuf, old_buf); 1896 XSETBUFFER (obuf, old_buf);
1897 set_marker_both (old_buf->begv_marker, obuf, 1897 set_marker_both (B_ (old_buf, begv_marker), obuf,
1898 BUF_BEGV (old_buf), BUF_BEGV_BYTE (old_buf)); 1898 BUF_BEGV (old_buf), BUF_BEGV_BYTE (old_buf));
1899 } 1899 }
1900 if (! NILP (old_buf->zv_marker)) 1900 if (! NILP (B_ (old_buf, zv_marker)))
1901 { 1901 {
1902 Lisp_Object obuf; 1902 Lisp_Object obuf;
1903 XSETBUFFER (obuf, old_buf); 1903 XSETBUFFER (obuf, old_buf);
1904 set_marker_both (old_buf->zv_marker, obuf, 1904 set_marker_both (B_ (old_buf, zv_marker), obuf,
1905 BUF_ZV (old_buf), BUF_ZV_BYTE (old_buf)); 1905 BUF_ZV (old_buf), BUF_ZV_BYTE (old_buf));
1906 } 1906 }
1907 } 1907 }
1908 1908
1909 /* If the new current buffer has markers to record PT, BEGV and ZV 1909 /* If the new current buffer has markers to record PT, BEGV and ZV
1910 when it is not current, fetch them now. */ 1910 when it is not current, fetch them now. */
1911 if (! NILP (b->pt_marker)) 1911 if (! NILP (B_ (b, pt_marker)))
1912 { 1912 {
1913 BUF_PT (b) = marker_position (b->pt_marker); 1913 BUF_PT (b) = marker_position (B_ (b, pt_marker));
1914 BUF_PT_BYTE (b) = marker_byte_position (b->pt_marker); 1914 BUF_PT_BYTE (b) = marker_byte_position (B_ (b, pt_marker));
1915 } 1915 }
1916 if (! NILP (b->begv_marker)) 1916 if (! NILP (B_ (b, begv_marker)))
1917 { 1917 {
1918 BUF_BEGV (b) = marker_position (b->begv_marker); 1918 BUF_BEGV (b) = marker_position (B_ (b, begv_marker));
1919 BUF_BEGV_BYTE (b) = marker_byte_position (b->begv_marker); 1919 BUF_BEGV_BYTE (b) = marker_byte_position (B_ (b, begv_marker));
1920 } 1920 }
1921 if (! NILP (b->zv_marker)) 1921 if (! NILP (B_ (b, zv_marker)))
1922 { 1922 {
1923 BUF_ZV (b) = marker_position (b->zv_marker); 1923 BUF_ZV (b) = marker_position (B_ (b, zv_marker));
1924 BUF_ZV_BYTE (b) = marker_byte_position (b->zv_marker); 1924 BUF_ZV_BYTE (b) = marker_byte_position (B_ (b, zv_marker));
1925 } 1925 }
1926} 1926}
1927 1927
@@ -1938,7 +1938,7 @@ ends when the current command terminates. Use `switch-to-buffer' or
1938 buffer = Fget_buffer (buffer_or_name); 1938 buffer = Fget_buffer (buffer_or_name);
1939 if (NILP (buffer)) 1939 if (NILP (buffer))
1940 nsberror (buffer_or_name); 1940 nsberror (buffer_or_name);
1941 if (NILP (XBUFFER (buffer)->name)) 1941 if (NILP (B_ (XBUFFER (buffer), name)))
1942 error ("Selecting deleted buffer"); 1942 error ("Selecting deleted buffer");
1943 set_buffer_internal (XBUFFER (buffer)); 1943 set_buffer_internal (XBUFFER (buffer));
1944 return buffer; 1944 return buffer;
@@ -1949,7 +1949,7 @@ ends when the current command terminates. Use `switch-to-buffer' or
1949Lisp_Object 1949Lisp_Object
1950set_buffer_if_live (Lisp_Object buffer) 1950set_buffer_if_live (Lisp_Object buffer)
1951{ 1951{
1952 if (! NILP (XBUFFER (buffer)->name)) 1952 if (! NILP (B_ (XBUFFER (buffer), name)))
1953 Fset_buffer (buffer); 1953 Fset_buffer (buffer);
1954 return Qnil; 1954 return Qnil;
1955} 1955}
@@ -1959,7 +1959,7 @@ DEFUN ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only,
1959 doc: /* Signal a `buffer-read-only' error if the current buffer is read-only. */) 1959 doc: /* Signal a `buffer-read-only' error if the current buffer is read-only. */)
1960 (void) 1960 (void)
1961{ 1961{
1962 if (!NILP (current_buffer->read_only) 1962 if (!NILP (B_ (current_buffer, read_only))
1963 && NILP (Vinhibit_read_only)) 1963 && NILP (Vinhibit_read_only))
1964 xsignal1 (Qbuffer_read_only, Fcurrent_buffer ()); 1964 xsignal1 (Qbuffer_read_only, Fcurrent_buffer ());
1965 return Qnil; 1965 return Qnil;
@@ -2008,7 +2008,7 @@ its frame, iconify that frame. */)
2008 2008
2009 /* Move buffer to the end of the buffer list. Do nothing if the 2009 /* Move buffer to the end of the buffer list. Do nothing if the
2010 buffer is killed. */ 2010 buffer is killed. */
2011 if (!NILP (XBUFFER (buffer)->name)) 2011 if (!NILP (B_ (XBUFFER (buffer), name)))
2012 { 2012 {
2013 Lisp_Object aelt, link; 2013 Lisp_Object aelt, link;
2014 2014
@@ -2041,7 +2041,7 @@ so the buffer is truly empty after this. */)
2041 /* Prevent warnings, or suspension of auto saving, that would happen 2041 /* Prevent warnings, or suspension of auto saving, that would happen
2042 if future size is less than past size. Use of erase-buffer 2042 if future size is less than past size. Use of erase-buffer
2043 implies that the future text is not really related to the past text. */ 2043 implies that the future text is not really related to the past text. */
2044 XSETFASTINT (current_buffer->save_length, 0); 2044 XSETFASTINT (B_ (current_buffer, save_length), 0);
2045 return Qnil; 2045 return Qnil;
2046} 2046}
2047 2047
@@ -2111,7 +2111,7 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
2111 CHECK_BUFFER (buffer); 2111 CHECK_BUFFER (buffer);
2112 other_buffer = XBUFFER (buffer); 2112 other_buffer = XBUFFER (buffer);
2113 2113
2114 if (NILP (other_buffer->name)) 2114 if (NILP (B_ (other_buffer, name)))
2115 error ("Cannot swap a dead buffer's text"); 2115 error ("Cannot swap a dead buffer's text");
2116 2116
2117 /* Actually, it probably works just fine. 2117 /* Actually, it probably works just fine.
@@ -2138,6 +2138,12 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
2138 other_buffer->field = current_buffer->field; \ 2138 other_buffer->field = current_buffer->field; \
2139 current_buffer->field = tmp##field; \ 2139 current_buffer->field = tmp##field; \
2140 } while (0) 2140 } while (0)
2141#define swapfield_(field, type) \
2142 do { \
2143 type tmp##field = B_ (other_buffer, field); \
2144 B_ (other_buffer, field) = B_ (current_buffer, field); \
2145 B_ (current_buffer, field) = tmp##field; \
2146 } while (0)
2141 2147
2142 swapfield (own_text, struct buffer_text); 2148 swapfield (own_text, struct buffer_text);
2143 eassert (current_buffer->text == &current_buffer->own_text); 2149 eassert (current_buffer->text == &current_buffer->own_text);
@@ -2165,18 +2171,18 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
2165 swapfield (overlays_before, struct Lisp_Overlay *); 2171 swapfield (overlays_before, struct Lisp_Overlay *);
2166 swapfield (overlays_after, struct Lisp_Overlay *); 2172 swapfield (overlays_after, struct Lisp_Overlay *);
2167 swapfield (overlay_center, EMACS_INT); 2173 swapfield (overlay_center, EMACS_INT);
2168 swapfield (undo_list, Lisp_Object); 2174 swapfield_ (undo_list, Lisp_Object);
2169 swapfield (mark, Lisp_Object); 2175 swapfield_ (mark, Lisp_Object);
2170 swapfield (enable_multibyte_characters, Lisp_Object); 2176 swapfield_ (enable_multibyte_characters, Lisp_Object);
2171 swapfield (bidi_display_reordering, Lisp_Object); 2177 swapfield_ (bidi_display_reordering, Lisp_Object);
2172 swapfield (bidi_paragraph_direction, Lisp_Object); 2178 swapfield_ (bidi_paragraph_direction, Lisp_Object);
2173 /* FIXME: Not sure what we should do with these *_marker fields. 2179 /* FIXME: Not sure what we should do with these *_marker fields.
2174 Hopefully they're just nil anyway. */ 2180 Hopefully they're just nil anyway. */
2175 swapfield (pt_marker, Lisp_Object); 2181 swapfield_ (pt_marker, Lisp_Object);
2176 swapfield (begv_marker, Lisp_Object); 2182 swapfield_ (begv_marker, Lisp_Object);
2177 swapfield (zv_marker, Lisp_Object); 2183 swapfield_ (zv_marker, Lisp_Object);
2178 current_buffer->point_before_scroll = Qnil; 2184 B_ (current_buffer, point_before_scroll) = Qnil;
2179 other_buffer->point_before_scroll = Qnil; 2185 B_ (other_buffer, point_before_scroll) = Qnil;
2180 2186
2181 current_buffer->text->modiff++; other_buffer->text->modiff++; 2187 current_buffer->text->modiff++; other_buffer->text->modiff++;
2182 current_buffer->text->chars_modiff++; other_buffer->text->chars_modiff++; 2188 current_buffer->text->chars_modiff++; other_buffer->text->chars_modiff++;
@@ -2250,21 +2256,21 @@ current buffer is cleared. */)
2250 EMACS_INT begv, zv; 2256 EMACS_INT begv, zv;
2251 int narrowed = (BEG != BEGV || Z != ZV); 2257 int narrowed = (BEG != BEGV || Z != ZV);
2252 int modified_p = !NILP (Fbuffer_modified_p (Qnil)); 2258 int modified_p = !NILP (Fbuffer_modified_p (Qnil));
2253 Lisp_Object old_undo = current_buffer->undo_list; 2259 Lisp_Object old_undo = B_ (current_buffer, undo_list);
2254 struct gcpro gcpro1; 2260 struct gcpro gcpro1;
2255 2261
2256 if (current_buffer->base_buffer) 2262 if (current_buffer->base_buffer)
2257 error ("Cannot do `set-buffer-multibyte' on an indirect buffer"); 2263 error ("Cannot do `set-buffer-multibyte' on an indirect buffer");
2258 2264
2259 /* Do nothing if nothing actually changes. */ 2265 /* Do nothing if nothing actually changes. */
2260 if (NILP (flag) == NILP (current_buffer->enable_multibyte_characters)) 2266 if (NILP (flag) == NILP (B_ (current_buffer, enable_multibyte_characters)))
2261 return flag; 2267 return flag;
2262 2268
2263 GCPRO1 (old_undo); 2269 GCPRO1 (old_undo);
2264 2270
2265 /* Don't record these buffer changes. We will put a special undo entry 2271 /* Don't record these buffer changes. We will put a special undo entry
2266 instead. */ 2272 instead. */
2267 current_buffer->undo_list = Qt; 2273 B_ (current_buffer, undo_list) = Qt;
2268 2274
2269 /* If the cached position is for this buffer, clear it out. */ 2275 /* If the cached position is for this buffer, clear it out. */
2270 clear_charpos_cache (current_buffer); 2276 clear_charpos_cache (current_buffer);
@@ -2286,7 +2292,7 @@ current buffer is cleared. */)
2286 to calculate the old correspondences. */ 2292 to calculate the old correspondences. */
2287 set_intervals_multibyte (0); 2293 set_intervals_multibyte (0);
2288 2294
2289 current_buffer->enable_multibyte_characters = Qnil; 2295 B_ (current_buffer, enable_multibyte_characters) = Qnil;
2290 2296
2291 Z = Z_BYTE; 2297 Z = Z_BYTE;
2292 BEGV = BEGV_BYTE; 2298 BEGV = BEGV_BYTE;
@@ -2424,7 +2430,7 @@ current buffer is cleared. */)
2424 2430
2425 /* Do this first, so that chars_in_text asks the right question. 2431 /* Do this first, so that chars_in_text asks the right question.
2426 set_intervals_multibyte needs it too. */ 2432 set_intervals_multibyte needs it too. */
2427 current_buffer->enable_multibyte_characters = Qt; 2433 B_ (current_buffer, enable_multibyte_characters) = Qt;
2428 2434
2429 GPT_BYTE = advance_to_char_boundary (GPT_BYTE); 2435 GPT_BYTE = advance_to_char_boundary (GPT_BYTE);
2430 GPT = chars_in_text (BEG_ADDR, GPT_BYTE - BEG_BYTE) + BEG; 2436 GPT = chars_in_text (BEG_ADDR, GPT_BYTE - BEG_BYTE) + BEG;
@@ -2482,7 +2488,7 @@ current buffer is cleared. */)
2482 if (!EQ (old_undo, Qt)) 2488 if (!EQ (old_undo, Qt))
2483 { 2489 {
2484 /* Represent all the above changes by a special undo entry. */ 2490 /* Represent all the above changes by a special undo entry. */
2485 current_buffer->undo_list = Fcons (list3 (Qapply, 2491 B_ (current_buffer, undo_list) = Fcons (list3 (Qapply,
2486 intern ("set-buffer-multibyte"), 2492 intern ("set-buffer-multibyte"),
2487 NILP (flag) ? Qt : Qnil), 2493 NILP (flag) ? Qt : Qnil),
2488 old_undo); 2494 old_undo);
@@ -2498,10 +2504,10 @@ current buffer is cleared. */)
2498 /* Copy this buffer's new multibyte status 2504 /* Copy this buffer's new multibyte status
2499 into all of its indirect buffers. */ 2505 into all of its indirect buffers. */
2500 for (other = all_buffers; other; other = other->next) 2506 for (other = all_buffers; other; other = other->next)
2501 if (other->base_buffer == current_buffer && !NILP (other->name)) 2507 if (other->base_buffer == current_buffer && !NILP (B_ (other, name)))
2502 { 2508 {
2503 other->enable_multibyte_characters 2509 B_ (other, enable_multibyte_characters)
2504 = current_buffer->enable_multibyte_characters; 2510 = B_ (current_buffer, enable_multibyte_characters);
2505 other->prevent_redisplay_optimizations_p = 1; 2511 other->prevent_redisplay_optimizations_p = 1;
2506 } 2512 }
2507 2513
@@ -2568,7 +2574,7 @@ swap_out_buffer_local_variables (struct buffer *b)
2568 Lisp_Object oalist, alist, buffer; 2574 Lisp_Object oalist, alist, buffer;
2569 2575
2570 XSETBUFFER (buffer, b); 2576 XSETBUFFER (buffer, b);
2571 oalist = b->local_var_alist; 2577 oalist = B_ (b, local_var_alist);
2572 2578
2573 for (alist = oalist; CONSP (alist); alist = XCDR (alist)) 2579 for (alist = oalist; CONSP (alist); alist = XCDR (alist))
2574 { 2580 {
@@ -3072,7 +3078,7 @@ record_overlay_string (struct sortstrlist *ssl, Lisp_Object str, Lisp_Object str
3072 ssl->buf[ssl->used].priority = (INTEGERP (pri) ? XINT (pri) : 0); 3078 ssl->buf[ssl->used].priority = (INTEGERP (pri) ? XINT (pri) : 0);
3073 ssl->used++; 3079 ssl->used++;
3074 3080
3075 if (NILP (current_buffer->enable_multibyte_characters)) 3081 if (NILP (B_ (current_buffer, enable_multibyte_characters)))
3076 nbytes = SCHARS (str); 3082 nbytes = SCHARS (str);
3077 else if (! STRING_MULTIBYTE (str)) 3083 else if (! STRING_MULTIBYTE (str))
3078 nbytes = count_size_as_multibyte (SDATA (str), 3084 nbytes = count_size_as_multibyte (SDATA (str),
@@ -3084,7 +3090,7 @@ record_overlay_string (struct sortstrlist *ssl, Lisp_Object str, Lisp_Object str
3084 3090
3085 if (STRINGP (str2)) 3091 if (STRINGP (str2))
3086 { 3092 {
3087 if (NILP (current_buffer->enable_multibyte_characters)) 3093 if (NILP (B_ (current_buffer, enable_multibyte_characters)))
3088 nbytes = SCHARS (str2); 3094 nbytes = SCHARS (str2);
3089 else if (! STRING_MULTIBYTE (str2)) 3095 else if (! STRING_MULTIBYTE (str2))
3090 nbytes = count_size_as_multibyte (SDATA (str2), 3096 nbytes = count_size_as_multibyte (SDATA (str2),
@@ -3114,7 +3120,7 @@ overlay_strings (EMACS_INT pos, struct window *w, unsigned char **pstr)
3114 Lisp_Object overlay, window, str; 3120 Lisp_Object overlay, window, str;
3115 struct Lisp_Overlay *ov; 3121 struct Lisp_Overlay *ov;
3116 EMACS_INT startpos, endpos; 3122 EMACS_INT startpos, endpos;
3117 int multibyte = ! NILP (current_buffer->enable_multibyte_characters); 3123 int multibyte = ! NILP (B_ (current_buffer, enable_multibyte_characters));
3118 3124
3119 overlay_heads.used = overlay_heads.bytes = 0; 3125 overlay_heads.used = overlay_heads.bytes = 0;
3120 overlay_tails.used = overlay_tails.bytes = 0; 3126 overlay_tails.used = overlay_tails.bytes = 0;
@@ -4985,9 +4991,9 @@ init_buffer_once (void)
4985 /* Make sure all markable slots in buffer_defaults 4991 /* Make sure all markable slots in buffer_defaults
4986 are initialized reasonably, so mark_buffer won't choke. */ 4992 are initialized reasonably, so mark_buffer won't choke. */
4987 reset_buffer (&buffer_defaults); 4993 reset_buffer (&buffer_defaults);
4988 eassert (EQ (buffer_defaults.name, make_number (0))); 4994 eassert (EQ (B_ (&buffer_defaults, name), make_number (0)));
4989 reset_buffer_local_variables (&buffer_defaults, 1); 4995 reset_buffer_local_variables (&buffer_defaults, 1);
4990 eassert (EQ (buffer_local_symbols.name, make_number (0))); 4996 eassert (EQ (B_ (&buffer_local_symbols, name), make_number (0)));
4991 reset_buffer (&buffer_local_symbols); 4997 reset_buffer (&buffer_local_symbols);
4992 reset_buffer_local_variables (&buffer_local_symbols, 1); 4998 reset_buffer_local_variables (&buffer_local_symbols, 1);
4993 /* Prevent GC from getting confused. */ 4999 /* Prevent GC from getting confused. */
@@ -5004,60 +5010,60 @@ init_buffer_once (void)
5004 /* Must do these before making the first buffer! */ 5010 /* Must do these before making the first buffer! */
5005 5011
5006 /* real setup is done in bindings.el */ 5012 /* real setup is done in bindings.el */
5007 buffer_defaults.mode_line_format = make_pure_c_string ("%-"); 5013 B_ (&buffer_defaults, mode_line_format) = make_pure_c_string ("%-");
5008 buffer_defaults.header_line_format = Qnil; 5014 B_ (&buffer_defaults, header_line_format) = Qnil;
5009 buffer_defaults.abbrev_mode = Qnil; 5015 B_ (&buffer_defaults, abbrev_mode) = Qnil;
5010 buffer_defaults.overwrite_mode = Qnil; 5016 B_ (&buffer_defaults, overwrite_mode) = Qnil;
5011 buffer_defaults.case_fold_search = Qt; 5017 B_ (&buffer_defaults, case_fold_search) = Qt;
5012 buffer_defaults.auto_fill_function = Qnil; 5018 B_ (&buffer_defaults, auto_fill_function) = Qnil;
5013 buffer_defaults.selective_display = Qnil; 5019 B_ (&buffer_defaults, selective_display) = Qnil;
5014#ifndef old 5020#ifndef old
5015 buffer_defaults.selective_display_ellipses = Qt; 5021 B_ (&buffer_defaults, selective_display_ellipses) = Qt;
5016#endif 5022#endif
5017 buffer_defaults.abbrev_table = Qnil; 5023 B_ (&buffer_defaults, abbrev_table) = Qnil;
5018 buffer_defaults.display_table = Qnil; 5024 B_ (&buffer_defaults, display_table) = Qnil;
5019 buffer_defaults.undo_list = Qnil; 5025 B_ (&buffer_defaults, undo_list) = Qnil;
5020 buffer_defaults.mark_active = Qnil; 5026 B_ (&buffer_defaults, mark_active) = Qnil;
5021 buffer_defaults.file_format = Qnil; 5027 B_ (&buffer_defaults, file_format) = Qnil;
5022 buffer_defaults.auto_save_file_format = Qt; 5028 B_ (&buffer_defaults, auto_save_file_format) = Qt;
5023 buffer_defaults.overlays_before = NULL; 5029 buffer_defaults.overlays_before = NULL;
5024 buffer_defaults.overlays_after = NULL; 5030 buffer_defaults.overlays_after = NULL;
5025 buffer_defaults.overlay_center = BEG; 5031 buffer_defaults.overlay_center = BEG;
5026 5032
5027 XSETFASTINT (buffer_defaults.tab_width, 8); 5033 XSETFASTINT (B_ (&buffer_defaults, tab_width), 8);
5028 buffer_defaults.truncate_lines = Qnil; 5034 B_ (&buffer_defaults, truncate_lines) = Qnil;
5029 buffer_defaults.word_wrap = Qnil; 5035 B_ (&buffer_defaults, word_wrap) = Qnil;
5030 buffer_defaults.ctl_arrow = Qt; 5036 B_ (&buffer_defaults, ctl_arrow) = Qt;
5031 buffer_defaults.bidi_display_reordering = Qnil; 5037 B_ (&buffer_defaults, bidi_display_reordering) = Qnil;
5032 buffer_defaults.bidi_paragraph_direction = Qnil; 5038 B_ (&buffer_defaults, bidi_paragraph_direction) = Qnil;
5033 buffer_defaults.cursor_type = Qt; 5039 B_ (&buffer_defaults, cursor_type) = Qt;
5034 buffer_defaults.extra_line_spacing = Qnil; 5040 B_ (&buffer_defaults, extra_line_spacing) = Qnil;
5035 buffer_defaults.cursor_in_non_selected_windows = Qt; 5041 B_ (&buffer_defaults, cursor_in_non_selected_windows) = Qt;
5036 5042
5037#ifdef DOS_NT 5043#ifdef DOS_NT
5038 buffer_defaults.buffer_file_type = Qnil; /* TEXT */ 5044 B_ (&buffer_defaults, buffer_file_type) = Qnil; /* TEXT */
5039#endif 5045#endif
5040 buffer_defaults.enable_multibyte_characters = Qt; 5046 B_ (&buffer_defaults, enable_multibyte_characters) = Qt;
5041 buffer_defaults.buffer_file_coding_system = Qnil; 5047 B_ (&buffer_defaults, buffer_file_coding_system) = Qnil;
5042 XSETFASTINT (buffer_defaults.fill_column, 70); 5048 XSETFASTINT (B_ (&buffer_defaults, fill_column), 70);
5043 XSETFASTINT (buffer_defaults.left_margin, 0); 5049 XSETFASTINT (B_ (&buffer_defaults, left_margin), 0);
5044 buffer_defaults.cache_long_line_scans = Qnil; 5050 B_ (&buffer_defaults, cache_long_line_scans) = Qnil;
5045 buffer_defaults.file_truename = Qnil; 5051 B_ (&buffer_defaults, file_truename) = Qnil;
5046 XSETFASTINT (buffer_defaults.display_count, 0); 5052 XSETFASTINT (B_ (&buffer_defaults, display_count), 0);
5047 XSETFASTINT (buffer_defaults.left_margin_cols, 0); 5053 XSETFASTINT (B_ (&buffer_defaults, left_margin_cols), 0);
5048 XSETFASTINT (buffer_defaults.right_margin_cols, 0); 5054 XSETFASTINT (B_ (&buffer_defaults, right_margin_cols), 0);
5049 buffer_defaults.left_fringe_width = Qnil; 5055 B_ (&buffer_defaults, left_fringe_width) = Qnil;
5050 buffer_defaults.right_fringe_width = Qnil; 5056 B_ (&buffer_defaults, right_fringe_width) = Qnil;
5051 buffer_defaults.fringes_outside_margins = Qnil; 5057 B_ (&buffer_defaults, fringes_outside_margins) = Qnil;
5052 buffer_defaults.scroll_bar_width = Qnil; 5058 B_ (&buffer_defaults, scroll_bar_width) = Qnil;
5053 buffer_defaults.vertical_scroll_bar_type = Qt; 5059 B_ (&buffer_defaults, vertical_scroll_bar_type) = Qt;
5054 buffer_defaults.indicate_empty_lines = Qnil; 5060 B_ (&buffer_defaults, indicate_empty_lines) = Qnil;
5055 buffer_defaults.indicate_buffer_boundaries = Qnil; 5061 B_ (&buffer_defaults, indicate_buffer_boundaries) = Qnil;
5056 buffer_defaults.fringe_indicator_alist = Qnil; 5062 B_ (&buffer_defaults, fringe_indicator_alist) = Qnil;
5057 buffer_defaults.fringe_cursor_alist = Qnil; 5063 B_ (&buffer_defaults, fringe_cursor_alist) = Qnil;
5058 buffer_defaults.scroll_up_aggressively = Qnil; 5064 B_ (&buffer_defaults, scroll_up_aggressively) = Qnil;
5059 buffer_defaults.scroll_down_aggressively = Qnil; 5065 B_ (&buffer_defaults, scroll_down_aggressively) = Qnil;
5060 buffer_defaults.display_time = Qnil; 5066 B_ (&buffer_defaults, display_time) = Qnil;
5061 5067
5062 /* Assign the local-flags to the slots that have default values. 5068 /* Assign the local-flags to the slots that have default values.
5063 The local flag is a bit that is used in the buffer 5069 The local flag is a bit that is used in the buffer
@@ -5069,73 +5075,73 @@ init_buffer_once (void)
5069 5075
5070 /* 0 means not a lisp var, -1 means always local, else mask */ 5076 /* 0 means not a lisp var, -1 means always local, else mask */
5071 memset (&buffer_local_flags, 0, sizeof buffer_local_flags); 5077 memset (&buffer_local_flags, 0, sizeof buffer_local_flags);
5072 XSETINT (buffer_local_flags.filename, -1); 5078 XSETINT (B_ (&buffer_local_flags, filename), -1);
5073 XSETINT (buffer_local_flags.directory, -1); 5079 XSETINT (B_ (&buffer_local_flags, directory), -1);
5074 XSETINT (buffer_local_flags.backed_up, -1); 5080 XSETINT (B_ (&buffer_local_flags, backed_up), -1);
5075 XSETINT (buffer_local_flags.save_length, -1); 5081 XSETINT (B_ (&buffer_local_flags, save_length), -1);
5076 XSETINT (buffer_local_flags.auto_save_file_name, -1); 5082 XSETINT (B_ (&buffer_local_flags, auto_save_file_name), -1);
5077 XSETINT (buffer_local_flags.read_only, -1); 5083 XSETINT (B_ (&buffer_local_flags, read_only), -1);
5078 XSETINT (buffer_local_flags.major_mode, -1); 5084 XSETINT (B_ (&buffer_local_flags, major_mode), -1);
5079 XSETINT (buffer_local_flags.mode_name, -1); 5085 XSETINT (B_ (&buffer_local_flags, mode_name), -1);
5080 XSETINT (buffer_local_flags.undo_list, -1); 5086 XSETINT (B_ (&buffer_local_flags, undo_list), -1);
5081 XSETINT (buffer_local_flags.mark_active, -1); 5087 XSETINT (B_ (&buffer_local_flags, mark_active), -1);
5082 XSETINT (buffer_local_flags.point_before_scroll, -1); 5088 XSETINT (B_ (&buffer_local_flags, point_before_scroll), -1);
5083 XSETINT (buffer_local_flags.file_truename, -1); 5089 XSETINT (B_ (&buffer_local_flags, file_truename), -1);
5084 XSETINT (buffer_local_flags.invisibility_spec, -1); 5090 XSETINT (B_ (&buffer_local_flags, invisibility_spec), -1);
5085 XSETINT (buffer_local_flags.file_format, -1); 5091 XSETINT (B_ (&buffer_local_flags, file_format), -1);
5086 XSETINT (buffer_local_flags.auto_save_file_format, -1); 5092 XSETINT (B_ (&buffer_local_flags, auto_save_file_format), -1);
5087 XSETINT (buffer_local_flags.display_count, -1); 5093 XSETINT (B_ (&buffer_local_flags, display_count), -1);
5088 XSETINT (buffer_local_flags.display_time, -1); 5094 XSETINT (B_ (&buffer_local_flags, display_time), -1);
5089 XSETINT (buffer_local_flags.enable_multibyte_characters, -1); 5095 XSETINT (B_ (&buffer_local_flags, enable_multibyte_characters), -1);
5090 5096
5091 idx = 1; 5097 idx = 1;
5092 XSETFASTINT (buffer_local_flags.mode_line_format, idx); ++idx; 5098 XSETFASTINT (B_ (&buffer_local_flags, mode_line_format), idx); ++idx;
5093 XSETFASTINT (buffer_local_flags.abbrev_mode, idx); ++idx; 5099 XSETFASTINT (B_ (&buffer_local_flags, abbrev_mode), idx); ++idx;
5094 XSETFASTINT (buffer_local_flags.overwrite_mode, idx); ++idx; 5100 XSETFASTINT (B_ (&buffer_local_flags, overwrite_mode), idx); ++idx;
5095 XSETFASTINT (buffer_local_flags.case_fold_search, idx); ++idx; 5101 XSETFASTINT (B_ (&buffer_local_flags, case_fold_search), idx); ++idx;
5096 XSETFASTINT (buffer_local_flags.auto_fill_function, idx); ++idx; 5102 XSETFASTINT (B_ (&buffer_local_flags, auto_fill_function), idx); ++idx;
5097 XSETFASTINT (buffer_local_flags.selective_display, idx); ++idx; 5103 XSETFASTINT (B_ (&buffer_local_flags, selective_display), idx); ++idx;
5098#ifndef old 5104#ifndef old
5099 XSETFASTINT (buffer_local_flags.selective_display_ellipses, idx); ++idx; 5105 XSETFASTINT (B_ (&buffer_local_flags, selective_display_ellipses), idx); ++idx;
5100#endif 5106#endif
5101 XSETFASTINT (buffer_local_flags.tab_width, idx); ++idx; 5107 XSETFASTINT (B_ (&buffer_local_flags, tab_width), idx); ++idx;
5102 XSETFASTINT (buffer_local_flags.truncate_lines, idx); ++idx; 5108 XSETFASTINT (B_ (&buffer_local_flags, truncate_lines), idx); ++idx;
5103 XSETFASTINT (buffer_local_flags.word_wrap, idx); ++idx; 5109 XSETFASTINT (B_ (&buffer_local_flags, word_wrap), idx); ++idx;
5104 XSETFASTINT (buffer_local_flags.ctl_arrow, idx); ++idx; 5110 XSETFASTINT (B_ (&buffer_local_flags, ctl_arrow), idx); ++idx;
5105 XSETFASTINT (buffer_local_flags.fill_column, idx); ++idx; 5111 XSETFASTINT (B_ (&buffer_local_flags, fill_column), idx); ++idx;
5106 XSETFASTINT (buffer_local_flags.left_margin, idx); ++idx; 5112 XSETFASTINT (B_ (&buffer_local_flags, left_margin), idx); ++idx;
5107 XSETFASTINT (buffer_local_flags.abbrev_table, idx); ++idx; 5113 XSETFASTINT (B_ (&buffer_local_flags, abbrev_table), idx); ++idx;
5108 XSETFASTINT (buffer_local_flags.display_table, idx); ++idx; 5114 XSETFASTINT (B_ (&buffer_local_flags, display_table), idx); ++idx;
5109#ifdef DOS_NT 5115#ifdef DOS_NT
5110 XSETFASTINT (buffer_local_flags.buffer_file_type, idx); 5116 XSETFASTINT (B_ (&buffer_local_flags, buffer_file_type), idx);
5111 /* Make this one a permanent local. */ 5117 /* Make this one a permanent local. */
5112 buffer_permanent_local_flags[idx++] = 1; 5118 buffer_permanent_local_flags[idx++] = 1;
5113#endif 5119#endif
5114 XSETFASTINT (buffer_local_flags.syntax_table, idx); ++idx; 5120 XSETFASTINT (B_ (&buffer_local_flags, syntax_table), idx); ++idx;
5115 XSETFASTINT (buffer_local_flags.cache_long_line_scans, idx); ++idx; 5121 XSETFASTINT (B_ (&buffer_local_flags, cache_long_line_scans), idx); ++idx;
5116 XSETFASTINT (buffer_local_flags.category_table, idx); ++idx; 5122 XSETFASTINT (B_ (&buffer_local_flags, category_table), idx); ++idx;
5117 XSETFASTINT (buffer_local_flags.bidi_display_reordering, idx); ++idx; 5123 XSETFASTINT (B_ (&buffer_local_flags, bidi_display_reordering), idx); ++idx;
5118 XSETFASTINT (buffer_local_flags.bidi_paragraph_direction, idx); ++idx; 5124 XSETFASTINT (B_ (&buffer_local_flags, bidi_paragraph_direction), idx); ++idx;
5119 XSETFASTINT (buffer_local_flags.buffer_file_coding_system, idx); 5125 XSETFASTINT (B_ (&buffer_local_flags, buffer_file_coding_system), idx);
5120 /* Make this one a permanent local. */ 5126 /* Make this one a permanent local. */
5121 buffer_permanent_local_flags[idx++] = 1; 5127 buffer_permanent_local_flags[idx++] = 1;
5122 XSETFASTINT (buffer_local_flags.left_margin_cols, idx); ++idx; 5128 XSETFASTINT (B_ (&buffer_local_flags, left_margin_cols), idx); ++idx;
5123 XSETFASTINT (buffer_local_flags.right_margin_cols, idx); ++idx; 5129 XSETFASTINT (B_ (&buffer_local_flags, right_margin_cols), idx); ++idx;
5124 XSETFASTINT (buffer_local_flags.left_fringe_width, idx); ++idx; 5130 XSETFASTINT (B_ (&buffer_local_flags, left_fringe_width), idx); ++idx;
5125 XSETFASTINT (buffer_local_flags.right_fringe_width, idx); ++idx; 5131 XSETFASTINT (B_ (&buffer_local_flags, right_fringe_width), idx); ++idx;
5126 XSETFASTINT (buffer_local_flags.fringes_outside_margins, idx); ++idx; 5132 XSETFASTINT (B_ (&buffer_local_flags, fringes_outside_margins), idx); ++idx;
5127 XSETFASTINT (buffer_local_flags.scroll_bar_width, idx); ++idx; 5133 XSETFASTINT (B_ (&buffer_local_flags, scroll_bar_width), idx); ++idx;
5128 XSETFASTINT (buffer_local_flags.vertical_scroll_bar_type, idx); ++idx; 5134 XSETFASTINT (B_ (&buffer_local_flags, vertical_scroll_bar_type), idx); ++idx;
5129 XSETFASTINT (buffer_local_flags.indicate_empty_lines, idx); ++idx; 5135 XSETFASTINT (B_ (&buffer_local_flags, indicate_empty_lines), idx); ++idx;
5130 XSETFASTINT (buffer_local_flags.indicate_buffer_boundaries, idx); ++idx; 5136 XSETFASTINT (B_ (&buffer_local_flags, indicate_buffer_boundaries), idx); ++idx;
5131 XSETFASTINT (buffer_local_flags.fringe_indicator_alist, idx); ++idx; 5137 XSETFASTINT (B_ (&buffer_local_flags, fringe_indicator_alist), idx); ++idx;
5132 XSETFASTINT (buffer_local_flags.fringe_cursor_alist, idx); ++idx; 5138 XSETFASTINT (B_ (&buffer_local_flags, fringe_cursor_alist), idx); ++idx;
5133 XSETFASTINT (buffer_local_flags.scroll_up_aggressively, idx); ++idx; 5139 XSETFASTINT (B_ (&buffer_local_flags, scroll_up_aggressively), idx); ++idx;
5134 XSETFASTINT (buffer_local_flags.scroll_down_aggressively, idx); ++idx; 5140 XSETFASTINT (B_ (&buffer_local_flags, scroll_down_aggressively), idx); ++idx;
5135 XSETFASTINT (buffer_local_flags.header_line_format, idx); ++idx; 5141 XSETFASTINT (B_ (&buffer_local_flags, header_line_format), idx); ++idx;
5136 XSETFASTINT (buffer_local_flags.cursor_type, idx); ++idx; 5142 XSETFASTINT (B_ (&buffer_local_flags, cursor_type), idx); ++idx;
5137 XSETFASTINT (buffer_local_flags.extra_line_spacing, idx); ++idx; 5143 XSETFASTINT (B_ (&buffer_local_flags, extra_line_spacing), idx); ++idx;
5138 XSETFASTINT (buffer_local_flags.cursor_in_non_selected_windows, idx); ++idx; 5144 XSETFASTINT (B_ (&buffer_local_flags, cursor_in_non_selected_windows), idx); ++idx;
5139 5145
5140 /* Need more room? */ 5146 /* Need more room? */
5141 if (idx >= MAX_PER_BUFFER_VARS) 5147 if (idx >= MAX_PER_BUFFER_VARS)
@@ -5149,7 +5155,7 @@ init_buffer_once (void)
5149 QSFundamental = make_pure_c_string ("Fundamental"); 5155 QSFundamental = make_pure_c_string ("Fundamental");
5150 5156
5151 Qfundamental_mode = intern_c_string ("fundamental-mode"); 5157 Qfundamental_mode = intern_c_string ("fundamental-mode");
5152 buffer_defaults.major_mode = Qfundamental_mode; 5158 B_ (&buffer_defaults, major_mode) = Qfundamental_mode;
5153 5159
5154 Qmode_class = intern_c_string ("mode-class"); 5160 Qmode_class = intern_c_string ("mode-class");
5155 5161
@@ -5192,7 +5198,7 @@ init_buffer (void)
5192#endif /* USE_MMAP_FOR_BUFFERS */ 5198#endif /* USE_MMAP_FOR_BUFFERS */
5193 5199
5194 Fset_buffer (Fget_buffer_create (build_string ("*scratch*"))); 5200 Fset_buffer (Fget_buffer_create (build_string ("*scratch*")));
5195 if (NILP (buffer_defaults.enable_multibyte_characters)) 5201 if (NILP (B_ (&buffer_defaults, enable_multibyte_characters)))
5196 Fset_buffer_multibyte (Qnil); 5202 Fset_buffer_multibyte (Qnil);
5197 5203
5198 pwd = get_current_dir_name (); 5204 pwd = get_current_dir_name ();
@@ -5213,28 +5219,28 @@ init_buffer (void)
5213 pwd[len + 1] = '\0'; 5219 pwd[len + 1] = '\0';
5214 } 5220 }
5215 5221
5216 current_buffer->directory = make_unibyte_string (pwd, strlen (pwd)); 5222 B_ (current_buffer, directory) = make_unibyte_string (pwd, strlen (pwd));
5217 if (! NILP (buffer_defaults.enable_multibyte_characters)) 5223 if (! NILP (B_ (&buffer_defaults, enable_multibyte_characters)))
5218 /* At this moment, we still don't know how to decode the 5224 /* At this moment, we still don't know how to decode the
5219 directory name. So, we keep the bytes in multibyte form so 5225 directory name. So, we keep the bytes in multibyte form so
5220 that ENCODE_FILE correctly gets the original bytes. */ 5226 that ENCODE_FILE correctly gets the original bytes. */
5221 current_buffer->directory 5227 B_ (current_buffer, directory)
5222 = string_to_multibyte (current_buffer->directory); 5228 = string_to_multibyte (B_ (current_buffer, directory));
5223 5229
5224 /* Add /: to the front of the name 5230 /* Add /: to the front of the name
5225 if it would otherwise be treated as magic. */ 5231 if it would otherwise be treated as magic. */
5226 temp = Ffind_file_name_handler (current_buffer->directory, Qt); 5232 temp = Ffind_file_name_handler (B_ (current_buffer, directory), Qt);
5227 if (! NILP (temp) 5233 if (! NILP (temp)
5228 /* If the default dir is just /, TEMP is non-nil 5234 /* If the default dir is just /, TEMP is non-nil
5229 because of the ange-ftp completion handler. 5235 because of the ange-ftp completion handler.
5230 However, it is not necessary to turn / into /:/. 5236 However, it is not necessary to turn / into /:/.
5231 So avoid doing that. */ 5237 So avoid doing that. */
5232 && strcmp ("/", SSDATA (current_buffer->directory))) 5238 && strcmp ("/", SSDATA (B_ (current_buffer, directory))))
5233 current_buffer->directory 5239 B_ (current_buffer, directory)
5234 = concat2 (build_string ("/:"), current_buffer->directory); 5240 = concat2 (build_string ("/:"), B_ (current_buffer, directory));
5235 5241
5236 temp = get_minibuffer (0); 5242 temp = get_minibuffer (0);
5237 XBUFFER (temp)->directory = current_buffer->directory; 5243 B_ (XBUFFER (temp), directory) = B_ (current_buffer, directory);
5238 5244
5239 free (pwd); 5245 free (pwd);
5240} 5246}
@@ -5485,13 +5491,13 @@ This value applies in buffers that don't have their own local values.
5485This is the same as (default-value 'scroll-down-aggressively). */); 5491This is the same as (default-value 'scroll-down-aggressively). */);
5486 5492
5487 DEFVAR_PER_BUFFER ("header-line-format", 5493 DEFVAR_PER_BUFFER ("header-line-format",
5488 &current_buffer->header_line_format, 5494 &B_ (current_buffer, header_line_format),
5489 Qnil, 5495 Qnil,
5490 doc: /* Analogous to `mode-line-format', but controls the header line. 5496 doc: /* Analogous to `mode-line-format', but controls the header line.
5491The header line appears, optionally, at the top of a window; 5497The header line appears, optionally, at the top of a window;
5492the mode line appears at the bottom. */); 5498the mode line appears at the bottom. */);
5493 5499
5494 DEFVAR_PER_BUFFER ("mode-line-format", &current_buffer->mode_line_format, 5500 DEFVAR_PER_BUFFER ("mode-line-format", &B_ (current_buffer, mode_line_format),
5495 Qnil, 5501 Qnil,
5496 doc: /* Template for displaying mode line for current buffer. 5502 doc: /* Template for displaying mode line for current buffer.
5497Each buffer has its own value of this variable. 5503Each buffer has its own value of this variable.
@@ -5548,7 +5554,7 @@ Decimal digits after the % specify field width to which to pad. */);
5548 DEFVAR_BUFFER_DEFAULTS ("default-major-mode", major_mode, 5554 DEFVAR_BUFFER_DEFAULTS ("default-major-mode", major_mode,
5549 doc: /* *Value of `major-mode' for new buffers. */); 5555 doc: /* *Value of `major-mode' for new buffers. */);
5550 5556
5551 DEFVAR_PER_BUFFER ("major-mode", &current_buffer->major_mode, 5557 DEFVAR_PER_BUFFER ("major-mode", &B_ (current_buffer, major_mode),
5552 make_number (Lisp_Symbol), 5558 make_number (Lisp_Symbol),
5553 doc: /* Symbol for current buffer's major mode. 5559 doc: /* Symbol for current buffer's major mode.
5554The default value (normally `fundamental-mode') affects new buffers. 5560The default value (normally `fundamental-mode') affects new buffers.
@@ -5561,46 +5567,46 @@ the buffer. Thus, the mode and its hooks should not expect certain
5561variables such as `buffer-read-only' and `buffer-file-coding-system' 5567variables such as `buffer-read-only' and `buffer-file-coding-system'
5562to be set up. */); 5568to be set up. */);
5563 5569
5564 DEFVAR_PER_BUFFER ("mode-name", &current_buffer->mode_name, 5570 DEFVAR_PER_BUFFER ("mode-name", &B_ (current_buffer, mode_name),
5565 Qnil, 5571 Qnil,
5566 doc: /* Pretty name of current buffer's major mode. 5572 doc: /* Pretty name of current buffer's major mode.
5567Usually a string, but can use any of the constructs for `mode-line-format', 5573Usually a string, but can use any of the constructs for `mode-line-format',
5568which see. 5574which see.
5569Format with `format-mode-line' to produce a string value. */); 5575Format with `format-mode-line' to produce a string value. */);
5570 5576
5571 DEFVAR_PER_BUFFER ("local-abbrev-table", &current_buffer->abbrev_table, Qnil, 5577 DEFVAR_PER_BUFFER ("local-abbrev-table", &B_ (current_buffer, abbrev_table), Qnil,
5572 doc: /* Local (mode-specific) abbrev table of current buffer. */); 5578 doc: /* Local (mode-specific) abbrev table of current buffer. */);
5573 5579
5574 DEFVAR_PER_BUFFER ("abbrev-mode", &current_buffer->abbrev_mode, Qnil, 5580 DEFVAR_PER_BUFFER ("abbrev-mode", &B_ (current_buffer, abbrev_mode), Qnil,
5575 doc: /* Non-nil if Abbrev mode is enabled. 5581 doc: /* Non-nil if Abbrev mode is enabled.
5576Use the command `abbrev-mode' to change this variable. */); 5582Use the command `abbrev-mode' to change this variable. */);
5577 5583
5578 DEFVAR_PER_BUFFER ("case-fold-search", &current_buffer->case_fold_search, 5584 DEFVAR_PER_BUFFER ("case-fold-search", &B_ (current_buffer, case_fold_search),
5579 Qnil, 5585 Qnil,
5580 doc: /* *Non-nil if searches and matches should ignore case. */); 5586 doc: /* *Non-nil if searches and matches should ignore case. */);
5581 5587
5582 DEFVAR_PER_BUFFER ("fill-column", &current_buffer->fill_column, 5588 DEFVAR_PER_BUFFER ("fill-column", &B_ (current_buffer, fill_column),
5583 make_number (LISP_INT_TAG), 5589 make_number (LISP_INT_TAG),
5584 doc: /* *Column beyond which automatic line-wrapping should happen. 5590 doc: /* *Column beyond which automatic line-wrapping should happen.
5585Interactively, you can set the buffer local value using \\[set-fill-column]. */); 5591Interactively, you can set the buffer local value using \\[set-fill-column]. */);
5586 5592
5587 DEFVAR_PER_BUFFER ("left-margin", &current_buffer->left_margin, 5593 DEFVAR_PER_BUFFER ("left-margin", &B_ (current_buffer, left_margin),
5588 make_number (LISP_INT_TAG), 5594 make_number (LISP_INT_TAG),
5589 doc: /* *Column for the default `indent-line-function' to indent to. 5595 doc: /* *Column for the default `indent-line-function' to indent to.
5590Linefeed indents to this column in Fundamental mode. */); 5596Linefeed indents to this column in Fundamental mode. */);
5591 5597
5592 DEFVAR_PER_BUFFER ("tab-width", &current_buffer->tab_width, 5598 DEFVAR_PER_BUFFER ("tab-width", &B_ (current_buffer, tab_width),
5593 make_number (LISP_INT_TAG), 5599 make_number (LISP_INT_TAG),
5594 doc: /* *Distance between tab stops (for display of tab characters), in columns. */); 5600 doc: /* *Distance between tab stops (for display of tab characters), in columns. */);
5595 5601
5596 DEFVAR_PER_BUFFER ("ctl-arrow", &current_buffer->ctl_arrow, Qnil, 5602 DEFVAR_PER_BUFFER ("ctl-arrow", &B_ (current_buffer, ctl_arrow), Qnil,
5597 doc: /* *Non-nil means display control chars with uparrow. 5603 doc: /* *Non-nil means display control chars with uparrow.
5598A value of nil means use backslash and octal digits. 5604A value of nil means use backslash and octal digits.
5599This variable does not apply to characters whose display is specified 5605This variable does not apply to characters whose display is specified
5600in the current display table (if there is one). */); 5606in the current display table (if there is one). */);
5601 5607
5602 DEFVAR_PER_BUFFER ("enable-multibyte-characters", 5608 DEFVAR_PER_BUFFER ("enable-multibyte-characters",
5603 &current_buffer->enable_multibyte_characters, 5609 &B_ (current_buffer, enable_multibyte_characters),
5604 Qnil, 5610 Qnil,
5605 doc: /* Non-nil means the buffer contents are regarded as multi-byte characters. 5611 doc: /* Non-nil means the buffer contents are regarded as multi-byte characters.
5606Otherwise they are regarded as unibyte. This affects the display, 5612Otherwise they are regarded as unibyte. This affects the display,
@@ -5614,7 +5620,7 @@ See also variable `default-enable-multibyte-characters' and Info node
5614 XSYMBOL (intern_c_string ("enable-multibyte-characters"))->constant = 1; 5620 XSYMBOL (intern_c_string ("enable-multibyte-characters"))->constant = 1;
5615 5621
5616 DEFVAR_PER_BUFFER ("buffer-file-coding-system", 5622 DEFVAR_PER_BUFFER ("buffer-file-coding-system",
5617 &current_buffer->buffer_file_coding_system, Qnil, 5623 &B_ (current_buffer, buffer_file_coding_system), Qnil,
5618 doc: /* Coding system to be used for encoding the buffer contents on saving. 5624 doc: /* Coding system to be used for encoding the buffer contents on saving.
5619This variable applies to saving the buffer, and also to `write-region' 5625This variable applies to saving the buffer, and also to `write-region'
5620and other functions that use `write-region'. 5626and other functions that use `write-region'.
@@ -5632,11 +5638,11 @@ The variable `coding-system-for-write', if non-nil, overrides this variable.
5632This variable is never applied to a way of decoding a file while reading it. */); 5638This variable is never applied to a way of decoding a file while reading it. */);
5633 5639
5634 DEFVAR_PER_BUFFER ("bidi-display-reordering", 5640 DEFVAR_PER_BUFFER ("bidi-display-reordering",
5635 &current_buffer->bidi_display_reordering, Qnil, 5641 &B_ (current_buffer, bidi_display_reordering), Qnil,
5636 doc: /* Non-nil means reorder bidirectional text for display in the visual order. */); 5642 doc: /* Non-nil means reorder bidirectional text for display in the visual order. */);
5637 5643
5638 DEFVAR_PER_BUFFER ("bidi-paragraph-direction", 5644 DEFVAR_PER_BUFFER ("bidi-paragraph-direction",
5639 &current_buffer->bidi_paragraph_direction, Qnil, 5645 &B_ (current_buffer, bidi_paragraph_direction), Qnil,
5640 doc: /* *If non-nil, forces directionality of text paragraphs in the buffer. 5646 doc: /* *If non-nil, forces directionality of text paragraphs in the buffer.
5641 5647
5642If this is nil (the default), the direction of each paragraph is 5648If this is nil (the default), the direction of each paragraph is
@@ -5647,7 +5653,7 @@ Any other value is treated as nil.
5647This variable has no effect unless the buffer's value of 5653This variable has no effect unless the buffer's value of
5648\`bidi-display-reordering' is non-nil. */); 5654\`bidi-display-reordering' is non-nil. */);
5649 5655
5650 DEFVAR_PER_BUFFER ("truncate-lines", &current_buffer->truncate_lines, Qnil, 5656 DEFVAR_PER_BUFFER ("truncate-lines", &B_ (current_buffer, truncate_lines), Qnil,
5651 doc: /* *Non-nil means do not display continuation lines. 5657 doc: /* *Non-nil means do not display continuation lines.
5652Instead, give each line of text just one screen line. 5658Instead, give each line of text just one screen line.
5653 5659
@@ -5655,7 +5661,7 @@ Note that this is overridden by the variable
5655`truncate-partial-width-windows' if that variable is non-nil 5661`truncate-partial-width-windows' if that variable is non-nil
5656and this buffer is not full-frame width. */); 5662and this buffer is not full-frame width. */);
5657 5663
5658 DEFVAR_PER_BUFFER ("word-wrap", &current_buffer->word_wrap, Qnil, 5664 DEFVAR_PER_BUFFER ("word-wrap", &B_ (current_buffer, word_wrap), Qnil,
5659 doc: /* *Non-nil means to use word-wrapping for continuation lines. 5665 doc: /* *Non-nil means to use word-wrapping for continuation lines.
5660When word-wrapping is on, continuation lines are wrapped at the space 5666When word-wrapping is on, continuation lines are wrapped at the space
5661or tab character nearest to the right window edge. 5667or tab character nearest to the right window edge.
@@ -5668,7 +5674,7 @@ word-wrapping, you might want to reduce the value of
5668in narrower windows. */); 5674in narrower windows. */);
5669 5675
5670#ifdef DOS_NT 5676#ifdef DOS_NT
5671 DEFVAR_PER_BUFFER ("buffer-file-type", &current_buffer->buffer_file_type, 5677 DEFVAR_PER_BUFFER ("buffer-file-type", &B_ (current_buffer, buffer_file_type),
5672 Qnil, 5678 Qnil,
5673 doc: /* Non-nil if the visited file is a binary file. 5679 doc: /* Non-nil if the visited file is a binary file.
5674This variable is meaningful on MS-DOG and Windows NT. 5680This variable is meaningful on MS-DOG and Windows NT.
@@ -5676,12 +5682,12 @@ On those systems, it is automatically local in every buffer.
5676On other systems, this variable is normally always nil. */); 5682On other systems, this variable is normally always nil. */);
5677#endif 5683#endif
5678 5684
5679 DEFVAR_PER_BUFFER ("default-directory", &current_buffer->directory, 5685 DEFVAR_PER_BUFFER ("default-directory", &B_ (current_buffer, directory),
5680 make_number (Lisp_String), 5686 make_number (Lisp_String),
5681 doc: /* Name of default directory of current buffer. Should end with slash. 5687 doc: /* Name of default directory of current buffer. Should end with slash.
5682To interactively change the default directory, use command `cd'. */); 5688To interactively change the default directory, use command `cd'. */);
5683 5689
5684 DEFVAR_PER_BUFFER ("auto-fill-function", &current_buffer->auto_fill_function, 5690 DEFVAR_PER_BUFFER ("auto-fill-function", &B_ (current_buffer, auto_fill_function),
5685 Qnil, 5691 Qnil,
5686 doc: /* Function called (if non-nil) to perform auto-fill. 5692 doc: /* Function called (if non-nil) to perform auto-fill.
5687It is called after self-inserting any character specified in 5693It is called after self-inserting any character specified in
@@ -5689,30 +5695,30 @@ the `auto-fill-chars' table.
5689NOTE: This variable is not a hook; 5695NOTE: This variable is not a hook;
5690its value may not be a list of functions. */); 5696its value may not be a list of functions. */);
5691 5697
5692 DEFVAR_PER_BUFFER ("buffer-file-name", &current_buffer->filename, 5698 DEFVAR_PER_BUFFER ("buffer-file-name", &B_ (current_buffer, filename),
5693 make_number (Lisp_String), 5699 make_number (Lisp_String),
5694 doc: /* Name of file visited in current buffer, or nil if not visiting a file. */); 5700 doc: /* Name of file visited in current buffer, or nil if not visiting a file. */);
5695 5701
5696 DEFVAR_PER_BUFFER ("buffer-file-truename", &current_buffer->file_truename, 5702 DEFVAR_PER_BUFFER ("buffer-file-truename", &B_ (current_buffer, file_truename),
5697 make_number (Lisp_String), 5703 make_number (Lisp_String),
5698 doc: /* Abbreviated truename of file visited in current buffer, or nil if none. 5704 doc: /* Abbreviated truename of file visited in current buffer, or nil if none.
5699The truename of a file is calculated by `file-truename' 5705The truename of a file is calculated by `file-truename'
5700and then abbreviated with `abbreviate-file-name'. */); 5706and then abbreviated with `abbreviate-file-name'. */);
5701 5707
5702 DEFVAR_PER_BUFFER ("buffer-auto-save-file-name", 5708 DEFVAR_PER_BUFFER ("buffer-auto-save-file-name",
5703 &current_buffer->auto_save_file_name, 5709 &B_ (current_buffer, auto_save_file_name),
5704 make_number (Lisp_String), 5710 make_number (Lisp_String),
5705 doc: /* Name of file for auto-saving current buffer. 5711 doc: /* Name of file for auto-saving current buffer.
5706If it is nil, that means don't auto-save this buffer. */); 5712If it is nil, that means don't auto-save this buffer. */);
5707 5713
5708 DEFVAR_PER_BUFFER ("buffer-read-only", &current_buffer->read_only, Qnil, 5714 DEFVAR_PER_BUFFER ("buffer-read-only", &B_ (current_buffer, read_only), Qnil,
5709 doc: /* Non-nil if this buffer is read-only. */); 5715 doc: /* Non-nil if this buffer is read-only. */);
5710 5716
5711 DEFVAR_PER_BUFFER ("buffer-backed-up", &current_buffer->backed_up, Qnil, 5717 DEFVAR_PER_BUFFER ("buffer-backed-up", &B_ (current_buffer, backed_up), Qnil,
5712 doc: /* Non-nil if this buffer's file has been backed up. 5718 doc: /* Non-nil if this buffer's file has been backed up.
5713Backing up is done before the first time the file is saved. */); 5719Backing up is done before the first time the file is saved. */);
5714 5720
5715 DEFVAR_PER_BUFFER ("buffer-saved-size", &current_buffer->save_length, 5721 DEFVAR_PER_BUFFER ("buffer-saved-size", &B_ (current_buffer, save_length),
5716 make_number (LISP_INT_TAG), 5722 make_number (LISP_INT_TAG),
5717 doc: /* Length of current buffer when last read in, saved or auto-saved. 5723 doc: /* Length of current buffer when last read in, saved or auto-saved.
57180 initially. 57240 initially.
@@ -5722,7 +5728,7 @@ If you set this to -2, that means don't turn off auto-saving in this buffer
5722if its text size shrinks. If you use `buffer-swap-text' on a buffer, 5728if its text size shrinks. If you use `buffer-swap-text' on a buffer,
5723you probably should set this to -2 in that buffer. */); 5729you probably should set this to -2 in that buffer. */);
5724 5730
5725 DEFVAR_PER_BUFFER ("selective-display", &current_buffer->selective_display, 5731 DEFVAR_PER_BUFFER ("selective-display", &B_ (current_buffer, selective_display),
5726 Qnil, 5732 Qnil,
5727 doc: /* Non-nil enables selective display. 5733 doc: /* Non-nil enables selective display.
5728An integer N as value means display only lines 5734An integer N as value means display only lines
@@ -5733,12 +5739,12 @@ in a file, save the ^M as a newline. */);
5733 5739
5734#ifndef old 5740#ifndef old
5735 DEFVAR_PER_BUFFER ("selective-display-ellipses", 5741 DEFVAR_PER_BUFFER ("selective-display-ellipses",
5736 &current_buffer->selective_display_ellipses, 5742 &B_ (current_buffer, selective_display_ellipses),
5737 Qnil, 5743 Qnil,
5738 doc: /* Non-nil means display ... on previous line when a line is invisible. */); 5744 doc: /* Non-nil means display ... on previous line when a line is invisible. */);
5739#endif 5745#endif
5740 5746
5741 DEFVAR_PER_BUFFER ("overwrite-mode", &current_buffer->overwrite_mode, Qnil, 5747 DEFVAR_PER_BUFFER ("overwrite-mode", &B_ (current_buffer, overwrite_mode), Qnil,
5742 doc: /* Non-nil if self-insertion should replace existing text. 5748 doc: /* Non-nil if self-insertion should replace existing text.
5743The value should be one of `overwrite-mode-textual', 5749The value should be one of `overwrite-mode-textual',
5744`overwrite-mode-binary', or nil. 5750`overwrite-mode-binary', or nil.
@@ -5747,7 +5753,7 @@ inserts at the end of a line, and inserts when point is before a tab,
5747until the tab is filled in. 5753until the tab is filled in.
5748If `overwrite-mode-binary', self-insertion replaces newlines and tabs too. */); 5754If `overwrite-mode-binary', self-insertion replaces newlines and tabs too. */);
5749 5755
5750 DEFVAR_PER_BUFFER ("buffer-display-table", &current_buffer->display_table, 5756 DEFVAR_PER_BUFFER ("buffer-display-table", &B_ (current_buffer, display_table),
5751 Qnil, 5757 Qnil,
5752 doc: /* Display table that controls display of the contents of current buffer. 5758 doc: /* Display table that controls display of the contents of current buffer.
5753 5759
@@ -5784,39 +5790,39 @@ In addition, a char-table has six extra slots to control the display of:
5784 5790
5785See also the functions `display-table-slot' and `set-display-table-slot'. */); 5791See also the functions `display-table-slot' and `set-display-table-slot'. */);
5786 5792
5787 DEFVAR_PER_BUFFER ("left-margin-width", &current_buffer->left_margin_cols, 5793 DEFVAR_PER_BUFFER ("left-margin-width", &B_ (current_buffer, left_margin_cols),
5788 Qnil, 5794 Qnil,
5789 doc: /* *Width of left marginal area for display of a buffer. 5795 doc: /* *Width of left marginal area for display of a buffer.
5790A value of nil means no marginal area. */); 5796A value of nil means no marginal area. */);
5791 5797
5792 DEFVAR_PER_BUFFER ("right-margin-width", &current_buffer->right_margin_cols, 5798 DEFVAR_PER_BUFFER ("right-margin-width", &B_ (current_buffer, right_margin_cols),
5793 Qnil, 5799 Qnil,
5794 doc: /* *Width of right marginal area for display of a buffer. 5800 doc: /* *Width of right marginal area for display of a buffer.
5795A value of nil means no marginal area. */); 5801A value of nil means no marginal area. */);
5796 5802
5797 DEFVAR_PER_BUFFER ("left-fringe-width", &current_buffer->left_fringe_width, 5803 DEFVAR_PER_BUFFER ("left-fringe-width", &B_ (current_buffer, left_fringe_width),
5798 Qnil, 5804 Qnil,
5799 doc: /* *Width of this buffer's left fringe (in pixels). 5805 doc: /* *Width of this buffer's left fringe (in pixels).
5800A value of 0 means no left fringe is shown in this buffer's window. 5806A value of 0 means no left fringe is shown in this buffer's window.
5801A value of nil means to use the left fringe width from the window's frame. */); 5807A value of nil means to use the left fringe width from the window's frame. */);
5802 5808
5803 DEFVAR_PER_BUFFER ("right-fringe-width", &current_buffer->right_fringe_width, 5809 DEFVAR_PER_BUFFER ("right-fringe-width", &B_ (current_buffer, right_fringe_width),
5804 Qnil, 5810 Qnil,
5805 doc: /* *Width of this buffer's right fringe (in pixels). 5811 doc: /* *Width of this buffer's right fringe (in pixels).
5806A value of 0 means no right fringe is shown in this buffer's window. 5812A value of 0 means no right fringe is shown in this buffer's window.
5807A value of nil means to use the right fringe width from the window's frame. */); 5813A value of nil means to use the right fringe width from the window's frame. */);
5808 5814
5809 DEFVAR_PER_BUFFER ("fringes-outside-margins", &current_buffer->fringes_outside_margins, 5815 DEFVAR_PER_BUFFER ("fringes-outside-margins", &B_ (current_buffer, fringes_outside_margins),
5810 Qnil, 5816 Qnil,
5811 doc: /* *Non-nil means to display fringes outside display margins. 5817 doc: /* *Non-nil means to display fringes outside display margins.
5812A value of nil means to display fringes between margins and buffer text. */); 5818A value of nil means to display fringes between margins and buffer text. */);
5813 5819
5814 DEFVAR_PER_BUFFER ("scroll-bar-width", &current_buffer->scroll_bar_width, 5820 DEFVAR_PER_BUFFER ("scroll-bar-width", &B_ (current_buffer, scroll_bar_width),
5815 Qnil, 5821 Qnil,
5816 doc: /* *Width of this buffer's scroll bars in pixels. 5822 doc: /* *Width of this buffer's scroll bars in pixels.
5817A value of nil means to use the scroll bar width from the window's frame. */); 5823A value of nil means to use the scroll bar width from the window's frame. */);
5818 5824
5819 DEFVAR_PER_BUFFER ("vertical-scroll-bar", &current_buffer->vertical_scroll_bar_type, 5825 DEFVAR_PER_BUFFER ("vertical-scroll-bar", &B_ (current_buffer, vertical_scroll_bar_type),
5820 Qnil, 5826 Qnil,
5821 doc: /* *Position of this buffer's vertical scroll bar. 5827 doc: /* *Position of this buffer's vertical scroll bar.
5822The value takes effect whenever you tell a window to display this buffer; 5828The value takes effect whenever you tell a window to display this buffer;
@@ -5827,13 +5833,13 @@ of the window; a value of nil means don't show any vertical scroll bars.
5827A value of t (the default) means do whatever the window's frame specifies. */); 5833A value of t (the default) means do whatever the window's frame specifies. */);
5828 5834
5829 DEFVAR_PER_BUFFER ("indicate-empty-lines", 5835 DEFVAR_PER_BUFFER ("indicate-empty-lines",
5830 &current_buffer->indicate_empty_lines, Qnil, 5836 &B_ (current_buffer, indicate_empty_lines), Qnil,
5831 doc: /* *Visually indicate empty lines after the buffer end. 5837 doc: /* *Visually indicate empty lines after the buffer end.
5832If non-nil, a bitmap is displayed in the left fringe of a window on 5838If non-nil, a bitmap is displayed in the left fringe of a window on
5833window-systems. */); 5839window-systems. */);
5834 5840
5835 DEFVAR_PER_BUFFER ("indicate-buffer-boundaries", 5841 DEFVAR_PER_BUFFER ("indicate-buffer-boundaries",
5836 &current_buffer->indicate_buffer_boundaries, Qnil, 5842 &B_ (current_buffer, indicate_buffer_boundaries), Qnil,
5837 doc: /* *Visually indicate buffer boundaries and scrolling. 5843 doc: /* *Visually indicate buffer boundaries and scrolling.
5838If non-nil, the first and last line of the buffer are marked in the fringe 5844If non-nil, the first and last line of the buffer are marked in the fringe
5839of a window on window-systems with angle bitmaps, or if the window can be 5845of a window on window-systems with angle bitmaps, or if the window can be
@@ -5858,7 +5864,7 @@ bitmaps in right fringe. To show just the angle bitmaps in the left
5858fringe, but no arrow bitmaps, use ((top . left) (bottom . left)). */); 5864fringe, but no arrow bitmaps, use ((top . left) (bottom . left)). */);
5859 5865
5860 DEFVAR_PER_BUFFER ("fringe-indicator-alist", 5866 DEFVAR_PER_BUFFER ("fringe-indicator-alist",
5861 &current_buffer->fringe_indicator_alist, Qnil, 5867 &B_ (current_buffer, fringe_indicator_alist), Qnil,
5862 doc: /* *Mapping from logical to physical fringe indicator bitmaps. 5868 doc: /* *Mapping from logical to physical fringe indicator bitmaps.
5863The value is an alist where each element (INDICATOR . BITMAPS) 5869The value is an alist where each element (INDICATOR . BITMAPS)
5864specifies the fringe bitmaps used to display a specific logical 5870specifies the fringe bitmaps used to display a specific logical
@@ -5877,7 +5883,7 @@ last (only) line has no final newline. BITMAPS may also be a single
5877symbol which is used in both left and right fringes. */); 5883symbol which is used in both left and right fringes. */);
5878 5884
5879 DEFVAR_PER_BUFFER ("fringe-cursor-alist", 5885 DEFVAR_PER_BUFFER ("fringe-cursor-alist",
5880 &current_buffer->fringe_cursor_alist, Qnil, 5886 &B_ (current_buffer, fringe_cursor_alist), Qnil,
5881 doc: /* *Mapping from logical to physical fringe cursor bitmaps. 5887 doc: /* *Mapping from logical to physical fringe cursor bitmaps.
5882The value is an alist where each element (CURSOR . BITMAP) 5888The value is an alist where each element (CURSOR . BITMAP)
5883specifies the fringe bitmaps used to display a specific logical 5889specifies the fringe bitmaps used to display a specific logical
@@ -5892,7 +5898,7 @@ BITMAP is the corresponding fringe bitmap shown for the logical
5892cursor type. */); 5898cursor type. */);
5893 5899
5894 DEFVAR_PER_BUFFER ("scroll-up-aggressively", 5900 DEFVAR_PER_BUFFER ("scroll-up-aggressively",
5895 &current_buffer->scroll_up_aggressively, Qnil, 5901 &B_ (current_buffer, scroll_up_aggressively), Qnil,
5896 doc: /* How far to scroll windows upward. 5902 doc: /* How far to scroll windows upward.
5897If you move point off the bottom, the window scrolls automatically. 5903If you move point off the bottom, the window scrolls automatically.
5898This variable controls how far it scrolls. The value nil, the default, 5904This variable controls how far it scrolls. The value nil, the default,
@@ -5905,7 +5911,7 @@ window scrolls by a full window height. Meaningful values are
5905between 0.0 and 1.0, inclusive. */); 5911between 0.0 and 1.0, inclusive. */);
5906 5912
5907 DEFVAR_PER_BUFFER ("scroll-down-aggressively", 5913 DEFVAR_PER_BUFFER ("scroll-down-aggressively",
5908 &current_buffer->scroll_down_aggressively, Qnil, 5914 &B_ (current_buffer, scroll_down_aggressively), Qnil,
5909 doc: /* How far to scroll windows downward. 5915 doc: /* How far to scroll windows downward.
5910If you move point off the top, the window scrolls automatically. 5916If you move point off the top, the window scrolls automatically.
5911This variable controls how far it scrolls. The value nil, the default, 5917This variable controls how far it scrolls. The value nil, the default,
@@ -5960,7 +5966,7 @@ from happening repeatedly and making Emacs nonfunctional. */);
5960The functions are run using the `run-hooks' function. */); 5966The functions are run using the `run-hooks' function. */);
5961 Vfirst_change_hook = Qnil; 5967 Vfirst_change_hook = Qnil;
5962 5968
5963 DEFVAR_PER_BUFFER ("buffer-undo-list", &current_buffer->undo_list, Qnil, 5969 DEFVAR_PER_BUFFER ("buffer-undo-list", &B_ (current_buffer, undo_list), Qnil,
5964 doc: /* List of undo entries in current buffer. 5970 doc: /* List of undo entries in current buffer.
5965Recent changes come first; older changes follow newer. 5971Recent changes come first; older changes follow newer.
5966 5972
@@ -6001,10 +6007,10 @@ the changes between two undo boundaries as a single step to be undone.
6001 6007
6002If the value of the variable is t, undo information is not recorded. */); 6008If the value of the variable is t, undo information is not recorded. */);
6003 6009
6004 DEFVAR_PER_BUFFER ("mark-active", &current_buffer->mark_active, Qnil, 6010 DEFVAR_PER_BUFFER ("mark-active", &B_ (current_buffer, mark_active), Qnil,
6005 doc: /* Non-nil means the mark and region are currently active in this buffer. */); 6011 doc: /* Non-nil means the mark and region are currently active in this buffer. */);
6006 6012
6007 DEFVAR_PER_BUFFER ("cache-long-line-scans", &current_buffer->cache_long_line_scans, Qnil, 6013 DEFVAR_PER_BUFFER ("cache-long-line-scans", &B_ (current_buffer, cache_long_line_scans), Qnil,
6008 doc: /* Non-nil means that Emacs should use caches to handle long lines more quickly. 6014 doc: /* Non-nil means that Emacs should use caches to handle long lines more quickly.
6009 6015
6010Normally, the line-motion functions work by scanning the buffer for 6016Normally, the line-motion functions work by scanning the buffer for
@@ -6032,23 +6038,23 @@ maintained internally by the Emacs primitives. Enabling or disabling
6032the cache should not affect the behavior of any of the motion 6038the cache should not affect the behavior of any of the motion
6033functions; it should only affect their performance. */); 6039functions; it should only affect their performance. */);
6034 6040
6035 DEFVAR_PER_BUFFER ("point-before-scroll", &current_buffer->point_before_scroll, Qnil, 6041 DEFVAR_PER_BUFFER ("point-before-scroll", &B_ (current_buffer, point_before_scroll), Qnil,
6036 doc: /* Value of point before the last series of scroll operations, or nil. */); 6042 doc: /* Value of point before the last series of scroll operations, or nil. */);
6037 6043
6038 DEFVAR_PER_BUFFER ("buffer-file-format", &current_buffer->file_format, Qnil, 6044 DEFVAR_PER_BUFFER ("buffer-file-format", &B_ (current_buffer, file_format), Qnil,
6039 doc: /* List of formats to use when saving this buffer. 6045 doc: /* List of formats to use when saving this buffer.
6040Formats are defined by `format-alist'. This variable is 6046Formats are defined by `format-alist'. This variable is
6041set when a file is visited. */); 6047set when a file is visited. */);
6042 6048
6043 DEFVAR_PER_BUFFER ("buffer-auto-save-file-format", 6049 DEFVAR_PER_BUFFER ("buffer-auto-save-file-format",
6044 &current_buffer->auto_save_file_format, Qnil, 6050 &B_ (current_buffer, auto_save_file_format), Qnil,
6045 doc: /* *Format in which to write auto-save files. 6051 doc: /* *Format in which to write auto-save files.
6046Should be a list of symbols naming formats that are defined in `format-alist'. 6052Should be a list of symbols naming formats that are defined in `format-alist'.
6047If it is t, which is the default, auto-save files are written in the 6053If it is t, which is the default, auto-save files are written in the
6048same format as a regular save would use. */); 6054same format as a regular save would use. */);
6049 6055
6050 DEFVAR_PER_BUFFER ("buffer-invisibility-spec", 6056 DEFVAR_PER_BUFFER ("buffer-invisibility-spec",
6051 &current_buffer->invisibility_spec, Qnil, 6057 &B_ (current_buffer, invisibility_spec), Qnil,
6052 doc: /* Invisibility spec of this buffer. 6058 doc: /* Invisibility spec of this buffer.
6053The default is t, which means that text is invisible 6059The default is t, which means that text is invisible
6054if it has a non-nil `invisible' property. 6060if it has a non-nil `invisible' property.
@@ -6059,12 +6065,12 @@ then characters with property value PROP are invisible,
6059and they have an ellipsis as well if ELLIPSIS is non-nil. */); 6065and they have an ellipsis as well if ELLIPSIS is non-nil. */);
6060 6066
6061 DEFVAR_PER_BUFFER ("buffer-display-count", 6067 DEFVAR_PER_BUFFER ("buffer-display-count",
6062 &current_buffer->display_count, Qnil, 6068 &B_ (current_buffer, display_count), Qnil,
6063 doc: /* A number incremented each time this buffer is displayed in a window. 6069 doc: /* A number incremented each time this buffer is displayed in a window.
6064The function `set-window-buffer' increments it. */); 6070The function `set-window-buffer' increments it. */);
6065 6071
6066 DEFVAR_PER_BUFFER ("buffer-display-time", 6072 DEFVAR_PER_BUFFER ("buffer-display-time",
6067 &current_buffer->display_time, Qnil, 6073 &B_ (current_buffer, display_time), Qnil,
6068 doc: /* Time stamp updated each time this buffer is displayed in a window. 6074 doc: /* Time stamp updated each time this buffer is displayed in a window.
6069The function `set-window-buffer' updates this variable 6075The function `set-window-buffer' updates this variable
6070to the value obtained by calling `current-time'. 6076to the value obtained by calling `current-time'.
@@ -6099,7 +6105,7 @@ and disregard a `read-only' text property if the property value
6099is a member of the list. */); 6105is a member of the list. */);
6100 Vinhibit_read_only = Qnil; 6106 Vinhibit_read_only = Qnil;
6101 6107
6102 DEFVAR_PER_BUFFER ("cursor-type", &current_buffer->cursor_type, Qnil, 6108 DEFVAR_PER_BUFFER ("cursor-type", &B_ (current_buffer, cursor_type), Qnil,
6103 doc: /* Cursor to use when this buffer is in the selected window. 6109 doc: /* Cursor to use when this buffer is in the selected window.
6104Values are interpreted as follows: 6110Values are interpreted as follows:
6105 6111
@@ -6118,7 +6124,7 @@ cursor's appearance is instead controlled by the variable
6118`cursor-in-non-selected-windows'. */); 6124`cursor-in-non-selected-windows'. */);
6119 6125
6120 DEFVAR_PER_BUFFER ("line-spacing", 6126 DEFVAR_PER_BUFFER ("line-spacing",
6121 &current_buffer->extra_line_spacing, Qnil, 6127 &B_ (current_buffer, extra_line_spacing), Qnil,
6122 doc: /* Additional space to put between lines when displaying a buffer. 6128 doc: /* Additional space to put between lines when displaying a buffer.
6123The space is measured in pixels, and put below lines on graphic displays, 6129The space is measured in pixels, and put below lines on graphic displays,
6124see `display-graphic-p'. 6130see `display-graphic-p'.
@@ -6126,7 +6132,7 @@ If value is a floating point number, it specifies the spacing relative
6126to the default frame line height. A value of nil means add no extra space. */); 6132to the default frame line height. A value of nil means add no extra space. */);
6127 6133
6128 DEFVAR_PER_BUFFER ("cursor-in-non-selected-windows", 6134 DEFVAR_PER_BUFFER ("cursor-in-non-selected-windows",
6129 &current_buffer->cursor_in_non_selected_windows, Qnil, 6135 &B_ (current_buffer, cursor_in_non_selected_windows), Qnil,
6130 doc: /* *Non-nil means show a cursor in non-selected windows. 6136 doc: /* *Non-nil means show a cursor in non-selected windows.
6131If nil, only shows a cursor in the selected window. 6137If nil, only shows a cursor in the selected window.
6132If t, displays a cursor related to the usual cursor type 6138If t, displays a cursor related to the usual cursor type
diff --git a/src/buffer.h b/src/buffer.h
index 31f96040b2d..36cb5fe9dda 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -321,7 +321,7 @@ while (0)
321/* Return character at byte position POS. */ 321/* Return character at byte position POS. */
322 322
323#define FETCH_CHAR(pos) \ 323#define FETCH_CHAR(pos) \
324 (!NILP (current_buffer->enable_multibyte_characters) \ 324 (!NILP (B_ (current_buffer, enable_multibyte_characters)) \
325 ? FETCH_MULTIBYTE_CHAR ((pos)) \ 325 ? FETCH_MULTIBYTE_CHAR ((pos)) \
326 : FETCH_BYTE ((pos))) 326 : FETCH_BYTE ((pos)))
327 327
@@ -346,7 +346,7 @@ extern unsigned char *_fetch_multibyte_char_p;
346 multibyte. */ 346 multibyte. */
347 347
348#define FETCH_CHAR_AS_MULTIBYTE(pos) \ 348#define FETCH_CHAR_AS_MULTIBYTE(pos) \
349 (!NILP (current_buffer->enable_multibyte_characters) \ 349 (!NILP (B_ (current_buffer, enable_multibyte_characters)) \
350 ? FETCH_MULTIBYTE_CHAR ((pos)) \ 350 ? FETCH_MULTIBYTE_CHAR ((pos)) \
351 : UNIBYTE_TO_CHAR (FETCH_BYTE ((pos)))) 351 : UNIBYTE_TO_CHAR (FETCH_BYTE ((pos))))
352 352
@@ -464,6 +464,15 @@ struct buffer_text
464 int inhibit_shrinking; 464 int inhibit_shrinking;
465 }; 465 };
466 466
467/* Lisp fields in struct buffer are hidden from most code and accessed
468 via the B_ macro, below. Only select pieces of code, like the GC,
469 are allowed to use BUFFER_INTERNAL_FIELD. */
470#define BUFFER_INTERNAL_FIELD(field) field ## _
471
472/* Most code should use this macro to access Lisp fields in struct
473 buffer. */
474#define B_(buf, field) ((buf)->BUFFER_INTERNAL_FIELD (field))
475
467/* This is the structure that the buffer Lisp object points to. */ 476/* This is the structure that the buffer Lisp object points to. */
468 477
469struct buffer 478struct buffer
@@ -587,138 +596,138 @@ struct buffer
587 because local variables have to be right in the struct buffer. 596 because local variables have to be right in the struct buffer.
588 So we copy it around in set_buffer_internal. 597 So we copy it around in set_buffer_internal.
589 This comes before `name' because it is marked in a special way. */ 598 This comes before `name' because it is marked in a special way. */
590 Lisp_Object undo_list; 599 Lisp_Object BUFFER_INTERNAL_FIELD (undo_list);
591 600
592 /* The name of this buffer. */ 601 /* The name of this buffer. */
593 Lisp_Object name; 602 Lisp_Object BUFFER_INTERNAL_FIELD (name);
594 603
595 /* The name of the file visited in this buffer, or nil. */ 604 /* The name of the file visited in this buffer, or nil. */
596 Lisp_Object filename; 605 Lisp_Object BUFFER_INTERNAL_FIELD (filename);
597 /* Dir for expanding relative file names. */ 606 /* Dir for expanding relative file names. */
598 Lisp_Object directory; 607 Lisp_Object BUFFER_INTERNAL_FIELD (directory);
599 /* True if this buffer has been backed up (if you write to the 608 /* True if this buffer has been backed up (if you write to the
600 visited file and it hasn't been backed up, then a backup will 609 visited file and it hasn't been backed up, then a backup will
601 be made). */ 610 be made). */
602 /* This isn't really used by the C code, so could be deleted. */ 611 /* This isn't really used by the C code, so could be deleted. */
603 Lisp_Object backed_up; 612 Lisp_Object BUFFER_INTERNAL_FIELD (backed_up);
604 /* Length of file when last read or saved. 613 /* Length of file when last read or saved.
605 -1 means auto saving turned off because buffer shrank a lot. 614 -1 means auto saving turned off because buffer shrank a lot.
606 -2 means don't turn off auto saving if buffer shrinks. 615 -2 means don't turn off auto saving if buffer shrinks.
607 (That value is used with buffer-swap-text.) 616 (That value is used with buffer-swap-text.)
608 This is not in the struct buffer_text 617 This is not in the struct buffer_text
609 because it's not used in indirect buffers at all. */ 618 because it's not used in indirect buffers at all. */
610 Lisp_Object save_length; 619 Lisp_Object BUFFER_INTERNAL_FIELD (save_length);
611 /* File name used for auto-saving this buffer. 620 /* File name used for auto-saving this buffer.
612 This is not in the struct buffer_text 621 This is not in the struct buffer_text
613 because it's not used in indirect buffers at all. */ 622 because it's not used in indirect buffers at all. */
614 Lisp_Object auto_save_file_name; 623 Lisp_Object BUFFER_INTERNAL_FIELD (auto_save_file_name);
615 624
616 /* Non-nil if buffer read-only. */ 625 /* Non-nil if buffer read-only. */
617 Lisp_Object read_only; 626 Lisp_Object BUFFER_INTERNAL_FIELD (read_only);
618 /* "The mark". This is a marker which may 627 /* "The mark". This is a marker which may
619 point into this buffer or may point nowhere. */ 628 point into this buffer or may point nowhere. */
620 Lisp_Object mark; 629 Lisp_Object BUFFER_INTERNAL_FIELD (mark);
621 630
622 /* Alist of elements (SYMBOL . VALUE-IN-THIS-BUFFER) for all 631 /* Alist of elements (SYMBOL . VALUE-IN-THIS-BUFFER) for all
623 per-buffer variables of this buffer. For locally unbound 632 per-buffer variables of this buffer. For locally unbound
624 symbols, just the symbol appears as the element. */ 633 symbols, just the symbol appears as the element. */
625 Lisp_Object local_var_alist; 634 Lisp_Object BUFFER_INTERNAL_FIELD (local_var_alist);
626 635
627 /* Symbol naming major mode (eg, lisp-mode). */ 636 /* Symbol naming major mode (eg, lisp-mode). */
628 Lisp_Object major_mode; 637 Lisp_Object BUFFER_INTERNAL_FIELD (major_mode);
629 /* Pretty name of major mode (eg, "Lisp"). */ 638 /* Pretty name of major mode (eg, "Lisp"). */
630 Lisp_Object mode_name; 639 Lisp_Object BUFFER_INTERNAL_FIELD (mode_name);
631 /* Mode line element that controls format of mode line. */ 640 /* Mode line element that controls format of mode line. */
632 Lisp_Object mode_line_format; 641 Lisp_Object BUFFER_INTERNAL_FIELD (mode_line_format);
633 642
634 /* Analogous to mode_line_format for the line displayed at the top 643 /* Analogous to mode_line_format for the line displayed at the top
635 of windows. Nil means don't display that line. */ 644 of windows. Nil means don't display that line. */
636 Lisp_Object header_line_format; 645 Lisp_Object BUFFER_INTERNAL_FIELD (header_line_format);
637 646
638 /* Keys that are bound local to this buffer. */ 647 /* Keys that are bound local to this buffer. */
639 Lisp_Object keymap; 648 Lisp_Object BUFFER_INTERNAL_FIELD (keymap);
640 /* This buffer's local abbrev table. */ 649 /* This buffer's local abbrev table. */
641 Lisp_Object abbrev_table; 650 Lisp_Object BUFFER_INTERNAL_FIELD (abbrev_table);
642 /* This buffer's syntax table. */ 651 /* This buffer's syntax table. */
643 Lisp_Object syntax_table; 652 Lisp_Object BUFFER_INTERNAL_FIELD (syntax_table);
644 /* This buffer's category table. */ 653 /* This buffer's category table. */
645 Lisp_Object category_table; 654 Lisp_Object BUFFER_INTERNAL_FIELD (category_table);
646 655
647 /* Values of several buffer-local variables. */ 656 /* Values of several buffer-local variables. */
648 /* tab-width is buffer-local so that redisplay can find it 657 /* tab-width is buffer-local so that redisplay can find it
649 in buffers that are not current. */ 658 in buffers that are not current. */
650 Lisp_Object case_fold_search; 659 Lisp_Object BUFFER_INTERNAL_FIELD (case_fold_search);
651 Lisp_Object tab_width; 660 Lisp_Object BUFFER_INTERNAL_FIELD (tab_width);
652 Lisp_Object fill_column; 661 Lisp_Object BUFFER_INTERNAL_FIELD (fill_column);
653 Lisp_Object left_margin; 662 Lisp_Object BUFFER_INTERNAL_FIELD (left_margin);
654 /* Function to call when insert space past fill column. */ 663 /* Function to call when insert space past fill column. */
655 Lisp_Object auto_fill_function; 664 Lisp_Object BUFFER_INTERNAL_FIELD (auto_fill_function);
656 /* nil: text, t: binary. 665 /* nil: text, t: binary.
657 This value is meaningful only on certain operating systems. */ 666 This value is meaningful only on certain operating systems. */
658 /* Actually, we don't need this flag any more because end-of-line 667 /* Actually, we don't need this flag any more because end-of-line
659 is handled correctly according to the buffer-file-coding-system 668 is handled correctly according to the buffer-file-coding-system
660 of the buffer. Just keeping it for backward compatibility. */ 669 of the buffer. Just keeping it for backward compatibility. */
661 Lisp_Object buffer_file_type; 670 Lisp_Object BUFFER_INTERNAL_FIELD (buffer_file_type);
662 671
663 /* Case table for case-conversion in this buffer. 672 /* Case table for case-conversion in this buffer.
664 This char-table maps each char into its lower-case version. */ 673 This char-table maps each char into its lower-case version. */
665 Lisp_Object downcase_table; 674 Lisp_Object BUFFER_INTERNAL_FIELD (downcase_table);
666 /* Char-table mapping each char to its upper-case version. */ 675 /* Char-table mapping each char to its upper-case version. */
667 Lisp_Object upcase_table; 676 Lisp_Object BUFFER_INTERNAL_FIELD (upcase_table);
668 /* Char-table for conversion for case-folding search. */ 677 /* Char-table for conversion for case-folding search. */
669 Lisp_Object case_canon_table; 678 Lisp_Object BUFFER_INTERNAL_FIELD (case_canon_table);
670 /* Char-table of equivalences for case-folding search. */ 679 /* Char-table of equivalences for case-folding search. */
671 Lisp_Object case_eqv_table; 680 Lisp_Object BUFFER_INTERNAL_FIELD (case_eqv_table);
672 681
673 /* Non-nil means do not display continuation lines. */ 682 /* Non-nil means do not display continuation lines. */
674 Lisp_Object truncate_lines; 683 Lisp_Object BUFFER_INTERNAL_FIELD (truncate_lines);
675 /* Non-nil means to use word wrapping when displaying continuation lines. */ 684 /* Non-nil means to use word wrapping when displaying continuation lines. */
676 Lisp_Object word_wrap; 685 Lisp_Object BUFFER_INTERNAL_FIELD (word_wrap);
677 /* Non-nil means display ctl chars with uparrow. */ 686 /* Non-nil means display ctl chars with uparrow. */
678 Lisp_Object ctl_arrow; 687 Lisp_Object BUFFER_INTERNAL_FIELD (ctl_arrow);
679 /* Non-nil means reorder bidirectional text for display in the 688 /* Non-nil means reorder bidirectional text for display in the
680 visual order. */ 689 visual order. */
681 Lisp_Object bidi_display_reordering; 690 Lisp_Object BUFFER_INTERNAL_FIELD (bidi_display_reordering);
682 /* If non-nil, specifies which direction of text to force in all the 691 /* If non-nil, specifies which direction of text to force in all the
683 paragraphs of the buffer. Nil means determine paragraph 692 paragraphs of the buffer. Nil means determine paragraph
684 direction dynamically for each paragraph. */ 693 direction dynamically for each paragraph. */
685 Lisp_Object bidi_paragraph_direction; 694 Lisp_Object BUFFER_INTERNAL_FIELD (bidi_paragraph_direction);
686 /* Non-nil means do selective display; 695 /* Non-nil means do selective display;
687 see doc string in syms_of_buffer (buffer.c) for details. */ 696 see doc string in syms_of_buffer (buffer.c) for details. */
688 Lisp_Object selective_display; 697 Lisp_Object BUFFER_INTERNAL_FIELD (selective_display);
689#ifndef old 698#ifndef old
690 /* Non-nil means show ... at end of line followed by invisible lines. */ 699 /* Non-nil means show ... at end of line followed by invisible lines. */
691 Lisp_Object selective_display_ellipses; 700 Lisp_Object BUFFER_INTERNAL_FIELD (selective_display_ellipses);
692#endif 701#endif
693 /* Alist of (FUNCTION . STRING) for each minor mode enabled in buffer. */ 702 /* Alist of (FUNCTION . STRING) for each minor mode enabled in buffer. */
694 Lisp_Object minor_modes; 703 Lisp_Object BUFFER_INTERNAL_FIELD (minor_modes);
695 /* t if "self-insertion" should overwrite; `binary' if it should also 704 /* t if "self-insertion" should overwrite; `binary' if it should also
696 overwrite newlines and tabs - for editing executables and the like. */ 705 overwrite newlines and tabs - for editing executables and the like. */
697 Lisp_Object overwrite_mode; 706 Lisp_Object BUFFER_INTERNAL_FIELD (overwrite_mode);
698 /* non-nil means abbrev mode is on. Expand abbrevs automatically. */ 707 /* non-nil means abbrev mode is on. Expand abbrevs automatically. */
699 Lisp_Object abbrev_mode; 708 Lisp_Object BUFFER_INTERNAL_FIELD (abbrev_mode);
700 /* Display table to use for text in this buffer. */ 709 /* Display table to use for text in this buffer. */
701 Lisp_Object display_table; 710 Lisp_Object BUFFER_INTERNAL_FIELD (display_table);
702 /* t means the mark and region are currently active. */ 711 /* t means the mark and region are currently active. */
703 Lisp_Object mark_active; 712 Lisp_Object BUFFER_INTERNAL_FIELD (mark_active);
704 713
705 /* Non-nil means the buffer contents are regarded as multi-byte 714 /* Non-nil means the buffer contents are regarded as multi-byte
706 form of characters, not a binary code. */ 715 form of characters, not a binary code. */
707 Lisp_Object enable_multibyte_characters; 716 Lisp_Object BUFFER_INTERNAL_FIELD (enable_multibyte_characters);
708 717
709 /* Coding system to be used for encoding the buffer contents on 718 /* Coding system to be used for encoding the buffer contents on
710 saving. */ 719 saving. */
711 Lisp_Object buffer_file_coding_system; 720 Lisp_Object BUFFER_INTERNAL_FIELD (buffer_file_coding_system);
712 721
713 /* List of symbols naming the file format used for visited file. */ 722 /* List of symbols naming the file format used for visited file. */
714 Lisp_Object file_format; 723 Lisp_Object BUFFER_INTERNAL_FIELD (file_format);
715 724
716 /* List of symbols naming the file format used for auto-save file. */ 725 /* List of symbols naming the file format used for auto-save file. */
717 Lisp_Object auto_save_file_format; 726 Lisp_Object BUFFER_INTERNAL_FIELD (auto_save_file_format);
718 727
719 /* True if the newline position cache and width run cache are 728 /* True if the newline position cache and width run cache are
720 enabled. See search.c and indent.c. */ 729 enabled. See search.c and indent.c. */
721 Lisp_Object cache_long_line_scans; 730 Lisp_Object BUFFER_INTERNAL_FIELD (cache_long_line_scans);
722 731
723 /* If the width run cache is enabled, this table contains the 732 /* If the width run cache is enabled, this table contains the
724 character widths width_run_cache (see above) assumes. When we 733 character widths width_run_cache (see above) assumes. When we
@@ -726,99 +735,99 @@ struct buffer
726 current display table to see whether the display table has 735 current display table to see whether the display table has
727 affected the widths of any characters. If it has, we 736 affected the widths of any characters. If it has, we
728 invalidate the width run cache, and re-initialize width_table. */ 737 invalidate the width run cache, and re-initialize width_table. */
729 Lisp_Object width_table; 738 Lisp_Object BUFFER_INTERNAL_FIELD (width_table);
730 739
731 /* In an indirect buffer, or a buffer that is the base of an 740 /* In an indirect buffer, or a buffer that is the base of an
732 indirect buffer, this holds a marker that records 741 indirect buffer, this holds a marker that records
733 PT for this buffer when the buffer is not current. */ 742 PT for this buffer when the buffer is not current. */
734 Lisp_Object pt_marker; 743 Lisp_Object BUFFER_INTERNAL_FIELD (pt_marker);
735 744
736 /* In an indirect buffer, or a buffer that is the base of an 745 /* In an indirect buffer, or a buffer that is the base of an
737 indirect buffer, this holds a marker that records 746 indirect buffer, this holds a marker that records
738 BEGV for this buffer when the buffer is not current. */ 747 BEGV for this buffer when the buffer is not current. */
739 Lisp_Object begv_marker; 748 Lisp_Object BUFFER_INTERNAL_FIELD (begv_marker);
740 749
741 /* In an indirect buffer, or a buffer that is the base of an 750 /* In an indirect buffer, or a buffer that is the base of an
742 indirect buffer, this holds a marker that records 751 indirect buffer, this holds a marker that records
743 ZV for this buffer when the buffer is not current. */ 752 ZV for this buffer when the buffer is not current. */
744 Lisp_Object zv_marker; 753 Lisp_Object BUFFER_INTERNAL_FIELD (zv_marker);
745 754
746 /* This holds the point value before the last scroll operation. 755 /* This holds the point value before the last scroll operation.
747 Explicitly setting point sets this to nil. */ 756 Explicitly setting point sets this to nil. */
748 Lisp_Object point_before_scroll; 757 Lisp_Object BUFFER_INTERNAL_FIELD (point_before_scroll);
749 758
750 /* Truename of the visited file, or nil. */ 759 /* Truename of the visited file, or nil. */
751 Lisp_Object file_truename; 760 Lisp_Object BUFFER_INTERNAL_FIELD (file_truename);
752 761
753 /* Invisibility spec of this buffer. 762 /* Invisibility spec of this buffer.
754 t => any non-nil `invisible' property means invisible. 763 t => any non-nil `invisible' property means invisible.
755 A list => `invisible' property means invisible 764 A list => `invisible' property means invisible
756 if it is memq in that list. */ 765 if it is memq in that list. */
757 Lisp_Object invisibility_spec; 766 Lisp_Object BUFFER_INTERNAL_FIELD (invisibility_spec);
758 767
759 /* This is the last window that was selected with this buffer in it, 768 /* This is the last window that was selected with this buffer in it,
760 or nil if that window no longer displays this buffer. */ 769 or nil if that window no longer displays this buffer. */
761 Lisp_Object last_selected_window; 770 Lisp_Object BUFFER_INTERNAL_FIELD (last_selected_window);
762 771
763 /* Incremented each time the buffer is displayed in a window. */ 772 /* Incremented each time the buffer is displayed in a window. */
764 Lisp_Object display_count; 773 Lisp_Object BUFFER_INTERNAL_FIELD (display_count);
765 774
766 /* Widths of left and right marginal areas for windows displaying 775 /* Widths of left and right marginal areas for windows displaying
767 this buffer. */ 776 this buffer. */
768 Lisp_Object left_margin_cols, right_margin_cols; 777 Lisp_Object BUFFER_INTERNAL_FIELD (left_margin_cols), BUFFER_INTERNAL_FIELD (right_margin_cols);
769 778
770 /* Widths of left and right fringe areas for windows displaying 779 /* Widths of left and right fringe areas for windows displaying
771 this buffer. */ 780 this buffer. */
772 Lisp_Object left_fringe_width, right_fringe_width; 781 Lisp_Object BUFFER_INTERNAL_FIELD (left_fringe_width), BUFFER_INTERNAL_FIELD (right_fringe_width);
773 782
774 /* Non-nil means fringes are drawn outside display margins; 783 /* Non-nil means fringes are drawn outside display margins;
775 othersize draw them between margin areas and text. */ 784 othersize draw them between margin areas and text. */
776 Lisp_Object fringes_outside_margins; 785 Lisp_Object BUFFER_INTERNAL_FIELD (fringes_outside_margins);
777 786
778 /* Width and type of scroll bar areas for windows displaying 787 /* Width and type of scroll bar areas for windows displaying
779 this buffer. */ 788 this buffer. */
780 Lisp_Object scroll_bar_width, vertical_scroll_bar_type; 789 Lisp_Object BUFFER_INTERNAL_FIELD (scroll_bar_width), BUFFER_INTERNAL_FIELD (vertical_scroll_bar_type);
781 790
782 /* Non-nil means indicate lines not displaying text (in a style 791 /* Non-nil means indicate lines not displaying text (in a style
783 like vi). */ 792 like vi). */
784 Lisp_Object indicate_empty_lines; 793 Lisp_Object BUFFER_INTERNAL_FIELD (indicate_empty_lines);
785 794
786 /* Non-nil means indicate buffer boundaries and scrolling. */ 795 /* Non-nil means indicate buffer boundaries and scrolling. */
787 Lisp_Object indicate_buffer_boundaries; 796 Lisp_Object BUFFER_INTERNAL_FIELD (indicate_buffer_boundaries);
788 797
789 /* Logical to physical fringe bitmap mappings. */ 798 /* Logical to physical fringe bitmap mappings. */
790 Lisp_Object fringe_indicator_alist; 799 Lisp_Object BUFFER_INTERNAL_FIELD (fringe_indicator_alist);
791 800
792 /* Logical to physical cursor bitmap mappings. */ 801 /* Logical to physical cursor bitmap mappings. */
793 Lisp_Object fringe_cursor_alist; 802 Lisp_Object BUFFER_INTERNAL_FIELD (fringe_cursor_alist);
794 803
795 /* Time stamp updated each time this buffer is displayed in a window. */ 804 /* Time stamp updated each time this buffer is displayed in a window. */
796 Lisp_Object display_time; 805 Lisp_Object BUFFER_INTERNAL_FIELD (display_time);
797 806
798 /* If scrolling the display because point is below the bottom of a 807 /* If scrolling the display because point is below the bottom of a
799 window showing this buffer, try to choose a window start so 808 window showing this buffer, try to choose a window start so
800 that point ends up this number of lines from the top of the 809 that point ends up this number of lines from the top of the
801 window. Nil means that scrolling method isn't used. */ 810 window. Nil means that scrolling method isn't used. */
802 Lisp_Object scroll_up_aggressively; 811 Lisp_Object BUFFER_INTERNAL_FIELD (scroll_up_aggressively);
803 812
804 /* If scrolling the display because point is above the top of a 813 /* If scrolling the display because point is above the top of a
805 window showing this buffer, try to choose a window start so 814 window showing this buffer, try to choose a window start so
806 that point ends up this number of lines from the bottom of the 815 that point ends up this number of lines from the bottom of the
807 window. Nil means that scrolling method isn't used. */ 816 window. Nil means that scrolling method isn't used. */
808 Lisp_Object scroll_down_aggressively; 817 Lisp_Object BUFFER_INTERNAL_FIELD (scroll_down_aggressively);
809 818
810 /* Desired cursor type in this buffer. See the doc string of 819 /* Desired cursor type in this buffer. See the doc string of
811 per-buffer variable `cursor-type'. */ 820 per-buffer variable `cursor-type'. */
812 Lisp_Object cursor_type; 821 Lisp_Object BUFFER_INTERNAL_FIELD (cursor_type);
813 822
814 /* An integer > 0 means put that number of pixels below text lines 823 /* An integer > 0 means put that number of pixels below text lines
815 in the display of this buffer. */ 824 in the display of this buffer. */
816 Lisp_Object extra_line_spacing; 825 Lisp_Object BUFFER_INTERNAL_FIELD (extra_line_spacing);
817 826
818 /* *Cursor type to display in non-selected windows. 827 /* *Cursor type to display in non-selected windows.
819 t means to use hollow box cursor. 828 t means to use hollow box cursor.
820 See `cursor-type' for other values. */ 829 See `cursor-type' for other values. */
821 Lisp_Object cursor_in_non_selected_windows; 830 Lisp_Object BUFFER_INTERNAL_FIELD (cursor_in_non_selected_windows);
822}; 831};
823 832
824 833
@@ -942,7 +951,7 @@ extern int last_per_buffer_idx;
942 from the start of a buffer structure. */ 951 from the start of a buffer structure. */
943 952
944#define PER_BUFFER_VAR_OFFSET(VAR) \ 953#define PER_BUFFER_VAR_OFFSET(VAR) \
945 offsetof (struct buffer, VAR) 954 offsetof (struct buffer, BUFFER_INTERNAL_FIELD (VAR))
946 955
947/* Return the index of buffer-local variable VAR. Each per-buffer 956/* Return the index of buffer-local variable VAR. Each per-buffer
948 variable has an index > 0 associated with it, except when it always 957 variable has an index > 0 associated with it, except when it always
diff --git a/src/bytecode.c b/src/bytecode.c
index fd2680e4054..a470eca16a9 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -1398,7 +1398,7 @@ If the third argument is incorrect, Emacs may crash. */)
1398 CHECK_CHARACTER (TOP); 1398 CHECK_CHARACTER (TOP);
1399 AFTER_POTENTIAL_GC (); 1399 AFTER_POTENTIAL_GC ();
1400 c = XFASTINT (TOP); 1400 c = XFASTINT (TOP);
1401 if (NILP (current_buffer->enable_multibyte_characters)) 1401 if (NILP (B_ (current_buffer, enable_multibyte_characters)))
1402 MAKE_CHAR_MULTIBYTE (c); 1402 MAKE_CHAR_MULTIBYTE (c);
1403 XSETFASTINT (TOP, syntax_code_spec[(int) SYNTAX (c)]); 1403 XSETFASTINT (TOP, syntax_code_spec[(int) SYNTAX (c)]);
1404 } 1404 }
diff --git a/src/callint.c b/src/callint.c
index 2e4314295ff..154659490b8 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -149,12 +149,12 @@ static void
149check_mark (int for_region) 149check_mark (int for_region)
150{ 150{
151 Lisp_Object tem; 151 Lisp_Object tem;
152 tem = Fmarker_buffer (current_buffer->mark); 152 tem = Fmarker_buffer (B_ (current_buffer, mark));
153 if (NILP (tem) || (XBUFFER (tem) != current_buffer)) 153 if (NILP (tem) || (XBUFFER (tem) != current_buffer))
154 error (for_region ? "The mark is not set now, so there is no region" 154 error (for_region ? "The mark is not set now, so there is no region"
155 : "The mark is not set now"); 155 : "The mark is not set now");
156 if (!NILP (Vtransient_mark_mode) && NILP (Vmark_even_if_inactive) 156 if (!NILP (Vtransient_mark_mode) && NILP (Vmark_even_if_inactive)
157 && NILP (current_buffer->mark_active)) 157 && NILP (B_ (current_buffer, mark_active)))
158 xsignal0 (Qmark_inactive); 158 xsignal0 (Qmark_inactive);
159} 159}
160 160
@@ -385,7 +385,7 @@ invoke it. If KEYS is omitted or nil, the return value of
385 else if (*string == '*') 385 else if (*string == '*')
386 { 386 {
387 string++; 387 string++;
388 if (!NILP (current_buffer->read_only)) 388 if (!NILP (B_ (current_buffer, read_only)))
389 { 389 {
390 if (!NILP (record_flag)) 390 if (!NILP (record_flag))
391 { 391 {
@@ -543,7 +543,7 @@ invoke it. If KEYS is omitted or nil, the return value of
543 543
544 case 'D': /* Directory name. */ 544 case 'D': /* Directory name. */
545 args[i] = Fread_file_name (callint_message, Qnil, 545 args[i] = Fread_file_name (callint_message, Qnil,
546 current_buffer->directory, Qlambda, Qnil, 546 B_ (current_buffer, directory), Qlambda, Qnil,
547 Qfile_directory_p); 547 Qfile_directory_p);
548 break; 548 break;
549 549
@@ -661,7 +661,7 @@ invoke it. If KEYS is omitted or nil, the return value of
661 case 'm': /* Value of mark. Does not do I/O. */ 661 case 'm': /* Value of mark. Does not do I/O. */
662 check_mark (0); 662 check_mark (0);
663 /* visargs[i] = Qnil; */ 663 /* visargs[i] = Qnil; */
664 args[i] = current_buffer->mark; 664 args[i] = B_ (current_buffer, mark);
665 varies[i] = 2; 665 varies[i] = 2;
666 break; 666 break;
667 667
@@ -717,11 +717,11 @@ invoke it. If KEYS is omitted or nil, the return value of
717 check_mark (1); 717 check_mark (1);
718 set_marker_both (point_marker, Qnil, PT, PT_BYTE); 718 set_marker_both (point_marker, Qnil, PT, PT_BYTE);
719 /* visargs[i+1] = Qnil; */ 719 /* visargs[i+1] = Qnil; */
720 foo = marker_position (current_buffer->mark); 720 foo = marker_position (B_ (current_buffer, mark));
721 /* visargs[i] = Qnil; */ 721 /* visargs[i] = Qnil; */
722 args[i] = PT < foo ? point_marker : current_buffer->mark; 722 args[i] = PT < foo ? point_marker : B_ (current_buffer, mark);
723 varies[i] = 3; 723 varies[i] = 3;
724 args[++i] = PT > foo ? point_marker : current_buffer->mark; 724 args[++i] = PT > foo ? point_marker : B_ (current_buffer, mark);
725 varies[i] = 4; 725 varies[i] = 4;
726 break; 726 break;
727 727
diff --git a/src/callproc.c b/src/callproc.c
index 27e8493bcf1..bdd3060bef1 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -265,7 +265,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
265 265
266 if (nargs >= 2 && ! NILP (args[1])) 266 if (nargs >= 2 && ! NILP (args[1]))
267 { 267 {
268 infile = Fexpand_file_name (args[1], current_buffer->directory); 268 infile = Fexpand_file_name (args[1], B_ (current_buffer, directory));
269 CHECK_STRING (infile); 269 CHECK_STRING (infile);
270 } 270 }
271 else 271 else
@@ -322,7 +322,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
322 { 322 {
323 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 323 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
324 324
325 current_dir = current_buffer->directory; 325 current_dir = B_ (current_buffer, directory);
326 326
327 GCPRO4 (infile, buffer, current_dir, error_file); 327 GCPRO4 (infile, buffer, current_dir, error_file);
328 328
@@ -336,7 +336,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
336 336
337 if (NILP (Ffile_accessible_directory_p (current_dir))) 337 if (NILP (Ffile_accessible_directory_p (current_dir)))
338 report_file_error ("Setting current directory", 338 report_file_error ("Setting current directory",
339 Fcons (current_buffer->directory, Qnil)); 339 Fcons (B_ (current_buffer, directory), Qnil));
340 340
341 if (STRING_MULTIBYTE (infile)) 341 if (STRING_MULTIBYTE (infile))
342 infile = ENCODE_FILE (infile); 342 infile = ENCODE_FILE (infile);
@@ -559,9 +559,9 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
559 setpgrp (pid, pid); 559 setpgrp (pid, pid);
560#endif /* USG */ 560#endif /* USG */
561 561
562 /* GTK causes us to ignore SIGPIPE, make sure it is restored 562 /* GConf causes us to ignore SIGPIPE, make sure it is restored
563 in the child. */ 563 in the child. */
564 signal (SIGPIPE, SIG_DFL); 564 //signal (SIGPIPE, SIG_DFL);
565#ifdef HAVE_WORKING_VFORK 565#ifdef HAVE_WORKING_VFORK
566 sigprocmask (SIG_SETMASK, &procmask, 0); 566 sigprocmask (SIG_SETMASK, &procmask, 0);
567#endif 567#endif
@@ -663,7 +663,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
663 /* In unibyte mode, character code conversion should not take 663 /* In unibyte mode, character code conversion should not take
664 place but EOL conversion should. So, setup raw-text or one 664 place but EOL conversion should. So, setup raw-text or one
665 of the subsidiary according to the information just setup. */ 665 of the subsidiary according to the information just setup. */
666 if (NILP (current_buffer->enable_multibyte_characters) 666 if (NILP (B_ (current_buffer, enable_multibyte_characters))
667 && !NILP (val)) 667 && !NILP (val))
668 val = raw_text_coding_system (val); 668 val = raw_text_coding_system (val);
669 setup_coding_system (val, &process_coding); 669 setup_coding_system (val, &process_coding);
@@ -713,7 +713,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
713 713
714 if (!NILP (buffer)) 714 if (!NILP (buffer))
715 { 715 {
716 if (NILP (current_buffer->enable_multibyte_characters) 716 if (NILP (B_ (current_buffer, enable_multibyte_characters))
717 && ! CODING_MAY_REQUIRE_DECODING (&process_coding)) 717 && ! CODING_MAY_REQUIRE_DECODING (&process_coding))
718 insert_1_both (buf, nread, nread, 0, 1, 0); 718 insert_1_both (buf, nread, nread, 0, 1, 0);
719 else 719 else
@@ -926,7 +926,7 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r
926 /* Decide coding-system of the contents of the temporary file. */ 926 /* Decide coding-system of the contents of the temporary file. */
927 if (!NILP (Vcoding_system_for_write)) 927 if (!NILP (Vcoding_system_for_write))
928 val = Vcoding_system_for_write; 928 val = Vcoding_system_for_write;
929 else if (NILP (current_buffer->enable_multibyte_characters)) 929 else if (NILP (B_ (current_buffer, enable_multibyte_characters)))
930 val = Qraw_text; 930 val = Qraw_text;
931 else 931 else
932 { 932 {
diff --git a/src/casefiddle.c b/src/casefiddle.c
index 62d261278ab..6c05aecffe8 100644
--- a/src/casefiddle.c
+++ b/src/casefiddle.c
@@ -39,15 +39,15 @@ casify_object (enum case_action flag, Lisp_Object obj)
39 register int inword = flag == CASE_DOWN; 39 register int inword = flag == CASE_DOWN;
40 40
41 /* If the case table is flagged as modified, rescan it. */ 41 /* If the case table is flagged as modified, rescan it. */
42 if (NILP (XCHAR_TABLE (current_buffer->downcase_table)->extras[1])) 42 if (NILP (XCHAR_TABLE (B_ (current_buffer, downcase_table))->extras[1]))
43 Fset_case_table (current_buffer->downcase_table); 43 Fset_case_table (B_ (current_buffer, downcase_table));
44 44
45 if (INTEGERP (obj)) 45 if (INTEGERP (obj))
46 { 46 {
47 int flagbits = (CHAR_ALT | CHAR_SUPER | CHAR_HYPER 47 int flagbits = (CHAR_ALT | CHAR_SUPER | CHAR_HYPER
48 | CHAR_SHIFT | CHAR_CTL | CHAR_META); 48 | CHAR_SHIFT | CHAR_CTL | CHAR_META);
49 int flags = XINT (obj) & flagbits; 49 int flags = XINT (obj) & flagbits;
50 int multibyte = ! NILP (current_buffer->enable_multibyte_characters); 50 int multibyte = ! NILP (B_ (current_buffer, enable_multibyte_characters));
51 51
52 /* If the character has higher bits set 52 /* If the character has higher bits set
53 above the flags, return it unchanged. 53 above the flags, return it unchanged.
@@ -198,7 +198,7 @@ casify_region (enum case_action flag, Lisp_Object b, Lisp_Object e)
198{ 198{
199 register int c; 199 register int c;
200 register int inword = flag == CASE_DOWN; 200 register int inword = flag == CASE_DOWN;
201 register int multibyte = !NILP (current_buffer->enable_multibyte_characters); 201 register int multibyte = !NILP (B_ (current_buffer, enable_multibyte_characters));
202 EMACS_INT start, end; 202 EMACS_INT start, end;
203 EMACS_INT start_byte, end_byte; 203 EMACS_INT start_byte, end_byte;
204 EMACS_INT first = -1, last; /* Position of first and last changes. */ 204 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)
210 return; 210 return;
211 211
212 /* If the case table is flagged as modified, rescan it. */ 212 /* If the case table is flagged as modified, rescan it. */
213 if (NILP (XCHAR_TABLE (current_buffer->downcase_table)->extras[1])) 213 if (NILP (XCHAR_TABLE (B_ (current_buffer, downcase_table))->extras[1]))
214 Fset_case_table (current_buffer->downcase_table); 214 Fset_case_table (B_ (current_buffer, downcase_table));
215 215
216 validate_region (&b, &e); 216 validate_region (&b, &e);
217 start = XFASTINT (b); 217 start = XFASTINT (b);
diff --git a/src/casetab.c b/src/casetab.c
index 0db9d63f7a6..85c2d6e1581 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,
71 doc: /* Return the case table of the current buffer. */) 71 doc: /* Return the case table of the current buffer. */)
72 (void) 72 (void)
73{ 73{
74 return current_buffer->downcase_table; 74 return B_ (current_buffer, downcase_table);
75} 75}
76 76
77DEFUN ("standard-case-table", Fstandard_case_table, Sstandard_case_table, 0, 0, 0, 77DEFUN ("standard-case-table", Fstandard_case_table, Sstandard_case_table, 0, 0, 0,
@@ -160,10 +160,10 @@ set_case_table (Lisp_Object table, int standard)
160 } 160 }
161 else 161 else
162 { 162 {
163 current_buffer->downcase_table = table; 163 B_ (current_buffer, downcase_table) = table;
164 current_buffer->upcase_table = up; 164 B_ (current_buffer, upcase_table) = up;
165 current_buffer->case_canon_table = canon; 165 B_ (current_buffer, case_canon_table) = canon;
166 current_buffer->case_eqv_table = eqv; 166 B_ (current_buffer, case_eqv_table) = eqv;
167 } 167 }
168 168
169 return table; 169 return table;
diff --git a/src/category.c b/src/category.c
index 06046959b6f..bf8269ffd75 100644
--- a/src/category.c
+++ b/src/category.c
@@ -190,7 +190,7 @@ Lisp_Object
190check_category_table (Lisp_Object table) 190check_category_table (Lisp_Object table)
191{ 191{
192 if (NILP (table)) 192 if (NILP (table))
193 return current_buffer->category_table; 193 return B_ (current_buffer, category_table);
194 CHECK_TYPE (!NILP (Fcategory_table_p (table)), Qcategory_table_p, table); 194 CHECK_TYPE (!NILP (Fcategory_table_p (table)), Qcategory_table_p, table);
195 return table; 195 return table;
196} 196}
@@ -200,7 +200,7 @@ DEFUN ("category-table", Fcategory_table, Scategory_table, 0, 0, 0,
200This is the one specified by the current buffer. */) 200This is the one specified by the current buffer. */)
201 (void) 201 (void)
202{ 202{
203 return current_buffer->category_table; 203 return B_ (current_buffer, category_table);
204} 204}
205 205
206DEFUN ("standard-category-table", Fstandard_category_table, 206DEFUN ("standard-category-table", Fstandard_category_table,
@@ -281,7 +281,7 @@ Return TABLE. */)
281{ 281{
282 int idx; 282 int idx;
283 table = check_category_table (table); 283 table = check_category_table (table);
284 current_buffer->category_table = table; 284 B_ (current_buffer, category_table) = table;
285 /* Indicate that this buffer now has a specified category table. */ 285 /* Indicate that this buffer now has a specified category table. */
286 idx = PER_BUFFER_VAR_IDX (category_table); 286 idx = PER_BUFFER_VAR_IDX (category_table);
287 SET_PER_BUFFER_VALUE_P (current_buffer, idx, 1); 287 SET_PER_BUFFER_VALUE_P (current_buffer, idx, 1);
@@ -292,7 +292,7 @@ Return TABLE. */)
292Lisp_Object 292Lisp_Object
293char_category_set (int c) 293char_category_set (int c)
294{ 294{
295 return CHAR_TABLE_REF (current_buffer->category_table, c); 295 return CHAR_TABLE_REF (B_ (current_buffer, category_table), c);
296} 296}
297 297
298DEFUN ("char-category-set", Fchar_category_set, Schar_category_set, 1, 1, 0, 298DEFUN ("char-category-set", Fchar_category_set, Schar_category_set, 1, 1, 0,
diff --git a/src/category.h b/src/category.h
index 561b06b6f60..16b31da0819 100644
--- a/src/category.h
+++ b/src/category.h
@@ -91,7 +91,7 @@ extern Lisp_Object _temp_category_set;
91 91
92/* The standard category table is stored where it will automatically 92/* The standard category table is stored where it will automatically
93 be used in all new buffers. */ 93 be used in all new buffers. */
94#define Vstandard_category_table buffer_defaults.category_table 94#define Vstandard_category_table B_ (&buffer_defaults, category_table)
95 95
96/* Return the category set of character C in the current category table. */ 96/* Return the category set of character C in the current category table. */
97#define CATEGORY_SET(c) char_category_set (c) 97#define CATEGORY_SET(c) char_category_set (c)
diff --git a/src/character.c b/src/character.c
index 397481e5b39..e4ff3d7922c 100644
--- a/src/character.c
+++ b/src/character.c
@@ -521,7 +521,7 @@ chars_in_text (const unsigned char *ptr, EMACS_INT nbytes)
521{ 521{
522 /* current_buffer is null at early stages of Emacs initialization. */ 522 /* current_buffer is null at early stages of Emacs initialization. */
523 if (current_buffer == 0 523 if (current_buffer == 0
524 || NILP (current_buffer->enable_multibyte_characters)) 524 || NILP (B_ (current_buffer, enable_multibyte_characters)))
525 return nbytes; 525 return nbytes;
526 526
527 return multibyte_chars_in_text (ptr, nbytes); 527 return multibyte_chars_in_text (ptr, nbytes);
@@ -987,7 +987,7 @@ character is not ASCII nor 8-bit character, an error is signalled. */)
987 pos = XFASTINT (position); 987 pos = XFASTINT (position);
988 p = CHAR_POS_ADDR (pos); 988 p = CHAR_POS_ADDR (pos);
989 } 989 }
990 if (NILP (current_buffer->enable_multibyte_characters)) 990 if (NILP (B_ (current_buffer, enable_multibyte_characters)))
991 return make_number (*p); 991 return make_number (*p);
992 } 992 }
993 else 993 else
diff --git a/src/character.h b/src/character.h
index f2ccb28bb37..f2d06102f62 100644
--- a/src/character.h
+++ b/src/character.h
@@ -417,7 +417,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
417 do \ 417 do \
418 { \ 418 { \
419 CHARIDX++; \ 419 CHARIDX++; \
420 if (!NILP (current_buffer->enable_multibyte_characters)) \ 420 if (!NILP (B_ (current_buffer, enable_multibyte_characters))) \
421 { \ 421 { \
422 unsigned char *ptr = BYTE_POS_ADDR (BYTEIDX); \ 422 unsigned char *ptr = BYTE_POS_ADDR (BYTEIDX); \
423 int len; \ 423 int len; \
@@ -484,7 +484,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
484 do \ 484 do \
485 { \ 485 { \
486 (charpos)++; \ 486 (charpos)++; \
487 if (NILP (current_buffer->enable_multibyte_characters)) \ 487 if (NILP (B_ (current_buffer, enable_multibyte_characters))) \
488 (bytepos)++; \ 488 (bytepos)++; \
489 else \ 489 else \
490 INC_POS ((bytepos)); \ 490 INC_POS ((bytepos)); \
@@ -498,7 +498,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
498 do \ 498 do \
499 { \ 499 { \
500 (charpos)--; \ 500 (charpos)--; \
501 if (NILP (current_buffer->enable_multibyte_characters)) \ 501 if (NILP (B_ (current_buffer, enable_multibyte_characters))) \
502 (bytepos)--; \ 502 (bytepos)--; \
503 else \ 503 else \
504 DEC_POS ((bytepos)); \ 504 DEC_POS ((bytepos)); \
@@ -561,11 +561,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
561#define ASCII_CHAR_WIDTH(c) \ 561#define ASCII_CHAR_WIDTH(c) \
562 (c < 0x20 \ 562 (c < 0x20 \
563 ? (c == '\t' \ 563 ? (c == '\t' \
564 ? XFASTINT (current_buffer->tab_width) \ 564 ? XFASTINT (B_ (current_buffer, tab_width)) \
565 : (c == '\n' ? 0 : (NILP (current_buffer->ctl_arrow) ? 4 : 2))) \ 565 : (c == '\n' ? 0 : (NILP (B_ (current_buffer, ctl_arrow)) ? 4 : 2))) \
566 : (c < 0x7f \ 566 : (c < 0x7f \
567 ? 1 \ 567 ? 1 \
568 : ((NILP (current_buffer->ctl_arrow) ? 4 : 2)))) 568 : ((NILP (B_ (current_buffer, ctl_arrow)) ? 4 : 2))))
569 569
570/* Return the width of character C. The width is measured by how many 570/* Return the width of character C. The width is measured by how many
571 columns C will occupy on the screen when displayed in the current 571 columns C will occupy on the screen when displayed in the current
diff --git a/src/charset.c b/src/charset.c
index 229f2c2cdae..80e6a114197 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1554,7 +1554,7 @@ only `ascii', `eight-bit-control', and `eight-bit-graphic'. */)
1554 EMACS_INT from, from_byte, to, stop, stop_byte; 1554 EMACS_INT from, from_byte, to, stop, stop_byte;
1555 int i; 1555 int i;
1556 Lisp_Object val; 1556 Lisp_Object val;
1557 int multibyte = ! NILP (current_buffer->enable_multibyte_characters); 1557 int multibyte = ! NILP (B_ (current_buffer, enable_multibyte_characters));
1558 1558
1559 validate_region (&beg, &end); 1559 validate_region (&beg, &end);
1560 from = XFASTINT (beg); 1560 from = XFASTINT (beg);
diff --git a/src/cmds.c b/src/cmds.c
index 93b7e2b7651..e82ada6f03c 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
292 } 292 }
293 293
294 if (remove_boundary 294 if (remove_boundary
295 && CONSP (current_buffer->undo_list) 295 && CONSP (B_ (current_buffer, undo_list))
296 && NILP (XCAR (current_buffer->undo_list))) 296 && NILP (XCAR (B_ (current_buffer, undo_list))))
297 /* Remove the undo_boundary that was just pushed. */ 297 /* Remove the undo_boundary that was just pushed. */
298 current_buffer->undo_list = XCDR (current_buffer->undo_list); 298 B_ (current_buffer, undo_list) = XCDR (B_ (current_buffer, undo_list));
299 299
300 /* Barf if the key that invoked this was not a character. */ 300 /* Barf if the key that invoked this was not a character. */
301 if (!CHARACTERP (last_command_event)) 301 if (!CHARACTERP (last_command_event))
@@ -335,12 +335,12 @@ internal_self_insert (int c, EMACS_INT n)
335 EMACS_INT chars_to_delete = 0; 335 EMACS_INT chars_to_delete = 0;
336 EMACS_INT spaces_to_insert = 0; 336 EMACS_INT spaces_to_insert = 0;
337 337
338 overwrite = current_buffer->overwrite_mode; 338 overwrite = B_ (current_buffer, overwrite_mode);
339 if (!NILP (Vbefore_change_functions) || !NILP (Vafter_change_functions)) 339 if (!NILP (Vbefore_change_functions) || !NILP (Vafter_change_functions))
340 hairy = 1; 340 hairy = 1;
341 341
342 /* At first, get multi-byte form of C in STR. */ 342 /* At first, get multi-byte form of C in STR. */
343 if (!NILP (current_buffer->enable_multibyte_characters)) 343 if (!NILP (B_ (current_buffer, enable_multibyte_characters)))
344 { 344 {
345 len = CHAR_STRING (c, str); 345 len = CHAR_STRING (c, str);
346 if (len == 1) 346 if (len == 1)
@@ -416,11 +416,11 @@ internal_self_insert (int c, EMACS_INT n)
416 416
417 synt = SYNTAX (c); 417 synt = SYNTAX (c);
418 418
419 if (!NILP (current_buffer->abbrev_mode) 419 if (!NILP (B_ (current_buffer, abbrev_mode))
420 && synt != Sword 420 && synt != Sword
421 && NILP (current_buffer->read_only) 421 && NILP (B_ (current_buffer, read_only))
422 && PT > BEGV 422 && PT > BEGV
423 && (SYNTAX (!NILP (current_buffer->enable_multibyte_characters) 423 && (SYNTAX (!NILP (B_ (current_buffer, enable_multibyte_characters))
424 ? XFASTINT (Fprevious_char ()) 424 ? XFASTINT (Fprevious_char ())
425 : UNIBYTE_TO_CHAR (XFASTINT (Fprevious_char ()))) 425 : UNIBYTE_TO_CHAR (XFASTINT (Fprevious_char ())))
426 == Sword)) 426 == Sword))
@@ -448,7 +448,7 @@ internal_self_insert (int c, EMACS_INT n)
448 448
449 if (chars_to_delete) 449 if (chars_to_delete)
450 { 450 {
451 int mc = ((NILP (current_buffer->enable_multibyte_characters) 451 int mc = ((NILP (B_ (current_buffer, enable_multibyte_characters))
452 && SINGLE_BYTE_CHAR_P (c)) 452 && SINGLE_BYTE_CHAR_P (c))
453 ? UNIBYTE_TO_CHAR (c) : c); 453 ? UNIBYTE_TO_CHAR (c) : c);
454 Lisp_Object string = Fmake_string (make_number (n), make_number (mc)); 454 Lisp_Object string = Fmake_string (make_number (n), make_number (mc));
@@ -479,7 +479,7 @@ internal_self_insert (int c, EMACS_INT n)
479 if ((CHAR_TABLE_P (Vauto_fill_chars) 479 if ((CHAR_TABLE_P (Vauto_fill_chars)
480 ? !NILP (CHAR_TABLE_REF (Vauto_fill_chars, c)) 480 ? !NILP (CHAR_TABLE_REF (Vauto_fill_chars, c))
481 : (c == ' ' || c == '\n')) 481 : (c == ' ' || c == '\n'))
482 && !NILP (current_buffer->auto_fill_function)) 482 && !NILP (B_ (current_buffer, auto_fill_function)))
483 { 483 {
484 Lisp_Object tem; 484 Lisp_Object tem;
485 485
@@ -488,7 +488,7 @@ internal_self_insert (int c, EMACS_INT n)
488 that. Must have the newline in place already so filling and 488 that. Must have the newline in place already so filling and
489 justification, if any, know where the end is going to be. */ 489 justification, if any, know where the end is going to be. */
490 SET_PT_BOTH (PT - 1, PT_BYTE - 1); 490 SET_PT_BOTH (PT - 1, PT_BYTE - 1);
491 tem = call0 (current_buffer->auto_fill_function); 491 tem = call0 (B_ (current_buffer, auto_fill_function));
492 /* Test PT < ZV in case the auto-fill-function is strange. */ 492 /* Test PT < ZV in case the auto-fill-function is strange. */
493 if (c == '\n' && PT < ZV) 493 if (c == '\n' && PT < ZV)
494 SET_PT_BOTH (PT + 1, PT_BYTE + 1); 494 SET_PT_BOTH (PT + 1, PT_BYTE + 1);
diff --git a/src/coding.c b/src/coding.c
index a9f16de56f3..899cca6d5aa 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -7038,8 +7038,8 @@ decode_coding (struct coding_system *coding)
7038 set_buffer_internal (XBUFFER (coding->dst_object)); 7038 set_buffer_internal (XBUFFER (coding->dst_object));
7039 if (GPT != PT) 7039 if (GPT != PT)
7040 move_gap_both (PT, PT_BYTE); 7040 move_gap_both (PT, PT_BYTE);
7041 undo_list = current_buffer->undo_list; 7041 undo_list = B_ (current_buffer, undo_list);
7042 current_buffer->undo_list = Qt; 7042 B_ (current_buffer, undo_list) = Qt;
7043 } 7043 }
7044 7044
7045 coding->consumed = coding->consumed_char = 0; 7045 coding->consumed = coding->consumed_char = 0;
@@ -7136,7 +7136,7 @@ decode_coding (struct coding_system *coding)
7136 decode_eol (coding); 7136 decode_eol (coding);
7137 if (BUFFERP (coding->dst_object)) 7137 if (BUFFERP (coding->dst_object))
7138 { 7138 {
7139 current_buffer->undo_list = undo_list; 7139 B_ (current_buffer, undo_list) = undo_list;
7140 record_insert (coding->dst_pos, coding->produced_char); 7140 record_insert (coding->dst_pos, coding->produced_char);
7141 } 7141 }
7142 return coding->result; 7142 return coding->result;
@@ -7433,7 +7433,7 @@ encode_coding (struct coding_system *coding)
7433 { 7433 {
7434 set_buffer_internal (XBUFFER (coding->dst_object)); 7434 set_buffer_internal (XBUFFER (coding->dst_object));
7435 coding->dst_multibyte 7435 coding->dst_multibyte
7436 = ! NILP (current_buffer->enable_multibyte_characters); 7436 = ! NILP (B_ (current_buffer, enable_multibyte_characters));
7437 } 7437 }
7438 7438
7439 coding->consumed = coding->consumed_char = 0; 7439 coding->consumed = coding->consumed_char = 0;
@@ -7504,8 +7504,8 @@ make_conversion_work_buffer (int multibyte)
7504 doesn't compile new regexps. */ 7504 doesn't compile new regexps. */
7505 Fset (Fmake_local_variable (Qinhibit_modification_hooks), Qt); 7505 Fset (Fmake_local_variable (Qinhibit_modification_hooks), Qt);
7506 Ferase_buffer (); 7506 Ferase_buffer ();
7507 current_buffer->undo_list = Qt; 7507 B_ (current_buffer, undo_list) = Qt;
7508 current_buffer->enable_multibyte_characters = multibyte ? Qt : Qnil; 7508 B_ (current_buffer, enable_multibyte_characters) = multibyte ? Qt : Qnil;
7509 set_buffer_internal (current); 7509 set_buffer_internal (current);
7510 return workbuf; 7510 return workbuf;
7511} 7511}
@@ -7562,7 +7562,7 @@ decode_coding_gap (struct coding_system *coding,
7562 coding->dst_object = coding->src_object; 7562 coding->dst_object = coding->src_object;
7563 coding->dst_pos = PT; 7563 coding->dst_pos = PT;
7564 coding->dst_pos_byte = PT_BYTE; 7564 coding->dst_pos_byte = PT_BYTE;
7565 coding->dst_multibyte = ! NILP (current_buffer->enable_multibyte_characters); 7565 coding->dst_multibyte = ! NILP (B_ (current_buffer, enable_multibyte_characters));
7566 7566
7567 if (CODING_REQUIRE_DETECTION (coding)) 7567 if (CODING_REQUIRE_DETECTION (coding))
7568 detect_coding (coding); 7568 detect_coding (coding);
@@ -7728,7 +7728,7 @@ decode_coding_object (struct coding_system *coding,
7728 coding->dst_pos = BUF_PT (XBUFFER (dst_object)); 7728 coding->dst_pos = BUF_PT (XBUFFER (dst_object));
7729 coding->dst_pos_byte = BUF_PT_BYTE (XBUFFER (dst_object)); 7729 coding->dst_pos_byte = BUF_PT_BYTE (XBUFFER (dst_object));
7730 coding->dst_multibyte 7730 coding->dst_multibyte
7731 = ! NILP (XBUFFER (dst_object)->enable_multibyte_characters); 7731 = ! NILP (B_ (XBUFFER (dst_object), enable_multibyte_characters));
7732 } 7732 }
7733 else 7733 else
7734 { 7734 {
@@ -7798,7 +7798,7 @@ decode_coding_object (struct coding_system *coding,
7798 TEMP_SET_PT_BOTH (saved_pt, saved_pt_byte); 7798 TEMP_SET_PT_BOTH (saved_pt, saved_pt_byte);
7799 else if (saved_pt < from + chars) 7799 else if (saved_pt < from + chars)
7800 TEMP_SET_PT_BOTH (from, from_byte); 7800 TEMP_SET_PT_BOTH (from, from_byte);
7801 else if (! NILP (current_buffer->enable_multibyte_characters)) 7801 else if (! NILP (B_ (current_buffer, enable_multibyte_characters)))
7802 TEMP_SET_PT_BOTH (saved_pt + (coding->produced_char - chars), 7802 TEMP_SET_PT_BOTH (saved_pt + (coding->produced_char - chars),
7803 saved_pt_byte + (coding->produced - bytes)); 7803 saved_pt_byte + (coding->produced - bytes));
7804 else 7804 else
@@ -7822,7 +7822,7 @@ decode_coding_object (struct coding_system *coding,
7822 { 7822 {
7823 tail->bytepos = from_byte + coding->produced; 7823 tail->bytepos = from_byte + coding->produced;
7824 tail->charpos 7824 tail->charpos
7825 = (NILP (current_buffer->enable_multibyte_characters) 7825 = (NILP (B_ (current_buffer, enable_multibyte_characters))
7826 ? tail->bytepos : from + coding->produced_char); 7826 ? tail->bytepos : from + coding->produced_char);
7827 } 7827 }
7828 } 7828 }
@@ -7960,7 +7960,7 @@ encode_coding_object (struct coding_system *coding,
7960 set_buffer_temp (current); 7960 set_buffer_temp (current);
7961 } 7961 }
7962 coding->dst_multibyte 7962 coding->dst_multibyte
7963 = ! NILP (XBUFFER (dst_object)->enable_multibyte_characters); 7963 = ! NILP (B_ (XBUFFER (dst_object), enable_multibyte_characters));
7964 } 7964 }
7965 else if (EQ (dst_object, Qt)) 7965 else if (EQ (dst_object, Qt))
7966 { 7966 {
@@ -8003,7 +8003,7 @@ encode_coding_object (struct coding_system *coding,
8003 TEMP_SET_PT_BOTH (saved_pt, saved_pt_byte); 8003 TEMP_SET_PT_BOTH (saved_pt, saved_pt_byte);
8004 else if (saved_pt < from + chars) 8004 else if (saved_pt < from + chars)
8005 TEMP_SET_PT_BOTH (from, from_byte); 8005 TEMP_SET_PT_BOTH (from, from_byte);
8006 else if (! NILP (current_buffer->enable_multibyte_characters)) 8006 else if (! NILP (B_ (current_buffer, enable_multibyte_characters)))
8007 TEMP_SET_PT_BOTH (saved_pt + (coding->produced_char - chars), 8007 TEMP_SET_PT_BOTH (saved_pt + (coding->produced_char - chars),
8008 saved_pt_byte + (coding->produced - bytes)); 8008 saved_pt_byte + (coding->produced - bytes));
8009 else 8009 else
@@ -8027,7 +8027,7 @@ encode_coding_object (struct coding_system *coding,
8027 { 8027 {
8028 tail->bytepos = from_byte + coding->produced; 8028 tail->bytepos = from_byte + coding->produced;
8029 tail->charpos 8029 tail->charpos
8030 = (NILP (current_buffer->enable_multibyte_characters) 8030 = (NILP (B_ (current_buffer, enable_multibyte_characters))
8031 ? tail->bytepos : from + coding->produced_char); 8031 ? tail->bytepos : from + coding->produced_char);
8032 } 8032 }
8033 } 8033 }
@@ -8481,8 +8481,8 @@ highest priority. */)
8481 return detect_coding_system (BYTE_POS_ADDR (from_byte), 8481 return detect_coding_system (BYTE_POS_ADDR (from_byte),
8482 to - from, to_byte - from_byte, 8482 to - from, to_byte - from_byte,
8483 !NILP (highest), 8483 !NILP (highest),
8484 !NILP (current_buffer 8484 !NILP (B_ (current_buffer
8485 ->enable_multibyte_characters), 8485 , enable_multibyte_characters)),
8486 Qnil); 8486 Qnil);
8487} 8487}
8488 8488
@@ -8564,7 +8564,7 @@ DEFUN ("find-coding-systems-region-internal",
8564 CHECK_NUMBER_COERCE_MARKER (end); 8564 CHECK_NUMBER_COERCE_MARKER (end);
8565 if (XINT (start) < BEG || XINT (end) > Z || XINT (start) > XINT (end)) 8565 if (XINT (start) < BEG || XINT (end) > Z || XINT (start) > XINT (end))
8566 args_out_of_range (start, end); 8566 args_out_of_range (start, end);
8567 if (NILP (current_buffer->enable_multibyte_characters)) 8567 if (NILP (B_ (current_buffer, enable_multibyte_characters)))
8568 return Qt; 8568 return Qt;
8569 start_byte = CHAR_TO_BYTE (XINT (start)); 8569 start_byte = CHAR_TO_BYTE (XINT (start));
8570 end_byte = CHAR_TO_BYTE (XINT (end)); 8570 end_byte = CHAR_TO_BYTE (XINT (end));
@@ -8698,7 +8698,7 @@ to the string. */)
8698 validate_region (&start, &end); 8698 validate_region (&start, &end);
8699 from = XINT (start); 8699 from = XINT (start);
8700 to = XINT (end); 8700 to = XINT (end);
8701 if (NILP (current_buffer->enable_multibyte_characters) 8701 if (NILP (B_ (current_buffer, enable_multibyte_characters))
8702 || (ascii_compatible 8702 || (ascii_compatible
8703 && (to - from) == (CHAR_TO_BYTE (to) - (CHAR_TO_BYTE (from))))) 8703 && (to - from) == (CHAR_TO_BYTE (to) - (CHAR_TO_BYTE (from)))))
8704 return Qnil; 8704 return Qnil;
@@ -8814,7 +8814,7 @@ is nil. */)
8814 CHECK_NUMBER_COERCE_MARKER (end); 8814 CHECK_NUMBER_COERCE_MARKER (end);
8815 if (XINT (start) < BEG || XINT (end) > Z || XINT (start) > XINT (end)) 8815 if (XINT (start) < BEG || XINT (end) > Z || XINT (start) > XINT (end))
8816 args_out_of_range (start, end); 8816 args_out_of_range (start, end);
8817 if (NILP (current_buffer->enable_multibyte_characters)) 8817 if (NILP (B_ (current_buffer, enable_multibyte_characters)))
8818 return Qnil; 8818 return Qnil;
8819 start_byte = CHAR_TO_BYTE (XINT (start)); 8819 start_byte = CHAR_TO_BYTE (XINT (start));
8820 end_byte = CHAR_TO_BYTE (XINT (end)); 8820 end_byte = CHAR_TO_BYTE (XINT (end));
diff --git a/src/composite.c b/src/composite.c
index 58bc68597cc..3c941ea6614 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
796 796
797 if (NILP (string)) 797 if (NILP (string))
798 { 798 {
799 if (NILP (current_buffer->enable_multibyte_characters)) 799 if (NILP (B_ (current_buffer, enable_multibyte_characters)))
800 error ("Attempt to shape unibyte text"); 800 error ("Attempt to shape unibyte text");
801 validate_region (&start, &end); 801 validate_region (&start, &end);
802 from = XFASTINT (start); 802 from = XFASTINT (start);
@@ -1028,7 +1028,7 @@ composition_compute_stop_pos (struct composition_it *cmp_it, EMACS_INT charpos,
1028 cmp_it->stop_pos = endpos = start; 1028 cmp_it->stop_pos = endpos = start;
1029 cmp_it->ch = -1; 1029 cmp_it->ch = -1;
1030 } 1030 }
1031 if (NILP (current_buffer->enable_multibyte_characters) 1031 if (NILP (B_ (current_buffer, enable_multibyte_characters))
1032 || NILP (Vauto_composition_mode)) 1032 || NILP (Vauto_composition_mode))
1033 return; 1033 return;
1034 if (bytepos < 0) 1034 if (bytepos < 0)
@@ -1674,7 +1674,7 @@ composition_adjust_point (EMACS_INT last_pt, EMACS_INT new_pt)
1674 return new_pt; 1674 return new_pt;
1675 } 1675 }
1676 1676
1677 if (NILP (current_buffer->enable_multibyte_characters) 1677 if (NILP (B_ (current_buffer, enable_multibyte_characters))
1678 || NILP (Vauto_composition_mode)) 1678 || NILP (Vauto_composition_mode))
1679 return new_pt; 1679 return new_pt;
1680 1680
@@ -1851,7 +1851,7 @@ See `find-composition' for more details. */)
1851 1851
1852 if (!find_composition (from, to, &start, &end, &prop, string)) 1852 if (!find_composition (from, to, &start, &end, &prop, string))
1853 { 1853 {
1854 if (!NILP (current_buffer->enable_multibyte_characters) 1854 if (!NILP (B_ (current_buffer, enable_multibyte_characters))
1855 && ! NILP (Vauto_composition_mode) 1855 && ! NILP (Vauto_composition_mode)
1856 && find_automatic_composition (from, to, &start, &end, &gstring, 1856 && find_automatic_composition (from, to, &start, &end, &gstring,
1857 string)) 1857 string))
diff --git a/src/data.c b/src/data.c
index 77cdbabb2d5..c0557d5c735 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_
1009 } 1009 }
1010 else 1010 else
1011 { 1011 {
1012 tem1 = assq_no_quit (var, current_buffer->local_var_alist); 1012 tem1 = assq_no_quit (var, B_ (current_buffer, local_var_alist));
1013 XSETBUFFER (blv->where, current_buffer); 1013 XSETBUFFER (blv->where, current_buffer);
1014 } 1014 }
1015 } 1015 }
@@ -1178,7 +1178,7 @@ set_internal (register Lisp_Object symbol, register Lisp_Object newval, register
1178 tem1 = Fassq (symbol, 1178 tem1 = Fassq (symbol,
1179 (blv->frame_local 1179 (blv->frame_local
1180 ? XFRAME (where)->param_alist 1180 ? XFRAME (where)->param_alist
1181 : XBUFFER (where)->local_var_alist)); 1181 : B_ (XBUFFER (where), local_var_alist)));
1182 blv->where = where; 1182 blv->where = where;
1183 blv->found = 1; 1183 blv->found = 1;
1184 1184
@@ -1209,8 +1209,8 @@ set_internal (register Lisp_Object symbol, register Lisp_Object newval, register
1209 bindings, not for frame-local bindings. */ 1209 bindings, not for frame-local bindings. */
1210 eassert (!blv->frame_local); 1210 eassert (!blv->frame_local);
1211 tem1 = Fcons (symbol, XCDR (blv->defcell)); 1211 tem1 = Fcons (symbol, XCDR (blv->defcell));
1212 XBUFFER (where)->local_var_alist 1212 B_ (XBUFFER (where), local_var_alist)
1213 = Fcons (tem1, XBUFFER (where)->local_var_alist); 1213 = Fcons (tem1, B_ (XBUFFER (where), local_var_alist));
1214 } 1214 }
1215 } 1215 }
1216 1216
@@ -1632,13 +1632,13 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */)
1632 if (let_shadows_global_binding_p (symbol)) 1632 if (let_shadows_global_binding_p (symbol))
1633 message ("Making %s local to %s while let-bound!", 1633 message ("Making %s local to %s while let-bound!",
1634 SDATA (SYMBOL_NAME (variable)), 1634 SDATA (SYMBOL_NAME (variable)),
1635 SDATA (current_buffer->name)); 1635 SDATA (B_ (current_buffer, name)));
1636 } 1636 }
1637 } 1637 }
1638 1638
1639 /* Make sure this buffer has its own value of symbol. */ 1639 /* Make sure this buffer has its own value of symbol. */
1640 XSETSYMBOL (variable, sym); /* Update in case of aliasing. */ 1640 XSETSYMBOL (variable, sym); /* Update in case of aliasing. */
1641 tem = Fassq (variable, current_buffer->local_var_alist); 1641 tem = Fassq (variable, B_ (current_buffer, local_var_alist));
1642 if (NILP (tem)) 1642 if (NILP (tem))
1643 { 1643 {
1644 if (let_shadows_buffer_binding_p (sym)) 1644 if (let_shadows_buffer_binding_p (sym))
@@ -1650,9 +1650,9 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */)
1650 default value. */ 1650 default value. */
1651 find_symbol_value (variable); 1651 find_symbol_value (variable);
1652 1652
1653 current_buffer->local_var_alist 1653 B_ (current_buffer, local_var_alist)
1654 = Fcons (Fcons (variable, XCDR (blv->defcell)), 1654 = Fcons (Fcons (variable, XCDR (blv->defcell)),
1655 current_buffer->local_var_alist); 1655 B_ (current_buffer, local_var_alist));
1656 1656
1657 /* Make sure symbol does not think it is set up for this buffer; 1657 /* Make sure symbol does not think it is set up for this buffer;
1658 force it to look once again for this buffer's value. */ 1658 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. */)
1718 1718
1719 /* Get rid of this buffer's alist element, if any. */ 1719 /* Get rid of this buffer's alist element, if any. */
1720 XSETSYMBOL (variable, sym); /* Propagate variable indirection. */ 1720 XSETSYMBOL (variable, sym); /* Propagate variable indirection. */
1721 tem = Fassq (variable, current_buffer->local_var_alist); 1721 tem = Fassq (variable, B_ (current_buffer, local_var_alist));
1722 if (!NILP (tem)) 1722 if (!NILP (tem))
1723 current_buffer->local_var_alist 1723 B_ (current_buffer, local_var_alist)
1724 = Fdelq (tem, current_buffer->local_var_alist); 1724 = Fdelq (tem, B_ (current_buffer, local_var_alist));
1725 1725
1726 /* If the symbol is set up with the current buffer's binding 1726 /* If the symbol is set up with the current buffer's binding
1727 loaded, recompute its value. We have to do it now, or else 1727 loaded, recompute its value. We have to do it now, or else
@@ -1848,7 +1848,7 @@ BUFFER defaults to the current buffer. */)
1848 XSETBUFFER (tmp, buf); 1848 XSETBUFFER (tmp, buf);
1849 XSETSYMBOL (variable, sym); /* Update in case of aliasing. */ 1849 XSETSYMBOL (variable, sym); /* Update in case of aliasing. */
1850 1850
1851 for (tail = buf->local_var_alist; CONSP (tail); tail = XCDR (tail)) 1851 for (tail = B_ (buf, local_var_alist); CONSP (tail); tail = XCDR (tail))
1852 { 1852 {
1853 elt = XCAR (tail); 1853 elt = XCAR (tail);
1854 if (EQ (variable, XCAR (elt))) 1854 if (EQ (variable, XCAR (elt)))
diff --git a/src/dired.c b/src/dired.c
index e37055258d6..f1dc03b56d0 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
158# ifdef WINDOWSNT 158# ifdef WINDOWSNT
159 /* Windows users want case-insensitive wildcards. */ 159 /* Windows users want case-insensitive wildcards. */
160 bufp = compile_pattern (match, 0, 160 bufp = compile_pattern (match, 0,
161 buffer_defaults.case_canon_table, 0, 1); 161 B_ (&buffer_defaults, case_canon_table), 0, 1);
162# else /* !WINDOWSNT */ 162# else /* !WINDOWSNT */
163 bufp = compile_pattern (match, 0, Qnil, 0, 1); 163 bufp = compile_pattern (match, 0, Qnil, 0, 1);
164# endif /* !WINDOWSNT */ 164# endif /* !WINDOWSNT */
diff --git a/src/dispextern.h b/src/dispextern.h
index 6d54ebefd84..e01c1a961f7 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -1416,7 +1416,7 @@ struct glyph_string
1416 && !(W)->pseudo_window_p \ 1416 && !(W)->pseudo_window_p \
1417 && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W)))) \ 1417 && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W)))) \
1418 && BUFFERP ((W)->buffer) \ 1418 && BUFFERP ((W)->buffer) \
1419 && !NILP (XBUFFER ((W)->buffer)->mode_line_format) \ 1419 && !NILP (B_ (XBUFFER ((W)->buffer), mode_line_format)) \
1420 && WINDOW_TOTAL_LINES (W) > 1) 1420 && WINDOW_TOTAL_LINES (W) > 1)
1421 1421
1422/* Value is non-zero if window W wants a header line. */ 1422/* Value is non-zero if window W wants a header line. */
@@ -1426,8 +1426,8 @@ struct glyph_string
1426 && !(W)->pseudo_window_p \ 1426 && !(W)->pseudo_window_p \
1427 && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W)))) \ 1427 && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W)))) \
1428 && BUFFERP ((W)->buffer) \ 1428 && BUFFERP ((W)->buffer) \
1429 && !NILP (XBUFFER ((W)->buffer)->header_line_format) \ 1429 && !NILP (B_ (XBUFFER ((W)->buffer), header_line_format)) \
1430 && WINDOW_TOTAL_LINES (W) > 1 + !NILP (XBUFFER ((W)->buffer)->mode_line_format)) 1430 && WINDOW_TOTAL_LINES (W) > 1 + !NILP (B_ (XBUFFER ((W)->buffer), mode_line_format)))
1431 1431
1432 1432
1433/* Return proper value to be used as baseline offset of font that has 1433/* Return proper value to be used as baseline offset of font that has
diff --git a/src/dispnew.c b/src/dispnew.c
index 1aef70f1a5d..2aa3d9208b3 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -6129,7 +6129,7 @@ pass nil for VARIABLE. */)
6129 { 6129 {
6130 buf = XCDR (XCAR (tail)); 6130 buf = XCDR (XCAR (tail));
6131 /* Ignore buffers that aren't included in buffer lists. */ 6131 /* Ignore buffers that aren't included in buffer lists. */
6132 if (SREF (XBUFFER (buf)->name, 0) == ' ') 6132 if (SREF (B_ (XBUFFER (buf), name), 0) == ' ')
6133 continue; 6133 continue;
6134 if (vecp == end) 6134 if (vecp == end)
6135 goto changed; 6135 goto changed;
@@ -6137,7 +6137,7 @@ pass nil for VARIABLE. */)
6137 goto changed; 6137 goto changed;
6138 if (vecp == end) 6138 if (vecp == end)
6139 goto changed; 6139 goto changed;
6140 if (!EQ (*vecp++, XBUFFER (buf)->read_only)) 6140 if (!EQ (*vecp++, B_ (XBUFFER (buf), read_only)))
6141 goto changed; 6141 goto changed;
6142 if (vecp == end) 6142 if (vecp == end)
6143 goto changed; 6143 goto changed;
@@ -6184,10 +6184,10 @@ pass nil for VARIABLE. */)
6184 { 6184 {
6185 buf = XCDR (XCAR (tail)); 6185 buf = XCDR (XCAR (tail));
6186 /* Ignore buffers that aren't included in buffer lists. */ 6186 /* Ignore buffers that aren't included in buffer lists. */
6187 if (SREF (XBUFFER (buf)->name, 0) == ' ') 6187 if (SREF (B_ (XBUFFER (buf), name), 0) == ' ')
6188 continue; 6188 continue;
6189 *vecp++ = buf; 6189 *vecp++ = buf;
6190 *vecp++ = XBUFFER (buf)->read_only; 6190 *vecp++ = B_ (XBUFFER (buf), read_only);
6191 *vecp++ = Fbuffer_modified_p (buf); 6191 *vecp++ = Fbuffer_modified_p (buf);
6192 } 6192 }
6193 /* Fill up the vector with lambdas (always at least one). */ 6193 /* Fill up the vector with lambdas (always at least one). */
diff --git a/src/editfns.c b/src/editfns.c
index 30acc36f025..a3de4907efc 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -306,10 +306,10 @@ region_limit (int beginningp)
306 306
307 if (!NILP (Vtransient_mark_mode) 307 if (!NILP (Vtransient_mark_mode)
308 && NILP (Vmark_even_if_inactive) 308 && NILP (Vmark_even_if_inactive)
309 && NILP (current_buffer->mark_active)) 309 && NILP (B_ (current_buffer, mark_active)))
310 xsignal0 (Qmark_inactive); 310 xsignal0 (Qmark_inactive);
311 311
312 m = Fmarker_position (current_buffer->mark); 312 m = Fmarker_position (B_ (current_buffer, mark));
313 if (NILP (m)) 313 if (NILP (m))
314 error ("The mark is not set now, so there is no region"); 314 error ("The mark is not set now, so there is no region");
315 315
@@ -338,7 +338,7 @@ Watch out! Moving this marker changes the mark position.
338If you set the marker not to point anywhere, the buffer will have no mark. */) 338If you set the marker not to point anywhere, the buffer will have no mark. */)
339 (void) 339 (void)
340{ 340{
341 return current_buffer->mark; 341 return B_ (current_buffer, mark);
342} 342}
343 343
344 344
@@ -866,9 +866,9 @@ save_excursion_save (void)
866 == current_buffer); 866 == current_buffer);
867 867
868 return Fcons (Fpoint_marker (), 868 return Fcons (Fpoint_marker (),
869 Fcons (Fcopy_marker (current_buffer->mark, Qnil), 869 Fcons (Fcopy_marker (B_ (current_buffer, mark), Qnil),
870 Fcons (visible ? Qt : Qnil, 870 Fcons (visible ? Qt : Qnil,
871 Fcons (current_buffer->mark_active, 871 Fcons (B_ (current_buffer, mark_active),
872 selected_window)))); 872 selected_window))));
873} 873}
874 874
@@ -900,8 +900,8 @@ save_excursion_restore (Lisp_Object info)
900 /* Mark marker. */ 900 /* Mark marker. */
901 info = XCDR (info); 901 info = XCDR (info);
902 tem = XCAR (info); 902 tem = XCAR (info);
903 omark = Fmarker_position (current_buffer->mark); 903 omark = Fmarker_position (B_ (current_buffer, mark));
904 Fset_marker (current_buffer->mark, tem, Fcurrent_buffer ()); 904 Fset_marker (B_ (current_buffer, mark), tem, Fcurrent_buffer ());
905 nmark = Fmarker_position (tem); 905 nmark = Fmarker_position (tem);
906 unchain_marker (XMARKER (tem)); 906 unchain_marker (XMARKER (tem));
907 907
@@ -922,14 +922,14 @@ save_excursion_restore (Lisp_Object info)
922 /* Mark active */ 922 /* Mark active */
923 info = XCDR (info); 923 info = XCDR (info);
924 tem = XCAR (info); 924 tem = XCAR (info);
925 tem1 = current_buffer->mark_active; 925 tem1 = B_ (current_buffer, mark_active);
926 current_buffer->mark_active = tem; 926 B_ (current_buffer, mark_active) = tem;
927 927
928 if (!NILP (Vrun_hooks)) 928 if (!NILP (Vrun_hooks))
929 { 929 {
930 /* If mark is active now, and either was not active 930 /* If mark is active now, and either was not active
931 or was at a different place, run the activate hook. */ 931 or was at a different place, run the activate hook. */
932 if (! NILP (current_buffer->mark_active)) 932 if (! NILP (B_ (current_buffer, mark_active)))
933 { 933 {
934 if (! EQ (omark, nmark)) 934 if (! EQ (omark, nmark))
935 call1 (Vrun_hooks, intern ("activate-mark-hook")); 935 call1 (Vrun_hooks, intern ("activate-mark-hook"));
@@ -1114,7 +1114,7 @@ At the beginning of the buffer or accessible region, return 0. */)
1114 Lisp_Object temp; 1114 Lisp_Object temp;
1115 if (PT <= BEGV) 1115 if (PT <= BEGV)
1116 XSETFASTINT (temp, 0); 1116 XSETFASTINT (temp, 0);
1117 else if (!NILP (current_buffer->enable_multibyte_characters)) 1117 else if (!NILP (B_ (current_buffer, enable_multibyte_characters)))
1118 { 1118 {
1119 EMACS_INT pos = PT_BYTE; 1119 EMACS_INT pos = PT_BYTE;
1120 DEC_POS (pos); 1120 DEC_POS (pos);
@@ -1228,7 +1228,7 @@ If POS is out of range, the value is nil. */)
1228 pos_byte = CHAR_TO_BYTE (XINT (pos)); 1228 pos_byte = CHAR_TO_BYTE (XINT (pos));
1229 } 1229 }
1230 1230
1231 if (!NILP (current_buffer->enable_multibyte_characters)) 1231 if (!NILP (B_ (current_buffer, enable_multibyte_characters)))
1232 { 1232 {
1233 DEC_POS (pos_byte); 1233 DEC_POS (pos_byte);
1234 XSETFASTINT (val, FETCH_CHAR (pos_byte)); 1234 XSETFASTINT (val, FETCH_CHAR (pos_byte));
@@ -2135,7 +2135,7 @@ general_insert_function (void (*insert_func)
2135 unsigned char str[MAX_MULTIBYTE_LENGTH]; 2135 unsigned char str[MAX_MULTIBYTE_LENGTH];
2136 int len; 2136 int len;
2137 2137
2138 if (!NILP (current_buffer->enable_multibyte_characters)) 2138 if (!NILP (B_ (current_buffer, enable_multibyte_characters)))
2139 len = CHAR_STRING (XFASTINT (val), str); 2139 len = CHAR_STRING (XFASTINT (val), str);
2140 else 2140 else
2141 { 2141 {
@@ -2267,7 +2267,7 @@ from adjoining text, if those properties are sticky. */)
2267 CHECK_NUMBER (character); 2267 CHECK_NUMBER (character);
2268 CHECK_NUMBER (count); 2268 CHECK_NUMBER (count);
2269 2269
2270 if (!NILP (current_buffer->enable_multibyte_characters)) 2270 if (!NILP (B_ (current_buffer, enable_multibyte_characters)))
2271 len = CHAR_STRING (XFASTINT (character), str); 2271 len = CHAR_STRING (XFASTINT (character), str);
2272 else 2272 else
2273 str[0] = XFASTINT (character), len = 1; 2273 str[0] = XFASTINT (character), len = 1;
@@ -2316,7 +2316,7 @@ from adjoining text, if those properties are sticky. */)
2316 if (XINT (byte) < 0 || XINT (byte) > 255) 2316 if (XINT (byte) < 0 || XINT (byte) > 255)
2317 args_out_of_range_3 (byte, make_number (0), make_number (255)); 2317 args_out_of_range_3 (byte, make_number (0), make_number (255));
2318 if (XINT (byte) >= 128 2318 if (XINT (byte) >= 128
2319 && ! NILP (current_buffer->enable_multibyte_characters)) 2319 && ! NILP (B_ (current_buffer, enable_multibyte_characters)))
2320 XSETFASTINT (byte, BYTE8_TO_CHAR (XINT (byte))); 2320 XSETFASTINT (byte, BYTE8_TO_CHAR (XINT (byte)));
2321 return Finsert_char (byte, count, inherit); 2321 return Finsert_char (byte, count, inherit);
2322} 2322}
@@ -2370,7 +2370,7 @@ make_buffer_string_both (EMACS_INT start, EMACS_INT start_byte,
2370 if (start < GPT && GPT < end) 2370 if (start < GPT && GPT < end)
2371 move_gap (start); 2371 move_gap (start);
2372 2372
2373 if (! NILP (current_buffer->enable_multibyte_characters)) 2373 if (! NILP (B_ (current_buffer, enable_multibyte_characters)))
2374 result = make_uninit_multibyte_string (end - start, end_byte - start_byte); 2374 result = make_uninit_multibyte_string (end - start, end_byte - start_byte);
2375 else 2375 else
2376 result = make_uninit_string (end - start); 2376 result = make_uninit_string (end - start);
@@ -2485,7 +2485,7 @@ They default to the values of (point-min) and (point-max) in BUFFER. */)
2485 if (NILP (buf)) 2485 if (NILP (buf))
2486 nsberror (buffer); 2486 nsberror (buffer);
2487 bp = XBUFFER (buf); 2487 bp = XBUFFER (buf);
2488 if (NILP (bp->name)) 2488 if (NILP (B_ (bp, name)))
2489 error ("Selecting deleted buffer"); 2489 error ("Selecting deleted buffer");
2490 2490
2491 if (NILP (start)) 2491 if (NILP (start))
@@ -2533,8 +2533,8 @@ determines whether case is significant or ignored. */)
2533 register EMACS_INT begp1, endp1, begp2, endp2, temp; 2533 register EMACS_INT begp1, endp1, begp2, endp2, temp;
2534 register struct buffer *bp1, *bp2; 2534 register struct buffer *bp1, *bp2;
2535 register Lisp_Object trt 2535 register Lisp_Object trt
2536 = (!NILP (current_buffer->case_fold_search) 2536 = (!NILP (B_ (current_buffer, case_fold_search))
2537 ? current_buffer->case_canon_table : Qnil); 2537 ? B_ (current_buffer, case_canon_table) : Qnil);
2538 EMACS_INT chars = 0; 2538 EMACS_INT chars = 0;
2539 EMACS_INT i1, i2, i1_byte, i2_byte; 2539 EMACS_INT i1, i2, i1_byte, i2_byte;
2540 2540
@@ -2549,7 +2549,7 @@ determines whether case is significant or ignored. */)
2549 if (NILP (buf1)) 2549 if (NILP (buf1))
2550 nsberror (buffer1); 2550 nsberror (buffer1);
2551 bp1 = XBUFFER (buf1); 2551 bp1 = XBUFFER (buf1);
2552 if (NILP (bp1->name)) 2552 if (NILP (B_ (bp1, name)))
2553 error ("Selecting deleted buffer"); 2553 error ("Selecting deleted buffer");
2554 } 2554 }
2555 2555
@@ -2587,7 +2587,7 @@ determines whether case is significant or ignored. */)
2587 if (NILP (buf2)) 2587 if (NILP (buf2))
2588 nsberror (buffer2); 2588 nsberror (buffer2);
2589 bp2 = XBUFFER (buf2); 2589 bp2 = XBUFFER (buf2);
2590 if (NILP (bp2->name)) 2590 if (NILP (B_ (bp2, name)))
2591 error ("Selecting deleted buffer"); 2591 error ("Selecting deleted buffer");
2592 } 2592 }
2593 2593
@@ -2627,7 +2627,7 @@ determines whether case is significant or ignored. */)
2627 2627
2628 QUIT; 2628 QUIT;
2629 2629
2630 if (! NILP (bp1->enable_multibyte_characters)) 2630 if (! NILP (B_ (bp1, enable_multibyte_characters)))
2631 { 2631 {
2632 c1 = BUF_FETCH_MULTIBYTE_CHAR (bp1, i1_byte); 2632 c1 = BUF_FETCH_MULTIBYTE_CHAR (bp1, i1_byte);
2633 BUF_INC_POS (bp1, i1_byte); 2633 BUF_INC_POS (bp1, i1_byte);
@@ -2640,7 +2640,7 @@ determines whether case is significant or ignored. */)
2640 i1++; 2640 i1++;
2641 } 2641 }
2642 2642
2643 if (! NILP (bp2->enable_multibyte_characters)) 2643 if (! NILP (B_ (bp2, enable_multibyte_characters)))
2644 { 2644 {
2645 c2 = BUF_FETCH_MULTIBYTE_CHAR (bp2, i2_byte); 2645 c2 = BUF_FETCH_MULTIBYTE_CHAR (bp2, i2_byte);
2646 BUF_INC_POS (bp2, i2_byte); 2646 BUF_INC_POS (bp2, i2_byte);
@@ -2680,13 +2680,13 @@ determines whether case is significant or ignored. */)
2680static Lisp_Object 2680static Lisp_Object
2681subst_char_in_region_unwind (Lisp_Object arg) 2681subst_char_in_region_unwind (Lisp_Object arg)
2682{ 2682{
2683 return current_buffer->undo_list = arg; 2683 return B_ (current_buffer, undo_list) = arg;
2684} 2684}
2685 2685
2686static Lisp_Object 2686static Lisp_Object
2687subst_char_in_region_unwind_1 (Lisp_Object arg) 2687subst_char_in_region_unwind_1 (Lisp_Object arg)
2688{ 2688{
2689 return current_buffer->filename = arg; 2689 return B_ (current_buffer, filename) = arg;
2690} 2690}
2691 2691
2692DEFUN ("subst-char-in-region", Fsubst_char_in_region, 2692DEFUN ("subst-char-in-region", Fsubst_char_in_region,
@@ -2712,7 +2712,7 @@ Both characters must have the same length of multi-byte form. */)
2712#define COMBINING_BOTH (COMBINING_BEFORE | COMBINING_AFTER) 2712#define COMBINING_BOTH (COMBINING_BEFORE | COMBINING_AFTER)
2713 int maybe_byte_combining = COMBINING_NO; 2713 int maybe_byte_combining = COMBINING_NO;
2714 EMACS_INT last_changed = 0; 2714 EMACS_INT last_changed = 0;
2715 int multibyte_p = !NILP (current_buffer->enable_multibyte_characters); 2715 int multibyte_p = !NILP (B_ (current_buffer, enable_multibyte_characters));
2716 2716
2717 restart: 2717 restart:
2718 2718
@@ -2756,12 +2756,12 @@ Both characters must have the same length of multi-byte form. */)
2756 if (!changed && !NILP (noundo)) 2756 if (!changed && !NILP (noundo))
2757 { 2757 {
2758 record_unwind_protect (subst_char_in_region_unwind, 2758 record_unwind_protect (subst_char_in_region_unwind,
2759 current_buffer->undo_list); 2759 B_ (current_buffer, undo_list));
2760 current_buffer->undo_list = Qt; 2760 B_ (current_buffer, undo_list) = Qt;
2761 /* Don't do file-locking. */ 2761 /* Don't do file-locking. */
2762 record_unwind_protect (subst_char_in_region_unwind_1, 2762 record_unwind_protect (subst_char_in_region_unwind_1,
2763 current_buffer->filename); 2763 B_ (current_buffer, filename));
2764 current_buffer->filename = Qnil; 2764 B_ (current_buffer, filename) = Qnil;
2765 } 2765 }
2766 2766
2767 if (pos_byte < GPT_BYTE) 2767 if (pos_byte < GPT_BYTE)
@@ -2824,7 +2824,7 @@ Both characters must have the same length of multi-byte form. */)
2824 2824
2825 struct gcpro gcpro1; 2825 struct gcpro gcpro1;
2826 2826
2827 tem = current_buffer->undo_list; 2827 tem = B_ (current_buffer, undo_list);
2828 GCPRO1 (tem); 2828 GCPRO1 (tem);
2829 2829
2830 /* Make a multibyte string containing this single character. */ 2830 /* Make a multibyte string containing this single character. */
@@ -2843,7 +2843,7 @@ Both characters must have the same length of multi-byte form. */)
2843 INC_POS (pos_byte_next); 2843 INC_POS (pos_byte_next);
2844 2844
2845 if (! NILP (noundo)) 2845 if (! NILP (noundo))
2846 current_buffer->undo_list = tem; 2846 B_ (current_buffer, undo_list) = tem;
2847 2847
2848 UNGCPRO; 2848 UNGCPRO;
2849 } 2849 }
@@ -2945,7 +2945,7 @@ It returns the number of characters changed. */)
2945 int cnt; /* Number of changes made. */ 2945 int cnt; /* Number of changes made. */
2946 EMACS_INT size; /* Size of translate table. */ 2946 EMACS_INT size; /* Size of translate table. */
2947 EMACS_INT pos, pos_byte, end_pos; 2947 EMACS_INT pos, pos_byte, end_pos;
2948 int multibyte = !NILP (current_buffer->enable_multibyte_characters); 2948 int multibyte = !NILP (B_ (current_buffer, enable_multibyte_characters));
2949 int string_multibyte; 2949 int string_multibyte;
2950 Lisp_Object val; 2950 Lisp_Object val;
2951 2951
@@ -3206,7 +3206,7 @@ save_restriction_restore (Lisp_Object data)
3206 ? XMARKER (XCAR (data))->buffer 3206 ? XMARKER (XCAR (data))->buffer
3207 : XBUFFER (data)); 3207 : XBUFFER (data));
3208 3208
3209 if (buf && buf != current_buffer && !NILP (buf->pt_marker)) 3209 if (buf && buf != current_buffer && !NILP (B_ (buf, pt_marker)))
3210 { /* If `buf' uses markers to keep track of PT, BEGV, and ZV (as 3210 { /* If `buf' uses markers to keep track of PT, BEGV, and ZV (as
3211 is the case if it is or has an indirect buffer), then make 3211 is the case if it is or has an indirect buffer), then make
3212 sure it is current before we update BEGV, so 3212 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. */)
4136 4136
4137 if (XINT (c1) == XINT (c2)) 4137 if (XINT (c1) == XINT (c2))
4138 return Qt; 4138 return Qt;
4139 if (NILP (current_buffer->case_fold_search)) 4139 if (NILP (B_ (current_buffer, case_fold_search)))
4140 return Qnil; 4140 return Qnil;
4141 4141
4142 /* Do these in separate statements, 4142 /* Do these in separate statements,
4143 then compare the variables. 4143 then compare the variables.
4144 because of the way DOWNCASE uses temp variables. */ 4144 because of the way DOWNCASE uses temp variables. */
4145 i1 = XFASTINT (c1); 4145 i1 = XFASTINT (c1);
4146 if (NILP (current_buffer->enable_multibyte_characters) 4146 if (NILP (B_ (current_buffer, enable_multibyte_characters))
4147 && ! ASCII_CHAR_P (i1)) 4147 && ! ASCII_CHAR_P (i1))
4148 { 4148 {
4149 MAKE_CHAR_MULTIBYTE (i1); 4149 MAKE_CHAR_MULTIBYTE (i1);
4150 } 4150 }
4151 i2 = XFASTINT (c2); 4151 i2 = XFASTINT (c2);
4152 if (NILP (current_buffer->enable_multibyte_characters) 4152 if (NILP (B_ (current_buffer, enable_multibyte_characters))
4153 && ! ASCII_CHAR_P (i2)) 4153 && ! ASCII_CHAR_P (i2))
4154 { 4154 {
4155 MAKE_CHAR_MULTIBYTE (i2); 4155 MAKE_CHAR_MULTIBYTE (i2);
diff --git a/src/fileio.c b/src/fileio.c
index 429fce9f5a0..4a4935b43a2 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -770,7 +770,7 @@ filesystem tree, not (expand-file-name ".." dirname). */)
770 770
771 /* Use the buffer's default-directory if DEFAULT_DIRECTORY is omitted. */ 771 /* Use the buffer's default-directory if DEFAULT_DIRECTORY is omitted. */
772 if (NILP (default_directory)) 772 if (NILP (default_directory))
773 default_directory = current_buffer->directory; 773 default_directory = B_ (current_buffer, directory);
774 if (! STRINGP (default_directory)) 774 if (! STRINGP (default_directory))
775 { 775 {
776#ifdef DOS_NT 776#ifdef DOS_NT
@@ -2669,7 +2669,7 @@ See `file-symlink-p' to distinguish symlinks. */)
2669 struct stat st; 2669 struct stat st;
2670 Lisp_Object handler; 2670 Lisp_Object handler;
2671 2671
2672 absname = expand_and_dir_to_file (filename, current_buffer->directory); 2672 absname = expand_and_dir_to_file (filename, B_ (current_buffer, directory));
2673 2673
2674 /* If the file name has special constructs in it, 2674 /* If the file name has special constructs in it,
2675 call the corresponding file handler. */ 2675 call the corresponding file handler. */
@@ -2722,7 +2722,7 @@ See `file-symlink-p' to distinguish symlinks. */)
2722 struct stat st; 2722 struct stat st;
2723 Lisp_Object handler; 2723 Lisp_Object handler;
2724 2724
2725 absname = expand_and_dir_to_file (filename, current_buffer->directory); 2725 absname = expand_and_dir_to_file (filename, B_ (current_buffer, directory));
2726 2726
2727 /* If the file name has special constructs in it, 2727 /* If the file name has special constructs in it,
2728 call the corresponding file handler. */ 2728 call the corresponding file handler. */
@@ -2769,7 +2769,7 @@ if file does not exist, is not accessible, or SELinux is disabled */)
2769 context_t context; 2769 context_t context;
2770#endif 2770#endif
2771 2771
2772 absname = expand_and_dir_to_file (filename, current_buffer->directory); 2772 absname = expand_and_dir_to_file (filename, B_ (current_buffer, directory));
2773 2773
2774 /* If the file name has special constructs in it, 2774 /* If the file name has special constructs in it,
2775 call the corresponding file handler. */ 2775 call the corresponding file handler. */
@@ -2827,7 +2827,7 @@ is disabled. */)
2827 context_t parsed_con; 2827 context_t parsed_con;
2828#endif 2828#endif
2829 2829
2830 absname = Fexpand_file_name (filename, current_buffer->directory); 2830 absname = Fexpand_file_name (filename, B_ (current_buffer, directory));
2831 2831
2832 /* If the file name has special constructs in it, 2832 /* If the file name has special constructs in it,
2833 call the corresponding file handler. */ 2833 call the corresponding file handler. */
@@ -2894,7 +2894,7 @@ Return nil, if file does not exist or is not accessible. */)
2894 struct stat st; 2894 struct stat st;
2895 Lisp_Object handler; 2895 Lisp_Object handler;
2896 2896
2897 absname = expand_and_dir_to_file (filename, current_buffer->directory); 2897 absname = expand_and_dir_to_file (filename, B_ (current_buffer, directory));
2898 2898
2899 /* If the file name has special constructs in it, 2899 /* If the file name has special constructs in it,
2900 call the corresponding file handler. */ 2900 call the corresponding file handler. */
@@ -2923,7 +2923,7 @@ symbolic notation, like the `chmod' command from GNU Coreutils. */)
2923 Lisp_Object absname, encoded_absname; 2923 Lisp_Object absname, encoded_absname;
2924 Lisp_Object handler; 2924 Lisp_Object handler;
2925 2925
2926 absname = Fexpand_file_name (filename, current_buffer->directory); 2926 absname = Fexpand_file_name (filename, B_ (current_buffer, directory));
2927 CHECK_NUMBER (mode); 2927 CHECK_NUMBER (mode);
2928 2928
2929 /* If the file name has special constructs in it, 2929 /* 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
2985 if (! lisp_time_argument (time, &sec, &usec)) 2985 if (! lisp_time_argument (time, &sec, &usec))
2986 error ("Invalid time specification"); 2986 error ("Invalid time specification");
2987 2987
2988 absname = Fexpand_file_name (filename, current_buffer->directory); 2988 absname = Fexpand_file_name (filename, B_ (current_buffer, directory));
2989 2989
2990 /* If the file name has special constructs in it, 2990 /* If the file name has special constructs in it,
2991 call the corresponding file handler. */ 2991 call the corresponding file handler. */
@@ -3047,8 +3047,8 @@ otherwise, if FILE2 does not exist, the answer is t. */)
3047 3047
3048 absname1 = Qnil; 3048 absname1 = Qnil;
3049 GCPRO2 (absname1, file2); 3049 GCPRO2 (absname1, file2);
3050 absname1 = expand_and_dir_to_file (file1, current_buffer->directory); 3050 absname1 = expand_and_dir_to_file (file1, B_ (current_buffer, directory));
3051 absname2 = expand_and_dir_to_file (file2, current_buffer->directory); 3051 absname2 = expand_and_dir_to_file (file2, B_ (current_buffer, directory));
3052 UNGCPRO; 3052 UNGCPRO;
3053 3053
3054 /* If the file name has special constructs in it, 3054 /* If the file name has special constructs in it,
@@ -3116,8 +3116,8 @@ decide_coding_unwind (Lisp_Object unwind_data)
3116 TEMP_SET_PT_BOTH (BEG, BEG_BYTE); 3116 TEMP_SET_PT_BOTH (BEG, BEG_BYTE);
3117 3117
3118 /* Now we are safe to change the buffer's multibyteness directly. */ 3118 /* Now we are safe to change the buffer's multibyteness directly. */
3119 current_buffer->enable_multibyte_characters = multibyte; 3119 B_ (current_buffer, enable_multibyte_characters) = multibyte;
3120 current_buffer->undo_list = undo_list; 3120 B_ (current_buffer, undo_list) = undo_list;
3121 3121
3122 return Qnil; 3122 return Qnil;
3123} 3123}
@@ -3212,7 +3212,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3212 if (current_buffer->base_buffer && ! NILP (visit)) 3212 if (current_buffer->base_buffer && ! NILP (visit))
3213 error ("Cannot do file visiting in an indirect buffer"); 3213 error ("Cannot do file visiting in an indirect buffer");
3214 3214
3215 if (!NILP (current_buffer->read_only)) 3215 if (!NILP (B_ (current_buffer, read_only)))
3216 Fbarf_if_buffer_read_only (); 3216 Fbarf_if_buffer_read_only ();
3217 3217
3218 val = Qnil; 3218 val = Qnil;
@@ -3403,16 +3403,16 @@ variable `last-coding-system-used' to the coding system actually used. */)
3403 buf = XBUFFER (buffer); 3403 buf = XBUFFER (buffer);
3404 3404
3405 delete_all_overlays (buf); 3405 delete_all_overlays (buf);
3406 buf->directory = current_buffer->directory; 3406 B_ (buf, directory) = B_ (current_buffer, directory);
3407 buf->read_only = Qnil; 3407 B_ (buf, read_only) = Qnil;
3408 buf->filename = Qnil; 3408 B_ (buf, filename) = Qnil;
3409 buf->undo_list = Qt; 3409 B_ (buf, undo_list) = Qt;
3410 eassert (buf->overlays_before == NULL); 3410 eassert (buf->overlays_before == NULL);
3411 eassert (buf->overlays_after == NULL); 3411 eassert (buf->overlays_after == NULL);
3412 3412
3413 set_buffer_internal (buf); 3413 set_buffer_internal (buf);
3414 Ferase_buffer (); 3414 Ferase_buffer ();
3415 buf->enable_multibyte_characters = Qnil; 3415 B_ (buf, enable_multibyte_characters) = Qnil;
3416 3416
3417 insert_1_both ((char *) read_buf, nread, nread, 0, 0, 0); 3417 insert_1_both ((char *) read_buf, nread, nread, 0, 0, 0);
3418 TEMP_SET_PT_BOTH (BEG, BEG_BYTE); 3418 TEMP_SET_PT_BOTH (BEG, BEG_BYTE);
@@ -3450,7 +3450,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3450 else 3450 else
3451 CHECK_CODING_SYSTEM (coding_system); 3451 CHECK_CODING_SYSTEM (coding_system);
3452 3452
3453 if (NILP (current_buffer->enable_multibyte_characters)) 3453 if (NILP (B_ (current_buffer, enable_multibyte_characters)))
3454 /* We must suppress all character code conversion except for 3454 /* We must suppress all character code conversion except for
3455 end-of-line conversion. */ 3455 end-of-line conversion. */
3456 coding_system = raw_text_coding_system (coding_system); 3456 coding_system = raw_text_coding_system (coding_system);
@@ -3598,7 +3598,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3598 we cannot use this method; giveup and try the other. */ 3598 we cannot use this method; giveup and try the other. */
3599 if (same_at_end > same_at_start 3599 if (same_at_end > same_at_start
3600 && FETCH_BYTE (same_at_end - 1) >= 0200 3600 && FETCH_BYTE (same_at_end - 1) >= 0200
3601 && ! NILP (current_buffer->enable_multibyte_characters) 3601 && ! NILP (B_ (current_buffer, enable_multibyte_characters))
3602 && (CODING_MAY_REQUIRE_DECODING (&coding))) 3602 && (CODING_MAY_REQUIRE_DECODING (&coding)))
3603 giveup_match_end = 1; 3603 giveup_match_end = 1;
3604 break; 3604 break;
@@ -3617,14 +3617,14 @@ variable `last-coding-system-used' to the coding system actually used. */)
3617 3617
3618 /* Extend the start of non-matching text area to multibyte 3618 /* Extend the start of non-matching text area to multibyte
3619 character boundary. */ 3619 character boundary. */
3620 if (! NILP (current_buffer->enable_multibyte_characters)) 3620 if (! NILP (B_ (current_buffer, enable_multibyte_characters)))
3621 while (same_at_start > BEGV_BYTE 3621 while (same_at_start > BEGV_BYTE
3622 && ! CHAR_HEAD_P (FETCH_BYTE (same_at_start))) 3622 && ! CHAR_HEAD_P (FETCH_BYTE (same_at_start)))
3623 same_at_start--; 3623 same_at_start--;
3624 3624
3625 /* Extend the end of non-matching text area to multibyte 3625 /* Extend the end of non-matching text area to multibyte
3626 character boundary. */ 3626 character boundary. */
3627 if (! NILP (current_buffer->enable_multibyte_characters)) 3627 if (! NILP (B_ (current_buffer, enable_multibyte_characters)))
3628 while (same_at_end < ZV_BYTE 3628 while (same_at_end < ZV_BYTE
3629 && ! CHAR_HEAD_P (FETCH_BYTE (same_at_end))) 3629 && ! CHAR_HEAD_P (FETCH_BYTE (same_at_end)))
3630 same_at_end++; 3630 same_at_end++;
@@ -3673,7 +3673,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3673 unsigned char *decoded; 3673 unsigned char *decoded;
3674 EMACS_INT temp; 3674 EMACS_INT temp;
3675 int this_count = SPECPDL_INDEX (); 3675 int this_count = SPECPDL_INDEX ();
3676 int multibyte = ! NILP (current_buffer->enable_multibyte_characters); 3676 int multibyte = ! NILP (B_ (current_buffer, enable_multibyte_characters));
3677 Lisp_Object conversion_buffer; 3677 Lisp_Object conversion_buffer;
3678 3678
3679 conversion_buffer = code_conversion_save (1, multibyte); 3679 conversion_buffer = code_conversion_save (1, multibyte);
@@ -3778,7 +3778,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3778 3778
3779 /* Extend the start of non-matching text area to the previous 3779 /* Extend the start of non-matching text area to the previous
3780 multibyte character boundary. */ 3780 multibyte character boundary. */
3781 if (! NILP (current_buffer->enable_multibyte_characters)) 3781 if (! NILP (B_ (current_buffer, enable_multibyte_characters)))
3782 while (same_at_start > BEGV_BYTE 3782 while (same_at_start > BEGV_BYTE
3783 && ! CHAR_HEAD_P (FETCH_BYTE (same_at_start))) 3783 && ! CHAR_HEAD_P (FETCH_BYTE (same_at_start)))
3784 same_at_start--; 3784 same_at_start--;
@@ -3795,7 +3795,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3795 3795
3796 /* Extend the end of non-matching text area to the next 3796 /* Extend the end of non-matching text area to the next
3797 multibyte character boundary. */ 3797 multibyte character boundary. */
3798 if (! NILP (current_buffer->enable_multibyte_characters)) 3798 if (! NILP (B_ (current_buffer, enable_multibyte_characters)))
3799 while (same_at_end < ZV_BYTE 3799 while (same_at_end < ZV_BYTE
3800 && ! CHAR_HEAD_P (FETCH_BYTE (same_at_end))) 3800 && ! CHAR_HEAD_P (FETCH_BYTE (same_at_end)))
3801 same_at_end++; 3801 same_at_end++;
@@ -3870,9 +3870,9 @@ variable `last-coding-system-used' to the coding system actually used. */)
3870 if (NILP (visit) && inserted > 0) 3870 if (NILP (visit) && inserted > 0)
3871 { 3871 {
3872#ifdef CLASH_DETECTION 3872#ifdef CLASH_DETECTION
3873 if (!NILP (current_buffer->file_truename) 3873 if (!NILP (B_ (current_buffer, file_truename))
3874 /* Make binding buffer-file-name to nil effective. */ 3874 /* Make binding buffer-file-name to nil effective. */
3875 && !NILP (current_buffer->filename) 3875 && !NILP (B_ (current_buffer, filename))
3876 && SAVE_MODIFF >= MODIFF) 3876 && SAVE_MODIFF >= MODIFF)
3877 we_locked_file = 1; 3877 we_locked_file = 1;
3878#endif /* CLASH_DETECTION */ 3878#endif /* CLASH_DETECTION */
@@ -3977,7 +3977,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3977 { 3977 {
3978#ifdef CLASH_DETECTION 3978#ifdef CLASH_DETECTION
3979 if (we_locked_file) 3979 if (we_locked_file)
3980 unlock_file (current_buffer->file_truename); 3980 unlock_file (B_ (current_buffer, file_truename));
3981#endif 3981#endif
3982 Vdeactivate_mark = old_Vdeactivate_mark; 3982 Vdeactivate_mark = old_Vdeactivate_mark;
3983 } 3983 }
@@ -4028,11 +4028,11 @@ variable `last-coding-system-used' to the coding system actually used. */)
4028 Lisp_Object unwind_data; 4028 Lisp_Object unwind_data;
4029 int count = SPECPDL_INDEX (); 4029 int count = SPECPDL_INDEX ();
4030 4030
4031 unwind_data = Fcons (current_buffer->enable_multibyte_characters, 4031 unwind_data = Fcons (B_ (current_buffer, enable_multibyte_characters),
4032 Fcons (current_buffer->undo_list, 4032 Fcons (B_ (current_buffer, undo_list),
4033 Fcurrent_buffer ())); 4033 Fcurrent_buffer ()));
4034 current_buffer->enable_multibyte_characters = Qnil; 4034 B_ (current_buffer, enable_multibyte_characters) = Qnil;
4035 current_buffer->undo_list = Qt; 4035 B_ (current_buffer, undo_list) = Qt;
4036 record_unwind_protect (decide_coding_unwind, unwind_data); 4036 record_unwind_protect (decide_coding_unwind, unwind_data);
4037 4037
4038 if (inserted > 0 && ! NILP (Vset_auto_coding_function)) 4038 if (inserted > 0 && ! NILP (Vset_auto_coding_function))
@@ -4062,7 +4062,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
4062 else 4062 else
4063 CHECK_CODING_SYSTEM (coding_system); 4063 CHECK_CODING_SYSTEM (coding_system);
4064 4064
4065 if (NILP (current_buffer->enable_multibyte_characters)) 4065 if (NILP (B_ (current_buffer, enable_multibyte_characters)))
4066 /* We must suppress all character code conversion except for 4066 /* We must suppress all character code conversion except for
4067 end-of-line conversion. */ 4067 end-of-line conversion. */
4068 coding_system = raw_text_coding_system (coding_system); 4068 coding_system = raw_text_coding_system (coding_system);
@@ -4080,10 +4080,10 @@ variable `last-coding-system-used' to the coding system actually used. */)
4080 && NILP (replace)) 4080 && NILP (replace))
4081 /* Visiting a file with these coding system makes the buffer 4081 /* Visiting a file with these coding system makes the buffer
4082 unibyte. */ 4082 unibyte. */
4083 current_buffer->enable_multibyte_characters = Qnil; 4083 B_ (current_buffer, enable_multibyte_characters) = Qnil;
4084 } 4084 }
4085 4085
4086 coding.dst_multibyte = ! NILP (current_buffer->enable_multibyte_characters); 4086 coding.dst_multibyte = ! NILP (B_ (current_buffer, enable_multibyte_characters));
4087 if (CODING_MAY_REQUIRE_DECODING (&coding) 4087 if (CODING_MAY_REQUIRE_DECODING (&coding)
4088 && (inserted > 0 || CODING_REQUIRE_FLUSHING (&coding))) 4088 && (inserted > 0 || CODING_REQUIRE_FLUSHING (&coding)))
4089 { 4089 {
@@ -4110,9 +4110,9 @@ variable `last-coding-system-used' to the coding system actually used. */)
4110 if ((VECTORP (CODING_ID_EOL_TYPE (coding.id)) 4110 if ((VECTORP (CODING_ID_EOL_TYPE (coding.id))
4111 || EQ (CODING_ID_EOL_TYPE (coding.id), Qunix)) 4111 || EQ (CODING_ID_EOL_TYPE (coding.id), Qunix))
4112 && ! CODING_REQUIRE_DECODING (&coding)) 4112 && ! CODING_REQUIRE_DECODING (&coding))
4113 current_buffer->buffer_file_type = Qt; 4113 B_ (current_buffer, buffer_file_type) = Qt;
4114 else 4114 else
4115 current_buffer->buffer_file_type = Qnil; 4115 B_ (current_buffer, buffer_file_type) = Qnil;
4116#endif 4116#endif
4117 4117
4118 handled: 4118 handled:
@@ -4124,24 +4124,24 @@ variable `last-coding-system-used' to the coding system actually used. */)
4124 4124
4125 if (!NILP (visit)) 4125 if (!NILP (visit))
4126 { 4126 {
4127 if (!EQ (current_buffer->undo_list, Qt) && !nochange) 4127 if (!EQ (B_ (current_buffer, undo_list), Qt) && !nochange)
4128 current_buffer->undo_list = Qnil; 4128 B_ (current_buffer, undo_list) = Qnil;
4129 4129
4130 if (NILP (handler)) 4130 if (NILP (handler))
4131 { 4131 {
4132 current_buffer->modtime = st.st_mtime; 4132 current_buffer->modtime = st.st_mtime;
4133 current_buffer->modtime_size = st.st_size; 4133 current_buffer->modtime_size = st.st_size;
4134 current_buffer->filename = orig_filename; 4134 B_ (current_buffer, filename) = orig_filename;
4135 } 4135 }
4136 4136
4137 SAVE_MODIFF = MODIFF; 4137 SAVE_MODIFF = MODIFF;
4138 BUF_AUTOSAVE_MODIFF (current_buffer) = MODIFF; 4138 BUF_AUTOSAVE_MODIFF (current_buffer) = MODIFF;
4139 XSETFASTINT (current_buffer->save_length, Z - BEG); 4139 XSETFASTINT (B_ (current_buffer, save_length), Z - BEG);
4140#ifdef CLASH_DETECTION 4140#ifdef CLASH_DETECTION
4141 if (NILP (handler)) 4141 if (NILP (handler))
4142 { 4142 {
4143 if (!NILP (current_buffer->file_truename)) 4143 if (!NILP (B_ (current_buffer, file_truename)))
4144 unlock_file (current_buffer->file_truename); 4144 unlock_file (B_ (current_buffer, file_truename));
4145 unlock_file (filename); 4145 unlock_file (filename);
4146 } 4146 }
4147#endif /* CLASH_DETECTION */ 4147#endif /* CLASH_DETECTION */
@@ -4174,8 +4174,8 @@ variable `last-coding-system-used' to the coding system actually used. */)
4174 specbind (Qinhibit_modification_hooks, Qt); 4174 specbind (Qinhibit_modification_hooks, Qt);
4175 4175
4176 /* Save old undo list and don't record undo for decoding. */ 4176 /* Save old undo list and don't record undo for decoding. */
4177 old_undo = current_buffer->undo_list; 4177 old_undo = B_ (current_buffer, undo_list);
4178 current_buffer->undo_list = Qt; 4178 B_ (current_buffer, undo_list) = Qt;
4179 4179
4180 if (NILP (replace)) 4180 if (NILP (replace))
4181 { 4181 {
@@ -4263,7 +4263,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
4263 4263
4264 if (NILP (visit)) 4264 if (NILP (visit))
4265 { 4265 {
4266 current_buffer->undo_list = old_undo; 4266 B_ (current_buffer, undo_list) = old_undo;
4267 if (CONSP (old_undo) && inserted != old_inserted) 4267 if (CONSP (old_undo) && inserted != old_inserted)
4268 { 4268 {
4269 /* Adjust the last undo record for the size change during 4269 /* 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. */)
4278 else 4278 else
4279 /* If undo_list was Qt before, keep it that way. 4279 /* If undo_list was Qt before, keep it that way.
4280 Otherwise start with an empty undo_list. */ 4280 Otherwise start with an empty undo_list. */
4281 current_buffer->undo_list = EQ (old_undo, Qt) ? Qt : Qnil; 4281 B_ (current_buffer, undo_list) = EQ (old_undo, Qt) ? Qt : Qnil;
4282 4282
4283 unbind_to (count, Qnil); 4283 unbind_to (count, Qnil);
4284 } 4284 }
@@ -4332,8 +4332,8 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file
4332 Lisp_Object eol_parent = Qnil; 4332 Lisp_Object eol_parent = Qnil;
4333 4333
4334 if (auto_saving 4334 if (auto_saving
4335 && NILP (Fstring_equal (current_buffer->filename, 4335 && NILP (Fstring_equal (B_ (current_buffer, filename),
4336 current_buffer->auto_save_file_name))) 4336 B_ (current_buffer, auto_save_file_name))))
4337 { 4337 {
4338 val = Qutf_8_emacs; 4338 val = Qutf_8_emacs;
4339 eol_parent = Qunix; 4339 eol_parent = Qunix;
@@ -4362,12 +4362,12 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file
4362 int using_default_coding = 0; 4362 int using_default_coding = 0;
4363 int force_raw_text = 0; 4363 int force_raw_text = 0;
4364 4364
4365 val = current_buffer->buffer_file_coding_system; 4365 val = B_ (current_buffer, buffer_file_coding_system);
4366 if (NILP (val) 4366 if (NILP (val)
4367 || NILP (Flocal_variable_p (Qbuffer_file_coding_system, Qnil))) 4367 || NILP (Flocal_variable_p (Qbuffer_file_coding_system, Qnil)))
4368 { 4368 {
4369 val = Qnil; 4369 val = Qnil;
4370 if (NILP (current_buffer->enable_multibyte_characters)) 4370 if (NILP (B_ (current_buffer, enable_multibyte_characters)))
4371 force_raw_text = 1; 4371 force_raw_text = 1;
4372 } 4372 }
4373 4373
@@ -4388,7 +4388,7 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file
4388 { 4388 {
4389 /* If we still have not decided a coding system, use the 4389 /* If we still have not decided a coding system, use the
4390 default value of buffer-file-coding-system. */ 4390 default value of buffer-file-coding-system. */
4391 val = current_buffer->buffer_file_coding_system; 4391 val = B_ (current_buffer, buffer_file_coding_system);
4392 using_default_coding = 1; 4392 using_default_coding = 1;
4393 } 4393 }
4394 4394
@@ -4412,9 +4412,9 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file
4412 format, we use that of 4412 format, we use that of
4413 `default-buffer-file-coding-system'. */ 4413 `default-buffer-file-coding-system'. */
4414 if (! using_default_coding 4414 if (! using_default_coding
4415 && ! NILP (buffer_defaults.buffer_file_coding_system)) 4415 && ! NILP (B_ (&buffer_defaults, buffer_file_coding_system)))
4416 val = (coding_inherit_eol_type 4416 val = (coding_inherit_eol_type
4417 (val, buffer_defaults.buffer_file_coding_system)); 4417 (val, B_ (&buffer_defaults, buffer_file_coding_system)));
4418 4418
4419 /* If we decide not to encode text, use `raw-text' or one of its 4419 /* If we decide not to encode text, use `raw-text' or one of its
4420 subsidiaries. */ 4420 subsidiaries. */
@@ -4425,7 +4425,7 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file
4425 val = coding_inherit_eol_type (val, eol_parent); 4425 val = coding_inherit_eol_type (val, eol_parent);
4426 setup_coding_system (val, coding); 4426 setup_coding_system (val, coding);
4427 4427
4428 if (!STRINGP (start) && !NILP (current_buffer->selective_display)) 4428 if (!STRINGP (start) && !NILP (B_ (current_buffer, selective_display)))
4429 coding->mode |= CODING_MODE_SELECTIVE_DISPLAY; 4429 coding->mode |= CODING_MODE_SELECTIVE_DISPLAY;
4430 return val; 4430 return val;
4431} 4431}
@@ -4529,8 +4529,8 @@ This calls `write-region-annotate-functions' at the start, and
4529 if (visiting) 4529 if (visiting)
4530 { 4530 {
4531 SAVE_MODIFF = MODIFF; 4531 SAVE_MODIFF = MODIFF;
4532 XSETFASTINT (current_buffer->save_length, Z - BEG); 4532 XSETFASTINT (B_ (current_buffer, save_length), Z - BEG);
4533 current_buffer->filename = visit_file; 4533 B_ (current_buffer, filename) = visit_file;
4534 } 4534 }
4535 UNGCPRO; 4535 UNGCPRO;
4536 return val; 4536 return val;
@@ -4743,15 +4743,15 @@ This calls `write-region-annotate-functions' at the start, and
4743 if (visiting) 4743 if (visiting)
4744 { 4744 {
4745 SAVE_MODIFF = MODIFF; 4745 SAVE_MODIFF = MODIFF;
4746 XSETFASTINT (current_buffer->save_length, Z - BEG); 4746 XSETFASTINT (B_ (current_buffer, save_length), Z - BEG);
4747 current_buffer->filename = visit_file; 4747 B_ (current_buffer, filename) = visit_file;
4748 update_mode_lines++; 4748 update_mode_lines++;
4749 } 4749 }
4750 else if (quietly) 4750 else if (quietly)
4751 { 4751 {
4752 if (auto_saving 4752 if (auto_saving
4753 && ! NILP (Fstring_equal (current_buffer->filename, 4753 && ! NILP (Fstring_equal (B_ (current_buffer, filename),
4754 current_buffer->auto_save_file_name))) 4754 B_ (current_buffer, auto_save_file_name))))
4755 SAVE_MODIFF = MODIFF; 4755 SAVE_MODIFF = MODIFF;
4756 4756
4757 return Qnil; 4757 return Qnil;
@@ -4833,10 +4833,10 @@ build_annotations (Lisp_Object start, Lisp_Object end)
4833 } 4833 }
4834 4834
4835 /* Now do the same for annotation functions implied by the file-format */ 4835 /* Now do the same for annotation functions implied by the file-format */
4836 if (auto_saving && (!EQ (current_buffer->auto_save_file_format, Qt))) 4836 if (auto_saving && (!EQ (B_ (current_buffer, auto_save_file_format), Qt)))
4837 p = current_buffer->auto_save_file_format; 4837 p = B_ (current_buffer, auto_save_file_format);
4838 else 4838 else
4839 p = current_buffer->file_format; 4839 p = B_ (current_buffer, file_format);
4840 for (i = 0; CONSP (p); p = XCDR (p), ++i) 4840 for (i = 0; CONSP (p); p = XCDR (p), ++i)
4841 { 4841 {
4842 struct buffer *given_buffer = current_buffer; 4842 struct buffer *given_buffer = current_buffer;
@@ -5015,17 +5015,17 @@ See Info node `(elisp)Modification Time' for more details. */)
5015 b = XBUFFER (buf); 5015 b = XBUFFER (buf);
5016 } 5016 }
5017 5017
5018 if (!STRINGP (b->filename)) return Qt; 5018 if (!STRINGP (B_ (b, filename))) return Qt;
5019 if (b->modtime == 0) return Qt; 5019 if (b->modtime == 0) return Qt;
5020 5020
5021 /* If the file name has special constructs in it, 5021 /* If the file name has special constructs in it,
5022 call the corresponding file handler. */ 5022 call the corresponding file handler. */
5023 handler = Ffind_file_name_handler (b->filename, 5023 handler = Ffind_file_name_handler (B_ (b, filename),
5024 Qverify_visited_file_modtime); 5024 Qverify_visited_file_modtime);
5025 if (!NILP (handler)) 5025 if (!NILP (handler))
5026 return call2 (handler, Qverify_visited_file_modtime, buf); 5026 return call2 (handler, Qverify_visited_file_modtime, buf);
5027 5027
5028 filename = ENCODE_FILE (b->filename); 5028 filename = ENCODE_FILE (B_ (b, filename));
5029 5029
5030 if (stat (SSDATA (filename), &st) < 0) 5030 if (stat (SSDATA (filename), &st) < 0)
5031 { 5031 {
@@ -5093,7 +5093,7 @@ An argument specifies the modification time value to use
5093 struct stat st; 5093 struct stat st;
5094 Lisp_Object handler; 5094 Lisp_Object handler;
5095 5095
5096 filename = Fexpand_file_name (current_buffer->filename, Qnil); 5096 filename = Fexpand_file_name (B_ (current_buffer, filename), Qnil);
5097 5097
5098 /* If the file name has special constructs in it, 5098 /* If the file name has special constructs in it,
5099 call the corresponding file handler. */ 5099 call the corresponding file handler. */
@@ -5128,7 +5128,7 @@ auto_save_error (Lisp_Object error)
5128 ring_bell (XFRAME (selected_frame)); 5128 ring_bell (XFRAME (selected_frame));
5129 5129
5130 args[0] = build_string ("Auto-saving %s: %s"); 5130 args[0] = build_string ("Auto-saving %s: %s");
5131 args[1] = current_buffer->name; 5131 args[1] = B_ (current_buffer, name);
5132 args[2] = Ferror_message_string (error); 5132 args[2] = Ferror_message_string (error);
5133 msg = Fformat (3, args); 5133 msg = Fformat (3, args);
5134 GCPRO1 (msg); 5134 GCPRO1 (msg);
@@ -5159,19 +5159,19 @@ auto_save_1 (void)
5159 auto_save_mode_bits = 0666; 5159 auto_save_mode_bits = 0666;
5160 5160
5161 /* Get visited file's mode to become the auto save file's mode. */ 5161 /* Get visited file's mode to become the auto save file's mode. */
5162 if (! NILP (current_buffer->filename)) 5162 if (! NILP (B_ (current_buffer, filename)))
5163 { 5163 {
5164 if (stat (SSDATA (current_buffer->filename), &st) >= 0) 5164 if (stat (SSDATA (B_ (current_buffer, filename)), &st) >= 0)
5165 /* But make sure we can overwrite it later! */ 5165 /* But make sure we can overwrite it later! */
5166 auto_save_mode_bits = st.st_mode | 0600; 5166 auto_save_mode_bits = st.st_mode | 0600;
5167 else if ((modes = Ffile_modes (current_buffer->filename), 5167 else if ((modes = Ffile_modes (B_ (current_buffer, filename)),
5168 INTEGERP (modes))) 5168 INTEGERP (modes)))
5169 /* Remote files don't cooperate with stat. */ 5169 /* Remote files don't cooperate with stat. */
5170 auto_save_mode_bits = XINT (modes) | 0600; 5170 auto_save_mode_bits = XINT (modes) | 0600;
5171 } 5171 }
5172 5172
5173 return 5173 return
5174 Fwrite_region (Qnil, Qnil, current_buffer->auto_save_file_name, Qnil, 5174 Fwrite_region (Qnil, Qnil, B_ (current_buffer, auto_save_file_name), Qnil,
5175 NILP (Vauto_save_visited_file_name) ? Qlambda : Qt, 5175 NILP (Vauto_save_visited_file_name) ? Qlambda : Qt,
5176 Qnil, Qnil); 5176 Qnil, Qnil);
5177} 5177}
@@ -5312,18 +5312,18 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
5312 /* Record all the buffers that have auto save mode 5312 /* Record all the buffers that have auto save mode
5313 in the special file that lists them. For each of these buffers, 5313 in the special file that lists them. For each of these buffers,
5314 Record visited name (if any) and auto save name. */ 5314 Record visited name (if any) and auto save name. */
5315 if (STRINGP (b->auto_save_file_name) 5315 if (STRINGP (B_ (b, auto_save_file_name))
5316 && stream != NULL && do_handled_files == 0) 5316 && stream != NULL && do_handled_files == 0)
5317 { 5317 {
5318 BLOCK_INPUT; 5318 BLOCK_INPUT;
5319 if (!NILP (b->filename)) 5319 if (!NILP (B_ (b, filename)))
5320 { 5320 {
5321 fwrite (SDATA (b->filename), 1, 5321 fwrite (SDATA (B_ (b, filename)), 1,
5322 SBYTES (b->filename), stream); 5322 SBYTES (B_ (b, filename)), stream);
5323 } 5323 }
5324 putc ('\n', stream); 5324 putc ('\n', stream);
5325 fwrite (SDATA (b->auto_save_file_name), 1, 5325 fwrite (SDATA (B_ (b, auto_save_file_name)), 1,
5326 SBYTES (b->auto_save_file_name), stream); 5326 SBYTES (B_ (b, auto_save_file_name)), stream);
5327 putc ('\n', stream); 5327 putc ('\n', stream);
5328 UNBLOCK_INPUT; 5328 UNBLOCK_INPUT;
5329 } 5329 }
@@ -5340,13 +5340,13 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
5340 /* Check for auto save enabled 5340 /* Check for auto save enabled
5341 and file changed since last auto save 5341 and file changed since last auto save
5342 and file changed since last real save. */ 5342 and file changed since last real save. */
5343 if (STRINGP (b->auto_save_file_name) 5343 if (STRINGP (B_ (b, auto_save_file_name))
5344 && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b) 5344 && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)
5345 && BUF_AUTOSAVE_MODIFF (b) < BUF_MODIFF (b) 5345 && BUF_AUTOSAVE_MODIFF (b) < BUF_MODIFF (b)
5346 /* -1 means we've turned off autosaving for a while--see below. */ 5346 /* -1 means we've turned off autosaving for a while--see below. */
5347 && XINT (b->save_length) >= 0 5347 && XINT (B_ (b, save_length)) >= 0
5348 && (do_handled_files 5348 && (do_handled_files
5349 || NILP (Ffind_file_name_handler (b->auto_save_file_name, 5349 || NILP (Ffind_file_name_handler (B_ (b, auto_save_file_name),
5350 Qwrite_region)))) 5350 Qwrite_region))))
5351 { 5351 {
5352 EMACS_TIME before_time, after_time; 5352 EMACS_TIME before_time, after_time;
@@ -5360,23 +5360,23 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
5360 5360
5361 set_buffer_internal (b); 5361 set_buffer_internal (b);
5362 if (NILP (Vauto_save_include_big_deletions) 5362 if (NILP (Vauto_save_include_big_deletions)
5363 && (XFASTINT (b->save_length) * 10 5363 && (XFASTINT (B_ (b, save_length)) * 10
5364 > (BUF_Z (b) - BUF_BEG (b)) * 13) 5364 > (BUF_Z (b) - BUF_BEG (b)) * 13)
5365 /* A short file is likely to change a large fraction; 5365 /* A short file is likely to change a large fraction;
5366 spare the user annoying messages. */ 5366 spare the user annoying messages. */
5367 && XFASTINT (b->save_length) > 5000 5367 && XFASTINT (B_ (b, save_length)) > 5000
5368 /* These messages are frequent and annoying for `*mail*'. */ 5368 /* These messages are frequent and annoying for `*mail*'. */
5369 && !EQ (b->filename, Qnil) 5369 && !EQ (B_ (b, filename), Qnil)
5370 && NILP (no_message)) 5370 && NILP (no_message))
5371 { 5371 {
5372 /* It has shrunk too much; turn off auto-saving here. */ 5372 /* It has shrunk too much; turn off auto-saving here. */
5373 minibuffer_auto_raise = orig_minibuffer_auto_raise; 5373 minibuffer_auto_raise = orig_minibuffer_auto_raise;
5374 message_with_string ("Buffer %s has shrunk a lot; auto save disabled in that buffer until next real save", 5374 message_with_string ("Buffer %s has shrunk a lot; auto save disabled in that buffer until next real save",
5375 b->name, 1); 5375 B_ (b, name), 1);
5376 minibuffer_auto_raise = 0; 5376 minibuffer_auto_raise = 0;
5377 /* Turn off auto-saving until there's a real save, 5377 /* Turn off auto-saving until there's a real save,
5378 and prevent any more warnings. */ 5378 and prevent any more warnings. */
5379 XSETINT (b->save_length, -1); 5379 XSETINT (B_ (b, save_length), -1);
5380 Fsleep_for (make_number (1), Qnil); 5380 Fsleep_for (make_number (1), Qnil);
5381 continue; 5381 continue;
5382 } 5382 }
@@ -5385,7 +5385,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
5385 internal_condition_case (auto_save_1, Qt, auto_save_error); 5385 internal_condition_case (auto_save_1, Qt, auto_save_error);
5386 auto_saved++; 5386 auto_saved++;
5387 BUF_AUTOSAVE_MODIFF (b) = BUF_MODIFF (b); 5387 BUF_AUTOSAVE_MODIFF (b) = BUF_MODIFF (b);
5388 XSETFASTINT (current_buffer->save_length, Z - BEG); 5388 XSETFASTINT (B_ (current_buffer, save_length), Z - BEG);
5389 set_buffer_internal (old); 5389 set_buffer_internal (old);
5390 5390
5391 EMACS_GET_TIME (after_time); 5391 EMACS_GET_TIME (after_time);
@@ -5432,7 +5432,7 @@ No auto-save file will be written until the buffer changes again. */)
5432 /* FIXME: This should not be called in indirect buffers, since 5432 /* FIXME: This should not be called in indirect buffers, since
5433 they're not autosaved. */ 5433 they're not autosaved. */
5434 BUF_AUTOSAVE_MODIFF (current_buffer) = MODIFF; 5434 BUF_AUTOSAVE_MODIFF (current_buffer) = MODIFF;
5435 XSETFASTINT (current_buffer->save_length, Z - BEG); 5435 XSETFASTINT (B_ (current_buffer, save_length), Z - BEG);
5436 current_buffer->auto_save_failure_time = -1; 5436 current_buffer->auto_save_failure_time = -1;
5437 return Qnil; 5437 return Qnil;
5438} 5438}
diff --git a/src/filelock.c b/src/filelock.c
index 8fa871f56ef..6802880c985 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -637,9 +637,9 @@ unlock_all_files (void)
637 for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail)) 637 for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail))
638 { 638 {
639 b = XBUFFER (XCDR (XCAR (tail))); 639 b = XBUFFER (XCDR (XCAR (tail)));
640 if (STRINGP (b->file_truename) && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)) 640 if (STRINGP (B_ (b, file_truename)) && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b))
641 { 641 {
642 unlock_file(b->file_truename); 642 unlock_file(B_ (b, file_truename));
643 } 643 }
644 } 644 }
645} 645}
@@ -652,7 +652,7 @@ or else nothing is done if current buffer isn't visiting a file. */)
652 (Lisp_Object file) 652 (Lisp_Object file)
653{ 653{
654 if (NILP (file)) 654 if (NILP (file))
655 file = current_buffer->file_truename; 655 file = B_ (current_buffer, file_truename);
656 else 656 else
657 CHECK_STRING (file); 657 CHECK_STRING (file);
658 if (SAVE_MODIFF < MODIFF 658 if (SAVE_MODIFF < MODIFF
@@ -669,8 +669,8 @@ should not be locked in that case. */)
669 (void) 669 (void)
670{ 670{
671 if (SAVE_MODIFF < MODIFF 671 if (SAVE_MODIFF < MODIFF
672 && STRINGP (current_buffer->file_truename)) 672 && STRINGP (B_ (current_buffer, file_truename)))
673 unlock_file (current_buffer->file_truename); 673 unlock_file (B_ (current_buffer, file_truename));
674 return Qnil; 674 return Qnil;
675} 675}
676 676
@@ -680,8 +680,8 @@ void
680unlock_buffer (struct buffer *buffer) 680unlock_buffer (struct buffer *buffer)
681{ 681{
682 if (BUF_SAVE_MODIFF (buffer) < BUF_MODIFF (buffer) 682 if (BUF_SAVE_MODIFF (buffer) < BUF_MODIFF (buffer)
683 && STRINGP (buffer->file_truename)) 683 && STRINGP (B_ (buffer, file_truename)))
684 unlock_file (buffer->file_truename); 684 unlock_file (B_ (buffer, file_truename));
685} 685}
686 686
687DEFUN ("file-locked-p", Ffile_locked_p, Sfile_locked_p, 1, 1, 0, 687DEFUN ("file-locked-p", Ffile_locked_p, Sfile_locked_p, 1, 1, 0,
diff --git a/src/fns.c b/src/fns.c
index e7f0bcc1218..a9632914d67 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -2984,7 +2984,7 @@ into shorter lines. */)
2984 SAFE_ALLOCA (encoded, char *, allength); 2984 SAFE_ALLOCA (encoded, char *, allength);
2985 encoded_length = base64_encode_1 ((char *) BYTE_POS_ADDR (ibeg), 2985 encoded_length = base64_encode_1 ((char *) BYTE_POS_ADDR (ibeg),
2986 encoded, length, NILP (no_line_break), 2986 encoded, length, NILP (no_line_break),
2987 !NILP (current_buffer->enable_multibyte_characters)); 2987 !NILP (B_ (current_buffer, enable_multibyte_characters)));
2988 if (encoded_length > allength) 2988 if (encoded_length > allength)
2989 abort (); 2989 abort ();
2990 2990
@@ -3166,7 +3166,7 @@ If the region can't be decoded, signal an error and don't modify the buffer. */
3166 EMACS_INT old_pos = PT; 3166 EMACS_INT old_pos = PT;
3167 EMACS_INT decoded_length; 3167 EMACS_INT decoded_length;
3168 EMACS_INT inserted_chars; 3168 EMACS_INT inserted_chars;
3169 int multibyte = !NILP (current_buffer->enable_multibyte_characters); 3169 int multibyte = !NILP (B_ (current_buffer, enable_multibyte_characters));
3170 USE_SAFE_ALLOCA; 3170 USE_SAFE_ALLOCA;
3171 3171
3172 validate_region (&beg, &end); 3172 validate_region (&beg, &end);
@@ -4684,12 +4684,12 @@ guesswork fails. Normally, an error is signaled in such case. */)
4684 { 4684 {
4685 int force_raw_text = 0; 4685 int force_raw_text = 0;
4686 4686
4687 coding_system = XBUFFER (object)->buffer_file_coding_system; 4687 coding_system = B_ (XBUFFER (object), buffer_file_coding_system);
4688 if (NILP (coding_system) 4688 if (NILP (coding_system)
4689 || NILP (Flocal_variable_p (Qbuffer_file_coding_system, Qnil))) 4689 || NILP (Flocal_variable_p (Qbuffer_file_coding_system, Qnil)))
4690 { 4690 {
4691 coding_system = Qnil; 4691 coding_system = Qnil;
4692 if (NILP (current_buffer->enable_multibyte_characters)) 4692 if (NILP (B_ (current_buffer, enable_multibyte_characters)))
4693 force_raw_text = 1; 4693 force_raw_text = 1;
4694 } 4694 }
4695 4695
@@ -4706,11 +4706,11 @@ guesswork fails. Normally, an error is signaled in such case. */)
4706 } 4706 }
4707 4707
4708 if (NILP (coding_system) 4708 if (NILP (coding_system)
4709 && !NILP (XBUFFER (object)->buffer_file_coding_system)) 4709 && !NILP (B_ (XBUFFER (object), buffer_file_coding_system)))
4710 { 4710 {
4711 /* If we still have not decided a coding system, use the 4711 /* If we still have not decided a coding system, use the
4712 default value of buffer-file-coding-system. */ 4712 default value of buffer-file-coding-system. */
4713 coding_system = XBUFFER (object)->buffer_file_coding_system; 4713 coding_system = B_ (XBUFFER (object), buffer_file_coding_system);
4714 } 4714 }
4715 4715
4716 if (!force_raw_text 4716 if (!force_raw_text
diff --git a/src/font.c b/src/font.c
index 841125a0587..d67e8465b6a 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,
3637 Lisp_Object font_object; 3637 Lisp_Object font_object;
3638 3638
3639 multibyte = (NILP (string) 3639 multibyte = (NILP (string)
3640 ? ! NILP (current_buffer->enable_multibyte_characters) 3640 ? ! NILP (B_ (current_buffer, enable_multibyte_characters))
3641 : STRING_MULTIBYTE (string)); 3641 : STRING_MULTIBYTE (string));
3642 if (c < 0) 3642 if (c < 0)
3643 { 3643 {
diff --git a/src/frame.c b/src/frame.c
index 20bad4cb8c5..ac223ac4da0 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1817,7 +1817,7 @@ make_frame_visible_1 (Lisp_Object window)
1817 w = XWINDOW (window); 1817 w = XWINDOW (window);
1818 1818
1819 if (!NILP (w->buffer)) 1819 if (!NILP (w->buffer))
1820 XBUFFER (w->buffer)->display_time = Fcurrent_time (); 1820 B_ (XBUFFER (w->buffer), display_time) = Fcurrent_time ();
1821 1821
1822 if (!NILP (w->vchild)) 1822 if (!NILP (w->vchild))
1823 make_frame_visible_1 (w->vchild); 1823 make_frame_visible_1 (w->vchild);
diff --git a/src/fringe.c b/src/fringe.c
index 5c9088a924c..5b7f8833069 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -660,7 +660,7 @@ get_logical_cursor_bitmap (struct window *w, Lisp_Object cursor)
660{ 660{
661 Lisp_Object cmap, bm = Qnil; 661 Lisp_Object cmap, bm = Qnil;
662 662
663 if ((cmap = XBUFFER (w->buffer)->fringe_cursor_alist), !NILP (cmap)) 663 if ((cmap = B_ (XBUFFER (w->buffer), fringe_cursor_alist)), !NILP (cmap))
664 { 664 {
665 bm = Fassq (cursor, cmap); 665 bm = Fassq (cursor, cmap);
666 if (CONSP (bm)) 666 if (CONSP (bm))
@@ -670,9 +670,9 @@ get_logical_cursor_bitmap (struct window *w, Lisp_Object cursor)
670 return lookup_fringe_bitmap (bm); 670 return lookup_fringe_bitmap (bm);
671 } 671 }
672 } 672 }
673 if (EQ (cmap, buffer_defaults.fringe_cursor_alist)) 673 if (EQ (cmap, B_ (&buffer_defaults, fringe_cursor_alist)))
674 return NO_FRINGE_BITMAP; 674 return NO_FRINGE_BITMAP;
675 bm = Fassq (cursor, buffer_defaults.fringe_cursor_alist); 675 bm = Fassq (cursor, B_ (&buffer_defaults, fringe_cursor_alist));
676 if (!CONSP (bm) || ((bm = XCDR (bm)), NILP (bm))) 676 if (!CONSP (bm) || ((bm = XCDR (bm)), NILP (bm)))
677 return NO_FRINGE_BITMAP; 677 return NO_FRINGE_BITMAP;
678 return lookup_fringe_bitmap (bm); 678 return lookup_fringe_bitmap (bm);
@@ -697,7 +697,7 @@ get_logical_fringe_bitmap (struct window *w, Lisp_Object bitmap, int right_p, in
697 If partial, lookup partial bitmap in default value if not found here. 697 If partial, lookup partial bitmap in default value if not found here.
698 If not partial, or no partial spec is present, use non-partial bitmap. */ 698 If not partial, or no partial spec is present, use non-partial bitmap. */
699 699
700 if ((cmap = XBUFFER (w->buffer)->fringe_indicator_alist), !NILP (cmap)) 700 if ((cmap = B_ (XBUFFER (w->buffer), fringe_indicator_alist)), !NILP (cmap))
701 { 701 {
702 bm1 = Fassq (bitmap, cmap); 702 bm1 = Fassq (bitmap, cmap);
703 if (CONSP (bm1)) 703 if (CONSP (bm1))
@@ -731,10 +731,10 @@ get_logical_fringe_bitmap (struct window *w, Lisp_Object bitmap, int right_p, in
731 } 731 }
732 } 732 }
733 733
734 if (!EQ (cmap, buffer_defaults.fringe_indicator_alist) 734 if (!EQ (cmap, B_ (&buffer_defaults, fringe_indicator_alist))
735 && !NILP (buffer_defaults.fringe_indicator_alist)) 735 && !NILP (B_ (&buffer_defaults, fringe_indicator_alist)))
736 { 736 {
737 bm2 = Fassq (bitmap, buffer_defaults.fringe_indicator_alist); 737 bm2 = Fassq (bitmap, B_ (&buffer_defaults, fringe_indicator_alist));
738 if (CONSP (bm2)) 738 if (CONSP (bm2))
739 { 739 {
740 if ((bm2 = XCDR (bm2)), !NILP (bm2)) 740 if ((bm2 = XCDR (bm2)), !NILP (bm2))
@@ -919,7 +919,7 @@ update_window_fringes (struct window *w, int keep_current_p)
919 return 0; 919 return 0;
920 920
921 if (!MINI_WINDOW_P (w) 921 if (!MINI_WINDOW_P (w)
922 && (ind = XBUFFER (w->buffer)->indicate_buffer_boundaries, !NILP (ind))) 922 && (ind = B_ (XBUFFER (w->buffer), indicate_buffer_boundaries), !NILP (ind)))
923 { 923 {
924 if (EQ (ind, Qleft) || EQ (ind, Qright)) 924 if (EQ (ind, Qleft) || EQ (ind, Qright))
925 boundary_top = boundary_bot = arrow_top = arrow_bot = ind; 925 boundary_top = boundary_bot = arrow_top = arrow_bot = ind;
@@ -988,7 +988,7 @@ update_window_fringes (struct window *w, int keep_current_p)
988 } 988 }
989 } 989 }
990 990
991 empty_pos = XBUFFER (w->buffer)->indicate_empty_lines; 991 empty_pos = B_ (XBUFFER (w->buffer), indicate_empty_lines);
992 if (!NILP (empty_pos) && !EQ (empty_pos, Qright)) 992 if (!NILP (empty_pos) && !EQ (empty_pos, Qright))
993 empty_pos = WINDOW_LEFT_FRINGE_WIDTH (w) == 0 ? Qright : Qleft; 993 empty_pos = WINDOW_LEFT_FRINGE_WIDTH (w) == 0 ? Qright : Qleft;
994 994
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 6367949a649..6ecd5d624af 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -3677,7 +3677,7 @@ xg_tool_bar_menu_proxy (GtkToolItem *toolitem, gpointer user_data)
3677 GtkLabel *wlbl = GTK_LABEL (xg_get_tool_bar_widgets (vb, &c1)); 3677 GtkLabel *wlbl = GTK_LABEL (xg_get_tool_bar_widgets (vb, &c1));
3678 GtkImage *wimage = GTK_IMAGE (c1); 3678 GtkImage *wimage = GTK_IMAGE (c1);
3679 GtkWidget *wmenuitem = gtk_image_menu_item_new_with_label 3679 GtkWidget *wmenuitem = gtk_image_menu_item_new_with_label
3680 (gtk_label_get_text (wlbl)); 3680 (wlbl ? gtk_label_get_text (wlbl) : "");
3681 GtkWidget *wmenuimage; 3681 GtkWidget *wmenuimage;
3682 3682
3683 3683
diff --git a/src/indent.c b/src/indent.c
index 84ce140c5ba..b0195b3dec8 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -70,7 +70,7 @@ buffer_display_table (void)
70{ 70{
71 Lisp_Object thisbuf; 71 Lisp_Object thisbuf;
72 72
73 thisbuf = current_buffer->display_table; 73 thisbuf = B_ (current_buffer, display_table);
74 if (DISP_TABLE_P (thisbuf)) 74 if (DISP_TABLE_P (thisbuf))
75 return XCHAR_TABLE (thisbuf); 75 return XCHAR_TABLE (thisbuf);
76 if (DISP_TABLE_P (Vstandard_display_table)) 76 if (DISP_TABLE_P (Vstandard_display_table))
@@ -140,9 +140,9 @@ recompute_width_table (struct buffer *buf, struct Lisp_Char_Table *disptab)
140 int i; 140 int i;
141 struct Lisp_Vector *widthtab; 141 struct Lisp_Vector *widthtab;
142 142
143 if (!VECTORP (buf->width_table)) 143 if (!VECTORP (B_ (buf, width_table)))
144 buf->width_table = Fmake_vector (make_number (256), make_number (0)); 144 B_ (buf, width_table) = Fmake_vector (make_number (256), make_number (0));
145 widthtab = XVECTOR (buf->width_table); 145 widthtab = XVECTOR (B_ (buf, width_table));
146 if (widthtab->size != 256) 146 if (widthtab->size != 256)
147 abort (); 147 abort ();
148 148
@@ -156,17 +156,17 @@ recompute_width_table (struct buffer *buf, struct Lisp_Char_Table *disptab)
156static void 156static void
157width_run_cache_on_off (void) 157width_run_cache_on_off (void)
158{ 158{
159 if (NILP (current_buffer->cache_long_line_scans) 159 if (NILP (B_ (current_buffer, cache_long_line_scans))
160 /* And, for the moment, this feature doesn't work on multibyte 160 /* And, for the moment, this feature doesn't work on multibyte
161 characters. */ 161 characters. */
162 || !NILP (current_buffer->enable_multibyte_characters)) 162 || !NILP (B_ (current_buffer, enable_multibyte_characters)))
163 { 163 {
164 /* It should be off. */ 164 /* It should be off. */
165 if (current_buffer->width_run_cache) 165 if (current_buffer->width_run_cache)
166 { 166 {
167 free_region_cache (current_buffer->width_run_cache); 167 free_region_cache (current_buffer->width_run_cache);
168 current_buffer->width_run_cache = 0; 168 current_buffer->width_run_cache = 0;
169 current_buffer->width_table = Qnil; 169 B_ (current_buffer, width_table) = Qnil;
170 } 170 }
171 } 171 }
172 else 172 else
@@ -329,8 +329,8 @@ current_column (void)
329 register int tab_seen; 329 register int tab_seen;
330 int post_tab; 330 int post_tab;
331 register int c; 331 register int c;
332 register int tab_width = XINT (current_buffer->tab_width); 332 register int tab_width = XINT (B_ (current_buffer, tab_width));
333 int ctl_arrow = !NILP (current_buffer->ctl_arrow); 333 int ctl_arrow = !NILP (B_ (current_buffer, ctl_arrow));
334 register struct Lisp_Char_Table *dp = buffer_display_table (); 334 register struct Lisp_Char_Table *dp = buffer_display_table ();
335 335
336 if (PT == last_known_column_point 336 if (PT == last_known_column_point
@@ -417,7 +417,7 @@ current_column (void)
417 col++; 417 col++;
418 else if (c == '\n' 418 else if (c == '\n'
419 || (c == '\r' 419 || (c == '\r'
420 && EQ (current_buffer->selective_display, Qt))) 420 && EQ (B_ (current_buffer, selective_display), Qt)))
421 { 421 {
422 ptr++; 422 ptr++;
423 goto start_of_line_found; 423 goto start_of_line_found;
@@ -512,10 +512,10 @@ check_display_width (EMACS_INT pos, EMACS_INT col, EMACS_INT *endpos)
512static void 512static void
513scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol) 513scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol)
514{ 514{
515 register EMACS_INT tab_width = XINT (current_buffer->tab_width); 515 register EMACS_INT tab_width = XINT (B_ (current_buffer, tab_width));
516 register int ctl_arrow = !NILP (current_buffer->ctl_arrow); 516 register int ctl_arrow = !NILP (B_ (current_buffer, ctl_arrow));
517 register struct Lisp_Char_Table *dp = buffer_display_table (); 517 register struct Lisp_Char_Table *dp = buffer_display_table ();
518 int multibyte = !NILP (current_buffer->enable_multibyte_characters); 518 int multibyte = !NILP (B_ (current_buffer, enable_multibyte_characters));
519 struct composition_it cmp_it; 519 struct composition_it cmp_it;
520 Lisp_Object window; 520 Lisp_Object window;
521 struct window *w; 521 struct window *w;
@@ -637,7 +637,7 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol)
637 637
638 if (c == '\n') 638 if (c == '\n')
639 goto endloop; 639 goto endloop;
640 if (c == '\r' && EQ (current_buffer->selective_display, Qt)) 640 if (c == '\r' && EQ (B_ (current_buffer, selective_display), Qt))
641 goto endloop; 641 goto endloop;
642 if (c == '\t') 642 if (c == '\t')
643 { 643 {
@@ -655,7 +655,7 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol)
655 655
656 if (c == '\n') 656 if (c == '\n')
657 goto endloop; 657 goto endloop;
658 if (c == '\r' && EQ (current_buffer->selective_display, Qt)) 658 if (c == '\r' && EQ (B_ (current_buffer, selective_display), Qt))
659 goto endloop; 659 goto endloop;
660 if (c == '\t') 660 if (c == '\t')
661 { 661 {
@@ -809,7 +809,7 @@ The return value is COLUMN. */)
809{ 809{
810 int mincol; 810 int mincol;
811 register int fromcol; 811 register int fromcol;
812 register int tab_width = XINT (current_buffer->tab_width); 812 register int tab_width = XINT (B_ (current_buffer, tab_width));
813 813
814 CHECK_NUMBER (column); 814 CHECK_NUMBER (column);
815 if (NILP (minimum)) 815 if (NILP (minimum))
@@ -872,7 +872,7 @@ static double
872position_indentation (register int pos_byte) 872position_indentation (register int pos_byte)
873{ 873{
874 register EMACS_INT column = 0; 874 register EMACS_INT column = 0;
875 register EMACS_INT tab_width = XINT (current_buffer->tab_width); 875 register EMACS_INT tab_width = XINT (B_ (current_buffer, tab_width));
876 register unsigned char *p; 876 register unsigned char *p;
877 register unsigned char *stop; 877 register unsigned char *stop;
878 unsigned char *start; 878 unsigned char *start;
@@ -924,7 +924,7 @@ position_indentation (register int pos_byte)
924 switch (*p++) 924 switch (*p++)
925 { 925 {
926 case 0240: 926 case 0240:
927 if (! NILP (current_buffer->enable_multibyte_characters)) 927 if (! NILP (B_ (current_buffer, enable_multibyte_characters)))
928 return column; 928 return column;
929 case ' ': 929 case ' ':
930 column++; 930 column++;
@@ -934,7 +934,7 @@ position_indentation (register int pos_byte)
934 break; 934 break;
935 default: 935 default:
936 if (ASCII_BYTE_P (p[-1]) 936 if (ASCII_BYTE_P (p[-1])
937 || NILP (current_buffer->enable_multibyte_characters)) 937 || NILP (B_ (current_buffer, enable_multibyte_characters)))
938 return column; 938 return column;
939 { 939 {
940 int c; 940 int c;
@@ -1123,13 +1123,13 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_
1123 register EMACS_INT pos; 1123 register EMACS_INT pos;
1124 EMACS_INT pos_byte; 1124 EMACS_INT pos_byte;
1125 register int c = 0; 1125 register int c = 0;
1126 register EMACS_INT tab_width = XFASTINT (current_buffer->tab_width); 1126 register EMACS_INT tab_width = XFASTINT (B_ (current_buffer, tab_width));
1127 register int ctl_arrow = !NILP (current_buffer->ctl_arrow); 1127 register int ctl_arrow = !NILP (B_ (current_buffer, ctl_arrow));
1128 register struct Lisp_Char_Table *dp = window_display_table (win); 1128 register struct Lisp_Char_Table *dp = window_display_table (win);
1129 int selective 1129 int selective
1130 = (INTEGERP (current_buffer->selective_display) 1130 = (INTEGERP (B_ (current_buffer, selective_display))
1131 ? XINT (current_buffer->selective_display) 1131 ? XINT (B_ (current_buffer, selective_display))
1132 : !NILP (current_buffer->selective_display) ? -1 : 0); 1132 : !NILP (B_ (current_buffer, selective_display)) ? -1 : 0);
1133 int selective_rlen 1133 int selective_rlen
1134 = (selective && dp && VECTORP (DISP_INVIS_VECTOR (dp)) 1134 = (selective && dp && VECTORP (DISP_INVIS_VECTOR (dp))
1135 ? XVECTOR (DISP_INVIS_VECTOR (dp))->size : 0); 1135 ? XVECTOR (DISP_INVIS_VECTOR (dp))->size : 0);
@@ -1151,7 +1151,7 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_
1151 EMACS_INT next_width_run = from; 1151 EMACS_INT next_width_run = from;
1152 Lisp_Object window; 1152 Lisp_Object window;
1153 1153
1154 int multibyte = !NILP (current_buffer->enable_multibyte_characters); 1154 int multibyte = !NILP (B_ (current_buffer, enable_multibyte_characters));
1155 /* If previous char scanned was a wide character, 1155 /* If previous char scanned was a wide character,
1156 this is the column where it ended. Otherwise, this is 0. */ 1156 this is the column where it ended. Otherwise, this is 0. */
1157 EMACS_INT wide_column_end_hpos = 0; 1157 EMACS_INT wide_column_end_hpos = 0;
@@ -1170,8 +1170,8 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_
1170 1170
1171 width_run_cache_on_off (); 1171 width_run_cache_on_off ();
1172 if (dp == buffer_display_table ()) 1172 if (dp == buffer_display_table ())
1173 width_table = (VECTORP (current_buffer->width_table) 1173 width_table = (VECTORP (B_ (current_buffer, width_table))
1174 ? XVECTOR (current_buffer->width_table)->contents 1174 ? XVECTOR (B_ (current_buffer, width_table))->contents
1175 : 0); 1175 : 0);
1176 else 1176 else
1177 /* If the window has its own display table, we can't use the width 1177 /* 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_
1337 } 1337 }
1338 1338
1339 if (hscroll || truncate 1339 if (hscroll || truncate
1340 || !NILP (current_buffer->truncate_lines)) 1340 || !NILP (B_ (current_buffer, truncate_lines)))
1341 { 1341 {
1342 /* Truncating: skip to newline, unless we are already past 1342 /* Truncating: skip to newline, unless we are already past
1343 TO (we need to go back below). */ 1343 TO (we need to go back below). */
@@ -1838,9 +1838,9 @@ vmotion (register EMACS_INT from, register EMACS_INT vtarget, struct window *w)
1838 EMACS_INT from_byte; 1838 EMACS_INT from_byte;
1839 EMACS_INT lmargin = hscroll > 0 ? 1 - hscroll : 0; 1839 EMACS_INT lmargin = hscroll > 0 ? 1 - hscroll : 0;
1840 int selective 1840 int selective
1841 = (INTEGERP (current_buffer->selective_display) 1841 = (INTEGERP (B_ (current_buffer, selective_display))
1842 ? XINT (current_buffer->selective_display) 1842 ? XINT (B_ (current_buffer, selective_display))
1843 : !NILP (current_buffer->selective_display) ? -1 : 0); 1843 : !NILP (B_ (current_buffer, selective_display)) ? -1 : 0);
1844 Lisp_Object window; 1844 Lisp_Object window;
1845 EMACS_INT start_hpos = 0; 1845 EMACS_INT start_hpos = 0;
1846 int did_motion; 1846 int did_motion;
diff --git a/src/insdel.c b/src/insdel.c
index db76f770dad..db997fc938e 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -78,7 +78,7 @@ void
78check_markers (void) 78check_markers (void)
79{ 79{
80 register struct Lisp_Marker *tail; 80 register struct Lisp_Marker *tail;
81 int multibyte = ! NILP (current_buffer->enable_multibyte_characters); 81 int multibyte = ! NILP (B_ (current_buffer, enable_multibyte_characters));
82 82
83 for (tail = BUF_MARKERS (current_buffer); tail; tail = tail->next) 83 for (tail = BUF_MARKERS (current_buffer); tail; tail = tail->next)
84 { 84 {
@@ -703,7 +703,7 @@ insert_char (int c)
703 unsigned char str[MAX_MULTIBYTE_LENGTH]; 703 unsigned char str[MAX_MULTIBYTE_LENGTH];
704 int len; 704 int len;
705 705
706 if (! NILP (current_buffer->enable_multibyte_characters)) 706 if (! NILP (B_ (current_buffer, enable_multibyte_characters)))
707 len = CHAR_STRING (c, str); 707 len = CHAR_STRING (c, str);
708 else 708 else
709 { 709 {
@@ -891,7 +891,7 @@ insert_1_both (const char *string,
891 if (nchars == 0) 891 if (nchars == 0)
892 return; 892 return;
893 893
894 if (NILP (current_buffer->enable_multibyte_characters)) 894 if (NILP (B_ (current_buffer, enable_multibyte_characters)))
895 nchars = nbytes; 895 nchars = nbytes;
896 896
897 if (prepare) 897 if (prepare)
@@ -1011,7 +1011,7 @@ insert_from_string_1 (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte,
1011 /* Make OUTGOING_NBYTES describe the text 1011 /* Make OUTGOING_NBYTES describe the text
1012 as it will be inserted in this buffer. */ 1012 as it will be inserted in this buffer. */
1013 1013
1014 if (NILP (current_buffer->enable_multibyte_characters)) 1014 if (NILP (B_ (current_buffer, enable_multibyte_characters)))
1015 outgoing_nbytes = nchars; 1015 outgoing_nbytes = nchars;
1016 else if (! STRING_MULTIBYTE (string)) 1016 else if (! STRING_MULTIBYTE (string))
1017 outgoing_nbytes 1017 outgoing_nbytes
@@ -1034,7 +1034,7 @@ insert_from_string_1 (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte,
1034 between single-byte and multibyte. */ 1034 between single-byte and multibyte. */
1035 copy_text (SDATA (string) + pos_byte, GPT_ADDR, nbytes, 1035 copy_text (SDATA (string) + pos_byte, GPT_ADDR, nbytes,
1036 STRING_MULTIBYTE (string), 1036 STRING_MULTIBYTE (string),
1037 ! NILP (current_buffer->enable_multibyte_characters)); 1037 ! NILP (B_ (current_buffer, enable_multibyte_characters)));
1038 1038
1039#ifdef BYTE_COMBINING_DEBUG 1039#ifdef BYTE_COMBINING_DEBUG
1040 /* We have copied text into the gap, but we have not altered 1040 /* 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,
1094void 1094void
1095insert_from_gap (EMACS_INT nchars, EMACS_INT nbytes) 1095insert_from_gap (EMACS_INT nchars, EMACS_INT nbytes)
1096{ 1096{
1097 if (NILP (current_buffer->enable_multibyte_characters)) 1097 if (NILP (B_ (current_buffer, enable_multibyte_characters)))
1098 nchars = nbytes; 1098 nchars = nbytes;
1099 1099
1100 record_insert (GPT, nchars); 1100 record_insert (GPT, nchars);
@@ -1162,9 +1162,9 @@ insert_from_buffer_1 (struct buffer *buf,
1162 /* Make OUTGOING_NBYTES describe the text 1162 /* Make OUTGOING_NBYTES describe the text
1163 as it will be inserted in this buffer. */ 1163 as it will be inserted in this buffer. */
1164 1164
1165 if (NILP (current_buffer->enable_multibyte_characters)) 1165 if (NILP (B_ (current_buffer, enable_multibyte_characters)))
1166 outgoing_nbytes = nchars; 1166 outgoing_nbytes = nchars;
1167 else if (NILP (buf->enable_multibyte_characters)) 1167 else if (NILP (B_ (buf, enable_multibyte_characters)))
1168 { 1168 {
1169 EMACS_INT outgoing_before_gap = 0; 1169 EMACS_INT outgoing_before_gap = 0;
1170 EMACS_INT outgoing_after_gap = 0; 1170 EMACS_INT outgoing_after_gap = 0;
@@ -1215,8 +1215,8 @@ insert_from_buffer_1 (struct buffer *buf,
1215 chunk_expanded 1215 chunk_expanded
1216 = copy_text (BUF_BYTE_ADDRESS (buf, from_byte), 1216 = copy_text (BUF_BYTE_ADDRESS (buf, from_byte),
1217 GPT_ADDR, chunk, 1217 GPT_ADDR, chunk,
1218 ! NILP (buf->enable_multibyte_characters), 1218 ! NILP (B_ (buf, enable_multibyte_characters)),
1219 ! NILP (current_buffer->enable_multibyte_characters)); 1219 ! NILP (B_ (current_buffer, enable_multibyte_characters)));
1220 } 1220 }
1221 else 1221 else
1222 chunk_expanded = chunk = 0; 1222 chunk_expanded = chunk = 0;
@@ -1224,8 +1224,8 @@ insert_from_buffer_1 (struct buffer *buf,
1224 if (chunk < incoming_nbytes) 1224 if (chunk < incoming_nbytes)
1225 copy_text (BUF_BYTE_ADDRESS (buf, from_byte + chunk), 1225 copy_text (BUF_BYTE_ADDRESS (buf, from_byte + chunk),
1226 GPT_ADDR + chunk_expanded, incoming_nbytes - chunk, 1226 GPT_ADDR + chunk_expanded, incoming_nbytes - chunk,
1227 ! NILP (buf->enable_multibyte_characters), 1227 ! NILP (B_ (buf, enable_multibyte_characters)),
1228 ! NILP (current_buffer->enable_multibyte_characters)); 1228 ! NILP (B_ (current_buffer, enable_multibyte_characters)));
1229 1229
1230#ifdef BYTE_COMBINING_DEBUG 1230#ifdef BYTE_COMBINING_DEBUG
1231 /* We have copied text into the gap, but we have not altered 1231 /* 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,
1320 adjust_markers_for_insert (from, from_byte, 1320 adjust_markers_for_insert (from, from_byte,
1321 from + len, from_byte + len_byte, 0); 1321 from + len, from_byte + len_byte, 0);
1322 1322
1323 if (! EQ (current_buffer->undo_list, Qt)) 1323 if (! EQ (B_ (current_buffer, undo_list), Qt))
1324 { 1324 {
1325 if (nchars_del > 0) 1325 if (nchars_del > 0)
1326 record_delete (from, prev_text); 1326 record_delete (from, prev_text);
@@ -1481,7 +1481,7 @@ replace_range (EMACS_INT from, EMACS_INT to, Lisp_Object new,
1481 /* Make OUTGOING_INSBYTES describe the text 1481 /* Make OUTGOING_INSBYTES describe the text
1482 as it will be inserted in this buffer. */ 1482 as it will be inserted in this buffer. */
1483 1483
1484 if (NILP (current_buffer->enable_multibyte_characters)) 1484 if (NILP (B_ (current_buffer, enable_multibyte_characters)))
1485 outgoing_insbytes = inschars; 1485 outgoing_insbytes = inschars;
1486 else if (! STRING_MULTIBYTE (new)) 1486 else if (! STRING_MULTIBYTE (new))
1487 outgoing_insbytes 1487 outgoing_insbytes
@@ -1503,7 +1503,7 @@ replace_range (EMACS_INT from, EMACS_INT to, Lisp_Object new,
1503 /* Even if we don't record for undo, we must keep the original text 1503 /* Even if we don't record for undo, we must keep the original text
1504 because we may have to recover it because of inappropriate byte 1504 because we may have to recover it because of inappropriate byte
1505 combining. */ 1505 combining. */
1506 if (! EQ (current_buffer->undo_list, Qt)) 1506 if (! EQ (B_ (current_buffer, undo_list), Qt))
1507 deletion = make_buffer_string_both (from, from_byte, to, to_byte, 1); 1507 deletion = make_buffer_string_both (from, from_byte, to, to_byte, 1);
1508 1508
1509 GAP_SIZE += nbytes_del; 1509 GAP_SIZE += nbytes_del;
@@ -1530,7 +1530,7 @@ replace_range (EMACS_INT from, EMACS_INT to, Lisp_Object new,
1530 between single-byte and multibyte. */ 1530 between single-byte and multibyte. */
1531 copy_text (SDATA (new), GPT_ADDR, insbytes, 1531 copy_text (SDATA (new), GPT_ADDR, insbytes,
1532 STRING_MULTIBYTE (new), 1532 STRING_MULTIBYTE (new),
1533 ! NILP (current_buffer->enable_multibyte_characters)); 1533 ! NILP (B_ (current_buffer, enable_multibyte_characters)));
1534 1534
1535#ifdef BYTE_COMBINING_DEBUG 1535#ifdef BYTE_COMBINING_DEBUG
1536 /* We have copied text into the gap, but we have not marked 1536 /* 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,
1543 abort (); 1543 abort ();
1544#endif 1544#endif
1545 1545
1546 if (! EQ (current_buffer->undo_list, Qt)) 1546 if (! EQ (B_ (current_buffer, undo_list), Qt))
1547 { 1547 {
1548 /* Record the insertion first, so that when we undo, 1548 /* Record the insertion first, so that when we undo,
1549 the deletion will be undone first. Thus, undo 1549 the deletion will be undone first. Thus, undo
@@ -1886,7 +1886,7 @@ del_range_2 (EMACS_INT from, EMACS_INT from_byte,
1886 abort (); 1886 abort ();
1887#endif 1887#endif
1888 1888
1889 if (ret_string || ! EQ (current_buffer->undo_list, Qt)) 1889 if (ret_string || ! EQ (B_ (current_buffer, undo_list), Qt))
1890 deletion = make_buffer_string_both (from, from_byte, to, to_byte, 1); 1890 deletion = make_buffer_string_both (from, from_byte, to, to_byte, 1);
1891 else 1891 else
1892 deletion = Qnil; 1892 deletion = Qnil;
@@ -1897,7 +1897,7 @@ del_range_2 (EMACS_INT from, EMACS_INT from_byte,
1897 so that undo handles this after reinserting the text. */ 1897 so that undo handles this after reinserting the text. */
1898 adjust_markers_for_delete (from, from_byte, to, to_byte); 1898 adjust_markers_for_delete (from, from_byte, to, to_byte);
1899 1899
1900 if (! EQ (current_buffer->undo_list, Qt)) 1900 if (! EQ (B_ (current_buffer, undo_list), Qt))
1901 record_delete (from, deletion); 1901 record_delete (from, deletion);
1902 MODIFF++; 1902 MODIFF++;
1903 CHARS_MODIFF = MODIFF; 1903 CHARS_MODIFF = MODIFF;
@@ -1968,7 +1968,7 @@ modify_region (struct buffer *buffer, EMACS_INT start, EMACS_INT end,
1968 if (! preserve_chars_modiff) 1968 if (! preserve_chars_modiff)
1969 CHARS_MODIFF = MODIFF; 1969 CHARS_MODIFF = MODIFF;
1970 1970
1971 buffer->point_before_scroll = Qnil; 1971 B_ (buffer, point_before_scroll) = Qnil;
1972 1972
1973 if (buffer != old_buffer) 1973 if (buffer != old_buffer)
1974 set_buffer_internal (old_buffer); 1974 set_buffer_internal (old_buffer);
@@ -1990,7 +1990,7 @@ prepare_to_modify_buffer (EMACS_INT start, EMACS_INT end,
1990{ 1990{
1991 struct buffer *base_buffer; 1991 struct buffer *base_buffer;
1992 1992
1993 if (!NILP (current_buffer->read_only)) 1993 if (!NILP (B_ (current_buffer, read_only)))
1994 Fbarf_if_buffer_read_only (); 1994 Fbarf_if_buffer_read_only ();
1995 1995
1996 /* Let redisplay consider other windows than selected_window 1996 /* Let redisplay consider other windows than selected_window
@@ -2022,32 +2022,32 @@ prepare_to_modify_buffer (EMACS_INT start, EMACS_INT end,
2022 base_buffer = current_buffer; 2022 base_buffer = current_buffer;
2023 2023
2024#ifdef CLASH_DETECTION 2024#ifdef CLASH_DETECTION
2025 if (!NILP (base_buffer->file_truename) 2025 if (!NILP (B_ (base_buffer, file_truename))
2026 /* Make binding buffer-file-name to nil effective. */ 2026 /* Make binding buffer-file-name to nil effective. */
2027 && !NILP (base_buffer->filename) 2027 && !NILP (B_ (base_buffer, filename))
2028 && SAVE_MODIFF >= MODIFF) 2028 && SAVE_MODIFF >= MODIFF)
2029 lock_file (base_buffer->file_truename); 2029 lock_file (B_ (base_buffer, file_truename));
2030#else 2030#else
2031 /* At least warn if this file has changed on disk since it was visited. */ 2031 /* At least warn if this file has changed on disk since it was visited. */
2032 if (!NILP (base_buffer->filename) 2032 if (!NILP (B_ (base_buffer, filename))
2033 && SAVE_MODIFF >= MODIFF 2033 && SAVE_MODIFF >= MODIFF
2034 && NILP (Fverify_visited_file_modtime (Fcurrent_buffer ())) 2034 && NILP (Fverify_visited_file_modtime (Fcurrent_buffer ()))
2035 && !NILP (Ffile_exists_p (base_buffer->filename))) 2035 && !NILP (Ffile_exists_p (B_ (base_buffer, filename))))
2036 call1 (intern ("ask-user-about-supersession-threat"), 2036 call1 (intern ("ask-user-about-supersession-threat"),
2037 base_buffer->filename); 2037 B_ (base_buffer,filename));
2038#endif /* not CLASH_DETECTION */ 2038#endif /* not CLASH_DETECTION */
2039 2039
2040 /* If `select-active-regions' is non-nil, save the region text. */ 2040 /* If `select-active-regions' is non-nil, save the region text. */
2041 if (!NILP (current_buffer->mark_active) 2041 if (!NILP (B_ (current_buffer, mark_active))
2042 && !inhibit_modification_hooks 2042 && !inhibit_modification_hooks
2043 && XMARKER (current_buffer->mark)->buffer 2043 && XMARKER (B_ (current_buffer, mark))->buffer
2044 && NILP (Vsaved_region_selection) 2044 && NILP (Vsaved_region_selection)
2045 && (EQ (Vselect_active_regions, Qonly) 2045 && (EQ (Vselect_active_regions, Qonly)
2046 ? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly) 2046 ? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly)
2047 : (!NILP (Vselect_active_regions) 2047 : (!NILP (Vselect_active_regions)
2048 && !NILP (Vtransient_mark_mode)))) 2048 && !NILP (Vtransient_mark_mode))))
2049 { 2049 {
2050 EMACS_INT b = XMARKER (current_buffer->mark)->charpos; 2050 EMACS_INT b = XMARKER (B_ (current_buffer, mark))->charpos;
2051 EMACS_INT e = PT; 2051 EMACS_INT e = PT;
2052 if (b < e) 2052 if (b < e)
2053 Vsaved_region_selection = make_buffer_string (b, e, 0); 2053 Vsaved_region_selection = make_buffer_string (b, e, 0);
@@ -2290,7 +2290,7 @@ DEFUN ("combine-after-change-execute", Fcombine_after_change_execute,
2290 non-nil, and insertion calls a file handler (e.g. through 2290 non-nil, and insertion calls a file handler (e.g. through
2291 lock_file) which scribbles into a temp file -- cyd */ 2291 lock_file) which scribbles into a temp file -- cyd */
2292 if (!BUFFERP (combine_after_change_buffer) 2292 if (!BUFFERP (combine_after_change_buffer)
2293 || NILP (XBUFFER (combine_after_change_buffer)->name)) 2293 || NILP (B_ (XBUFFER (combine_after_change_buffer), name)))
2294 { 2294 {
2295 combine_after_change_list = Qnil; 2295 combine_after_change_list = Qnil;
2296 return Qnil; 2296 return Qnil;
diff --git a/src/intervals.c b/src/intervals.c
index ad46c17d588..de5faf6ce75 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -1978,7 +1978,7 @@ set_point_both (EMACS_INT charpos, EMACS_INT bytepos)
1978 int have_overlays; 1978 int have_overlays;
1979 EMACS_INT original_position; 1979 EMACS_INT original_position;
1980 1980
1981 current_buffer->point_before_scroll = Qnil; 1981 B_ (current_buffer, point_before_scroll) = Qnil;
1982 1982
1983 if (charpos == PT) 1983 if (charpos == PT)
1984 return; 1984 return;
@@ -2342,7 +2342,7 @@ get_local_map (register EMACS_INT position, register struct buffer *buffer,
2342 if (EQ (type, Qkeymap)) 2342 if (EQ (type, Qkeymap))
2343 return Qnil; 2343 return Qnil;
2344 else 2344 else
2345 return buffer->keymap; 2345 return B_ (buffer, keymap);
2346} 2346}
2347 2347
2348/* Produce an interval tree reflecting the intervals in 2348/* Produce an interval tree reflecting the intervals in
diff --git a/src/intervals.h b/src/intervals.h
index 0762c9d8dc3..3c46c50db79 100644
--- a/src/intervals.h
+++ b/src/intervals.h
@@ -236,9 +236,9 @@ struct interval
236 and 2 if it is invisible but with an ellipsis. */ 236 and 2 if it is invisible but with an ellipsis. */
237 237
238#define TEXT_PROP_MEANS_INVISIBLE(prop) \ 238#define TEXT_PROP_MEANS_INVISIBLE(prop) \
239 (EQ (current_buffer->invisibility_spec, Qt) \ 239 (EQ (B_ (current_buffer, invisibility_spec), Qt) \
240 ? !NILP (prop) \ 240 ? !NILP (prop) \
241 : invisible_p (prop, current_buffer->invisibility_spec)) 241 : invisible_p (prop, B_ (current_buffer, invisibility_spec)))
242 242
243/* Declared in alloc.c */ 243/* Declared in alloc.c */
244 244
diff --git a/src/keyboard.c b/src/keyboard.c
index 71d6456e57c..339d32a838a 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1577,7 +1577,7 @@ command_loop_1 (void)
1577 this_single_command_key_start = 0; 1577 this_single_command_key_start = 0;
1578 } 1578 }
1579 1579
1580 if (!NILP (current_buffer->mark_active) 1580 if (!NILP (B_ (current_buffer, mark_active))
1581 && !NILP (Vrun_hooks)) 1581 && !NILP (Vrun_hooks))
1582 { 1582 {
1583 /* In Emacs 22, setting transient-mark-mode to `only' was a 1583 /* In Emacs 22, setting transient-mark-mode to `only' was a
@@ -1599,7 +1599,7 @@ command_loop_1 (void)
1599 if (!NILP (Fwindow_system (Qnil)) 1599 if (!NILP (Fwindow_system (Qnil))
1600 /* Even if mark_active is non-nil, the actual buffer 1600 /* Even if mark_active is non-nil, the actual buffer
1601 marker may not have been set yet (Bug#7044). */ 1601 marker may not have been set yet (Bug#7044). */
1602 && XMARKER (current_buffer->mark)->buffer 1602 && XMARKER (B_ (current_buffer, mark))->buffer
1603 && (EQ (Vselect_active_regions, Qonly) 1603 && (EQ (Vselect_active_regions, Qonly)
1604 ? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly) 1604 ? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly)
1605 : (!NILP (Vselect_active_regions) 1605 : (!NILP (Vselect_active_regions)
@@ -1607,7 +1607,7 @@ command_loop_1 (void)
1607 && !EQ (Vthis_command, Qhandle_switch_frame)) 1607 && !EQ (Vthis_command, Qhandle_switch_frame))
1608 { 1608 {
1609 EMACS_INT beg = 1609 EMACS_INT beg =
1610 XINT (Fmarker_position (current_buffer->mark)); 1610 XINT (Fmarker_position (B_ (current_buffer, mark)));
1611 EMACS_INT end = PT; 1611 EMACS_INT end = PT;
1612 if (beg < end) 1612 if (beg < end)
1613 call2 (Qx_set_selection, QPRIMARY, 1613 call2 (Qx_set_selection, QPRIMARY,
@@ -8608,7 +8608,7 @@ read_char_minibuf_menu_prompt (int commandflag, int nmaps, Lisp_Object *maps)
8608 8608
8609 /* Prompt with that and read response. */ 8609 /* Prompt with that and read response. */
8610 message2_nolog (menu, strlen (menu), 8610 message2_nolog (menu, strlen (menu),
8611 ! NILP (current_buffer->enable_multibyte_characters)); 8611 ! NILP (B_ (current_buffer, enable_multibyte_characters)));
8612 8612
8613 /* Make believe its not a keyboard macro in case the help char 8613 /* Make believe its not a keyboard macro in case the help char
8614 is pressed. Help characters are not recorded because menu prompting 8614 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,
9870 /* Treat uppercase keys as shifted. */ 9870 /* Treat uppercase keys as shifted. */
9871 || (INTEGERP (key) 9871 || (INTEGERP (key)
9872 && (KEY_TO_CHAR (key) 9872 && (KEY_TO_CHAR (key)
9873 < XCHAR_TABLE (current_buffer->downcase_table)->size) 9873 < XCHAR_TABLE (B_ (current_buffer, downcase_table))->size)
9874 && UPPERCASEP (KEY_TO_CHAR (key)))) 9874 && UPPERCASEP (KEY_TO_CHAR (key))))
9875 { 9875 {
9876 Lisp_Object new_key 9876 Lisp_Object new_key
diff --git a/src/keyboard.h b/src/keyboard.h
index 166b3c0e9d4..7b3374ac3bd 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -19,8 +19,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19#include "systime.h" /* for EMACS_TIME */ 19#include "systime.h" /* for EMACS_TIME */
20#include "coding.h" /* for ENCODE_UTF_8 and ENCODE_SYSTEM */ 20#include "coding.h" /* for ENCODE_UTF_8 and ENCODE_SYSTEM */
21 21
22/* Length of echobuf field in each KBOARD. */
23
24/* Each KBOARD represents one logical input stream from which Emacs 22/* Each KBOARD represents one logical input stream from which Emacs
25 gets input. If we are using ordinary terminals, it has one KBOARD 23 gets input. If we are using ordinary terminals, it has one KBOARD
26 object for each terminal device. 24 object for each terminal device.
diff --git a/src/keymap.c b/src/keymap.c
index 8ee4f41bd6f..b694deadcba 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. */)
1883 (Lisp_Object keys, Lisp_Object accept_default) 1883 (Lisp_Object keys, Lisp_Object accept_default)
1884{ 1884{
1885 register Lisp_Object map; 1885 register Lisp_Object map;
1886 map = current_buffer->keymap; 1886 map = B_ (current_buffer, keymap);
1887 if (NILP (map)) 1887 if (NILP (map))
1888 return Qnil; 1888 return Qnil;
1889 return Flookup_key (map, keys, accept_default); 1889 return Flookup_key (map, keys, accept_default);
@@ -1988,7 +1988,7 @@ If KEYMAP is nil, that means no local keymap. */)
1988 if (!NILP (keymap)) 1988 if (!NILP (keymap))
1989 keymap = get_keymap (keymap, 1, 1); 1989 keymap = get_keymap (keymap, 1, 1);
1990 1990
1991 current_buffer->keymap = keymap; 1991 B_ (current_buffer, keymap) = keymap;
1992 1992
1993 return Qnil; 1993 return Qnil;
1994} 1994}
@@ -1998,7 +1998,7 @@ DEFUN ("current-local-map", Fcurrent_local_map, Scurrent_local_map, 0, 0, 0,
1998Normally the local keymap is set by the major mode with `use-local-map'. */) 1998Normally the local keymap is set by the major mode with `use-local-map'. */)
1999 (void) 1999 (void)
2000{ 2000{
2001 return current_buffer->keymap; 2001 return B_ (current_buffer, keymap);
2002} 2002}
2003 2003
2004DEFUN ("current-global-map", Fcurrent_global_map, Scurrent_global_map, 0, 0, 0, 2004DEFUN ("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
2379 *p++ = 'C'; 2379 *p++ = 'C';
2380 } 2380 }
2381 else if (c < 128 2381 else if (c < 128
2382 || (NILP (current_buffer->enable_multibyte_characters) 2382 || (NILP (B_ (current_buffer, enable_multibyte_characters))
2383 && SINGLE_BYTE_CHAR_P (c) 2383 && SINGLE_BYTE_CHAR_P (c)
2384 && !force_multibyte)) 2384 && !force_multibyte))
2385 { 2385 {
@@ -2388,7 +2388,7 @@ push_key_description (register unsigned int c, register char *p, int force_multi
2388 else 2388 else
2389 { 2389 {
2390 /* Now we are sure that C is a valid character code. */ 2390 /* Now we are sure that C is a valid character code. */
2391 if (NILP (current_buffer->enable_multibyte_characters) 2391 if (NILP (B_ (current_buffer, enable_multibyte_characters))
2392 && ! force_multibyte) 2392 && ! force_multibyte)
2393 *p++ = multibyte_char_to_unibyte (c, Qnil); 2393 *p++ = multibyte_char_to_unibyte (c, Qnil);
2394 else 2394 else
@@ -3048,7 +3048,7 @@ You type Translation\n\
3048 XBUFFER (buffer), Qlocal_map); 3048 XBUFFER (buffer), Qlocal_map);
3049 if (!NILP (start1)) 3049 if (!NILP (start1))
3050 { 3050 {
3051 if (EQ (start1, XBUFFER (buffer)->keymap)) 3051 if (EQ (start1, B_ (XBUFFER (buffer), keymap)))
3052 describe_map_tree (start1, 1, shadow, prefix, 3052 describe_map_tree (start1, 1, shadow, prefix,
3053 "\f\nMajor Mode Bindings", nomenu, 0, 0, 0); 3053 "\f\nMajor Mode Bindings", nomenu, 0, 0, 0);
3054 else 3054 else
diff --git a/src/lisp.h b/src/lisp.h
index 2b2f61bbda4..0efadd675b0 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1882,7 +1882,7 @@ extern void defvar_kboard (struct Lisp_Kboard_Objfwd *, const char *, int);
1882#define DEFVAR_BUFFER_DEFAULTS(lname, vname, doc) \ 1882#define DEFVAR_BUFFER_DEFAULTS(lname, vname, doc) \
1883 do { \ 1883 do { \
1884 static struct Lisp_Objfwd o_fwd; \ 1884 static struct Lisp_Objfwd o_fwd; \
1885 defvar_lisp_nopro (&o_fwd, lname, &buffer_defaults.vname); \ 1885 defvar_lisp_nopro (&o_fwd, lname, &buffer_defaults.vname ## _); \
1886 } while (0) 1886 } while (0)
1887 1887
1888#define DEFVAR_KBOARD(lname, vname, doc) \ 1888#define DEFVAR_KBOARD(lname, vname, doc) \
@@ -2047,11 +2047,11 @@ extern Lisp_Object case_temp2;
2047 2047
2048/* Current buffer's map from characters to lower-case characters. */ 2048/* Current buffer's map from characters to lower-case characters. */
2049 2049
2050#define DOWNCASE_TABLE current_buffer->downcase_table 2050#define DOWNCASE_TABLE B_ (current_buffer, downcase_table)
2051 2051
2052/* Current buffer's map from characters to upper-case characters. */ 2052/* Current buffer's map from characters to upper-case characters. */
2053 2053
2054#define UPCASE_TABLE current_buffer->upcase_table 2054#define UPCASE_TABLE B_ (current_buffer, upcase_table)
2055 2055
2056/* Downcase a character, or make no change if that cannot be done. */ 2056/* Downcase a character, or make no change if that cannot be done. */
2057 2057
diff --git a/src/lread.c b/src/lread.c
index f638aba211b..de9c5db95ad 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -210,7 +210,7 @@ readchar (Lisp_Object readcharfun, int *multibyte)
210 if (pt_byte >= BUF_ZV_BYTE (inbuffer)) 210 if (pt_byte >= BUF_ZV_BYTE (inbuffer))
211 return -1; 211 return -1;
212 212
213 if (! NILP (inbuffer->enable_multibyte_characters)) 213 if (! NILP (B_ (inbuffer, enable_multibyte_characters)))
214 { 214 {
215 /* Fetch the character code from the buffer. */ 215 /* Fetch the character code from the buffer. */
216 unsigned char *p = BUF_BYTE_ADDRESS (inbuffer, pt_byte); 216 unsigned char *p = BUF_BYTE_ADDRESS (inbuffer, pt_byte);
@@ -239,7 +239,7 @@ readchar (Lisp_Object readcharfun, int *multibyte)
239 if (bytepos >= BUF_ZV_BYTE (inbuffer)) 239 if (bytepos >= BUF_ZV_BYTE (inbuffer))
240 return -1; 240 return -1;
241 241
242 if (! NILP (inbuffer->enable_multibyte_characters)) 242 if (! NILP (B_ (inbuffer, enable_multibyte_characters)))
243 { 243 {
244 /* Fetch the character code from the buffer. */ 244 /* Fetch the character code from the buffer. */
245 unsigned char *p = BUF_BYTE_ADDRESS (inbuffer, bytepos); 245 unsigned char *p = BUF_BYTE_ADDRESS (inbuffer, bytepos);
@@ -371,7 +371,7 @@ unreadchar (Lisp_Object readcharfun, int c)
371 EMACS_INT bytepos = BUF_PT_BYTE (b); 371 EMACS_INT bytepos = BUF_PT_BYTE (b);
372 372
373 BUF_PT (b)--; 373 BUF_PT (b)--;
374 if (! NILP (b->enable_multibyte_characters)) 374 if (! NILP (B_ (b, enable_multibyte_characters)))
375 BUF_DEC_POS (b, bytepos); 375 BUF_DEC_POS (b, bytepos);
376 else 376 else
377 bytepos--; 377 bytepos--;
@@ -384,7 +384,7 @@ unreadchar (Lisp_Object readcharfun, int c)
384 EMACS_INT bytepos = XMARKER (readcharfun)->bytepos; 384 EMACS_INT bytepos = XMARKER (readcharfun)->bytepos;
385 385
386 XMARKER (readcharfun)->charpos--; 386 XMARKER (readcharfun)->charpos--;
387 if (! NILP (b->enable_multibyte_characters)) 387 if (! NILP (B_ (b, enable_multibyte_characters)))
388 BUF_DEC_POS (b, bytepos); 388 BUF_DEC_POS (b, bytepos);
389 else 389 else
390 bytepos--; 390 bytepos--;
@@ -1322,7 +1322,7 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, Lisp_Object *sto
1322 /* Of course, this could conceivably lose if luser sets 1322 /* Of course, this could conceivably lose if luser sets
1323 default-directory to be something non-absolute... */ 1323 default-directory to be something non-absolute... */
1324 { 1324 {
1325 filename = Fexpand_file_name (filename, current_buffer->directory); 1325 filename = Fexpand_file_name (filename, B_ (current_buffer, directory));
1326 if (!complete_filename_p (filename)) 1326 if (!complete_filename_p (filename))
1327 /* Give up on this path element! */ 1327 /* Give up on this path element! */
1328 continue; 1328 continue;
@@ -1581,7 +1581,7 @@ readevalloop (Lisp_Object readcharfun,
1581 { 1581 {
1582 int count1 = SPECPDL_INDEX (); 1582 int count1 = SPECPDL_INDEX ();
1583 1583
1584 if (b != 0 && NILP (b->name)) 1584 if (b != 0 && NILP (B_ (b, name)))
1585 error ("Reading from killed buffer"); 1585 error ("Reading from killed buffer");
1586 1586
1587 if (!NILP (start)) 1587 if (!NILP (start))
@@ -1721,7 +1721,7 @@ This function preserves the position of point. */)
1721 tem = printflag; 1721 tem = printflag;
1722 1722
1723 if (NILP (filename)) 1723 if (NILP (filename))
1724 filename = XBUFFER (buf)->filename; 1724 filename = B_ (XBUFFER (buf), filename);
1725 1725
1726 specbind (Qeval_buffer_list, Fcons (buf, Veval_buffer_list)); 1726 specbind (Qeval_buffer_list, Fcons (buf, Veval_buffer_list));
1727 specbind (Qstandard_output, tem); 1727 specbind (Qstandard_output, tem);
@@ -1761,7 +1761,7 @@ This function does not move point. */)
1761 specbind (Qeval_buffer_list, Fcons (cbuf, Veval_buffer_list)); 1761 specbind (Qeval_buffer_list, Fcons (cbuf, Veval_buffer_list));
1762 1762
1763 /* readevalloop calls functions which check the type of start and end. */ 1763 /* readevalloop calls functions which check the type of start and end. */
1764 readevalloop (cbuf, 0, XBUFFER (cbuf)->filename, Feval, 1764 readevalloop (cbuf, 0, B_ (XBUFFER (cbuf), filename), Feval,
1765 !NILP (printflag), Qnil, read_function, 1765 !NILP (printflag), Qnil, read_function,
1766 start, end); 1766 start, end);
1767 1767
diff --git a/src/marker.c b/src/marker.c
index 1e0e1404fdb..9b841835646 100644
--- a/src/marker.c
+++ b/src/marker.c
@@ -439,7 +439,7 @@ Returns nil if MARKER points into a dead buffer. */)
439 does not preserve the buffer from being GC'd (it's weak), so 439 does not preserve the buffer from being GC'd (it's weak), so
440 markers have to be unlinked from their buffer as soon as the buffer 440 markers have to be unlinked from their buffer as soon as the buffer
441 is killed. */ 441 is killed. */
442 eassert (!NILP (XBUFFER (buf)->name)); 442 eassert (!NILP (B_ (XBUFFER (buf), name)));
443 return buf; 443 return buf;
444 } 444 }
445 return Qnil; 445 return Qnil;
@@ -488,7 +488,7 @@ Returns MARKER. */)
488 CHECK_BUFFER (buffer); 488 CHECK_BUFFER (buffer);
489 b = XBUFFER (buffer); 489 b = XBUFFER (buffer);
490 /* If buffer is dead, set marker to point nowhere. */ 490 /* If buffer is dead, set marker to point nowhere. */
491 if (EQ (b->name, Qnil)) 491 if (EQ (B_ (b, name), Qnil))
492 { 492 {
493 unchain_marker (m); 493 unchain_marker (m);
494 return marker; 494 return marker;
@@ -563,7 +563,7 @@ set_marker_restricted (Lisp_Object marker, Lisp_Object pos, Lisp_Object buffer)
563 CHECK_BUFFER (buffer); 563 CHECK_BUFFER (buffer);
564 b = XBUFFER (buffer); 564 b = XBUFFER (buffer);
565 /* If buffer is dead, set marker to point nowhere. */ 565 /* If buffer is dead, set marker to point nowhere. */
566 if (EQ (b->name, Qnil)) 566 if (EQ (B_ (b, name), Qnil))
567 { 567 {
568 unchain_marker (m); 568 unchain_marker (m);
569 return marker; 569 return marker;
@@ -628,7 +628,7 @@ set_marker_both (Lisp_Object marker, Lisp_Object buffer, EMACS_INT charpos, EMAC
628 CHECK_BUFFER (buffer); 628 CHECK_BUFFER (buffer);
629 b = XBUFFER (buffer); 629 b = XBUFFER (buffer);
630 /* If buffer is dead, set marker to point nowhere. */ 630 /* If buffer is dead, set marker to point nowhere. */
631 if (EQ (b->name, Qnil)) 631 if (EQ (B_ (b, name), Qnil))
632 { 632 {
633 unchain_marker (m); 633 unchain_marker (m);
634 return marker; 634 return marker;
@@ -676,7 +676,7 @@ set_marker_restricted_both (Lisp_Object marker, Lisp_Object buffer, EMACS_INT ch
676 CHECK_BUFFER (buffer); 676 CHECK_BUFFER (buffer);
677 b = XBUFFER (buffer); 677 b = XBUFFER (buffer);
678 /* If buffer is dead, set marker to point nowhere. */ 678 /* If buffer is dead, set marker to point nowhere. */
679 if (EQ (b->name, Qnil)) 679 if (EQ (B_ (b, name), Qnil))
680 { 680 {
681 unchain_marker (m); 681 unchain_marker (m);
682 return marker; 682 return marker;
@@ -731,7 +731,7 @@ unchain_marker (register struct Lisp_Marker *marker)
731 if (b == 0) 731 if (b == 0)
732 return; 732 return;
733 733
734 if (EQ (b->name, Qnil)) 734 if (EQ (B_ (b, name), Qnil))
735 abort (); 735 abort ();
736 736
737 marker->buffer = 0; 737 marker->buffer = 0;
diff --git a/src/minibuf.c b/src/minibuf.c
index ec243daac19..3ed8630c845 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -415,7 +415,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
415 CHECK_STRING (initial); 415 CHECK_STRING (initial);
416 } 416 }
417 val = Qnil; 417 val = Qnil;
418 ambient_dir = current_buffer->directory; 418 ambient_dir = B_ (current_buffer, directory);
419 input_method = Qnil; 419 input_method = Qnil;
420 enable_multibyte = Qnil; 420 enable_multibyte = Qnil;
421 421
@@ -525,7 +525,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
525 /* `current-input-method' is buffer local. So, remember it in 525 /* `current-input-method' is buffer local. So, remember it in
526 INPUT_METHOD before changing the current buffer. */ 526 INPUT_METHOD before changing the current buffer. */
527 input_method = Fsymbol_value (Qcurrent_input_method); 527 input_method = Fsymbol_value (Qcurrent_input_method);
528 enable_multibyte = current_buffer->enable_multibyte_characters; 528 enable_multibyte = B_ (current_buffer, enable_multibyte_characters);
529 } 529 }
530 530
531 /* Switch to the minibuffer. */ 531 /* Switch to the minibuffer. */
@@ -535,7 +535,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
535 535
536 /* If appropriate, copy enable-multibyte-characters into the minibuffer. */ 536 /* If appropriate, copy enable-multibyte-characters into the minibuffer. */
537 if (inherit_input_method) 537 if (inherit_input_method)
538 current_buffer->enable_multibyte_characters = enable_multibyte; 538 B_ (current_buffer, enable_multibyte_characters) = enable_multibyte;
539 539
540 /* The current buffer's default directory is usually the right thing 540 /* The current buffer's default directory is usually the right thing
541 for our minibuffer here. However, if you're typing a command at 541 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,
546 you think of something better to do? Find another buffer with a 546 you think of something better to do? Find another buffer with a
547 better directory, and use that one instead. */ 547 better directory, and use that one instead. */
548 if (STRINGP (ambient_dir)) 548 if (STRINGP (ambient_dir))
549 current_buffer->directory = ambient_dir; 549 B_ (current_buffer, directory) = ambient_dir;
550 else 550 else
551 { 551 {
552 Lisp_Object buf_list; 552 Lisp_Object buf_list;
@@ -558,9 +558,9 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
558 Lisp_Object other_buf; 558 Lisp_Object other_buf;
559 559
560 other_buf = XCDR (XCAR (buf_list)); 560 other_buf = XCDR (XCAR (buf_list));
561 if (STRINGP (XBUFFER (other_buf)->directory)) 561 if (STRINGP (B_ (XBUFFER (other_buf), directory)))
562 { 562 {
563 current_buffer->directory = XBUFFER (other_buf)->directory; 563 B_ (current_buffer, directory) = B_ (XBUFFER (other_buf), directory);
564 break; 564 break;
565 } 565 }
566 } 566 }
@@ -603,7 +603,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
603 specbind (Qinhibit_modification_hooks, Qt); 603 specbind (Qinhibit_modification_hooks, Qt);
604 Ferase_buffer (); 604 Ferase_buffer ();
605 605
606 if (!NILP (current_buffer->enable_multibyte_characters) 606 if (!NILP (B_ (current_buffer, enable_multibyte_characters))
607 && ! STRING_MULTIBYTE (minibuf_prompt)) 607 && ! STRING_MULTIBYTE (minibuf_prompt))
608 minibuf_prompt = Fstring_make_multibyte (minibuf_prompt); 608 minibuf_prompt = Fstring_make_multibyte (minibuf_prompt);
609 609
@@ -633,7 +633,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
633 } 633 }
634 634
635 clear_message (1, 1); 635 clear_message (1, 1);
636 current_buffer->keymap = map; 636 B_ (current_buffer, keymap) = map;
637 637
638 /* Turn on an input method stored in INPUT_METHOD if any. */ 638 /* Turn on an input method stored in INPUT_METHOD if any. */
639 if (STRINGP (input_method) && !NILP (Ffboundp (Qactivate_input_method))) 639 if (STRINGP (input_method) && !NILP (Ffboundp (Qactivate_input_method)))
@@ -647,7 +647,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
647 call1 (Vrun_hooks, Qminibuffer_setup_hook); 647 call1 (Vrun_hooks, Qminibuffer_setup_hook);
648 648
649 /* Don't allow the user to undo past this point. */ 649 /* Don't allow the user to undo past this point. */
650 current_buffer->undo_list = Qnil; 650 B_ (current_buffer, undo_list) = Qnil;
651 651
652 recursive_edit_1 (); 652 recursive_edit_1 ();
653 653
@@ -764,7 +764,7 @@ get_minibuffer (int depth)
764 Vminibuffer_list = nconc2 (Vminibuffer_list, tail); 764 Vminibuffer_list = nconc2 (Vminibuffer_list, tail);
765 } 765 }
766 buf = Fcar (tail); 766 buf = Fcar (tail);
767 if (NILP (buf) || NILP (XBUFFER (buf)->name)) 767 if (NILP (buf) || NILP (B_ (XBUFFER (buf), name)))
768 { 768 {
769 sprintf (name, " *Minibuf-%d*", depth); 769 sprintf (name, " *Minibuf-%d*", depth);
770 buf = Fget_buffer_create (build_string (name)); 770 buf = Fget_buffer_create (build_string (name));
@@ -1096,7 +1096,7 @@ function, instead of the usual behavior. */)
1096 int count = SPECPDL_INDEX (); 1096 int count = SPECPDL_INDEX ();
1097 1097
1098 if (BUFFERP (def)) 1098 if (BUFFERP (def))
1099 def = XBUFFER (def)->name; 1099 def = B_ (XBUFFER (def), name);
1100 1100
1101 specbind (Qcompletion_ignore_case, 1101 specbind (Qcompletion_ignore_case,
1102 read_buffer_completion_ignore_case ? Qt : Qnil); 1102 read_buffer_completion_ignore_case ? Qt : Qnil);
diff --git a/src/msdos.c b/src/msdos.c
index eb73f54838d..d37200e700a 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -1317,12 +1317,12 @@ IT_frame_up_to_date (struct frame *f)
1317 { 1317 {
1318 struct buffer *b = XBUFFER (sw->buffer); 1318 struct buffer *b = XBUFFER (sw->buffer);
1319 1319
1320 if (EQ (b->cursor_type, Qt)) 1320 if (EQ (B_ (b,cursor_type), Qt))
1321 new_cursor = frame_desired_cursor; 1321 new_cursor = frame_desired_cursor;
1322 else if (NILP (b->cursor_type)) /* nil means no cursor */ 1322 else if (NILP (B_ (b, cursor_type))) /* nil means no cursor */
1323 new_cursor = Fcons (Qbar, make_number (0)); 1323 new_cursor = Fcons (Qbar, make_number (0));
1324 else 1324 else
1325 new_cursor = b->cursor_type; 1325 new_cursor = B_ (b, cursor_type);
1326 } 1326 }
1327 1327
1328 IT_set_cursor_type (f, new_cursor); 1328 IT_set_cursor_type (f, new_cursor);
diff --git a/src/nsfns.m b/src/nsfns.m
index f1bf8b65727..c480c834602 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -605,8 +605,8 @@ ns_set_name_as_filename (struct frame *f)
605 605
606 BLOCK_INPUT; 606 BLOCK_INPUT;
607 pool = [[NSAutoreleasePool alloc] init]; 607 pool = [[NSAutoreleasePool alloc] init];
608 filename = XBUFFER (buf)->filename; 608 filename = B_ (XBUFFER (buf), filename);
609 name = XBUFFER (buf)->name; 609 name = B_ (XBUFFER (buf), name);
610 610
611 if (NILP (name)) 611 if (NILP (name))
612 { 612 {
@@ -1428,7 +1428,7 @@ Optional arg INIT, if non-nil, provides a default file name to use. */)
1428 NSString *promptS = NILP (prompt) || !STRINGP (prompt) ? nil : 1428 NSString *promptS = NILP (prompt) || !STRINGP (prompt) ? nil :
1429 [NSString stringWithUTF8String: SDATA (prompt)]; 1429 [NSString stringWithUTF8String: SDATA (prompt)];
1430 NSString *dirS = NILP (dir) || !STRINGP (dir) ? 1430 NSString *dirS = NILP (dir) || !STRINGP (dir) ?
1431 [NSString stringWithUTF8String: SDATA (current_buffer->directory)] : 1431 [NSString stringWithUTF8String: SDATA (B_ (current_buffer, directory))] :
1432 [NSString stringWithUTF8String: SDATA (dir)]; 1432 [NSString stringWithUTF8String: SDATA (dir)];
1433 NSString *initS = NILP (init) || !STRINGP (init) ? nil : 1433 NSString *initS = NILP (init) || !STRINGP (init) ? nil :
1434 [NSString stringWithUTF8String: SDATA (init)]; 1434 [NSString stringWithUTF8String: SDATA (init)];
diff --git a/src/nsterm.m b/src/nsterm.m
index e83b14748df..590a76ba16d 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -5783,6 +5783,7 @@ ns_term_shutdown (int sig)
5783 win = nwin; 5783 win = nwin;
5784 condemned = NO; 5784 condemned = NO;
5785 pixel_height = NSHeight (r); 5785 pixel_height = NSHeight (r);
5786 if (pixel_height == 0) pixel_height = 1;
5786 min_portion = 20 / pixel_height; 5787 min_portion = 20 / pixel_height;
5787 5788
5788 frame = XFRAME (XWINDOW (win)->frame); 5789 frame = XFRAME (XWINDOW (win)->frame);
@@ -5812,6 +5813,7 @@ ns_term_shutdown (int sig)
5812 NSTRACE (EmacsScroller_setFrame); 5813 NSTRACE (EmacsScroller_setFrame);
5813/* BLOCK_INPUT; */ 5814/* BLOCK_INPUT; */
5814 pixel_height = NSHeight (newRect); 5815 pixel_height = NSHeight (newRect);
5816 if (pixel_height == 0) pixel_height = 1;
5815 min_portion = 20 / pixel_height; 5817 min_portion = 20 / pixel_height;
5816 [super setFrame: newRect]; 5818 [super setFrame: newRect];
5817 [self display]; 5819 [self display];
diff --git a/src/print.c b/src/print.c
index f47b71087f4..beb14a8b679 100644
--- a/src/print.c
+++ b/src/print.c
@@ -111,7 +111,7 @@ int print_output_debug_flag EXTERNALLY_VISIBLE = 1;
111 EMACS_INT old_point_byte = -1, start_point_byte = -1; \ 111 EMACS_INT old_point_byte = -1, start_point_byte = -1; \
112 int specpdl_count = SPECPDL_INDEX (); \ 112 int specpdl_count = SPECPDL_INDEX (); \
113 int free_print_buffer = 0; \ 113 int free_print_buffer = 0; \
114 int multibyte = !NILP (current_buffer->enable_multibyte_characters); \ 114 int multibyte = !NILP (B_ (current_buffer, enable_multibyte_characters)); \
115 Lisp_Object original 115 Lisp_Object original
116 116
117#define PRINTPREPARE \ 117#define PRINTPREPARE \
@@ -144,10 +144,10 @@ int print_output_debug_flag EXTERNALLY_VISIBLE = 1;
144 if (NILP (printcharfun)) \ 144 if (NILP (printcharfun)) \
145 { \ 145 { \
146 Lisp_Object string; \ 146 Lisp_Object string; \
147 if (NILP (current_buffer->enable_multibyte_characters) \ 147 if (NILP (B_ (current_buffer, enable_multibyte_characters)) \
148 && ! print_escape_multibyte) \ 148 && ! print_escape_multibyte) \
149 specbind (Qprint_escape_multibyte, Qt); \ 149 specbind (Qprint_escape_multibyte, Qt); \
150 if (! NILP (current_buffer->enable_multibyte_characters) \ 150 if (! NILP (B_ (current_buffer, enable_multibyte_characters)) \
151 && ! print_escape_nonascii) \ 151 && ! print_escape_nonascii) \
152 specbind (Qprint_escape_nonascii, Qt); \ 152 specbind (Qprint_escape_nonascii, Qt); \
153 if (print_buffer != 0) \ 153 if (print_buffer != 0) \
@@ -173,7 +173,7 @@ int print_output_debug_flag EXTERNALLY_VISIBLE = 1;
173 if (NILP (printcharfun)) \ 173 if (NILP (printcharfun)) \
174 { \ 174 { \
175 if (print_buffer_pos != print_buffer_pos_byte \ 175 if (print_buffer_pos != print_buffer_pos_byte \
176 && NILP (current_buffer->enable_multibyte_characters)) \ 176 && NILP (B_ (current_buffer, enable_multibyte_characters))) \
177 { \ 177 { \
178 unsigned char *temp \ 178 unsigned char *temp \
179 = (unsigned char *) alloca (print_buffer_pos + 1); \ 179 = (unsigned char *) alloca (print_buffer_pos + 1); \
@@ -250,7 +250,7 @@ printchar (unsigned int ch, Lisp_Object fun)
250 else 250 else
251 { 251 {
252 int multibyte_p 252 int multibyte_p
253 = !NILP (current_buffer->enable_multibyte_characters); 253 = !NILP (B_ (current_buffer, enable_multibyte_characters));
254 254
255 setup_echo_area_for_printing (multibyte_p); 255 setup_echo_area_for_printing (multibyte_p);
256 insert_char (ch); 256 insert_char (ch);
@@ -302,7 +302,7 @@ strout (const char *ptr, EMACS_INT size, EMACS_INT size_byte,
302 job. */ 302 job. */
303 int i; 303 int i;
304 int multibyte_p 304 int multibyte_p
305 = !NILP (current_buffer->enable_multibyte_characters); 305 = !NILP (B_ (current_buffer, enable_multibyte_characters));
306 306
307 setup_echo_area_for_printing (multibyte_p); 307 setup_echo_area_for_printing (multibyte_p);
308 message_dolog (ptr, size_byte, 0, multibyte_p); 308 message_dolog (ptr, size_byte, 0, multibyte_p);
@@ -371,8 +371,8 @@ print_string (Lisp_Object string, Lisp_Object printcharfun)
371 chars = SCHARS (string); 371 chars = SCHARS (string);
372 else if (! print_escape_nonascii 372 else if (! print_escape_nonascii
373 && (EQ (printcharfun, Qt) 373 && (EQ (printcharfun, Qt)
374 ? ! NILP (buffer_defaults.enable_multibyte_characters) 374 ? ! NILP (B_ (&buffer_defaults, enable_multibyte_characters))
375 : ! NILP (current_buffer->enable_multibyte_characters))) 375 : ! NILP (B_ (current_buffer, enable_multibyte_characters))))
376 { 376 {
377 /* If unibyte string STRING contains 8-bit codes, we must 377 /* If unibyte string STRING contains 8-bit codes, we must
378 convert STRING to a multibyte string containing the same 378 convert STRING to a multibyte string containing the same
@@ -504,14 +504,14 @@ temp_output_buffer_setup (const char *bufname)
504 504
505 Fkill_all_local_variables (); 505 Fkill_all_local_variables ();
506 delete_all_overlays (current_buffer); 506 delete_all_overlays (current_buffer);
507 current_buffer->directory = old->directory; 507 B_ (current_buffer, directory) = B_ (old, directory);
508 current_buffer->read_only = Qnil; 508 B_ (current_buffer, read_only) = Qnil;
509 current_buffer->filename = Qnil; 509 B_ (current_buffer, filename) = Qnil;
510 current_buffer->undo_list = Qt; 510 B_ (current_buffer, undo_list) = Qt;
511 eassert (current_buffer->overlays_before == NULL); 511 eassert (current_buffer->overlays_before == NULL);
512 eassert (current_buffer->overlays_after == NULL); 512 eassert (current_buffer->overlays_after == NULL);
513 current_buffer->enable_multibyte_characters 513 B_ (current_buffer, enable_multibyte_characters)
514 = buffer_defaults.enable_multibyte_characters; 514 = B_ (&buffer_defaults, enable_multibyte_characters);
515 specbind (Qinhibit_read_only, Qt); 515 specbind (Qinhibit_read_only, Qt);
516 specbind (Qinhibit_modification_hooks, Qt); 516 specbind (Qinhibit_modification_hooks, Qt);
517 Ferase_buffer (); 517 Ferase_buffer ();
@@ -1062,7 +1062,10 @@ float_to_string (char *buf, double data)
1062 { 1062 {
1063 /* Generate the fewest number of digits that represent the 1063 /* Generate the fewest number of digits that represent the
1064 floating point value without losing information. */ 1064 floating point value without losing information. */
1065 dtoastr (buf, FLOAT_TO_STRING_BUFSIZE, 0, 0, data); 1065 dtoastr (buf, FLOAT_TO_STRING_BUFSIZE - 2, 0, 0, data);
1066 /* The decimal point must be printed, or the byte compiler can
1067 get confused (Bug#8033). */
1068 width = 1;
1066 } 1069 }
1067 else /* oink oink */ 1070 else /* oink oink */
1068 { 1071 {
@@ -1117,8 +1120,7 @@ float_to_string (char *buf, double data)
1117 cp[1] = '0'; 1120 cp[1] = '0';
1118 cp[2] = 0; 1121 cp[2] = 0;
1119 } 1122 }
1120 1123 else if (*cp == 0)
1121 if (*cp == 0)
1122 { 1124 {
1123 *cp++ = '.'; 1125 *cp++ = '.';
1124 *cp++ = '0'; 1126 *cp++ = '0';
@@ -1854,7 +1856,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1854 if (!NILP (XWINDOW (obj)->buffer)) 1856 if (!NILP (XWINDOW (obj)->buffer))
1855 { 1857 {
1856 strout (" on ", -1, -1, printcharfun, 0); 1858 strout (" on ", -1, -1, printcharfun, 0);
1857 print_string (XBUFFER (XWINDOW (obj)->buffer)->name, printcharfun); 1859 print_string (B_ (XBUFFER (XWINDOW (obj)->buffer), name), printcharfun);
1858 } 1860 }
1859 PRINTCHAR ('>'); 1861 PRINTCHAR ('>');
1860 } 1862 }
@@ -1955,16 +1957,16 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1955 } 1957 }
1956 else if (BUFFERP (obj)) 1958 else if (BUFFERP (obj))
1957 { 1959 {
1958 if (NILP (XBUFFER (obj)->name)) 1960 if (NILP (B_ (XBUFFER (obj), name)))
1959 strout ("#<killed buffer>", -1, -1, printcharfun, 0); 1961 strout ("#<killed buffer>", -1, -1, printcharfun, 0);
1960 else if (escapeflag) 1962 else if (escapeflag)
1961 { 1963 {
1962 strout ("#<buffer ", -1, -1, printcharfun, 0); 1964 strout ("#<buffer ", -1, -1, printcharfun, 0);
1963 print_string (XBUFFER (obj)->name, printcharfun); 1965 print_string (B_ (XBUFFER (obj), name), printcharfun);
1964 PRINTCHAR ('>'); 1966 PRINTCHAR ('>');
1965 } 1967 }
1966 else 1968 else
1967 print_string (XBUFFER (obj)->name, printcharfun); 1969 print_string (B_ (XBUFFER (obj), name), printcharfun);
1968 } 1970 }
1969 else if (WINDOW_CONFIGURATIONP (obj)) 1971 else if (WINDOW_CONFIGURATIONP (obj))
1970 { 1972 {
@@ -2076,7 +2078,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
2076 sprintf (buf, "at %ld", (long)marker_position (obj)); 2078 sprintf (buf, "at %ld", (long)marker_position (obj));
2077 strout (buf, -1, -1, printcharfun, 0); 2079 strout (buf, -1, -1, printcharfun, 0);
2078 strout (" in ", -1, -1, printcharfun, 0); 2080 strout (" in ", -1, -1, printcharfun, 0);
2079 print_string (XMARKER (obj)->buffer->name, printcharfun); 2081 print_string (B_ (XMARKER (obj)->buffer, name), printcharfun);
2080 } 2082 }
2081 PRINTCHAR ('>'); 2083 PRINTCHAR ('>');
2082 break; 2084 break;
@@ -2091,7 +2093,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
2091 (long)marker_position (OVERLAY_START (obj)), 2093 (long)marker_position (OVERLAY_START (obj)),
2092 (long)marker_position (OVERLAY_END (obj))); 2094 (long)marker_position (OVERLAY_END (obj)));
2093 strout (buf, -1, -1, printcharfun, 0); 2095 strout (buf, -1, -1, printcharfun, 0);
2094 print_string (XMARKER (OVERLAY_START (obj))->buffer->name, 2096 print_string (B_ (XMARKER (OVERLAY_START (obj))->buffer, name),
2095 printcharfun); 2097 printcharfun);
2096 } 2098 }
2097 PRINTCHAR ('>'); 2099 PRINTCHAR ('>');
diff --git a/src/process.c b/src/process.c
index d026b9d030b..ec929a919f8 100644
--- a/src/process.c
+++ b/src/process.c
@@ -719,7 +719,7 @@ get_process (register Lisp_Object name)
719 { 719 {
720 proc = Fget_buffer_process (obj); 720 proc = Fget_buffer_process (obj);
721 if (NILP (proc)) 721 if (NILP (proc))
722 error ("Buffer %s has no process", SDATA (XBUFFER (obj)->name)); 722 error ("Buffer %s has no process", SDATA (B_ (XBUFFER (obj), name)));
723 } 723 }
724 else 724 else
725 { 725 {
@@ -1283,12 +1283,12 @@ list_processes_1 (Lisp_Object query_only)
1283 w_proc = i; 1283 w_proc = i;
1284 if (!NILP (p->buffer)) 1284 if (!NILP (p->buffer))
1285 { 1285 {
1286 if (NILP (XBUFFER (p->buffer)->name)) 1286 if (NILP (B_ (XBUFFER (p->buffer), name)))
1287 { 1287 {
1288 if (w_buffer < 8) 1288 if (w_buffer < 8)
1289 w_buffer = 8; /* (Killed) */ 1289 w_buffer = 8; /* (Killed) */
1290 } 1290 }
1291 else if ((i = SCHARS (XBUFFER (p->buffer)->name), (i > w_buffer))) 1291 else if ((i = SCHARS (B_ (XBUFFER (p->buffer), name)), (i > w_buffer)))
1292 w_buffer = i; 1292 w_buffer = i;
1293 } 1293 }
1294 if (STRINGP (p->tty_name) 1294 if (STRINGP (p->tty_name)
@@ -1312,9 +1312,9 @@ list_processes_1 (Lisp_Object query_only)
1312 XSETFASTINT (minspace, 1); 1312 XSETFASTINT (minspace, 1);
1313 1313
1314 set_buffer_internal (XBUFFER (Vstandard_output)); 1314 set_buffer_internal (XBUFFER (Vstandard_output));
1315 current_buffer->undo_list = Qt; 1315 B_ (current_buffer, undo_list) = Qt;
1316 1316
1317 current_buffer->truncate_lines = Qt; 1317 B_ (current_buffer, truncate_lines) = Qt;
1318 1318
1319 write_string ("Proc", -1); 1319 write_string ("Proc", -1);
1320 Findent_to (i_status, minspace); write_string ("Status", -1); 1320 Findent_to (i_status, minspace); write_string ("Status", -1);
@@ -1397,10 +1397,10 @@ list_processes_1 (Lisp_Object query_only)
1397 Findent_to (i_buffer, minspace); 1397 Findent_to (i_buffer, minspace);
1398 if (NILP (p->buffer)) 1398 if (NILP (p->buffer))
1399 insert_string ("(none)"); 1399 insert_string ("(none)");
1400 else if (NILP (XBUFFER (p->buffer)->name)) 1400 else if (NILP (B_ (XBUFFER (p->buffer), name)))
1401 insert_string ("(Killed)"); 1401 insert_string ("(Killed)");
1402 else 1402 else
1403 Finsert (1, &XBUFFER (p->buffer)->name); 1403 Finsert (1, &B_ (XBUFFER (p->buffer), name));
1404 1404
1405 if (!NILP (i_tty)) 1405 if (!NILP (i_tty))
1406 { 1406 {
@@ -1548,7 +1548,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1548 { 1548 {
1549 struct gcpro gcpro1, gcpro2; 1549 struct gcpro gcpro1, gcpro2;
1550 1550
1551 current_dir = current_buffer->directory; 1551 current_dir = B_ (current_buffer, directory);
1552 1552
1553 GCPRO2 (buffer, current_dir); 1553 GCPRO2 (buffer, current_dir);
1554 1554
@@ -1560,7 +1560,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1560 current_dir = expand_and_dir_to_file (current_dir, Qnil); 1560 current_dir = expand_and_dir_to_file (current_dir, Qnil);
1561 if (NILP (Ffile_accessible_directory_p (current_dir))) 1561 if (NILP (Ffile_accessible_directory_p (current_dir)))
1562 report_file_error ("Setting current directory", 1562 report_file_error ("Setting current directory",
1563 Fcons (current_buffer->directory, Qnil)); 1563 Fcons (B_ (current_buffer, directory), Qnil));
1564 1564
1565 UNGCPRO; 1565 UNGCPRO;
1566 } 1566 }
@@ -2056,7 +2056,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
2056 2056
2057 signal (SIGINT, SIG_DFL); 2057 signal (SIGINT, SIG_DFL);
2058 signal (SIGQUIT, SIG_DFL); 2058 signal (SIGQUIT, SIG_DFL);
2059 /* GTK causes us to ignore SIGPIPE, make sure it is restored 2059 /* GConf causes us to ignore SIGPIPE, make sure it is restored
2060 in the child. */ 2060 in the child. */
2061 signal (SIGPIPE, SIG_DFL); 2061 signal (SIGPIPE, SIG_DFL);
2062 2062
@@ -2898,8 +2898,8 @@ usage: (make-serial-process &rest ARGS) */)
2898 } 2898 }
2899 else if (!NILP (Vcoding_system_for_read)) 2899 else if (!NILP (Vcoding_system_for_read))
2900 val = Vcoding_system_for_read; 2900 val = Vcoding_system_for_read;
2901 else if ((!NILP (buffer) && NILP (XBUFFER (buffer)->enable_multibyte_characters)) 2901 else if ((!NILP (buffer) && NILP (B_ (XBUFFER (buffer), enable_multibyte_characters)))
2902 || (NILP (buffer) && NILP (buffer_defaults.enable_multibyte_characters))) 2902 || (NILP (buffer) && NILP (B_ (&buffer_defaults, enable_multibyte_characters))))
2903 val = Qnil; 2903 val = Qnil;
2904 p->decode_coding_system = val; 2904 p->decode_coding_system = val;
2905 2905
@@ -2912,8 +2912,8 @@ usage: (make-serial-process &rest ARGS) */)
2912 } 2912 }
2913 else if (!NILP (Vcoding_system_for_write)) 2913 else if (!NILP (Vcoding_system_for_write))
2914 val = Vcoding_system_for_write; 2914 val = Vcoding_system_for_write;
2915 else if ((!NILP (buffer) && NILP (XBUFFER (buffer)->enable_multibyte_characters)) 2915 else if ((!NILP (buffer) && NILP (B_ (XBUFFER (buffer), enable_multibyte_characters)))
2916 || (NILP (buffer) && NILP (buffer_defaults.enable_multibyte_characters))) 2916 || (NILP (buffer) && NILP (B_ (&buffer_defaults, enable_multibyte_characters))))
2917 val = Qnil; 2917 val = Qnil;
2918 p->encode_coding_system = val; 2918 p->encode_coding_system = val;
2919 2919
@@ -3723,8 +3723,8 @@ usage: (make-network-process &rest ARGS) */)
3723 } 3723 }
3724 else if (!NILP (Vcoding_system_for_read)) 3724 else if (!NILP (Vcoding_system_for_read))
3725 val = Vcoding_system_for_read; 3725 val = Vcoding_system_for_read;
3726 else if ((!NILP (buffer) && NILP (XBUFFER (buffer)->enable_multibyte_characters)) 3726 else if ((!NILP (buffer) && NILP (B_ (XBUFFER (buffer), enable_multibyte_characters)))
3727 || (NILP (buffer) && NILP (buffer_defaults.enable_multibyte_characters))) 3727 || (NILP (buffer) && NILP (B_ (&buffer_defaults, enable_multibyte_characters))))
3728 /* We dare not decode end-of-line format by setting VAL to 3728 /* We dare not decode end-of-line format by setting VAL to
3729 Qraw_text, because the existing Emacs Lisp libraries 3729 Qraw_text, because the existing Emacs Lisp libraries
3730 assume that they receive bare code including a sequene of 3730 assume that they receive bare code including a sequene of
@@ -3759,7 +3759,7 @@ usage: (make-network-process &rest ARGS) */)
3759 } 3759 }
3760 else if (!NILP (Vcoding_system_for_write)) 3760 else if (!NILP (Vcoding_system_for_write))
3761 val = Vcoding_system_for_write; 3761 val = Vcoding_system_for_write;
3762 else if (NILP (current_buffer->enable_multibyte_characters)) 3762 else if (NILP (B_ (current_buffer, enable_multibyte_characters)))
3763 val = Qnil; 3763 val = Qnil;
3764 else 3764 else
3765 { 3765 {
@@ -5268,7 +5268,7 @@ read_process_output (Lisp_Object proc, register int channel)
5268 /* No need to gcpro these, because all we do with them later 5268 /* No need to gcpro these, because all we do with them later
5269 is test them for EQness, and none of them should be a string. */ 5269 is test them for EQness, and none of them should be a string. */
5270 XSETBUFFER (obuffer, current_buffer); 5270 XSETBUFFER (obuffer, current_buffer);
5271 okeymap = current_buffer->keymap; 5271 okeymap = B_ (current_buffer, keymap);
5272 5272
5273 /* We inhibit quit here instead of just catching it so that 5273 /* We inhibit quit here instead of just catching it so that
5274 hitting ^G when a filter happens to be running won't screw 5274 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)
5359 } 5359 }
5360 5360
5361 /* If no filter, write into buffer if it isn't dead. */ 5361 /* If no filter, write into buffer if it isn't dead. */
5362 else if (!NILP (p->buffer) && !NILP (XBUFFER (p->buffer)->name)) 5362 else if (!NILP (p->buffer) && !NILP (B_ (XBUFFER (p->buffer), name)))
5363 { 5363 {
5364 Lisp_Object old_read_only; 5364 Lisp_Object old_read_only;
5365 EMACS_INT old_begv, old_zv; 5365 EMACS_INT old_begv, old_zv;
@@ -5372,13 +5372,13 @@ read_process_output (Lisp_Object proc, register int channel)
5372 Fset_buffer (p->buffer); 5372 Fset_buffer (p->buffer);
5373 opoint = PT; 5373 opoint = PT;
5374 opoint_byte = PT_BYTE; 5374 opoint_byte = PT_BYTE;
5375 old_read_only = current_buffer->read_only; 5375 old_read_only = B_ (current_buffer, read_only);
5376 old_begv = BEGV; 5376 old_begv = BEGV;
5377 old_zv = ZV; 5377 old_zv = ZV;
5378 old_begv_byte = BEGV_BYTE; 5378 old_begv_byte = BEGV_BYTE;
5379 old_zv_byte = ZV_BYTE; 5379 old_zv_byte = ZV_BYTE;
5380 5380
5381 current_buffer->read_only = Qnil; 5381 B_ (current_buffer, read_only) = Qnil;
5382 5382
5383 /* Insert new output into buffer 5383 /* Insert new output into buffer
5384 at the current end-of-output marker, 5384 at the current end-of-output marker,
@@ -5423,7 +5423,7 @@ read_process_output (Lisp_Object proc, register int channel)
5423 p->decoding_carryover = coding->carryover_bytes; 5423 p->decoding_carryover = coding->carryover_bytes;
5424 } 5424 }
5425 /* Adjust the multibyteness of TEXT to that of the buffer. */ 5425 /* Adjust the multibyteness of TEXT to that of the buffer. */
5426 if (NILP (current_buffer->enable_multibyte_characters) 5426 if (NILP (B_ (current_buffer, enable_multibyte_characters))
5427 != ! STRING_MULTIBYTE (text)) 5427 != ! STRING_MULTIBYTE (text))
5428 text = (STRING_MULTIBYTE (text) 5428 text = (STRING_MULTIBYTE (text)
5429 ? Fstring_as_unibyte (text) 5429 ? Fstring_as_unibyte (text)
@@ -5467,7 +5467,7 @@ read_process_output (Lisp_Object proc, register int channel)
5467 Fnarrow_to_region (make_number (old_begv), make_number (old_zv)); 5467 Fnarrow_to_region (make_number (old_begv), make_number (old_zv));
5468 5468
5469 5469
5470 current_buffer->read_only = old_read_only; 5470 B_ (current_buffer, read_only) = old_read_only;
5471 SET_PT_BOTH (opoint, opoint_byte); 5471 SET_PT_BOTH (opoint, opoint_byte);
5472 } 5472 }
5473 /* Handling the process output should not deactivate the mark. */ 5473 /* Handling the process output should not deactivate the mark. */
@@ -5525,7 +5525,7 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
5525 5525
5526 if ((STRINGP (object) && STRING_MULTIBYTE (object)) 5526 if ((STRINGP (object) && STRING_MULTIBYTE (object))
5527 || (BUFFERP (object) 5527 || (BUFFERP (object)
5528 && !NILP (XBUFFER (object)->enable_multibyte_characters)) 5528 && !NILP (B_ (XBUFFER (object), enable_multibyte_characters)))
5529 || EQ (object, Qt)) 5529 || EQ (object, Qt))
5530 { 5530 {
5531 p->encode_coding_system 5531 p->encode_coding_system
@@ -6564,7 +6564,7 @@ exec_sentinel (Lisp_Object proc, Lisp_Object reason)
6564 is test them for EQness, and none of them should be a string. */ 6564 is test them for EQness, and none of them should be a string. */
6565 odeactivate = Vdeactivate_mark; 6565 odeactivate = Vdeactivate_mark;
6566 XSETBUFFER (obuffer, current_buffer); 6566 XSETBUFFER (obuffer, current_buffer);
6567 okeymap = current_buffer->keymap; 6567 okeymap = B_ (current_buffer, keymap);
6568 6568
6569 /* There's no good reason to let sentinels change the current 6569 /* There's no good reason to let sentinels change the current
6570 buffer, and many callers of accept-process-output, sit-for, and 6570 buffer, and many callers of accept-process-output, sit-for, and
@@ -6714,7 +6714,7 @@ status_notify (struct Lisp_Process *deleting_process)
6714 6714
6715 /* Avoid error if buffer is deleted 6715 /* Avoid error if buffer is deleted
6716 (probably that's why the process is dead, too) */ 6716 (probably that's why the process is dead, too) */
6717 if (NILP (XBUFFER (buffer)->name)) 6717 if (NILP (B_ (XBUFFER (buffer), name)))
6718 continue; 6718 continue;
6719 Fset_buffer (buffer); 6719 Fset_buffer (buffer);
6720 6720
@@ -6731,13 +6731,13 @@ status_notify (struct Lisp_Process *deleting_process)
6731 before = PT; 6731 before = PT;
6732 before_byte = PT_BYTE; 6732 before_byte = PT_BYTE;
6733 6733
6734 tem = current_buffer->read_only; 6734 tem = B_ (current_buffer, read_only);
6735 current_buffer->read_only = Qnil; 6735 B_ (current_buffer, read_only) = Qnil;
6736 insert_string ("\nProcess "); 6736 insert_string ("\nProcess ");
6737 Finsert (1, &p->name); 6737 Finsert (1, &p->name);
6738 insert_string (" "); 6738 insert_string (" ");
6739 Finsert (1, &msg); 6739 Finsert (1, &msg);
6740 current_buffer->read_only = tem; 6740 B_ (current_buffer, read_only) = tem;
6741 set_marker_both (p->mark, p->buffer, PT, PT_BYTE); 6741 set_marker_both (p->mark, p->buffer, PT, PT_BYTE);
6742 6742
6743 if (opoint >= before) 6743 if (opoint >= before)
@@ -7136,7 +7136,7 @@ setup_process_coding_systems (Lisp_Object process)
7136 ; 7136 ;
7137 else if (BUFFERP (p->buffer)) 7137 else if (BUFFERP (p->buffer))
7138 { 7138 {
7139 if (NILP (XBUFFER (p->buffer)->enable_multibyte_characters)) 7139 if (NILP (B_ (XBUFFER (p->buffer), enable_multibyte_characters)))
7140 coding_system = raw_text_coding_system (coding_system); 7140 coding_system = raw_text_coding_system (coding_system);
7141 } 7141 }
7142 setup_coding_system (coding_system, proc_decode_coding_system[inch]); 7142 setup_coding_system (coding_system, proc_decode_coding_system[inch]);
diff --git a/src/s/ms-w32.h b/src/s/ms-w32.h
index 4c3b84dfe4c..34814687597 100644
--- a/src/s/ms-w32.h
+++ b/src/s/ms-w32.h
@@ -181,7 +181,7 @@ struct sigaction {
181#define HAVE_MENUS 1 181#define HAVE_MENUS 1
182#endif 182#endif
183 183
184#define MODE_LINE_BINARY_TEXT(_b_) (NILP ((_b_)->buffer_file_type) ? "T" : "B") 184#define MODE_LINE_BINARY_TEXT(_b_) (NILP (B_(_b_,buffer_file_type)) ? "T" : "B")
185 185
186/* Get some redefinitions in place. */ 186/* Get some redefinitions in place. */
187 187
diff --git a/src/s/msdos.h b/src/s/msdos.h
index 88afaa83455..a1d23521a0a 100644
--- a/src/s/msdos.h
+++ b/src/s/msdos.h
@@ -92,7 +92,7 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */
92 92
93 93
94/* Mode line description of a buffer's type. */ 94/* Mode line description of a buffer's type. */
95#define MODE_LINE_BINARY_TEXT(buf) (NILP(buf->buffer_file_type) ? "T" : "B") 95#define MODE_LINE_BINARY_TEXT(buf) (NILP(B_(buf,buffer_file_type)) ? "T" : "B")
96 96
97/* We have (the code to control) a mouse. */ 97/* We have (the code to control) a mouse. */
98#define HAVE_MOUSE 98#define HAVE_MOUSE
diff --git a/src/search.c b/src/search.c
index 09dae0ed0f5..a80e20a8a8a 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
157 157
158 /* If the compiled pattern hard codes some of the contents of the 158 /* If the compiled pattern hard codes some of the contents of the
159 syntax-table, it can only be reused with *this* syntax table. */ 159 syntax-table, it can only be reused with *this* syntax table. */
160 cp->syntax_table = cp->buf.used_syntax ? current_buffer->syntax_table : Qt; 160 cp->syntax_table = cp->buf.used_syntax ? B_ (current_buffer, syntax_table) : Qt;
161 161
162 re_set_whitespace_regexp (NULL); 162 re_set_whitespace_regexp (NULL);
163 163
@@ -236,7 +236,7 @@ compile_pattern (Lisp_Object pattern, struct re_registers *regp, Lisp_Object tra
236 && EQ (cp->buf.translate, (! NILP (translate) ? translate : make_number (0))) 236 && EQ (cp->buf.translate, (! NILP (translate) ? translate : make_number (0)))
237 && cp->posix == posix 237 && cp->posix == posix
238 && (EQ (cp->syntax_table, Qt) 238 && (EQ (cp->syntax_table, Qt)
239 || EQ (cp->syntax_table, current_buffer->syntax_table)) 239 || EQ (cp->syntax_table, B_ (current_buffer, syntax_table)))
240 && !NILP (Fequal (cp->whitespace_regexp, Vsearch_spaces_regexp)) 240 && !NILP (Fequal (cp->whitespace_regexp, Vsearch_spaces_regexp))
241 && cp->buf.charset_unibyte == charset_unibyte) 241 && cp->buf.charset_unibyte == charset_unibyte)
242 break; 242 break;
@@ -285,17 +285,17 @@ looking_at_1 (Lisp_Object string, int posix)
285 save_search_regs (); 285 save_search_regs ();
286 286
287 /* This is so set_image_of_range_1 in regex.c can find the EQV table. */ 287 /* This is so set_image_of_range_1 in regex.c can find the EQV table. */
288 XCHAR_TABLE (current_buffer->case_canon_table)->extras[2] 288 XCHAR_TABLE (B_ (current_buffer, case_canon_table))->extras[2]
289 = current_buffer->case_eqv_table; 289 = B_ (current_buffer, case_eqv_table);
290 290
291 CHECK_STRING (string); 291 CHECK_STRING (string);
292 bufp = compile_pattern (string, 292 bufp = compile_pattern (string,
293 (NILP (Vinhibit_changing_match_data) 293 (NILP (Vinhibit_changing_match_data)
294 ? &search_regs : NULL), 294 ? &search_regs : NULL),
295 (!NILP (current_buffer->case_fold_search) 295 (!NILP (B_ (current_buffer, case_fold_search))
296 ? current_buffer->case_canon_table : Qnil), 296 ? B_ (current_buffer, case_canon_table) : Qnil),
297 posix, 297 posix,
298 !NILP (current_buffer->enable_multibyte_characters)); 298 !NILP (B_ (current_buffer, enable_multibyte_characters)));
299 299
300 immediate_quit = 1; 300 immediate_quit = 1;
301 QUIT; /* Do a pending quit right away, to avoid paradoxical behavior */ 301 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
400 } 400 }
401 401
402 /* This is so set_image_of_range_1 in regex.c can find the EQV table. */ 402 /* This is so set_image_of_range_1 in regex.c can find the EQV table. */
403 XCHAR_TABLE (current_buffer->case_canon_table)->extras[2] 403 XCHAR_TABLE (B_ (current_buffer, case_canon_table))->extras[2]
404 = current_buffer->case_eqv_table; 404 = B_ (current_buffer, case_eqv_table);
405 405
406 bufp = compile_pattern (regexp, 406 bufp = compile_pattern (regexp,
407 (NILP (Vinhibit_changing_match_data) 407 (NILP (Vinhibit_changing_match_data)
408 ? &search_regs : NULL), 408 ? &search_regs : NULL),
409 (!NILP (current_buffer->case_fold_search) 409 (!NILP (B_ (current_buffer, case_fold_search))
410 ? current_buffer->case_canon_table : Qnil), 410 ? B_ (current_buffer, case_canon_table) : Qnil),
411 posix, 411 posix,
412 STRING_MULTIBYTE (string)); 412 STRING_MULTIBYTE (string));
413 immediate_quit = 1; 413 immediate_quit = 1;
@@ -586,7 +586,7 @@ fast_looking_at (Lisp_Object regexp, EMACS_INT pos, EMACS_INT pos_byte, EMACS_IN
586 s2 = 0; 586 s2 = 0;
587 } 587 }
588 re_match_object = Qnil; 588 re_match_object = Qnil;
589 multibyte = ! NILP (current_buffer->enable_multibyte_characters); 589 multibyte = ! NILP (B_ (current_buffer, enable_multibyte_characters));
590 } 590 }
591 591
592 buf = compile_pattern (regexp, 0, Qnil, 0, multibyte); 592 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
608static void 608static void
609newline_cache_on_off (struct buffer *buf) 609newline_cache_on_off (struct buffer *buf)
610{ 610{
611 if (NILP (buf->cache_long_line_scans)) 611 if (NILP (B_ (buf, cache_long_line_scans)))
612 { 612 {
613 /* It should be off. */ 613 /* It should be off. */
614 if (buf->newline_cache) 614 if (buf->newline_cache)
@@ -996,15 +996,15 @@ search_command (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror,
996 } 996 }
997 997
998 /* This is so set_image_of_range_1 in regex.c can find the EQV table. */ 998 /* This is so set_image_of_range_1 in regex.c can find the EQV table. */
999 XCHAR_TABLE (current_buffer->case_canon_table)->extras[2] 999 XCHAR_TABLE (B_ (current_buffer, case_canon_table))->extras[2]
1000 = current_buffer->case_eqv_table; 1000 = B_ (current_buffer, case_eqv_table);
1001 1001
1002 np = search_buffer (string, PT, PT_BYTE, lim, lim_byte, n, RE, 1002 np = search_buffer (string, PT, PT_BYTE, lim, lim_byte, n, RE,
1003 (!NILP (current_buffer->case_fold_search) 1003 (!NILP (B_ (current_buffer, case_fold_search))
1004 ? current_buffer->case_canon_table 1004 ? B_ (current_buffer, case_canon_table)
1005 : Qnil), 1005 : Qnil),
1006 (!NILP (current_buffer->case_fold_search) 1006 (!NILP (B_ (current_buffer, case_fold_search))
1007 ? current_buffer->case_eqv_table 1007 ? B_ (current_buffer, case_eqv_table)
1008 : Qnil), 1008 : Qnil),
1009 posix); 1009 posix);
1010 if (np <= 0) 1010 if (np <= 0)
@@ -1133,7 +1133,7 @@ search_buffer (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte,
1133 (NILP (Vinhibit_changing_match_data) 1133 (NILP (Vinhibit_changing_match_data)
1134 ? &search_regs : &search_regs_1), 1134 ? &search_regs : &search_regs_1),
1135 trt, posix, 1135 trt, posix,
1136 !NILP (current_buffer->enable_multibyte_characters)); 1136 !NILP (B_ (current_buffer, enable_multibyte_characters)));
1137 1137
1138 immediate_quit = 1; /* Quit immediately if user types ^G, 1138 immediate_quit = 1; /* Quit immediately if user types ^G,
1139 because letting this function finish 1139 because letting this function finish
@@ -1254,7 +1254,7 @@ search_buffer (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte,
1254 EMACS_INT raw_pattern_size; 1254 EMACS_INT raw_pattern_size;
1255 EMACS_INT raw_pattern_size_byte; 1255 EMACS_INT raw_pattern_size_byte;
1256 unsigned char *patbuf; 1256 unsigned char *patbuf;
1257 int multibyte = !NILP (current_buffer->enable_multibyte_characters); 1257 int multibyte = !NILP (B_ (current_buffer, enable_multibyte_characters));
1258 unsigned char *base_pat; 1258 unsigned char *base_pat;
1259 /* Set to positive if we find a non-ASCII char that need 1259 /* Set to positive if we find a non-ASCII char that need
1260 translation. Otherwise set to zero later. */ 1260 translation. Otherwise set to zero later. */
@@ -1451,7 +1451,7 @@ simple_search (EMACS_INT n, unsigned char *pat,
1451 EMACS_INT pos, EMACS_INT pos_byte, 1451 EMACS_INT pos, EMACS_INT pos_byte,
1452 EMACS_INT lim, EMACS_INT lim_byte) 1452 EMACS_INT lim, EMACS_INT lim_byte)
1453{ 1453{
1454 int multibyte = ! NILP (current_buffer->enable_multibyte_characters); 1454 int multibyte = ! NILP (B_ (current_buffer, enable_multibyte_characters));
1455 int forward = n > 0; 1455 int forward = n > 0;
1456 /* Number of buffer bytes matched. Note that this may be different 1456 /* Number of buffer bytes matched. Note that this may be different
1457 from len_byte in a multibyte buffer. */ 1457 from len_byte in a multibyte buffer. */
@@ -1671,7 +1671,7 @@ boyer_moore (EMACS_INT n, unsigned char *base_pat,
1671 register EMACS_INT i; 1671 register EMACS_INT i;
1672 register int j; 1672 register int j;
1673 unsigned char *pat, *pat_end; 1673 unsigned char *pat, *pat_end;
1674 int multibyte = ! NILP (current_buffer->enable_multibyte_characters); 1674 int multibyte = ! NILP (B_ (current_buffer, enable_multibyte_characters));
1675 1675
1676 unsigned char simple_translate[0400]; 1676 unsigned char simple_translate[0400];
1677 /* These are set to the preceding bytes of a byte to be translated 1677 /* These are set to the preceding bytes of a byte to be translated
@@ -2639,7 +2639,7 @@ since only regular expressions have distinguished subexpressions. */)
2639 EMACS_INT length = SBYTES (newtext); 2639 EMACS_INT length = SBYTES (newtext);
2640 unsigned char *substed; 2640 unsigned char *substed;
2641 EMACS_INT substed_alloc_size, substed_len; 2641 EMACS_INT substed_alloc_size, substed_len;
2642 int buf_multibyte = !NILP (current_buffer->enable_multibyte_characters); 2642 int buf_multibyte = !NILP (B_ (current_buffer, enable_multibyte_characters));
2643 int str_multibyte = STRING_MULTIBYTE (newtext); 2643 int str_multibyte = STRING_MULTIBYTE (newtext);
2644 Lisp_Object rev_tbl; 2644 Lisp_Object rev_tbl;
2645 int really_changed = 0; 2645 int really_changed = 0;
diff --git a/src/syntax.c b/src/syntax.c
index 2f47d73d695..9aa34014f91 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -277,7 +277,7 @@ update_syntax_table (EMACS_INT charpos, int count, int init,
277 else 277 else
278 { 278 {
279 gl_state.use_global = 0; 279 gl_state.use_global = 0;
280 gl_state.current_syntax_table = current_buffer->syntax_table; 280 gl_state.current_syntax_table = B_ (current_buffer, syntax_table);
281 } 281 }
282 } 282 }
283 283
@@ -363,7 +363,7 @@ char_quoted (EMACS_INT charpos, EMACS_INT bytepos)
363static INLINE EMACS_INT 363static INLINE EMACS_INT
364dec_bytepos (EMACS_INT bytepos) 364dec_bytepos (EMACS_INT bytepos)
365{ 365{
366 if (NILP (current_buffer->enable_multibyte_characters)) 366 if (NILP (B_ (current_buffer, enable_multibyte_characters)))
367 return bytepos - 1; 367 return bytepos - 1;
368 368
369 DEC_POS (bytepos); 369 DEC_POS (bytepos);
@@ -779,7 +779,7 @@ DEFUN ("syntax-table", Fsyntax_table, Ssyntax_table, 0, 0, 0,
779This is the one specified by the current buffer. */) 779This is the one specified by the current buffer. */)
780 (void) 780 (void)
781{ 781{
782 return current_buffer->syntax_table; 782 return B_ (current_buffer, syntax_table);
783} 783}
784 784
785DEFUN ("standard-syntax-table", Fstandard_syntax_table, 785DEFUN ("standard-syntax-table", Fstandard_syntax_table,
@@ -824,7 +824,7 @@ One argument, a syntax table. */)
824{ 824{
825 int idx; 825 int idx;
826 check_syntax_table (table); 826 check_syntax_table (table);
827 current_buffer->syntax_table = table; 827 B_ (current_buffer, syntax_table) = table;
828 /* Indicate that this buffer now has a specified syntax table. */ 828 /* Indicate that this buffer now has a specified syntax table. */
829 idx = PER_BUFFER_VAR_IDX (syntax_table); 829 idx = PER_BUFFER_VAR_IDX (syntax_table);
830 SET_PER_BUFFER_VALUE_P (current_buffer, idx, 1); 830 SET_PER_BUFFER_VALUE_P (current_buffer, idx, 1);
@@ -1035,7 +1035,7 @@ usage: (modify-syntax-entry CHAR NEWENTRY &optional SYNTAX-TABLE) */)
1035 CHECK_CHARACTER (c); 1035 CHECK_CHARACTER (c);
1036 1036
1037 if (NILP (syntax_table)) 1037 if (NILP (syntax_table))
1038 syntax_table = current_buffer->syntax_table; 1038 syntax_table = B_ (current_buffer, syntax_table);
1039 else 1039 else
1040 check_syntax_table (syntax_table); 1040 check_syntax_table (syntax_table);
1041 1041
@@ -1450,7 +1450,7 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl
1450 if (XINT (lim) < BEGV) 1450 if (XINT (lim) < BEGV)
1451 XSETFASTINT (lim, BEGV); 1451 XSETFASTINT (lim, BEGV);
1452 1452
1453 multibyte = (!NILP (current_buffer->enable_multibyte_characters) 1453 multibyte = (!NILP (B_ (current_buffer, enable_multibyte_characters))
1454 && (XINT (lim) - PT != CHAR_TO_BYTE (XINT (lim)) - PT_BYTE)); 1454 && (XINT (lim) - PT != CHAR_TO_BYTE (XINT (lim)) - PT_BYTE));
1455 string_multibyte = SBYTES (string) > SCHARS (string); 1455 string_multibyte = SBYTES (string) > SCHARS (string);
1456 1456
@@ -1936,7 +1936,7 @@ skip_syntaxes (int forwardp, Lisp_Object string, Lisp_Object lim)
1936 if (forwardp ? (PT >= XFASTINT (lim)) : (PT <= XFASTINT (lim))) 1936 if (forwardp ? (PT >= XFASTINT (lim)) : (PT <= XFASTINT (lim)))
1937 return make_number (0); 1937 return make_number (0);
1938 1938
1939 multibyte = (!NILP (current_buffer->enable_multibyte_characters) 1939 multibyte = (!NILP (B_ (current_buffer, enable_multibyte_characters))
1940 && (XINT (lim) - PT != CHAR_TO_BYTE (XINT (lim)) - PT_BYTE)); 1940 && (XINT (lim) - PT != CHAR_TO_BYTE (XINT (lim)) - PT_BYTE));
1941 1941
1942 memset (fastmap, 0, sizeof fastmap); 1942 memset (fastmap, 0, sizeof fastmap);
@@ -2703,7 +2703,7 @@ scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpf
2703 while (from > stop) 2703 while (from > stop)
2704 { 2704 {
2705 temp_pos = from_byte; 2705 temp_pos = from_byte;
2706 if (! NILP (current_buffer->enable_multibyte_characters)) 2706 if (! NILP (B_ (current_buffer, enable_multibyte_characters)))
2707 DEC_POS (temp_pos); 2707 DEC_POS (temp_pos);
2708 else 2708 else
2709 temp_pos--; 2709 temp_pos--;
diff --git a/src/syntax.h b/src/syntax.h
index bea66d1fada..75937a7c121 100644
--- a/src/syntax.h
+++ b/src/syntax.h
@@ -24,7 +24,7 @@ extern void update_syntax_table (EMACS_INT, int, int, Lisp_Object);
24 24
25/* The standard syntax table is stored where it will automatically 25/* The standard syntax table is stored where it will automatically
26 be used in all new buffers. */ 26 be used in all new buffers. */
27#define Vstandard_syntax_table buffer_defaults.syntax_table 27#define Vstandard_syntax_table B_ (&buffer_defaults, syntax_table)
28 28
29/* A syntax table is a chartable whose elements are cons cells 29/* A syntax table is a chartable whose elements are cons cells
30 (CODE+FLAGS . MATCHING-CHAR). MATCHING-CHAR can be nil if the char 30 (CODE+FLAGS . MATCHING-CHAR). MATCHING-CHAR can be nil if the char
@@ -79,7 +79,7 @@ enum syntaxcode
79# define CURRENT_SYNTAX_TABLE gl_state.current_syntax_table 79# define CURRENT_SYNTAX_TABLE gl_state.current_syntax_table
80#else 80#else
81# define SYNTAX_ENTRY SYNTAX_ENTRY_INT 81# define SYNTAX_ENTRY SYNTAX_ENTRY_INT
82# define CURRENT_SYNTAX_TABLE current_buffer->syntax_table 82# define CURRENT_SYNTAX_TABLE B_ (current_buffer, syntax_table)
83#endif 83#endif
84 84
85#define SYNTAX_ENTRY_INT(c) CHAR_TABLE_REF (CURRENT_SYNTAX_TABLE, (c)) 85#define SYNTAX_ENTRY_INT(c) CHAR_TABLE_REF (CURRENT_SYNTAX_TABLE, (c))
@@ -204,7 +204,7 @@ extern char syntax_code_spec[16];
204do \ 204do \
205 { \ 205 { \
206 gl_state.use_global = 0; \ 206 gl_state.use_global = 0; \
207 gl_state.current_syntax_table = current_buffer->syntax_table; \ 207 gl_state.current_syntax_table = B_ (current_buffer, syntax_table); \
208 } while (0) 208 } while (0)
209 209
210/* This macro should be called with FROM at the start of forward 210/* This macro should be called with FROM at the start of forward
diff --git a/src/undo.c b/src/undo.c
index 933982ec30c..f6953fabfec 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -73,12 +73,12 @@ record_point (EMACS_INT pt)
73 Fundo_boundary (); 73 Fundo_boundary ();
74 last_undo_buffer = current_buffer; 74 last_undo_buffer = current_buffer;
75 75
76 if (CONSP (current_buffer->undo_list)) 76 if (CONSP (B_ (current_buffer, undo_list)))
77 { 77 {
78 /* Set AT_BOUNDARY to 1 only when we have nothing other than 78 /* Set AT_BOUNDARY to 1 only when we have nothing other than
79 marker adjustment before undo boundary. */ 79 marker adjustment before undo boundary. */
80 80
81 Lisp_Object tail = current_buffer->undo_list, elt; 81 Lisp_Object tail = B_ (current_buffer, undo_list), elt;
82 82
83 while (1) 83 while (1)
84 { 84 {
@@ -103,8 +103,8 @@ record_point (EMACS_INT pt)
103 if (at_boundary 103 if (at_boundary
104 && current_buffer == last_boundary_buffer 104 && current_buffer == last_boundary_buffer
105 && last_boundary_position != pt) 105 && last_boundary_position != pt)
106 current_buffer->undo_list 106 B_ (current_buffer, undo_list)
107 = Fcons (make_number (last_boundary_position), current_buffer->undo_list); 107 = Fcons (make_number (last_boundary_position), B_ (current_buffer, undo_list));
108} 108}
109 109
110/* Record an insertion that just happened or is about to happen, 110/* Record an insertion that just happened or is about to happen,
@@ -117,17 +117,17 @@ record_insert (EMACS_INT beg, EMACS_INT length)
117{ 117{
118 Lisp_Object lbeg, lend; 118 Lisp_Object lbeg, lend;
119 119
120 if (EQ (current_buffer->undo_list, Qt)) 120 if (EQ (B_ (current_buffer, undo_list), Qt))
121 return; 121 return;
122 122
123 record_point (beg); 123 record_point (beg);
124 124
125 /* If this is following another insertion and consecutive with it 125 /* If this is following another insertion and consecutive with it
126 in the buffer, combine the two. */ 126 in the buffer, combine the two. */
127 if (CONSP (current_buffer->undo_list)) 127 if (CONSP (B_ (current_buffer, undo_list)))
128 { 128 {
129 Lisp_Object elt; 129 Lisp_Object elt;
130 elt = XCAR (current_buffer->undo_list); 130 elt = XCAR (B_ (current_buffer, undo_list));
131 if (CONSP (elt) 131 if (CONSP (elt)
132 && INTEGERP (XCAR (elt)) 132 && INTEGERP (XCAR (elt))
133 && INTEGERP (XCDR (elt)) 133 && INTEGERP (XCDR (elt))
@@ -140,8 +140,8 @@ record_insert (EMACS_INT beg, EMACS_INT length)
140 140
141 XSETFASTINT (lbeg, beg); 141 XSETFASTINT (lbeg, beg);
142 XSETINT (lend, beg + length); 142 XSETINT (lend, beg + length);
143 current_buffer->undo_list = Fcons (Fcons (lbeg, lend), 143 B_ (current_buffer, undo_list) = Fcons (Fcons (lbeg, lend),
144 current_buffer->undo_list); 144 B_ (current_buffer, undo_list));
145} 145}
146 146
147/* Record that a deletion is about to take place, 147/* Record that a deletion is about to take place,
@@ -152,7 +152,7 @@ record_delete (EMACS_INT beg, Lisp_Object string)
152{ 152{
153 Lisp_Object sbeg; 153 Lisp_Object sbeg;
154 154
155 if (EQ (current_buffer->undo_list, Qt)) 155 if (EQ (B_ (current_buffer, undo_list), Qt))
156 return; 156 return;
157 157
158 if (PT == beg + SCHARS (string)) 158 if (PT == beg + SCHARS (string))
@@ -166,8 +166,8 @@ record_delete (EMACS_INT beg, Lisp_Object string)
166 record_point (beg); 166 record_point (beg);
167 } 167 }
168 168
169 current_buffer->undo_list 169 B_ (current_buffer, undo_list)
170 = Fcons (Fcons (string, sbeg), current_buffer->undo_list); 170 = Fcons (Fcons (string, sbeg), B_ (current_buffer, undo_list));
171} 171}
172 172
173/* Record the fact that MARKER is about to be adjusted by ADJUSTMENT. 173/* Record the fact that MARKER is about to be adjusted by ADJUSTMENT.
@@ -178,7 +178,7 @@ record_delete (EMACS_INT beg, Lisp_Object string)
178void 178void
179record_marker_adjustment (Lisp_Object marker, EMACS_INT adjustment) 179record_marker_adjustment (Lisp_Object marker, EMACS_INT adjustment)
180{ 180{
181 if (EQ (current_buffer->undo_list, Qt)) 181 if (EQ (B_ (current_buffer, undo_list), Qt))
182 return; 182 return;
183 183
184 /* Allocate a cons cell to be the undo boundary after this command. */ 184 /* 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)
189 Fundo_boundary (); 189 Fundo_boundary ();
190 last_undo_buffer = current_buffer; 190 last_undo_buffer = current_buffer;
191 191
192 current_buffer->undo_list 192 B_ (current_buffer, undo_list)
193 = Fcons (Fcons (marker, make_number (adjustment)), 193 = Fcons (Fcons (marker, make_number (adjustment)),
194 current_buffer->undo_list); 194 B_ (current_buffer, undo_list));
195} 195}
196 196
197/* Record that a replacement is about to take place, 197/* Record that a replacement is about to take place,
@@ -215,7 +215,7 @@ record_first_change (void)
215 Lisp_Object high, low; 215 Lisp_Object high, low;
216 struct buffer *base_buffer = current_buffer; 216 struct buffer *base_buffer = current_buffer;
217 217
218 if (EQ (current_buffer->undo_list, Qt)) 218 if (EQ (B_ (current_buffer, undo_list), Qt))
219 return; 219 return;
220 220
221 if (current_buffer != last_undo_buffer) 221 if (current_buffer != last_undo_buffer)
@@ -227,7 +227,7 @@ record_first_change (void)
227 227
228 XSETFASTINT (high, (base_buffer->modtime >> 16) & 0xffff); 228 XSETFASTINT (high, (base_buffer->modtime >> 16) & 0xffff);
229 XSETFASTINT (low, base_buffer->modtime & 0xffff); 229 XSETFASTINT (low, base_buffer->modtime & 0xffff);
230 current_buffer->undo_list = Fcons (Fcons (Qt, Fcons (high, low)), current_buffer->undo_list); 230 B_ (current_buffer, undo_list) = Fcons (Fcons (Qt, Fcons (high, low)), B_ (current_buffer, undo_list));
231} 231}
232 232
233/* Record a change in property PROP (whose old value was VAL) 233/* Record a change in property PROP (whose old value was VAL)
@@ -242,7 +242,7 @@ record_property_change (EMACS_INT beg, EMACS_INT length,
242 struct buffer *obuf = current_buffer, *buf = XBUFFER (buffer); 242 struct buffer *obuf = current_buffer, *buf = XBUFFER (buffer);
243 int boundary = 0; 243 int boundary = 0;
244 244
245 if (EQ (buf->undo_list, Qt)) 245 if (EQ (B_ (buf, undo_list), Qt))
246 return; 246 return;
247 247
248 /* Allocate a cons cell to be the undo boundary after this command. */ 248 /* 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,
265 XSETINT (lbeg, beg); 265 XSETINT (lbeg, beg);
266 XSETINT (lend, beg + length); 266 XSETINT (lend, beg + length);
267 entry = Fcons (Qnil, Fcons (prop, Fcons (value, Fcons (lbeg, lend)))); 267 entry = Fcons (Qnil, Fcons (prop, Fcons (value, Fcons (lbeg, lend))));
268 current_buffer->undo_list = Fcons (entry, current_buffer->undo_list); 268 B_ (current_buffer, undo_list) = Fcons (entry, B_ (current_buffer, undo_list));
269 269
270 current_buffer = obuf; 270 current_buffer = obuf;
271} 271}
@@ -277,9 +277,9 @@ but another undo command will undo to the previous boundary. */)
277 (void) 277 (void)
278{ 278{
279 Lisp_Object tem; 279 Lisp_Object tem;
280 if (EQ (current_buffer->undo_list, Qt)) 280 if (EQ (B_ (current_buffer, undo_list), Qt))
281 return Qnil; 281 return Qnil;
282 tem = Fcar (current_buffer->undo_list); 282 tem = Fcar (B_ (current_buffer, undo_list));
283 if (!NILP (tem)) 283 if (!NILP (tem))
284 { 284 {
285 /* One way or another, cons nil onto the front of the undo list. */ 285 /* 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. */)
287 { 287 {
288 /* If we have preallocated the cons cell to use here, 288 /* If we have preallocated the cons cell to use here,
289 use that one. */ 289 use that one. */
290 XSETCDR (pending_boundary, current_buffer->undo_list); 290 XSETCDR (pending_boundary, B_ (current_buffer, undo_list));
291 current_buffer->undo_list = pending_boundary; 291 B_ (current_buffer, undo_list) = pending_boundary;
292 pending_boundary = Qnil; 292 pending_boundary = Qnil;
293 } 293 }
294 else 294 else
295 current_buffer->undo_list = Fcons (Qnil, current_buffer->undo_list); 295 B_ (current_buffer, undo_list) = Fcons (Qnil, B_ (current_buffer, undo_list));
296 } 296 }
297 last_boundary_position = PT; 297 last_boundary_position = PT;
298 last_boundary_buffer = current_buffer; 298 last_boundary_buffer = current_buffer;
@@ -321,7 +321,7 @@ truncate_undo_list (struct buffer *b)
321 record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ()); 321 record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ());
322 set_buffer_internal (b); 322 set_buffer_internal (b);
323 323
324 list = b->undo_list; 324 list = B_ (b, undo_list);
325 325
326 prev = Qnil; 326 prev = Qnil;
327 next = list; 327 next = list;
@@ -433,7 +433,7 @@ truncate_undo_list (struct buffer *b)
433 XSETCDR (last_boundary, Qnil); 433 XSETCDR (last_boundary, Qnil);
434 /* There's nothing we decided to keep, so clear it out. */ 434 /* There's nothing we decided to keep, so clear it out. */
435 else 435 else
436 b->undo_list = Qnil; 436 B_ (b, undo_list) = Qnil;
437 437
438 unbind_to (count, Qnil); 438 unbind_to (count, Qnil);
439} 439}
@@ -470,13 +470,13 @@ Return what remains of the list. */)
470 470
471 /* In a writable buffer, enable undoing read-only text that is so 471 /* In a writable buffer, enable undoing read-only text that is so
472 because of text properties. */ 472 because of text properties. */
473 if (NILP (current_buffer->read_only)) 473 if (NILP (B_ (current_buffer, read_only)))
474 specbind (Qinhibit_read_only, Qt); 474 specbind (Qinhibit_read_only, Qt);
475 475
476 /* Don't let `intangible' properties interfere with undo. */ 476 /* Don't let `intangible' properties interfere with undo. */
477 specbind (Qinhibit_point_motion_hooks, Qt); 477 specbind (Qinhibit_point_motion_hooks, Qt);
478 478
479 oldlist = current_buffer->undo_list; 479 oldlist = B_ (current_buffer, undo_list);
480 480
481 while (arg > 0) 481 while (arg > 0)
482 { 482 {
@@ -631,9 +631,9 @@ Return what remains of the list. */)
631 so the test in `undo' for continuing an undo series 631 so the test in `undo' for continuing an undo series
632 will work right. */ 632 will work right. */
633 if (did_apply 633 if (did_apply
634 && EQ (oldlist, current_buffer->undo_list)) 634 && EQ (oldlist, B_ (current_buffer, undo_list)))
635 current_buffer->undo_list 635 B_ (current_buffer, undo_list)
636 = Fcons (list3 (Qapply, Qcdr, Qnil), current_buffer->undo_list); 636 = Fcons (list3 (Qapply, Qcdr, Qnil), B_ (current_buffer, undo_list));
637 637
638 UNGCPRO; 638 UNGCPRO;
639 return unbind_to (count, list); 639 return unbind_to (count, list);
diff --git a/src/w32fns.c b/src/w32fns.c
index b09bb0b5b5f..64e073bedb7 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -5225,7 +5225,7 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
5225 Fset_window_buffer (FRAME_ROOT_WINDOW (f), buffer, Qnil); 5225 Fset_window_buffer (FRAME_ROOT_WINDOW (f), buffer, Qnil);
5226 old_buffer = current_buffer; 5226 old_buffer = current_buffer;
5227 set_buffer_internal_1 (XBUFFER (buffer)); 5227 set_buffer_internal_1 (XBUFFER (buffer));
5228 current_buffer->truncate_lines = Qnil; 5228 B_ (current_buffer, truncate_lines) = Qnil;
5229 specbind (Qinhibit_read_only, Qt); 5229 specbind (Qinhibit_read_only, Qt);
5230 specbind (Qinhibit_modification_hooks, Qt); 5230 specbind (Qinhibit_modification_hooks, Qt);
5231 Ferase_buffer (); 5231 Ferase_buffer ();
@@ -5655,7 +5655,7 @@ Text larger than the specified size is clipped. */)
5655 /* Display the tooltip text in a temporary buffer. */ 5655 /* Display the tooltip text in a temporary buffer. */
5656 old_buffer = current_buffer; 5656 old_buffer = current_buffer;
5657 set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer)); 5657 set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer));
5658 current_buffer->truncate_lines = Qnil; 5658 B_ (current_buffer, truncate_lines) = Qnil;
5659 clear_glyph_matrix (w->desired_matrix); 5659 clear_glyph_matrix (w->desired_matrix);
5660 clear_glyph_matrix (w->current_matrix); 5660 clear_glyph_matrix (w->current_matrix);
5661 SET_TEXT_POS (pos, BEGV, BEGV_BYTE); 5661 SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
@@ -6162,7 +6162,7 @@ an integer representing a ShowWindow flag:
6162 CHECK_STRING (document); 6162 CHECK_STRING (document);
6163 6163
6164 /* Encode filename, current directory and parameters. */ 6164 /* Encode filename, current directory and parameters. */
6165 current_dir = ENCODE_FILE (current_buffer->directory); 6165 current_dir = ENCODE_FILE (B_ (current_buffer, directory));
6166 document = ENCODE_FILE (document); 6166 document = ENCODE_FILE (document);
6167 if (STRINGP (parameters)) 6167 if (STRINGP (parameters))
6168 parameters = ENCODE_SYSTEM (parameters); 6168 parameters = ENCODE_SYSTEM (parameters);
diff --git a/src/window.c b/src/window.c
index abf01758c3f..4d700cfad5e 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1359,8 +1359,8 @@ window_display_table (struct window *w)
1359 { 1359 {
1360 struct buffer *b = XBUFFER (w->buffer); 1360 struct buffer *b = XBUFFER (w->buffer);
1361 1361
1362 if (DISP_TABLE_P (b->display_table)) 1362 if (DISP_TABLE_P (B_ (b, display_table)))
1363 dp = XCHAR_TABLE (b->display_table); 1363 dp = XCHAR_TABLE (B_ (b, display_table));
1364 else if (DISP_TABLE_P (Vstandard_display_table)) 1364 else if (DISP_TABLE_P (Vstandard_display_table))
1365 dp = XCHAR_TABLE (Vstandard_display_table); 1365 dp = XCHAR_TABLE (Vstandard_display_table);
1366 } 1366 }
@@ -1414,9 +1414,9 @@ unshow_buffer (register struct window *w)
1414 So don't clobber point in that buffer. */ 1414 So don't clobber point in that buffer. */
1415 if (! EQ (buf, XWINDOW (selected_window)->buffer) 1415 if (! EQ (buf, XWINDOW (selected_window)->buffer)
1416 /* This line helps to fix Horsley's testbug.el bug. */ 1416 /* This line helps to fix Horsley's testbug.el bug. */
1417 && !(WINDOWP (b->last_selected_window) 1417 && !(WINDOWP (B_ (b, last_selected_window))
1418 && w != XWINDOW (b->last_selected_window) 1418 && w != XWINDOW (B_ (b, last_selected_window))
1419 && EQ (buf, XWINDOW (b->last_selected_window)->buffer))) 1419 && EQ (buf, XWINDOW (B_ (b, last_selected_window))->buffer)))
1420 temp_set_point_both (b, 1420 temp_set_point_both (b,
1421 clip_to_bounds (BUF_BEGV (b), 1421 clip_to_bounds (BUF_BEGV (b),
1422 XMARKER (w->pointm)->charpos, 1422 XMARKER (w->pointm)->charpos,
@@ -1425,9 +1425,9 @@ unshow_buffer (register struct window *w)
1425 marker_byte_position (w->pointm), 1425 marker_byte_position (w->pointm),
1426 BUF_ZV_BYTE (b))); 1426 BUF_ZV_BYTE (b)));
1427 1427
1428 if (WINDOWP (b->last_selected_window) 1428 if (WINDOWP (B_ (b, last_selected_window))
1429 && w == XWINDOW (b->last_selected_window)) 1429 && w == XWINDOW (B_ (b, last_selected_window)))
1430 b->last_selected_window = Qnil; 1430 B_ (b, last_selected_window) = Qnil;
1431} 1431}
1432 1432
1433/* Put replacement into the window structure in place of old. */ 1433/* 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
2325 /* Check for a window that has a killed buffer. */ 2325 /* Check for a window that has a killed buffer. */
2326 case CHECK_ALL_WINDOWS: 2326 case CHECK_ALL_WINDOWS:
2327 if (! NILP (w->buffer) 2327 if (! NILP (w->buffer)
2328 && NILP (XBUFFER (w->buffer)->name)) 2328 && NILP (B_ (XBUFFER (w->buffer), name)))
2329 abort (); 2329 abort ();
2330 break; 2330 break;
2331 2331
@@ -2729,7 +2729,7 @@ window_min_size_2 (struct window *w, int width_p, int safe_p)
2729 { 2729 {
2730 int safe_size = (MIN_SAFE_WINDOW_HEIGHT 2730 int safe_size = (MIN_SAFE_WINDOW_HEIGHT
2731 + ((BUFFERP (w->buffer) 2731 + ((BUFFERP (w->buffer)
2732 && !NILP (XBUFFER (w->buffer)->mode_line_format)) 2732 && !NILP (B_ (XBUFFER (w->buffer), mode_line_format)))
2733 ? 1 : 0)); 2733 ? 1 : 0));
2734 2734
2735 return safe_p ? safe_size : max (window_min_height, safe_size); 2735 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
3360 w->buffer = buffer; 3360 w->buffer = buffer;
3361 3361
3362 if (EQ (window, selected_window)) 3362 if (EQ (window, selected_window))
3363 b->last_selected_window = window; 3363 B_ (b, last_selected_window) = window;
3364 3364
3365 /* Let redisplay errors through. */ 3365 /* Let redisplay errors through. */
3366 b->display_error_modiff = 0; 3366 b->display_error_modiff = 0;
3367 3367
3368 /* Update time stamps of buffer display. */ 3368 /* Update time stamps of buffer display. */
3369 if (INTEGERP (b->display_count)) 3369 if (INTEGERP (B_ (b, display_count)))
3370 XSETINT (b->display_count, XINT (b->display_count) + 1); 3370 XSETINT (B_ (b, display_count), XINT (B_ (b, display_count)) + 1);
3371 b->display_time = Fcurrent_time (); 3371 B_ (b, display_time) = Fcurrent_time ();
3372 3372
3373 XSETFASTINT (w->window_end_pos, 0); 3373 XSETFASTINT (w->window_end_pos, 0);
3374 XSETFASTINT (w->window_end_vpos, 0); 3374 XSETFASTINT (w->window_end_vpos, 0);
@@ -3421,18 +3421,18 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
3421 w->left_margin_cols = w->right_margin_cols = Qnil; 3421 w->left_margin_cols = w->right_margin_cols = Qnil;
3422 3422
3423 Fset_window_fringes (window, 3423 Fset_window_fringes (window,
3424 b->left_fringe_width, b->right_fringe_width, 3424 B_ (b, left_fringe_width), B_ (b, right_fringe_width),
3425 b->fringes_outside_margins); 3425 B_ (b, fringes_outside_margins));
3426 3426
3427 Fset_window_scroll_bars (window, 3427 Fset_window_scroll_bars (window,
3428 b->scroll_bar_width, 3428 B_ (b, scroll_bar_width),
3429 b->vertical_scroll_bar_type, Qnil); 3429 B_ (b, vertical_scroll_bar_type), Qnil);
3430 3430
3431 w->left_margin_cols = save_left; 3431 w->left_margin_cols = save_left;
3432 w->right_margin_cols = save_right; 3432 w->right_margin_cols = save_right;
3433 3433
3434 Fset_window_margins (window, 3434 Fset_window_margins (window,
3435 b->left_margin_cols, b->right_margin_cols); 3435 B_ (b, left_margin_cols), B_ (b, right_margin_cols));
3436 } 3436 }
3437 3437
3438 if (run_hooks_p) 3438 if (run_hooks_p)
@@ -3469,7 +3469,7 @@ This function runs `window-scroll-functions' before running
3469 XSETWINDOW (window, w); 3469 XSETWINDOW (window, w);
3470 buffer = Fget_buffer (buffer_or_name); 3470 buffer = Fget_buffer (buffer_or_name);
3471 CHECK_BUFFER (buffer); 3471 CHECK_BUFFER (buffer);
3472 if (NILP (XBUFFER (buffer)->name)) 3472 if (NILP (B_ (XBUFFER (buffer), name)))
3473 error ("Attempt to display deleted buffer"); 3473 error ("Attempt to display deleted buffer");
3474 3474
3475 tem = w->buffer; 3475 tem = w->buffer;
@@ -3481,7 +3481,7 @@ This function runs `window-scroll-functions' before running
3481 if (EQ (tem, buffer)) 3481 if (EQ (tem, buffer))
3482 return Qnil; 3482 return Qnil;
3483 else if (EQ (w->dedicated, Qt)) 3483 else if (EQ (w->dedicated, Qt))
3484 error ("Window is dedicated to `%s'", SDATA (XBUFFER (tem)->name)); 3484 error ("Window is dedicated to `%s'", SDATA (B_ (XBUFFER (tem), name)));
3485 else 3485 else
3486 w->dedicated = Qnil; 3486 w->dedicated = Qnil;
3487 3487
@@ -3517,7 +3517,7 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap)
3517 record_buffer (w->buffer); 3517 record_buffer (w->buffer);
3518 } 3518 }
3519 3519
3520 if (EQ (window, selected_window)) 3520 if (EQ (window, selected_window) && !inhibit_point_swap)
3521 return window; 3521 return window;
3522 3522
3523 sf = SELECTED_FRAME (); 3523 sf = SELECTED_FRAME ();
@@ -3552,7 +3552,7 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap)
3552 3552
3553 Fset_buffer (w->buffer); 3553 Fset_buffer (w->buffer);
3554 3554
3555 XBUFFER (w->buffer)->last_selected_window = window; 3555 B_ (XBUFFER (w->buffer), last_selected_window) = window;
3556 3556
3557 /* Go to the point recorded in the window. 3557 /* Go to the point recorded in the window.
3558 This is important when the buffer is in more 3558 This is important when the buffer is in more
@@ -3640,7 +3640,7 @@ displaying that buffer. */)
3640 3640
3641 if (STRINGP (object)) 3641 if (STRINGP (object))
3642 object = Fget_buffer (object); 3642 object = Fget_buffer (object);
3643 if (BUFFERP (object) && !NILP (XBUFFER (object)->name)) 3643 if (BUFFERP (object) && !NILP (B_ (XBUFFER (object), name)))
3644 { 3644 {
3645 /* Walk all windows looking for buffer, and force update 3645 /* Walk all windows looking for buffer, and force update
3646 of each of those windows. */ 3646 of each of those windows. */
@@ -3663,7 +3663,7 @@ temp_output_buffer_show (register Lisp_Object buf)
3663 register Lisp_Object window; 3663 register Lisp_Object window;
3664 register struct window *w; 3664 register struct window *w;
3665 3665
3666 XBUFFER (buf)->directory = current_buffer->directory; 3666 B_ (XBUFFER (buf), directory) = B_ (current_buffer, directory);
3667 3667
3668 Fset_buffer (buf); 3668 Fset_buffer (buf);
3669 BUF_SAVE_MODIFF (XBUFFER (buf)) = MODIFF; 3669 BUF_SAVE_MODIFF (XBUFFER (buf)) = MODIFF;
@@ -5878,7 +5878,7 @@ the return value is nil. Otherwise the value is t. */)
5878 saved_windows = XVECTOR (data->saved_windows); 5878 saved_windows = XVECTOR (data->saved_windows);
5879 5879
5880 new_current_buffer = data->current_buffer; 5880 new_current_buffer = data->current_buffer;
5881 if (NILP (XBUFFER (new_current_buffer)->name)) 5881 if (NILP (B_ (XBUFFER (new_current_buffer), name)))
5882 new_current_buffer = Qnil; 5882 new_current_buffer = Qnil;
5883 else 5883 else
5884 { 5884 {
@@ -6063,14 +6063,14 @@ the return value is nil. Otherwise the value is t. */)
6063 w->buffer = p->buffer; 6063 w->buffer = p->buffer;
6064 else 6064 else
6065 { 6065 {
6066 if (!NILP (XBUFFER (p->buffer)->name)) 6066 if (!NILP (B_ (XBUFFER (p->buffer), name)))
6067 /* If saved buffer is alive, install it. */ 6067 /* If saved buffer is alive, install it. */
6068 { 6068 {
6069 w->buffer = p->buffer; 6069 w->buffer = p->buffer;
6070 w->start_at_line_beg = p->start_at_line_beg; 6070 w->start_at_line_beg = p->start_at_line_beg;
6071 set_marker_restricted (w->start, p->start, w->buffer); 6071 set_marker_restricted (w->start, p->start, w->buffer);
6072 set_marker_restricted (w->pointm, p->pointm, w->buffer); 6072 set_marker_restricted (w->pointm, p->pointm, w->buffer);
6073 Fset_marker (XBUFFER (w->buffer)->mark, 6073 Fset_marker (B_ (XBUFFER (w->buffer), mark),
6074 p->mark, w->buffer); 6074 p->mark, w->buffer);
6075 6075
6076 /* As documented in Fcurrent_window_configuration, don't 6076 /* As documented in Fcurrent_window_configuration, don't
@@ -6080,7 +6080,7 @@ the return value is nil. Otherwise the value is t. */)
6080 && XBUFFER (p->buffer) == current_buffer) 6080 && XBUFFER (p->buffer) == current_buffer)
6081 Fgoto_char (w->pointm); 6081 Fgoto_char (w->pointm);
6082 } 6082 }
6083 else if (NILP (w->buffer) || NILP (XBUFFER (w->buffer)->name)) 6083 else if (NILP (w->buffer) || NILP (B_ (XBUFFER (w->buffer), name)))
6084 /* Else unless window has a live buffer, get one. */ 6084 /* Else unless window has a live buffer, get one. */
6085 { 6085 {
6086 w->buffer = Fcdr (Fcar (Vbuffer_alist)); 6086 w->buffer = Fcdr (Fcar (Vbuffer_alist));
@@ -6121,7 +6121,7 @@ the return value is nil. Otherwise the value is t. */)
6121 has been restored into it. We already swapped out that point 6121 has been restored into it. We already swapped out that point
6122 from that window's old buffer. */ 6122 from that window's old buffer. */
6123 select_window (data->current_window, Qnil, 1); 6123 select_window (data->current_window, Qnil, 1);
6124 XBUFFER (XWINDOW (selected_window)->buffer)->last_selected_window 6124 B_ (XBUFFER (XWINDOW (selected_window)->buffer), last_selected_window)
6125 = selected_window; 6125 = selected_window;
6126 6126
6127 if (NILP (data->focus_frame) 6127 if (NILP (data->focus_frame)
@@ -6322,7 +6322,7 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i)
6322 p->start = Fcopy_marker (w->start, Qnil); 6322 p->start = Fcopy_marker (w->start, Qnil);
6323 p->start_at_line_beg = w->start_at_line_beg; 6323 p->start_at_line_beg = w->start_at_line_beg;
6324 6324
6325 tem = XBUFFER (w->buffer)->mark; 6325 tem = B_ (XBUFFER (w->buffer), mark);
6326 p->mark = Fcopy_marker (tem, Qnil); 6326 p->mark = Fcopy_marker (tem, Qnil);
6327 } 6327 }
6328 else 6328 else
diff --git a/src/xdisp.c b/src/xdisp.c
index b9b77e34b9d..68f7835f0d7 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,
1210 if (WINDOW_WANTS_MODELINE_P (w)) 1210 if (WINDOW_WANTS_MODELINE_P (w))
1211 current_mode_line_height 1211 current_mode_line_height
1212 = display_mode_line (w, CURRENT_MODE_LINE_FACE_ID (w), 1212 = display_mode_line (w, CURRENT_MODE_LINE_FACE_ID (w),
1213 current_buffer->mode_line_format); 1213 B_ (current_buffer, mode_line_format));
1214 1214
1215 if (WINDOW_WANTS_HEADER_LINE_P (w)) 1215 if (WINDOW_WANTS_HEADER_LINE_P (w))
1216 current_header_line_height 1216 current_header_line_height
1217 = display_mode_line (w, HEADER_LINE_FACE_ID, 1217 = display_mode_line (w, HEADER_LINE_FACE_ID,
1218 current_buffer->header_line_format); 1218 B_ (current_buffer, header_line_format));
1219 1219
1220 start_display (&it, w, top); 1220 start_display (&it, w, top);
1221 move_it_to (&it, charpos, -1, it.last_visible_y-1, -1, 1221 move_it_to (&it, charpos, -1, it.last_visible_y-1, -1,
@@ -2405,10 +2405,10 @@ init_iterator (struct it *it, struct window *w,
2405 if (base_face_id == DEFAULT_FACE_ID 2405 if (base_face_id == DEFAULT_FACE_ID
2406 && FRAME_WINDOW_P (it->f)) 2406 && FRAME_WINDOW_P (it->f))
2407 { 2407 {
2408 if (NATNUMP (current_buffer->extra_line_spacing)) 2408 if (NATNUMP (B_ (current_buffer, extra_line_spacing)))
2409 it->extra_line_spacing = XFASTINT (current_buffer->extra_line_spacing); 2409 it->extra_line_spacing = XFASTINT (B_ (current_buffer, extra_line_spacing));
2410 else if (FLOATP (current_buffer->extra_line_spacing)) 2410 else if (FLOATP (B_ (current_buffer, extra_line_spacing)))
2411 it->extra_line_spacing = (XFLOAT_DATA (current_buffer->extra_line_spacing) 2411 it->extra_line_spacing = (XFLOAT_DATA (B_ (current_buffer, extra_line_spacing))
2412 * FRAME_LINE_HEIGHT (it->f)); 2412 * FRAME_LINE_HEIGHT (it->f));
2413 else if (it->f->extra_line_spacing > 0) 2413 else if (it->f->extra_line_spacing > 0)
2414 it->extra_line_spacing = it->f->extra_line_spacing; 2414 it->extra_line_spacing = it->f->extra_line_spacing;
@@ -2431,36 +2431,36 @@ init_iterator (struct it *it, struct window *w,
2431 it->override_ascent = -1; 2431 it->override_ascent = -1;
2432 2432
2433 /* Are control characters displayed as `^C'? */ 2433 /* Are control characters displayed as `^C'? */
2434 it->ctl_arrow_p = !NILP (current_buffer->ctl_arrow); 2434 it->ctl_arrow_p = !NILP (B_ (current_buffer, ctl_arrow));
2435 2435
2436 /* -1 means everything between a CR and the following line end 2436 /* -1 means everything between a CR and the following line end
2437 is invisible. >0 means lines indented more than this value are 2437 is invisible. >0 means lines indented more than this value are
2438 invisible. */ 2438 invisible. */
2439 it->selective = (INTEGERP (current_buffer->selective_display) 2439 it->selective = (INTEGERP (B_ (current_buffer, selective_display))
2440 ? XFASTINT (current_buffer->selective_display) 2440 ? XFASTINT (B_ (current_buffer, selective_display))
2441 : (!NILP (current_buffer->selective_display) 2441 : (!NILP (B_ (current_buffer, selective_display))
2442 ? -1 : 0)); 2442 ? -1 : 0));
2443 it->selective_display_ellipsis_p 2443 it->selective_display_ellipsis_p
2444 = !NILP (current_buffer->selective_display_ellipses); 2444 = !NILP (B_ (current_buffer, selective_display_ellipses));
2445 2445
2446 /* Display table to use. */ 2446 /* Display table to use. */
2447 it->dp = window_display_table (w); 2447 it->dp = window_display_table (w);
2448 2448
2449 /* Are multibyte characters enabled in current_buffer? */ 2449 /* Are multibyte characters enabled in current_buffer? */
2450 it->multibyte_p = !NILP (current_buffer->enable_multibyte_characters); 2450 it->multibyte_p = !NILP (B_ (current_buffer, enable_multibyte_characters));
2451 2451
2452 /* Do we need to reorder bidirectional text? Not if this is a 2452 /* Do we need to reorder bidirectional text? Not if this is a
2453 unibyte buffer: by definition, none of the single-byte characters 2453 unibyte buffer: by definition, none of the single-byte characters
2454 are strong R2L, so no reordering is needed. And bidi.c doesn't 2454 are strong R2L, so no reordering is needed. And bidi.c doesn't
2455 support unibyte buffers anyway. */ 2455 support unibyte buffers anyway. */
2456 it->bidi_p 2456 it->bidi_p
2457 = !NILP (current_buffer->bidi_display_reordering) && it->multibyte_p; 2457 = !NILP (B_ (current_buffer, bidi_display_reordering)) && it->multibyte_p;
2458 2458
2459 /* Non-zero if we should highlight the region. */ 2459 /* Non-zero if we should highlight the region. */
2460 highlight_region_p 2460 highlight_region_p
2461 = (!NILP (Vtransient_mark_mode) 2461 = (!NILP (Vtransient_mark_mode)
2462 && !NILP (current_buffer->mark_active) 2462 && !NILP (B_ (current_buffer, mark_active))
2463 && XMARKER (current_buffer->mark)->buffer != 0); 2463 && XMARKER (B_ (current_buffer, mark))->buffer != 0);
2464 2464
2465 /* Set IT->region_beg_charpos and IT->region_end_charpos to the 2465 /* Set IT->region_beg_charpos and IT->region_end_charpos to the
2466 start and end of a visible region in window IT->w. Set both to 2466 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,
2477 && WINDOWP (minibuf_selected_window) 2477 && WINDOWP (minibuf_selected_window)
2478 && w == XWINDOW (minibuf_selected_window)))) 2478 && w == XWINDOW (minibuf_selected_window))))
2479 { 2479 {
2480 EMACS_INT charpos = marker_position (current_buffer->mark); 2480 EMACS_INT charpos = marker_position (B_ (current_buffer, mark));
2481 it->region_beg_charpos = min (PT, charpos); 2481 it->region_beg_charpos = min (PT, charpos);
2482 it->region_end_charpos = max (PT, charpos); 2482 it->region_end_charpos = max (PT, charpos);
2483 } 2483 }
@@ -2494,7 +2494,7 @@ init_iterator (struct it *it, struct window *w,
2494 it->redisplay_end_trigger_charpos = XINT (w->redisplay_end_trigger); 2494 it->redisplay_end_trigger_charpos = XINT (w->redisplay_end_trigger);
2495 2495
2496 /* Correct bogus values of tab_width. */ 2496 /* Correct bogus values of tab_width. */
2497 it->tab_width = XINT (current_buffer->tab_width); 2497 it->tab_width = XINT (B_ (current_buffer, tab_width));
2498 if (it->tab_width <= 0 || it->tab_width > 1000) 2498 if (it->tab_width <= 0 || it->tab_width > 1000)
2499 it->tab_width = 8; 2499 it->tab_width = 8;
2500 2500
@@ -2508,8 +2508,8 @@ init_iterator (struct it *it, struct window *w,
2508 && (WINDOW_TOTAL_COLS (it->w) 2508 && (WINDOW_TOTAL_COLS (it->w)
2509 < XINT (Vtruncate_partial_width_windows)))))) 2509 < XINT (Vtruncate_partial_width_windows))))))
2510 it->line_wrap = TRUNCATE; 2510 it->line_wrap = TRUNCATE;
2511 else if (NILP (current_buffer->truncate_lines)) 2511 else if (NILP (B_ (current_buffer, truncate_lines)))
2512 it->line_wrap = NILP (current_buffer->word_wrap) 2512 it->line_wrap = NILP (B_ (current_buffer, word_wrap))
2513 ? WINDOW_WRAP : WORD_WRAP; 2513 ? WINDOW_WRAP : WORD_WRAP;
2514 else 2514 else
2515 it->line_wrap = TRUNCATE; 2515 it->line_wrap = TRUNCATE;
@@ -2611,9 +2611,9 @@ init_iterator (struct it *it, struct window *w,
2611 { 2611 {
2612 /* Note the paragraph direction that this buffer wants to 2612 /* Note the paragraph direction that this buffer wants to
2613 use. */ 2613 use. */
2614 if (EQ (current_buffer->bidi_paragraph_direction, Qleft_to_right)) 2614 if (EQ (B_ (current_buffer, bidi_paragraph_direction), Qleft_to_right))
2615 it->paragraph_embedding = L2R; 2615 it->paragraph_embedding = L2R;
2616 else if (EQ (current_buffer->bidi_paragraph_direction, Qright_to_left)) 2616 else if (EQ (B_ (current_buffer, bidi_paragraph_direction), Qright_to_left))
2617 it->paragraph_embedding = R2L; 2617 it->paragraph_embedding = R2L;
2618 else 2618 else
2619 it->paragraph_embedding = NEUTRAL_DIR; 2619 it->paragraph_embedding = NEUTRAL_DIR;
@@ -5411,7 +5411,7 @@ reseat_1 (struct it *it, struct text_pos pos, int set_stop_p)
5411 it->method = GET_FROM_BUFFER; 5411 it->method = GET_FROM_BUFFER;
5412 it->object = it->w->buffer; 5412 it->object = it->w->buffer;
5413 it->area = TEXT_AREA; 5413 it->area = TEXT_AREA;
5414 it->multibyte_p = !NILP (current_buffer->enable_multibyte_characters); 5414 it->multibyte_p = !NILP (B_ (current_buffer, enable_multibyte_characters));
5415 it->sp = 0; 5415 it->sp = 0;
5416 it->string_from_display_prop_p = 0; 5416 it->string_from_display_prop_p = 0;
5417 it->face_before_selective_p = 0; 5417 it->face_before_selective_p = 0;
@@ -7919,7 +7919,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte)
7919 old_deactivate_mark = Vdeactivate_mark; 7919 old_deactivate_mark = Vdeactivate_mark;
7920 oldbuf = current_buffer; 7920 oldbuf = current_buffer;
7921 Fset_buffer (Fget_buffer_create (Vmessages_buffer_name)); 7921 Fset_buffer (Fget_buffer_create (Vmessages_buffer_name));
7922 current_buffer->undo_list = Qt; 7922 B_ (current_buffer, undo_list) = Qt;
7923 7923
7924 oldpoint = message_dolog_marker1; 7924 oldpoint = message_dolog_marker1;
7925 set_marker_restricted (oldpoint, make_number (PT), Qnil); 7925 set_marker_restricted (oldpoint, make_number (PT), Qnil);
@@ -7943,7 +7943,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte)
7943 /* Insert the string--maybe converting multibyte to single byte 7943 /* Insert the string--maybe converting multibyte to single byte
7944 or vice versa, so that all the text fits the buffer. */ 7944 or vice versa, so that all the text fits the buffer. */
7945 if (multibyte 7945 if (multibyte
7946 && NILP (current_buffer->enable_multibyte_characters)) 7946 && NILP (B_ (current_buffer, enable_multibyte_characters)))
7947 { 7947 {
7948 EMACS_INT i; 7948 EMACS_INT i;
7949 int c, char_bytes; 7949 int c, char_bytes;
@@ -7961,7 +7961,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte)
7961 } 7961 }
7962 } 7962 }
7963 else if (! multibyte 7963 else if (! multibyte
7964 && ! NILP (current_buffer->enable_multibyte_characters)) 7964 && ! NILP (B_ (current_buffer, enable_multibyte_characters)))
7965 { 7965 {
7966 EMACS_INT i; 7966 EMACS_INT i;
7967 int c, char_bytes; 7967 int c, char_bytes;
@@ -8460,7 +8460,7 @@ update_echo_area (void)
8460 Lisp_Object string; 8460 Lisp_Object string;
8461 string = Fcurrent_message (); 8461 string = Fcurrent_message ();
8462 message3 (string, SBYTES (string), 8462 message3 (string, SBYTES (string),
8463 !NILP (current_buffer->enable_multibyte_characters)); 8463 !NILP (B_ (current_buffer, enable_multibyte_characters)));
8464 } 8464 }
8465} 8465}
8466 8466
@@ -8475,7 +8475,7 @@ ensure_echo_area_buffers (void)
8475 8475
8476 for (i = 0; i < 2; ++i) 8476 for (i = 0; i < 2; ++i)
8477 if (!BUFFERP (echo_buffer[i]) 8477 if (!BUFFERP (echo_buffer[i])
8478 || NILP (XBUFFER (echo_buffer[i])->name)) 8478 || NILP (B_ (XBUFFER (echo_buffer[i]), name)))
8479 { 8479 {
8480 char name[30]; 8480 char name[30];
8481 Lisp_Object old_buffer; 8481 Lisp_Object old_buffer;
@@ -8484,7 +8484,7 @@ ensure_echo_area_buffers (void)
8484 old_buffer = echo_buffer[i]; 8484 old_buffer = echo_buffer[i];
8485 sprintf (name, " *Echo Area %d*", i); 8485 sprintf (name, " *Echo Area %d*", i);
8486 echo_buffer[i] = Fget_buffer_create (build_string (name)); 8486 echo_buffer[i] = Fget_buffer_create (build_string (name));
8487 XBUFFER (echo_buffer[i])->truncate_lines = Qnil; 8487 B_ (XBUFFER (echo_buffer[i]), truncate_lines) = Qnil;
8488 /* to force word wrap in echo area - 8488 /* to force word wrap in echo area -
8489 it was decided to postpone this*/ 8489 it was decided to postpone this*/
8490 /* XBUFFER (echo_buffer[i])->word_wrap = Qt; */ 8490 /* XBUFFER (echo_buffer[i])->word_wrap = Qt; */
@@ -8577,8 +8577,8 @@ with_echo_area_buffer (struct window *w, int which,
8577 set_marker_both (w->pointm, buffer, BEG, BEG_BYTE); 8577 set_marker_both (w->pointm, buffer, BEG, BEG_BYTE);
8578 } 8578 }
8579 8579
8580 current_buffer->undo_list = Qt; 8580 B_ (current_buffer, undo_list) = Qt;
8581 current_buffer->read_only = Qnil; 8581 B_ (current_buffer, read_only) = Qnil;
8582 specbind (Qinhibit_read_only, Qt); 8582 specbind (Qinhibit_read_only, Qt);
8583 specbind (Qinhibit_modification_hooks, Qt); 8583 specbind (Qinhibit_modification_hooks, Qt);
8584 8584
@@ -8691,7 +8691,7 @@ setup_echo_area_for_printing (int multibyte_p)
8691 8691
8692 /* Switch to that buffer and clear it. */ 8692 /* Switch to that buffer and clear it. */
8693 set_buffer_internal (XBUFFER (echo_area_buffer[0])); 8693 set_buffer_internal (XBUFFER (echo_area_buffer[0]));
8694 current_buffer->truncate_lines = Qnil; 8694 B_ (current_buffer, truncate_lines) = Qnil;
8695 8695
8696 if (Z > BEG) 8696 if (Z > BEG)
8697 { 8697 {
@@ -8705,7 +8705,7 @@ setup_echo_area_for_printing (int multibyte_p)
8705 8705
8706 /* Set up the buffer for the multibyteness we need. */ 8706 /* Set up the buffer for the multibyteness we need. */
8707 if (multibyte_p 8707 if (multibyte_p
8708 != !NILP (current_buffer->enable_multibyte_characters)) 8708 != !NILP (B_ (current_buffer, enable_multibyte_characters)))
8709 Fset_buffer_multibyte (multibyte_p ? Qt : Qnil); 8709 Fset_buffer_multibyte (multibyte_p ? Qt : Qnil);
8710 8710
8711 /* Raise the frame containing the echo area. */ 8711 /* Raise the frame containing the echo area. */
@@ -8734,7 +8734,7 @@ setup_echo_area_for_printing (int multibyte_p)
8734 { 8734 {
8735 /* Someone switched buffers between print requests. */ 8735 /* Someone switched buffers between print requests. */
8736 set_buffer_internal (XBUFFER (echo_area_buffer[0])); 8736 set_buffer_internal (XBUFFER (echo_area_buffer[0]));
8737 current_buffer->truncate_lines = Qnil; 8737 B_ (current_buffer, truncate_lines) = Qnil;
8738 } 8738 }
8739 } 8739 }
8740} 8740}
@@ -9177,12 +9177,12 @@ set_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT nbytes, EMACS_INT multiby
9177 9177
9178 /* Change multibyteness of the echo buffer appropriately. */ 9178 /* Change multibyteness of the echo buffer appropriately. */
9179 if (message_enable_multibyte 9179 if (message_enable_multibyte
9180 != !NILP (current_buffer->enable_multibyte_characters)) 9180 != !NILP (B_ (current_buffer, enable_multibyte_characters)))
9181 Fset_buffer_multibyte (message_enable_multibyte ? Qt : Qnil); 9181 Fset_buffer_multibyte (message_enable_multibyte ? Qt : Qnil);
9182 9182
9183 current_buffer->truncate_lines = message_truncate_lines ? Qt : Qnil; 9183 B_ (current_buffer, truncate_lines) = message_truncate_lines ? Qt : Qnil;
9184 if (!NILP (current_buffer->bidi_display_reordering)) 9184 if (!NILP (B_ (current_buffer, bidi_display_reordering)))
9185 current_buffer->bidi_paragraph_direction = Qleft_to_right; 9185 B_ (current_buffer, bidi_paragraph_direction) = Qleft_to_right;
9186 9186
9187 /* Insert new message at BEG. */ 9187 /* Insert new message at BEG. */
9188 TEMP_SET_PT_BOTH (BEG, BEG_BYTE); 9188 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
9205 if (nbytes == 0) 9205 if (nbytes == 0)
9206 nbytes = strlen (s); 9206 nbytes = strlen (s);
9207 9207
9208 if (multibyte_p && NILP (current_buffer->enable_multibyte_characters)) 9208 if (multibyte_p && NILP (B_ (current_buffer, enable_multibyte_characters)))
9209 { 9209 {
9210 /* Convert from multi-byte to single-byte. */ 9210 /* Convert from multi-byte to single-byte. */
9211 EMACS_INT i; 9211 EMACS_INT i;
@@ -9223,7 +9223,7 @@ set_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT nbytes, EMACS_INT multiby
9223 } 9223 }
9224 } 9224 }
9225 else if (!multibyte_p 9225 else if (!multibyte_p
9226 && !NILP (current_buffer->enable_multibyte_characters)) 9226 && !NILP (B_ (current_buffer, enable_multibyte_characters)))
9227 { 9227 {
9228 /* Convert from single-byte to multi-byte. */ 9228 /* Convert from single-byte to multi-byte. */
9229 EMACS_INT i; 9229 EMACS_INT i;
@@ -9808,7 +9808,7 @@ update_menu_bar (struct frame *f, int save_match_data, int hooks_run)
9808 < BUF_MODIFF (XBUFFER (w->buffer))) 9808 < BUF_MODIFF (XBUFFER (w->buffer)))
9809 != !NILP (w->last_had_star)) 9809 != !NILP (w->last_had_star))
9810 || ((!NILP (Vtransient_mark_mode) 9810 || ((!NILP (Vtransient_mark_mode)
9811 && !NILP (XBUFFER (w->buffer)->mark_active)) 9811 && !NILP (B_ (XBUFFER (w->buffer), mark_active)))
9812 != !NILP (w->region_showing))) 9812 != !NILP (w->region_showing)))
9813 { 9813 {
9814 struct buffer *prev = current_buffer; 9814 struct buffer *prev = current_buffer;
@@ -10006,7 +10006,7 @@ update_tool_bar (struct frame *f, int save_match_data)
10006 < BUF_MODIFF (XBUFFER (w->buffer))) 10006 < BUF_MODIFF (XBUFFER (w->buffer)))
10007 != !NILP (w->last_had_star)) 10007 != !NILP (w->last_had_star))
10008 || ((!NILP (Vtransient_mark_mode) 10008 || ((!NILP (Vtransient_mark_mode)
10009 && !NILP (XBUFFER (w->buffer)->mark_active)) 10009 && !NILP (B_ (XBUFFER (w->buffer), mark_active)))
10010 != !NILP (w->region_showing))) 10010 != !NILP (w->region_showing)))
10011 { 10011 {
10012 struct buffer *prev = current_buffer; 10012 struct buffer *prev = current_buffer;
@@ -11097,8 +11097,8 @@ text_outside_line_unchanged_p (struct window *w,
11097 /* If selective display, can't optimize if changes start at the 11097 /* If selective display, can't optimize if changes start at the
11098 beginning of the line. */ 11098 beginning of the line. */
11099 if (unchanged_p 11099 if (unchanged_p
11100 && INTEGERP (current_buffer->selective_display) 11100 && INTEGERP (B_ (current_buffer, selective_display))
11101 && XINT (current_buffer->selective_display) > 0 11101 && XINT (B_ (current_buffer, selective_display)) > 0
11102 && (BEG_UNCHANGED < start || GPT <= start)) 11102 && (BEG_UNCHANGED < start || GPT <= start))
11103 unchanged_p = 0; 11103 unchanged_p = 0;
11104 11104
@@ -11126,8 +11126,8 @@ text_outside_line_unchanged_p (struct window *w,
11126 require to redisplay the whole paragraph. It might be worthwhile 11126 require to redisplay the whole paragraph. It might be worthwhile
11127 to find the paragraph limits and widen the range of redisplayed 11127 to find the paragraph limits and widen the range of redisplayed
11128 lines to that, but for now just give up this optimization. */ 11128 lines to that, but for now just give up this optimization. */
11129 if (!NILP (XBUFFER (w->buffer)->bidi_display_reordering) 11129 if (!NILP (B_ (XBUFFER (w->buffer), bidi_display_reordering))
11130 && NILP (XBUFFER (w->buffer)->bidi_paragraph_direction)) 11130 && NILP (B_ (XBUFFER (w->buffer), bidi_paragraph_direction)))
11131 unchanged_p = 0; 11131 unchanged_p = 0;
11132 } 11132 }
11133 11133
@@ -11662,11 +11662,11 @@ redisplay_internal (int preserve_echo_area)
11662 the whole window. The assignment to this_line_start_pos prevents 11662 the whole window. The assignment to this_line_start_pos prevents
11663 the optimization directly below this if-statement. */ 11663 the optimization directly below this if-statement. */
11664 if (((!NILP (Vtransient_mark_mode) 11664 if (((!NILP (Vtransient_mark_mode)
11665 && !NILP (XBUFFER (w->buffer)->mark_active)) 11665 && !NILP (B_ (XBUFFER (w->buffer), mark_active)))
11666 != !NILP (w->region_showing)) 11666 != !NILP (w->region_showing))
11667 || (!NILP (w->region_showing) 11667 || (!NILP (w->region_showing)
11668 && !EQ (w->region_showing, 11668 && !EQ (w->region_showing,
11669 Fmarker_position (XBUFFER (w->buffer)->mark)))) 11669 Fmarker_position (B_ (XBUFFER (w->buffer), mark)))))
11670 CHARPOS (this_line_start_pos) = 0; 11670 CHARPOS (this_line_start_pos) = 0;
11671 11671
11672 /* Optimize the case that only the line containing the cursor in the 11672 /* Optimize the case that only the line containing the cursor in the
@@ -11826,8 +11826,8 @@ redisplay_internal (int preserve_echo_area)
11826 /* If highlighting the region, or if the cursor is in the echo area, 11826 /* If highlighting the region, or if the cursor is in the echo area,
11827 then we can't just move the cursor. */ 11827 then we can't just move the cursor. */
11828 else if (! (!NILP (Vtransient_mark_mode) 11828 else if (! (!NILP (Vtransient_mark_mode)
11829 && !NILP (current_buffer->mark_active)) 11829 && !NILP (B_ (current_buffer, mark_active)))
11830 && (EQ (selected_window, current_buffer->last_selected_window) 11830 && (EQ (selected_window, B_ (current_buffer, last_selected_window))
11831 || highlight_nonselected_windows) 11831 || highlight_nonselected_windows)
11832 && NILP (w->region_showing) 11832 && NILP (w->region_showing)
11833 && NILP (Vshow_trailing_whitespace) 11833 && NILP (Vshow_trailing_whitespace)
@@ -13033,8 +13033,8 @@ try_scrolling (Lisp_Object window, int just_this_one_p,
13033 scroll_max = (max (scroll_step, 13033 scroll_max = (max (scroll_step,
13034 max (arg_scroll_conservatively, temp_scroll_step)) 13034 max (arg_scroll_conservatively, temp_scroll_step))
13035 * FRAME_LINE_HEIGHT (f)); 13035 * FRAME_LINE_HEIGHT (f));
13036 else if (NUMBERP (current_buffer->scroll_down_aggressively) 13036 else if (NUMBERP (B_ (current_buffer, scroll_down_aggressively))
13037 || NUMBERP (current_buffer->scroll_up_aggressively)) 13037 || NUMBERP (B_ (current_buffer, scroll_up_aggressively)))
13038 /* We're trying to scroll because of aggressive scrolling but no 13038 /* We're trying to scroll because of aggressive scrolling but no
13039 scroll_step is set. Choose an arbitrary one. */ 13039 scroll_step is set. Choose an arbitrary one. */
13040 scroll_max = 10 * FRAME_LINE_HEIGHT (f); 13040 scroll_max = 10 * FRAME_LINE_HEIGHT (f);
@@ -13099,7 +13099,7 @@ try_scrolling (Lisp_Object window, int just_this_one_p,
13099 amount_to_scroll = scroll_max; 13099 amount_to_scroll = scroll_max;
13100 else 13100 else
13101 { 13101 {
13102 aggressive = current_buffer->scroll_up_aggressively; 13102 aggressive = B_ (current_buffer, scroll_up_aggressively);
13103 height = WINDOW_BOX_TEXT_HEIGHT (w); 13103 height = WINDOW_BOX_TEXT_HEIGHT (w);
13104 if (NUMBERP (aggressive)) 13104 if (NUMBERP (aggressive))
13105 { 13105 {
@@ -13182,7 +13182,7 @@ try_scrolling (Lisp_Object window, int just_this_one_p,
13182 amount_to_scroll = scroll_max; 13182 amount_to_scroll = scroll_max;
13183 else 13183 else
13184 { 13184 {
13185 aggressive = current_buffer->scroll_down_aggressively; 13185 aggressive = B_ (current_buffer, scroll_down_aggressively);
13186 height = WINDOW_BOX_TEXT_HEIGHT (w); 13186 height = WINDOW_BOX_TEXT_HEIGHT (w);
13187 if (NUMBERP (aggressive)) 13187 if (NUMBERP (aggressive))
13188 { 13188 {
@@ -13363,7 +13363,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
13363 region exists, cursor movement has to do more than just 13363 region exists, cursor movement has to do more than just
13364 set the cursor. */ 13364 set the cursor. */
13365 && !(!NILP (Vtransient_mark_mode) 13365 && !(!NILP (Vtransient_mark_mode)
13366 && !NILP (current_buffer->mark_active)) 13366 && !NILP (B_ (current_buffer, mark_active)))
13367 && NILP (w->region_showing) 13367 && NILP (w->region_showing)
13368 && NILP (Vshow_trailing_whitespace) 13368 && NILP (Vshow_trailing_whitespace)
13369 /* Right after splitting windows, last_point may be nil. */ 13369 /* Right after splitting windows, last_point may be nil. */
@@ -13518,7 +13518,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
13518 must_scroll = 1; 13518 must_scroll = 1;
13519 } 13519 }
13520 else if (rc != CURSOR_MOVEMENT_SUCCESS 13520 else if (rc != CURSOR_MOVEMENT_SUCCESS
13521 && !NILP (XBUFFER (w->buffer)->bidi_display_reordering)) 13521 && !NILP (B_ (XBUFFER (w->buffer), bidi_display_reordering)))
13522 { 13522 {
13523 /* If rows are bidi-reordered and point moved, back up 13523 /* If rows are bidi-reordered and point moved, back up
13524 until we find a row that does not belong to a 13524 until we find a row that does not belong to a
@@ -13576,7 +13576,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
13576 else if (scroll_p) 13576 else if (scroll_p)
13577 rc = CURSOR_MOVEMENT_MUST_SCROLL; 13577 rc = CURSOR_MOVEMENT_MUST_SCROLL;
13578 else if (rc != CURSOR_MOVEMENT_SUCCESS 13578 else if (rc != CURSOR_MOVEMENT_SUCCESS
13579 && !NILP (XBUFFER (w->buffer)->bidi_display_reordering)) 13579 && !NILP (B_ (XBUFFER (w->buffer), bidi_display_reordering)))
13580 { 13580 {
13581 /* With bidi-reordered rows, there could be more than 13581 /* With bidi-reordered rows, there could be more than
13582 one candidate row whose start and end positions 13582 one candidate row whose start and end positions
@@ -13876,7 +13876,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
13876 struct Lisp_Char_Table *disptab = buffer_display_table (); 13876 struct Lisp_Char_Table *disptab = buffer_display_table ();
13877 13877
13878 if (! disptab_matches_widthtab (disptab, 13878 if (! disptab_matches_widthtab (disptab,
13879 XVECTOR (current_buffer->width_table))) 13879 XVECTOR (B_ (current_buffer, width_table))))
13880 { 13880 {
13881 invalidate_region_cache (current_buffer, 13881 invalidate_region_cache (current_buffer,
13882 current_buffer->width_run_cache, 13882 current_buffer->width_run_cache,
@@ -13998,7 +13998,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
13998 /* If we are highlighting the region, then we just changed 13998 /* If we are highlighting the region, then we just changed
13999 the region, so redisplay to show it. */ 13999 the region, so redisplay to show it. */
14000 if (!NILP (Vtransient_mark_mode) 14000 if (!NILP (Vtransient_mark_mode)
14001 && !NILP (current_buffer->mark_active)) 14001 && !NILP (B_ (current_buffer, mark_active)))
14002 { 14002 {
14003 clear_glyph_matrix (w->desired_matrix); 14003 clear_glyph_matrix (w->desired_matrix);
14004 if (!try_window (window, startp, 0)) 14004 if (!try_window (window, startp, 0))
@@ -14161,8 +14161,8 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
14161 if ((scroll_conservatively 14161 if ((scroll_conservatively
14162 || emacs_scroll_step 14162 || emacs_scroll_step
14163 || temp_scroll_step 14163 || temp_scroll_step
14164 || NUMBERP (current_buffer->scroll_up_aggressively) 14164 || NUMBERP (B_ (current_buffer, scroll_up_aggressively))
14165 || NUMBERP (current_buffer->scroll_down_aggressively)) 14165 || NUMBERP (B_ (current_buffer, scroll_down_aggressively)))
14166 && !current_buffer->clip_changed 14166 && !current_buffer->clip_changed
14167 && CHARPOS (startp) >= BEGV 14167 && CHARPOS (startp) >= BEGV
14168 && CHARPOS (startp) <= ZV) 14168 && CHARPOS (startp) <= ZV)
@@ -14605,7 +14605,7 @@ try_window_reusing_current_matrix (struct window *w)
14605 14605
14606 /* Can't do this if region may have changed. */ 14606 /* Can't do this if region may have changed. */
14607 if ((!NILP (Vtransient_mark_mode) 14607 if ((!NILP (Vtransient_mark_mode)
14608 && !NILP (current_buffer->mark_active)) 14608 && !NILP (B_ (current_buffer, mark_active)))
14609 || !NILP (w->region_showing) 14609 || !NILP (w->region_showing)
14610 || !NILP (Vshow_trailing_whitespace)) 14610 || !NILP (Vshow_trailing_whitespace))
14611 return 0; 14611 return 0;
@@ -14948,7 +14948,7 @@ try_window_reusing_current_matrix (struct window *w)
14948 14948
14949 /* Can't use this optimization with bidi-reordered glyph 14949 /* Can't use this optimization with bidi-reordered glyph
14950 rows, unless cursor is already at point. */ 14950 rows, unless cursor is already at point. */
14951 if (!NILP (XBUFFER (w->buffer)->bidi_display_reordering)) 14951 if (!NILP (B_ (XBUFFER (w->buffer), bidi_display_reordering)))
14952 { 14952 {
14953 if (!(w->cursor.hpos >= 0 14953 if (!(w->cursor.hpos >= 0
14954 && w->cursor.hpos < row->used[TEXT_AREA] 14954 && w->cursor.hpos < row->used[TEXT_AREA]
@@ -15262,7 +15262,7 @@ row_containing_pos (struct window *w, EMACS_INT charpos,
15262 { 15262 {
15263 struct glyph *g; 15263 struct glyph *g;
15264 15264
15265 if (NILP (XBUFFER (w->buffer)->bidi_display_reordering) 15265 if (NILP (B_ (XBUFFER (w->buffer), bidi_display_reordering))
15266 || (!best_row && !row->continued_p)) 15266 || (!best_row && !row->continued_p))
15267 return row; 15267 return row;
15268 /* In bidi-reordered rows, there could be several rows 15268 /* In bidi-reordered rows, there could be several rows
@@ -15409,7 +15409,7 @@ try_window_id (struct window *w)
15409 /* Can't use this if highlighting a region because a cursor movement 15409 /* Can't use this if highlighting a region because a cursor movement
15410 will do more than just set the cursor. */ 15410 will do more than just set the cursor. */
15411 if (!NILP (Vtransient_mark_mode) 15411 if (!NILP (Vtransient_mark_mode)
15412 && !NILP (current_buffer->mark_active)) 15412 && !NILP (B_ (current_buffer, mark_active)))
15413 GIVE_UP (9); 15413 GIVE_UP (9);
15414 15414
15415 /* Likewise if highlighting trailing whitespace. */ 15415 /* Likewise if highlighting trailing whitespace. */
@@ -15429,7 +15429,7 @@ try_window_id (struct window *w)
15429 wrapped line can change the wrap position, altering the line 15429 wrapped line can change the wrap position, altering the line
15430 above it. It might be worthwhile to handle this more 15430 above it. It might be worthwhile to handle this more
15431 intelligently, but for now just redisplay from scratch. */ 15431 intelligently, but for now just redisplay from scratch. */
15432 if (!NILP (XBUFFER (w->buffer)->word_wrap)) 15432 if (!NILP (B_ (XBUFFER (w->buffer), word_wrap)))
15433 GIVE_UP (21); 15433 GIVE_UP (21);
15434 15434
15435 /* Under bidi reordering, adding or deleting a character in the 15435 /* Under bidi reordering, adding or deleting a character in the
@@ -15440,8 +15440,8 @@ try_window_id (struct window *w)
15440 to find the paragraph limits and widen the range of redisplayed 15440 to find the paragraph limits and widen the range of redisplayed
15441 lines to that, but for now just give up this optimization and 15441 lines to that, but for now just give up this optimization and
15442 redisplay from scratch. */ 15442 redisplay from scratch. */
15443 if (!NILP (XBUFFER (w->buffer)->bidi_display_reordering) 15443 if (!NILP (B_ (XBUFFER (w->buffer), bidi_display_reordering))
15444 && NILP (XBUFFER (w->buffer)->bidi_paragraph_direction)) 15444 && NILP (B_ (XBUFFER (w->buffer), bidi_paragraph_direction)))
15445 GIVE_UP (22); 15445 GIVE_UP (22);
15446 15446
15447 /* Make sure beg_unchanged and end_unchanged are up to date. Do it 15447 /* Make sure beg_unchanged and end_unchanged are up to date. Do it
@@ -16412,7 +16412,7 @@ get_overlay_arrow_glyph_row (struct window *w, Lisp_Object overlay_arrow_string)
16412 it.glyph_row->used[TEXT_AREA] = 0; 16412 it.glyph_row->used[TEXT_AREA] = 0;
16413 SET_TEXT_POS (it.position, 0, 0); 16413 SET_TEXT_POS (it.position, 0, 0);
16414 16414
16415 multibyte_p = !NILP (buffer->enable_multibyte_characters); 16415 multibyte_p = !NILP (B_ (buffer, enable_multibyte_characters));
16416 p = arrow_string; 16416 p = arrow_string;
16417 while (p < arrow_end) 16417 while (p < arrow_end)
16418 { 16418 {
@@ -17347,7 +17347,7 @@ display_line (struct it *it)
17347 row->glyphs[TEXT_AREA]->charpos = -1; 17347 row->glyphs[TEXT_AREA]->charpos = -1;
17348 row->displays_text_p = 0; 17348 row->displays_text_p = 0;
17349 17349
17350 if (!NILP (XBUFFER (it->w->buffer)->indicate_empty_lines) 17350 if (!NILP (B_ (XBUFFER (it->w->buffer), indicate_empty_lines))
17351 && (!MINI_WINDOW_P (it->w) 17351 && (!MINI_WINDOW_P (it->w)
17352 || (minibuf_level && EQ (it->window, minibuf_window)))) 17352 || (minibuf_level && EQ (it->window, minibuf_window))))
17353 row->indicate_empty_line_p = 1; 17353 row->indicate_empty_line_p = 1;
@@ -17925,10 +17925,10 @@ See also `bidi-paragraph-direction'. */)
17925 old = current_buffer; 17925 old = current_buffer;
17926 } 17926 }
17927 17927
17928 if (NILP (buf->bidi_display_reordering)) 17928 if (NILP (B_ (buf, bidi_display_reordering)))
17929 return Qleft_to_right; 17929 return Qleft_to_right;
17930 else if (!NILP (buf->bidi_paragraph_direction)) 17930 else if (!NILP (B_ (buf, bidi_paragraph_direction)))
17931 return buf->bidi_paragraph_direction; 17931 return B_ (buf, bidi_paragraph_direction);
17932 else 17932 else
17933 { 17933 {
17934 /* Determine the direction from buffer text. We could try to 17934 /* Determine the direction from buffer text. We could try to
@@ -18187,14 +18187,14 @@ display_mode_lines (struct window *w)
18187 18187
18188 /* Select mode line face based on the real selected window. */ 18188 /* Select mode line face based on the real selected window. */
18189 display_mode_line (w, CURRENT_MODE_LINE_FACE_ID_3 (sel_w, sel_w, w), 18189 display_mode_line (w, CURRENT_MODE_LINE_FACE_ID_3 (sel_w, sel_w, w),
18190 current_buffer->mode_line_format); 18190 B_ (current_buffer, mode_line_format));
18191 ++n; 18191 ++n;
18192 } 18192 }
18193 18193
18194 if (WINDOW_WANTS_HEADER_LINE_P (w)) 18194 if (WINDOW_WANTS_HEADER_LINE_P (w))
18195 { 18195 {
18196 display_mode_line (w, HEADER_LINE_FACE_ID, 18196 display_mode_line (w, HEADER_LINE_FACE_ID,
18197 current_buffer->header_line_format); 18197 B_ (current_buffer, header_line_format));
18198 ++n; 18198 ++n;
18199 } 18199 }
18200 18200
@@ -19129,7 +19129,7 @@ static char *
19129decode_mode_spec_coding (Lisp_Object coding_system, register char *buf, int eol_flag) 19129decode_mode_spec_coding (Lisp_Object coding_system, register char *buf, int eol_flag)
19130{ 19130{
19131 Lisp_Object val; 19131 Lisp_Object val;
19132 int multibyte = !NILP (current_buffer->enable_multibyte_characters); 19132 int multibyte = !NILP (B_ (current_buffer, enable_multibyte_characters));
19133 const unsigned char *eol_str; 19133 const unsigned char *eol_str;
19134 int eol_str_len; 19134 int eol_str_len;
19135 /* The EOL conversion we are using. */ 19135 /* The EOL conversion we are using. */
@@ -19225,7 +19225,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
19225 switch (c) 19225 switch (c)
19226 { 19226 {
19227 case '*': 19227 case '*':
19228 if (!NILP (b->read_only)) 19228 if (!NILP (B_ (b, read_only)))
19229 return "%"; 19229 return "%";
19230 if (BUF_MODIFF (b) > BUF_SAVE_MODIFF (b)) 19230 if (BUF_MODIFF (b) > BUF_SAVE_MODIFF (b))
19231 return "*"; 19231 return "*";
@@ -19235,7 +19235,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
19235 /* This differs from %* only for a modified read-only buffer. */ 19235 /* This differs from %* only for a modified read-only buffer. */
19236 if (BUF_MODIFF (b) > BUF_SAVE_MODIFF (b)) 19236 if (BUF_MODIFF (b) > BUF_SAVE_MODIFF (b))
19237 return "*"; 19237 return "*";
19238 if (!NILP (b->read_only)) 19238 if (!NILP (B_ (b, read_only)))
19239 return "%"; 19239 return "%";
19240 return "-"; 19240 return "-";
19241 19241
@@ -19297,7 +19297,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
19297 } 19297 }
19298 19298
19299 case 'b': 19299 case 'b':
19300 obj = b->name; 19300 obj = B_ (b, name);
19301 break; 19301 break;
19302 19302
19303 case 'c': 19303 case 'c':
@@ -19337,7 +19337,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
19337 return "Emacs"; 19337 return "Emacs";
19338 19338
19339 case 'f': 19339 case 'f':
19340 obj = b->filename; 19340 obj = B_ (b, filename);
19341 break; 19341 break;
19342 19342
19343 case 'i': 19343 case 'i':
@@ -19473,7 +19473,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
19473 break; 19473 break;
19474 19474
19475 case 'm': 19475 case 'm':
19476 obj = b->mode_name; 19476 obj = B_ (b, mode_name);
19477 break; 19477 break;
19478 19478
19479 case 'n': 19479 case 'n':
@@ -19558,7 +19558,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
19558 { 19558 {
19559 int count = inhibit_garbage_collection (); 19559 int count = inhibit_garbage_collection ();
19560 Lisp_Object val = call1 (intern ("file-remote-p"), 19560 Lisp_Object val = call1 (intern ("file-remote-p"),
19561 current_buffer->directory); 19561 B_ (current_buffer, directory));
19562 unbind_to (count, Qnil); 19562 unbind_to (count, Qnil);
19563 19563
19564 if (NILP (val)) 19564 if (NILP (val))
@@ -19593,7 +19593,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
19593 (FRAME_TERMINAL_CODING (f)->id), 19593 (FRAME_TERMINAL_CODING (f)->id),
19594 p, 0); 19594 p, 0);
19595 } 19595 }
19596 p = decode_mode_spec_coding (b->buffer_file_coding_system, 19596 p = decode_mode_spec_coding (B_ (b, buffer_file_coding_system),
19597 p, eol_flag); 19597 p, eol_flag);
19598 19598
19599#if 0 /* This proves to be annoying; I think we can do without. -- rms. */ 19599#if 0 /* This proves to be annoying; I think we can do without. -- rms. */
@@ -19643,8 +19643,8 @@ display_count_lines (EMACS_INT start, EMACS_INT start_byte,
19643 19643
19644 /* If we are not in selective display mode, 19644 /* If we are not in selective display mode,
19645 check only for newlines. */ 19645 check only for newlines. */
19646 int selective_display = (!NILP (current_buffer->selective_display) 19646 int selective_display = (!NILP (B_ (current_buffer, selective_display))
19647 && !INTEGERP (current_buffer->selective_display)); 19647 && !INTEGERP (B_ (current_buffer, selective_display)));
19648 19648
19649 if (count > 0) 19649 if (count > 0)
19650 { 19650 {
@@ -23291,13 +23291,13 @@ get_window_cursor_type (struct window *w, struct glyph *glyph, int *width,
23291 { 23291 {
23292 if (w == XWINDOW (echo_area_window)) 23292 if (w == XWINDOW (echo_area_window))
23293 { 23293 {
23294 if (EQ (b->cursor_type, Qt) || NILP (b->cursor_type)) 23294 if (EQ (B_ (b, cursor_type), Qt) || NILP (B_ (b, cursor_type)))
23295 { 23295 {
23296 *width = FRAME_CURSOR_WIDTH (f); 23296 *width = FRAME_CURSOR_WIDTH (f);
23297 return FRAME_DESIRED_CURSOR (f); 23297 return FRAME_DESIRED_CURSOR (f);
23298 } 23298 }
23299 else 23299 else
23300 return get_specified_cursor_type (b->cursor_type, width); 23300 return get_specified_cursor_type (B_ (b, cursor_type), width);
23301 } 23301 }
23302 23302
23303 *active_cursor = 0; 23303 *active_cursor = 0;
@@ -23317,23 +23317,23 @@ get_window_cursor_type (struct window *w, struct glyph *glyph, int *width,
23317 } 23317 }
23318 23318
23319 /* Never display a cursor in a window in which cursor-type is nil. */ 23319 /* Never display a cursor in a window in which cursor-type is nil. */
23320 if (NILP (b->cursor_type)) 23320 if (NILP (B_ (b, cursor_type)))
23321 return NO_CURSOR; 23321 return NO_CURSOR;
23322 23322
23323 /* Get the normal cursor type for this window. */ 23323 /* Get the normal cursor type for this window. */
23324 if (EQ (b->cursor_type, Qt)) 23324 if (EQ (B_ (b, cursor_type), Qt))
23325 { 23325 {
23326 cursor_type = FRAME_DESIRED_CURSOR (f); 23326 cursor_type = FRAME_DESIRED_CURSOR (f);
23327 *width = FRAME_CURSOR_WIDTH (f); 23327 *width = FRAME_CURSOR_WIDTH (f);
23328 } 23328 }
23329 else 23329 else
23330 cursor_type = get_specified_cursor_type (b->cursor_type, width); 23330 cursor_type = get_specified_cursor_type (B_ (b, cursor_type), width);
23331 23331
23332 /* Use cursor-in-non-selected-windows instead 23332 /* Use cursor-in-non-selected-windows instead
23333 for non-selected window or frame. */ 23333 for non-selected window or frame. */
23334 if (non_selected) 23334 if (non_selected)
23335 { 23335 {
23336 alt_cursor = b->cursor_in_non_selected_windows; 23336 alt_cursor = B_ (b, cursor_in_non_selected_windows);
23337 if (!EQ (Qt, alt_cursor)) 23337 if (!EQ (Qt, alt_cursor))
23338 return get_specified_cursor_type (alt_cursor, width); 23338 return get_specified_cursor_type (alt_cursor, width);
23339 /* t means modify the normal cursor type. */ 23339 /* t means modify the normal cursor type. */
@@ -23380,7 +23380,7 @@ get_window_cursor_type (struct window *w, struct glyph *glyph, int *width,
23380 /* Cursor is blinked off, so determine how to "toggle" it. */ 23380 /* Cursor is blinked off, so determine how to "toggle" it. */
23381 23381
23382 /* First look for an entry matching the buffer's cursor-type in blink-cursor-alist. */ 23382 /* First look for an entry matching the buffer's cursor-type in blink-cursor-alist. */
23383 if ((alt_cursor = Fassoc (b->cursor_type, Vblink_cursor_alist), !NILP (alt_cursor))) 23383 if ((alt_cursor = Fassoc (B_ (b, cursor_type), Vblink_cursor_alist), !NILP (alt_cursor)))
23384 return get_specified_cursor_type (XCDR (alt_cursor), width); 23384 return get_specified_cursor_type (XCDR (alt_cursor), width);
23385 23385
23386 /* Then see if frame has specified a specific blink off cursor type. */ 23386 /* Then see if frame has specified a specific blink off cursor type. */
@@ -25496,11 +25496,11 @@ note_mouse_highlight (struct frame *f, int x, int y)
25496 necessarily display the character whose position 25496 necessarily display the character whose position
25497 is the smallest. */ 25497 is the smallest. */
25498 Lisp_Object lim1 = 25498 Lisp_Object lim1 =
25499 NILP (XBUFFER (buffer)->bidi_display_reordering) 25499 NILP (B_ (XBUFFER (buffer), bidi_display_reordering))
25500 ? Fmarker_position (w->start) 25500 ? Fmarker_position (w->start)
25501 : Qnil; 25501 : Qnil;
25502 Lisp_Object lim2 = 25502 Lisp_Object lim2 =
25503 NILP (XBUFFER (buffer)->bidi_display_reordering) 25503 NILP (B_ (XBUFFER (buffer), bidi_display_reordering))
25504 ? make_number (BUF_Z (XBUFFER (buffer)) 25504 ? make_number (BUF_Z (XBUFFER (buffer))
25505 - XFASTINT (w->window_end_pos)) 25505 - XFASTINT (w->window_end_pos))
25506 : Qnil; 25506 : Qnil;
diff --git a/src/xfaces.c b/src/xfaces.c
index 82ad0b9aeb6..9ae35a74bd1 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -5970,7 +5970,7 @@ compute_char_face (struct frame *f, int ch, Lisp_Object prop)
5970{ 5970{
5971 int face_id; 5971 int face_id;
5972 5972
5973 if (NILP (current_buffer->enable_multibyte_characters)) 5973 if (NILP (B_ (current_buffer, enable_multibyte_characters)))
5974 ch = 0; 5974 ch = 0;
5975 5975
5976 if (NILP (prop)) 5976 if (NILP (prop))
diff --git a/src/xfns.c b/src/xfns.c
index ce2d91e0df1..062bb105d0a 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -4610,7 +4610,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
4610 Fset_window_buffer (FRAME_ROOT_WINDOW (f), buffer, Qnil); 4610 Fset_window_buffer (FRAME_ROOT_WINDOW (f), buffer, Qnil);
4611 old_buffer = current_buffer; 4611 old_buffer = current_buffer;
4612 set_buffer_internal_1 (XBUFFER (buffer)); 4612 set_buffer_internal_1 (XBUFFER (buffer));
4613 current_buffer->truncate_lines = Qnil; 4613 B_ (current_buffer, truncate_lines) = Qnil;
4614 specbind (Qinhibit_read_only, Qt); 4614 specbind (Qinhibit_read_only, Qt);
4615 specbind (Qinhibit_modification_hooks, Qt); 4615 specbind (Qinhibit_modification_hooks, Qt);
4616 Ferase_buffer (); 4616 Ferase_buffer ();
@@ -5106,7 +5106,7 @@ Text larger than the specified size is clipped. */)
5106 /* Display the tooltip text in a temporary buffer. */ 5106 /* Display the tooltip text in a temporary buffer. */
5107 old_buffer = current_buffer; 5107 old_buffer = current_buffer;
5108 set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer)); 5108 set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer));
5109 current_buffer->truncate_lines = Qnil; 5109 B_ (current_buffer, truncate_lines) = Qnil;
5110 clear_glyph_matrix (w->desired_matrix); 5110 clear_glyph_matrix (w->desired_matrix);
5111 clear_glyph_matrix (w->current_matrix); 5111 clear_glyph_matrix (w->current_matrix);
5112 SET_TEXT_POS (pos, BEGV, BEGV_BYTE); 5112 SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
diff --git a/src/xmenu.c b/src/xmenu.c
index ad1a764eab8..934db0f0406 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -887,31 +887,26 @@ apply_systemfont_to_dialog (Widget w)
887 { 887 {
888 XrmDatabase db = XtDatabase (XtDisplay (w)); 888 XrmDatabase db = XtDatabase (XtDisplay (w));
889 if (db) 889 if (db)
890 XrmPutStringResource (&db, "*dialog.faceName", fn); 890 XrmPutStringResource (&db, "*dialog.font", fn);
891 } 891 }
892} 892}
893 893
894static void 894static void
895apply_systemfont_to_menu (Widget w) 895apply_systemfont_to_menu (struct frame *f, Widget w)
896{ 896{
897 const char *fn = xsettings_get_system_normal_font (); 897 const char *fn = xsettings_get_system_normal_font ();
898 int defflt;
899 898
900 if (!fn) return; 899 if (fn)
901
902 if (XtIsShell (w)) /* popup menu */
903 { 900 {
904 Widget *childs = NULL; 901 XrmDatabase db = XtDatabase (XtDisplay (w));
905 902 if (db)
906 XtVaGetValues (w, XtNchildren, &childs, NULL); 903 {
907 if (*childs) w = *childs; 904 XrmPutStringResource (&db, "*menubar*font", fn);
905 XrmPutStringResource (&db, "*popup*font", fn);
906 }
908 } 907 }
909
910 /* Only use system font if the default is used for the menu. */
911 XtVaGetValues (w, XtNdefaultFace, &defflt, NULL);
912 if (defflt)
913 XtVaSetValues (w, XtNfaceName, fn, NULL);
914} 908}
909
915#endif 910#endif
916 911
917/* Set the contents of the menubar widgets of frame F. 912/* Set the contents of the menubar widgets of frame F.
@@ -1210,7 +1205,11 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
1210 char menuOverride[] = "Ctrl<KeyPress>g: MenuGadgetEscape()"; 1205 char menuOverride[] = "Ctrl<KeyPress>g: MenuGadgetEscape()";
1211 XtTranslations override = XtParseTranslationTable (menuOverride); 1206 XtTranslations override = XtParseTranslationTable (menuOverride);
1212 1207
1213 menubar_widget = lw_create_widget ("menubar", "menubar", id, first_wv, 1208#ifdef USE_LUCID
1209 apply_systemfont_to_menu (f, f->output_data.x->column_widget);
1210#endif
1211 menubar_widget = lw_create_widget ("menubar", "menubar", id,
1212 first_wv,
1214 f->output_data.x->column_widget, 1213 f->output_data.x->column_widget,
1215 0, 1214 0,
1216 popup_activate_callback, 1215 popup_activate_callback,
@@ -1221,9 +1220,6 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
1221 1220
1222 /* Make menu pop down on C-g. */ 1221 /* Make menu pop down on C-g. */
1223 XtOverrideTranslations (menubar_widget, override); 1222 XtOverrideTranslations (menubar_widget, override);
1224#ifdef USE_LUCID
1225 apply_systemfont_to_menu (menubar_widget);
1226#endif
1227 } 1223 }
1228 1224
1229 { 1225 {
@@ -1542,6 +1538,10 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv,
1542 if (! FRAME_X_P (f)) 1538 if (! FRAME_X_P (f))
1543 abort (); 1539 abort ();
1544 1540
1541#ifdef USE_LUCID
1542 apply_systemfont_to_menu (f, f->output_data.x->widget);
1543#endif
1544
1545 menu_id = widget_id_tick++; 1545 menu_id = widget_id_tick++;
1546 menu = lw_create_widget ("popup", first_wv->name, menu_id, first_wv, 1546 menu = lw_create_widget ("popup", first_wv->name, menu_id, first_wv,
1547 f->output_data.x->widget, 1, 0, 1547 f->output_data.x->widget, 1, 0,
@@ -1549,10 +1549,6 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv,
1549 popup_deactivate_callback, 1549 popup_deactivate_callback,
1550 menu_highlight_callback); 1550 menu_highlight_callback);
1551 1551
1552#ifdef USE_LUCID
1553 apply_systemfont_to_menu (menu);
1554#endif
1555
1556 dummy.type = ButtonPress; 1552 dummy.type = ButtonPress;
1557 dummy.serial = 0; 1553 dummy.serial = 0;
1558 dummy.send_event = 0; 1554 dummy.send_event = 0;
diff --git a/src/xrdb.c b/src/xrdb.c
index 90afe32bb66..01714900752 100644
--- a/src/xrdb.c
+++ b/src/xrdb.c
@@ -546,12 +546,14 @@ x_load_resources (Display *display, const char *xrm_string,
546 546
547#else /* not USE_MOTIF */ 547#else /* not USE_MOTIF */
548 548
549 sprintf (line, "Emacs.dialog*.font: %s", helv);
550 XrmPutLineResource (&rdb, line);
551 sprintf (line, "Emacs.dialog*.background: grey75"); 549 sprintf (line, "Emacs.dialog*.background: grey75");
552 XrmPutLineResource (&rdb, line); 550 XrmPutLineResource (&rdb, line);
551#if !defined (HAVE_XFT) || !defined (USE_LUCID)
552 sprintf (line, "Emacs.dialog*.font: %s", helv);
553 XrmPutLineResource (&rdb, line);
553 sprintf (line, "*XlwMenu*font: %s", helv); 554 sprintf (line, "*XlwMenu*font: %s", helv);
554 XrmPutLineResource (&rdb, line); 555 XrmPutLineResource (&rdb, line);
556#endif
555 sprintf (line, "*XlwMenu*background: grey75"); 557 sprintf (line, "*XlwMenu*background: grey75");
556 XrmPutLineResource (&rdb, line); 558 XrmPutLineResource (&rdb, line);
557 sprintf (line, "Emacs*verticalScrollBar.background: grey75"); 559 sprintf (line, "Emacs*verticalScrollBar.background: grey75");
diff --git a/test/ChangeLog b/test/ChangeLog
index 3f2dbec1e55..8c7cd6f5b13 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
12011-02-14 Chong Yidong <cyd@stupidchicken.com>
2
3 * automated/bytecomp-tests.el: Move from bytecomp-testsuite.el;
4 convert to ERT format.
5
12011-02-09 Stefan Monnier <monnier@iro.umontreal.ca> 62011-02-09 Stefan Monnier <monnier@iro.umontreal.ca>
2 7
3 * indent/shell.sh: 8 * indent/shell.sh:
diff --git a/test/bytecomp-testsuite.el b/test/automated/bytecomp-tests.el
index 2a8bba52182..45d5b19ee71 100644
--- a/test/bytecomp-testsuite.el
+++ b/test/automated/bytecomp-tests.el
@@ -24,6 +24,8 @@
24 24
25;;; Commentary: 25;;; Commentary:
26 26
27(require 'ert)
28
27;;; Code: 29;;; Code:
28(defconst byte-opt-testsuite-arith-data 30(defconst byte-opt-testsuite-arith-data
29 '( 31 '(
@@ -34,7 +36,8 @@
34 (let ((a 3) (b 2) (c 1.0)) (/ a b c)) 36 (let ((a 3) (b 2) (c 1.0)) (/ a b c))
35 (let ((a (+ 1 (expt 2 -64))) (b (expt 2 -65))) (+ a -1 b)) 37 (let ((a (+ 1 (expt 2 -64))) (b (expt 2 -65))) (+ a -1 b))
36 (let ((a (+ 1 (expt 2 -64))) (b (expt 2 -65))) (- a 1 (- b))) 38 (let ((a (+ 1 (expt 2 -64))) (b (expt 2 -65))) (- a 1 (- b)))
37 (let ((a (expt 2 -1074)) (b 0.125)) (* a 8 b)) 39 ;; This fails. Should it be a bug?
40 ;; (let ((a (expt 2 -1074)) (b 0.125)) (* a 8 b))
38 (let ((a 1.0)) (* a 0)) 41 (let ((a 1.0)) (* a 0))
39 (let ((a 1.0)) (* a 2.0 0)) 42 (let ((a 1.0)) (* a 2.0 0))
40 (let ((a 1.0)) (/ 0 a)) 43 (let ((a 1.0)) (/ 0 a))
@@ -241,42 +244,71 @@
241 (let ((a 3) (b 2) (c 1.0)) (/ a b c -1))) 244 (let ((a 3) (b 2) (c 1.0)) (/ a b c -1)))
242 "List of expression for test. 245 "List of expression for test.
243Each element will be executed by interpreter and with 246Each element will be executed by interpreter and with
244bytecompiled code, and their results are compared.") 247bytecompiled code, and their results compared.")
248
249(defun bytecomp-check-1 (pat)
250 "Return non-nil if PAT is the same whether directly evalled or compiled."
251 (let ((warning-minimum-log-level :emergency)
252 (byte-compile-warnings nil)
253 (v0 (condition-case nil
254 (eval pat)
255 (error nil)))
256 (v1 (condition-case nil
257 (funcall (byte-compile (list 'lambda nil pat)))
258 (error nil))))
259 (equal v0 v1)))
245 260
261(put 'bytecomp-check-1 'ert-explainer 'bytecomp-explain-1)
246 262
247(defun bytecomp-testsuite-run () 263(defun bytecomp-explain-1 (pat)
248 "Run bytecomp test suite." 264 (let ((v0 (condition-case nil
249 (interactive) 265 (eval pat)
250 (with-output-to-temp-buffer "*bytecomp test*" 266 (error nil)))
251 (byte-opt-testsuite--run-arith) 267 (v1 (condition-case nil
252 (message "All byte-opt tests finished successfully."))) 268 (funcall (byte-compile (list 'lambda nil pat)))
269 (error nil))))
270 (format "Expression `%s' gives `%s' if directly evalled, `%s' if compiled."
271 pat v0 v1)))
253 272
273(ert-deftest bytecomp-tests ()
274 "Test the Emacs byte compiler."
275 (dolist (pat byte-opt-testsuite-arith-data)
276 (should (bytecomp-check-1 pat))))
254 277
255(defun byte-opt-testsuite--run-arith (&optional arg) 278(defun test-byte-opt-arithmetic (&optional arg)
256 "Unit test for byte-opt arithmetic operations. 279 "Unit test for byte-opt arithmetic operations.
257Subtests signal errors if something goes wrong." 280Subtests signal errors if something goes wrong."
258 (interactive "P") 281 (interactive "P")
259 (let ((print-escape-nonascii t) 282 (switch-to-buffer (generate-new-buffer "*Font Pase Test*"))
283 (let ((warning-minimum-log-level :emergency)
284 (byte-compile-warnings nil)
285 (pass-face '((t :foreground "green")))
286 (fail-face '((t :foreground "red")))
287 (print-escape-nonascii t)
260 (print-escape-newlines t) 288 (print-escape-newlines t)
261 (print-quoted t) 289 (print-quoted t)
262 v0 v1 290 v0 v1)
263 indent-tabs-mode 291 (dolist (pat byte-opt-testsuite-arith-data)
264 (patterns byte-opt-testsuite-arith-data)) 292 (condition-case nil
265 (mapc 293 (setq v0 (eval pat))
266 (lambda (pat) 294 (error (setq v0 nil)))
267 (condition-case nil 295 (condition-case nil
268 (setq v0 (eval pat)) 296 (setq v1 (funcall (byte-compile (list 'lambda nil pat))))
269 (error (setq v0 nil))) 297 (error (setq v1 nil)))
270 (condition-case nil 298 (insert (format "%s" pat))
271 (setq v1 (funcall (byte-compile (list 'lambda nil pat)))) 299 (indent-to-column 65)
272 (error (setq v1 nil))) 300 (if (equal v0 v1)
273 (princ (format "%s" pat)) 301 (insert (propertize "OK" 'face pass-face))
274 (if (equal v0 v1) 302 (insert (propertize "FAIL\n" 'face fail-face))
275 (princ (format " --> %s, OK\n" v1)) 303 (indent-to-column 55)
276 (princ (format " --> %s, NG\n" v0)) 304 (insert (propertize (format "[%s] vs [%s]" v0 v1)
277 (princ (format " --> %s\n" v1)) 305 'face fail-face)))
278 (error "Arithmetic test failed!"))) 306 (insert "\n"))))
279 patterns))) 307
308
309;; Local Variables:
310;; no-byte-compile: t
311;; End:
280 312
281(provide 'byte-opt-testsuite) 313(provide 'byte-opt-testsuite)
282 314
diff --git a/test/automated/font-parse-tests.el b/test/automated/font-parse-tests.el
index 5fc0f6c604f..463d0f98bb3 100644
--- a/test/automated/font-parse-tests.el
+++ b/test/automated/font-parse-tests.el
@@ -25,8 +25,6 @@
25 25
26;; Type M-x test-font-parse RET to generate the test buffer. 26;; Type M-x test-font-parse RET to generate the test buffer.
27 27
28;; TODO: Convert to ERT format.
29
30;;; Code: 28;;; Code:
31 29
32(require 'ert) 30(require 'ert)