aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXue Fuqiao2013-08-04 10:59:08 +0800
committerXue Fuqiao2013-08-04 10:59:08 +0800
commit99191b89ff64172740add88e67f163619a07830c (patch)
tree828d1ac7c917076703b9d4a3746ff7480bd97f0d
parentab419665caa6e2ad7465cf59ef902cc4ad1d2117 (diff)
parent2ad0a067728ccc7f8b32b0c3db1677ca351943fe (diff)
downloademacs-99191b89ff64172740add88e67f163619a07830c.tar.gz
emacs-99191b89ff64172740add88e67f163619a07830c.zip
Merge from mainline.
-rw-r--r--doc/emacs/ChangeLog27
-rw-r--r--doc/emacs/cal-xtra.texi94
-rw-r--r--doc/emacs/calendar.texi88
-rw-r--r--doc/emacs/custom.texi5
-rw-r--r--doc/emacs/emacs.texi4
-rw-r--r--doc/emacs/macos.texi7
-rw-r--r--doc/emacs/maintaining.texi22
-rw-r--r--doc/emacs/mule.texi102
-rw-r--r--doc/emacs/rmail.texi11
-rw-r--r--doc/lispintro/ChangeLog4
-rw-r--r--doc/lispintro/emacs-lisp-intro.texi15
-rw-r--r--doc/lispref/ChangeLog17
-rw-r--r--doc/lispref/display.texi1
-rw-r--r--doc/lispref/elisp.texi1
-rw-r--r--doc/lispref/functions.texi1
-rw-r--r--doc/lispref/nonascii.texi51
-rw-r--r--doc/lispref/variables.texi1
-rw-r--r--doc/misc/ChangeLog5
-rw-r--r--doc/misc/gnus.texi39
-rw-r--r--etc/ChangeLog24
-rw-r--r--etc/DEVEL.HUMOR8
-rw-r--r--etc/NEWS25
-rw-r--r--etc/TODO9
-rw-r--r--etc/tutorials/TUTORIAL29
-rw-r--r--etc/tutorials/TUTORIAL.cn423
-rw-r--r--etc/tutorials/TUTORIAL.es4
-rw-r--r--etc/tutorials/TUTORIAL.translators2
-rw-r--r--lisp/ChangeLog197
-rw-r--r--lisp/autorevert.el12
-rw-r--r--lisp/custom.el85
-rw-r--r--lisp/desktop.el630
-rw-r--r--lisp/emacs-lisp/advice.el1
-rw-r--r--lisp/emacs-lisp/easy-mmode.el12
-rw-r--r--lisp/emacs-lisp/lisp-mode.el7
-rw-r--r--lisp/emacs-lisp/package.el2
-rw-r--r--lisp/emacs-lisp/re-builder.el2
-rw-r--r--lisp/files.el206
-rw-r--r--lisp/frameset.el693
-rw-r--r--lisp/gnus/ChangeLog71
-rw-r--r--lisp/gnus/gnus-delay.el2
-rw-r--r--lisp/gnus/gnus-group.el15
-rw-r--r--lisp/gnus/gnus-icalendar.el837
-rw-r--r--lisp/gnus/gnus-int.el4
-rw-r--r--lisp/gnus/gnus-score.el13
-rw-r--r--lisp/gnus/gnus-start.el6
-rw-r--r--lisp/gnus/gnus-sum.el3
-rw-r--r--lisp/gnus/gnus-util.el15
-rw-r--r--lisp/gnus/gnus-uu.el4
-rw-r--r--lisp/gnus/message.el2
-rw-r--r--lisp/gnus/mm-decode.el21
-rw-r--r--lisp/gnus/mml2015.el24
-rw-r--r--lisp/gnus/nnmbox.el53
-rw-r--r--lisp/gnus/nnrss.el36
-rw-r--r--lisp/gnus/rfc2047.el161
-rw-r--r--lisp/ibuf-ext.el2
-rw-r--r--lisp/ibuffer.el24
-rw-r--r--lisp/mh-e/mh-e.el1
-rw-r--r--lisp/minibuffer.el11
-rw-r--r--lisp/net/browse-url.el4
-rw-r--r--lisp/net/eww.el2
-rw-r--r--lisp/net/network-stream.el6
-rw-r--r--lisp/net/shr.el9
-rw-r--r--lisp/net/tramp-adb.el86
-rw-r--r--lisp/net/tramp-gvfs.el136
-rw-r--r--lisp/net/tramp-sh.el137
-rw-r--r--lisp/net/tramp-smb.el19
-rw-r--r--lisp/net/tramp.el88
-rw-r--r--lisp/server.el2
-rw-r--r--lisp/speedbar.el2
-rw-r--r--lisp/textmodes/reftex-toc.el4
-rw-r--r--lisp/url/ChangeLog5
-rw-r--r--lisp/url/url-handlers.el10
-rw-r--r--lisp/vc/log-view.el43
-rw-r--r--lisp/vc/vc-dir.el2
-rw-r--r--lisp/vc/vc-hooks.el4
-rw-r--r--lisp/whitespace.el13
-rw-r--r--src/ChangeLog196
-rw-r--r--src/callproc.c5
-rw-r--r--src/coding.c2
-rw-r--r--src/composite.c30
-rw-r--r--src/composite.h88
-rw-r--r--src/data.c4
-rw-r--r--src/eval.c124
-rw-r--r--src/fileio.c2
-rw-r--r--src/fns.c2
-rw-r--r--src/font.c107
-rw-r--r--src/font.h59
-rw-r--r--src/fontset.c21
-rw-r--r--src/fontset.h6
-rw-r--r--src/frame.c74
-rw-r--r--src/frame.h25
-rw-r--r--src/ftfont.c24
-rw-r--r--src/ftxfont.c22
-rw-r--r--src/gtkutil.c126
-rw-r--r--src/gtkutil.h46
-rw-r--r--src/image.c14
-rw-r--r--src/insdel.c22
-rw-r--r--src/keyboard.c12
-rw-r--r--src/lisp.h1
-rw-r--r--src/menu.c9
-rw-r--r--src/menu.h10
-rw-r--r--src/msdos.c18
-rw-r--r--src/msdos.h2
-rw-r--r--src/nsfns.m27
-rw-r--r--src/nsfont.m28
-rw-r--r--src/nsmenu.m6
-rw-r--r--src/nsterm.h13
-rw-r--r--src/nsterm.m58
-rw-r--r--src/scroll.c12
-rw-r--r--src/term.c28
-rw-r--r--src/terminal.c4
-rw-r--r--src/w32fns.c42
-rw-r--r--src/w32font.c41
-rw-r--r--src/w32font.h10
-rw-r--r--src/w32inevt.c12
-rw-r--r--src/w32inevt.h2
-rw-r--r--src/w32menu.c32
-rw-r--r--src/w32notify.c2
-rw-r--r--src/w32term.c59
-rw-r--r--src/w32term.h4
-rw-r--r--src/w32uniscribe.c23
-rw-r--r--src/w32xfns.c8
-rw-r--r--src/widget.c36
-rw-r--r--src/window.c4
-rw-r--r--src/xdisp.c10
-rw-r--r--src/xfaces.c13
-rw-r--r--src/xfns.c55
-rw-r--r--src/xfont.c35
-rw-r--r--src/xftfont.c28
-rw-r--r--src/xmenu.c89
-rw-r--r--src/xselect.c4
-rw-r--r--src/xterm.c103
-rw-r--r--src/xterm.h6
-rw-r--r--test/ChangeLog27
-rw-r--r--test/automated/core-elisp-tests.el40
-rw-r--r--test/automated/file-notify-tests.el14
-rw-r--r--test/automated/icalendar-tests.el76
-rw-r--r--test/automated/undo-tests.el4
138 files changed, 4262 insertions, 2487 deletions
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index eaae7ec5c9f..ad411e44ba6 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,3 +1,30 @@
12013-07-31 Eli Zaretskii <eliz@gnu.org>
2
3 * emacs.texi (Top): Remove menu item for the removed "Disabling
4 Multibyte" node.
5
62013-07-31 Xue Fuqiao <xfq.free@gmail.com>
7
8 * rmail.texi (Rmail Coding): Move here from mule.texi.
9
10 * custom.texi (Specifying File Variables): Fix cross-references.
11
12 * mule.texi (Unibyte Mode): Fix cross-references.
13 (Disabling Multibyte): Remove.
14
15 * macos.texi (Mac / GNUstep Basics): Mention `ns-alternate-modifier'.
16
17 * cal-xtra.texi (Advanced Calendar/Diary Usage): Update menu.
18 (Mayan Calendar): Move here from calendar.texi.
19 * emacs.texi (Top): Update menu.
20
212013-07-30 Xue Fuqiao <xfq.free@gmail.com>
22
23 * emacs.texi (Top): Add menu entry.
24
25 * maintaining.texi (VC Ignore): New node. Document vc-ignore.
26 (VC Directory Commands): Add vc-dir-ignore.
27
12013-07-28 Xue Fuqiao <xfq.free@gmail.com> 282013-07-28 Xue Fuqiao <xfq.free@gmail.com>
2 29
3 * glossary.texi (Glossary): Add some entries. 30 * glossary.texi (Glossary): Add some entries.
diff --git a/doc/emacs/cal-xtra.texi b/doc/emacs/cal-xtra.texi
index 1b182327d33..5c964bbb369 100644
--- a/doc/emacs/cal-xtra.texi
+++ b/doc/emacs/cal-xtra.texi
@@ -17,6 +17,7 @@ your personal tastes.
17@menu 17@menu
18* Calendar Customizing:: Calendar layout and hooks. 18* Calendar Customizing:: Calendar layout and hooks.
19* Holiday Customizing:: Defining your own holidays. 19* Holiday Customizing:: Defining your own holidays.
20* Mayan Calendar:: Moving to a date specified in a Mayan calendar.
20* Date Display Format:: Changing the format. 21* Date Display Format:: Changing the format.
21* Time Display Format:: Changing the format. 22* Time Display Format:: Changing the format.
22* Diary Customizing:: Defaults you can set. 23* Diary Customizing:: Defaults you can set.
@@ -260,6 +261,99 @@ visible in the calendar window, with descriptive strings, like this:
260(((6 4 2012) "Lunar Eclipse") ((11 13 2012) "Solar Eclipse") ... ) 261(((6 4 2012) "Lunar Eclipse") ((11 13 2012) "Solar Eclipse") ... )
261@end smallexample 262@end smallexample
262 263
264@node Mayan Calendar
265@subsection Converting from the Mayan Calendar
266@cindex Mayan calendar
267
268 Here are the commands to select dates based on the Mayan calendar:
269
270@table @kbd
271@item g m l
272Move to a date specified by the long count calendar
273(@code{calendar-mayan-goto-long-count-date}).
274@item g m n t
275Move to the next occurrence of a place in the
276tzolkin calendar (@code{calendar-mayan-next-tzolkin-date}).
277@item g m p t
278Move to the previous occurrence of a place in the
279tzolkin calendar (@code{calendar-mayan-previous-tzolkin-date}).
280@item g m n h
281Move to the next occurrence of a place in the
282haab calendar (@code{calendar-mayan-next-haab-date}).
283@item g m p h
284Move to the previous occurrence of a place in the
285haab calendar (@code{calendar-mayan-previous-haab-date}).
286@item g m n c
287Move to the next occurrence of a place in the
288calendar round (@code{calendar-mayan-next-calendar-round-date}).
289@item g m p c
290Move to the previous occurrence of a place in the
291calendar round (@code{calendar-mayan-previous-calendar-round-date}).
292@end table
293
294@cindex Mayan long count
295 To understand these commands, you need to understand the Mayan calendars.
296The @dfn{long count} is a counting of days with these units:
297
298@display
2991 kin = 1 day@ @ @ 1 uinal = 20 kin@ @ @ 1 tun = 18 uinal
3001 katun = 20 tun@ @ @ 1 baktun = 20 katun
301@end display
302
303@kindex g m @r{(Calendar mode)}
304@findex calendar-mayan-goto-long-count-date
305@noindent
306Thus, the long count date 12.16.11.16.6 means 12 baktun, 16 katun, 11
307tun, 16 uinal, and 6 kin. The Emacs calendar can handle Mayan long
308count dates as early as 7.17.18.13.3, but no earlier. When you use the
309@kbd{g m l} command, type the Mayan long count date with the baktun,
310katun, tun, uinal, and kin separated by periods.
311
312@findex calendar-mayan-previous-tzolkin-date
313@findex calendar-mayan-next-tzolkin-date
314@cindex Mayan tzolkin calendar
315 The Mayan tzolkin calendar is a cycle of 260 days formed by a pair of
316independent cycles of 13 and 20 days. Since this cycle repeats
317endlessly, Emacs provides commands to move backward and forward to the
318previous or next point in the cycle. Type @kbd{g m p t} to go to the
319previous tzolkin date; Emacs asks you for a tzolkin date and moves point
320to the previous occurrence of that date. Similarly, type @kbd{g m n t}
321to go to the next occurrence of a tzolkin date.
322
323@findex calendar-mayan-previous-haab-date
324@findex calendar-mayan-next-haab-date
325@cindex Mayan haab calendar
326 The Mayan haab calendar is a cycle of 365 days arranged as 18 months
327of 20 days each, followed by a 5-day monthless period. Like the tzolkin
328cycle, this cycle repeats endlessly, and there are commands to move
329backward and forward to the previous or next point in the cycle. Type
330@kbd{g m p h} to go to the previous haab date; Emacs asks you for a haab
331date and moves point to the previous occurrence of that date.
332Similarly, type @kbd{g m n h} to go to the next occurrence of a haab
333date.
334
335@c This is omitted because it is too long for smallbook format.
336@c @findex calendar-mayan-previous-calendar-round-date
337@findex calendar-mayan-next-calendar-round-date
338@cindex Mayan calendar round
339 The Maya also used the combination of the tzolkin date and the haab
340date. This combination is a cycle of about 52 years called a
341@emph{calendar round}. If you type @kbd{g m p c}, Emacs asks you for
342both a haab and a tzolkin date and then moves point to the previous
343occurrence of that combination. Use @kbd{g m n c} to move point to the
344next occurrence of a combination. These commands signal an error if the
345haab/tzolkin date combination you have typed is impossible.
346
347 Emacs uses strict completion
348@iftex
349(@pxref{Completion Exit,,, emacs, the Emacs Manual})
350@end iftex
351@ifnottex
352(@pxref{Completion Exit})
353@end ifnottex
354whenever it asks you to type a Mayan name, so you don't have to worry
355about spelling.
356
263@node Date Display Format 357@node Date Display Format
264@subsection Date Display Format 358@subsection Date Display Format
265@vindex calendar-date-display-form 359@vindex calendar-date-display-form
diff --git a/doc/emacs/calendar.texi b/doc/emacs/calendar.texi
index 075d753ae7a..88f46984207 100644
--- a/doc/emacs/calendar.texi
+++ b/doc/emacs/calendar.texi
@@ -678,7 +678,6 @@ and from several other calendars.
678 (aside from Gregorian). 678 (aside from Gregorian).
679* To Other Calendar:: Converting the selected date to various calendars. 679* To Other Calendar:: Converting the selected date to various calendars.
680* From Other Calendar:: Moving to a date specified in another calendar. 680* From Other Calendar:: Moving to a date specified in another calendar.
681* Mayan Calendar:: Moving to a date specified in a Mayan calendar.
682@end menu 681@end menu
683 682
684@c FIXME perhaps most of the details should be moved to cal-xtra. 683@c FIXME perhaps most of the details should be moved to cal-xtra.
@@ -913,93 +912,6 @@ years for the date given by point. If you are not in the calendar,
913this command first asks you for the date of death and the range of 912this command first asks you for the date of death and the range of
914years, and then displays the list of yahrzeit dates. 913years, and then displays the list of yahrzeit dates.
915 914
916@c FIXME move to emacs-xtra.
917@node Mayan Calendar
918@subsection Converting from the Mayan Calendar
919
920 Here are the commands to select dates based on the Mayan calendar:
921
922@table @kbd
923@item g m l
924Move to a date specified by the long count calendar
925(@code{calendar-mayan-goto-long-count-date}).
926@item g m n t
927Move to the next occurrence of a place in the
928tzolkin calendar (@code{calendar-mayan-next-tzolkin-date}).
929@item g m p t
930Move to the previous occurrence of a place in the
931tzolkin calendar (@code{calendar-mayan-previous-tzolkin-date}).
932@item g m n h
933Move to the next occurrence of a place in the
934haab calendar (@code{calendar-mayan-next-haab-date}).
935@item g m p h
936Move to the previous occurrence of a place in the
937haab calendar (@code{calendar-mayan-previous-haab-date}).
938@item g m n c
939Move to the next occurrence of a place in the
940calendar round (@code{calendar-mayan-next-calendar-round-date}).
941@item g m p c
942Move to the previous occurrence of a place in the
943calendar round (@code{calendar-mayan-previous-calendar-round-date}).
944@end table
945
946@cindex Mayan long count
947 To understand these commands, you need to understand the Mayan calendars.
948The @dfn{long count} is a counting of days with these units:
949
950@display
9511 kin = 1 day@ @ @ 1 uinal = 20 kin@ @ @ 1 tun = 18 uinal
9521 katun = 20 tun@ @ @ 1 baktun = 20 katun
953@end display
954
955@kindex g m @r{(Calendar mode)}
956@findex calendar-mayan-goto-long-count-date
957@noindent
958Thus, the long count date 12.16.11.16.6 means 12 baktun, 16 katun, 11
959tun, 16 uinal, and 6 kin. The Emacs calendar can handle Mayan long
960count dates as early as 7.17.18.13.3, but no earlier. When you use the
961@kbd{g m l} command, type the Mayan long count date with the baktun,
962katun, tun, uinal, and kin separated by periods.
963
964@findex calendar-mayan-previous-tzolkin-date
965@findex calendar-mayan-next-tzolkin-date
966@cindex Mayan tzolkin calendar
967 The Mayan tzolkin calendar is a cycle of 260 days formed by a pair of
968independent cycles of 13 and 20 days. Since this cycle repeats
969endlessly, Emacs provides commands to move backward and forward to the
970previous or next point in the cycle. Type @kbd{g m p t} to go to the
971previous tzolkin date; Emacs asks you for a tzolkin date and moves point
972to the previous occurrence of that date. Similarly, type @kbd{g m n t}
973to go to the next occurrence of a tzolkin date.
974
975@findex calendar-mayan-previous-haab-date
976@findex calendar-mayan-next-haab-date
977@cindex Mayan haab calendar
978 The Mayan haab calendar is a cycle of 365 days arranged as 18 months
979of 20 days each, followed by a 5-day monthless period. Like the tzolkin
980cycle, this cycle repeats endlessly, and there are commands to move
981backward and forward to the previous or next point in the cycle. Type
982@kbd{g m p h} to go to the previous haab date; Emacs asks you for a haab
983date and moves point to the previous occurrence of that date.
984Similarly, type @kbd{g m n h} to go to the next occurrence of a haab
985date.
986
987@c This is omitted because it is too long for smallbook format.
988@c @findex calendar-mayan-previous-calendar-round-date
989@findex calendar-mayan-next-calendar-round-date
990@cindex Mayan calendar round
991 The Maya also used the combination of the tzolkin date and the haab
992date. This combination is a cycle of about 52 years called a
993@emph{calendar round}. If you type @kbd{g m p c}, Emacs asks you for
994both a haab and a tzolkin date and then moves point to the previous
995occurrence of that combination. Use @kbd{g m n c} to move point to the
996next occurrence of a combination. These commands signal an error if the
997haab/tzolkin date combination you have typed is impossible.
998
999 Emacs uses strict completion (@pxref{Completion Exit}) whenever it
1000asks you to type a Mayan name, so you don't have to worry about
1001spelling.
1002
1003@node Diary 915@node Diary
1004@section The Diary 916@section The Diary
1005@cindex diary 917@cindex diary
diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi
index 45fa45191f3..f3e07fd8ba0 100644
--- a/doc/emacs/custom.texi
+++ b/doc/emacs/custom.texi
@@ -1166,7 +1166,10 @@ conversion of this file. @xref{Coding Systems}.
1166 1166
1167@item 1167@item
1168@code{unibyte} says to load or compile a file of Emacs Lisp in unibyte 1168@code{unibyte} says to load or compile a file of Emacs Lisp in unibyte
1169mode, if the value is @code{t}. @xref{Disabling Multibyte}. 1169mode, if the value is @code{t}. @xref{Disabling Multibyte, ,
1170Disabling Multibyte Characters, elisp, GNU Emacs Lisp Reference
1171Manual}.
1172
1170@end itemize 1173@end itemize
1171 1174
1172@noindent 1175@noindent
diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi
index e2d0b0eebf6..8a518b82abb 100644
--- a/doc/emacs/emacs.texi
+++ b/doc/emacs/emacs.texi
@@ -544,7 +544,6 @@ Frames and Graphical Displays
544International Character Set Support 544International Character Set Support
545 545
546* International Chars:: Basic concepts of multibyte characters. 546* International Chars:: Basic concepts of multibyte characters.
547* Disabling Multibyte:: Controlling whether to use multibyte characters.
548* Language Environments:: Setting things up for the language you use. 547* Language Environments:: Setting things up for the language you use.
549* Input Methods:: Entering text characters not on your keyboard. 548* Input Methods:: Entering text characters not on your keyboard.
550* Select Input Method:: Specifying your choice of input methods. 549* Select Input Method:: Specifying your choice of input methods.
@@ -798,6 +797,7 @@ Version Control
798* Old Revisions:: Examining and comparing old versions. 797* Old Revisions:: Examining and comparing old versions.
799* VC Change Log:: Viewing the VC Change Log. 798* VC Change Log:: Viewing the VC Change Log.
800* VC Undo:: Canceling changes before or after committing. 799* VC Undo:: Canceling changes before or after committing.
800* VC Ignore:: Ignore files under version control system.
801* VC Directory Mode:: Listing files managed by version control. 801* VC Directory Mode:: Listing files managed by version control.
802* Branches:: Multiple lines of development. 802* Branches:: Multiple lines of development.
803@ifnottex 803@ifnottex
@@ -956,7 +956,6 @@ Conversion To and From Other Calendars
956 (aside from Gregorian). 956 (aside from Gregorian).
957* To Other Calendar:: Converting the selected date to various calendars. 957* To Other Calendar:: Converting the selected date to various calendars.
958* From Other Calendar:: Moving to a date specified in another calendar. 958* From Other Calendar:: Moving to a date specified in another calendar.
959* Mayan Calendar:: Moving to a date specified in a Mayan calendar.
960 959
961The Diary 960The Diary
962 961
@@ -971,6 +970,7 @@ More advanced features of the Calendar and Diary
971 970
972* Calendar Customizing:: Calendar layout and hooks. 971* Calendar Customizing:: Calendar layout and hooks.
973* Holiday Customizing:: Defining your own holidays. 972* Holiday Customizing:: Defining your own holidays.
973* Mayan Calendar:: Moving to a date specified in a Mayan calendar.
974* Date Display Format:: Changing the format. 974* Date Display Format:: Changing the format.
975* Time Display Format:: Changing the format. 975* Time Display Format:: Changing the format.
976* Diary Customizing:: Defaults you can set. 976* Diary Customizing:: Defaults you can set.
diff --git a/doc/emacs/macos.texi b/doc/emacs/macos.texi
index 4483c91802d..61c056ceb4b 100644
--- a/doc/emacs/macos.texi
+++ b/doc/emacs/macos.texi
@@ -40,13 +40,16 @@ Emacs provides a set of key bindings using this modifier key that mimic
40other Mac / GNUstep applications (@pxref{Mac / GNUstep Events}). You 40other Mac / GNUstep applications (@pxref{Mac / GNUstep Events}). You
41can change these bindings in the usual way (@pxref{Key Bindings}). 41can change these bindings in the usual way (@pxref{Key Bindings}).
42 42
43@c FIXME mention ns-alternate-modifier? 43@vindex ns-alternate-modifier
44@vindex ns-right-alternate-modifier
44 The variable @code{ns-right-alternate-modifier} controls the 45 The variable @code{ns-right-alternate-modifier} controls the
45behavior of the right @key{alt} and @key{option} keys. These keys 46behavior of the right @key{alt} and @key{option} keys. These keys
46behave like the left-hand keys if the value is @code{left} (the 47behave like the left-hand keys if the value is @code{left} (the
47default). A value of @code{control}, @code{meta}, @code{alt}, 48default). A value of @code{control}, @code{meta}, @code{alt},
48@code{super}, or @code{hyper} makes them behave like the corresponding 49@code{super}, or @code{hyper} makes them behave like the corresponding
49modifier keys; a value of @code{none} tells Emacs to ignore them. 50modifier keys; a value to @code{left} means be the same key as
51@code{ns-alternate-modifier}; a value of @code{none} tells Emacs to
52ignore them.
50 53
51 @kbd{S-Mouse-1} adjusts the region to the click position, 54 @kbd{S-Mouse-1} adjusts the region to the click position,
52just like @kbd{Mouse-3} (@code{mouse-save-then-kill}); it does not pop 55just like @kbd{Mouse-3} (@code{mouse-save-then-kill}); it does not pop
diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi
index 6184684fbb0..553375442d5 100644
--- a/doc/emacs/maintaining.texi
+++ b/doc/emacs/maintaining.texi
@@ -1,4 +1,4 @@
1@c This is part of the Emacs manual. 1@c This is part of the Emacs manual., Abbrevs, This is part of the Emacs manual., Top
2@c Copyright (C) 1985-1987, 1993-1995, 1997, 1999-2013 Free Software 2@c Copyright (C) 1985-1987, 1993-1995, 1997, 1999-2013 Free Software
3@c Foundation, Inc. 3@c Foundation, Inc.
4@c See file emacs.texi for copying conditions. 4@c See file emacs.texi for copying conditions.
@@ -56,6 +56,7 @@ variable @code{vc-handled-backends} to @code{nil}
56* Old Revisions:: Examining and comparing old versions. 56* Old Revisions:: Examining and comparing old versions.
57* VC Change Log:: Viewing the VC Change Log. 57* VC Change Log:: Viewing the VC Change Log.
58* VC Undo:: Canceling changes before or after committing. 58* VC Undo:: Canceling changes before or after committing.
59* VC Ignore:: Ignore files under version control system.
59* VC Directory Mode:: Listing files managed by version control. 60* VC Directory Mode:: Listing files managed by version control.
60* Branches:: Multiple lines of development. 61* Branches:: Multiple lines of development.
61@ifnottex 62@ifnottex
@@ -1032,6 +1033,23 @@ unlocked; you must lock again to resume editing. You can also use
1032@kbd{C-x v u} to unlock a file if you lock it and then decide not to 1033@kbd{C-x v u} to unlock a file if you lock it and then decide not to
1033change it. 1034change it.
1034 1035
1036@node VC Ignore
1037@subsection Ignore Version Control Files
1038
1039@table @kbd
1040@item C-x v G
1041Ignore a file under current version control system. (@code{vc-ignore}).
1042@end table
1043
1044@kindex C-x v G
1045@findex vc-ignore
1046 Many source trees contain some files that do not need to be versioned,
1047such as editor backups, object or bytecode files, and built programs.
1048You can simply not add them, but then they’ll always crop up as
1049unknown files. You can also tell the version control system to ignore
1050these files by adding them to the ignore file at the top of the tree.
1051@kbd{C-x v G} (@code{vc-ignore}) can help you do this.
1052
1035@node VC Directory Mode 1053@node VC Directory Mode
1036@subsection VC Directory Mode 1054@subsection VC Directory Mode
1037 1055
@@ -1222,7 +1240,7 @@ Revisions}), and @w{@kbd{C-x v u}} (@pxref{VC Undo}).
1222 1240
1223 The VC Directory buffer also defines some single-key shortcuts for 1241 The VC Directory buffer also defines some single-key shortcuts for
1224VC commands with the @kbd{C-x v} prefix: @kbd{=}, @kbd{+}, @kbd{l}, 1242VC commands with the @kbd{C-x v} prefix: @kbd{=}, @kbd{+}, @kbd{l},
1225@kbd{i}, @kbd{D}, @kbd{L} and @kbd{v}. 1243@kbd{i}, @kbd{D}, @kbd{L}, @kbd{G} and @kbd{v}.
1226 1244
1227 For example, you can commit a set of edited files by opening a VC 1245 For example, you can commit a set of edited files by opening a VC
1228Directory buffer, where the files are listed with the @samp{edited} 1246Directory buffer, where the files are listed with the @samp{edited}
diff --git a/doc/emacs/mule.texi b/doc/emacs/mule.texi
index c8bd5027fa0..ebddc46be94 100644
--- a/doc/emacs/mule.texi
+++ b/doc/emacs/mule.texi
@@ -90,7 +90,6 @@ value to make sure Emacs interprets keyboard input correctly; see
90 90
91@menu 91@menu
92* International Chars:: Basic concepts of multibyte characters. 92* International Chars:: Basic concepts of multibyte characters.
93* Disabling Multibyte:: Controlling whether to use multibyte characters.
94* Language Environments:: Setting things up for the language you use. 93* Language Environments:: Setting things up for the language you use.
95* Input Methods:: Entering text characters not on your keyboard. 94* Input Methods:: Entering text characters not on your keyboard.
96* Select Input Method:: Specifying your choice of input methods. 95* Select Input Method:: Specifying your choice of input methods.
@@ -244,79 +243,6 @@ Character code properties: customize what to show
244 decomposition: (65 768) ('A' '`') 243 decomposition: (65 768) ('A' '`')
245@end smallexample 244@end smallexample
246 245
247@c FIXME? Does this section even belong in the user manual?
248@c Seems more appropriate to the lispref?
249@node Disabling Multibyte
250@section Disabling Multibyte Characters
251
252 By default, Emacs starts in multibyte mode: it stores the contents
253of buffers and strings using an internal encoding that represents
254non-@acronym{ASCII} characters using multi-byte sequences. Multibyte
255mode allows you to use all the supported languages and scripts without
256limitations.
257
258@cindex turn multibyte support on or off
259 Under very special circumstances, you may want to disable multibyte
260character support, for a specific buffer.
261When multibyte characters are disabled in a buffer, we call
262that @dfn{unibyte mode}. In unibyte mode, each character in the
263buffer has a character code ranging from 0 through 255 (0377 octal); 0
264through 127 (0177 octal) represent @acronym{ASCII} characters, and 128
265(0200 octal) through 255 (0377 octal) represent non-@acronym{ASCII}
266characters.
267
268 To edit a particular file in unibyte representation, visit it using
269@code{find-file-literally}. @xref{Visiting}. You can convert a
270multibyte buffer to unibyte by saving it to a file, killing the
271buffer, and visiting the file again with @code{find-file-literally}.
272Alternatively, you can use @kbd{C-x @key{RET} c}
273(@code{universal-coding-system-argument}) and specify @samp{raw-text}
274as the coding system with which to visit or save a file. @xref{Text
275Coding}. Unlike @code{find-file-literally}, finding a file as
276@samp{raw-text} doesn't disable format conversion, uncompression, or
277auto mode selection.
278
279@c Not a single file in Emacs uses this feature. Is it really worth
280@c mentioning in the _user_ manual? Also, this duplicates somewhat
281@c "Loading Non-ASCII" from the lispref.
282@cindex Lisp files, and multibyte operation
283@cindex multibyte operation, and Lisp files
284@cindex unibyte operation, and Lisp files
285@cindex init file, and non-@acronym{ASCII} characters
286 Emacs normally loads Lisp files as multibyte.
287This includes the Emacs initialization
288file, @file{.emacs}, and the initialization files of packages
289such as Gnus. However, you can specify unibyte loading for a
290particular Lisp file, by adding an entry @samp{coding: raw-text} in a file
291local variables section. @xref{Specify Coding}.
292Then that file is always loaded as unibyte text.
293@ignore
294@c I don't see the point of this statement:
295The motivation for these conventions is that it is more reliable to
296always load any particular Lisp file in the same way.
297@end ignore
298You can also load a Lisp file as unibyte, on any one occasion, by
299typing @kbd{C-x @key{RET} c raw-text @key{RET}} immediately before
300loading it.
301
302@c See http://debbugs.gnu.org/11226 for lack of unibyte tooltip.
303@vindex enable-multibyte-characters
304The buffer-local variable @code{enable-multibyte-characters} is
305non-@code{nil} in multibyte buffers, and @code{nil} in unibyte ones.
306The mode line also indicates whether a buffer is multibyte or not.
307@xref{Mode Line}. With a graphical display, in a multibyte buffer,
308the portion of the mode line that indicates the character set has a
309tooltip that (amongst other things) says that the buffer is multibyte.
310In a unibyte buffer, the character set indicator is absent. Thus, in
311a unibyte buffer (when using a graphical display) there is normally
312nothing before the indication of the visited file's end-of-line
313convention (colon, backslash, etc.), unless you are using an input
314method.
315
316@findex toggle-enable-multibyte-characters
317You can turn off multibyte support in a specific buffer by invoking the
318command @code{toggle-enable-multibyte-characters} in that buffer.
319
320@node Language Environments 246@node Language Environments
321@section Language Environments 247@section Language Environments
322@cindex language environments 248@cindex language environments
@@ -919,18 +845,6 @@ pattern, are decoded correctly.
919Unlike the previous two, this variable does not override any 845Unlike the previous two, this variable does not override any
920@samp{-*-coding:-*-} tag. 846@samp{-*-coding:-*-} tag.
921 847
922@c FIXME? This seems somewhat out of place. Move to the Rmail section?
923@vindex rmail-file-coding-system
924 When you get new mail in Rmail, each message is translated
925automatically from the coding system it is written in, as if it were a
926separate file. This uses the priority list of coding systems that you
927have specified. If a MIME message specifies a character set, Rmail
928obeys that specification. For reading and saving Rmail files
929themselves, Emacs uses the coding system specified by the variable
930@code{rmail-file-coding-system}. The default value is @code{nil},
931which means that Rmail files are not translated (they are read and
932written in the Emacs internal character code).
933
934@node Specify Coding 848@node Specify Coding
935@section Specifying a File's Coding System 849@section Specifying a File's Coding System
936 850
@@ -1591,15 +1505,13 @@ the range 0240 to 0377 octal (160 to 255 decimal) to handle the
1591accented letters and punctuation needed by various European languages 1505accented letters and punctuation needed by various European languages
1592(and some non-European ones). Note that Emacs considers bytes with 1506(and some non-European ones). Note that Emacs considers bytes with
1593codes in this range as raw bytes, not as characters, even in a unibyte 1507codes in this range as raw bytes, not as characters, even in a unibyte
1594buffer, i.e., if you disable multibyte characters. However, Emacs 1508buffer, i.e., if you disable multibyte characters. However, Emacs can
1595can still handle these character codes as if they belonged to 1509still handle these character codes as if they belonged to @emph{one}
1596@emph{one} of the single-byte character sets at a time. To specify 1510of the single-byte character sets at a time. To specify @emph{which}
1597@emph{which} of these codes to use, invoke @kbd{M-x 1511of these codes to use, invoke @kbd{M-x set-language-environment} and
1598set-language-environment} and specify a suitable language environment 1512specify a suitable language environment such as @samp{Latin-@var{n}}.
1599such as @samp{Latin-@var{n}}. 1513@xref{Disabling Multibyte, , Disabling Multibyte Characters, elisp,
1600 1514GNU Emacs Lisp Reference Manual}.
1601 For more information about unibyte operation, see
1602@ref{Disabling Multibyte}.
1603 1515
1604@vindex unibyte-display-via-language-environment 1516@vindex unibyte-display-via-language-environment
1605 Emacs can also display bytes in the range 160 to 255 as readable 1517 Emacs can also display bytes in the range 160 to 255 as readable
diff --git a/doc/emacs/rmail.texi b/doc/emacs/rmail.texi
index 62f35b2ee83..67afc29a277 100644
--- a/doc/emacs/rmail.texi
+++ b/doc/emacs/rmail.texi
@@ -1274,6 +1274,17 @@ It reads the name of a coding system, and then redecodes the message
1274using the coding system you specified. If you specified the right 1274using the coding system you specified. If you specified the right
1275coding system, the result should be readable. 1275coding system, the result should be readable.
1276 1276
1277@vindex rmail-file-coding-system
1278 When you get new mail in Rmail, each message is translated
1279automatically from the coding system it is written in, as if it were a
1280separate file. This uses the priority list of coding systems that you
1281have specified. If a MIME message specifies a character set, Rmail
1282obeys that specification. For reading and saving Rmail files
1283themselves, Emacs uses the coding system specified by the variable
1284@code{rmail-file-coding-system}. The default value is @code{nil},
1285which means that Rmail files are not translated (they are read and
1286written in the Emacs internal character code).
1287
1277@node Rmail Editing 1288@node Rmail Editing
1278@section Editing Within a Message 1289@section Editing Within a Message
1279 1290
diff --git a/doc/lispintro/ChangeLog b/doc/lispintro/ChangeLog
index 4182b6a3184..481eb0c9db8 100644
--- a/doc/lispintro/ChangeLog
+++ b/doc/lispintro/ChangeLog
@@ -1,3 +1,7 @@
12013-08-02 Xue Fuqiao <xfq.free@gmail.com>
2
3 * emacs-lisp-intro.texi (zap-to-char): Remove obsolete stuff.
4
12013-07-06 Glenn Morris <rgm@gnu.org> 52013-07-06 Glenn Morris <rgm@gnu.org>
2 6
3 * emacs-lisp-intro.texi (Top): 7 * emacs-lisp-intro.texi (Top):
diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi
index dafee51a020..f0d9ab63935 100644
--- a/doc/lispintro/emacs-lisp-intro.texi
+++ b/doc/lispintro/emacs-lisp-intro.texi
@@ -7537,20 +7537,7 @@ retrieved. @xref{Yanking, , Yanking Text Back}.
7537@section @code{zap-to-char} 7537@section @code{zap-to-char}
7538@findex zap-to-char 7538@findex zap-to-char
7539 7539
7540@c FIXME remove obsolete stuff 7540Let us look at the interactive @code{zap-to-char} function.
7541The @code{zap-to-char} function changed little between GNU Emacs
7542version 19 and GNU Emacs version 22. However, @code{zap-to-char}
7543calls another function, @code{kill-region}, which enjoyed a major
7544rewrite.
7545
7546The @code{kill-region} function in Emacs 19 is complex, but does not
7547use code that is important at this time. We will skip it.
7548
7549The @code{kill-region} function in Emacs 22 is easier to read than the
7550same function in Emacs 19 and introduces a very important concept,
7551that of error handling. We will walk through the function.
7552
7553But first, let us look at the interactive @code{zap-to-char} function.
7554 7541
7555@menu 7542@menu
7556* Complete zap-to-char:: The complete implementation. 7543* Complete zap-to-char:: The complete implementation.
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 38262f05355..d77ede29da1 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,20 @@
12013-08-02 Xue Fuqiao <xfq.free@gmail.com>
2
3 * display.texi (Face Functions): Add an index.
4
5 * variables.texi (Variable Aliases): Add an index.
6
7 * functions.texi (Defining Functions): Add an index.
8
9 * nonascii.texi (Coding System Basics): Add an index.
10
112013-07-31 Xue Fuqiao <xfq.free@gmail.com>
12
13 * nonascii.texi (Non-ASCII Characters): Update menu.
14 (Disabling Multibyte): Move here from doc/emacs/mule.texi. Fix cross-references.
15
16 * elisp.texi (Top): Update menu.
17
12013-07-30 Xue Fuqiao <xfq.free@gmail.com> 182013-07-30 Xue Fuqiao <xfq.free@gmail.com>
2 19
3 * windows.texi (Window History): Mention the default value of 20 * windows.texi (Window History): Mention the default value of
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index 44fbc66a60e..c5068425c66 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -2738,6 +2738,7 @@ differently from the default face.
2738@end defun 2738@end defun
2739 2739
2740@cindex face alias 2740@cindex face alias
2741@cindex alias, for faces
2741A @dfn{face alias} provides an equivalent name for a face. You can 2742A @dfn{face alias} provides an equivalent name for a face. You can
2742define a face alias by giving the alias symbol the @code{face-alias} 2743define a face alias by giving the alias symbol the @code{face-alias}
2743property, with a value of the target face name. The following example 2744property, with a value of the target face name. The following example
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi
index 4b8cc36b4ea..230da1867dd 100644
--- a/doc/lispref/elisp.texi
+++ b/doc/lispref/elisp.texi
@@ -1194,6 +1194,7 @@ Text Properties
1194Non-@acronym{ASCII} Characters 1194Non-@acronym{ASCII} Characters
1195 1195
1196* Text Representations:: How Emacs represents text. 1196* Text Representations:: How Emacs represents text.
1197* Disabling Multibyte:: Controlling whether to use multibyte characters.
1197* Converting Representations:: Converting unibyte to multibyte and vice versa. 1198* Converting Representations:: Converting unibyte to multibyte and vice versa.
1198* Selecting a Representation:: Treating a byte sequence as unibyte or multi. 1199* Selecting a Representation:: Treating a byte sequence as unibyte or multi.
1199* Character Codes:: How unibyte and multibyte relate to 1200* Character Codes:: How unibyte and multibyte relate to
diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi
index fcd345ef83b..39a9ff6b62c 100644
--- a/doc/lispref/functions.texi
+++ b/doc/lispref/functions.texi
@@ -580,6 +580,7 @@ redefinition from unintentional redefinition.
580@end defmac 580@end defmac
581 581
582@cindex function aliases 582@cindex function aliases
583@cindex alias, for functions
583@defun defalias name definition &optional doc 584@defun defalias name definition &optional doc
584@anchor{Definition of defalias} 585@anchor{Definition of defalias}
585This function defines the symbol @var{name} as a function, with 586This function defines the symbol @var{name} as a function, with
diff --git a/doc/lispref/nonascii.texi b/doc/lispref/nonascii.texi
index b8b62325bb4..090310c5545 100644
--- a/doc/lispref/nonascii.texi
+++ b/doc/lispref/nonascii.texi
@@ -13,6 +13,7 @@ how they are stored in strings and buffers.
13 13
14@menu 14@menu
15* Text Representations:: How Emacs represents text. 15* Text Representations:: How Emacs represents text.
16* Disabling Multibyte:: Controlling whether to use multibyte characters.
16* Converting Representations:: Converting unibyte to multibyte and vice versa. 17* Converting Representations:: Converting unibyte to multibyte and vice versa.
17* Selecting a Representation:: Treating a byte sequence as unibyte or multi. 18* Selecting a Representation:: Treating a byte sequence as unibyte or multi.
18* Character Codes:: How unibyte and multibyte relate to 19* Character Codes:: How unibyte and multibyte relate to
@@ -140,6 +141,55 @@ This function concatenates all its argument @var{bytes} and makes the
140result a unibyte string. 141result a unibyte string.
141@end defun 142@end defun
142 143
144@node Disabling Multibyte
145@section Disabling Multibyte Characters
146@cindex disabling multibyte
147
148 By default, Emacs starts in multibyte mode: it stores the contents
149of buffers and strings using an internal encoding that represents
150non-@acronym{ASCII} characters using multi-byte sequences. Multibyte
151mode allows you to use all the supported languages and scripts without
152limitations.
153
154@cindex turn multibyte support on or off
155 Under very special circumstances, you may want to disable multibyte
156character support, for a specific buffer.
157When multibyte characters are disabled in a buffer, we call
158that @dfn{unibyte mode}. In unibyte mode, each character in the
159buffer has a character code ranging from 0 through 255 (0377 octal); 0
160through 127 (0177 octal) represent @acronym{ASCII} characters, and 128
161(0200 octal) through 255 (0377 octal) represent non-@acronym{ASCII}
162characters.
163
164 To edit a particular file in unibyte representation, visit it using
165@code{find-file-literally}. @xref{Visiting Functions}. You can
166convert a multibyte buffer to unibyte by saving it to a file, killing
167the buffer, and visiting the file again with
168@code{find-file-literally}. Alternatively, you can use @kbd{C-x
169@key{RET} c} (@code{universal-coding-system-argument}) and specify
170@samp{raw-text} as the coding system with which to visit or save a
171file. @xref{Text Coding, , Specifying a Coding System for File Text,
172emacs, GNU Emacs Manual}. Unlike @code{find-file-literally}, finding
173a file as @samp{raw-text} doesn't disable format conversion,
174uncompression, or auto mode selection.
175
176@c See http://debbugs.gnu.org/11226 for lack of unibyte tooltip.
177@vindex enable-multibyte-characters
178The buffer-local variable @code{enable-multibyte-characters} is
179non-@code{nil} in multibyte buffers, and @code{nil} in unibyte ones.
180The mode line also indicates whether a buffer is multibyte or not.
181With a graphical display, in a multibyte buffer, the portion of the
182mode line that indicates the character set has a tooltip that (amongst
183other things) says that the buffer is multibyte. In a unibyte buffer,
184the character set indicator is absent. Thus, in a unibyte buffer
185(when using a graphical display) there is normally nothing before the
186indication of the visited file's end-of-line convention (colon,
187backslash, etc.), unless you are using an input method.
188
189@findex toggle-enable-multibyte-characters
190You can turn off multibyte support in a specific buffer by invoking the
191command @code{toggle-enable-multibyte-characters} in that buffer.
192
143@node Converting Representations 193@node Converting Representations
144@section Converting Text Representations 194@section Converting Text Representations
145 195
@@ -962,6 +1012,7 @@ The value of the @code{:mime-charset} property is also defined
962as an alias for the coding system. 1012as an alias for the coding system.
963@end defun 1013@end defun
964 1014
1015@cindex alias, for coding systems
965@defun coding-system-aliases coding-system 1016@defun coding-system-aliases coding-system
966This function returns the list of aliases of @var{coding-system}. 1017This function returns the list of aliases of @var{coding-system}.
967@end defun 1018@end defun
diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi
index 4a38fa9ccd5..557add738ba 100644
--- a/doc/lispref/variables.texi
+++ b/doc/lispref/variables.texi
@@ -1838,6 +1838,7 @@ updates this list.
1838@node Variable Aliases 1838@node Variable Aliases
1839@section Variable Aliases 1839@section Variable Aliases
1840@cindex variable aliases 1840@cindex variable aliases
1841@cindex alias, for variables
1841 1842
1842 It is sometimes useful to make two variables synonyms, so that both 1843 It is sometimes useful to make two variables synonyms, so that both
1843variables always have the same value, and changing either one also 1844variables always have the same value, and changing either one also
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog
index 9b45ac06f4c..7f5c70e07e3 100644
--- a/doc/misc/ChangeLog
+++ b/doc/misc/ChangeLog
@@ -1,3 +1,8 @@
12013-08-01 Lars Magne Ingebrigtsen <larsi@gnus.org>
2
3 * gnus.texi (Basic Usage): Mention that warp means jump here.
4 (The notmuch Engine): Mention notmuch.
5
12013-07-30 Tassilo Horn <tsdh@gnu.org> 62013-07-30 Tassilo Horn <tsdh@gnu.org>
2 7
3 * gnus.texi (Sorting the Summary Buffer): Document new defcustom 8 * gnus.texi (Sorting the Summary Buffer): Document new defcustom
diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
index 808bd2b114b..4edc1d62f1a 100644
--- a/doc/misc/gnus.texi
+++ b/doc/misc/gnus.texi
@@ -21109,17 +21109,17 @@ the articles that match this query, and takes you to a summary buffer
21109showing these articles. Articles may then be read, moved and deleted 21109showing these articles. Articles may then be read, moved and deleted
21110using the usual commands. 21110using the usual commands.
21111 21111
21112The @code{nnir} group made in this way is an @code{ephemeral} group, and 21112The @code{nnir} group made in this way is an @code{ephemeral} group,
21113some changes are not permanent: aside from reading, moving, and 21113and some changes are not permanent: aside from reading, moving, and
21114deleting, you can't act on the original article. But there is an 21114deleting, you can't act on the original article. But there is an
21115alternative: you can @emph{warp} to the original group for the article 21115alternative: you can @emph{warp} (i.e., jump) to the original group
21116on the current line with @kbd{A W}, aka 21116for the article on the current line with @kbd{A W}, aka
21117@code{gnus-warp-to-article}. Even better, the function 21117@code{gnus-warp-to-article}. Even better, the function
21118@code{gnus-summary-refer-thread}, bound by default in summary buffers to 21118@code{gnus-summary-refer-thread}, bound by default in summary buffers
21119@kbd{A T}, will first warp to the original group before it works its 21119to @kbd{A T}, will first warp to the original group before it works
21120magic and includes all the articles in the thread. From here you can 21120its magic and includes all the articles in the thread. From here you
21121read, move and delete articles, but also copy them, alter article marks, 21121can read, move and delete articles, but also copy them, alter article
21122whatever. Go nuts. 21122marks, whatever. Go nuts.
21123 21123
21124You say you want to search more than just the group on the current line? 21124You say you want to search more than just the group on the current line?
21125No problem: just process-mark the groups you want to search. You want 21125No problem: just process-mark the groups you want to search. You want
@@ -21161,6 +21161,7 @@ query language anyway.
21161* The swish++ Engine:: Swish++ configuration and usage. 21161* The swish++ Engine:: Swish++ configuration and usage.
21162* The swish-e Engine:: Swish-e configuration and usage. 21162* The swish-e Engine:: Swish-e configuration and usage.
21163* The namazu Engine:: Namazu configuration and usage. 21163* The namazu Engine:: Namazu configuration and usage.
21164* The notmuch Engine:: Notmuch configuration and usage.
21164* The hyrex Engine:: Hyrex configuration and usage. 21165* The hyrex Engine:: Hyrex configuration and usage.
21165* Customizations:: User customizable settings. 21166* Customizations:: User customizable settings.
21166@end menu 21167@end menu
@@ -21390,6 +21391,26 @@ mknmz --mailnews ~/Mail/archive/ ~/Mail/mail/ ~/Mail/lists/
21390For maximum searching efficiency you might want to have a cron job run 21391For maximum searching efficiency you might want to have a cron job run
21391this command periodically, say every four hours. 21392this command periodically, say every four hours.
21392 21393
21394
21395@node The notmuch Engine
21396@subsubsection The notmuch Engine
21397
21398@table @code
21399@item nnir-notmuch-program
21400The name of the notmuch search executable. Defaults to
21401@samp{notmuch}.
21402
21403@item nnir-notmuch-additional-switches
21404A list of strings, to be given as additional arguments to notmuch.
21405
21406@item nnir-notmuch-remove-prefix
21407The prefix to remove from each file name returned by notmuch in order
21408to get a group name (albeit with @samp{/} instead of @samp{.}). This
21409is a regular expression.
21410
21411@end table
21412
21413
21393@node The hyrex Engine 21414@node The hyrex Engine
21394@subsubsection The hyrex Engine 21415@subsubsection The hyrex Engine
21395This engine is obsolete. 21416This engine is obsolete.
diff --git a/etc/ChangeLog b/etc/ChangeLog
index c201772cd93..4c0535d07a0 100644
--- a/etc/ChangeLog
+++ b/etc/ChangeLog
@@ -1,3 +1,27 @@
12013-08-03 Juanma Barranquero <lekktu@gmail.com>
2
3 * NEWS: Document new package frameset.el.
4
52013-08-03 Xue Fuqiao <xfq.free@gmail.com>
6
7 * TODO: Adjust entry about bug reporting.
8
92013-08-02 Bastien Guerry <bzg@gnu.org>
10
11 * DEVEL.HUMOR: New entry.
12
132013-08-02 Xue Fuqiao <xfq.free@gmail.com>
14
15 * tutorials/TUTORIAL: Remove a redundant sentence about yanking.
16
17 * tutorials/TUTORIAL.cn: Update; synchronize with TUTORIAL.
18
19 * tutorials/TUTORIAL.translators (Maintainer): Update the maintainer.
20
212013-08-02 Juanma Barranquero <lekktu@gmail.com>
22
23 * tutorials/TUTORIAL.es: Fix typos (bug#15000).
24
12013-07-26 Micah Anderson <micah@riseup.net> (tiny change) 252013-07-26 Micah Anderson <micah@riseup.net> (tiny change)
2 26
3 * spook.lines: Additions. (Bug#14658) 27 * spook.lines: Additions. (Bug#14658)
diff --git a/etc/DEVEL.HUMOR b/etc/DEVEL.HUMOR
index 091c267579b..7521f7950b1 100644
--- a/etc/DEVEL.HUMOR
+++ b/etc/DEVEL.HUMOR
@@ -194,3 +194,11 @@ drivers?"
194depression or loneliness when it is left out of the picture, so I 194depression or loneliness when it is left out of the picture, so I
195wouldn't worry about it too much." 195wouldn't worry about it too much."
196 -- Lennart Borgman and Jason Rumney 196 -- Lennart Borgman and Jason Rumney
197
198----------------------------------------------------------------------
199
200 "... a non-CS-educated guy like me ..."
201
202 "Kind of late, but thanks for letting us know. I've just revoked your
203 write access to the repository for the obvious safety reasons,"
204 -- Bastien Guerry and Stefan Monnier
diff --git a/etc/NEWS b/etc/NEWS
index 1cd444e6455..60a846b459f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -233,11 +233,16 @@ The default separator is changed to allow surrounding spaces around the comma.
233*** New variable `diary-from-outlook-function', used by the command 233*** New variable `diary-from-outlook-function', used by the command
234`diary-from-outlook'. 234`diary-from-outlook'.
235 235
236** VC Directory Mode 236** VC and related modes
237
238*** In VC directory mode, `D' displays diffs between VC-controlled
239whole tree revisions.
240
241*** In VC directory mode, `L' lists the change log for the current VC
242controlled tree in a window.
237 243
238*** `D' displays diffs between VC-controlled whole tree revisions. 244*** `C-x v G' (globally) and `G' (in VC directory mode) ignores a
239*** `L' lists the change log for the current VC controlled tree in a window. 245file under current version control system.
240*** `I' ignores the file under current version control system.
241 246
242** cl-lib 247** cl-lib
243 248
@@ -269,8 +274,8 @@ auto-saves of the desktop.
269 274
270*** `desktop-restore-frames', enabled by default, allows saving and 275*** `desktop-restore-frames', enabled by default, allows saving and
271restoring the window/frame configuration. Additional options 276restoring the window/frame configuration. Additional options
272`desktop-restore-in-current-display' and 277`desktop-restore-in-current-display', `desktop-restore-reuses-frames'
273`desktop-restoring-reuses-frames' allow further customization. 278and `desktop-restore-forces-onscreen' allow further customization.
274 279
275** Dired 280** Dired
276 281
@@ -511,6 +516,12 @@ It is layered as:
511- advice-add/advice-remove to add/remove a piece of advice on a named function, 516- advice-add/advice-remove to add/remove a piece of advice on a named function,
512 much like `defadvice' does. 517 much like `defadvice' does.
513 518
519** New frameset.el package.
520It provides a set of operations to save a frameset (the state of all
521or a subset of the existing frames and windows, somewhat similar to a
522frame configuration), both in-session and persistently, and restore it
523at some point in the future.
524
514+++ 525+++
515** The package filenotify.el provides an interface for file system 526** The package filenotify.el provides an interface for file system
516notifications. It requires, that Emacs is compiled with one of the 527notifications. It requires, that Emacs is compiled with one of the
@@ -519,6 +530,8 @@ low-level libraries gfilenotify.c, inotify.c or w32notify.c.
519 530
520* Incompatible Lisp Changes in Emacs 24.4 531* Incompatible Lisp Changes in Emacs 24.4
521 532
533** `defvar' and `defcustom' in a let-binding affect the "external" default.
534
522** The syntax of ?» and ?« is now punctuation instead of matched parens. 535** The syntax of ?» and ?« is now punctuation instead of matched parens.
523Some languages match those as »...« and others as «...» so better stay neutral. 536Some languages match those as »...« and others as «...» so better stay neutral.
524 537
diff --git a/etc/TODO b/etc/TODO
index faa9fc4c98d..305722dfe7b 100644
--- a/etc/TODO
+++ b/etc/TODO
@@ -176,6 +176,15 @@ where <device> is the network device found under the first key.
176 176
177** Check for any included packages that define obsolete bug-reporting commands. 177** Check for any included packages that define obsolete bug-reporting commands.
178Change them to use report-emacs-bug. 178Change them to use report-emacs-bug.
179*** Related functions:
180**** gnus-bug
181**** report-calc-bug
182**** org-submit-bug-report
183**** lm-report-bug
184**** tramp-bug
185**** c-submit-bug-report
186**** ffap-bug and ffap-submit-bug (obsoleted)
187[Do all of them need changing?]
179 188
180** Allow fringe indicators to display a tooltip (provide a help-echo property?) 189** Allow fringe indicators to display a tooltip (provide a help-echo property?)
181 190
diff --git a/etc/tutorials/TUTORIAL b/etc/tutorials/TUTORIAL
index 91962fd722c..91b3731fd0d 100644
--- a/etc/tutorials/TUTORIAL
+++ b/etc/tutorials/TUTORIAL
@@ -372,13 +372,15 @@ the text between the two positions.
372 372
373The difference between "killing" and "deleting" is that "killed" text 373The difference between "killing" and "deleting" is that "killed" text
374can be reinserted (at any position), whereas "deleted" things cannot 374can be reinserted (at any position), whereas "deleted" things cannot
375be reinserted in this way (you can, however, undo a deletion--see below). 375be reinserted in this way (you can, however, undo a deletion--see
376Reinsertion of killed text is called "yanking". Generally, the 376below). Reinsertion of killed text is called "yanking". (Think of it
377commands that can remove a lot of text kill the text (they are set up so 377as yanking back, or pulling back, some text that was taken away.)
378that you can yank the text), while the commands that remove just one 378Generally, the commands that can remove a lot of text kill the text
379character, or only remove blank lines and spaces, do deletion (so you 379(they are set up so that you can yank the text), while the commands
380cannot yank that text). <DEL> and C-d do deletion in the simplest 380that remove just one character, or only remove blank lines and spaces,
381case, with no argument. When given an argument, they kill instead. 381do deletion (so you cannot yank that text). <DEL> and C-d do deletion
382in the simplest case, with no argument. When given an argument, they
383kill instead.
382 384
383>> Move the cursor to the beginning of a line which is not empty. 385>> Move the cursor to the beginning of a line which is not empty.
384 Then type C-k to kill the text on that line. 386 Then type C-k to kill the text on that line.
@@ -391,13 +393,12 @@ treats a numeric argument specially: it kills that many lines AND
391their contents. This is not mere repetition. C-u 2 C-k kills two 393their contents. This is not mere repetition. C-u 2 C-k kills two
392lines and their newlines; typing C-k twice would not do that. 394lines and their newlines; typing C-k twice would not do that.
393 395
394Reinserting killed text is called "yanking". (Think of it as yanking 396You can yank the killed text either at the same place where it was
395back, or pulling back, some text that was taken away.) You can yank 397killed, or at some other place in the text you are editing, or even in
396the killed text either at the same place where it was killed, or at 398a different file. You can yank the same text several times; that
397some other place in the text you are editing, or even in a different 399makes multiple copies of it. Some other editors call killing and
398file. You can yank the same text several times; that makes multiple 400yanking "cutting" and "pasting" (see the Glossary in the Emacs
399copies of it. Some other editors call killing and yanking "cutting" 401manual).
400and "pasting" (see the Glossary in the Emacs manual).
401 402
402The command for yanking is C-y. It reinserts the last killed text, 403The command for yanking is C-y. It reinserts the last killed text,
403at the current cursor position. 404at the current cursor position.
diff --git a/etc/tutorials/TUTORIAL.cn b/etc/tutorials/TUTORIAL.cn
index 7c02d06defa..faf049b0af3 100644
--- a/etc/tutorials/TUTORIAL.cn
+++ b/etc/tutorials/TUTORIAL.cn
@@ -14,8 +14,9 @@ META 键(有时候用 EDIT 或 ALT æ¥æ ‡ç¤ºï¼‰ã€‚为了é¿å…æ¯æ¬¡éƒ½è¦å†™å
14 先按一下 ESC é”®ç„¶åŽæ”¾å¼€ï¼Œå†è¾“å…¥ <chr>。我们用 <ESC> æ¥è¡¨ç¤º 14 先按一下 ESC é”®ç„¶åŽæ”¾å¼€ï¼Œå†è¾“å…¥ <chr>。我们用 <ESC> æ¥è¡¨ç¤º
15 ESC 键。 15 ESC 键。
16 16
17é‡è¦æç¤ºï¼šè¦é€€å‡º Emacs,请用 C-x C-c(两个连续的组åˆé”®ï¼‰ã€‚下文中左边顶 17é‡è¦æç¤ºï¼šè¦é€€å‡º Emacs,请用 C-x C-c(两个连续的组åˆé”®ï¼‰ã€‚
18行的“>>â€å­—æ ·ç”¨æ¥æç¤ºä½ å°è¯•键盘命令。比如: 18è¦é€€å‡ºä¸€ä¸ªæ­£åœ¨è¿è¡Œä¸­çš„命令,请用 C-g。
19下文中左边顶行的“>>â€å­—æ ·ç”¨æ¥æç¤ºä½ å°è¯•键盘命令。比如:
19<<Blank lines inserted around following line by help-with-tutorial>> 20<<Blank lines inserted around following line by help-with-tutorial>>
20[本页当中特æ„留出一些空白是出于教学目的,请继续往åŽé˜…读] 21[本页当中特æ„留出一些空白是出于教学目的,请继续往åŽé˜…读]
21>> 现在输入 C-v ï¼ˆæŸ¥çœ‹ä¸‹ä¸€å±æ–‡å­—)移动到下一å±ã€‚ 22>> 现在输入 C-v ï¼ˆæŸ¥çœ‹ä¸‹ä¸€å±æ–‡å­—)移动到下一å±ã€‚
@@ -43,7 +44,9 @@ METAã€EDIT 或 ALT 键那么就先按 <ESC> 冿Œ‰ v)。
43 ï¼ˆæ³¨æ„æ˜¯ CONTROL-Lï¼Œä¸æ˜¯ CONTROL-1) 44 ï¼ˆæ³¨æ„æ˜¯ CONTROL-Lï¼Œä¸æ˜¯ CONTROL-1)
44 45
45>> 找到光标,留æ„其附近的文字,然åŽè¾“å…¥ C-l。 46>> 找到光标,留æ„其附近的文字,然åŽè¾“å…¥ C-l。
46 找找光标在哪里,你会å‘现其附近的文字并没有å˜åŒ–。 47 找找光标在哪里,你会å‘现其附近的文字与之å‰ç›¸åŒï¼Œä½ç½®å´å˜ä¸ºå±å¹•的中心。
48 å¦‚æžœä½ å†æ¬¡è¾“å…¥ C-l ,附近的文字将移动到å±å¹•çš„é¡¶ç«¯ã€‚å†æ¬¡è¾“å…¥ C-l ,
49 文字将移动到底端。
47 50
48如果你的键盘上有 PageUp å’Œ PageDn,也å¯ä»¥ç”¨è¿™ä¸¤ä¸ªé”®æ¥æ»šå±ã€‚ä¸è¿‡ä½¿ç”¨ 51如果你的键盘上有 PageUp å’Œ PageDn,也å¯ä»¥ç”¨è¿™ä¸¤ä¸ªé”®æ¥æ»šå±ã€‚ä¸è¿‡ä½¿ç”¨
49C-v å’Œ M-v çš„æ•ˆçŽ‡è¦æ›´é«˜ä¸€äº›ã€‚ 52C-v å’Œ M-v çš„æ•ˆçŽ‡è¦æ›´é«˜ä¸€äº›ã€‚
@@ -78,8 +81,8 @@ P 代表 previous(上一行),N 代表 next(下一行),B 代表 backw
78>> 用 C-f 把光标移动到这一行,然åŽå†ç”¨ C-p 往上挪。 81>> 用 C-f 把光标移动到这一行,然åŽå†ç”¨ C-p 往上挪。
79 注æ„观察当光标在一行的中央时 C-p 命令的行为。 82 注æ„观察当光标在一行的中央时 C-p 命令的行为。
80 83
81æ¯è¡Œæ–‡å­—都以一个“æ¢è¡Œç¬¦â€ç»“æŸï¼Œâ€œæ¢è¡Œç¬¦â€æŠŠè¡Œä¸Žè¡ŒåŒºåˆ†å¼€æ¥ã€‚æ–‡ä»¶çšæœ€åŽ 84æ¯è¡Œæ–‡å­—都以一个“æ¢è¡Œç¬¦â€ç»“æŸï¼Œâ€œæ¢è¡Œç¬¦â€æŠŠè¡Œä¸Žè¡ŒåŒºåˆ†å¼€æ¥ã€‚(通常情况下,
82一行也应该也有一个æ¢è¡Œç¬¦ï¼ˆä¸è¿‡ Emacs å¹¶ä¸å¼ºåˆ¶è¦æ±‚这一点)。 85一个文件的最åŽä¸€è¡Œä¼šæœ‰ä¸€ä¸ªæ¢è¡Œç¬¦ï¼Œä½†æ˜¯ Emacs ä¸å¼ºåˆ¶è¦æ±‚这一点。)
83 86
84>> 在一行的行头输入 C-b。 87>> 在一行的行头输入 C-b。
85 光标应该会移动到å‰ä¸€è¡Œçš„行尾,因为光标在回退过程中越过了æ¢è¡Œç¬¦ã€‚ 88 光标应该会移动到å‰ä¸€è¡Œçš„行尾,因为光标在回退过程中越过了æ¢è¡Œç¬¦ã€‚
@@ -179,27 +182,20 @@ EDIT 或 ALT)键,那么还有å¦ä¸€ç§åŠžæ³•ï¼šæŒ‰ä½ META 键䏿”¾ï¼Œç„¶å
179标志――åªè¦ç»™å‡ºæœ‰ä¸€ä¸ªå‰ç¼€å‚数,ä¸ç®¡å…¶å€¼ä¸ºä½•,它都会改å˜å‘½ä»¤çš„功能。 182标志――åªè¦ç»™å‡ºæœ‰ä¸€ä¸ªå‰ç¼€å‚数,ä¸ç®¡å…¶å€¼ä¸ºä½•,它都会改å˜å‘½ä»¤çš„功能。
180 183
181而 C-v å’Œ M-v 则属于å¦ä¸€ç§ç±»åž‹çš„ä¾‹å¤–ã€‚å½“ç»™å®šä¸€ä¸ªå‚æ•°æ—¶ï¼Œå®ƒä»¬å°†æ»šåŠ¨ä½ æŒ‡ 184而 C-v å’Œ M-v 则属于å¦ä¸€ç§ç±»åž‹çš„ä¾‹å¤–ã€‚å½“ç»™å®šä¸€ä¸ªå‚æ•°æ—¶ï¼Œå®ƒä»¬å°†æ»šåŠ¨ä½ æŒ‡
182定的“行数â€ï¼Œè€Œä¸æ˜¯â€œå±æ•°â€ã€‚举例æ¥è¯´ï¼ŒC-u 8 C-v å°†å±å¹•å‘下滚动 8 行, 185定的“行数â€ï¼Œè€Œä¸æ˜¯â€œå±æ•°â€ã€‚举例æ¥è¯´ï¼ŒC-u 8 C-v 将文本å‘下滚动 8 行。
183è€Œä¸æ˜¯ 8 å±ã€‚
184 186
185>> 现在试试看,输入 C-u 8 C-v。 187>> 现在试试看,输入 C-u 8 C-v。
186 188
187这个命令应该已ç»å°†æ–‡å­—å‘上滚动了 8 è¡Œã€‚å¦‚æžœä½ æƒ³å°†å®ƒå†æ¬¡åœ°å‘ä¸‹æ»šåŠ¨ï¼Œä½ å¯ 189这个命令应该已ç»å°†æ–‡å­—å‘上滚动了 8 è¡Œã€‚å¦‚æžœä½ æƒ³å°†å®ƒå†æ¬¡åœ°å‘下滚动,你å¯
188ä»¥ç»™å®šä¸€ä¸ªå‚æ•°ç„¶åŽæ‰§è¡Œ M-v。 190ä»¥ç»™å®šä¸€ä¸ªå‚æ•°ç„¶åŽæ‰§è¡Œ M-v。
189 191
190如果你正在使用一个窗å£ç³»ç»Ÿï¼Œæ¯”如 X11 或者微软的 Windows,那么在 Emacs 192如果你正在使用图形界é¢ï¼Œæ¯”如 X 或者微软的 Windows,那么在 Emacs窗
191窗å£çš„边缘应该有一个长方形的区域å«â€œæ»šåЍæ¡â€ï¼Œä½ å¯ä»¥ç”¨é¼ æ ‡æ“çºµæ»šåŠ¨æ¡æ¥ 193å£çš„一边应该有一个长方形的区域å«â€œæ»šåЍæ¡â€ã€‚ä½ å¯ä»¥ç”¨é¼ æ ‡æ“çºµæ»šåŠ¨æ¡æ¥æ»šåЍ
192滚动文字。 194文字。
193 195
194>> 试ç€åœ¨â€œæ»šåЍæ¡å†…çš„å白区域â€ä¸ŠæŒ‰ä¸€ä¸‹é¼ æ ‡ä¸­é”®ã€‚ 196如果你的鼠标有滚轮的è¯ï¼Œä½ ä¹Ÿå¯ä»¥ä½¿ç”¨æ»šè½®æ¥æ»šåŠ¨ã€‚
195 文字应该会滚动到鼠标所指示的ä½ç½®ã€‚
196 197
197>> 当按ä½ä¸­é”®æ—¶ï¼Œè¯•ç€å°†é¼ æ ‡ä¸Šä¸‹ç§»åŠ¨ã€‚ 198* 如果 EMACS 失去å“应(IF EMACS STOPS RESPONDING)
198 你会看到文字éšç€é¼ æ ‡çš„移动而上下滚动。
199 ã€Windows ç‰ˆæœ¬ç¬¦åˆ Windows 程åºçš„传统æ“作习惯,上述æ“作ä¸é€‚用。】
200
201
202* 在 EMACS 失去å“应的时候(WHEN EMACS IS HUNG)
203----------------------------------------------- 199-----------------------------------------------
204 200
205如果 Emacs 对你的命令失去å“应,你å¯ä»¥ç”¨ C-g æ¥å®‰å…¨åœ°ç»ˆæ­¢è¿™æ¡å‘½ä»¤ã€‚C-g 201如果 Emacs 对你的命令失去å“应,你å¯ä»¥ç”¨ C-g æ¥å®‰å…¨åœ°ç»ˆæ­¢è¿™æ¡å‘½ä»¤ã€‚C-g
@@ -234,7 +230,7 @@ C-g 还å¯ä»¥å–æ¶ˆæ•°å­—å‚æ•°å’Œåªè¾“入到一åŠçš„命令。
234* 窗格(WINDOWS) 230* 窗格(WINDOWS)
235----------------- 231-----------------
236 232
237Emacs å¯ä»¥æœ‰å¤šä¸ªçª—格,æ¯ä¸ªçª—格显示ä¸åŒçš„æ–‡å­—。åŽé¢ä¼šä»‹ç»æ€Žä¹ˆå¯¹ä»˜å¤šä¸ªçª— 233Emacs å¯ä»¥æœ‰å¤šä¸ªâ€œçª—æ ¼â€ï¼Œæ¯ä¸ªçª—格显示ä¸åŒçš„æ–‡å­—。åŽé¢ä¼šä»‹ç»æ€Žä¹ˆå¯¹ä»˜å¤šä¸ªçª—
238格,现在我们先学会如何关掉多余的窗格。其实也很简å•: 234格,现在我们先学会如何关掉多余的窗格。其实也很简å•:
239 235
240 C-x 1 åªä¿ç•™ä¸€ä¸ªçª—格(也就是关掉其它所有窗格)。 236 C-x 1 åªä¿ç•™ä¸€ä¸ªçª—格(也就是关掉其它所有窗格)。
@@ -244,49 +240,46 @@ Emacs å¯ä»¥æœ‰å¤šä¸ªçª—格,æ¯ä¸ªçª—格显示ä¸åŒçš„æ–‡å­—。åŽé¢ä¼šä»‹ç»
244 240
245>> 把光标移到本行然åŽè¾“å…¥ C-u 0 C-l。 241>> 把光标移到本行然åŽè¾“å…¥ C-u 0 C-l。
246 242
247>> 输入 CONTROL-h k CONTROL-f。观察当一个新窗格出现时当å‰çª—æ ¼ï¼ˆç”¨æ¥æ˜¾ç¤º 243>> 输入 C-h k C-f。观察当一个新窗格出现时当å‰çª—æ ¼ï¼ˆç”¨æ¥æ˜¾ç¤º
248 CONTROL-f 命令的文档)是如何缩å°çš„。 244 C-f 命令的文档)是如何缩å°çš„。
249 245
250>> 输入 C-x 1 关掉文档窗格。 246>> 输入 C-x 1 关掉文档窗格。
251 247
252这个命令跟先å‰å­¦è¿‡çš„命令ä¸å¤ªä¸€æ ·ï¼Œå› ä¸ºå®ƒåŒ…å«äº†ä¸¤ä¸ªå­—符,以 CONTROL-x å¼€ 248有一系列命令是以 CONTROL-x å¼€å§‹çš„ï¼Œè¿™äº›å‘½ä»¤è®¸å¤šéƒ½è·Ÿâ€œçª—æ ¼ã€æ–‡ä»¶ã€ç¼“冲区
253始。有一系列命令都是以 CONTROL-x å¼€å§‹çš„ï¼Œè¿™äº›å‘½ä»¤è®¸å¤šéƒ½è·Ÿâ€œçª—æ ¼ã€æ–‡ä»¶ã€ 249ã€ç¼“冲区(bufferï¼‰ä¼šåœ¨åŽæ–‡è¯¦ç»†ä»‹ç»ã€‘â€ç­‰ç­‰è¯¸å¦‚此类的东西有关,其中有些
254缓冲区ã€ç¼“冲区(bufferï¼‰ä¼šåœ¨åŽæ–‡è¯¦ç»†ä»‹ç»ã€‘â€ç­‰ç­‰è¯¸å¦‚此类的东西有关,其 250命令å¯èƒ½åŒ…å«äº† 2 个ã€3 个或者 4 个字符。
255中有些命令å¯èƒ½åŒ…å«äº† 2 个ã€3 个或者 4 个字符。
256 251
257 252
258* æ’入与删除(INSERTING AND DELETING) 253* æ’入与删除(INSERTING AND DELETING)
259-------------------------------------- 254--------------------------------------
260 255
261æ’入文字很简å•,直接敲键盘就å¯ä»¥äº†ã€‚你能看到的字符,比如 Aã€7ã€* 等等, 256æ’入文字很简å•,直接敲键盘就å¯ä»¥äº†ã€‚普通的字符,比如 Aã€7ã€* 等等,会
262都被 Emacs 视为文字并且å¯ä»¥ç›´æŽ¥æ’入。敲 <Return>(回车键)会æ’å…¥ä¸€ä¸ªæ¢ 257éšç€ä½ çš„输入而æ’å…¥ã€‚è¦æ’入一个æ¢è¡Œç¬¦ï¼Œè¾“å…¥ <Return>(这个键在键盘上有
263行符。 258时会被标注æˆâ€œEnterâ€ï¼‰ã€‚
264
265ä½ å¯ä»¥ç”¨ <Delback> æ¥åˆ é™¤æœ€åŽè¾“入的一个字符,这个跟你在 Emacs 之外的用
266法应该一样。一般æ¥è¯´ <Delback> 就是ä½äºŽ <Return> 键上方æŸå¤„的一个大å—头
267的键,通常被标示为“Deleteâ€ã€â€œDelâ€æˆ–者“Backspaceâ€ã€‚
268 259
269如果你找到äºâ€œBackspaceâ€é”®ï¼Œé‚£ä¹ˆå®ƒåº”该就是 <Delback>;这时哪怕你åˆåœ¨åˆ« 260ä½ å¯ä»¥ç”¨ <DEL> æ¥åˆ é™¤å…标左边的字符,这个键通常被标注为“Backspaceâ€â€•―跟
270的地方找到äºä¸€ä¸ªâ€œDelâ€é”®ï¼Œé‚£ä¹ˆå®ƒä¹Ÿåº”è¯¥ä¸æ˜¯ <Delback>。 261你在 Emacs 之外的用法应该一样,删除最åŽä¸€ä¸ªè¾“入的字符。
271 262
272ä¸€ç§æ›´é€šç¨çš„说法是,<Delback> å°åˆ é™¤ä½äºŽå…‰æ ‡å的一个字符。 263ä½ çš„é®ç˜ä¸Šå¯èƒ½æœ‰å¦å¤–ä¸€ä¸ªé”®ï¼Œæ ‡æ³¨ç€ <Delete>ï¼Œä½†é‚£ä¸ªä¸æ˜¯æˆ‘们所说的 <DEL>。
273 264
274>> 现在就æ¥è¯•è¯•â€•â€•æ•²ç‚¹å­—ï¼Œç„¶åŽæŒ‰å‡ ä¸‹ <Delback> 删除它们。 265>> 现在就æ¥è¯•è¯•â€•â€•æ•²ç‚¹å­—ï¼Œç„¶åŽæŒ‰å‡ ä¸‹ <DEL> 删除它们。
275 ä¸ç”¨æ‹…心文件被修改,你åšä»€ä¹ˆéƒ½æ²¡å…³ç³»ï¼Œè¿™é‡Œå°±æ˜¯ä¸“给你练习用的。 266 ä¸ç”¨æ‹…心文件被修改,你åšä»€ä¹ˆéƒ½æ²¡å…³ç³»ï¼Œè¿™é‡Œå°±æ˜¯ä¸“给你练习用的。
276 267
277如果一行文字很长ã€è¶…出了窗格的宽度,显示ä¸ä¸‹çš„部分会在紧邻的下一行继续 268如果一行文字很长ã€è¶…出了窗格的宽度,显示ä¸ä¸‹çš„部分会在紧邻的下一行继续
278æ˜¾ç¤ºã€‚è¿™æ—¶ä¼šæœ‰ä¸€ä¸ªåæ–œçº¿ï¼ˆåœ¨æŽ§åˆ¶å°ä¸‹æ˜¯å斜线,如果你用图形窗å£ç³»ç»Ÿï¼Œåˆ™ 269显示。如果你使用的是图形界é¢ï¼Œæ–‡æœ¬åŒºåŸŸä¸¤è¾¹çš„狭窄区域(左å³â€œè¾¹ç¼˜â€ï¼‰ä¼šå‡º
279应该是一个å°å°çš„转弯箭头)显示在å³è¾¹æ²¿ï¼Œè¡¨æ˜Žè¿™æ˜¯æŸä¸€è¡Œçš„æŽ¥ç»­æ˜¾ç¤ºã€‚ 270现å°å°çš„转弯箭头,表明这是æŸä¸€è¡Œçš„æŽ¥ç»­æ˜¾ç¤ºã€‚如果你使用的是文本终端,接
271续显示由å±å¹•最å³è¾¹ä¸€åˆ—çš„ä¸€ä¸ªåæ–œçº¿æ¥è¡¨ç¤ºã€‚
280 272
281>> 输入文字,一直到å±å¹•çš„å³è¾¹ç•Œï¼Œç„¶åŽç»§ç»­ï¼Œä½ ä¼šçœ‹åˆ°ä¸€ä¸ªæŽ¥ç»­è¡Œå‡ºçŽ°ã€‚ 273>> 输入文字,一直到å±å¹•çš„å³è¾¹ç•Œï¼Œç„¶åŽç»§ç»­ã€‚
274你会看到一个接续行出现。
282 275
283>> 用 <Delback> 删掉一些文字,直到此行长度å°äºŽçª—格宽度,接续行就消失了。 276>> 用 <DEL> 删掉一些文字,直到此行长度å°äºŽçª—格宽度,接续行就消失了。
284 277
285æ¢è¡Œç¬¦è·Ÿå…¶å®ƒå­—符一样å¯ä»¥è¢«åˆ é™¤ã€‚两行中间的æ¢è¡Œç¬¦è¢«åˆ é™¤åŽï¼Œè¿™ä¸¤è¡Œå°†ä¼šåˆ 278æ¢è¡Œç¬¦è·Ÿå…¶å®ƒå­—符一样å¯ä»¥è¢«åˆ é™¤ã€‚两行中间的æ¢è¡Œç¬¦è¢«åˆ é™¤åŽï¼Œè¿™ä¸¤è¡Œå°†ä¼šåˆ
286å¹¶æˆä¸€è¡Œã€‚如果åˆå¹¶åŽçš„è¿™ä¸€è¡Œå¤ªé•¿ï¼Œè¶…å‡ºäº†çª—æ ¼å®½åº¦ï¼Œå®ƒå°±ä¼šä»¥ä¸€ä¸ªæŽ¥ç»­è¡Œæ¥ 279å¹¶æˆä¸€è¡Œã€‚如果åˆå¹¶åŽçš„这一行太长,超出了窗格宽度,它就会以一个接续行æ¥
287显示。 280显示。
288 281
289>> 移动光标到æŸè¡Œçš„开头并输入 <Delback>。 282>> 移动光标到æŸè¡Œçš„开头并输入 <DEL>。
290 这时该行将与其å‰ä¸€è¡Œä¸€èµ·è¢«åˆå¹¶ä¸ºä¸€è¡Œã€‚ 283 这时该行将与其å‰ä¸€è¡Œä¸€èµ·è¢«åˆå¹¶ä¸ºä¸€è¡Œã€‚
291 284
292>> 输入 <Return> 釿–°æ’入你刚æ‰åˆ é™¤çš„æ¢è¡Œç¬¦ã€‚ 285>> 输入 <Return> 釿–°æ’入你刚æ‰åˆ é™¤çš„æ¢è¡Œç¬¦ã€‚
@@ -299,10 +292,10 @@ Emacs å¯ä»¥æœ‰å¤šä¸ªçª—格,æ¯ä¸ªçª—格显示ä¸åŒçš„æ–‡å­—。åŽé¢ä¼šä»‹ç»
299å¥½ï¼ŒçŽ°åœ¨ä½ åº”è¯¥å·²ç»æŽŒæ¡äº†æœ€åŸºæœ¬çš„的文本æ’入和修改功能,其实删除还å¯ä»¥ 292å¥½ï¼ŒçŽ°åœ¨ä½ åº”è¯¥å·²ç»æŽŒæ¡äº†æœ€åŸºæœ¬çš„的文本æ’入和修改功能,其实删除还å¯ä»¥
300“以è¯ä¸ºå•ä½â€è¿›è¡Œï¼Œä¸‹é¢æ˜¯ä¸€ä¸ªå…³äºŽâ€œåˆ é™¤â€æ“作的å°ç»“: 293“以è¯ä¸ºå•ä½â€è¿›è¡Œï¼Œä¸‹é¢æ˜¯ä¸€ä¸ªå…³äºŽâ€œåˆ é™¤â€æ“作的å°ç»“:
301 294
302 <Delback> 删除光标å‰çš„一个字符 295 <DEL> 删除光标å‰çš„一个字符
303 C-d 删除光标åŽçš„一个字符 296 C-d 删除光标åŽçš„一个字符
304 297
305 M-<Delback> 移除光标å‰çš„ä¸€ä¸ªè¯ 298 M-<DEL> 移除光标å‰çš„一个è¯
306 M-d 移除光标åŽçš„ä¸€ä¸ªè¯ 299 M-d 移除光标åŽçš„一个è¯
307 300
308 C-k 移除从光标到“行尾â€é—´çš„字符 301 C-k 移除从光标到“行尾â€é—´çš„字符
@@ -311,29 +304,31 @@ Emacs å¯ä»¥æœ‰å¤šä¸ªçª—格,æ¯ä¸ªçª—格显示ä¸åŒçš„æ–‡å­—。åŽé¢ä¼šä»‹ç»
311ã€å¯èƒ½ä½ å·²ç»æ³¨æ„到了“删除(delete)â€å’Œâ€œç§»é™¤ï¼ˆkill)â€çš„用è¯åŒºåˆ«ï¼ŒåŽ 304ã€å¯èƒ½ä½ å·²ç»æ³¨æ„到了“删除(delete)â€å’Œâ€œç§»é™¤ï¼ˆkill)â€çš„用è¯åŒºåˆ«ï¼ŒåŽ
312文会有详细说明。】 305文会有详细说明。】
313 306
314注æ„“<Delback> å’Œ C-dâ€è¿˜æœ‰â€œM-<Delback> å’Œ M-dâ€æ˜¯æ ¹æ®å‰è¿°æƒ¯ä¾‹ä»Ž C-f 307注æ„“<DEL> å’Œ C-dâ€è¿˜æœ‰â€œM-<DEL> å’Œ M-dâ€æ˜¯æ ¹æ®å‰è¿°æƒ¯ä¾‹ä»Ž C-få’Œ M-f è¡ç”Ÿ
315å’Œ M-f è¡ç”Ÿå‡ºæ¥çš„(其实<Delback>䏿˜¯æŽ§åˆ¶å­—符,我们先忽略这一点)。C-k 308出æ¥çš„(其实<DEL>䏿˜¯æŽ§åˆ¶å­—符,我们先忽略这一点)。C-kå’Œ M-k 的关系在
316å’Œ M-k 的关系在æŸç§ç¨‹åº¦ä¸Šä¸Ž C-e å’Œ M-e 一样――如果把“一行â€å’Œâ€œä¸€å¥â€ 309æŸç§ç¨‹åº¦ä¸Šä¸Ž C-e å’Œ M-e 一样――如果把“一行â€å’Œâ€œä¸€å¥â€ä½œä¸€ä¸ªç±»æ¯”çš„è¯ã€‚
317作一个类比的è¯ã€‚
318 310
319你也å¯ä»¥ç”¨ä¸€ç§é€šç”¨çš„办法æ¥ç§»é™¤ç¼“冲区里的任何一部分:首先把光标移动到你 311你也å¯ä»¥ç”¨ä¸€ç§é€šç”¨çš„办法æ¥ç§»é™¤ç¼“冲区里的任何一部分:首先把光标移动到你
320想è¦ç§»é™¤çš„åŒºåŸŸçš„ä¸€ç«¯ï¼Œç„¶åŽæŒ‰ C-@ 或 C-SPC(任一å³å¯ï¼ŒSPCæŒ‡ç©ºæ ¼ï¼‰ã€æ³¨æ„, 312想è¦ç§»é™¤çš„åŒºåŸŸçš„ä¸€ç«¯ï¼Œç„¶åŽæŒ‰ C-<SPC>(<SPC>æŒ‡ç©ºæ ¼ï¼‰ã€æ³¨æ„,C-<SPC> å¾€
321C-SPC 往往被中文用户设定æˆè¾“入法热键,如果这样,C-SPC 就被系统拦截而无 313往被中文用户设定æˆè¾“入法热键,如果这样,C-<SPC> 就被系统拦截而无法传递
322法传递给 Emacs 了,因此这里还是推è使用C-@。】,然åŽå°†å…‰æ ‡ç§»åŠ¨åˆ°å¦ä¸€ç«¯ï¼Œ 314ç»™ Emacs äº†ï¼Œåœ¨è¿™ç§æƒ…况下å¯ä»¥ä½¿ç”¨C-@。】,然åŽå°†å…‰æ ‡ç§»åŠ¨åˆ°ä½ å‡†å¤‡ç§»é™¤çš„
323冿Œ‰ C-w å°±å¯ä»¥æŠŠä½äºŽè¿™ä¸¤ç‚¹ä¹‹é—´çš„æ‰€æœ‰æ–‡å­—移除了。 315文字的å¦ä¸€ç«¯ã€‚这个时候, Emacs 会高亮光标和你按下 C-<SPC> 之间的文本。
316最åŽï¼ŒæŒ‰ä¸‹ C-w 。这样就å¯ä»¥æŠŠä½äºŽè¿™ä¸¤ç‚¹ä¹‹é—´çš„æ‰€æœ‰æ–‡å­—移除了。
324 317
325>> 移动光标到上一段开头的“你â€å­—。 318>> 移动光标到上一段开头的“你â€å­—。
326>> 输入 C-@ 。Emacs 应该会在å±å¹•的下方显示一个“Mark setâ€çš„æ¶ˆæ¯ã€‚ 319>> 输入 C-<SPC> 。Emacs 应该会在å±å¹•的下方显示一个“Mark setâ€çš„æ¶ˆæ¯ã€‚
327>> 移动光标到第二行中的“端â€å­—。 320>> 移动光标到第二行中的“端â€å­—。
328>> 输入 C-w,从“你â€å¼€å§‹åˆ°â€œç«¯â€ä¹‹å‰çš„æ–‡å­—被全部移除。 321>> 输入 C-w,从“你â€å¼€å§‹åˆ°â€œç«¯â€ä¹‹å‰çš„æ–‡å­—被全部移除。
329 322
330注æ„,“移除(kill)â€å’Œâ€œåˆ é™¤ï¼ˆdelete)â€çš„ä¸åŒåœ¨äºŽè¢«ç§»é™¤çš„东西å¯ä»¥æ‰¾å›ž 323注æ„,“移除(kill)â€å’Œâ€œåˆ é™¤ï¼ˆdelete)â€çš„ä¸åŒåœ¨äºŽè¢«ç§»é™¤çš„东西å¯ä»¥è¢«é‡æ–°
331æ¥ï¼Œè€Œè¢«åˆ é™¤çš„å°±ä¸è¡Œäº†ã€‚ã€å®žé™…上,移除掉的东西虽然看起æ¥â€œæ¶ˆå¤±â€äº†ï¼Œä½† 324æ’入(在任何ä½ç½®ï¼‰ï¼Œè€Œè¢«åˆ é™¤çš„å°±ä¸èƒ½ä½¿ç”¨ç›¸åŒçš„æ–¹æ³•釿–°æ’入了(ä¸è¿‡å¯ä»¥
332实际上被 Emacs 记录了下æ¥ï¼Œå› æ­¤è¿˜å¯ä»¥æ‰¾å›žæ¥ï¼›è€Œåˆ é™¤æŽ‰çš„东西虽然也å¯èƒ½è¿˜ 325通过撤销一个删除命令æ¥åšåˆ°ï¼ŒåŽæ–‡ä¼šæåˆ°ï¼‰ã€‚ã€å®žé™…上,移除掉的东西虽然看
333在内存里,但是已ç»è¢« Emacs“抛弃â€äº†ï¼Œæ‰€ä»¥å°±æ‰¾ä¸å›žæ¥äº†ã€‚ã€‘é‡æ–°æ’入被移 326èµ·æ¥â€œæ¶ˆå¤±â€äº†ï¼Œä½†å®žé™…上被 Emacs 记录了下æ¥ï¼Œå› æ­¤è¿˜å¯ä»¥æ‰¾å›žæ¥ï¼›è€Œåˆ é™¤æŽ‰
334除的文字称为“å¬å›žï¼ˆyank)â€ã€‚一般而言,那些å¯èƒ½æ¶ˆé™¤å¾ˆå¤šæ–‡å­—的命令会把 327的东西虽然也å¯èƒ½è¿˜åœ¨å†…存里,但是已ç»è¢« Emacs“抛弃â€äº†ï¼Œæ‰€ä»¥å°±æ‰¾ä¸å›žæ¥
335消除掉的文字记录下æ¥ï¼ˆå®ƒä»¬è¢«è®¾å®šæˆäº†â€œå¯å¬å›žâ€ï¼‰ï¼Œè€Œé‚£äº›åªæ¶ˆé™¤ä¸€ä¸ªå­—符 328äº†ã€‚ã€‘é‡æ–°æ’入被移除的文字称为“å¬å›žï¼ˆyank)â€ã€‚一般而言,那些å¯èƒ½æ¶ˆé™¤å¾ˆ
336æˆ–è€…åªæ¶ˆé™¤ç©ºç™½çš„命令就ä¸ä¼šè®°å½•被消除的内容(自然你也就无法å¬å›žäº†ï¼‰ã€‚ 329多文字的命令会把消除掉的文字记录下æ¥ï¼ˆå®ƒä»¬è¢«è®¾å®šæˆäº†â€œå¯å¬å›žâ€ï¼‰ï¼Œè€Œé‚£äº›
330åªæ¶ˆé™¤ä¸€ä¸ªå­—ç¬¦æˆ–è€…åªæ¶ˆé™¤ç©ºç™½çš„命令就ä¸ä¼šè®°å½•被消除的内容(自然你也就无
331法å¬å›žäº†ï¼‰ã€‚
337 332
338>> 移动光标到一éžç©ºç™½è¡Œçš„行头,然åŽè¾“å…¥ C-k 移除那一行上的文字。 333>> 移动光标到一éžç©ºç™½è¡Œçš„行头,然åŽè¾“å…¥ C-k 移除那一行上的文字。
339 334
@@ -345,9 +340,10 @@ C-SPC 往往被中文用户设定æˆè¾“入法热键,如果这样,C-SPC å°±è¢
345C-k 会把两行以åŠå®ƒä»¬çš„æ¢è¡Œç¬¦ç§»é™¤ï¼›è€Œå¦‚æžœåªæ˜¯è¾“å…¥ C-k ä¸¤æ¬¡æ˜¾ç„¶ä¸æ˜¯è¿™ä¸ªç»“ 340C-k 会把两行以åŠå®ƒä»¬çš„æ¢è¡Œç¬¦ç§»é™¤ï¼›è€Œå¦‚æžœåªæ˜¯è¾“å…¥ C-k ä¸¤æ¬¡æ˜¾ç„¶ä¸æ˜¯è¿™ä¸ªç»“
346果。 341果。
347 342
348å°è¢«ç§»é™¤çš„æ–‡å­—æ¢å¤çš„动作称为“å¬å›žï¼ˆyanking)â€ã€‚ï¼ˆå°±å¥½åƒæŠŠåˆ«äººä»Žä½ èº«è¾¹ 343釿–°æ’入被移除的文字æ¢å¤çš„动作称为“å¬å›žï¼ˆyanking)â€ã€‚ï¼ˆå°±å¥½åƒæŠŠåˆ«äººä»Žä½ èº«è¾¹
349移走的东西åˆçŒ›åŠ›åœ°æ‹‰å›žæ¥ã€‚)你å¯ä»¥åœ¨ä½ åˆ é™¤æ–‡å­—的地方å¬å›žï¼Œä¹Ÿå¯ä»¥åœ¨åˆ«çš„ 344移走的东西åˆçŒ›åŠ›åœ°æ‹‰å›žæ¥ã€‚)你å¯ä»¥åœ¨ä½ åˆ é™¤æ–‡å­—的地方å¬å›žï¼Œä¹Ÿå¯ä»¥åœ¨åˆ«çš„
350地方å¬å›žï¼Œè¿˜å¯ä»¥å¤šæ¬¡å¬å›žåŒæ ·çš„æ–‡å­—以得到它的多个拷è´ã€‚ 345地方å¬å›žï¼Œè¿˜å¯ä»¥å¤šæ¬¡å¬å›žåŒæ ·çš„æ–‡å­—以得到它的多个拷è´ã€‚很多其它的编辑器
346把移除和å¬å›žå«åšâ€œå‰ªåˆ‡â€å’Œâ€œç²˜è´´â€ (详情å¯è§ Emacs 使用手册里的术语表)。
351 347
352å¬å›žçš„命令是 C-y。它会在光标所在处æ’入你最åŽç§»é™¤çš„æ–‡å­—。 348å¬å›žçš„命令是 C-y。它会在光标所在处æ’入你最åŽç§»é™¤çš„æ–‡å­—。
353 349
@@ -383,24 +379,23 @@ C-y å¯ä»¥å¬å›žæœ€è¿‘一次移除的内容,那如何å¬å›žå‰å‡ æ¬¡ç§»é™¤çš„å
383* 撤销(UNDO) 379* 撤销(UNDO)
384-------------- 380--------------
385 381
386如果你修改了一段文字,åˆè§‰å¾—改得ä¸å¥½ï¼Œå¯ä»¥ç”¨ undo 命令进行撤销: 382如果你修改了一段文字,åˆè§‰å¾—改得ä¸å¥½ï¼Œå¯ä»¥ç”¨ undo 命令进行撤销:C-/。
387C-x u。
388 383
389通常 C-x u 会消除一个命令所造æˆçš„æ‰€æœ‰æ”¹å˜ï¼›å¦‚果你在一行中连续多次地使用 384通常 C-/ 会消除一个命令所造æˆçš„æ‰€æœ‰æ”¹å˜ï¼›å¦‚果你在一行中连续多次地使用
390C-x u,你会把以å‰çš„å‘½ä»¤ä¹Ÿä¾æ¬¡æ’¤é”€ã€‚ 385C-/,你会把以å‰çš„å‘½ä»¤ä¹Ÿä¾æ¬¡æ’¤é”€ã€‚
391 386
392但是有两个例外: 387但是有两个例外:
3931) æ²¡æœ‰æ”¹å˜æ–‡å­—的命令ä¸ç®—(包括光标移动命令和滚动命令) 3881) æ²¡æœ‰æ”¹å˜æ–‡å­—的命令ä¸ç®—(包括光标移动命令和滚动命令)
3942) 从键盘输入的字符以组为å•ä½â€•―æ¯ç»„ 20 个字符――æ¥è¿›è¡Œå¤„ç†ã€‚ 3892) 从键盘输入的字符以组为å•ä½â€•―æ¯ç»„最多 20 个字符――æ¥è¿›è¡Œå¤„ç†ã€‚
395 (这是为了å‡å°‘你在撤销“æ’入文字â€åŠ¨ä½œæ—¶éœ€è¦è¾“å…¥ C-x u 的次数) 390 (这是为了å‡å°‘你在撤销“æ’入文字â€åŠ¨ä½œæ—¶éœ€è¦è¾“å…¥ C-/ 的次数)
396 391
397>> 用 C-k 将这一行移除,然åŽè¾“å…¥ C-x u ï¼Œå®ƒä¼šå†æ¬¡å‡ºçŽ°ã€‚ 392>> 用 C-k 将这一行移除,然åŽè¾“å…¥ C-/ ï¼Œå®ƒä¼šå†æ¬¡å‡ºçŽ°ã€‚
398 393
399C-_ 也是撤销命令;它的作用跟 C-x u 一样,但是它比较容易多次输入。C-_ 的 394C-_ 也是撤销命令;它的作用跟 C-/ 一样,但是它比较容易多次输入。在
400缺点是在æŸäº›é”®ç›˜ä¸Šå¯èƒ½ä¸å¤ªå®¹æ˜“æŒ‰ï¼Œè¿™ä¹Ÿæ­£æ˜¯æˆ‘ä»¬åŒæ—¶æä¾ C-x u 的原因。在 395æŸäº›ç»ˆç«¯ä¸Šï¼Œè¾“å…¥ C-/ å®žé™…ä¸Šå‘ Emacs å‘é€çš„æ˜¯ C-_ 。
401æŸäº›ç»ˆç«¯ä¸Šï¼Œä½ å¯ä»¥æŒ‰ä½ CONTROL 冿Œ‰â€œ/â€æ¥è¾“å…¥ C-_。 396å¦å¤–, C-x u åŒ C-/ å®Œå…¨ä¸€æ ·ï¼Œä½†æ˜¯æŒ‰èµ·æ¥æœ‰äº›éº»çƒ¦ã€‚
402 397
403æ•°å­—å‚æ•°å¯¹äºŽ C-_ å’Œ C-x u çš„æ„义是执行撤销的é‡å¤æ¬¡æ•°ã€‚ 398æ•°å­—å‚æ•°å¯¹äºŽ C-/ 〠C-_ å’Œ C-x u çš„æ„义是执行撤销的é‡å¤æ¬¡æ•°ã€‚
404 399
405 400
406* 文件(FILE) 401* 文件(FILE)
@@ -416,14 +411,13 @@ C-_ 也是撤销命令;它的作用跟 C-x u 一样,但是它比较容易多
416文件也ä¿å­˜åˆ°è®¡ç®—机上。在存盘的时候,Emacs 会把存盘å‰çš„æ–‡ä»¶é‡å‘½åä¿å­˜ï¼Œ 411文件也ä¿å­˜åˆ°è®¡ç®—机上。在存盘的时候,Emacs 会把存盘å‰çš„æ–‡ä»¶é‡å‘½åä¿å­˜ï¼Œ
417以防你改完之åŽåˆæƒ³å悔。 412以防你改完之åŽåˆæƒ³å悔。
418 413
419在å±å¹•的下方,你应该能够看到头尾都是短线“-â€çš„一行,行首通常是一些诸如 414在å±å¹•的下方,你应该能够看到头部有短线“-â€çš„一行,行首通常是一些诸如“
420“--:-- TUTORIAL.cnâ€çš„æ–‡å­—ï¼Œè¿™äº›æ–‡å­—ä»£è¡¨äº†ä½ å½“å‰æ­£åœ¨è®¿é—®çš„æ–‡ä»¶ã€‚比如你 415-:--- TUTORIAL.cnâ€çš„æ–‡å­—ï¼Œè¿™äº›æ–‡å­—ä»£è¡¨äº†ä½ å½“å‰æ­£åœ¨è®¿é—®çš„æ–‡ä»¶ã€‚比如你现
421现在正在访问的文件å«â€œTUTORIAL.cï¼Œå®ƒåªæ˜¯ä¸€ä¸ªç»™ä½ ä¸´æ—¶ä½¿ç”¨çš„æ‹·è´ã€‚æ¯å½“ 416在正在访问的文件是对 Emacs å¿«éŸæŒå—的一份临时拷è´ï¼Œå«åšâ€œTUTORIAL.cnâ€ã€‚
422Emacs 寻找到一个文件,文件å就会出现在这个ä½ç½®ã€‚ 417æ¯å½“Emacs 寻找到一个文件,文件å就会出现在这个ä½ç½®ã€‚
423 418
424寻找文件的命令有一个特点,那就是你必须给出文件å。我们称这个命令“从终 419寻找文件的命令有一个特点,那就是你必须给出文件å。我们称这个命令“读入
425ç«¯è¯»å…¥äº†ä¸€ä¸ªå‚æ•°â€ï¼ˆåœ¨è¿™é‡Œï¼Œè¿™ä¸ªå‚数显然就是文件å)。在你输入这æ¡å‘½ä»¤ 420äº†ä¸€ä¸ªå‚æ•°â€ï¼ˆåœ¨è¿™é‡Œï¼Œè¿™ä¸ªå‚数显然就是文件å)。在你输入这æ¡å‘½ä»¤ä¹‹åŽï¼š
426之åŽï¼š
427 421
428 C-x C-f 寻找一个文件 422 C-x C-f 寻找一个文件
429 423
@@ -437,10 +431,10 @@ Emacs 会æç¤ºä½ è¾“入文件å。你输入的文件å会出现在å±å¹•最åº
437 这会关掉å°ç¼“å†²ï¼ŒåŒæ—¶ä¹Ÿä¼šå–消使用å°ç¼“冲的 C-x C-f 命令。 431 这会关掉å°ç¼“å†²ï¼ŒåŒæ—¶ä¹Ÿä¼šå–消使用å°ç¼“冲的 C-x C-f 命令。
438 当然了,你也没有找任何文件。 432 当然了,你也没有找任何文件。
439 433
440用 <Return> ç»“æŸæ–‡ä»¶åçš„è¾“å…¥ã€‚è¿™ä¹‹åŽ C-x C-f 命令å¼å§‹å·¥ä½œå¹¶æ‰¾åˆ°ä½ æŒ‡å®šçš„ 434用 <Return> ç»“æŸæ–‡ä»¶å的输入。之åŽï¼Œå°ç¼“冲会消失,C-x C-f 将会去寻找你
441文件。å°ç¼“冲在 C-x C-f 命令结æŸä¹‹åŽä¹Ÿä¼šæ¶ˆå¤±ã€‚ 435指定的文件。å°ç¼“冲在 C-x C-f 命令结æŸä¹‹åŽä¹Ÿä¼šæ¶ˆå¤±ã€‚
442 436
443眨眼间文件就被显示在å±å¹•上,你å¯ä»¥å¼€å§‹ç¼–辑了。存盘用这æ¡å‘½ä»¤ï¼š 437文件被显示在了å±å¹•上,你å¯ä»¥å¼€å§‹ç¼–辑了。存盘用这æ¡å‘½ä»¤ï¼š
444 438
445 C-x C-s 储存这个文件 439 C-x C-s 储存这个文件
446 440
@@ -450,15 +444,16 @@ Emacs 会æç¤ºä½ è¾“入文件å。你输入的文件å会出现在å±å¹•最åº
450 M-x customize-variable <Return> make-backup-files <Return>】 444 M-x customize-variable <Return> make-backup-files <Return>】
451 445
452存盘结æŸåŽï¼ŒEmacs 会显示写入文件的文件å。你最好养æˆç»å¸¸å­˜ç›˜çš„习惯,这 446存盘结æŸåŽï¼ŒEmacs 会显示写入文件的文件å。你最好养æˆç»å¸¸å­˜ç›˜çš„习惯,这
453å¯ä»¥å‡å°‘系统崩溃和死机给你带æ¥çš„æŸå¤±ã€‚ 447å¯ä»¥å‡å°‘系统崩溃和死机给你带æ¥çš„æŸå¤±ï¼ˆä¹Ÿå¯å‚è§ä¸‹é¢çš„“自动ä¿å­˜â€ä¸€èŠ‚ï¼‰ã€‚
454 448
455>> 输入 C-x C-s 把本快速指å—存下æ¥ã€‚ 449>> 输入 C-x C-s TUTORIAL.cn <Return> 。
456 你会在å±å¹•çš„ä¸‹æ–¹çœ‹åˆ°ä¸€æ¡æ¶ˆæ¯ï¼šâ€œWrote ...TUTORIAL.cnâ€ã€‚ 450 这将会把该指å—ä¿å­˜ä¸ºä¸€ä¸ªå为 TUTORIAL.cn 的文件,并且在å±å¹•的下方显
451 ç¤ºä¸€æ¡æ¶ˆæ¯ï¼šâ€œWrote ...TUTORIAL.cnâ€ã€‚
457 452
458ä½ ä¸ä½†å¯ä»¥å¯»æ‰¾ä¸€ä¸ªå·²æœ‰çš„æ–‡ä»¶æ¥æŸ¥çœ‹æˆ–编辑,还å¯ä»¥å¯»æ‰¾ä¸€ä¸ªä¸å­˜åœ¨çš„æ–‡ä»¶ã€‚ 453ä½ ä¸ä½†å¯ä»¥å¯»æ‰¾ä¸€ä¸ªå·²æœ‰çš„æ–‡ä»¶æ¥æŸ¥çœ‹æˆ–编辑,还å¯ä»¥å¯»æ‰¾ä¸€ä¸ªä¸å­˜åœ¨çš„æ–‡ä»¶ã€‚
459实际上这正是 Emacs 创建新文件的方法:找到ä¸å­˜åœ¨çš„æ–°æ–‡ä»¶ã€‚åªæœ‰åœ¨å­˜ç›˜çš„æ—¶ 454实际上这正是 Emacs 创建新文件的方法:找到ä¸å­˜åœ¨çš„æ–°æ–‡ä»¶ã€‚äº‹å®žä¸Šï¼Œåªæœ‰
460候,Emacs æ‰ä¼šçœŸæ­£åˆ›å»ºè¿™ä¸ªæ–‡ä»¶ã€‚而在这之åŽçš„一切就跟编辑一个已有文件没 455在存盘的时候,Emacs æ‰ä¼šçœŸæ­£åˆ›å»ºè¿™ä¸ªæ–‡ä»¶ã€‚而在这之åŽçš„一切就跟编辑一个
461有区别了。 456已有文件没有区别了。
462 457
463 458
464* 缓冲区(BUFFER) 459* 缓冲区(BUFFER)
@@ -468,10 +463,6 @@ Emacs 会æç¤ºä½ è¾“入文件å。你输入的文件å会出现在å±å¹•最åº
468切回第一个文件,一ç§åŠžæ³•æ˜¯å†ç”¨ä¸€æ¬¡ C-x C-f。这样,你就å¯ä»¥åœ¨ Emacs ä¸­åŒ 463切回第一个文件,一ç§åŠžæ³•æ˜¯å†ç”¨ä¸€æ¬¡ C-x C-f。这样,你就å¯ä»¥åœ¨ Emacs 中åŒ
469时打开多个文件。 464时打开多个文件。
470 465
471>> 用 C-x C-f foo <Return> 的方å¼å»ºç«‹ä¸€ä¸ªå为“fooâ€çš„æ–‡ä»¶ã€‚
472 输入一些文字,å†ç”¨ C-x C-s ä¿å­˜æ–‡ä»¶â€œfooâ€ã€‚
473 最åŽï¼Œè¾“å…¥ C-x C-f TUTORIAL.cn <Return> 回到这里。
474
475Emacs 把æ¯ä¸ªç¼–辑中的文件都放在一个称为“缓冲区(buffer)â€çš„地方。æ¯å¯» 466Emacs 把æ¯ä¸ªç¼–辑中的文件都放在一个称为“缓冲区(buffer)â€çš„地方。æ¯å¯»
476找到一个文件,Emacs 就在其内部开辟一个缓冲区。用下é¢çš„命令å¯ä»¥åˆ—å‡ºå½“å‰ 467找到一个文件,Emacs 就在其内部开辟一个缓冲区。用下é¢çš„命令å¯ä»¥åˆ—出当å‰
477所有的缓冲区: 468所有的缓冲区:
@@ -490,24 +481,28 @@ Emacs 把æ¯ä¸ªç¼–辑中的文件都放在一个称为“缓冲区(buffer)â€
490C-x C-f 是一ç§åŠžæ³•ã€‚ä¸è¿‡è¿˜æœ‰ä¸€ä¸ªæ›´ç®€å•的办法,那就是用 C-x b。用这æ¡å‘½ 481C-x C-f 是一ç§åŠžæ³•ã€‚ä¸è¿‡è¿˜æœ‰ä¸€ä¸ªæ›´ç®€å•的办法,那就是用 C-x b。用这æ¡å‘½
491令,你必须输入缓冲区的å称。 482令,你必须输入缓冲区的å称。
492 483
493>> 输入 C-x b foo <Return> 以回到文ä»â€œfooâ€çš„缓冲区。 484>> 通过输入 C-x C-f foo <Return> 创建一个å为“fooâ€çš„æ–‡ä»¶ã€‚
494 ç„¶åŽè¾“å…¥ C-x b TUTORIAL.cn <Return> 回到这里。 485 ç„¶åŽè¾“å…¥ C-x b TUTORIAL.cn <Return> 回到这里。
495 486
496大多数情况下,缓冲区与跟其对应的文件是åŒå的(ä¸åŒ…括目录å),ä¸è¿‡è¿™ä¹Ÿ 487大多数情况下,缓冲区与跟其对应的文件是åŒå的(ä¸åŒ…括目录å),ä¸è¿‡è¿™ä¹Ÿ
497䏿˜¯ç»å¯¹çš„。用 C-x C-b 得到的缓冲区列表总是显示缓冲区å。 488䏿˜¯ç»å¯¹çš„。用 C-x C-b 得到的缓冲区列表总是显示缓冲区å。
498 489
499你在 Emacs çª—æ ¼é‡Œçœ‹åˆ°çš„â€œä»»ä½•â€æ–‡å­—都一定属于æŸä¸ªç¼“冲区。然而,缓冲区未 490缓冲区未必有对应文件。显示缓冲区列表的缓冲区(å«åšâ€œ*Buffer List*â€ï¼‰å°±
500å¿…æœ‰å¯¹åº”æ–‡ä»¶ï¼šæ¯”å¦‚æ˜¾ç¤ºç¼“å†²åŒºåˆ—è¡¨çš„ç¼“å†²åŒºå°±æ˜¯è¿™æ ·ã€‚å†æ¯”如“*Messages*†491是这样。这个 TUTORIAL.cn ç¼“å†²åŒºèµ·åˆæ²¡æœ‰å¯¹åº”的文件,但是现在有了,因为
501缓冲区也没有对应文件,这个缓冲区里存放的都是在 Emacs 底部出现的消æ¯ã€‚ 492在å‰ä¸€èŠ‚ä½ è¾“å…¥äº† C-x C-s , 将它ä¿å­˜æˆäº†ä¸€ä¸ªæ–‡ä»¶ã€‚
493
494“*Messages*â€ç¼“冲区也没有对应文件,这个缓冲区里存放的都是在 Emacs 底部
495出现的消æ¯ã€‚
502 496
503>> 输入 C-x b *Messages* <Return> 瞅瞅消æ¯ç¼“冲区里都有什么东西。 497>> 输入 C-x b *Messages* <Return> 瞅瞅消æ¯ç¼“冲区里都有什么东西。
504 ç„¶åŽå†è¾“å…¥ C-x b TUTORIAL.cn <Return> 回到这里。 498 ç„¶åŽå†è¾“å…¥ C-x b TUTORIAL.cn <Return> 回到这里。
505 499
506如果你对æŸä¸ªæ–‡ä»¶åšäº†äº›ä¿®æ”¹ï¼Œç„¶åŽåˆ‡æ¢åˆ°å¦ä¸€ä¸ªæ–‡ä»¶ï¼Œè¿™ä¸ªåŠ¨ä½œå¹¶ä¸ä¼šå¸®ä½ æŠŠ 500如果你对æŸä¸ªæ–‡ä»¶åšäº†äº›ä¿®æ”¹ï¼Œç„¶åŽåˆ‡æ¢åˆ°å¦ä¸€ä¸ªæ–‡ä»¶ï¼Œè¿™ä¸ªåŠ¨ä½œå¹¶ä¸ä¼šå¸®ä½ æŠŠ
507å‰ä¸€ä¸ªæ–‡ä»¶å­˜ç›˜ã€‚对第一个文件的修改ä»ç„¶ä»…存在于 Emacs 中,也就是在它对应 501å‰ä¸€ä¸ªæ–‡ä»¶å­˜ç›˜ã€‚对第一个文件的修改ä»ç„¶ä»…存在于 Emacs 中,也就是在它对
508的缓冲区里。并且,对第二个文件的修改也ä¸ä¼šå½±å“到第一个文件。这很有用, 502应的缓冲区里。并且,对第二个文件的修改也ä¸ä¼šå½±å“到第一个文件。这很有用,
509但是也挺麻烦:因为如果你想è¦å­˜å‚¨ç¬¬ä¸€ä¸ªæ–‡ä»¶ï¼Œè¿˜éœ€è¦å…ˆ C-x C-f 切æ¢å›žåŽ»å† 503但也æ„味ç€ä½ éœ€è¦ä¸€ä¸ªç®€ä¾¿çš„办法æ¥ä¿å­˜ç¬¬ä¸€ä¸ªæ–‡ä»¶çš„缓冲区。先切æ¢å›žé‚£ä¸ªç¼“
510用 C-x C-s 存盘。你需è¦ä¸€ä¸ªæ›´ç®€ä¾¿çš„æ–¹æ³•,而 Emacs å·²ç»ä¸ºä½ å‡†å¤‡å¥½äº†ï¼š 504冲区,å†ç”¨ C-x C-s 存盘,太麻烦了。你需è¦ä¸€ä¸ªæ›´ç®€ä¾¿çš„æ–¹æ³•,而 Emacs å·²
505ç»ä¸ºä½ å‡†å¤‡å¥½äº†ï¼š
511 506
512 C-x s ä¿å­˜å¤šä¸ªç¼“冲区 507 C-x s ä¿å­˜å¤šä¸ªç¼“冲区
513 508
@@ -532,21 +527,18 @@ Emacs 的命令就åƒå¤©ä¸Šçš„æ˜Ÿæ˜Ÿï¼Œæ•°ä¹Ÿæ•°ä¸æ¸…。把它们都对应到 C
532很多扩展命令都相当有用,虽然与你已ç»å­¦è¿‡çš„命令比起æ¥ï¼Œä»–们å¯èƒ½ä¸é‚£ä¹ˆå¸¸ 527很多扩展命令都相当有用,虽然与你已ç»å­¦è¿‡çš„命令比起æ¥ï¼Œä»–们å¯èƒ½ä¸é‚£ä¹ˆå¸¸
533用。我们早已ç»è§è¿‡ä¸€äº›æ‰©å±•命令了,比如用 C-x C-f 寻找文件和用 C-x C-s 528用。我们早已ç»è§è¿‡ä¸€äº›æ‰©å±•命令了,比如用 C-x C-f 寻找文件和用 C-x C-s
534ä¿å­˜æ–‡ä»¶ï¼›é€€å‡º Emacs 用的 C-x C-c 也是扩展命令。(ä¸ç”¨æ‹…心退出 Emacs 会 529ä¿å­˜æ–‡ä»¶ï¼›é€€å‡º Emacs 用的 C-x C-c 也是扩展命令。(ä¸ç”¨æ‹…心退出 Emacs 会
535给你带æ¥ä»€ä¹ˆæŸå¤±ï¼ŒEmacs ä¼šåœ¨é€€å‡ºä¹‹å‰æé†’ä½ å­˜ç›˜çš„ï¼‰ 530给你带æ¥ä»€ä¹ˆæŸå¤±ï¼ŒEmacs ä¼šåœ¨é€€å‡ºä¹‹å‰æé†’ä½ å­˜ç›˜çš„ã€‚ï¼‰
536 531
537在控制å°ä¸‹ï¼ŒC-z å¯ä»¥æš‚时离开 Emacs――当然,你还å¯ä»¥å†å›žæ¥ã€‚ 532如果你使用图形界é¢ï¼Œä½ ä¸éœ€è¦ä»»ä½•特殊的命令æ¥åˆ‡æ¢ Emacs 和其他应用程åºã€‚
533ä½ å¯ä»¥ä½¿ç”¨é¼ æ ‡æˆ–者窗å£ç®¡ç†å™¨çš„命令。然而,如果你使用åªèƒ½åŒæ—¶æ˜¾ç¤ºä¸€ä¸ªåº”
534用程åºçš„æ–‡æœ¬ç»ˆç«¯ï¼Œä½ éœ€è¦â€œæŒ‚起†Emacs ,以切æ¢åˆ°å…¶ä»–的应用程åºã€‚
538 535
539在å…许 C-z 的系统中,C-z 会把 Emacs“挂起â€ï¼Œä¹Ÿå°±æ˜¯è¯´ï¼Œå®ƒä¼šå›žåˆ° shell 536C-z å¯ä»¥æš‚时离开 Emacs――当然,你还å¯ä»¥å†å›žæ¥ã€‚在å…许 C-z 的系统中,C-z
540但ä¸é€€å‡º Emacsã€‚åœ¨å¸¸ç”¨çš shell 中,通常å¯ä»¥ç”¨â€œfgâ€æˆ–è…“%emacsâ命令å 537会把 EmacsâœæŒèµ·â€ï¼Œä¹Ÿå°±æ˜¯è¯´ï¼Œå®ƒä¼šå›žåˆ° shellä½†ä¸ææ­» Emacs 的进程ã在常
541次回到 Emacs 中。 538用的 shell 中,通常å¯ä»¥ç”¨â€œfgâ€æˆ–者“%emacsâ€å‘½ä»¤å†æ¬¡å›žåˆ° Emacs 中。
542 539
543在没有æä¾›æŒ‚起功能的系统中,C-z 会在 Emacs ä¹‹ä¸‹åˆ›å»ºä¸€ä¸ªå­ shell æ¥è®©ä½  540你最好在打算退出登陆的时候å†ç”¨ C-x C-c。在把 Emacs 当åšä¸€ä¸ªä¸´æ—¶çš„编辑
544è¿è¡Œå…¶å®ƒç¨‹åºï¼Œå¹¶ä¸”冿¬¡â€œå›žåˆ°â€Emacs 中――虽然我们并没有真正离开过。这 541器的时候(比如被一个邮件处ç†ç¨‹åºè°ƒç”¨ï¼‰ï¼Œä¹Ÿå¯ä»¥ç”¨ C-x C-c 退出。
545ç§æƒ…况下,通常用 shell 命令“exitâ€ä»Žå­ shell 回到 Emacs。
546
547你最好在打算退出登陆的时候å†ç”¨ C-x C-c。在 Emacs 被诸如邮件处ç†ç¨‹åºä¹‹ç±»
548的外部程åºè°ƒç”¨ä¹‹åŽï¼Œä¹Ÿå¯ä»¥ç”¨ C-x C-c 退出。ä¸è¿‡ä¸€èˆ¬æ¥è®²ï¼Œå¦‚æžœä½ ä¸æƒ³é€€å‡º
549登录,最好还是把 Emacs æŒ‚èµ·è€Œä¸æ˜¯é€€å‡ºã€‚
550 542
551C-x 的扩展命令有很多,下é¢åˆ—出的是你已ç»å­¦è¿‡çš„: 543C-x 的扩展命令有很多,下é¢åˆ—出的是你已ç»å­¦è¿‡çš„:
552 544
@@ -557,11 +549,11 @@ C-x 的扩展命令有很多,下é¢åˆ—出的是你已ç»å­¦è¿‡çš„:
557 C-x 1 关掉其它所有窗格,åªä¿ç•™ä¸€ä¸ªã€‚ 549 C-x 1 关掉其它所有窗格,åªä¿ç•™ä¸€ä¸ªã€‚
558 C-x u 撤销。 550 C-x u 撤销。
559 551
560ç”¨å‘½ä»¤åæ‰©å±•的命令通常并ä¸å¸¸ç”¨ï¼Œæˆ–åªç”¨åœ¨éƒ¨åˆ†æ¨¡å¼ä¸‹ã€‚比如 replace-string 552ç”¨å‘½ä»¤åæ‰©å±•的命令通常并ä¸å¸¸ç”¨ï¼Œæˆ–åªç”¨åœ¨éƒ¨åˆ†æ¨¡å¼ä¸‹ã€‚比如
561(字符串替æ¢ï¼‰è¿™ä¸ªå‘½ä»¤ï¼Œå®ƒä¼šåœ¨å…¨æ–‡èŒƒå›´å†…æŠŠä¸€ä¸ªå­—ç¬¦ä¸²æ›¿æ¢æˆå¦ä¸€ä¸ªã€‚在输 553replace-string(字符串替æ¢ï¼‰è¿™ä¸ªå‘½ä»¤ï¼Œå®ƒä¼šæŠŠä¸€ä¸ªå­—ç¬¦ä¸²æ›¿æ¢æˆå¦ä¸€ä¸ªã€‚在
562å…¥ M-x 之åŽï¼ŒEmacs 会在å±å¹•底端å‘你询问并等待你输入命令å。如果你想输入 554输入 M-x 之åŽï¼ŒEmacs 会在å±å¹•底端å‘你询问并等待你输入命令å。如果你想
563“replace-stringâ€ï¼Œå…¶å®žåªéœ€è¦æ•²â€œrepl s<TAB>â€å°±è¡Œäº†ï¼ŒEmacs 会帮你自动 555输入“replace-stringâ€ï¼Œå…¶å®žåªéœ€è¦æ•²â€œrepl s<TAB>â€å°±è¡Œäº†ï¼ŒEmacs 会帮你自
564è¡¥é½ã€‚è¾“å…¥å®Œä¹‹åŽæŒ‰ <Return> 。 556动补é½ã€‚è¾“å…¥å®Œä¹‹åŽæŒ‰ <Return> æäº¤ã€‚
565 557
566字符串替æ¢å‘½ä»¤éœ€è¦ä¸¤ä¸ªå‚数――被替æ¢çš„å­—ç¬¦ä¸²å’Œç”¨æ¥æ›¿æ¢å®ƒçš„字符串。æ¯ä¸ª 558字符串替æ¢å‘½ä»¤éœ€è¦ä¸¤ä¸ªå‚数――被替æ¢çš„å­—ç¬¦ä¸²å’Œç”¨æ¥æ›¿æ¢å®ƒçš„字符串。æ¯ä¸ª
567傿•°çš„输入都以æ¢è¡Œç¬¦æ¥ç»“æŸã€‚ 559傿•°çš„输入都以æ¢è¡Œç¬¦æ¥ç»“æŸã€‚
@@ -586,8 +578,8 @@ C-x 的扩展命令有很多,下é¢åˆ—出的是你已ç»å­¦è¿‡çš„:
586“#hello.c#â€ã€‚这个文件会在正常存盘之åŽè¢« Emacs 删除。 578“#hello.c#â€ã€‚这个文件会在正常存盘之åŽè¢« Emacs 删除。
587 579
588所以,å‡å¦‚ä¸å¹¸çœŸçš„å‘生了,你大å¯ä»¥ä»Žå®¹åœ°æ‰“开原æ¥çš„æ–‡ä»¶ï¼ˆæ³¨æ„䏿˜¯è‡ªåŠ¨ä¿ 580所以,å‡å¦‚ä¸å¹¸çœŸçš„å‘生了,你大å¯ä»¥ä»Žå®¹åœ°æ‰“开原æ¥çš„æ–‡ä»¶ï¼ˆæ³¨æ„䏿˜¯è‡ªåЍä¿
589存文件)然åŽè¾“å…¥ M-x recover file<Return> æ¥æ¢å¤ä½ çš„自动ä¿å­˜æ–‡ä»¶ã€‚在æ 581存文件)然åŽè¾“å…¥ M-x recover file <Return> æ¥æ¢å¤ä½ çš„自动ä¿å­˜æ–‡ä»¶ã€‚在
590示确认的时候,输入 yes<Return>。 582æç¤ºç¡®è®¤çš„æ—¶å€™ï¼Œè¾“å…¥ yes<Return>。
591 583
592 584
593* 回显区(ECHO AREA) 585* 回显区(ECHO AREA)
@@ -602,7 +594,7 @@ C-x 的扩展命令有很多,下é¢åˆ—出的是你已ç»å­¦è¿‡çš„:
602 594
603ä½äºŽå›žæ˜¾åŒºæ­£ä¸Šæ–¹çš„ä¸€è¡Œè¢«ç§°ä¸ºâ€œçŠ¶æ€æ â€ã€‚çŠ¶æ€æ ä¸Šä¼šæ˜¾ç¤ºä¸€äº›ä¿¡æ¯ï¼Œæ¯”如: 595ä½äºŽå›žæ˜¾åŒºæ­£ä¸Šæ–¹çš„ä¸€è¡Œè¢«ç§°ä¸ºâ€œçŠ¶æ€æ â€ã€‚çŠ¶æ€æ ä¸Šä¼šæ˜¾ç¤ºä¸€äº›ä¿¡æ¯ï¼Œæ¯”如:
604 596
605--:** TUTORIAL.cn (Fundamental)--L670--54%---------------- 597 -:**- TUTORIAL.cn 63% L749 (Fundamental)
606 598
607çŠ¶æ€æ æ˜¾ç¤ºäº† Emacs 的状æ€å’Œä½ æ­£åœ¨ç¼–辑的文字的一些信æ¯ã€‚ 599çŠ¶æ€æ æ˜¾ç¤ºäº† Emacs 的状æ€å’Œä½ æ­£åœ¨ç¼–辑的文字的一些信æ¯ã€‚
608 600
@@ -631,7 +623,7 @@ Emacs çš„ä¸»æ¨¡å¼æž—林总总。有用æ¥ç¼–辑程åºä»£ç çš„――比如 Lisp
631 623
632编辑自然语言文本――比如现在――应该用 Text 模å¼ã€‚ 624编辑自然语言文本――比如现在――应该用 Text 模å¼ã€‚
633 625
634>> 输入 M-x text mode<Return>。 626>> 输入 M-x text-mode <Return>。
635 627
636别担心,什么都没å˜ã€‚ä¸è¿‡ç»†å¿ƒä¸€äº›å¯ä»¥å‘现,M-f å’Œ M-b 现在把å•引å·ï¼ˆ') 628别担心,什么都没å˜ã€‚ä¸è¿‡ç»†å¿ƒä¸€äº›å¯ä»¥å‘现,M-f å’Œ M-b 现在把å•引å·ï¼ˆ')
637视为è¯çš„一部分了。而在先å‰çš„ Fundamental 模å¼ä¸­ï¼ŒM-f å’Œ M-b 都将å•å¼•å· 629视为è¯çš„一部分了。而在先å‰çš„ Fundamental 模å¼ä¸­ï¼ŒM-f å’Œ M-b 都将å•引å·
@@ -643,7 +635,8 @@ Emacs 里得到了很好的体现】
643 635
644用 C-h m å¯ä»¥æŸ¥çœ‹å½“å‰ä¸»æ¨¡å¼çš„æ–‡æ¡£ã€‚ 636用 C-h m å¯ä»¥æŸ¥çœ‹å½“å‰ä¸»æ¨¡å¼çš„æ–‡æ¡£ã€‚
645 637
646>> 用 C-u C-v 将本行带到å±å¹•的最上方。 638>> 把光标移动到下一行。
639>> 用 C-l C-l 将本行带到å±å¹•的最上方。
647>> 输入 C-h m,看看 Text 模å¼ä¸Ž Fundamental æ¨¡å¼æœ‰å“ªäº›ä¸åŒã€‚ 640>> 输入 C-h m,看看 Text 模å¼ä¸Ž Fundamental æ¨¡å¼æœ‰å“ªäº›ä¸åŒã€‚
648>> 输入 C-x 1 关掉文档窗格。 641>> 输入 C-x 1 关掉文档窗格。
649 642
@@ -655,12 +648,12 @@ mode)存在。辅模å¼å¹¶ä¸èƒ½æ›¿ä»£ä¸»æ¨¡å¼ï¼Œè€Œæ˜¯æä¾›ä¸€äº›è¾…助的å
655有一个å«åšè‡ªåŠ¨æŠ˜è¡Œï¼ˆAuto Fill)的辅模å¼å¾ˆæœ‰ç”¨ï¼Œç‰¹åˆ«æ˜¯åœ¨ç¼–辑自然语言文本 648有一个å«åšè‡ªåŠ¨æŠ˜è¡Œï¼ˆAuto Fill)的辅模å¼å¾ˆæœ‰ç”¨ï¼Œç‰¹åˆ«æ˜¯åœ¨ç¼–辑自然语言文本
656的时候。å¯ç”¨è‡ªåŠ¨æŠ˜è¡ŒåŽï¼ŒEmacs 会在你打字超出一行边界时自动替你æ¢è¡Œã€‚ 649的时候。å¯ç”¨è‡ªåŠ¨æŠ˜è¡ŒåŽï¼ŒEmacs 会在你打字超出一行边界时自动替你æ¢è¡Œã€‚
657 650
658用 M-x auto fill mode<Return> å¯åŠ¨è‡ªåŠ¨æŠ˜è¡Œæ¨¡å¼ã€‚å†ç”¨ä¸€æ¬¡è¿™æ¡å‘½ä»¤ï¼Œè‡ªåЍ 651用 M-x auto-fill-mode <Return> å¯åŠ¨è‡ªåŠ¨æŠ˜è¡Œæ¨¡å¼ã€‚å†ç”¨ä¸€æ¬¡è¿™æ¡å‘½ä»¤ï¼Œè‡ª
659折行模å¼ä¼šè¢«å…³é—­ã€‚ä¹Ÿå°±æ˜¯è¯´ï¼Œå¦‚æžœè‡ªåŠ¨æŠ˜è¡Œæ¨¡å¼æ²¡æœ‰è¢«å¼€å¯ï¼Œè¿™ä¸ªå‘½ä»¤ä¼šå¼€å¯ 652动折行模å¼ä¼šè¢«å…³é—­ã€‚ä¹Ÿå°±æ˜¯è¯´ï¼Œå¦‚æžœè‡ªåŠ¨æŠ˜è¡Œæ¨¡å¼æ²¡æœ‰è¢«å¼€å¯ï¼Œè¿™ä¸ªå‘½ä»¤ä¼šå¼€
660它;如果已ç»å¼€å¯äº†ï¼Œè¿™ä¸ªå‘½ä»¤ä¼šå…³é—­å®ƒã€‚所以我们说,这个命令å¯ä»¥ç”¨æ¥â€œå¼€ 653å¯å®ƒï¼›å¦‚果已ç»å¼€å¯äº†ï¼Œè¿™ä¸ªå‘½ä»¤ä¼šå…³é—­å®ƒã€‚所以我们说,这个命令å¯ä»¥ç”¨æ¥
661关(toggleï¼‰â€æ¨¡å¼ã€‚ 654“开关(toggleï¼‰â€æ¨¡å¼ã€‚
662 655
663>> 现在输入 M-x auto fill mode<Return>。然åŽéšä¾¿æ•²ç‚¹ä»€ä¹ˆï¼Œç›´åˆ°ä½ çœ‹åˆ°å®ƒ 656>> 现在输入 M-x auto-fill-mode <Return>。然åŽéšä¾¿æ•²ç‚¹ä»€ä¹ˆï¼Œç›´åˆ°ä½ çœ‹åˆ°å®ƒ
664 分æˆä¸¤è¡Œã€‚你必须敲一些空格,因为 Auto Fill åªåœ¨ç©ºç™½å¤„进行断行。 657 分æˆä¸¤è¡Œã€‚你必须敲一些空格,因为 Auto Fill åªåœ¨ç©ºç™½å¤„进行断行。
665 ã€è¾“入空格对英文æ¥è¯´æ˜¯å¿…须的,而对中文则ä¸å¿…。】 658 ã€è¾“入空格对英文æ¥è¯´æ˜¯å¿…须的,而对中文则ä¸å¿…。】
666 659
@@ -680,12 +673,11 @@ mode)存在。辅模å¼å¹¶ä¸èƒ½æ›¿ä»£ä¸»æ¨¡å¼ï¼Œè€Œæ˜¯æä¾›ä¸€äº›è¾…助的å
680* æœç´¢ï¼ˆSEARCHING) 673* æœç´¢ï¼ˆSEARCHING)
681------------------- 674-------------------
682 675
683Emacs å¯ä»¥å‘剿ˆ–å‘åŽæœç´¢å­—ç¬¦ä¸²ã‚æœç´¢å‘½ä»¤æ˜¯ä¸€ä¸ªç§»åŠ¨å…‰æ ‡çš„å‘½ä»¤ï¼šæœç´¢æˆåŠŸ 676Emacs å¯ä»¥å‘剿ˆ–å‘åŽæœç´¢å­—ç¬¦ä¸²ï¼ˆâ€œå­—ç¬¦ä¸²â€æŒ‡çš„æ˜¯ä¸€ç»„连续的字符)。æœç´¢å‘½
684åŽï¼Œå…‰æ ‡ä¼šåœç•™åœ¨æœç´¢ç›®æ ‡å‡ºçŽ°çš„åœ°æ–¹ã€‚ 677令是一个移动光标的命令:æœç´¢æˆåŠŸåŽï¼Œå…‰æ ‡ä¼šåœç•™åœ¨æœç´¢ç›®æ ‡å‡ºçŽ°çš„åœ°æ–¹ã€‚
685 678
686Emacs çš„æœç´¢å‘½ä»¤çš„独特之处在于,它是“æ¸è¿›çš„(incremental)â€ã€‚æ„æ€æ˜¯æœ 679Emacs çš„æœç´¢å‘½ä»¤æ˜¯â€œæ¸è¿›çš„(incremental)â€ã€‚æ„æ€æ˜¯æœç´¢ä¸Žè¾“å…¥åŒæ—¶è¿›è¡Œï¼š
687ç´¢ä¸Žè¾“å…¥åŒæ—¶è¿›è¡Œï¼šä½ åœ¨é”®ç›˜ä¸Šä¸€å­—一å¥åœ°è¾“å…¥æœç´¢è¯çš„过程中,Emacs å°±å·²ç» 680你在键盘上一字一å¥åœ°è¾“å…¥æœç´¢è¯çš„过程中,Emacs 就已ç»å¼€å§‹æ›¿ä½ æœç´¢äº†ã€‚
688开始替你æœç´¢äº†ã€‚
689 681
690C-s 是å‘剿œç´¢ï¼ŒC-r 是å‘åŽæœç´¢ã€‚ä¸è¿‡æ‰‹åˆ«è¿™ä¹ˆå¿«ï¼åˆ«ç€æ€¥è¯•。 682C-s 是å‘剿œç´¢ï¼ŒC-r 是å‘åŽæœç´¢ã€‚ä¸è¿‡æ‰‹åˆ«è¿™ä¹ˆå¿«ï¼åˆ«ç€æ€¥è¯•。
691 683
@@ -696,7 +688,7 @@ C-s 是å‘剿œç´¢ï¼ŒC-r 是å‘åŽæœç´¢ã€‚ä¸è¿‡æ‰‹åˆ«è¿™ä¹ˆå¿«ï¼åˆ«ç€æ€¥è¯•
696 慢慢输入“cursorâ€è¿™ä¸ªè¯ï¼Œæ¯æ•²ä¸€ä¸ªå­—都åœé¡¿ä¸€ä¸‹å¹¶è§‚察光标。 688 慢慢输入“cursorâ€è¿™ä¸ªè¯ï¼Œæ¯æ•²ä¸€ä¸ªå­—都åœé¡¿ä¸€ä¸‹å¹¶è§‚察光标。
697 çŽ°åœ¨ä½ åº”è¯¥å·²æ›¾ç»æ‰¾åˆ°â€œcursorâ€è¿™ä¸ªè¯äº†ã€‚ 689 çŽ°åœ¨ä½ åº”è¯¥å·²æ›¾ç»æ‰¾åˆ°â€œcursorâ€è¿™ä¸ªè¯äº†ã€‚
698>> 冿Œ‰ä¸€æ¬¡ C-s,æœç´¢ä¸‹ä¸€ä¸ªâ€œcursorâ€å‡ºçŽ°çš„ä½ç½®ã€‚ 690>> 冿Œ‰ä¸€æ¬¡ C-s,æœç´¢ä¸‹ä¸€ä¸ªâ€œcursorâ€å‡ºçŽ°çš„ä½ç½®ã€‚
699>> 现在按四次退格键,看看光标是如何移动的。 691>> 现在按四次 <DEL> ,看看光标是如何移动的。
700>> 敲 <Return> ç»“æŸæœç´¢ã€‚ 692>> 敲 <Return> ç»“æŸæœç´¢ã€‚
701 693
702看仔细了么?在一次æ¸è¿›å¼æœç´¢ä¸­ï¼ŒEmacs 会å°è¯•跳到æœç´¢ç›®æ ‡å‡ºçŽ°çš„ä½ç½®ã€‚è¦ 694看仔细了么?在一次æ¸è¿›å¼æœç´¢ä¸­ï¼ŒEmacs 会å°è¯•跳到æœç´¢ç›®æ ‡å‡ºçŽ°çš„ä½ç½®ã€‚è¦
@@ -705,19 +697,14 @@ C-s 是å‘剿œç´¢ï¼ŒC-r 是å‘åŽæœç´¢ã€‚ä¸è¿‡æ‰‹åˆ«è¿™ä¹ˆå¿«ï¼åˆ«ç€æ€¥è¯•
705现 C-g 会让光标回到æœç´¢å¼€å§‹çš„ä½ç½®ï¼Œè€Œ <Return> 则让光标留在æœç´¢ç»“果上, 697现 C-g 会让光标回到æœç´¢å¼€å§‹çš„ä½ç½®ï¼Œè€Œ <Return> 则让光标留在æœç´¢ç»“果上,
706这是很有用的功能。】 698这是很有用的功能。】
707 699
708注æ„:在æŸäº›ç»ˆç«¯ä¸‹ï¼Œè¾“å…¥ C-x C-s 会冻结å±å¹•ã€å±å¹•没有任何输出】,使你看 700在æ¸è¿›å¼æœç´¢ä¸­ï¼ŒæŒ‰ <DEL> 会“撤回â€åˆ°æœ€è¿‘一次æœç´¢çš„命中ä½ç½®ã€‚å¦‚æžœä¹‹å‰æ²¡
709ä¸åˆ° Emacs 的任何å˜åŒ–。其原因是æ“作系统的“æµé‡æŽ§åˆ¶â€åŠŸèƒ½æ‹¦æˆªäº† C-s å¹¶ 701有一个命中, <DEL> 会抹去æœç´¢å­—符串中的最åŽä¸€ä¸ªå­—符。比如你已ç»è¾“入了
710冻结了å±å¹•。用 C-q å¯ä»¥è§£é™¤å±å¹•冻结。è¦è§£å†³è¿™ä¸ªé—®é¢˜ï¼Œè¯·å‚考 Emacs 手册 702“câ€ï¼Œå…‰æ ‡å°±åœåœ¨â€œcâ€ç¬¬ä¸€æ¬¡å‡ºçŽ°çš„ä½ç½®ï¼Œå†è¾“入“uâ€ï¼Œå…‰æ ‡åœåœ¨â€œcuâ€ç¬¬ä¸€æ¬¡å‡ºçް
711里的“Spontaneous Entry to Incremental Searchâ€ä¸€èŠ‚ã€Emacs 手册å¯èƒ½è¿˜æ²¡ 703çš„ä½ç½®ï¼Œè¿™æ—¶å†æŒ‰ <DEL> ,“uâ€å°±ä»Žæœç´¢å­—串中消失了,然åŽå…‰æ ‡ä¼šå›žåˆ°â€œcâ€ç¬¬
712有中文翻译】,那里æä¾›äº†ä¸€äº›æœ‰ç”¨çš„建议。 704一次出现的ä½ç½®ã€‚
713
714在æ¸è¿›å¼æœç´¢ä¸­ï¼ŒæŒ‰é€€æ ¼é”®ä¼šåˆ é™¤ç›®æ ‡å­—符串的最åŽä¸€ä¸ªå­—符,并且光标会回到
715最近一次æœç´¢çš„命中ä½ç½®ã€‚比如你已ç»è¾“入了“câ€ï¼Œå…‰æ ‡å°±åœåœ¨â€œcâ€ç¬¬ä¸€æ¬¡å‡º
716现的ä½ç½®ï¼Œå†è¾“入“uâ€ï¼Œå…‰æ ‡åœåœ¨â€œcuâ€ç¬¬ä¸€æ¬¡å‡ºçŽ°çš„ä½ç½®ï¼Œè¿™æ—¶å†æŒ‰é€€æ ¼é”®ï¼Œ
717“uâ€å°±ä»Žæœç´¢å­—串中消失了,然åŽå…‰æ ‡ä¼šå›žåˆ°â€œcâ€ç¬¬ä¸€æ¬¡å‡ºçŽ°çš„ä½ç½®ã€‚
718 705
719å¦å¤–,如果你在æœç´¢çš„æ—¶å€™è¾“入了 CONTROL 或者 META 组åˆé”®çš„è¯ï¼Œæœç´¢å¯èƒ½ä¼š 706å¦å¤–,如果你在æœç´¢çš„æ—¶å€™è¾“入了 control 或者 meta 组åˆé”®çš„è¯ï¼Œæœç´¢å¯èƒ½ä¼š
720结æŸã€‚(也有例外,比如 C-s å’Œ M-r 这些用于æœç´¢çš„命令。) 707结æŸã€‚(也有例外,比如 C-s å’Œ C-r 这些用于æœç´¢çš„命令。)
721 708
722å‰é¢è¯´çš„都是“å‘ä¸‹â€æœç´¢ï¼Œå¦‚果想“å‘ä¸Šâ€æœç´¢ï¼Œå¯ä»¥ç”¨ C-r。C-r 与 C-s 709å‰é¢è¯´çš„都是“å‘ä¸‹â€æœç´¢ï¼Œå¦‚果想“å‘ä¸Šâ€æœç´¢ï¼Œå¯ä»¥ç”¨ C-r。C-r 与 C-s
723相比除了æœç´¢æ–¹å‘相å之外,其余的æ“作都一样。 710相比除了æœç´¢æ–¹å‘相å之外,其余的æ“作都一样。
@@ -728,7 +715,7 @@ C-s 是å‘剿œç´¢ï¼ŒC-r 是å‘åŽæœç´¢ã€‚ä¸è¿‡æ‰‹åˆ«è¿™ä¹ˆå¿«ï¼åˆ«ç€æ€¥è¯•
728 715
729Emacs 的迷人之处很多,能够在å±å¹•ä¸ŠåŒæ—¶æ˜¾ç¤ºå¤šä¸ªçª—格就是其中之一。 716Emacs 的迷人之处很多,能够在å±å¹•ä¸ŠåŒæ—¶æ˜¾ç¤ºå¤šä¸ªçª—格就是其中之一。
730 717
731>> 移动光标到这一行,然åŽè¾“å…¥ C-u 0 C-l。 718>> 移动光标到这一行,然åŽè¾“å…¥ C-l C-l。
732 719
733>> 现在输入 C-x 2,它会将å±å¹•划分æˆä¸¤ä¸ªçª—格。 720>> 现在输入 C-x 2,它会将å±å¹•划分æˆä¸¤ä¸ªçª—格。
734 这两个窗格里显示的都是本篇快速指å—,而光标则åœç•™åœ¨ä¸Šæ–¹çš„窗格里。 721 这两个窗格里显示的都是本篇快速指å—,而光标则åœç•™åœ¨ä¸Šæ–¹çš„窗格里。
@@ -746,18 +733,17 @@ Emacs 的迷人之处很多,能够在å±å¹•ä¸ŠåŒæ—¶æ˜¾ç¤ºå¤šä¸ªçª—格就是å…
746>> å†è¾“å…¥ C-x o 将光标移回到上方的窗格里。 733>> å†è¾“å…¥ C-x o 将光标移回到上方的窗格里。
747 光标会回到它在上方窗格中原本所在的ä½ç½®ã€‚ 734 光标会回到它在上方窗格中原本所在的ä½ç½®ã€‚
748 735
749连续使用 C-x o å¯ä»¥é历所有窗格。æ¯ä¸€ä¸ªçª—格都有它自己的光标ä½ç½®ï¼Œä½†æ˜¯åª 736连续使用 C-x o å¯ä»¥é历所有窗格。“被选中的窗格â€ï¼Œä¹Ÿå°±æ˜¯ç»å¤§å¤šæ•°çš„编辑
750有一个窗格会真正显示这个光标。ã€å…¶å®ƒçª—格在控制å°ä¸‹ä¸ä¼šæ˜¾ç¤ºå…‰æ ‡ï¼Œåœ¨å›¾å½¢ 737æ“作所å‘ç”Ÿçš„åœ°æ–¹ï¼Œæ˜¯åœ¨ä½ ä¸æ‰“å­—æ—¶é—ªçƒå…‰æ ‡çš„那个窗格。其他的窗格有它们自
751窗å£ä¸‹ç¼ºçœæ˜¾ç¤ºä¸ºé•‚空光标。】一般所有的编辑命令都作用于这个光标所在的窗 738己的光标ä½ç½®ï¼› 如果你在图形界é¢ä¸‹è¿è¡Œ Emacs ,这些光标是镂空的长方形。
752格,我们称这个窗格为“被选中的窗格â€ã€‚
753 739
754当你在一个窗格中编辑,但用å¦ä¸€ä¸ªçª—格作为å‚考的时候,C-M-v 是很有用的命 740当你在一个窗格中编辑,但用å¦ä¸€ä¸ªçª—格作为å‚考的时候,C-M-v 是很有用的命
755令。你å¯ä»¥å§‹ç»ˆå¤„于ç¼è¾‘窗格中,然åŽç”¨ C-M-v 命令滚动å¦å¤–ä¸€ä¸ªçª—æ ¼ã€‚ã€æ¯”如 741令。无需离å¼è¢«é€‰ä¸­çš„窗格,你就å¯ä»¥ç”¨ C-M-v 命令滚动å¦å¤–一个窗格中的文
756翻译和校对就很适åˆç”¨è¿™ç§æ–¹å¼è¿›è¡Œã€‚】 742å­—ã€‚ã€æ¯”如翻译和校对就很适åˆç”¨è¿™ç§æ–¹å¼è¿›è¡Œã€‚】
757 743
758C-M-v 是一个 CONTROL-META 组åˆé”®ã€‚如果你有 META 键的è¯ï¼Œå¯ä»¥åŒæ—¶æŒ‰ä½ 744C-M-v 是一个 CONTROL-META 组åˆé”®ã€‚如果你有 META (或 Alt)键的è¯ï¼Œå¯ä»¥
759CONTROL å’Œ META 键并输入 v。CONTROL å’Œ META 键先按哪个都å¯ä»¥ï¼Œå› ä¸ºå®ƒä»¬ 745åŒæ—¶æŒ‰ä½CONTROL å’Œ META 键并输入 v。CONTROL å’Œ META 键先按哪个都å¯ä»¥ï¼Œ
760åªæ˜¯ç”¨æ¥â€œä¿®é¥°ï¼ˆmodify)â€ä½ è¾“入的字符的。 746å› ä¸ºå®ƒä»¬åªæ˜¯ç”¨æ¥â€œä¿®é¥°ï¼ˆmodify)â€ä½ è¾“入的字符的。
761 747
762如果你并没有 META 键,你也å¯ä»¥ç”¨ ESC æ¥ä»£æ›¿ï¼Œä¸è¿‡è¿™æ ·çš„è¯å°±è¦æ³¨æ„按键顺 748如果你并没有 META 键,你也å¯ä»¥ç”¨ ESC æ¥ä»£æ›¿ï¼Œä¸è¿‡è¿™æ ·çš„è¯å°±è¦æ³¨æ„按键顺
763åºäº†ï¼šä½ å¿…须先输入 ESC ,然åŽå†è¾“å…¥ CONTROL-v。CONTROL-ESC v 是没用的, 749åºäº†ï¼šä½ å¿…须先输入 ESC ,然åŽå†è¾“å…¥ CONTROL-v。CONTROL-ESC v 是没用的,
@@ -779,6 +765,26 @@ CONTROL å’Œ META 键并输入 v。CONTROL å’Œ META 键先按哪个都å¯ä»¥ï¼Œå›
779>> 输入 C-x o 回到上方的窗格,然åŽå†ç”¨ C-x 1 关掉下方窗格。 765>> 输入 C-x o 回到上方的窗格,然åŽå†ç”¨ C-x 1 关掉下方窗格。
780 766
781 767
768* 多窗å£ï¼ˆMULTIPLE FRAMES)
769------------------
770
771Emacs å¯ä»¥åˆ›å»ºå¤šä¸ªçª—å£ã€‚窗å£ç”±è®¸å¤šçª—格以åŠèœå•ã€æ»šåЍæ¡ã€å›žæ˜¾åŒºç­‰ç»„æˆã€‚
772在图形界é¢ä¸‹ï¼Œå¤šä¸ªçª—å£å¯ä»¥åŒæ—¶æ˜¾ç¤ºå‡ºæ¥ã€‚在文本终端中,åªèƒ½åŒæ—¶æ˜¾ç¤ºä¸€ä¸ª
773窗å£ã€‚
774
775>> 输入 M-x make-frame <Return>。
776 å¯ä»¥çœ‹åˆ°ä¸€ä¸ªæ–°çš„窗å£å‡ºçŽ°åœ¨äº†ä½ çš„å±å¹•上。
777
778ä½ å¯ä»¥åœ¨æ–°çš„窗å£é‡Œåšæœ€åˆçš„窗å£é‡Œå¯ä»¥åšçš„ä»»ä½•äº‹æƒ…ã€‚ç¬¬ä¸€ä¸ªçª—å£æ²¡æœ‰ä»€ä¹ˆç‰¹
779别的。
780
781>> 输入 M-x delete-frame <Return>.
782 这个命令将会关闭选中的窗å£ã€‚
783
784你也å¯ä»¥é€šè¿‡å›¾å½¢ç³»ç»Ÿæ¥å…³é—­æŸä¸ªçª—å£ï¼ˆé€šå¸¸æ˜¯åœ¨çª—å£ä¸Šé¢çš„æŸä¸ªè§’è½é‡Œçš„一个
785“Xâ€æŒ‰é’®ï¼‰ã€‚如果你关闭的是 Emacs 进程的最åŽä¸€ä¸ªçª—å£ï¼Œ Emacs 将会退出。
786
787
782* 递归编辑(RECURSIVE EDITING LEVELS) 788* 递归编辑(RECURSIVE EDITING LEVELS)
783-------------------------------------- 789--------------------------------------
784 790
@@ -810,9 +816,7 @@ CONTROL å’Œ META 键并输入 v。CONTROL å’Œ META 键先按哪个都å¯ä»¥ï¼Œå›
810么帮助。如果你连自己到底需è¦ä»€ä¹ˆå¸®åŠ©éƒ½ä¸çŸ¥é“,那么就输入 C-h ?,Emacs 816么帮助。如果你连自己到底需è¦ä»€ä¹ˆå¸®åŠ©éƒ½ä¸çŸ¥é“,那么就输入 C-h ?,Emacs
811会告诉你它能æä¾›äº†å“ªäº›å¸®åŠ©ã€‚å¦‚æžœä½ æŒ‰äº† C-h åˆæƒ³å悔,å¯ä»¥ç”¨ C-g å–æ¶ˆã€‚ 817会告诉你它能æä¾›äº†å“ªäº›å¸®åŠ©ã€‚å¦‚æžœä½ æŒ‰äº† C-h åˆæƒ³å悔,å¯ä»¥ç”¨ C-g å–æ¶ˆã€‚
812 818
813(有些主机改å˜äº† C-h çš„æ„义,这ç§ä»¥å·±åº¦äººå¤–åŠ ä¸€åˆ€åˆ‡çš„åšæ³•确实ä¸å¤ªå¥½ï¼Œä¸ 819(如果你按 C-h ä¹‹åŽæ²¡æœ‰ä»»ä½•å¸®åŠ©ä¿¡æ¯æ˜¾ç¤ºå‡ºæ¥ï¼Œé‚£ä¹ˆè¯•试 F1 键或者 M-x help <Return> 。)
814过倒是让你å¯ä»¥ä¹‰æ­£è¾žä¸¥åœ°æŠ±æ€¨ä»–们的系统管ç†å‘˜ã€‚è¯è¯´å›žæ¥ï¼Œå¦‚果你按 C-h 之
815åŽæ²¡æœ‰ä»»ä½•å¸®åŠ©ä¿¡æ¯æ˜¾ç¤ºå‡ºæ¥ï¼Œé‚£ä¹ˆè¯•试 F1 键或者 M-x help <Return> 。)
816 820
817最基本的帮助功能是 C-h c。输入 C-h c 之åŽå†è¾“入一个组åˆé”®ï¼ŒEmacs 会给出 821最基本的帮助功能是 C-h c。输入 C-h c 之åŽå†è¾“入一个组åˆé”®ï¼ŒEmacs 会给出
818这个命令的简è¦è¯´æ˜Žã€‚ 822这个命令的简è¦è¯´æ˜Žã€‚
@@ -823,9 +827,9 @@ CONTROL å’Œ META 键并输入 v。CONTROL å’Œ META 键先按哪个都å¯ä»¥ï¼Œå›
823 827
824 C-p runs the command previous-line 828 C-p runs the command previous-line
825 829
826è¿™æ¡æ¶ˆæ¯æ˜¾ç¤ºäº† C-p 命令对应的函数åï¼Œå½æ•°å主è¦ç”¨æ¥å®šåˆ¶å’Œæ‰©å±• Emacsãå½ 830è¿™æ¡æ¶ˆæ¯æ˜¾ç¤ºäº† C-p 命令对应的函数å。å½ä»¤çš„功能由函数完æˆï¼Œæ‰€ä»¥å½æ•°å
827令的功能由函数完æˆï¼Œæ‰€ä»¥å‡½æ•°å本身也å¯ä»¥è¢«çœ‹æˆæ˜¯æœ€ç®€å•的文档――至少对 831本身也å¯ä»¥è¢«çœ‹æˆæ˜¯æœ€ç®€å•的文档――至少对于你已ç»å­¦è¿‡çš„命令æ¥è¯´ï¼Œå®ƒä»¬çš„函
828于你已ç»å­¦è¿‡çš„命令æ¥è¯´ï¼Œå®ƒä»¬çš„函数å足以解释它们的功能了。 832æ•°å足以解释它们的功能了。
829 833
830多字符命令一样å¯ä»¥ç”¨ C-h c æ¥æŸ¥çœ‹ã€‚ 834多字符命令一样å¯ä»¥ç”¨ C-h c æ¥æŸ¥çœ‹ã€‚
831 835
@@ -841,7 +845,7 @@ CONTROL å’Œ META 键并输入 v。CONTROL å’Œ META 键先按哪个都å¯ä»¥ï¼Œå›
841 845
842 C-h f 解释一个函数。需è¦è¾“入函数å。 846 C-h f 解释一个函数。需è¦è¾“入函数å。
843 847
844>> 试试看,输入 C-h f previous-line<Return>。 848>> 试试看,输入 C-h f previous-line <Return>。
845 Emacs 会给出它所知é“的所有有关“实现 C-p 命令功能的函数â€çš„ä¿¡æ¯ã€‚ 849 Emacs 会给出它所知é“的所有有关“实现 C-p 命令功能的函数â€çš„ä¿¡æ¯ã€‚
846 850
847C-h v ç”¨æ¥æ˜¾ç¤º Emacs å˜é‡çš„æ–‡æ¡£ã€‚Emacs å˜é‡å¯ä»¥è¢«ç”¨æ¥â€œå®šåˆ¶ Emacs 的行 851C-h v ç”¨æ¥æ˜¾ç¤º Emacs å˜é‡çš„æ–‡æ¡£ã€‚Emacs å˜é‡å¯ä»¥è¢«ç”¨æ¥â€œå®šåˆ¶ Emacs 的行
@@ -852,7 +856,7 @@ C-h v ç”¨æ¥æ˜¾ç¤º Emacs å˜é‡çš„æ–‡æ¡£ã€‚Emacs å˜é‡å¯ä»¥è¢«ç”¨æ¥â€œå®šåˆ¶
852 的命令。这些命令全都å¯ä»¥ç”¨ M-x æ¥å¯åŠ¨ã€‚å¯¹äºŽæŸäº›å‘½ä»¤æ¥è¯´ï¼Œ 856 的命令。这些命令全都å¯ä»¥ç”¨ M-x æ¥å¯åŠ¨ã€‚å¯¹äºŽæŸäº›å‘½ä»¤æ¥è¯´ï¼Œ
853 相关命令æœç´¢è¿˜ä¼šåˆ—出一两个组åˆé”®ã€‚ 857 相关命令æœç´¢è¿˜ä¼šåˆ—出一两个组åˆé”®ã€‚
854 858
855>> 输入 C-h a file<Return>。 859>> 输入 C-h a file <Return>。
856 860
857Emacs 会在å¦ä¸€ä¸ªçª—格里显示一个 M-x 命令列表,这个列表包å«äº†æ‰€æœ‰åç§°ä¸­å« 861Emacs 会在å¦ä¸€ä¸ªçª—格里显示一个 M-x 命令列表,这个列表包å«äº†æ‰€æœ‰å称中å«
858有“fileâ€çš„命令。你å¯ä»¥çœ‹åˆ°åƒâ€œC-x C-fâ€è¿™æ ·çš„组åˆé”®æ˜¾ç¤ºåœ¨â€œfind-file†862有“fileâ€çš„命令。你å¯ä»¥çœ‹åˆ°åƒâ€œC-x C-fâ€è¿™æ ·çš„组åˆé”®æ˜¾ç¤ºåœ¨â€œfind-fileâ€
@@ -862,7 +866,7 @@ Emacs 会在å¦ä¸€ä¸ªçª—格里显示一个 M-x 命令列表,这个列表包å«
862 866
863>> 输入 C-x 1 æ¥åˆ é™¤ help 窗格。 867>> 输入 C-x 1 æ¥åˆ é™¤ help 窗格。
864 868
865 C-h i é˜…è¯»è”æœºæ‰‹å†Œï¼ˆä¹Ÿå°±æ˜¯é€šå¸¸è®²çš„ Info)。 869 C-h i 阅读手册(也就是通常讲的 Info)。
866 这个命令会打开一个称为“*info*â€çš„特殊缓冲区,在那里, 870 这个命令会打开一个称为“*info*â€çš„特殊缓冲区,在那里,
867 ä½ å¯ä»¥é˜…读安装在系统里的软件包使用手册。è¦è¯» Emacs 的使 871 ä½ å¯ä»¥é˜…读安装在系统里的软件包使用手册。è¦è¯» Emacs 的使
868 用手册,按 m emacs <Return> å°±å¯ä»¥äº†ã€‚如果你之å‰ä»Žæ²¡ç”¨ 872 用手册,按 m emacs <Return> å°±å¯ä»¥äº†ã€‚如果你之å‰ä»Žæ²¡ç”¨
@@ -875,18 +879,19 @@ Emacs 会在å¦ä¸€ä¸ªçª—格里显示一个 M-x 命令列表,这个列表包å«
875--------------------------- 879---------------------------
876 880
877想学习更多的使用技巧,Emacs 使用手册(manual)值得一读。你å¯ä»¥è¯»çº¸ç‰ˆçš„ 881想学习更多的使用技巧,Emacs 使用手册(manual)值得一读。你å¯ä»¥è¯»çº¸ç‰ˆçš„
878书,也å¯ä»¥çœ‹ç”µå­ç‰ˆçš„è”æœºæ‰‹å†Œï¼ˆå¯ä»¥ä»Ž Help èœå•进入或者按 F10 h r)。æ 882书,也å¯ä»¥åœ¨ Emacs 中读(å¯ä»¥ä»Ž Help èœå•进入或者按 C-h r)。æä¸¤ä¸ªä½ 
879两个你å¯èƒ½ä¼šå¾ˆæ„Ÿå…´è¶£çš„功能å§ï¼Œä¸€ä¸ªæ˜¯å¯ä»¥å¸®ä½ å°‘敲键盘的 completion(自动 883å¯èƒ½ä¼šå¾ˆæ„Ÿå…´è¶£çš„功能å§ï¼Œä¸€ä¸ªæ˜¯å¯ä»¥å¸®ä½ å°‘敲键盘的 completion(自动补全),
880补全),å¦ä¸€ä¸ªæ˜¯æ–¹ä¾¿æ–‡ä»¶å¤„ç†çš„ dired(目录编辑)。 884å¦ä¸€ä¸ªæ˜¯æ–¹ä¾¿æ–‡ä»¶å¤„ç†çš„ dired(目录编辑)。
881 885
882Completion å¯ä»¥æ›¿ä½ èŠ‚çœä¸å¿…è¦çš„键盘输入。比如说你想切æ¢åˆ° *Message* 缓 886Completion å¯ä»¥æ›¿ä½ èŠ‚çœä¸å¿…è¦çš„键盘输入。比如说你想切æ¢åˆ° *Message* 缓
883冲区,你就å¯ä»¥ç”¨ C-x b *M<Tab> æ¥å®Œæˆã€‚åªè¦ Emacs 能够根æ®ä½ å·²ç»è¾“入的 887冲区,你就å¯ä»¥ç”¨ C-x b *M<Tab> æ¥å®Œæˆã€‚åªè¦ Emacs 能够根æ®ä½ å·²ç»è¾“入的
884文字确定你想è¦è¾“入的内容,它就会自动帮你补é½ã€‚有关 Completion 的详细说 888文字确定你想è¦è¾“入的内容,它就会自动帮你补é½ã€‚Completion 也å¯ç”¨äºŽå‘½ä»¤
885明å¯ä»¥åœ¨ Emacs Info 中的“Completionâ€ä¸€èŠ‚é‡Œæ‰¾åˆ°ã€‚ 889å和文件å。有关 Completion 的详细说明å¯ä»¥åœ¨ Emacs Info 中的
890“Completionâ€ä¸€èŠ‚é‡Œæ‰¾åˆ°ã€‚
886 891
887Dired 能够在一个缓冲区里列出一个目录下的所有文件(å¯ä»¥é€‰æ‹©æ˜¯å¦ä¹Ÿåˆ—å‡ºå­ 892Dired 能够在一个缓冲区里列出一个目录下的所有文件(å¯ä»¥é€‰æ‹©æ˜¯å¦ä¹Ÿåˆ—出å­
888目录),然åŽä½ å¯ä»¥åœ¨è¿™ä¸ªæ–‡ä»¶åˆ—表上完æˆå¯¹æ–‡ä»¶çš„移动ã€è®¿é—®ã€é‡å‘½å或删除 893目录),然åŽä½ å¯ä»¥åœ¨è¿™ä¸ªæ–‡ä»¶åˆ—表上完æˆå¯¹æ–‡ä»¶çš„移动ã€è®¿é—®ã€é‡å‘½å或删除
889等等æ“作。Dired 也在 Emacs Info 中有详细介ç»ï¼Œå‚è§â€œDiredâ€ä¸€èŠ‚ã€‚ 894等等æ“作。Dired 也在 Emacs 使用手册中有详细介ç»ï¼Œå‚è§â€œDiredâ€ä¸€èŠ‚ã€‚
890 895
891Emacs 使用手册里还有许许多多的精彩功能等ç€ä½ æ¥äº†è§£ã€‚ 896Emacs 使用手册里还有许许多多的精彩功能等ç€ä½ æ¥äº†è§£ã€‚
892 897
@@ -894,8 +899,7 @@ Emacs 使用手册里还有许许多多的精彩功能等ç€ä½ æ¥äº†è§£ã€‚
894* 总结(CONCLUSION) 899* 总结(CONCLUSION)
895-------------------- 900--------------------
896 901
897è®°ä½ï¼Œè¦é€€å‡º Emacs 请用 C-x C-cã€‚è¦æš‚æ—¶åˆ‡æ¢åˆ° shell 并且ç¨åŽå†å›žåˆ° 902è¦é€€å‡º Emacs 请用 C-x C-c。
898Emacs 里æ¥ï¼Œè¯·ç”¨ C-z。ã€åˆ‡æ¢åˆ° shell 仅对控制å°ä¸‹çš„ Emacs 有效】
899 903
900æœ¬æ–‡å®Œå…¨æ˜¯ä¸ºé›¶èµ·ç‚¹æ–°æ‰‹æ‰€å†™çš„èµ·æ­¥æ•™ç¨‹ã€‚å¦‚æžœä½ è§‰å¾—å“ªé‡Œè¿˜çœ‹ä¸æ˜Žç™½ï¼Œåƒä¸‡ä¸ 904æœ¬æ–‡å®Œå…¨æ˜¯ä¸ºé›¶èµ·ç‚¹æ–°æ‰‹æ‰€å†™çš„èµ·æ­¥æ•™ç¨‹ã€‚å¦‚æžœä½ è§‰å¾—å“ªé‡Œè¿˜çœ‹ä¸æ˜Žç™½ï¼Œåƒä¸‡ä¸
901è¦æ€€ç–‘è‡ªå·±ï¼Œé‚£ä¸€å®šæ˜¯æˆ‘ä»¬æ²¡æœ‰å†™å¥½ã€‚æˆ‘ä»¬æ°¸è¿œæ¬¢è¿Žä½ çš„ä¸æ»¡å’ŒæŠ±æ€¨ã€‚ 905è¦æ€€ç–‘è‡ªå·±ï¼Œé‚£ä¸€å®šæ˜¯æˆ‘ä»¬æ²¡æœ‰å†™å¥½ã€‚æˆ‘ä»¬æ°¸è¿œæ¬¢è¿Žä½ çš„ä¸æ»¡å’ŒæŠ±æ€¨ã€‚
@@ -905,6 +909,7 @@ Emacs 里æ¥ï¼Œè¯·ç”¨ C-z。ã€åˆ‡æ¢åˆ° shell 仅对控制å°ä¸‹çš„ Emacs 有æ•
905--------------------- 909---------------------
906 910
907翻译:孙一江 <sunyijiang@gmail.com> 911翻译:孙一江 <sunyijiang@gmail.com>
912维护:薛富侨 <xfq.free@gmail.com>
908校对:水木社区(www.newsmth.net)Emacs æ¿ä¼—多网å‹åŠä¼—多 Emacs 中文用户 913校对:水木社区(www.newsmth.net)Emacs æ¿ä¼—多网å‹åŠä¼—多 Emacs 中文用户
909 914
910Emacs 快速指å—(Tutorial)早有两个刘昭å®çš„中文译本,ç¹ç®€å„一。其简体版本 915Emacs 快速指å—(Tutorial)早有两个刘昭å®çš„中文译本,ç¹ç®€å„一。其简体版本
@@ -915,11 +920,11 @@ Emacs 快速指å—(Tutorial)早有两个刘昭å®çš„中文译本,ç¹ç®€å„
915的译文质é‡å¾ˆé«˜ï¼Œåœ¨ç¿»è¯‘过程中给予过我们许多借鉴和å‚考,在此对刘昭å®çš„工作 920的译文质é‡å¾ˆé«˜ï¼Œåœ¨ç¿»è¯‘过程中给予过我们许多借鉴和å‚考,在此对刘昭å®çš„工作
916表示感谢。 921表示感谢。
917 922
918翻译过程中最大的挑战莫过于术语译è¯çš„选择了。ç»è¿‡æ°´æœ¨ç¤¾åŒº Emacs æ¿çƒ­å¿ƒç½‘ 923翻译过程中最大的挑战莫过于术语译è¯çš„选择了。ç»è¿‡æ°´æœ¨ç¤¾åŒº Emacs æ¿çƒ­å¿ƒ
919å‹å°èŒƒå›´å†…的讨论,我们选择了现在的译法。用户的广泛å‚与是自由软件生命力 924网å‹å°èŒƒå›´å†…的讨论,我们选择了现在的译法。用户的广泛å‚与是自由软件生命
920çš„æºæ³‰ï¼Œæ‰€ä»¥å¦‚果你有任何建议ã€å‹˜è¯¯æˆ–想法,请用你喜欢的方å¼å‘我们æå‡ºã€‚ 925åŠ›çš„æºæ³‰ï¼Œæ‰€ä»¥å¦‚果你有任何建议ã€å‹˜è¯¯æˆ–想法,请用你喜欢的方å¼å‘我们æå‡ºã€‚
921ä½ å¯ä»¥é€šè¿‡ç”µå­é‚®ä»¶ç›´æŽ¥è”系译者,也å¯ä»¥æ”¾åˆ° GNU Emacs 的开å‘邮件列表或者 926ä½ å¯ä»¥é€šè¿‡ç”µå­é‚®ä»¶ç›´æŽ¥è”系维护者,也å¯ä»¥æ”¾åˆ° GNU Emacs 的开å‘邮件列表
922水木社区的 Emacs æ¿ä¸Šè¿›è¡Œè®¨è®ºã€‚ 927或者水木社区的 Emacs æ¿ä¸Šè¿›è¡Œè®¨è®ºã€‚
923 928
924下é¢åˆ—å‡ºä¸»è¦æœ¯è¯­çš„译è¯å¯¹ç…§ï¼Œå¹¶ç»™å‡ºæ³¨é‡Šè¯´æ˜Žï¼š 929下é¢åˆ—å‡ºä¸»è¦æœ¯è¯­çš„译è¯å¯¹ç…§ï¼Œå¹¶ç»™å‡ºæ³¨é‡Šè¯´æ˜Žï¼š
925 930
@@ -941,6 +946,8 @@ Emacs 快速指å—(Tutorial)早有两个刘昭å®çš„中文译本,ç¹ç®€å„
941 search æœç´¢ 946 search æœç´¢
942 incremental search æ¸è¿›å¼æœç´¢ [3] 947 incremental search æ¸è¿›å¼æœç´¢ [3]
943 948
949对于其他没有æåˆ°çš„æœ¯è¯­ï¼Œè¯»è€…å¯ä»¥å‚考 Emacs 使用手册里的术语表。
950
944[1] “windowâ€ä¸€è¯åœ¨è®¡ç®—机相关的领域一般都被译为“窗å£â€ã€‚但是在 Emacs 951[1] “windowâ€ä¸€è¯åœ¨è®¡ç®—机相关的领域一般都被译为“窗å£â€ã€‚但是在 Emacs
945 中,还有一个“frameâ€çš„æ¦‚念。在被广泛使用的 X 窗å£ç³»ç»Ÿå’Œå¾®è½¯çš„视窗 952 中,还有一个“frameâ€çš„æ¦‚念。在被广泛使用的 X 窗å£ç³»ç»Ÿå’Œå¾®è½¯çš„视窗
946 (Windows)系列æ“作系统中,Emacs 的一个“frameâ€å°±æ˜¯ä¸€ä¸ªâ€œçª—å£â€ï¼Œå›  953 (Windows)系列æ“作系统中,Emacs 的一个“frameâ€å°±æ˜¯ä¸€ä¸ªâ€œçª—å£â€ï¼Œå› 
@@ -977,46 +984,56 @@ Emacs 快速指å—(Tutorial)早有两个刘昭å®çš„中文译本,ç¹ç®€å„
977This tutorial descends from a long line of Emacs tutorials 984This tutorial descends from a long line of Emacs tutorials
978starting with the one written by Stuart Cracraft for the original Emacs. 985starting with the one written by Stuart Cracraft for the original Emacs.
979 986
980This version of the tutorial, like GNU Emacs, is copyrighted, and 987This version of the tutorial is a part of GNU Emacs. It is copyrighted
981comes with permission to distribute copies on certain conditions: 988and comes with permission to distribute copies on certain conditions:
989
990 Copyright (C) 1985, 1996, 1998, 2001-2013 Free Software Foundation,
991 Inc.
992
993 This file is part of GNU Emacs.
982 994
983Copyright (C) 1985, 1996, 1998, 2001-2013 Free Software Foundation, Inc. 995 GNU Emacs is free software: you can redistribute it and/or modify
996 it under the terms of the GNU General Public License as published by
997 the Free Software Foundation, either version 3 of the License, or
998 (at your option) any later version.
984 999
985 Permission is granted to anyone to make or distribute verbatim copies 1000 GNU Emacs is distributed in the hope that it will be useful,
986 of this document as received, in any medium, provided that the 1001 but WITHOUT ANY WARRANTY; without even the implied warranty of
987 copyright notice and permission notice are preserved, 1002 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
988 and that the distributor grants the recipient permission 1003 GNU General Public License for more details.
989 for further redistribution as permitted by this notice.
990 1004
991 Permission is granted to distribute modified versions 1005 You should have received a copy of the GNU General Public License
992 of this document, or of portions of it, 1006 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
993 under the above conditions, provided also that they
994 carry prominent notices stating who last altered them.
995 1007
996The conditions for copying Emacs itself are more complex, but in the 1008Please read the file COPYING and then do give copies of GNU Emacs to
997same spirit. Please read the file COPYING and then do give copies of 1009your friends. Help stamp out software obstructionism ("ownership") by
998GNU Emacs to your friends. Help stamp out software obstructionism 1010using, writing, and sharing free software!
999("ownership") by using, writing, and sharing free software!
1000 1011
1001ã€ä¸‹é¢ä¸ºç‰ˆæƒå£°æ˜Žçš„译文,仅供å‚考。实际法律效力以英文原文为准。】 1012ã€ä¸‹é¢ä¸ºç‰ˆæƒå£°æ˜Žçš„译文,仅供å‚考。实际法律效力以英文原文为准。】
1002 1013
1003æœ¬å¿«é€ŸæŒ‡å—æ²¿è¢­è‡ªåކ岿‚ ä¹…çš„ Emacs 快速指å—,å¯ä¸Šæº¯è‡³ Stuart Cracraft 为最 1014æœ¬å¿«é€ŸæŒ‡å—æ²¿è¢­è‡ªåކ岿‚ ä¹…çš„ Emacs 快速指å—,å¯ä¸Šæº¯è‡³ Stuart Cracraft 为最
1004åˆçš„ Emacs 所作的版本。 1015åˆçš„ Emacs 所作的版本。
1005 1016
1006本篇文档与 GNU Emacs 一样拥有版æƒï¼Œå¹¶å…许在下列æ¡ä»¶çš„约æŸä¸‹å‘行其拷è´ï¼š 1017æœ¬ç¯‡æŒ‡å—æ˜¯ GNU Emacs 的一部分,并å…许在下列æ¡ä»¶çš„约æŸä¸‹å‘行其拷è´ï¼š
1018
1019 Copyright (C) 1985, 1996, 1998, 2001-2013 Free Software Foundation,
1020 Inc.
1021
1022 本文件为 GNU Emacs 的一部分。
1007 1023
1008 Copyright (C) 1985, 1996, 1998, 2001-2013 Free Software Foundation, Inc. 1024 GNU Emacs 为自由软件;您å¯ä¾æ®è‡ªç”±è½¯ä»¶åŸºé‡‘会所å‘表的GNU通用公共授æƒ
1025 æ¡æ¬¾ï¼Œå¯¹æœ¬ç¨‹åºå†æ¬¡å‘布和/æˆ–ä¿®æ”¹ï¼›æ— è®ºæ‚¨ä¾æ®çš„æ˜¯æœ¬æŽˆæƒçš„第三版,或
1026 (您å¯é€‰çš„)任一日åŽå‘行的版本。
1009 1027
1010 本文档å…许在ä¸å˜æ›´æ–‡æ¡£å†…容的情况下由任何人å‘å¸ƒåœ¨ä»»ä½•åª’ä½“ä¸Šï¼ŒåŒæ—¶å¿…é¡» 1028 GNU Emacs 是基于使用目的而加以å‘布,然而ä¸è´Ÿä»»ä½•æ‹…ä¿è´£ä»»ï¼›äº¦æ— å¯¹é€‚
1011 完整ä¿ç•™ç‰ˆæƒå’Œè®¸å¯å£°æ˜Žï¼Œä¸”需给予å—众与å‘行者完全相åŒçš„ã€å¦‚æœ¬å£°æ˜Žæ‰€å… 1029 售性或特定目的适用性所为的默示性担ä¿ã€‚详情请å‚ç…§GNU通用公共授æƒã€‚
1012 è®¸çš„å†æ¬¡å‘行本文档的æƒåˆ©ã€‚
1013 1030
1014 本声明å…许在与上述æ¡ä»ç›¸åŒçšæƒ…å†µä¸‹å‘布ç»è¿‡ä¿®æ”¹çš„å…¨éƒ¨æˆ–éƒ¨åˆ†æ–‡æ¡£ï¼ŒåŒæ—¶ 1031 您应已æ¶åˆ°é™éšäºŽ GNU Emacs çš„GNU通用公共授æƒçš„副本;如果没有,请å‚ç…§
1015 必须附带显è¦çš„æ–‡å­—以申明文档的最åŽä¿®æ”¹è€…。 1032 <http://www.gnu.org/licenses/>.
1016 1033
1017Emacs 自身的版æƒé—®é¢˜è™½æ¯æœ¬æ–‡æ¡£è¦å¤æ‚ä¸äº›ï¼Œä½†ä¹ŸåŸºäºŽç›¸åŒçš„精神。æ¬è¯·é˜…读文 1034敬请é˜è¯»æ–‡ä»¶âœCOPYINGâ€ï¼Œç„¶åŽå‘你的朋å‹ä»¬åˆ†å‘ GNU Emacs æ‹·è´ã€‚让我们以使
1018ä»¶âœCOPYINGâ€ï¼Œç„¶åŽå你的朋å‹ä»¬åˆ†å‘ GNU Emacs æ‹·è´ã€‚让我们以使用ã编写和 1035用ã编写和分享自由软件的实际行动æ¥å…±åŒç¥›é™¤è½¯ä»¶éšœç¢ä¸»ä¹‰ï¼ˆæ‰è°“的“所有
1019分享自由软件的实际行动æ¥å…±åŒç¥›é™¤è½¯ä»¶éšœç¢ä¸»ä¹‰ï¼ˆæ‰€è°“的“所有æƒâ€ï¼‰ï¼ 1036æƒâ€ï¼‰ï¼
1020 1037
1021;;; Local Variables: 1038;;; Local Variables:
1022;;; coding: utf-8 1039;;; coding: utf-8
diff --git a/etc/tutorials/TUTORIAL.es b/etc/tutorials/TUTORIAL.es
index e8a23e6d7a4..15b0a4e26bf 100644
--- a/etc/tutorials/TUTORIAL.es
+++ b/etc/tutorials/TUTORIAL.es
@@ -285,7 +285,7 @@ Explicaremos después como usar múltiples ventanas. Ahora mismo
285queremos explicar cómo deshacerse de ventanas adicionales y volver a 285queremos explicar cómo deshacerse de ventanas adicionales y volver a
286la edición básica en una ventana. Es sencillo: 286la edición básica en una ventana. Es sencillo:
287 287
288 C-x 1 Una ventana (p.ej., elimina todas las otras ventanas). 288 C-x 1 Una ventana (es decir, elimina todas las demás ventanas).
289 289
290Esto es CONTROL-x seguido por el dígito 1. C-x 1 expande la ventana que 290Esto es CONTROL-x seguido por el dígito 1. C-x 1 expande la ventana que
291contiene el cursor, para ocupar toda la pantalla. Esto borra todas las 291contiene el cursor, para ocupar toda la pantalla. Esto borra todas las
@@ -374,7 +374,7 @@ resumen de las operaciones de borrado:
374Note que <DEL> y C-d, comparados con M-<DEL> y M-d, extienden el 374Note que <DEL> y C-d, comparados con M-<DEL> y M-d, extienden el
375paralelismo iniciado por C-f y M-f (bien, <DEL> no es realmente una 375paralelismo iniciado por C-f y M-f (bien, <DEL> no es realmente una
376tecla de control, pero no nos preocuparemos de eso ahora). C-k y M-k, 376tecla de control, pero no nos preocuparemos de eso ahora). C-k y M-k,
377en ciertas forma, son como C-e y M-e, en que las líneas de unos 377en cierta forma, son como C-e y M-e, en que las líneas de unos
378corresponden a sentencias en los otros. 378corresponden a sentencias en los otros.
379 379
380También puede eliminar un segmento contiguo de texto con un método 380También puede eliminar un segmento contiguo de texto con un método
diff --git a/etc/tutorials/TUTORIAL.translators b/etc/tutorials/TUTORIAL.translators
index 3ec948eb79a..25897d753a6 100644
--- a/etc/tutorials/TUTORIAL.translators
+++ b/etc/tutorials/TUTORIAL.translators
@@ -7,7 +7,7 @@ Maintainer: Ognyan Kulev <ogi@tower.3.bg>
7 7
8* TUTORIAL.cn: 8* TUTORIAL.cn:
9Author: Sun Yijiang <sunyijiang@gmail.com> 9Author: Sun Yijiang <sunyijiang@gmail.com>
10Maintainer: Sun Yijiang <sunyijiang@gmail.com> 10Maintainer: Xue Fuqiao <xfq.free@gmail.com>
11 11
12* TUTORIAL.cs: 12* TUTORIAL.cs:
13Author: Milan Zamazal <pdm@zamazal.org> 13Author: Milan Zamazal <pdm@zamazal.org>
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d914582c280..5dfca6b8e2f 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -22,15 +22,208 @@
22 (vc-bzr-ignore-completion-table): 22 (vc-bzr-ignore-completion-table):
23 (vc-bzr-find-ignore-file): New functions. 23 (vc-bzr-find-ignore-file): New functions.
24 24
252013-08-04 Juanma Barranquero <lekktu@gmail.com>
26
27 * frameset.el (frameset-p, frameset-save): Fix autoload cookies.
28 (frameset-filter-minibuffer): Doc fix.
29 (frameset-restore): Fix autoload cookie. Fix typo in docstring.
30
31 * desktop.el (desktop-clear): Only delete frames when called
32 interactively and desktop-restore-frames is non-nil. Doc fix.
33 (desktop-read): Set desktop-saved-frameset to nil.
34
352013-08-03 Juanma Barranquero <lekktu@gmail.com>
36
37 * frameset.el (frameset-prop): New function and setter.
38 (frameset-save): Do not modify frame list passed by the caller.
39
402013-08-03 Stefan Monnier <monnier@iro.umontreal.ca>
41
42 * emacs-lisp/package.el (package-desc-from-define): Ignore unknown keys.
43
442013-08-02 Stefan Monnier <monnier@iro.umontreal.ca>
45
46 * emacs-lisp/easy-mmode.el (define-globalized-minor-mode)
47 (easy-mmode-define-navigation): Avoid ((lambda (..) ..) ...).
48
49 * custom.el (custom-initialize-default, custom-initialize-set)
50 (custom-initialize-reset, custom-initialize-changed): Affect the
51 toplevel-default-value (bug#6275, bug#14586).
52 * emacs-lisp/advice.el (ad-compile-function): Undo previous workaround
53 for bug#6275.
54
552013-08-02 Juanma Barranquero <lekktu@gmail.com>
56
57 * emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression):
58 Add cl-def* expressions.
59
60 * frameset.el (frameset-filter-params): Fix order of arguments.
61
622013-08-02 Juanma Barranquero <lekktu@gmail.com>
63
64 Move code related to saving frames to frameset.el.
65 * desktop.el: Require frameset.
66 (desktop-restore-frames): Doc fix.
67 (desktop-restore-reuses-frames): Rename from
68 desktop-restoring-reuses-frames.
69 (desktop-saved-frameset): Rename from desktop-saved-frame-states.
70 (desktop-clear): Clear frames too.
71 (desktop-filter-parameters-alist): Set from frameset-filter-alist.
72 (desktop--filter-tty*, desktop-save, desktop-read):
73 Use frameset functions.
74 (desktop-before-saving-frames-functions, desktop--filter-*-color)
75 (desktop--filter-minibuffer, desktop--filter-restore-desktop-parm)
76 (desktop--filter-save-desktop-parm, desktop--filter-iconified-position)
77 (desktop-restore-in-original-display-p, desktop--filter-frame-parms)
78 (desktop--process-minibuffer-frames, desktop-save-frames)
79 (desktop--reuse-list, desktop--compute-pos, desktop--move-onscreen)
80 (desktop--find-frame, desktop--select-frame, desktop--make-frame)
81 (desktop--sort-states, desktop-restoring-frames-p)
82 (desktop-restore-frames): Remove. Most code moved to frameset.el.
83 (desktop-restoring-frameset-p, desktop-restore-frameset)
84 (desktop--check-dont-save, desktop-save-frameset): New functions.
85 (desktop--app-id): New constant.
86 (desktop-first-buffer, desktop-buffer-ok-count)
87 (desktop-buffer-fail-count): Move before first use.
88 * frameset.el: New file.
89
902013-08-01 Stefan Monnier <monnier@iro.umontreal.ca>
91
92 * files.el: Use lexical-binding.
93 (dir-locals-read-from-file): Remove unused `err' variable.
94 (hack-dir-local-variables--warned-coding): New var.
95 (hack-dir-local-variables): Use it to avoid repeated warnings.
96 (make-backup-file-name--default-function): New function.
97 (make-backup-file-name-function): Use it as default.
98 (buffer-stale--default-function): New function.
99 (buffer-stale-function): Use it as default.
100 (revert-buffer-insert-file-contents--default-function): New function.
101 (revert-buffer-insert-file-contents-function): Use it as default.
102 (insert-directory): Avoid add-to-list.
103
104 * autorevert.el (auto-revert-handler): Simplify.
105 Use buffer-stale--default-function.
106
1072013-08-01 Tassilo Horn <tsdh@gnu.org>
108
109 * speedbar.el (speedbar-query-confirmation-method): Doc fix.
110
111 * whitespace.el (whitespace-ensure-local-variables): New function.
112 (whitespace-cleanup-region): Call it.
113 (whitespace-turn-on): Call it.
114
1152013-08-01 Michael Albinus <michael.albinus@gmx.de>
116
117 Complete file name handlers.
118
119 * net/tramp.el (tramp-handle-set-visited-file-modtime)
120 (tramp-handle-verify-visited-file-modtime)
121 (tramp-handle-file-notify-rm-watch): New functions.
122 (tramp-call-process): Do not bind `default-directory'.
123
124 * net/tramp-adb.el (tramp-adb-file-name-handler-alist):
125 Order alphabetically.
126 [access-file, add-name-to-file, dired-call-process]:
127 [dired-compress-file, file-acl, file-notify-rm-watch]:
128 [file-ownership-preserved-p, file-selinux-context]:
129 [make-directory-internal, make-symbolic-link, set-file-acl]:
130 [set-file-selinux-context, set-visited-file-modtime]:
131 [verify-visited-file-modtime]: Add handler.
132 (tramp-adb-handle-write-region): Apply `set-visited-file-modtime'.
133
134 * net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist)
135 [file-notify-add-watch, file-notify-rm-watch]:
136 [set-file-times, set-visited-file-modtime]:
137 [verify-visited-file-modtime]: Add handler.
138 (with-tramp-gvfs-error-message)
139 (tramp-gvfs-handle-set-visited-file-modtime)
140 (tramp-gvfs-fuse-file-name): Remove.
141 (tramp-gvfs-handle-file-notify-add-watch)
142 (tramp-gvfs-file-gvfs-monitor-file-process-filter): New defuns.
143 (tramp-gvfs-handle-write-region): Fix error in moving tmpfile.
144
145 * net/tramp-sh.el (tramp-sh-file-name-handler-alist):
146 Order alphabetically.
147 [file-notify-rm-watch ]: Use default Tramp handler.
148 [executable-find]: Remove private handler.
149 (tramp-do-copy-or-rename-file-out-of-band): Do not bind
150 `default-directory'.
151 (tramp-sh-handle-executable-find)
152 (tramp-sh-handle-file-notify-rm-watch): Remove functions.
153 (tramp-sh-file-gvfs-monitor-dir-process-filter)
154 (tramp-sh-file-inotifywait-process-filter, tramp-set-remote-path):
155 Do not use `format' in `tramp-message'.
156
157 * net/tramp-smb.el (tramp-smb-file-name-handler-alist)
158 [file-notify-rm-watch, set-visited-file-modtime]:
159 [verify-visited-file-modtime]: Add handler.
160 (tramp-smb-call-winexe): Do not bind `default-directory'.
161
1622013-08-01 Xue Fuqiao <xfq.free@gmail.com>
163
164 * vc/vc-hooks.el (vc-menu-map): Fix menu entry for vc-ignore.
165
1662013-07-31 Dmitry Gutov <dgutov@yandex.ru>
167
168 * vc/log-view.el (log-view-diff): Extract `log-view-diff-common',
169 use it.
170 (log-view-diff-changeset): Same.
171 (log-view-diff-common): Call backend command `previous-revision'
172 to find out the previous revision, in both cases. Swap the
173 variables `to' and `fr', so that `fr' usually refers to the
174 earlier revision (Bug#14989).
175
1762013-07-31 Kan-Ru Chen <kanru@kanru.info>
177
178 * ibuf-ext.el (ibuffer-filter-by-filename):
179 Make it work with dired buffers too.
180
1812013-07-31 Dmitry Antipov <dmantipov@yandex.ru>
182
183 * emacs-lisp/re-builder.el (reb-color-display-p):
184 * files.el (save-buffers-kill-terminal):
185 * net/browse-url.el (browse-url):
186 * server.el (server-save-buffers-kill-terminal):
187 * textmodes/reftex-toc.el (reftex-toc, reftex-toc-revert):
188 Prefer nil to selected-frame for the first arg of frame-parameter.
189
1902013-07-31 Xue Fuqiao <xfq.free@gmail.com>
191
192 * vc/vc-hooks.el (vc-menu-map): Add menu entry for vc-ignore.
193
1942013-07-30 Stephen Berman <stephen.berman@gmx.net>
195
196 * minibuffer.el (completion--twq-all): Try and preserve each
197 completion's case choice (bug#14907).
198
1992013-07-30 Lars Magne Ingebrigtsen <larsi@gnus.org>
200
201 * net/network-stream.el (open-network-stream): Mention the new
202 :nogreeting parameter.
203 (network-stream-open-starttls): Use the :nogreeting parameter
204 (bug#14938).
205
206 * net/shr.el (shr-mouse-browse-url): Remove and use `shr-browse-url'.
207
208 * net/eww.el (eww-setup-buffer): Switching to the buffer seems
209 more natural than popping.
210
211 * net/shr.el (shr-urlify): Put `follow-link' on URLs (bug#14815).
212 (shr-urlify): Highlight under mouse.
213
252013-07-30 Xue Fuqiao <xfq.free@gmail.com> 2142013-07-30 Xue Fuqiao <xfq.free@gmail.com>
26 215
216 * vc/vc-hooks.el (vc-prefix-map): Add key binding for vc-ignore.
217
218 * vc/vc-dir.el (vc-dir-mode-map): Change key binding for vc-dir-ignore.
219
27 * vc/vc-svn.el (vc-svn-ignore): Remove `interactive'. Use `*vc*' 220 * vc/vc-svn.el (vc-svn-ignore): Remove `interactive'. Use `*vc*'
28 buffer for output. 221 buffer for output.
29 222
30 * vc/vc-hg.el (vc-hg-ignore): Remove `interactive'. Do not assume 223 * vc/vc-hg.el (vc-hg-ignore): Remove `interactive'. Do not assume
31 point-min==1. Fix search string. Fix parentheses missing. 224 point-min==1. Fix search string. Fix parentheses missing.
32 225
33 * vc/vc-git.el (vc-git-ignore): Remove `interactive'. Do not 226 * vc/vc-git.el (vc-git-ignore): Remove `interactive'. Do not
34 assume point-min==1. Fix search string. Fix parentheses missing. 227 assume point-min==1. Fix search string. Fix parentheses missing.
35 228
36 * vc/vc-cvs.el (vc-cvs-ignore): Remove `interactive'. 229 * vc/vc-cvs.el (vc-cvs-ignore): Remove `interactive'.
@@ -94,7 +287,7 @@
94 * progmodes/cc-engine.el (c-beginning-of-statement-1) 287 * progmodes/cc-engine.el (c-beginning-of-statement-1)
95 (c-after-conditional): Adapt to deal with c-block-stmt-1-2-key. 288 (c-after-conditional): Adapt to deal with c-block-stmt-1-2-key.
96 * progmodes/cc-fonts.el (c-font-lock-declarations): Adapt to deal 289 * progmodes/cc-fonts.el (c-font-lock-declarations): Adapt to deal
97 with c-block-stmet-1-2-key. 290 with c-block-stmt-1-2-key.
98 291
992013-07-27 Juanma Barranquero <lekktu@gmail.com> 2922013-07-27 Juanma Barranquero <lekktu@gmail.com>
100 293
diff --git a/lisp/autorevert.el b/lisp/autorevert.el
index 1617a31cd82..978a834cb4c 100644
--- a/lisp/autorevert.el
+++ b/lisp/autorevert.el
@@ -595,14 +595,14 @@ This is an internal function used by Auto-Revert Mode."
595 (setq size 595 (setq size
596 (nth 7 (file-attributes 596 (nth 7 (file-attributes
597 buffer-file-name))))) 597 buffer-file-name)))))
598 (and (file-readable-p buffer-file-name) 598 (funcall (or buffer-stale-function
599 (not (verify-visited-file-modtime buffer))))) 599 #'buffer-stale--default-function)
600 t)))
600 (and (or auto-revert-mode 601 (and (or auto-revert-mode
601 global-auto-revert-non-file-buffers) 602 global-auto-revert-non-file-buffers)
602 revert-buffer-function 603 (funcall (or buffer-stale-function
603 (boundp 'buffer-stale-function) 604 #'buffer-stale--default-function)
604 (functionp buffer-stale-function) 605 t))))
605 (funcall buffer-stale-function t))))
606 eob eoblist) 606 eob eoblist)
607 (setq auto-revert-notify-modified-p nil) 607 (setq auto-revert-notify-modified-p nil)
608 (when revert 608 (when revert
diff --git a/lisp/custom.el b/lisp/custom.el
index f2d58084e9e..3db34e4d1fb 100644
--- a/lisp/custom.el
+++ b/lisp/custom.el
@@ -49,63 +49,66 @@ Users should not set it.")
49 49
50;;; The `defcustom' Macro. 50;;; The `defcustom' Macro.
51 51
52(defun custom-initialize-default (symbol value) 52(defun custom-initialize-default (symbol exp)
53 "Initialize SYMBOL with VALUE. 53 "Initialize SYMBOL with EXP.
54This will do nothing if symbol already has a default binding. 54This will do nothing if symbol already has a default binding.
55Otherwise, if symbol has a `saved-value' property, it will evaluate 55Otherwise, if symbol has a `saved-value' property, it will evaluate
56the car of that and use it as the default binding for symbol. 56the car of that and use it as the default binding for symbol.
57Otherwise, VALUE will be evaluated and used as the default binding for 57Otherwise, EXP will be evaluated and used as the default binding for
58symbol." 58symbol."
59 (eval `(defvar ,symbol ,(if (get symbol 'saved-value) 59 (eval `(defvar ,symbol ,(let ((sv (get symbol 'saved-value)))
60 (car (get symbol 'saved-value)) 60 (if sv (car sv) exp)))))
61 value))))
62 61
63(defun custom-initialize-set (symbol value) 62(defun custom-initialize-set (symbol exp)
64 "Initialize SYMBOL based on VALUE. 63 "Initialize SYMBOL based on EXP.
65If the symbol doesn't have a default binding already, 64If the symbol doesn't have a default binding already,
66then set it using its `:set' function (or `set-default' if it has none). 65then set it using its `:set' function (or `set-default' if it has none).
67The value is either the value in the symbol's `saved-value' property, 66The value is either the value in the symbol's `saved-value' property,
68if any, or VALUE." 67if any, or the value of EXP."
69 (unless (default-boundp symbol) 68 (condition-case nil
70 (funcall (or (get symbol 'custom-set) 'set-default) 69 (default-toplevel-value symbol)
71 symbol 70 (error
72 (eval (if (get symbol 'saved-value) 71 (funcall (or (get symbol 'custom-set) #'set-default-toplevel-value)
73 (car (get symbol 'saved-value)) 72 symbol
74 value))))) 73 (eval (let ((sv (get symbol 'saved-value)))
75 74 (if sv (car sv) exp)))))))
76(defun custom-initialize-reset (symbol value) 75
77 "Initialize SYMBOL based on VALUE. 76(defun custom-initialize-reset (symbol exp)
77 "Initialize SYMBOL based on EXP.
78Set the symbol, using its `:set' function (or `set-default' if it has none). 78Set the symbol, using its `:set' function (or `set-default' if it has none).
79The value is either the symbol's current value 79The value is either the symbol's current value
80 (as obtained using the `:get' function), if any, 80 (as obtained using the `:get' function), if any,
81or the value in the symbol's `saved-value' property if any, 81or the value in the symbol's `saved-value' property if any,
82or (last of all) VALUE." 82or (last of all) the value of EXP."
83 (funcall (or (get symbol 'custom-set) 'set-default) 83 (funcall (or (get symbol 'custom-set) #'set-default-toplevel-value)
84 symbol 84 symbol
85 (cond ((default-boundp symbol) 85 (condition-case nil
86 (funcall (or (get symbol 'custom-get) 'default-value) 86 (let ((def (default-toplevel-value symbol))
87 symbol)) 87 (getter (get symbol 'custom-get)))
88 ((get symbol 'saved-value) 88 (if getter (funcall getter symbol) def))
89 (eval (car (get symbol 'saved-value)))) 89 (error
90 (t 90 (eval (let ((sv (get symbol 'saved-value)))
91 (eval value))))) 91 (if sv (car sv) exp)))))))
92 92
93(defun custom-initialize-changed (symbol value) 93(defun custom-initialize-changed (symbol exp)
94 "Initialize SYMBOL with VALUE. 94 "Initialize SYMBOL with EXP.
95Like `custom-initialize-reset', but only use the `:set' function if 95Like `custom-initialize-reset', but only use the `:set' function if
96not using the standard setting. 96not using the standard setting.
97For the standard setting, use `set-default'." 97For the standard setting, use `set-default'."
98 (cond ((default-boundp symbol) 98 (condition-case nil
99 (funcall (or (get symbol 'custom-set) 'set-default) 99 (let ((def (default-toplevel-value symbol)))
100 symbol 100 (funcall (or (get symbol 'custom-set) #'set-default-toplevel-value)
101 (funcall (or (get symbol 'custom-get) 'default-value) 101 symbol
102 symbol))) 102 (let ((getter (get symbol 'custom-get)))
103 ((get symbol 'saved-value) 103 (if getter (funcall getter symbol) def))))
104 (funcall (or (get symbol 'custom-set) 'set-default) 104 (error
105 symbol 105 (cond
106 (eval (car (get symbol 'saved-value))))) 106 ((get symbol 'saved-value)
107 (t 107 (funcall (or (get symbol 'custom-set) #'set-default-toplevel-value)
108 (set-default symbol (eval value))))) 108 symbol
109 (eval (car (get symbol 'saved-value)))))
110 (t
111 (set-default symbol (eval exp)))))))
109 112
110(defvar custom-delayed-init-variables nil 113(defvar custom-delayed-init-variables nil
111 "List of variables whose initialization is pending.") 114 "List of variables whose initialization is pending.")
diff --git a/lisp/desktop.el b/lisp/desktop.el
index 299bdc0eeb4..778c37484e1 100644
--- a/lisp/desktop.el
+++ b/lisp/desktop.el
@@ -134,6 +134,7 @@
134;;; Code: 134;;; Code:
135 135
136(require 'cl-lib) 136(require 'cl-lib)
137(require 'frameset)
137 138
138(defvar desktop-file-version "206" 139(defvar desktop-file-version "206"
139 "Version number of desktop file format. 140 "Version number of desktop file format.
@@ -372,7 +373,7 @@ modes are restored automatically; they should not be listed here."
372 :group 'desktop) 373 :group 'desktop)
373 374
374(defcustom desktop-restore-frames t 375(defcustom desktop-restore-frames t
375 "When non-nil, save window/frame configuration to desktop file." 376 "When non-nil, save frames to desktop file."
376 :type 'boolean 377 :type 'boolean
377 :group 'desktop 378 :group 'desktop
378 :version "24.4") 379 :version "24.4")
@@ -399,7 +400,7 @@ few pixels, especially near the right / bottom borders of the screen."
399 :group 'desktop 400 :group 'desktop
400 :version "24.4") 401 :version "24.4")
401 402
402(defcustom desktop-restoring-reuses-frames t 403(defcustom desktop-restore-reuses-frames t
403 "If t, restoring frames reuses existing frames. 404 "If t, restoring frames reuses existing frames.
404If nil, existing frames are deleted. 405If nil, existing frames are deleted.
405If `keep', existing frames are kept and not reused." 406If `keep', existing frames are kept and not reused."
@@ -409,13 +410,6 @@ If `keep', existing frames are kept and not reused."
409 :group 'desktop 410 :group 'desktop
410 :version "24.4") 411 :version "24.4")
411 412
412(defcustom desktop-before-saving-frames-functions nil
413 "Abnormal hook run before saving frames.
414Functions in this hook are called with one argument, a live frame."
415 :type 'hook
416 :group 'desktop
417 :version "24.4")
418
419(defcustom desktop-file-name-format 'absolute 413(defcustom desktop-file-name-format 'absolute
420 "Format in which desktop file names should be saved. 414 "Format in which desktop file names should be saved.
421Possible values are: 415Possible values are:
@@ -599,7 +593,7 @@ DIRNAME omitted or nil means use `desktop-dirname'."
599 "Checksum of the last auto-saved contents of the desktop file. 593 "Checksum of the last auto-saved contents of the desktop file.
600Used to avoid writing contents unchanged between auto-saves.") 594Used to avoid writing contents unchanged between auto-saves.")
601 595
602(defvar desktop-saved-frame-states nil 596(defvar desktop-saved-frameset nil
603 "Saved state of all frames. 597 "Saved state of all frames.
604Only valid during frame saving & restoring; intended for internal use.") 598Only valid during frame saving & restoring; intended for internal use.")
605 599
@@ -649,7 +643,10 @@ DIRNAME omitted or nil means use `desktop-dirname'."
649 "Empty the Desktop. 643 "Empty the Desktop.
650This kills all buffers except for internal ones and those with names matched by 644This kills all buffers except for internal ones and those with names matched by
651a regular expression in the list `desktop-clear-preserve-buffers'. 645a regular expression in the list `desktop-clear-preserve-buffers'.
652Furthermore, it clears the variables listed in `desktop-globals-to-clear'." 646Furthermore, it clears the variables listed in `desktop-globals-to-clear'.
647When called interactively and `desktop-restore-frames' is non-nil, it also
648deletes all frames except the selected one (and its minibuffer frame,
649if different)."
653 (interactive) 650 (interactive)
654 (desktop-lazy-abort) 651 (desktop-lazy-abort)
655 (dolist (var desktop-globals-to-clear) 652 (dolist (var desktop-globals-to-clear)
@@ -667,7 +664,21 @@ Furthermore, it clears the variables listed in `desktop-globals-to-clear'."
667 (unless (or (eq (aref bufname 0) ?\s) ;; Don't kill internal buffers 664 (unless (or (eq (aref bufname 0) ?\s) ;; Don't kill internal buffers
668 (string-match-p preserve-regexp bufname)) 665 (string-match-p preserve-regexp bufname))
669 (kill-buffer buffer))))) 666 (kill-buffer buffer)))))
670 (delete-other-windows)) 667 (delete-other-windows)
668 (when (and desktop-restore-frames
669 ;; Non-interactive calls to desktop-clear happen before desktop-read
670 ;; which already takes care of frame restoration and deletion.
671 (called-interactively-p 'any))
672 (let* ((this (selected-frame))
673 (mini (window-frame (minibuffer-window this)))) ; in case they difer
674 (dolist (frame (sort (frame-list) #'frameset-sort-frames-for-deletion))
675 (condition-case err
676 (unless (or (eq frame this)
677 (eq frame mini)
678 (frame-parameter frame 'desktop-dont-clear))
679 (delete-frame frame))
680 (error
681 (delay-warning 'desktop (error-message-string err))))))))
671 682
672;; ---------------------------------------------------------------------------- 683;; ----------------------------------------------------------------------------
673(unless noninteractive 684(unless noninteractive
@@ -890,223 +901,41 @@ DIRNAME must be the directory in which the desktop file will be saved."
890 901
891;; ---------------------------------------------------------------------------- 902;; ----------------------------------------------------------------------------
892(defvar desktop-filter-parameters-alist 903(defvar desktop-filter-parameters-alist
893 '((background-color . desktop--filter-*-color) 904 (append '((font-backend . t)
894 (buffer-list . t) 905 (name . t)
895 (buffer-predicate . t) 906 (outer-window-id . t)
896 (buried-buffer-list . t) 907 (parent-id . t)
897 (desktop--font . desktop--filter-restore-desktop-parm) 908 (tty . desktop--filter-tty*)
898 (desktop--fullscreen . desktop--filter-restore-desktop-parm) 909 (tty-type . desktop--filter-tty*)
899 (desktop--height . desktop--filter-restore-desktop-parm) 910 (window-id . t)
900 (desktop--width . desktop--filter-restore-desktop-parm) 911 (window-system . t))
901 (font . desktop--filter-save-desktop-parm) 912 frameset-filter-alist)
902 (font-backend . t)
903 (foreground-color . desktop--filter-*-color)
904 (fullscreen . desktop--filter-save-desktop-parm)
905 (height . desktop--filter-save-desktop-parm)
906 (left . desktop--filter-iconified-position)
907 (minibuffer . desktop--filter-minibuffer)
908 (name . t)
909 (outer-window-id . t)
910 (parent-id . t)
911 (top . desktop--filter-iconified-position)
912 (tty . desktop--filter-tty*)
913 (tty-type . desktop--filter-tty*)
914 (width . desktop--filter-save-desktop-parm)
915 (window-id . t)
916 (window-system . t))
917 "Alist of frame parameters and filtering functions. 913 "Alist of frame parameters and filtering functions.
918 914Its format is identical to `frameset-filter-alist' (which see).")
919Each element is a cons (PARAM . FILTER), where PARAM is a parameter
920name (a symbol identifying a frame parameter), and FILTER can be t
921\(meaning the parameter is removed from the parameter list on saving
922and restoring), or a function that will be called with three args:
923
924 CURRENT a cons (PARAM . VALUE), where PARAM is the one being
925 filtered and VALUE is its current value
926 PARAMETERS the complete alist of parameters being filtered
927 SAVING non-nil if filtering before saving state, nil otherwise
928
929The FILTER function must return:
930 nil CURRENT is removed from the list
931 t CURRENT is left as is
932 (PARAM' . VALUE') replace CURRENT with this
933
934Frame parameters not on this list are passed intact.")
935
936(defvar desktop--target-display nil
937 "Either (minibuffer . VALUE) or nil.
938This refers to the current frame config being processed inside
939`frame--restore-frames' and its auxiliary functions (like filtering).
940If nil, there is no need to change the display.
941If non-nil, display parameter to use when creating the frame.
942Internal use only.")
943
944(defun desktop-switch-to-gui-p (parameters)
945 "True when switching to a graphic display.
946Return t if PARAMETERS describes a text-only terminal and
947the target is a graphic display; otherwise return nil.
948Only meaningful when called from a filtering function in
949`desktop-filter-parameters-alist'."
950 (and desktop--target-display ; we're switching
951 (null (cdr (assq 'display parameters))) ; from a tty
952 (cdr desktop--target-display))) ; to a GUI display
953
954(defun desktop-switch-to-tty-p (parameters)
955 "True when switching to a text-only terminal.
956Return t if PARAMETERS describes a graphic display and
957the target is a text-only terminal; otherwise return nil.
958Only meaningful when called from a filtering function in
959`desktop-filter-parameters-alist'."
960 (and desktop--target-display ; we're switching
961 (cdr (assq 'display parameters)) ; from a GUI display
962 (null (cdr desktop--target-display)))) ; to a tty
963 915
964(defun desktop--filter-tty* (_current parameters saving) 916(defun desktop--filter-tty* (_current parameters saving)
965 ;; Remove tty and tty-type parameters when switching 917 ;; Remove tty and tty-type parameters when switching
966 ;; to a GUI frame. 918 ;; to a GUI frame.
967 (or saving 919 (or saving
968 (not (desktop-switch-to-gui-p parameters)))) 920 (not (frameset-switch-to-gui-p parameters))))
969 921
970(defun desktop--filter-*-color (current parameters saving) 922(defun desktop--check-dont-save (frame)
971 ;; Remove (foreground|background)-color parameters 923 (not (frame-parameter frame 'desktop-dont-save)))
972 ;; when switching to a GUI frame if they denote an 924
973 ;; "unspecified" color. 925(defconst desktop--app-id `(desktop . ,desktop-file-version))
974 (or saving 926
975 (not (desktop-switch-to-gui-p parameters)) 927(defun desktop-save-frameset ()
976 (not (stringp (cdr current))) 928 "Save the state of existing frames in `desktop-saved-frameset'.
977 (not (string-match-p "^unspecified-[fb]g$" (cdr current)))))
978
979(defun desktop--filter-minibuffer (current _parameters saving)
980 ;; When minibuffer is a window, save it as minibuffer . t
981 (or (not saving)
982 (if (windowp (cdr current))
983 '(minibuffer . t)
984 t)))
985
986(defun desktop--filter-restore-desktop-parm (current parameters saving)
987 ;; When switching to a GUI frame, convert desktop--XXX parameter to XXX
988 (or saving
989 (not (desktop-switch-to-gui-p parameters))
990 (let ((val (cdr current)))
991 (if (eq val :desktop-processed)
992 nil
993 (cons (intern (substring (symbol-name (car current))
994 9)) ;; (length "desktop--")
995 val)))))
996
997(defun desktop--filter-save-desktop-parm (current parameters saving)
998 ;; When switching to a tty frame, save parameter XXX as desktop--XXX so it
999 ;; can be restored in a subsequent GUI session, unless it already exists.
1000 (cond (saving t)
1001 ((desktop-switch-to-tty-p parameters)
1002 (let ((sym (intern (format "desktop--%s" (car current)))))
1003 (if (assq sym parameters)
1004 nil
1005 (cons sym (cdr current)))))
1006 ((desktop-switch-to-gui-p parameters)
1007 (let* ((dtp (assq (intern (format "desktop--%s" (car current)))
1008 parameters))
1009 (val (cdr dtp)))
1010 (if (eq val :desktop-processed)
1011 nil
1012 (setcdr dtp :desktop-processed)
1013 (cons (car current) val))))
1014 (t t)))
1015
1016(defun desktop--filter-iconified-position (_current parameters saving)
1017 ;; When saving an iconified frame, top & left are meaningless,
1018 ;; so remove them to allow restoring to a default position.
1019 (not (and saving (eq (cdr (assq 'visibility parameters)) 'icon))))
1020
1021(defun desktop-restore-in-original-display-p ()
1022 "True if saved frames' displays should be honored."
1023 (cond ((daemonp) t)
1024 ((eq system-type 'windows-nt) nil)
1025 (t (null desktop-restore-in-current-display))))
1026
1027(defun desktop--filter-frame-parms (parameters saving)
1028 "Filter frame parameters and return filtered list.
1029PARAMETERS is a parameter alist as returned by `frame-parameters'.
1030If SAVING is non-nil, filtering is happening before saving frame state;
1031otherwise, filtering is being done before restoring frame state.
1032Parameters are filtered according to the setting of
1033`desktop-filter-parameters-alist' (which see).
1034Internal use only."
1035 (let ((filtered nil))
1036 (dolist (param parameters)
1037 (let ((filter (cdr (assq (car param) desktop-filter-parameters-alist)))
1038 this)
1039 (cond (;; no filter: pass param
1040 (null filter)
1041 (push param filtered))
1042 (;; filter = t; skip param
1043 (eq filter t))
1044 (;; filter func returns nil: skip param
1045 (null (setq this (funcall filter param parameters saving))))
1046 (;; filter func returns t: pass param
1047 (eq this t)
1048 (push param filtered))
1049 (;; filter func returns a new param: use it
1050 t
1051 (push this filtered)))))
1052 ;; Set the display parameter after filtering, so that filter functions
1053 ;; have access to its original value.
1054 (when desktop--target-display
1055 (let ((display (assq 'display filtered)))
1056 (if display
1057 (setcdr display (cdr desktop--target-display))
1058 (push desktop--target-display filtered))))
1059 filtered))
1060
1061(defun desktop--process-minibuffer-frames (frames)
1062 ;; Adds a desktop--mini parameter to frames
1063 ;; desktop--mini is a list (MINIBUFFER NUMBER DEFAULT?) where
1064 ;; MINIBUFFER t if the frame (including minibuffer-only) owns a minibuffer
1065 ;; NUMBER if MINIBUFFER = t, an ID for the frame; if nil, the ID of
1066 ;; the frame containing the minibuffer used by this frame
1067 ;; DEFAULT? if t, this frame is the value of default-minibuffer-frame
1068 (let ((count 0))
1069 ;; Reset desktop--mini for all frames
1070 (dolist (frame (frame-list))
1071 (set-frame-parameter frame 'desktop--mini nil))
1072 ;; Number all frames with its own minibuffer
1073 (dolist (frame (minibuffer-frame-list))
1074 (set-frame-parameter frame 'desktop--mini
1075 (list t
1076 (cl-incf count)
1077 (eq frame default-minibuffer-frame))))
1078 ;; Now link minibufferless frames with their minibuffer frames
1079 (dolist (frame frames)
1080 (unless (frame-parameter frame 'desktop--mini)
1081 (let ((mb-frame (window-frame (minibuffer-window frame))))
1082 ;; Frames whose minibuffer frame has been filtered out will have
1083 ;; desktop--mini = nil, so desktop-restore-frames will restore them
1084 ;; according to their minibuffer parameter. Set up desktop--mini
1085 ;; for the rest.
1086 (when (memq mb-frame frames)
1087 (set-frame-parameter frame 'desktop--mini
1088 (list nil
1089 (cl-second (frame-parameter mb-frame 'desktop--mini))
1090 nil))))))))
1091
1092(defun desktop-save-frames ()
1093 "Save frame state in `desktop-saved-frame-states'.
1094Runs the hook `desktop-before-saving-frames-functions'.
1095Frames with a non-nil `desktop-dont-save' parameter are not saved." 929Frames with a non-nil `desktop-dont-save' parameter are not saved."
1096 (setq desktop-saved-frame-states 930 (setq desktop-saved-frameset
1097 (and desktop-restore-frames 931 (and desktop-restore-frames
1098 (let ((frames (cl-delete-if 932 (let ((name (concat user-login-name "@" system-name
1099 (lambda (frame) 933 (format-time-string " %Y-%m-%d %T"))))
1100 (run-hook-with-args 'desktop-before-saving-frames-functions frame) 934 (frameset-save nil
1101 (frame-parameter frame 'desktop-dont-save)) 935 :filters desktop-filter-parameters-alist
1102 (frame-list)))) 936 :predicate #'desktop--check-dont-save
1103 ;; In case some frame was deleted by a hook function 937 :properties (list :app desktop--app-id
1104 (setq frames (cl-delete-if-not #'frame-live-p frames)) 938 :name name))))))
1105 (desktop--process-minibuffer-frames frames)
1106 (mapcar (lambda (frame)
1107 (cons (desktop--filter-frame-parms (frame-parameters frame) t)
1108 (window-state-get (frame-root-window frame) t)))
1109 frames)))))
1110 939
1111;;;###autoload 940;;;###autoload
1112(defun desktop-save (dirname &optional release auto-save) 941(defun desktop-save (dirname &optional release auto-save)
@@ -1148,11 +977,11 @@ and don't save the buffer if they are the same."
1148 (insert "\n;; Global section:\n") 977 (insert "\n;; Global section:\n")
1149 ;; Called here because we save the window/frame state as a global 978 ;; Called here because we save the window/frame state as a global
1150 ;; variable for compatibility with previous Emacsen. 979 ;; variable for compatibility with previous Emacsen.
1151 (desktop-save-frames) 980 (desktop-save-frameset)
1152 (unless (memq 'desktop-saved-frame-states desktop-globals-to-save) 981 (unless (memq 'desktop-saved-frameset desktop-globals-to-save)
1153 (desktop-outvar 'desktop-saved-frame-states)) 982 (desktop-outvar 'desktop-saved-frameset))
1154 (mapc (function desktop-outvar) desktop-globals-to-save) 983 (mapc (function desktop-outvar) desktop-globals-to-save)
1155 (setq desktop-saved-frame-states nil) ; after saving desktop-globals-to-save 984 (setq desktop-saved-frameset nil) ; after saving desktop-globals-to-save
1156 (when (memq 'kill-ring desktop-globals-to-save) 985 (when (memq 'kill-ring desktop-globals-to-save)
1157 (insert 986 (insert
1158 "(setq kill-ring-yank-pointer (nthcdr " 987 "(setq kill-ring-yank-pointer (nthcdr "
@@ -1210,319 +1039,26 @@ This function also sets `desktop-dirname' to nil."
1210(defvar desktop-lazy-timer nil) 1039(defvar desktop-lazy-timer nil)
1211 1040
1212;; ---------------------------------------------------------------------------- 1041;; ----------------------------------------------------------------------------
1213(defvar desktop--reuse-list nil 1042(defun desktop-restoring-frameset-p ()
1214 "Internal use only.") 1043 "True if calling `desktop-restore-frameset' will actually restore it."
1215 1044 (and desktop-restore-frames desktop-saved-frameset t))
1216(defun desktop--compute-pos (value left/top right/bottom) 1045
1217 (pcase value 1046(defun desktop-restore-frameset ()
1218 (`(+ ,val) (+ left/top val)) 1047 "Restore the state of a set of frames.
1219 (`(- ,val) (+ right/bottom val)) 1048This function depends on the value of `desktop-saved-frameset'
1220 (val val)))
1221
1222(defun desktop--move-onscreen (frame)
1223 "If FRAME is offscreen, move it back onscreen and, if necessary, resize it.
1224When forced onscreen, frames wider than the monitor's workarea are converted
1225to fullwidth, and frames taller than the workarea are converted to fullheight.
1226NOTE: This only works for non-iconified frames."
1227 (pcase-let* ((`(,left ,top ,width ,height) (cl-cdadr (frame-monitor-attributes frame)))
1228 (right (+ left width -1))
1229 (bottom (+ top height -1))
1230 (fr-left (desktop--compute-pos (frame-parameter frame 'left) left right))
1231 (fr-top (desktop--compute-pos (frame-parameter frame 'top) top bottom))
1232 (ch-width (frame-char-width frame))
1233 (ch-height (frame-char-height frame))
1234 (fr-width (max (frame-pixel-width frame) (* ch-width (frame-width frame))))
1235 (fr-height (max (frame-pixel-height frame) (* ch-height (frame-height frame))))
1236 (fr-right (+ fr-left fr-width -1))
1237 (fr-bottom (+ fr-top fr-height -1)))
1238 (when (pcase desktop-restore-forces-onscreen
1239 ;; Any corner is outside the screen.
1240 (`all (or (< fr-bottom top) (> fr-bottom bottom)
1241 (< fr-left left) (> fr-left right)
1242 (< fr-right left) (> fr-right right)
1243 (< fr-top top) (> fr-top bottom)))
1244 ;; Displaced to the left, right, above or below the screen.
1245 (`t (or (> fr-left right)
1246 (< fr-right left)
1247 (> fr-top bottom)
1248 (< fr-bottom top)))
1249 (_ nil))
1250 (let ((fullwidth (> fr-width width))
1251 (fullheight (> fr-height height))
1252 (params nil))
1253 ;; Position frame horizontally.
1254 (cond (fullwidth
1255 (push `(left . ,left) params))
1256 ((> fr-right right)
1257 (push `(left . ,(+ left (- width fr-width))) params))
1258 ((< fr-left left)
1259 (push `(left . ,left) params)))
1260 ;; Position frame vertically.
1261 (cond (fullheight
1262 (push `(top . ,top) params))
1263 ((> fr-bottom bottom)
1264 (push `(top . ,(+ top (- height fr-height))) params))
1265 ((< fr-top top)
1266 (push `(top . ,top) params)))
1267 ;; Compute fullscreen state, if required.
1268 (when (or fullwidth fullheight)
1269 (push (cons 'fullscreen
1270 (cond ((not fullwidth) 'fullheight)
1271 ((not fullheight) 'fullwidth)
1272 (t 'maximized)))
1273 params))
1274 ;; Finally, move the frame back onscreen.
1275 (when params
1276 (modify-frame-parameters frame params))))))
1277
1278(defun desktop--find-frame (predicate display &rest args)
1279 "Find a suitable frame in `desktop--reuse-list'.
1280Look through frames whose display property matches DISPLAY and
1281return the first one for which (PREDICATE frame ARGS) returns t.
1282If PREDICATE is nil, it is always satisfied. Internal use only.
1283This is an auxiliary function for `desktop--select-frame'."
1284 (cl-find-if (lambda (frame)
1285 (and (equal (frame-parameter frame 'display) display)
1286 (or (null predicate)
1287 (apply predicate frame args))))
1288 desktop--reuse-list))
1289
1290(defun desktop--select-frame (display frame-cfg)
1291 "Look for an existing frame to reuse.
1292DISPLAY is the display where the frame will be shown, and FRAME-CFG
1293is the parameter list of the frame being restored. Internal use only."
1294 (if (eq desktop-restoring-reuses-frames t)
1295 (let ((frame nil)
1296 mini)
1297 ;; There are no fancy heuristics there. We could implement some
1298 ;; based on frame size and/or position, etc., but it is not clear
1299 ;; that any "gain" (in the sense of reduced flickering, etc.) is
1300 ;; worth the added complexity. In fact, the code below mainly
1301 ;; tries to work nicely when M-x desktop-read is used after a desktop
1302 ;; session has already been loaded. The other main use case, which
1303 ;; is the initial desktop-read upon starting Emacs, should usually
1304 ;; only have one, or very few, frame(s) to reuse.
1305 (cond ((null display)
1306 ;; When the target is tty, every existing frame is reusable.
1307 (setq frame (desktop--find-frame nil display)))
1308 ((car (setq mini (cdr (assq 'desktop--mini frame-cfg))))
1309 ;; If the frame has its own minibuffer, let's see whether
1310 ;; that frame has already been loaded (which can happen after
1311 ;; M-x desktop-read).
1312 (setq frame (desktop--find-frame
1313 (lambda (f m)
1314 (equal (frame-parameter f 'desktop--mini) m))
1315 display mini))
1316 ;; If it has not been loaded, and it is not a minibuffer-only frame,
1317 ;; let's look for an existing non-minibuffer-only frame to reuse.
1318 (unless (or frame (eq (cdr (assq 'minibuffer frame-cfg)) 'only))
1319 (setq frame (desktop--find-frame
1320 (lambda (f)
1321 (let ((w (frame-parameter f 'minibuffer)))
1322 (and (window-live-p w)
1323 (window-minibuffer-p w)
1324 (eq (window-frame w) f))))
1325 display))))
1326 (mini
1327 ;; For minibufferless frames, check whether they already exist,
1328 ;; and that they are linked to the right minibuffer frame.
1329 (setq frame (desktop--find-frame
1330 (lambda (f n)
1331 (pcase-let (((and m `(,hasmini ,num))
1332 (frame-parameter f 'desktop--mini)))
1333 (and m
1334 (null hasmini)
1335 (= num n)
1336 (equal (cl-second (frame-parameter
1337 (window-frame (minibuffer-window f))
1338 'desktop--mini))
1339 n))))
1340 display (cl-second mini))))
1341 (t
1342 ;; Default to just finding a frame in the same display.
1343 (setq frame (desktop--find-frame nil display))))
1344 ;; If found, remove from the list.
1345 (when frame
1346 (setq desktop--reuse-list (delq frame desktop--reuse-list)))
1347 frame)
1348 nil))
1349
1350(defun desktop--make-frame (frame-cfg window-cfg)
1351 "Set up a frame according to its saved state.
1352That means either creating a new frame or reusing an existing one.
1353FRAME-CFG is the parameter list of the new frame; WINDOW-CFG is
1354its window state. Internal use only."
1355 (let* ((fullscreen (cdr (assq 'fullscreen frame-cfg)))
1356 (lines (assq 'tool-bar-lines frame-cfg))
1357 (filtered-cfg (desktop--filter-frame-parms frame-cfg nil))
1358 (display (cdr (assq 'display filtered-cfg))) ;; post-filtering
1359 alt-cfg frame)
1360
1361 ;; This works around bug#14795 (or feature#14795, if not a bug :-)
1362 (setq filtered-cfg (assq-delete-all 'tool-bar-lines filtered-cfg))
1363 (push '(tool-bar-lines . 0) filtered-cfg)
1364
1365 (when fullscreen
1366 ;; Currently Emacs has the limitation that it does not record the size
1367 ;; and position of a frame before maximizing it, so we cannot save &
1368 ;; restore that info. Instead, when restoring, we resort to creating
1369 ;; invisible "fullscreen" frames of default size and then maximizing them
1370 ;; (and making them visible) which at least is somewhat user-friendly
1371 ;; when these frames are later de-maximized.
1372 (let ((width (and (eq fullscreen 'fullheight) (cdr (assq 'width filtered-cfg))))
1373 (height (and (eq fullscreen 'fullwidth) (cdr (assq 'height filtered-cfg))))
1374 (visible (assq 'visibility filtered-cfg)))
1375 (setq filtered-cfg (cl-delete-if (lambda (p)
1376 (memq p '(visibility fullscreen width height)))
1377 filtered-cfg :key #'car))
1378 (when width
1379 (setq filtered-cfg (append `((user-size . t) (width . ,width))
1380 filtered-cfg)))
1381 (when height
1382 (setq filtered-cfg (append `((user-size . t) (height . ,height))
1383 filtered-cfg)))
1384 ;; These are parameters to apply after creating/setting the frame.
1385 (push visible alt-cfg)
1386 (push (cons 'fullscreen fullscreen) alt-cfg)))
1387
1388 ;; Time to find or create a frame an apply the big bunch of parameters.
1389 ;; If a frame needs to be created and it falls partially or wholly offscreen,
1390 ;; sometimes it gets "pushed back" onscreen; however, moving it afterwards is
1391 ;; allowed. So we create the frame as invisible and then reapply the full
1392 ;; parameter list (including position and size parameters).
1393 (setq frame (or (desktop--select-frame display filtered-cfg)
1394 (make-frame-on-display display
1395 (cons '(visibility)
1396 (cl-loop
1397 for param in '(left top width height minibuffer)
1398 collect (assq param filtered-cfg))))))
1399 (modify-frame-parameters frame
1400 (if (eq (frame-parameter frame 'fullscreen) fullscreen)
1401 ;; Workaround for bug#14949
1402 (assq-delete-all 'fullscreen filtered-cfg)
1403 filtered-cfg))
1404
1405 ;; If requested, force frames to be onscreen.
1406 (when (and desktop-restore-forces-onscreen
1407 ;; FIXME: iconified frames should be checked too,
1408 ;; but it is impossible without deiconifying them.
1409 (not (eq (frame-parameter frame 'visibility) 'icon)))
1410 (desktop--move-onscreen frame))
1411
1412 ;; Let's give the finishing touches (visibility, tool-bar, maximization).
1413 (when lines (push lines alt-cfg))
1414 (when alt-cfg (modify-frame-parameters frame alt-cfg))
1415 ;; Now restore window state.
1416 (window-state-put window-cfg (frame-root-window frame) 'safe)
1417 frame))
1418
1419(defun desktop--sort-states (state1 state2)
1420 ;; Order: default minibuffer frame
1421 ;; other frames with minibuffer, ascending ID
1422 ;; minibufferless frames, ascending ID
1423 (pcase-let ((`(,_p1 ,hasmini1 ,num1 ,default1) (assq 'desktop--mini (car state1)))
1424 (`(,_p2 ,hasmini2 ,num2 ,default2) (assq 'desktop--mini (car state2))))
1425 (cond (default1 t)
1426 (default2 nil)
1427 ((eq hasmini1 hasmini2) (< num1 num2))
1428 (t hasmini1))))
1429
1430(defun desktop-restoring-frames-p ()
1431 "True if calling `desktop-restore-frames' will actually restore frames."
1432 (and desktop-restore-frames desktop-saved-frame-states t))
1433
1434(defun desktop-restore-frames ()
1435 "Restore window/frame configuration.
1436This function depends on the value of `desktop-saved-frame-states'
1437being set (usually, by reading it from the desktop)." 1049being set (usually, by reading it from the desktop)."
1438 (when (desktop-restoring-frames-p) 1050 (when (desktop-restoring-frameset-p)
1439 (let* ((frame-mb-map nil) ;; Alist of frames with their own minibuffer 1051 (frameset-restore desktop-saved-frameset
1440 (delete-saved (eq desktop-restore-in-current-display 'delete)) 1052 :filters desktop-filter-parameters-alist
1441 (forcing (not (desktop-restore-in-original-display-p))) 1053 :reuse-frames desktop-restore-reuses-frames
1442 (target (and forcing (cons 'display (frame-parameter nil 'display))))) 1054 :force-display desktop-restore-in-current-display
1443 1055 :force-onscreen desktop-restore-forces-onscreen)))
1444 ;; Sorting saved states allows us to easily restore minibuffer-owning frames 1056
1445 ;; before minibufferless ones. 1057;; Just to silence the byte compiler.
1446 (setq desktop-saved-frame-states (sort desktop-saved-frame-states 1058;; Dynamicaly bound in `desktop-read'.
1447 #'desktop--sort-states)) 1059(defvar desktop-first-buffer)
1448 ;; Potentially all existing frames are reusable. Later we will decide which ones 1060(defvar desktop-buffer-ok-count)
1449 ;; to reuse, and how to deal with any leftover. 1061(defvar desktop-buffer-fail-count)
1450 (setq desktop--reuse-list (frame-list))
1451
1452 (dolist (state desktop-saved-frame-states)
1453 (condition-case err
1454 (pcase-let* ((`(,frame-cfg . ,window-cfg) state)
1455 ((and d-mini `(,hasmini ,num ,default))
1456 (cdr (assq 'desktop--mini frame-cfg)))
1457 (frame nil) (to-tty nil))
1458 ;; Only set target if forcing displays and the target display is different.
1459 (if (or (not forcing)
1460 (equal target (or (assq 'display frame-cfg) '(display . nil))))
1461 (setq desktop--target-display nil)
1462 (setq desktop--target-display target
1463 to-tty (null (cdr target))))
1464 ;; Time to restore frames and set up their minibuffers as they were.
1465 ;; We only skip a frame (thus deleting it) if either:
1466 ;; - we're switching displays, and the user chose the option to delete, or
1467 ;; - we're switching to tty, and the frame to restore is minibuffer-only.
1468 (unless (and desktop--target-display
1469 (or delete-saved
1470 (and to-tty
1471 (eq (cdr (assq 'minibuffer frame-cfg)) 'only))))
1472
1473 ;; Restore minibuffers. Some of this stuff could be done in a filter
1474 ;; function, but it would be messy because restoring minibuffers affects
1475 ;; global state; it's best to do it here than add a bunch of global
1476 ;; variables to pass info back-and-forth to/from the filter function.
1477 (cond
1478 ((null d-mini)) ;; No desktop--mini. Process as normal frame.
1479 (to-tty) ;; Ignore minibuffer stuff and process as normal frame.
1480 (hasmini ;; Frame has minibuffer (or it is minibuffer-only).
1481 (when (eq (cdr (assq 'minibuffer frame-cfg)) 'only)
1482 (setq frame-cfg (append '((tool-bar-lines . 0) (menu-bar-lines . 0))
1483 frame-cfg))))
1484 (t ;; Frame depends on other frame's minibuffer window.
1485 (let ((mb-frame (cdr (assq num frame-mb-map))))
1486 (unless (frame-live-p mb-frame)
1487 (error "Minibuffer frame %s not found" num))
1488 (let ((mb-param (assq 'minibuffer frame-cfg))
1489 (mb-window (minibuffer-window mb-frame)))
1490 (unless (and (window-live-p mb-window)
1491 (window-minibuffer-p mb-window))
1492 (error "Not a minibuffer window %s" mb-window))
1493 (if mb-param
1494 (setcdr mb-param mb-window)
1495 (push (cons 'minibuffer mb-window) frame-cfg))))))
1496 ;; OK, we're ready at last to create (or reuse) a frame and
1497 ;; restore the window config.
1498 (setq frame (desktop--make-frame frame-cfg window-cfg))
1499 ;; Set default-minibuffer if required.
1500 (when default (setq default-minibuffer-frame frame))
1501 ;; Store NUM/frame to assign to minibufferless frames.
1502 (when hasmini (push (cons num frame) frame-mb-map))))
1503 (error
1504 (delay-warning 'desktop (error-message-string err) :error))))
1505
1506 ;; In case we try to delete the initial frame, we want to make sure that
1507 ;; other frames are already visible (discussed in thread for bug#14841).
1508 (sit-for 0 t)
1509
1510 ;; Delete remaining frames, but do not fail if some resist being deleted.
1511 (unless (eq desktop-restoring-reuses-frames 'keep)
1512 (dolist (frame desktop--reuse-list)
1513 (condition-case err
1514 (delete-frame frame)
1515 (error
1516 (delay-warning 'desktop (error-message-string err))))))
1517 (setq desktop--reuse-list nil)
1518 ;; Make sure there's at least one visible frame, and select it.
1519 (unless (or (daemonp)
1520 (cl-find-if #'frame-visible-p (frame-list)))
1521 (let ((visible (if (frame-live-p default-minibuffer-frame)
1522 default-minibuffer-frame
1523 (car (frame-list)))))
1524 (make-frame-visible visible)
1525 (select-frame-set-input-focus visible))))))
1526 1062
1527;;;###autoload 1063;;;###autoload
1528(defun desktop-read (&optional dirname) 1064(defun desktop-read (&optional dirname)
@@ -1583,7 +1119,7 @@ Using it may cause conflicts. Use it anyway? " owner)))))
1583 (file-error (message "Couldn't record use of desktop file") 1119 (file-error (message "Couldn't record use of desktop file")
1584 (sit-for 1)))) 1120 (sit-for 1))))
1585 1121
1586 (unless (desktop-restoring-frames-p) 1122 (unless (desktop-restoring-frameset-p)
1587 ;; `desktop-create-buffer' puts buffers at end of the buffer list. 1123 ;; `desktop-create-buffer' puts buffers at end of the buffer list.
1588 ;; We want buffers existing prior to evaluating the desktop (and 1124 ;; We want buffers existing prior to evaluating the desktop (and
1589 ;; not reused) to be placed at the end of the buffer list, so we 1125 ;; not reused) to be placed at the end of the buffer list, so we
@@ -1593,9 +1129,14 @@ Using it may cause conflicts. Use it anyway? " owner)))))
1593 (switch-to-buffer (car (buffer-list)))) 1129 (switch-to-buffer (car (buffer-list))))
1594 (run-hooks 'desktop-delay-hook) 1130 (run-hooks 'desktop-delay-hook)
1595 (setq desktop-delay-hook nil) 1131 (setq desktop-delay-hook nil)
1596 (desktop-restore-frames) 1132 (desktop-restore-frameset)
1597 (run-hooks 'desktop-after-read-hook) 1133 (run-hooks 'desktop-after-read-hook)
1598 (message "Desktop: %d buffer%s restored%s%s." 1134 (message "Desktop: %s%d buffer%s restored%s%s."
1135 (if desktop-saved-frameset
1136 (let ((fn (length (frameset-states desktop-saved-frameset))))
1137 (format "%d frame%s, "
1138 fn (if (= fn 1) "" "s")))
1139 "")
1599 desktop-buffer-ok-count 1140 desktop-buffer-ok-count
1600 (if (= 1 desktop-buffer-ok-count) "" "s") 1141 (if (= 1 desktop-buffer-ok-count) "" "s")
1601 (if (< 0 desktop-buffer-fail-count) 1142 (if (< 0 desktop-buffer-fail-count)
@@ -1605,7 +1146,7 @@ Using it may cause conflicts. Use it anyway? " owner)))))
1605 (format ", %d to restore lazily" 1146 (format ", %d to restore lazily"
1606 (length desktop-buffer-args-list)) 1147 (length desktop-buffer-args-list))
1607 "")) 1148 ""))
1608 (unless (desktop-restoring-frames-p) 1149 (unless (desktop-restoring-frameset-p)
1609 ;; Bury the *Messages* buffer to not reshow it when burying 1150 ;; Bury the *Messages* buffer to not reshow it when burying
1610 ;; the buffer we switched to above. 1151 ;; the buffer we switched to above.
1611 (when (buffer-live-p (get-buffer "*Messages*")) 1152 (when (buffer-live-p (get-buffer "*Messages*"))
@@ -1618,6 +1159,7 @@ Using it may cause conflicts. Use it anyway? " owner)))))
1618 (walk-window-tree (lambda (window) 1159 (walk-window-tree (lambda (window)
1619 (set-window-prev-buffers window nil) 1160 (set-window-prev-buffers window nil)
1620 (set-window-next-buffers window nil)))) 1161 (set-window-next-buffers window nil))))
1162 (setq desktop-saved-frameset nil)
1621 t)) 1163 t))
1622 ;; No desktop file found. 1164 ;; No desktop file found.
1623 (desktop-clear) 1165 (desktop-clear)
@@ -1743,14 +1285,6 @@ integer, start a new timer to call `desktop-auto-save' in that many seconds."
1743;; Create a buffer, load its file, set its mode, ...; 1285;; Create a buffer, load its file, set its mode, ...;
1744;; called from Desktop file only. 1286;; called from Desktop file only.
1745 1287
1746;; Just to silence the byte compiler.
1747
1748(defvar desktop-first-buffer) ; Dynamically bound in `desktop-read'
1749
1750;; Bound locally in `desktop-read'.
1751(defvar desktop-buffer-ok-count)
1752(defvar desktop-buffer-fail-count)
1753
1754(defun desktop-create-buffer 1288(defun desktop-create-buffer
1755 (file-version 1289 (file-version
1756 buffer-filename 1290 buffer-filename
diff --git a/lisp/emacs-lisp/advice.el b/lisp/emacs-lisp/advice.el
index 3d03e894534..eb1d63e788b 100644
--- a/lisp/emacs-lisp/advice.el
+++ b/lisp/emacs-lisp/advice.el
@@ -2280,7 +2280,6 @@ For that it has to be fbound with a non-autoload definition."
2280(defun ad-compile-function (function) 2280(defun ad-compile-function (function)
2281 "Byte-compile the assembled advice function." 2281 "Byte-compile the assembled advice function."
2282 (require 'bytecomp) 2282 (require 'bytecomp)
2283 (require 'warnings) ;To define warning-suppress-types before we let-bind it.
2284 (let ((byte-compile-warnings byte-compile-warnings) 2283 (let ((byte-compile-warnings byte-compile-warnings)
2285 ;; Don't pop up windows showing byte-compiler warnings. 2284 ;; Don't pop up windows showing byte-compiler warnings.
2286 (warning-suppress-types '((bytecomp)))) 2285 (warning-suppress-types '((bytecomp))))
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index ed10080cc35..f8fb65be4d3 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -419,7 +419,7 @@ See `%s' for more information on %s."
419 ;; Go through existing buffers. 419 ;; Go through existing buffers.
420 (dolist (buf (buffer-list)) 420 (dolist (buf (buffer-list))
421 (with-current-buffer buf 421 (with-current-buffer buf
422 (if ,global-mode (,turn-on) (when ,mode (,mode -1)))))) 422 (if ,global-mode (funcall #',turn-on) (when ,mode (,mode -1))))))
423 423
424 ;; Autoloading define-globalized-minor-mode autoloads everything 424 ;; Autoloading define-globalized-minor-mode autoloads everything
425 ;; up-to-here. 425 ;; up-to-here.
@@ -449,8 +449,8 @@ See `%s' for more information on %s."
449 (if ,mode 449 (if ,mode
450 (progn 450 (progn
451 (,mode -1) 451 (,mode -1)
452 (,turn-on)) 452 (funcall #',turn-on))
453 (,turn-on)))) 453 (funcall #',turn-on))))
454 (setq ,MODE-major-mode major-mode))))) 454 (setq ,MODE-major-mode major-mode)))))
455 (put ',MODE-enable-in-buffers 'definition-name ',global-mode) 455 (put ',MODE-enable-in-buffers 'definition-name ',global-mode)
456 456
@@ -589,7 +589,7 @@ BODY is executed after moving to the destination location."
589 (prog1 (or (< (- (point-max) (point-min)) (buffer-size))) 589 (prog1 (or (< (- (point-max) (point-min)) (buffer-size)))
590 (widen)))) 590 (widen))))
591 ,body 591 ,body
592 (when was-narrowed (,narrowfun))))))) 592 (when was-narrowed (funcall #',narrowfun)))))))
593 (unless name (setq name base-name)) 593 (unless name (setq name base-name))
594 `(progn 594 `(progn
595 (defun ,next-sym (&optional count) 595 (defun ,next-sym (&optional count)
@@ -601,13 +601,13 @@ BODY is executed after moving to the destination location."
601 ,(funcall when-narrowed 601 ,(funcall when-narrowed
602 `(if (not (re-search-forward ,re nil t count)) 602 `(if (not (re-search-forward ,re nil t count))
603 (if (looking-at ,re) 603 (if (looking-at ,re)
604 (goto-char (or ,(if endfun `(,endfun)) (point-max))) 604 (goto-char (or ,(if endfun `(funcall #',endfun)) (point-max)))
605 (user-error "No next %s" ,name)) 605 (user-error "No next %s" ,name))
606 (goto-char (match-beginning 0)) 606 (goto-char (match-beginning 0))
607 (when (and (eq (current-buffer) (window-buffer (selected-window))) 607 (when (and (eq (current-buffer) (window-buffer (selected-window)))
608 (called-interactively-p 'interactive)) 608 (called-interactively-p 'interactive))
609 (let ((endpt (or (save-excursion 609 (let ((endpt (or (save-excursion
610 ,(if endfun `(,endfun) 610 ,(if endfun `(funcall #',endfun)
611 `(re-search-forward ,re nil t 2))) 611 `(re-search-forward ,re nil t 2)))
612 (point-max)))) 612 (point-max))))
613 (unless (pos-visible-in-window-p endpt nil t) 613 (unless (pos-visible-in-window-p endpt nil t)
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index af30deca4cc..3cbd6d4a585 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -110,7 +110,9 @@ It has `lisp-mode-abbrev-table' as its parent."
110 "define-compiler-macro" "define-modify-macro" 110 "define-compiler-macro" "define-modify-macro"
111 "defsetf" "define-setf-expander" 111 "defsetf" "define-setf-expander"
112 "define-method-combination" 112 "define-method-combination"
113 "defgeneric" "defmethod") t)) 113 "defgeneric" "defmethod"
114 "cl-defun" "cl-defsubst" "cl-defmacro"
115 "cl-define-compiler-macro") t))
114 "\\s-+\\(\\(\\sw\\|\\s_\\)+\\)")) 116 "\\s-+\\(\\(\\sw\\|\\s_\\)+\\)"))
115 2) 117 2)
116 (list (purecopy "Variables") 118 (list (purecopy "Variables")
@@ -132,7 +134,8 @@ It has `lisp-mode-abbrev-table' as its parent."
132 (regexp-opt 134 (regexp-opt
133 '("defgroup" "deftheme" "deftype" "defstruct" 135 '("defgroup" "deftheme" "deftype" "defstruct"
134 "defclass" "define-condition" "define-widget" 136 "defclass" "define-condition" "define-widget"
135 "defface" "defpackage") t)) 137 "defface" "defpackage" "cl-deftype"
138 "cl-defstruct") t))
136 "\\s-+'?\\(\\(\\sw\\|\\s_\\)+\\)")) 139 "\\s-+'?\\(\\(\\sw\\|\\s_\\)+\\)"))
137 2)) 140 2))
138 141
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 68d2880d33e..add73fd4bde 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -296,7 +296,7 @@ contrast, `package-user-dir' contains packages for personal use."
296 (:constructor 296 (:constructor
297 package-desc-from-define 297 package-desc-from-define
298 (name-string version-string &optional summary requirements 298 (name-string version-string &optional summary requirements
299 &key kind archive 299 &key kind archive &allow-other-keys
300 &aux 300 &aux
301 (name (intern name-string)) 301 (name (intern name-string))
302 (version (version-to-list version-string)) 302 (version (version-to-list version-string))
diff --git a/lisp/emacs-lisp/re-builder.el b/lisp/emacs-lisp/re-builder.el
index 9b73bea065f..d463bfac412 100644
--- a/lisp/emacs-lisp/re-builder.el
+++ b/lisp/emacs-lisp/re-builder.el
@@ -319,7 +319,7 @@ Except for Lisp syntax this is the same as `reb-regexp'.")
319 (eq 'color 319 (eq 'color
320 ;; emacs/xemacs compatibility 320 ;; emacs/xemacs compatibility
321 (if (fboundp 'frame-parameter) 321 (if (fboundp 'frame-parameter)
322 (frame-parameter (selected-frame) 'display-type) 322 (frame-parameter nil 'display-type)
323 (if (fboundp 'frame-property) 323 (if (fboundp 'frame-property)
324 (frame-property (selected-frame) 'display-type))))) 324 (frame-property (selected-frame) 'display-type)))))
325 325
diff --git a/lisp/files.el b/lisp/files.el
index 10d66e0b2e0..526c535450b 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1,4 +1,4 @@
1;;; files.el --- file input and output commands for Emacs 1;;; files.el --- file input and output commands for Emacs -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 1985-1987, 1992-2013 Free Software Foundation, Inc. 3;; Copyright (C) 1985-1987, 1992-2013 Free Software Foundation, Inc.
4 4
@@ -3645,20 +3645,19 @@ is found. Returns the new class name."
3645 (with-temp-buffer 3645 (with-temp-buffer
3646 ;; This is with-demoted-errors, but we want to mention dir-locals 3646 ;; This is with-demoted-errors, but we want to mention dir-locals
3647 ;; in any error message. 3647 ;; in any error message.
3648 (let (err) 3648 (condition-case err
3649 (condition-case err 3649 (progn
3650 (progn 3650 (insert-file-contents file)
3651 (insert-file-contents file) 3651 (unless (zerop (buffer-size))
3652 (unless (zerop (buffer-size)) 3652 (let* ((dir-name (file-name-directory file))
3653 (let* ((dir-name (file-name-directory file)) 3653 (class-name (intern dir-name))
3654 (class-name (intern dir-name)) 3654 (variables (let ((read-circle nil))
3655 (variables (let ((read-circle nil)) 3655 (read (current-buffer)))))
3656 (read (current-buffer))))) 3656 (dir-locals-set-class-variables class-name variables)
3657 (dir-locals-set-class-variables class-name variables) 3657 (dir-locals-set-directory-class dir-name class-name
3658 (dir-locals-set-directory-class dir-name class-name 3658 (nth 5 (file-attributes file)))
3659 (nth 5 (file-attributes file))) 3659 class-name)))
3660 class-name))) 3660 (error (message "Error reading dir-locals: %S" err) nil))))
3661 (error (message "Error reading dir-locals: %S" err) nil)))))
3662 3661
3663(defcustom enable-remote-dir-locals nil 3662(defcustom enable-remote-dir-locals nil
3664 "Non-nil means dir-local variables will be applied to remote files." 3663 "Non-nil means dir-local variables will be applied to remote files."
@@ -3666,6 +3665,8 @@ is found. Returns the new class name."
3666 :type 'boolean 3665 :type 'boolean
3667 :group 'find-file) 3666 :group 'find-file)
3668 3667
3668(defvar hack-dir-local-variables--warned-coding nil)
3669
3669(defun hack-dir-local-variables () 3670(defun hack-dir-local-variables ()
3670 "Read per-directory local variables for the current buffer. 3671 "Read per-directory local variables for the current buffer.
3671Store the directory-local variables in `dir-local-variables-alist' 3672Store the directory-local variables in `dir-local-variables-alist'
@@ -3697,8 +3698,10 @@ This does nothing if either `enable-local-variables' or
3697 (when variables 3698 (when variables
3698 (dolist (elt variables) 3699 (dolist (elt variables)
3699 (if (eq (car elt) 'coding) 3700 (if (eq (car elt) 'coding)
3700 (display-warning :warning 3701 (unless hack-dir-local-variables--warned-coding
3701 "Coding cannot be specified by dir-locals") 3702 (setq hack-dir-local-variables--warned-coding t)
3703 (display-warning :warning
3704 "Coding cannot be specified by dir-locals"))
3702 (unless (memq (car elt) '(eval mode)) 3705 (unless (memq (car elt) '(eval mode))
3703 (setq dir-local-variables-alist 3706 (setq dir-local-variables-alist
3704 (assq-delete-all (car elt) dir-local-variables-alist))) 3707 (assq-delete-all (car elt) dir-local-variables-alist)))
@@ -4145,9 +4148,9 @@ FILENAME defaults to `buffer-file-name'."
4145 (file-name-sans-extension 4148 (file-name-sans-extension
4146 (file-name-nondirectory (or filename (buffer-file-name))))) 4149 (file-name-nondirectory (or filename (buffer-file-name)))))
4147 4150
4148(defcustom make-backup-file-name-function nil 4151(defcustom make-backup-file-name-function
4152 #'make-backup-file-name--default-function
4149 "A function to use instead of the default `make-backup-file-name'. 4153 "A function to use instead of the default `make-backup-file-name'.
4150A value of nil gives the default `make-backup-file-name' behavior.
4151 4154
4152This could be buffer-local to do something special for specific 4155This could be buffer-local to do something special for specific
4153files. If you define it, you may need to change `backup-file-name-p' 4156files. If you define it, you may need to change `backup-file-name-p'
@@ -4155,8 +4158,7 @@ and `file-name-sans-versions' too.
4155 4158
4156See also `backup-directory-alist'." 4159See also `backup-directory-alist'."
4157 :group 'backup 4160 :group 'backup
4158 :type '(choice (const :tag "Default" nil) 4161 :type '(function :tag "Your function"))
4159 (function :tag "Your function")))
4160 4162
4161(defcustom backup-directory-alist nil 4163(defcustom backup-directory-alist nil
4162 "Alist of filename patterns and backup directory names. 4164 "Alist of filename patterns and backup directory names.
@@ -4216,24 +4218,26 @@ Checks for files in `temporary-file-directory',
4216Normally this will just be the file's name with `~' appended. 4218Normally this will just be the file's name with `~' appended.
4217Customization hooks are provided as follows. 4219Customization hooks are provided as follows.
4218 4220
4219If the variable `make-backup-file-name-function' is non-nil, its value 4221The value of `make-backup-file-name-function' should be a function which
4220should be a function which will be called with FILE as its argument; 4222will be called with FILE as its argument; the resulting name is used.
4221the resulting name is used.
4222 4223
4223Otherwise a match for FILE is sought in `backup-directory-alist'; see 4224By default, a match for FILE is sought in `backup-directory-alist'; see
4224the documentation of that variable. If the directory for the backup 4225the documentation of that variable. If the directory for the backup
4225doesn't exist, it is created." 4226doesn't exist, it is created."
4226 (if make-backup-file-name-function 4227 (funcall (or make-backup-file-name-function
4227 (funcall make-backup-file-name-function file) 4228 #'make-backup-file-name--default-function)
4228 (if (and (eq system-type 'ms-dos) 4229 file))
4229 (not (msdos-long-file-names))) 4230
4230 (let ((fn (file-name-nondirectory file))) 4231(defun make-backup-file-name--default-function (file)
4231 (concat (file-name-directory file) 4232 (if (and (eq system-type 'ms-dos)
4232 (or (and (string-match "\\`[^.]+\\'" fn) 4233 (not (msdos-long-file-names)))
4233 (concat (match-string 0 fn) ".~")) 4234 (let ((fn (file-name-nondirectory file)))
4234 (and (string-match "\\`[^.]+\\.\\(..?\\)?" fn) 4235 (concat (file-name-directory file)
4235 (concat (match-string 0 fn) "~"))))) 4236 (or (and (string-match "\\`[^.]+\\'" fn)
4236 (concat (make-backup-file-name-1 file) "~")))) 4237 (concat (match-string 0 fn) ".~"))
4238 (and (string-match "\\`[^.]+\\.\\(..?\\)?" fn)
4239 (concat (match-string 0 fn) "~")))))
4240 (concat (make-backup-file-name-1 file) "~")))
4237 4241
4238(defun make-backup-file-name-1 (file) 4242(defun make-backup-file-name-1 (file)
4239 "Subroutine of `make-backup-file-name' and `find-backup-file-name'." 4243 "Subroutine of `make-backup-file-name' and `find-backup-file-name'."
@@ -5254,14 +5258,20 @@ It also has access to the `preserve-modes' argument of `revert-buffer'
5254via the `revert-buffer-preserve-modes' dynamic variable.") 5258via the `revert-buffer-preserve-modes' dynamic variable.")
5255 5259
5256(put 'revert-buffer-insert-file-contents-function 'permanent-local t) 5260(put 'revert-buffer-insert-file-contents-function 'permanent-local t)
5257(defvar revert-buffer-insert-file-contents-function nil 5261(defvar revert-buffer-insert-file-contents-function
5262 #'revert-buffer-insert-file-contents--default-function
5258 "Function to use to insert contents when reverting this buffer. 5263 "Function to use to insert contents when reverting this buffer.
5259Gets two args, first the nominal file name to use, 5264Gets two args, first the nominal file name to use,
5260and second, t if reading the auto-save file. 5265and second, t if reading the auto-save file.
5261 5266
5262The function you specify is responsible for updating (or preserving) point.") 5267The function you specify is responsible for updating (or preserving) point.")
5263 5268
5264(defvar buffer-stale-function nil 5269(defun buffer-stale--default-function (&optional _noconfirm)
5270 (and buffer-file-name
5271 (file-readable-p buffer-file-name)
5272 (not (verify-visited-file-modtime (current-buffer)))))
5273
5274(defvar buffer-stale-function #'buffer-stale--default-function
5265 "Function to check whether a non-file buffer needs reverting. 5275 "Function to check whether a non-file buffer needs reverting.
5266This should be a function with one optional argument NOCONFIRM. 5276This should be a function with one optional argument NOCONFIRM.
5267Auto Revert Mode passes t for NOCONFIRM. The function should return 5277Auto Revert Mode passes t for NOCONFIRM. The function should return
@@ -5382,62 +5392,11 @@ non-nil, it is called instead of rereading visited file contents."
5382 (local-hook (when (local-variable-p 'after-revert-hook) 5392 (local-hook (when (local-variable-p 'after-revert-hook)
5383 after-revert-hook)) 5393 after-revert-hook))
5384 (inhibit-read-only t)) 5394 (inhibit-read-only t))
5385 (cond 5395 ;; FIXME: Throw away undo-log when preserve-modes is nil?
5386 (revert-buffer-insert-file-contents-function 5396 (funcall
5387 (unless (eq buffer-undo-list t) 5397 (or revert-buffer-insert-file-contents-function
5388 ;; Get rid of all undo records for this buffer. 5398 #'revert-buffer-insert-file-contents--default-function)
5389 (setq buffer-undo-list nil)) 5399 file-name auto-save-p)
5390 ;; Don't make undo records for the reversion.
5391 (let ((buffer-undo-list t))
5392 (funcall revert-buffer-insert-file-contents-function
5393 file-name auto-save-p)))
5394 ((not (file-exists-p file-name))
5395 (error (if buffer-file-number
5396 "File %s no longer exists!"
5397 "Cannot revert nonexistent file %s")
5398 file-name))
5399 ((not (file-readable-p file-name))
5400 (error (if buffer-file-number
5401 "File %s no longer readable!"
5402 "Cannot revert unreadable file %s")
5403 file-name))
5404 (t
5405 ;; Bind buffer-file-name to nil
5406 ;; so that we don't try to lock the file.
5407 (let ((buffer-file-name nil))
5408 (or auto-save-p
5409 (unlock-buffer)))
5410 (widen)
5411 (let ((coding-system-for-read
5412 ;; Auto-saved file should be read by Emacs's
5413 ;; internal coding.
5414 (if auto-save-p 'auto-save-coding
5415 (or coding-system-for-read
5416 (and
5417 buffer-file-coding-system-explicit
5418 (car buffer-file-coding-system-explicit))))))
5419 (if (and (not enable-multibyte-characters)
5420 coding-system-for-read
5421 (not (memq (coding-system-base
5422 coding-system-for-read)
5423 '(no-conversion raw-text))))
5424 ;; As a coding system suitable for multibyte
5425 ;; buffer is specified, make the current
5426 ;; buffer multibyte.
5427 (set-buffer-multibyte t))
5428
5429 ;; This force after-insert-file-set-coding
5430 ;; (called from insert-file-contents) to set
5431 ;; buffer-file-coding-system to a proper value.
5432 (kill-local-variable 'buffer-file-coding-system)
5433
5434 ;; Note that this preserves point in an intelligent way.
5435 (if revert-buffer-preserve-modes
5436 (let ((buffer-file-format buffer-file-format))
5437 (insert-file-contents file-name (not auto-save-p)
5438 nil nil t))
5439 (insert-file-contents file-name (not auto-save-p)
5440 nil nil t)))))
5441 ;; Recompute the truename in case changes in symlinks 5400 ;; Recompute the truename in case changes in symlinks
5442 ;; have changed the truename. 5401 ;; have changed the truename.
5443 (setq buffer-file-truename 5402 (setq buffer-file-truename
@@ -5452,6 +5411,56 @@ non-nil, it is called instead of rereading visited file contents."
5452 (run-hooks 'revert-buffer-internal-hook)) 5411 (run-hooks 'revert-buffer-internal-hook))
5453 t))))) 5412 t)))))
5454 5413
5414(defun revert-buffer-insert-file-contents--default-function (file-name auto-save-p)
5415 (cond
5416 ((not (file-exists-p file-name))
5417 (error (if buffer-file-number
5418 "File %s no longer exists!"
5419 "Cannot revert nonexistent file %s")
5420 file-name))
5421 ((not (file-readable-p file-name))
5422 (error (if buffer-file-number
5423 "File %s no longer readable!"
5424 "Cannot revert unreadable file %s")
5425 file-name))
5426 (t
5427 ;; Bind buffer-file-name to nil
5428 ;; so that we don't try to lock the file.
5429 (let ((buffer-file-name nil))
5430 (or auto-save-p
5431 (unlock-buffer)))
5432 (widen)
5433 (let ((coding-system-for-read
5434 ;; Auto-saved file should be read by Emacs's
5435 ;; internal coding.
5436 (if auto-save-p 'auto-save-coding
5437 (or coding-system-for-read
5438 (and
5439 buffer-file-coding-system-explicit
5440 (car buffer-file-coding-system-explicit))))))
5441 (if (and (not enable-multibyte-characters)
5442 coding-system-for-read
5443 (not (memq (coding-system-base
5444 coding-system-for-read)
5445 '(no-conversion raw-text))))
5446 ;; As a coding system suitable for multibyte
5447 ;; buffer is specified, make the current
5448 ;; buffer multibyte.
5449 (set-buffer-multibyte t))
5450
5451 ;; This force after-insert-file-set-coding
5452 ;; (called from insert-file-contents) to set
5453 ;; buffer-file-coding-system to a proper value.
5454 (kill-local-variable 'buffer-file-coding-system)
5455
5456 ;; Note that this preserves point in an intelligent way.
5457 (if revert-buffer-preserve-modes
5458 (let ((buffer-file-format buffer-file-format))
5459 (insert-file-contents file-name (not auto-save-p)
5460 nil nil t))
5461 (insert-file-contents file-name (not auto-save-p)
5462 nil nil t))))))
5463
5455(defun recover-this-file () 5464(defun recover-this-file ()
5456 "Recover the visited file--get contents from its last auto-save file." 5465 "Recover the visited file--get contents from its last auto-save file."
5457 (interactive) 5466 (interactive)
@@ -6204,9 +6213,10 @@ normally equivalent short `-D' option is just passed on to
6204 ;; directory if FILE is a symbolic link. 6213 ;; directory if FILE is a symbolic link.
6205 (unless full-directory-p 6214 (unless full-directory-p
6206 (setq switches 6215 (setq switches
6207 (if (stringp switches) 6216 (cond
6208 (concat switches " -d") 6217 ((stringp switches) (concat switches " -d"))
6209 (add-to-list 'switches "-d" 'append)))) 6218 ((member "-d" switches) switches)
6219 (t (append switches '("-d"))))))
6210 (apply 'call-process 6220 (apply 'call-process
6211 insert-directory-program nil t nil 6221 insert-directory-program nil t nil
6212 (append 6222 (append
@@ -6479,7 +6489,7 @@ With prefix ARG, silently save all file-visiting buffers, then kill.
6479If emacsclient was started with a list of filenames to edit, then 6489If emacsclient was started with a list of filenames to edit, then
6480only these files will be asked to be saved." 6490only these files will be asked to be saved."
6481 (interactive "P") 6491 (interactive "P")
6482 (if (frame-parameter (selected-frame) 'client) 6492 (if (frame-parameter nil 'client)
6483 (server-save-buffers-kill-terminal arg) 6493 (server-save-buffers-kill-terminal arg)
6484 (save-buffers-kill-emacs arg))) 6494 (save-buffers-kill-emacs arg)))
6485 6495
diff --git a/lisp/frameset.el b/lisp/frameset.el
new file mode 100644
index 00000000000..63ee9af23fc
--- /dev/null
+++ b/lisp/frameset.el
@@ -0,0 +1,693 @@
1;;; frameset.el --- save and restore frame and window setup -*- lexical-binding: t -*-
2
3;; Copyright (C) 2013 Free Software Foundation, Inc.
4
5;; Author: Juanma Barranquero <lekktu@gmail.com>
6;; Keywords: convenience
7
8;; This file is part of GNU Emacs.
9
10;; GNU Emacs is free software: you can redistribute it and/or modify
11;; it under the terms of the GNU General Public License as published by
12;; the Free Software Foundation, either version 3 of the License, or
13;; (at your option) any later version.
14
15;; GNU Emacs is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; GNU General Public License for more details.
19
20;; You should have received a copy of the GNU General Public License
21;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
22
23;;; Commentary:
24
25;; This file provides a set of operations to save a frameset (the state
26;; of all or a subset of the existing frames and windows), both
27;; in-session and persistently, and restore it at some point in the
28;; future.
29;;
30;; It should be noted that restoring the frames' windows depends on
31;; the buffers they are displaying, but this package does not provide
32;; any way to save and restore sets of buffers (see desktop.el for
33;; that). So, it's up to the user of frameset.el to make sure that
34;; any relevant buffer is loaded before trying to restore a frameset.
35;; When a window is restored and a buffer is missing, the window will
36;; be deleted unless it is the last one in the frame, in which case
37;; some previous buffer will be shown instead.
38
39;;; Code:
40
41(require 'cl-lib)
42
43
44;; Framesets have two fields:
45;; - properties: a property list to store both frameset-specific and
46;; user-defined serializable data. Currently defined properties
47;; include:
48;; :version ID - Identifies the version of the frameset struct;
49;; this is the only property always present and
50;; must not be modified.
51;; :app APPINFO - Freeform. Can be used by applications and
52;; packages to indicate the intended (but by no
53;; means exclusive) use of the frameset. For
54;; example, currently desktop.el sets :app to
55;; `(desktop . ,desktop-file-version).
56;; :name NAME - The name of the frameset instance; a string.
57;; :desc TEXT - A description for user consumption (to choose
58;; among framesets, etc.); a string.
59;; - states: an alist of items (FRAME-PARAMETERS . WINDOW-STATE) in
60;; no particular order. Each item represents a frame to be
61;; restored.
62
63(cl-defstruct (frameset (:type list) :named
64 (:copier nil)
65 (:predicate nil))
66 properties ;; property list
67 states) ;; list of conses (frame-state . window-state)
68
69(defun copy-frameset (frameset)
70 "Return a copy of FRAMESET.
71This is a deep copy done with `copy-tree'."
72 (copy-tree frameset t))
73
74;;;###autoload
75(defun frameset-p (frameset)
76 "If FRAMESET is a frameset, return its :version.
77Else return nil."
78 (and (eq (car-safe frameset) 'frameset)
79 (plist-get (cl-second frameset) :version)))
80
81;; A setf'able accessor to the frameset's properties
82(defun frameset-prop (frameset prop)
83 "Return the value of the PROP property of FRAMESET.
84
85Properties other than :version can be set with
86
87 (setf (frameset-prop FRAMESET PROP) NEW-VALUE)"
88 (plist-get (frameset-properties frameset) prop))
89
90(gv-define-setter frameset-prop (val fs prop)
91 (macroexp-let2 nil v val
92 `(progn
93 (cl-assert (not (eq ,prop :version)) t ":version can not be set")
94 (setf (frameset-properties ,fs)
95 (plist-put (frameset-properties ,fs) ,prop ,v))
96 ,v)))
97
98
99;; Filtering
100
101(defvar frameset-filter-alist
102 '((background-color . frameset-filter-sanitize-color)
103 (buffer-list . t)
104 (buffer-predicate . t)
105 (buried-buffer-list . t)
106 (font . frameset-filter-save-parm)
107 (foreground-color . frameset-filter-sanitize-color)
108 (fullscreen . frameset-filter-save-parm)
109 (GUI:font . frameset-filter-restore-parm)
110 (GUI:fullscreen . frameset-filter-restore-parm)
111 (GUI:height . frameset-filter-restore-parm)
112 (GUI:width . frameset-filter-restore-parm)
113 (height . frameset-filter-save-parm)
114 (left . frameset-filter-iconified)
115 (minibuffer . frameset-filter-minibuffer)
116 (top . frameset-filter-iconified)
117 (width . frameset-filter-save-parm))
118 "Alist of frame parameters and filtering functions.
119
120Each element is a cons (PARAM . ACTION), where PARAM is a parameter
121name (a symbol identifying a frame parameter), and ACTION can be:
122
123 t The parameter is always removed from the parameter list.
124 :save The parameter is removed when saving the frame.
125 :restore The parameter is removed when restoring the frame.
126 FILTER A filter function.
127
128FILTER can be a symbol FILTER-FUN, or a list (FILTER-FUN ARGS...).
129It will be called with four arguments CURRENT, FILTERED, PARAMETERS
130and SAVING, plus any additional ARGS:
131
132 CURRENT A cons (PARAM . VALUE), where PARAM is the one being
133 filtered and VALUE is its current value.
134 FILTERED The alist of parameters filtered so far.
135 PARAMETERS The complete alist of parameters being filtered,
136 SAVING Non-nil if filtering before saving state, nil otherwise.
137
138The FILTER-FUN function must return:
139 nil CURRENT is removed from the list.
140 t CURRENT is left as is.
141 (PARAM' . VALUE') Replace CURRENT with this.
142
143Frame parameters not on this list are passed intact.")
144
145(defvar frameset--target-display nil
146 ;; Either (minibuffer . VALUE) or nil.
147 ;; This refers to the current frame config being processed inside
148 ;; `frame--restore-frames' and its auxiliary functions (like filtering).
149 ;; If nil, there is no need to change the display.
150 ;; If non-nil, display parameter to use when creating the frame.
151 "Internal use only.")
152
153(defun frameset-switch-to-gui-p (parameters)
154 "True when switching to a graphic display.
155Return t if PARAMETERS describes a text-only terminal and
156the target is a graphic display; otherwise return nil.
157Only meaningful when called from a filtering function in
158`frameset-filter-alist'."
159 (and frameset--target-display ; we're switching
160 (null (cdr (assq 'display parameters))) ; from a tty
161 (cdr frameset--target-display))) ; to a GUI display
162
163(defun frameset-switch-to-tty-p (parameters)
164 "True when switching to a text-only terminal.
165Return t if PARAMETERS describes a graphic display and
166the target is a text-only terminal; otherwise return nil.
167Only meaningful when called from a filtering function in
168`frameset-filter-alist'."
169 (and frameset--target-display ; we're switching
170 (cdr (assq 'display parameters)) ; from a GUI display
171 (null (cdr frameset--target-display)))) ; to a tty
172
173(defun frameset-filter-sanitize-color (current _filtered parameters saving)
174 "When switching to a GUI frame, remove \"unspecified\" colors.
175Useful as a filter function for tty-specific parameters."
176 (or saving
177 (not (frameset-switch-to-gui-p parameters))
178 (not (stringp (cdr current)))
179 (not (string-match-p "^unspecified-[fb]g$" (cdr current)))))
180
181(defun frameset-filter-minibuffer (current _filtered _parameters saving)
182 "When saving, convert (minibuffer . #<window>) parameter to (minibuffer . t)."
183 (or (not saving)
184 (if (windowp (cdr current))
185 '(minibuffer . t)
186 t)))
187
188(defun frameset-filter-save-parm (current _filtered parameters saving
189 &optional prefix)
190 "When switching to a tty frame, save parameter P as PREFIX:P.
191The parameter can be later restored with `frameset-filter-restore-parm'.
192PREFIX defaults to `GUI'."
193 (unless prefix (setq prefix 'GUI))
194 (cond (saving t)
195 ((frameset-switch-to-tty-p parameters)
196 (let ((prefix:p (intern (format "%s:%s" prefix (car current)))))
197 (if (assq prefix:p parameters)
198 nil
199 (cons prefix:p (cdr current)))))
200 ((frameset-switch-to-gui-p parameters)
201 (not (assq (intern (format "%s:%s" prefix (car current))) parameters)))
202 (t t)))
203
204(defun frameset-filter-restore-parm (current filtered parameters saving)
205 "When switching to a GUI frame, restore PREFIX:P parameter as P.
206CURRENT must be of the form (PREFIX:P . value)."
207 (or saving
208 (not (frameset-switch-to-gui-p parameters))
209 (let* ((prefix:p (symbol-name (car current)))
210 (p (intern (substring prefix:p
211 (1+ (string-match-p ":" prefix:p)))))
212 (val (cdr current))
213 (found (assq p filtered)))
214 (if (not found)
215 (cons p val)
216 (setcdr found val)
217 nil))))
218
219(defun frameset-filter-iconified (_current _filtered parameters saving)
220 "Remove CURRENT when saving an iconified frame.
221This is used for positions parameters `left' and `top', which are
222meaningless in an iconified frame, so the frame is restored in a
223default position."
224 (not (and saving (eq (cdr (assq 'visibility parameters)) 'icon))))
225
226(defun frameset-keep-original-display-p (force-display)
227 "True if saved frames' displays should be honored."
228 (cond ((daemonp) t)
229 ((eq system-type 'windows-nt) nil)
230 (t (null force-display))))
231
232(defun frameset-filter-params (parameters filter-alist saving)
233 "Filter parameter list PARAMETERS and return a filtered list.
234FILTER-ALIST is an alist of parameter filters, in the format of
235`frameset-filter-alist' (which see).
236SAVING is non-nil while filtering parameters to save a frameset,
237nil while the filtering is done to restore it."
238 (let ((filtered nil))
239 (dolist (current parameters)
240 (pcase (cdr (assq (car current) filter-alist))
241 (`nil
242 (push current filtered))
243 (`t
244 nil)
245 (:save
246 (unless saving (push current filtered)))
247 (:restore
248 (when saving (push current filtered)))
249 ((or `(,fun . ,args) (and fun (pred fboundp)))
250 (let ((this (apply fun current filtered parameters saving args)))
251 (when this
252 (push (if (eq this t) current this) filtered))))
253 (other
254 (delay-warning 'frameset (format "Unknown filter %S" other) :error))))
255 ;; Set the display parameter after filtering, so that filter functions
256 ;; have access to its original value.
257 (when frameset--target-display
258 (let ((display (assq 'display filtered)))
259 (if display
260 (setcdr display (cdr frameset--target-display))
261 (push frameset--target-display filtered))))
262 filtered))
263
264
265;; Saving framesets
266
267(defun frameset--set-id (frame)
268 "Set FRAME's `frameset-id' if not yet set.
269Internal use only."
270 (unless (frame-parameter frame 'frameset-id)
271 (set-frame-parameter frame
272 'frameset-id
273 (mapconcat (lambda (n) (format "%04X" n))
274 (cl-loop repeat 4 collect (random 65536))
275 "-"))))
276
277(defun frameset--process-minibuffer-frames (frame-list)
278 "Process FRAME-LIST and record minibuffer relationships.
279FRAME-LIST is a list of frames."
280 ;; Record frames with their own minibuffer
281 (dolist (frame (minibuffer-frame-list))
282 (when (memq frame frame-list)
283 (frameset--set-id frame)
284 ;; For minibuffer-owning frames, frameset--mini is a cons
285 ;; (t . DEFAULT?), where DEFAULT? is a boolean indicating whether
286 ;; the frame is the one pointed out by `default-minibuffer-frame'.
287 (set-frame-parameter frame
288 'frameset--mini
289 (cons t (eq frame default-minibuffer-frame)))))
290 ;; Now link minibufferless frames with their minibuffer frames
291 (dolist (frame frame-list)
292 (unless (frame-parameter frame 'frameset--mini)
293 (frameset--set-id frame)
294 (let* ((mb-frame (window-frame (minibuffer-window frame)))
295 (id (and mb-frame (frame-parameter mb-frame 'frameset-id))))
296 (if (null id)
297 (error "Minibuffer frame %S for %S is excluded" mb-frame frame)
298 ;; For minibufferless frames, frameset--mini is a cons
299 ;; (nil . FRAME-ID), where FRAME-ID is the frameset-id of
300 ;; the frame containing its minibuffer window.
301 (set-frame-parameter frame
302 'frameset--mini
303 (cons nil id)))))))
304
305;;;###autoload
306(cl-defun frameset-save (frame-list &key filters predicate properties)
307 "Return the frameset of FRAME-LIST, a list of frames.
308If nil, FRAME-LIST defaults to all live frames.
309FILTERS is an alist of parameter filters; defaults to `frameset-filter-alist'.
310PREDICATE is a predicate function, which must return non-nil for frames that
311should be saved; it defaults to saving all frames from FRAME-LIST.
312PROPERTIES is a user-defined property list to add to the frameset."
313 (let ((frames (cl-delete-if-not #'frame-live-p
314 (cl-delete-if-not (or predicate #'framep)
315 (or (copy-sequence frame-list)
316 (frame-list))))))
317 (frameset--process-minibuffer-frames frames)
318 (make-frameset :properties (append '(:version 1) properties)
319 :states (mapcar
320 (lambda (frame)
321 (cons
322 (frameset-filter-params (frame-parameters frame)
323 (or filters
324 frameset-filter-alist)
325 t)
326 (window-state-get (frame-root-window frame) t)))
327 frames))))
328
329
330;; Restoring framesets
331
332(defvar frameset--reuse-list nil
333 "Internal use only.")
334
335(defun frameset--compute-pos (value left/top right/bottom)
336 (pcase value
337 (`(+ ,val) (+ left/top val))
338 (`(- ,val) (+ right/bottom val))
339 (val val)))
340
341(defun frameset--move-onscreen (frame force-onscreen)
342 "If FRAME is offscreen, move it back onscreen and, if necessary, resize it.
343For the description of FORCE-ONSCREEN, see `frameset-restore'.
344When forced onscreen, frames wider than the monitor's workarea are converted
345to fullwidth, and frames taller than the workarea are converted to fullheight.
346NOTE: This only works for non-iconified frames. Internal use only."
347 (pcase-let* ((`(,left ,top ,width ,height) (cl-cdadr (frame-monitor-attributes frame)))
348 (right (+ left width -1))
349 (bottom (+ top height -1))
350 (fr-left (frameset--compute-pos (frame-parameter frame 'left) left right))
351 (fr-top (frameset--compute-pos (frame-parameter frame 'top) top bottom))
352 (ch-width (frame-char-width frame))
353 (ch-height (frame-char-height frame))
354 (fr-width (max (frame-pixel-width frame) (* ch-width (frame-width frame))))
355 (fr-height (max (frame-pixel-height frame) (* ch-height (frame-height frame))))
356 (fr-right (+ fr-left fr-width -1))
357 (fr-bottom (+ fr-top fr-height -1)))
358 (when (pcase force-onscreen
359 ;; Any corner is outside the screen.
360 (`all (or (< fr-bottom top) (> fr-bottom bottom)
361 (< fr-left left) (> fr-left right)
362 (< fr-right left) (> fr-right right)
363 (< fr-top top) (> fr-top bottom)))
364 ;; Displaced to the left, right, above or below the screen.
365 (`t (or (> fr-left right)
366 (< fr-right left)
367 (> fr-top bottom)
368 (< fr-bottom top)))
369 ;; Fully inside, no need to do anything.
370 (_ nil))
371 (let ((fullwidth (> fr-width width))
372 (fullheight (> fr-height height))
373 (params nil))
374 ;; Position frame horizontally.
375 (cond (fullwidth
376 (push `(left . ,left) params))
377 ((> fr-right right)
378 (push `(left . ,(+ left (- width fr-width))) params))
379 ((< fr-left left)
380 (push `(left . ,left) params)))
381 ;; Position frame vertically.
382 (cond (fullheight
383 (push `(top . ,top) params))
384 ((> fr-bottom bottom)
385 (push `(top . ,(+ top (- height fr-height))) params))
386 ((< fr-top top)
387 (push `(top . ,top) params)))
388 ;; Compute fullscreen state, if required.
389 (when (or fullwidth fullheight)
390 (push (cons 'fullscreen
391 (cond ((not fullwidth) 'fullheight)
392 ((not fullheight) 'fullwidth)
393 (t 'maximized)))
394 params))
395 ;; Finally, move the frame back onscreen.
396 (when params
397 (modify-frame-parameters frame params))))))
398
399(defun frameset--find-frame (predicate display &rest args)
400 "Find a frame in `frameset--reuse-list' satisfying PREDICATE.
401Look through available frames whose display property matches DISPLAY
402and return the first one for which (PREDICATE frame ARGS) returns t.
403If PREDICATE is nil, it is always satisfied. Internal use only."
404 (cl-find-if (lambda (frame)
405 (and (equal (frame-parameter frame 'display) display)
406 (or (null predicate)
407 (apply predicate frame args))))
408 frameset--reuse-list))
409
410(defun frameset--reuse-frame (display frame-cfg)
411 "Look for an existing frame to reuse.
412DISPLAY is the display where the frame will be shown, and FRAME-CFG
413is the parameter list of the frame being restored. Internal use only."
414 (let ((frame nil)
415 mini)
416 ;; There are no fancy heuristics there. We could implement some
417 ;; based on frame size and/or position, etc., but it is not clear
418 ;; that any "gain" (in the sense of reduced flickering, etc.) is
419 ;; worth the added complexity. In fact, the code below mainly
420 ;; tries to work nicely when M-x desktop-read is used after a
421 ;; desktop session has already been loaded. The other main use
422 ;; case, which is the initial desktop-read upon starting Emacs,
423 ;; will usually have only one frame, and should already work.
424 (cond ((null display)
425 ;; When the target is tty, every existing frame is reusable.
426 (setq frame (frameset--find-frame nil display)))
427 ((car (setq mini (cdr (assq 'frameset--mini frame-cfg))))
428 ;; If the frame has its own minibuffer, let's see whether
429 ;; that frame has already been loaded (which can happen after
430 ;; M-x desktop-read).
431 (setq frame (frameset--find-frame
432 (lambda (f id)
433 (string= (frame-parameter f 'frameset-id) id))
434 display (cdr mini)))
435 ;; If it has not been loaded, and it is not a minibuffer-only frame,
436 ;; let's look for an existing non-minibuffer-only frame to reuse.
437 (unless (or frame (eq (cdr (assq 'minibuffer frame-cfg)) 'only))
438 (setq frame (frameset--find-frame
439 (lambda (f)
440 (let ((w (frame-parameter f 'minibuffer)))
441 (and (window-live-p w)
442 (window-minibuffer-p w)
443 (eq (window-frame w) f))))
444 display))))
445 (mini
446 ;; For minibufferless frames, check whether they already exist,
447 ;; and that they are linked to the right minibuffer frame.
448 (setq frame (frameset--find-frame
449 (lambda (f id mini-id)
450 (and (string= (frame-parameter f 'frameset-id) id)
451 (string= (frame-parameter (window-frame (minibuffer-window f))
452 'frameset-id)
453 mini-id)))
454 display (cdr (assq 'frameset-id frame-cfg)) (cdr mini))))
455 (t
456 ;; Default to just finding a frame in the same display.
457 (setq frame (frameset--find-frame nil display))))
458 ;; If found, remove from the list.
459 (when frame
460 (setq frameset--reuse-list (delq frame frameset--reuse-list)))
461 frame))
462
463(defun frameset--get-frame (frame-cfg window-cfg filters force-onscreen)
464 "Set up and return a frame according to its saved state.
465That means either reusing an existing frame or creating one anew.
466FRAME-CFG is the frame's parameter list; WINDOW-CFG is its window state.
467For the meaning of FORCE-ONSCREEN, see `frameset-restore'."
468 (let* ((fullscreen (cdr (assq 'fullscreen frame-cfg)))
469 (lines (assq 'tool-bar-lines frame-cfg))
470 (filtered-cfg (frameset-filter-params frame-cfg filters nil))
471 (display (cdr (assq 'display filtered-cfg))) ;; post-filtering
472 alt-cfg frame)
473
474 ;; This works around bug#14795 (or feature#14795, if not a bug :-)
475 (setq filtered-cfg (assq-delete-all 'tool-bar-lines filtered-cfg))
476 (push '(tool-bar-lines . 0) filtered-cfg)
477
478 (when fullscreen
479 ;; Currently Emacs has the limitation that it does not record the size
480 ;; and position of a frame before maximizing it, so we cannot save &
481 ;; restore that info. Instead, when restoring, we resort to creating
482 ;; invisible "fullscreen" frames of default size and then maximizing them
483 ;; (and making them visible) which at least is somewhat user-friendly
484 ;; when these frames are later de-maximized.
485 (let ((width (and (eq fullscreen 'fullheight) (cdr (assq 'width filtered-cfg))))
486 (height (and (eq fullscreen 'fullwidth) (cdr (assq 'height filtered-cfg))))
487 (visible (assq 'visibility filtered-cfg)))
488 (setq filtered-cfg (cl-delete-if (lambda (p)
489 (memq p '(visibility fullscreen width height)))
490 filtered-cfg :key #'car))
491 (when width
492 (setq filtered-cfg (append `((user-size . t) (width . ,width))
493 filtered-cfg)))
494 (when height
495 (setq filtered-cfg (append `((user-size . t) (height . ,height))
496 filtered-cfg)))
497 ;; These are parameters to apply after creating/setting the frame.
498 (push visible alt-cfg)
499 (push (cons 'fullscreen fullscreen) alt-cfg)))
500
501 ;; Time to find or create a frame an apply the big bunch of parameters.
502 ;; If a frame needs to be created and it falls partially or fully offscreen,
503 ;; sometimes it gets "pushed back" onscreen; however, moving it afterwards is
504 ;; allowed. So we create the frame as invisible and then reapply the full
505 ;; parameter list (including position and size parameters).
506 (setq frame (or (and frameset--reuse-list
507 (frameset--reuse-frame display filtered-cfg))
508 (make-frame-on-display display
509 (cons '(visibility)
510 (cl-loop
511 for param in '(left top width height minibuffer)
512 collect (assq param filtered-cfg))))))
513 (modify-frame-parameters frame
514 (if (eq (frame-parameter frame 'fullscreen) fullscreen)
515 ;; Workaround for bug#14949
516 (assq-delete-all 'fullscreen filtered-cfg)
517 filtered-cfg))
518
519 ;; If requested, force frames to be onscreen.
520 (when (and force-onscreen
521 ;; FIXME: iconified frames should be checked too,
522 ;; but it is impossible without deiconifying them.
523 (not (eq (frame-parameter frame 'visibility) 'icon)))
524 (frameset--move-onscreen frame force-onscreen))
525
526 ;; Let's give the finishing touches (visibility, tool-bar, maximization).
527 (when lines (push lines alt-cfg))
528 (when alt-cfg (modify-frame-parameters frame alt-cfg))
529 ;; Now restore window state.
530 (window-state-put window-cfg (frame-root-window frame) 'safe)
531 frame))
532
533(defun frameset--sort-states (state1 state2)
534 "Predicate to sort frame states in a suitable order to be created.
535It sorts minibuffer-owning frames before minibufferless ones."
536 (pcase-let ((`(,hasmini1 ,id-def1) (assq 'frameset--mini (car state1)))
537 (`(,hasmini2 ,id-def2) (assq 'frameset--mini (car state2))))
538 (cond ((eq id-def1 t) t)
539 ((eq id-def2 t) nil)
540 ((not (eq hasmini1 hasmini2)) (eq hasmini1 t))
541 ((eq hasmini1 nil) (string< id-def1 id-def2))
542 (t t))))
543
544(defun frameset-sort-frames-for-deletion (frame1 _frame2)
545 "Predicate to sort live frames for deletion.
546Minibufferless frames must go first to avoid errors when attempting
547to delete a frame whose minibuffer window is used by another frame."
548 (not (frame-parameter frame1 'minibuffer)))
549
550;;;###autoload
551(cl-defun frameset-restore (frameset &key filters reuse-frames force-display force-onscreen)
552 "Restore a FRAMESET into the current display(s).
553
554FILTERS is an alist of parameter filters; defaults to `frameset-filter-alist'.
555
556REUSE-FRAMES describes how to reuse existing frames while restoring a frameset:
557 t Reuse any existing frame if possible; delete leftover frames.
558 nil Restore frameset in new frames and delete existing frames.
559 keep Restore frameset in new frames and keep the existing ones.
560 LIST A list of frames to reuse; only these will be reused, if possible,
561 and any leftover one will be deleted; other frames not on this
562 list will be kept.
563
564FORCE-DISPLAY can be:
565 t Frames will be restored in the current display.
566 nil Frames will be restored, if possible, in their original displays.
567 delete Frames in other displays will be deleted instead of restored.
568
569FORCE-ONSCREEN can be:
570 all Force onscreen any frame fully or partially offscreen.
571 t Force onscreen only those frames that are fully offscreen.
572 nil Do not force any frame back onscreen.
573
574All keywords default to nil."
575
576 (cl-assert (frameset-p frameset))
577
578 (let* ((delete-saved (eq force-display 'delete))
579 (forcing (not (frameset-keep-original-display-p force-display)))
580 (target (and forcing (cons 'display (frame-parameter nil 'display))))
581 other-frames)
582
583 ;; frameset--reuse-list is a list of frames potentially reusable. Later we
584 ;; will decide which ones can be reused, and how to deal with any leftover.
585 (pcase reuse-frames
586 ((or `nil `keep)
587 (setq frameset--reuse-list nil
588 other-frames (frame-list)))
589 ((pred consp)
590 (setq frameset--reuse-list (copy-sequence reuse-frames)
591 other-frames (cl-delete-if (lambda (frame)
592 (memq frame frameset--reuse-list))
593 (frame-list))))
594 (_
595 (setq frameset--reuse-list (frame-list)
596 other-frames nil)))
597
598 ;; Sort saved states to guarantee that minibufferless frames will be created
599 ;; after the frames that contain their minibuffer windows.
600 (dolist (state (sort (copy-sequence (frameset-states frameset))
601 #'frameset--sort-states))
602 (condition-case-unless-debug err
603 (pcase-let* ((`(,frame-cfg . ,window-cfg) state)
604 ((and d-mini `(,hasmini . ,mb-id))
605 (cdr (assq 'frameset--mini frame-cfg)))
606 (default (and (booleanp mb-id) mb-id))
607 (frame nil) (to-tty nil))
608 ;; Only set target if forcing displays and the target display is different.
609 (if (or (not forcing)
610 (equal target (or (assq 'display frame-cfg) '(display . nil))))
611 (setq frameset--target-display nil)
612 (setq frameset--target-display target
613 to-tty (null (cdr target))))
614 ;; If keeping non-reusable frames, and the frame-id of one of them
615 ;; matches the frame-id of a frame being restored (because, for example,
616 ;; the frameset has already been read in the same session), remove the
617 ;; frame-id from the non-reusable frame, which is not useful anymore.
618 (when (and other-frames
619 (or (eq reuse-frames 'keep) (consp reuse-frames)))
620 (let ((dup (cl-find (cdr (assq 'frameset-frame-id frame-cfg))
621 other-frames
622 :key (lambda (frame)
623 (frame-parameter frame 'frameset-frame-id))
624 :test #'string=)))
625 (when dup
626 (set-frame-parameter dup 'frameset-frame-id nil))))
627 ;; Time to restore frames and set up their minibuffers as they were.
628 ;; We only skip a frame (thus deleting it) if either:
629 ;; - we're switching displays, and the user chose the option to delete, or
630 ;; - we're switching to tty, and the frame to restore is minibuffer-only.
631 (unless (and frameset--target-display
632 (or delete-saved
633 (and to-tty
634 (eq (cdr (assq 'minibuffer frame-cfg)) 'only))))
635
636 ;; Restore minibuffers. Some of this stuff could be done in a filter
637 ;; function, but it would be messy because restoring minibuffers affects
638 ;; global state; it's best to do it here than add a bunch of global
639 ;; variables to pass info back-and-forth to/from the filter function.
640 (cond
641 ((null d-mini)) ;; No frameset--mini. Process as normal frame.
642 (to-tty) ;; Ignore minibuffer stuff and process as normal frame.
643 (hasmini ;; Frame has minibuffer (or it is minibuffer-only).
644 (when (eq (cdr (assq 'minibuffer frame-cfg)) 'only)
645 (setq frame-cfg (append '((tool-bar-lines . 0) (menu-bar-lines . 0))
646 frame-cfg))))
647 (t ;; Frame depends on other frame's minibuffer window.
648 (let* ((mb-frame (or (cl-find-if
649 (lambda (f)
650 (string= (frame-parameter f 'frameset-id)
651 mb-id))
652 (frame-list))
653 (error "Minibuffer frame %S not found" mb-id)))
654 (mb-param (assq 'minibuffer frame-cfg))
655 (mb-window (minibuffer-window mb-frame)))
656 (unless (and (window-live-p mb-window)
657 (window-minibuffer-p mb-window))
658 (error "Not a minibuffer window %s" mb-window))
659 (if mb-param
660 (setcdr mb-param mb-window)
661 (push (cons 'minibuffer mb-window) frame-cfg))))))
662 ;; OK, we're ready at last to create (or reuse) a frame and
663 ;; restore the window config.
664 (setq frame (frameset--get-frame frame-cfg window-cfg
665 (or filters frameset-filter-alist)
666 force-onscreen))
667 ;; Set default-minibuffer if required.
668 (when default (setq default-minibuffer-frame frame)))
669 (error
670 (delay-warning 'frameset (error-message-string err) :error))))
671
672 ;; In case we try to delete the initial frame, we want to make sure that
673 ;; other frames are already visible (discussed in thread for bug#14841).
674 (sit-for 0 t)
675
676 ;; Delete remaining frames, but do not fail if some resist being deleted.
677 (unless (eq reuse-frames 'keep)
678 (dolist (frame (sort (nconc (if (listp reuse-frames) nil other-frames)
679 frameset--reuse-list)
680 #'frameset-sort-frames-for-deletion))
681 (condition-case err
682 (delete-frame frame)
683 (error
684 (delay-warning 'frameset (error-message-string err))))))
685 (setq frameset--reuse-list nil)
686
687 ;; Make sure there's at least one visible frame.
688 (unless (or (daemonp) (visible-frame-list))
689 (make-frame-visible (car (frame-list))))))
690
691(provide 'frameset)
692
693;;; frameset.el ends here
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 4230d010a5d..2164fd96b46 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,5 +1,76 @@
12013-08-02 Lars Magne Ingebrigtsen <larsi@gnus.org>
2
3 * gnus-delay.el (gnus-delay-article): Fix typo.
4
5 * gnus-group.el (gnus-group-delete-articles): Allow deleting only "old"
6 articles.
7
8 * gnus-delay.el (gnus-delay-article): Run `message-send-hook' so that
9 we can get spell-checking etc.
10
112013-08-02 Katsumi Yamaoka <yamaoka@jpl.org>
12
13 * rfc2047.el (rfc2047-encode-message-header): Unify charsets into
14 a single one used for encoding the whole text in a header.
15
162013-08-01 Lars Magne Ingebrigtsen <larsi@gnus.org>
17
18 * message.el (message-ignored-news-headers): Delete X-Gnus-Delayed
19 before sending.
20
21 * mm-decode.el (mm-command-output): New face.
22 (mm-display-external): Use it.
23
242013-08-01 Kan-Ru Chen (陳侃如) <kanru@kanru.info> (tiny change)
25
26 * nnmbox.el (nnmbox-request-article): Don't change point.
27
282013-08-01 Lars Magne Ingebrigtsen <larsi@gnus.org>
29
30 * gnus-icalendar.el (gnus-icalendar-event:inline-reply-buttons):
31 Include `handle' parameter.
32
332013-08-01 Jan Tatarik <jan.tatarik@gmail.com>
34
35 * gnus-icalendar.el: New file.
36
372013-08-01 Lars Magne Ingebrigtsen <larsi@gnus.org>
38
39 * gnus-int.el (gnus-warp-to-article): Mention that warp means jump.
40
41 * gnus-uu.el (gnus-uu-mark-thread, gnus-uu-unmark-thread): Work with
42 dummy roots, too.
43
442013-08-01 David Edmondson <dme@dme.org>
45
46 * mml2015.el (mml2015-epg-key-image-to-string): Protect against bugging
47 out on ttys.
48
492013-08-01 Lars Magne Ingebrigtsen <larsi@gnus.org>
50
51 * gnus-start.el (gnus-dribble-save): Only save the dribble file if it's
52 not empty.
53
54 * nnrss.el (nnrss-discover-feed): Indent.
55
562013-08-01 Katsumi Yamaoka <yamaoka@jpl.org>
57
58 * gnus-util.el (gnus-emacs-completing-read): Isolate XEmacs stuff.
59
602013-07-30 Lars Magne Ingebrigtsen <larsi@gnus.org>
61
62 * gnus-start.el (gnus-read-active-for-groups): Always mark the data as
63 dirty to ensure nnimap data being saved.
64
12013-07-30 Tassilo Horn <tsdh@gnu.org> 652013-07-30 Tassilo Horn <tsdh@gnu.org>
2 66
67 * gnus-sum.el (gnus-summary-make-menu-bar): Add "Current thread score"
68 menu entry.
69
70 * gnus-score.el (gnus-summary-current-score): Use prefix arg to show
71 the current thread's total score instead of the current article's
72 score.
73
3 * gnus-sum.el (gnus-subthread-sort-functions): New defcustom. 74 * gnus-sum.el (gnus-subthread-sort-functions): New defcustom.
4 (gnus-sort-threads-recursively): Delete defcustom. 75 (gnus-sort-threads-recursively): Delete defcustom.
5 (gnus-sort-threads-recursive): Adapt accordingly. 76 (gnus-sort-threads-recursive): Adapt accordingly.
diff --git a/lisp/gnus/gnus-delay.el b/lisp/gnus/gnus-delay.el
index 921d24109c2..2cdafe1565b 100644
--- a/lisp/gnus/gnus-delay.el
+++ b/lisp/gnus/gnus-delay.el
@@ -80,6 +80,8 @@ DELAY is a string, giving the length of the time. Possible values are:
80 (list (read-string 80 (list (read-string
81 "Target date (YYYY-MM-DD), time (hh:mm), 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 ;; Allow spell checking etc.
84 (run-hooks 'message-send-hook)
83 (let (num unit days year month day hour minute deadline) 85 (let (num unit days year month day hour minute deadline)
84 (cond ((string-match 86 (cond ((string-match
85 "\\([0-9][0-9][0-9]?[0-9]?\\)-\\([0-9]+\\)-\\([0-9]+\\)" 87 "\\([0-9][0-9][0-9]?[0-9]?\\)-\\([0-9]+\\)-\\([0-9]+\\)"
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index 8050f5d59d7..9533f5819a4 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -2796,14 +2796,21 @@ server."
2796 (lambda (group) 2796 (lambda (group)
2797 (gnus-group-delete-group group nil t)))))) 2797 (gnus-group-delete-group group nil t))))))
2798 2798
2799(defun gnus-group-delete-articles (group) 2799(defun gnus-group-delete-articles (group &optional oldp)
2800 "Delete all articles in the current group." 2800 "Delete all articles in the current group.
2801 (interactive (list (gnus-group-group-name))) 2801If OLDP (the prefix), only delete articles that are \"old\",
2802according to the expiry settings. Note that this will delete old
2803not-expirable articles, too."
2804 (interactive (list (gnus-group-group-name)
2805 current-prefix-arg))
2802 (let ((articles (gnus-uncompress-range (gnus-active group)))) 2806 (let ((articles (gnus-uncompress-range (gnus-active group))))
2803 (when (gnus-yes-or-no-p 2807 (when (gnus-yes-or-no-p
2804 (format "Do you really want to delete these %d articles forever? " 2808 (format "Do you really want to delete these %d articles forever? "
2805 (length articles))) 2809 (length articles)))
2806 (gnus-request-expire-articles articles group 'force)))) 2810 (gnus-request-expire-articles articles group
2811 (if current-prefix-arg
2812 nil
2813 'force)))))
2807 2814
2808(defun gnus-group-delete-group (group &optional force no-prompt) 2815(defun gnus-group-delete-group (group &optional force no-prompt)
2809 "Delete the current group. Only meaningful with editable groups. 2816 "Delete the current group. Only meaningful with editable groups.
diff --git a/lisp/gnus/gnus-icalendar.el b/lisp/gnus/gnus-icalendar.el
new file mode 100644
index 00000000000..0286fd5dd89
--- /dev/null
+++ b/lisp/gnus/gnus-icalendar.el
@@ -0,0 +1,837 @@
1;;; gnus-icalendar.el --- reply to iCalendar meeting requests
2
3;; Copyright (C) 2013 Free Software Foundation, Inc.
4
5;; Author: Jan Tatarik <Jan.Tatarik@gmail.com>
6;; Keywords: mail, icalendar, org
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;; To install:
24;; (require 'gnus-icalendar)
25;; (gnus-icalendar-setup)
26
27;; to enable optional iCalendar->Org sync functionality
28;; NOTE: both the capture file and the headline(s) inside must already exist
29;; (setq gnus-icalendar-org-capture-file "~/org/notes.org")
30;; (setq gnus-icalendar-org-capture-headline '("Calendar"))
31;; (gnus-icalendar-org-setup)
32
33
34;;; Code:
35
36(require 'icalendar)
37(require 'eieio)
38(require 'mm-decode)
39(require 'gnus-sum)
40
41(eval-when-compile (require 'cl))
42
43(defun gnus-icalendar-find-if (pred seq)
44 (catch 'found
45 (while seq
46 (when (funcall pred (car seq))
47 (throw 'found (car seq)))
48 (pop seq))))
49
50;;;
51;;; ical-event
52;;;
53
54(defclass gnus-icalendar-event ()
55 ((organizer :initarg :organizer
56 :accessor gnus-icalendar-event:organizer
57 :initform ""
58 :type (or null string))
59 (summary :initarg :summary
60 :accessor gnus-icalendar-event:summary
61 :initform ""
62 :type (or null string))
63 (description :initarg :description
64 :accessor gnus-icalendar-event:description
65 :initform ""
66 :type (or null string))
67 (location :initarg :location
68 :accessor gnus-icalendar-event:location
69 :initform ""
70 :type (or null string))
71 (start :initarg :start
72 :accessor gnus-icalendar-event:start
73 :initform ""
74 :type (or null string))
75 (end :initarg :end
76 :accessor gnus-icalendar-event:end
77 :initform ""
78 :type (or null string))
79 (recur :initarg :recur
80 :accessor gnus-icalendar-event:recur
81 :initform ""
82 :type (or null string))
83 (uid :initarg :uid
84 :accessor gnus-icalendar-event:uid
85 :type string)
86 (method :initarg :method
87 :accessor gnus-icalendar-event:method
88 :initform "PUBLISH"
89 :type (or null string))
90 (rsvp :initarg :rsvp
91 :accessor gnus-icalendar-event:rsvp
92 :initform nil
93 :type (or null boolean)))
94 "generic iCalendar Event class")
95
96(defclass gnus-icalendar-event-request (gnus-icalendar-event)
97 nil
98 "iCalendar class for REQUEST events")
99
100(defclass gnus-icalendar-event-cancel (gnus-icalendar-event)
101 nil
102 "iCalendar class for CANCEL events")
103
104(defclass gnus-icalendar-event-reply (gnus-icalendar-event)
105 nil
106 "iCalendar class for REPLY events")
107
108(defmethod gnus-icalendar-event:recurring-p ((event gnus-icalendar-event))
109 "Return t if EVENT is recurring."
110 (not (null (gnus-icalendar-event:recur event))))
111
112(defmethod gnus-icalendar-event:recurring-freq ((event gnus-icalendar-event))
113 "Return recurring frequency of EVENT."
114 (let ((rrule (gnus-icalendar-event:recur event)))
115 (string-match "FREQ=\\([[:alpha:]]+\\)" rrule)
116 (match-string 1 rrule)))
117
118(defmethod gnus-icalendar-event:recurring-interval ((event gnus-icalendar-event))
119 "Return recurring interval of EVENT."
120 (let ((rrule (gnus-icalendar-event:recur event))
121 (default-interval 1))
122
123 (string-match "INTERVAL=\\([[:digit:]]+\\)" rrule)
124 (or (match-string 1 rrule)
125 default-interval)))
126
127(defmethod gnus-icalendar-event:start-time ((event gnus-icalendar-event))
128 "Return time value of the EVENT start date."
129 (date-to-time (gnus-icalendar-event:start event)))
130
131(defmethod gnus-icalendar-event:end-time ((event gnus-icalendar-event))
132 "Return time value of the EVENT end date."
133 (date-to-time (gnus-icalendar-event:end event)))
134
135
136(defun gnus-icalendar-event--decode-datefield (ical field zone-map &optional date-style)
137 (let* ((calendar-date-style (or date-style 'european))
138 (date (icalendar--get-event-property ical field))
139 (date-zone (icalendar--find-time-zone
140 (icalendar--get-event-property-attributes
141 ical field)
142 zone-map))
143 (date-decoded (icalendar--decode-isodatetime date nil date-zone)))
144
145 (concat (icalendar--datetime-to-iso-date date-decoded "-")
146 " "
147 (icalendar--datetime-to-colontime date-decoded))))
148
149(defun gnus-icalendar-event--find-attendee (ical name-or-email)
150 (let* ((event (car (icalendar--all-events ical)))
151 (event-props (caddr event)))
152 (labels ((attendee-name (att) (plist-get (cadr att) 'CN))
153 (attendee-email (att)
154 (replace-regexp-in-string "^.*MAILTO:" "" (caddr att)))
155 (attendee-prop-matches-p (prop)
156 (and (eq (car prop) 'ATTENDEE)
157 (or (member (attendee-name prop) name-or-email)
158 (let ((att-email (attendee-email prop)))
159 (gnus-icalendar-find-if (lambda (email)
160 (string-match email att-email))
161 name-or-email))))))
162
163 (gnus-icalendar-find-if #'attendee-prop-matches-p event-props))))
164
165
166(defun gnus-icalendar-event-from-ical (ical &optional attendee-name-or-email)
167 (let* ((event (car (icalendar--all-events ical)))
168 (zone-map (icalendar--convert-all-timezones ical))
169 (organizer (replace-regexp-in-string
170 "^.*MAILTO:" ""
171 (or (icalendar--get-event-property event 'ORGANIZER) "")))
172 (prop-map '((summary . SUMMARY)
173 (description . DESCRIPTION)
174 (location . LOCATION)
175 (recur . RRULE)
176 (uid . UID)))
177 (method (caddr (assoc 'METHOD (caddr (car (nreverse ical))))))
178 (attendee (when attendee-name-or-email
179 (gnus-icalendar-event--find-attendee ical attendee-name-or-email)))
180 (args (list :method method
181 :organizer organizer
182 :start (gnus-icalendar-event--decode-datefield event 'DTSTART zone-map)
183 :end (gnus-icalendar-event--decode-datefield event 'DTEND zone-map)
184 :rsvp (string= (plist-get (cadr attendee) 'RSVP)
185 "TRUE")))
186 (event-class (pcase method
187 ("REQUEST" 'gnus-icalendar-event-request)
188 ("CANCEL" 'gnus-icalendar-event-cancel)
189 ("REPLY" 'gnus-icalendar-event-reply)
190 (_ 'gnus-icalendar-event))))
191
192 (labels ((map-property (prop)
193 (let ((value (icalendar--get-event-property event prop)))
194 (when value
195 ;; ugly, but cannot get
196 ;;replace-regexp-in-string work with "\\" as
197 ;;REP, plus we should also handle "\\;"
198 (replace-regexp-in-string
199 "\\\\," ","
200 (replace-regexp-in-string
201 "\\\\n" "\n" (substring-no-properties value))))))
202 (accumulate-args (mapping)
203 (destructuring-bind (slot . ical-property) mapping
204 (setq args (append (list
205 (intern (concat ":" (symbol-name slot)))
206 (map-property ical-property))
207 args)))))
208
209 (mapc #'accumulate-args prop-map)
210 (apply 'make-instance event-class args))))
211
212(defun gnus-icalendar-event-from-buffer (buf &optional attendee-name-or-email)
213 "Parse RFC5545 iCalendar in buffer BUF and return an event object.
214
215Return a gnus-icalendar-event object representing the first event
216contained in the invitation. Return nil for calendars without an event entry.
217
218ATTENDEE-NAME-OR-EMAIL is a list of strings that will be matched
219against the event's attendee names and emails. Invitation rsvp
220status will be retrieved from the first matching attendee record."
221 (let ((ical (with-current-buffer (icalendar--get-unfolded-buffer (get-buffer buf))
222 (goto-char (point-min))
223 (icalendar--read-element nil nil))))
224
225 (when ical
226 (gnus-icalendar-event-from-ical ical attendee-name-or-email))))
227
228;;;
229;;; gnus-icalendar-event-reply
230;;;
231
232(defun gnus-icalendar-event--build-reply-event-body (ical-request status identities)
233 (let ((summary-status (capitalize (symbol-name status)))
234 (attendee-status (upcase (symbol-name status)))
235 reply-event-lines)
236 (labels ((update-summary (line)
237 (if (string-match "^[^:]+:" line)
238 (replace-match (format "\\&%s: " summary-status) t nil line)
239 line))
240 (update-dtstamp ()
241 (format-time-string "DTSTAMP:%Y%m%dT%H%M%SZ" nil t))
242 (attendee-matches-identity (line)
243 (gnus-icalendar-find-if (lambda (name) (string-match-p name line))
244 identities))
245 (update-attendee-status (line)
246 (when (and (attendee-matches-identity line)
247 (string-match "\\(PARTSTAT=\\)[^;]+" line))
248 (replace-match (format "\\1%s" attendee-status) t nil line)))
249 (process-event-line (line)
250 (when (string-match "^\\([^;:]+\\)" line)
251 (let* ((key (match-string 0 line))
252 ;; NOTE: not all of the below fields are mandatory,
253 ;; but they are often present in other clients'
254 ;; replies. Can be helpful for debugging, too.
255 (new-line (pcase key
256 ("ATTENDEE" (update-attendee-status line))
257 ("SUMMARY" (update-summary line))
258 ("DTSTAMP" (update-dtstamp))
259 ((or "ORGANIZER" "DTSTART" "DTEND"
260 "LOCATION" "DURATION" "SEQUENCE"
261 "RECURRENCE-ID" "UID") line)
262 (_ nil))))
263 (when new-line
264 (push new-line reply-event-lines))))))
265
266 (mapc #'process-event-line (split-string ical-request "\n"))
267
268 (unless (gnus-icalendar-find-if (lambda (x) (string-match "^ATTENDEE" x))
269 reply-event-lines)
270 (error "Could not find an event attendee matching given identity"))
271
272 (mapconcat #'identity `("BEGIN:VEVENT"
273 ,@(nreverse reply-event-lines)
274 "END:VEVENT")
275 "\n"))))
276
277(defun gnus-icalendar-event-reply-from-buffer (buf status identities)
278 "Build a calendar event reply for request contained in BUF.
279The reply will have STATUS (`accepted', `tentative' or `declined').
280The reply will be composed for attendees matching any entry
281on the IDENTITIES list."
282 (flet ((extract-block (blockname)
283 (save-excursion
284 (let ((block-start-re (format "^BEGIN:%s" blockname))
285 (block-end-re (format "^END:%s" blockname))
286 start)
287 (when (re-search-forward block-start-re nil t)
288 (setq start (line-beginning-position))
289 (re-search-forward block-end-re)
290 (buffer-substring-no-properties start (line-end-position)))))))
291
292 (let (zone event)
293 (with-current-buffer (icalendar--get-unfolded-buffer (get-buffer buf))
294 (goto-char (point-min))
295 (setq zone (extract-block "VTIMEZONE")
296 event (extract-block "VEVENT")))
297
298 (when event
299 (let ((contents (list "BEGIN:VCALENDAR"
300 "METHOD:REPLY"
301 "PRODID:Gnus"
302 "VERSION:2.0"
303 zone
304 (gnus-icalendar-event--build-reply-event-body event status identities)
305 "END:VCALENDAR")))
306
307 (mapconcat #'identity (delq nil contents) "\n"))))))
308
309;;;
310;;; gnus-icalendar-org
311;;;
312;;; TODO: this is an optional feature, and it's only available with org-mode
313;;; 7+, so will need to properly handle emacsen with no/outdated org-mode
314
315(require 'org)
316(require 'org-capture)
317
318(defgroup gnus-icalendar-org nil
319 "Settings for Calendar Event gnus/org integration."
320 :group 'gnus-icalendar
321 :prefix "gnus-icalendar-org-")
322
323(defcustom gnus-icalendar-org-capture-file nil
324 "Target Org file for storing captured calendar events."
325 :type 'file
326 :group 'gnus-icalendar-org)
327
328(defcustom gnus-icalendar-org-capture-headline nil
329 "Target outline in `gnus-icalendar-org-capture-file' for storing captured events."
330 :type '(repeat string)
331 :group 'gnus-icalendar-org)
332
333(defcustom gnus-icalendar-org-template-name "used by gnus-icalendar-org"
334 "Org-mode template name."
335 :type '(string)
336 :group 'gnus-icalendar-org)
337
338(defcustom gnus-icalendar-org-template-key "#"
339 "Org-mode template hotkey."
340 :type '(string)
341 :group 'gnus-icalendar-org)
342
343(defvar gnus-icalendar-org-enabled-p nil)
344
345
346(defmethod gnus-icalendar-event:org-repeat ((event gnus-icalendar-event))
347 "Return `org-mode' timestamp repeater string for recurring EVENT.
348Return nil for non-recurring EVENT."
349 (when (gnus-icalendar-event:recurring-p event)
350 (let* ((freq-map '(("HOURLY" . "h")
351 ("DAILY" . "d")
352 ("WEEKLY" . "w")
353 ("MONTHLY" . "m")
354 ("YEARLY" . "y")))
355 (org-freq (cdr (assoc (gnus-icalendar-event:recurring-freq event) freq-map))))
356
357 (when org-freq
358 (format "+%s%s" (gnus-icalendar-event:recurring-interval event) org-freq)))))
359
360(defmethod gnus-icalendar-event:org-timestamp ((event gnus-icalendar-event))
361 "Build `org-mode' timestamp from EVENT start/end dates and recurrence info."
362 (let* ((start (gnus-icalendar-event:start-time event))
363 (end (gnus-icalendar-event:end-time event))
364 (start-date (format-time-string "%Y-%m-%d %a" start t))
365 (start-time (format-time-string "%H:%M" start t))
366 (end-date (format-time-string "%Y-%m-%d %a" end t))
367 (end-time (format-time-string "%H:%M" end t))
368 (org-repeat (gnus-icalendar-event:org-repeat event))
369 (repeat (if org-repeat (concat " " org-repeat) "")))
370
371 (if (equal start-date end-date)
372 (format "<%s %s-%s%s>" start-date start-time end-time repeat)
373 (format "<%s %s>--<%s %s>" start-date start-time end-date end-time))))
374
375;; TODO: make the template customizable
376(defmethod gnus-icalendar-event->org-entry ((event gnus-icalendar-event) reply-status)
377 "Return string with new `org-mode' entry describing EVENT."
378 (with-temp-buffer
379 (org-mode)
380 (with-slots (organizer summary description location
381 recur uid) event
382 (let* ((reply (if reply-status (capitalize (symbol-name reply-status))
383 "Not replied yet"))
384 (props `(("ICAL_EVENT" . "t")
385 ("ID" . ,uid)
386 ("DT" . ,(gnus-icalendar-event:org-timestamp event))
387 ("ORGANIZER" . ,(gnus-icalendar-event:organizer event))
388 ("LOCATION" . ,(gnus-icalendar-event:location event))
389 ("RRULE" . ,(gnus-icalendar-event:recur event))
390 ("REPLY" . ,reply))))
391
392 (insert (format "* %s (%s)\n\n" summary location))
393 (mapc (lambda (prop)
394 (org-entry-put (point) (car prop) (cdr prop)))
395 props))
396
397 (when description
398 (save-restriction
399 (narrow-to-region (point) (point))
400 (insert description)
401 (indent-region (point-min) (point-max) 2)
402 (fill-region (point-min) (point-max))))
403
404 (buffer-string))))
405
406(defun gnus-icalendar--deactivate-org-timestamp (ts)
407 (replace-regexp-in-string "[<>]"
408 (lambda (m) (pcase m ("<" "[") (">" "]")))
409 ts))
410
411(defun gnus-icalendar-find-org-event-file (event &optional org-file)
412 "Return the name of the file containing EVENT org entry.
413Return nil when not found.
414
415All org agenda files are searched for the EVENT entry. When
416the optional ORG-FILE argument is specified, only that one file
417is searched."
418 (let ((uid (gnus-icalendar-event:uid event))
419 (files (or org-file (org-agenda-files t 'ifmode))))
420 (flet
421 ((find-event-in (file)
422 (org-check-agenda-file file)
423 (with-current-buffer (find-file-noselect file)
424 (let ((event-pos (org-find-entry-with-id uid)))
425 (when (and event-pos
426 (string= (cdr (assoc "ICAL_EVENT" (org-entry-properties event-pos)))
427 "t"))
428 (throw 'found file))))))
429
430 (gnus-icalendar-find-if #'find-event-in files))))
431
432
433(defun gnus-icalendar--show-org-event (event &optional org-file)
434 (let ((file (gnus-icalendar-find-org-event-file event org-file)))
435 (when file
436 (switch-to-buffer (find-file file))
437 (goto-char (org-find-entry-with-id (gnus-icalendar-event:uid event)))
438 (org-show-entry))))
439
440
441(defun gnus-icalendar--update-org-event (event reply-status &optional org-file)
442 (let ((file (gnus-icalendar-find-org-event-file event org-file)))
443 (when file
444 (with-current-buffer (find-file-noselect file)
445 (with-slots (uid summary description organizer location recur) event
446 (let ((event-pos (org-find-entry-with-id uid)))
447 (when event-pos
448 (goto-char event-pos)
449
450 ;; update the headline, keep todo, priority and tags, if any
451 (save-excursion
452 (let* ((priority (org-entry-get (point) "PRIORITY"))
453 (headline (delq nil (list
454 (org-entry-get (point) "TODO")
455 (when priority (format "[#%s]" priority))
456 (format "%s (%s)" summary location)
457 (org-entry-get (point) "TAGS")))))
458
459 (re-search-forward "^\\*+ " (line-end-position))
460 (delete-region (point) (line-end-position))
461 (insert (mapconcat #'identity headline " "))))
462
463 ;; update props and description
464 (let ((entry-end (org-entry-end-position))
465 (entry-outline-level (org-outline-level)))
466
467 ;; delete body of the entry, leave org drawers intact
468 (save-restriction
469 (org-narrow-to-element)
470 (goto-char entry-end)
471 (re-search-backward "^[\t ]*:END:")
472 (forward-line)
473 (delete-region (point) entry-end))
474
475 ;; put new event description in the entry body
476 (when description
477 (save-restriction
478 (narrow-to-region (point) (point))
479 (insert "\n" (replace-regexp-in-string "[\n]+$" "\n" description) "\n")
480 (indent-region (point-min) (point-max) (1+ entry-outline-level))
481 (fill-region (point-min) (point-max))))
482
483 ;; update entry properties
484 (org-entry-put event-pos "DT" (gnus-icalendar-event:org-timestamp event))
485 (org-entry-put event-pos "ORGANIZER" organizer)
486 (org-entry-put event-pos "LOCATION" location)
487 (org-entry-put event-pos "RRULE" recur)
488 (when reply-status (org-entry-put event-pos "REPLY"
489 (capitalize (symbol-name reply-status))))
490 (save-buffer)))))))))
491
492
493(defun gnus-icalendar--cancel-org-event (event &optional org-file)
494 (let ((file (gnus-icalendar-find-org-event-file event org-file)))
495 (when file
496 (with-current-buffer (find-file-noselect file)
497 (let ((event-pos (org-find-entry-with-id (gnus-icalendar-event:uid event))))
498 (when event-pos
499 (let ((ts (org-entry-get event-pos "DT")))
500 (when ts
501 (org-entry-put event-pos "DT" (gnus-icalendar--deactivate-org-timestamp ts))
502 (save-buffer)))))))))
503
504
505(defun gnus-icalendar--get-org-event-reply-status (event &optional org-file)
506 (let ((file (gnus-icalendar-find-org-event-file event org-file)))
507 (when file
508 (save-excursion
509 (with-current-buffer (find-file-noselect file)
510 (let ((event-pos (org-find-entry-with-id (gnus-icalendar-event:uid event))))
511 (org-entry-get event-pos "REPLY")))))))
512
513
514(defun gnus-icalendar-insinuate-org-templates ()
515 (unless (gnus-icalendar-find-if (lambda (x) (string= (cadr x) gnus-icalendar-org-template-name))
516 org-capture-templates)
517 (setq org-capture-templates
518 (append `((,gnus-icalendar-org-template-key
519 ,gnus-icalendar-org-template-name
520 entry
521 (file+olp ,gnus-icalendar-org-capture-file ,@gnus-icalendar-org-capture-headline)
522 "%i"
523 :immediate-finish t))
524 org-capture-templates))
525
526 ;; hide the template from interactive template selection list
527 ;; (org-capture)
528 ;; NOTE: doesn't work when capturing from string
529 ;; (when (boundp 'org-capture-templates-contexts)
530 ;; (push `(,gnus-icalendar-org-template-key "" ((in-mode . "gnus-article-mode")))
531 ;; org-capture-templates-contexts))
532 ))
533
534(defun gnus-icalendar:org-event-save (event reply-status)
535 (with-temp-buffer
536 (org-capture-string (gnus-icalendar-event->org-entry event reply-status)
537 gnus-icalendar-org-template-key)))
538
539(defun gnus-icalendar-show-org-agenda (event)
540 (let* ((time-delta (time-subtract (gnus-icalendar-event:end-time event)
541 (gnus-icalendar-event:start-time event)))
542 (duration-days (1+ (/ (+ (* (car time-delta) (expt 2 16))
543 (cadr time-delta))
544 86400))))
545
546 (org-agenda-list nil (gnus-icalendar-event:start event) duration-days)))
547
548(defmethod gnus-icalendar-event:sync-to-org ((event gnus-icalendar-event-request) reply-status)
549 (if (gnus-icalendar-find-org-event-file event)
550 (gnus-icalendar--update-org-event event reply-status)
551 (gnus-icalendar:org-event-save event reply-status)))
552
553(defmethod gnus-icalendar-event:sync-to-org ((event gnus-icalendar-event-cancel))
554 (when (gnus-icalendar-find-org-event-file event)
555 (gnus-icalendar--cancel-org-event event)))
556
557(defun gnus-icalendar-org-setup ()
558 (if (and gnus-icalendar-org-capture-file gnus-icalendar-org-capture-headline)
559 (progn
560 (gnus-icalendar-insinuate-org-templates)
561 (setq gnus-icalendar-org-enabled-p t))
562 (message "Cannot enable Calendar->Org: missing capture file, headline")))
563
564;;;
565;;; gnus-icalendar
566;;;
567
568(defgroup gnus-icalendar nil
569 "Settings for inline display of iCalendar invitations."
570 :group 'gnus-article
571 :prefix "gnus-icalendar-")
572
573(defcustom gnus-icalendar-reply-bufname "*CAL*"
574 "Buffer used for building iCalendar invitation reply."
575 :type '(string)
576 :group 'gnus-icalendar)
577
578(make-variable-buffer-local
579 (defvar gnus-icalendar-reply-status nil))
580
581(make-variable-buffer-local
582 (defvar gnus-icalendar-event nil))
583
584(make-variable-buffer-local
585 (defvar gnus-icalendar-handle nil))
586
587(defvar gnus-icalendar-identities
588 (apply #'append
589 (mapcar (lambda (x) (if (listp x) x (list x)))
590 (list user-full-name (regexp-quote user-mail-address)
591 ; NOTE: this one can be a list
592 gnus-ignored-from-addresses))))
593
594;; TODO: make the template customizable
595(defmethod gnus-icalendar-event->gnus-calendar ((event gnus-icalendar-event) &optional reply-status)
596 "Format an overview of EVENT details."
597 (flet ((format-header (x)
598 (format "%-12s%s"
599 (propertize (concat (car x) ":") 'face 'bold)
600 (cadr x))))
601
602 (with-slots (organizer summary description location recur uid method rsvp) event
603 (let ((headers `(("Summary" ,summary)
604 ("Location" ,location)
605 ("Time" ,(gnus-icalendar-event:org-timestamp event))
606 ("Organizer" ,organizer)
607 ("Method" ,method))))
608
609 (when (and (not (gnus-icalendar-event-reply-p event)) rsvp)
610 (setq headers (append headers
611 `(("Status" ,(or reply-status "Not replied yet"))))))
612
613 (concat
614 (mapconcat #'format-header headers "\n")
615 "\n\n"
616 description)))))
617
618(defmacro gnus-icalendar-with-decoded-handle (handle &rest body)
619 "Execute BODY in buffer containing the decoded contents of HANDLE."
620 (let ((charset (make-symbol "charset")))
621 `(let ((,charset (cdr (assoc 'charset (mm-handle-type ,handle)))))
622 (with-temp-buffer
623 (mm-insert-part ,handle)
624 (when (string= ,charset "utf-8")
625 (mm-decode-coding-region (point-min) (point-max) 'utf-8))
626
627 ,@body))))
628
629
630(defun gnus-icalendar-event-from-handle (handle &optional attendee-name-or-email)
631 (gnus-icalendar-with-decoded-handle handle
632 (gnus-icalendar-event-from-buffer (current-buffer) attendee-name-or-email)))
633
634(defun gnus-icalendar-insert-button (text callback data)
635 ;; FIXME: the gnus-mime-button-map keymap does not make sense for this kind
636 ;; of button.
637 (let ((start (point)))
638 (gnus-add-text-properties
639 start
640 (progn
641 (insert "[ " text " ]")
642 (point))
643 `(gnus-callback
644 ,callback
645 keymap ,gnus-mime-button-map
646 face ,gnus-article-button-face
647 gnus-data ,data))
648 (widget-convert-button 'link start (point)
649 :action 'gnus-widget-press-button
650 :button-keymap gnus-widget-button-keymap)))
651
652(defun gnus-icalendar-send-buffer-by-mail (buffer-name subject)
653 (let ((message-signature nil))
654 (with-current-buffer gnus-summary-buffer
655 (gnus-summary-reply)
656 (message-goto-body)
657 (mml-insert-multipart "alternative")
658 (mml-insert-empty-tag 'part 'type "text/plain")
659 (mml-attach-buffer buffer-name "text/calendar; method=REPLY; charset=UTF-8")
660 (message-goto-subject)
661 (delete-region (line-beginning-position) (line-end-position))
662 (insert "Subject: " subject)
663 (message-send-and-exit))))
664
665(defun gnus-icalendar-reply (data)
666 (let* ((handle (car data))
667 (status (cadr data))
668 (event (caddr data))
669 (reply (gnus-icalendar-with-decoded-handle handle
670 (gnus-icalendar-event-reply-from-buffer
671 (current-buffer) status gnus-icalendar-identities))))
672
673 (when reply
674 (flet ((fold-icalendar-buffer ()
675 (goto-char (point-min))
676 (while (re-search-forward "^\\(.\\{72\\}\\)\\(.+\\)$" nil t)
677 (replace-match "\\1\n \\2")
678 (goto-char (line-beginning-position)))))
679 (let ((subject (concat (capitalize (symbol-name status))
680 ": " (gnus-icalendar-event:summary event))))
681
682 (with-current-buffer (get-buffer-create gnus-icalendar-reply-bufname)
683 (delete-region (point-min) (point-max))
684 (insert reply)
685 (fold-icalendar-buffer)
686 (gnus-icalendar-send-buffer-by-mail (buffer-name) subject))
687
688 ;; Back in article buffer
689 (setq-local gnus-icalendar-reply-status status)
690 (when gnus-icalendar-org-enabled-p
691 (gnus-icalendar--update-org-event event status)
692 ;; refresh article buffer to update the reply status
693 (with-current-buffer gnus-summary-buffer
694 (gnus-summary-show-article))))))))
695
696(defun gnus-icalendar-sync-event-to-org (event)
697 (gnus-icalendar-event:sync-to-org event gnus-icalendar-reply-status))
698
699(defmethod gnus-icalendar-event:inline-reply-buttons ((event gnus-icalendar-event) handle)
700 (when (gnus-icalendar-event:rsvp event)
701 `(("Accept" gnus-icalendar-reply (,handle accepted ,event))
702 ("Tentative" gnus-icalendar-reply (,handle tentative ,event))
703 ("Decline" gnus-icalendar-reply (,handle declined ,event)))))
704
705(defmethod gnus-icalendar-event:inline-reply-buttons ((event gnus-icalendar-event-reply) handle)
706 "No buttons for REPLY events."
707 nil)
708
709(defmethod gnus-icalendar-event:inline-reply-status ((event gnus-icalendar-event))
710 (or (when gnus-icalendar-org-enabled-p
711 (gnus-icalendar--get-org-event-reply-status event))
712 "Not replied yet"))
713
714(defmethod gnus-icalendar-event:inline-reply-status ((event gnus-icalendar-event-reply))
715 "No reply status for REPLY events."
716 nil)
717
718
719(defmethod gnus-icalendar-event:inline-org-buttons ((event gnus-icalendar-event))
720 (let* ((org-entry-exists-p (gnus-icalendar-find-org-event-file event))
721 (export-button-text (if org-entry-exists-p "Update Org Entry" "Export to Org")))
722
723 (delq nil (list
724 `("Show Agenda" gnus-icalendar-show-org-agenda ,event)
725 (when (gnus-icalendar-event-request-p event)
726 `(,export-button-text gnus-icalendar-sync-event-to-org ,event))
727 (when org-entry-exists-p
728 `("Show Org Entry" gnus-icalendar--show-org-event ,event))))))
729
730(defun gnus-icalendar-mm-inline (handle)
731 (let ((event (gnus-icalendar-event-from-handle handle gnus-icalendar-identities)))
732
733 (setq gnus-icalendar-reply-status nil)
734
735 (when event
736 (flet ((insert-button-group (buttons)
737 (when buttons
738 (mapc (lambda (x)
739 (apply 'gnus-icalendar-insert-button x)
740 (insert " "))
741 buttons)
742 (insert "\n\n"))))
743
744 (insert-button-group
745 (gnus-icalendar-event:inline-reply-buttons event handle))
746
747 (when gnus-icalendar-org-enabled-p
748 (insert-button-group (gnus-icalendar-event:inline-org-buttons event)))
749
750 (setq gnus-icalendar-event event
751 gnus-icalendar-handle handle)
752
753 (insert (gnus-icalendar-event->gnus-calendar
754 event
755 (gnus-icalendar-event:inline-reply-status event)))))))
756
757(defun gnus-icalendar-save-part (handle)
758 (let (event)
759 (when (and (equal (car (mm-handle-type handle)) "text/calendar")
760 (setq event (gnus-icalendar-event-from-handle handle gnus-icalendar-identities)))
761
762 (gnus-icalendar-event:sync-to-org event))))
763
764
765(defun gnus-icalendar-save-event ()
766 "Save the Calendar event in the text/calendar part under point."
767 (interactive)
768 (gnus-article-check-buffer)
769 (let ((data (get-text-property (point) 'gnus-data)))
770 (when data
771 (gnus-icalendar-save-part data))))
772
773(defun gnus-icalendar-reply-accept ()
774 "Accept invitation in the current article."
775 (interactive)
776 (with-current-buffer gnus-article-buffer
777 (gnus-icalendar-reply (list gnus-icalendar-handle 'accepted gnus-icalendar-event))
778 (setq-local gnus-icalendar-reply-status 'accepted)))
779
780(defun gnus-icalendar-reply-tentative ()
781 "Send tentative response to invitation in the current article."
782 (interactive)
783 (with-current-buffer gnus-article-buffer
784 (gnus-icalendar-reply (list gnus-icalendar-handle 'tentative gnus-icalendar-event))
785 (setq-local gnus-icalendar-reply-status 'tentative)))
786
787(defun gnus-icalendar-reply-decline ()
788 "Decline invitation in the current article."
789 (interactive)
790 (with-current-buffer gnus-article-buffer
791 (gnus-icalendar-reply (list gnus-icalendar-handle 'declined gnus-icalendar-event))
792 (setq-local gnus-icalendar-reply-status 'declined)))
793
794(defun gnus-icalendar-event-export ()
795 "Export calendar event to `org-mode', or update existing agenda entry."
796 (interactive)
797 (with-current-buffer gnus-article-buffer
798 (gnus-icalendar-sync-event-to-org gnus-icalendar-event))
799 ;; refresh article buffer in case the reply had been sent before initial org
800 ;; export
801 (with-current-buffer gnus-summary-buffer
802 (gnus-summary-show-article)))
803
804(defun gnus-icalendar-event-show ()
805 "Display `org-mode' agenda entry related to the calendar event."
806 (interactive)
807 (gnus-icalendar--show-org-event
808 (with-current-buffer gnus-article-buffer
809 gnus-icalendar-event)))
810
811(defun gnus-icalendar-event-check-agenda ()
812 "Display `org-mode' agenda for days between event start and end dates."
813 (interactive)
814 (gnus-icalendar-show-org-agenda
815 (with-current-buffer gnus-article-buffer gnus-icalendar-event)))
816
817(defun gnus-icalendar-setup ()
818 (add-to-list 'mm-inlined-types "text/calendar")
819 (add-to-list 'mm-automatic-display "text/calendar")
820 (add-to-list 'mm-inline-media-tests '("text/calendar" gnus-icalendar-mm-inline identity))
821
822 (gnus-define-keys (gnus-summary-calendar-map "i" gnus-summary-mode-map)
823 "a" gnus-icalendar-reply-accept
824 "t" gnus-icalendar-reply-tentative
825 "d" gnus-icalendar-reply-decline
826 "c" gnus-icalendar-event-check-agenda
827 "e" gnus-icalendar-event-export
828 "s" gnus-icalendar-event-show)
829
830 (require 'gnus-art)
831 (add-to-list 'gnus-mime-action-alist
832 (cons "save calendar event" 'gnus-icalendar-save-event)
833 t))
834
835(provide 'gnus-icalendar)
836
837;;; gnus-icalendar.el ends here
diff --git a/lisp/gnus/gnus-int.el b/lisp/gnus/gnus-int.el
index 2378b598eeb..6aa874f0347 100644
--- a/lisp/gnus/gnus-int.el
+++ b/lisp/gnus/gnus-int.el
@@ -582,8 +582,8 @@ This is the string that Gnus uses to identify the group."
582 (gnus-group-method group))) 582 (gnus-group-method group)))
583 583
584(defun gnus-warp-to-article () 584(defun gnus-warp-to-article ()
585 "Warps from an article in a virtual group to the article in its 585 "Jump from an article in a virtual group to the article in its real group.
586real group. Does nothing on a real group." 586Does nothing in a real group."
587 (interactive) 587 (interactive)
588 (when (gnus-virtual-group-p gnus-newsgroup-name) 588 (when (gnus-virtual-group-p gnus-newsgroup-name)
589 (let ((gnus-command-method 589 (let ((gnus-command-method
diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el
index da5c31325bd..5f91246761e 100644
--- a/lisp/gnus/gnus-score.el
+++ b/lisp/gnus/gnus-score.el
@@ -1071,10 +1071,15 @@ EXTRA is the possible non-standard header."
1071 (push (cons article n) gnus-newsgroup-scored))) 1071 (push (cons article n) gnus-newsgroup-scored)))
1072 (gnus-summary-update-line))) 1072 (gnus-summary-update-line)))
1073 1073
1074(defun gnus-summary-current-score () 1074(defun gnus-summary-current-score (arg)
1075 "Return the score of the current article." 1075 "Return the score of the current article.
1076 (interactive) 1076 With prefix ARG, return the total score of the current (sub)thread."
1077 (gnus-message 1 "%s" (gnus-summary-article-score))) 1077 (interactive "P")
1078 (gnus-message 1 "%s" (if arg
1079 (gnus-thread-total-score
1080 (gnus-id-to-thread
1081 (mail-header-id (gnus-summary-article-header))))
1082 (gnus-summary-article-score))))
1078 1083
1079(defun gnus-score-change-score-file (file) 1084(defun gnus-score-change-score-file (file)
1080 "Change current score alist." 1085 "Change current score alist."
diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el
index 05cf290cac9..9f3f469ad43 100644
--- a/lisp/gnus/gnus-start.el
+++ b/lisp/gnus/gnus-start.el
@@ -944,7 +944,8 @@ If REGEXP is given, lines that match it will be deleted."
944 (when (and gnus-dribble-buffer 944 (when (and gnus-dribble-buffer
945 (buffer-name gnus-dribble-buffer)) 945 (buffer-name gnus-dribble-buffer))
946 (with-current-buffer gnus-dribble-buffer 946 (with-current-buffer gnus-dribble-buffer
947 (save-buffer)))) 947 (when (> (buffer-size) 0)
948 (save-buffer)))))
948 949
949(defun gnus-dribble-clear () 950(defun gnus-dribble-clear ()
950 (when (gnus-buffer-exists-p gnus-dribble-buffer) 951 (when (gnus-buffer-exists-p gnus-dribble-buffer)
@@ -1807,6 +1808,9 @@ backend check whether the group actually exists."
1807 (or (not (gnus-agent-method-p method)) 1808 (or (not (gnus-agent-method-p method))
1808 (gnus-online method))) 1809 (gnus-online method)))
1809 (gnus-finish-retrieve-group-infos method infos early-data) 1810 (gnus-finish-retrieve-group-infos method infos early-data)
1811 ;; We may have altered the data now, so mark the dribble buffer
1812 ;; as dirty so that it gets saved.
1813 (gnus-dribble-touch)
1810 (gnus-agent-save-active method)) 1814 (gnus-agent-save-active method))
1811 ;; Most backends have -retrieve-groups. 1815 ;; Most backends have -retrieve-groups.
1812 ((gnus-check-backend-function 'retrieve-groups (car method)) 1816 ((gnus-check-backend-function 'retrieve-groups (car method))
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index a7269baee74..94f4e703180 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -2359,7 +2359,8 @@ increase the score of each group you read."
2359 ["Mark above" gnus-summary-mark-above t] 2359 ["Mark above" gnus-summary-mark-above t]
2360 ["Tick above" gnus-summary-tick-above t] 2360 ["Tick above" gnus-summary-tick-above t]
2361 ["Clear above" gnus-summary-clear-above t]) 2361 ["Clear above" gnus-summary-clear-above t])
2362 ["Current score" gnus-summary-current-score t] 2362 ["Current article score" gnus-summary-current-score t]
2363 ["Current thread score" (gnus-summary-current-score 'total) t]
2363 ["Set score" gnus-summary-set-score t] 2364 ["Set score" gnus-summary-set-score t]
2364 ["Switch current score file..." gnus-score-change-score-file t] 2365 ["Switch current score file..." gnus-score-change-score-file t]
2365 ["Set mark below..." gnus-score-set-mark-below t] 2366 ["Set mark below..." gnus-score-set-mark-below t]
diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el
index 0f0e9675c71..1d2ab2da248 100644
--- a/lisp/gnus/gnus-util.el
+++ b/lisp/gnus/gnus-util.el
@@ -1558,12 +1558,15 @@ SPEC is a predicate specifier that contains stuff like `or', `and',
1558 "Call standard `completing-read-function'." 1558 "Call standard `completing-read-function'."
1559 (let ((completion-styles gnus-completion-styles)) 1559 (let ((completion-styles gnus-completion-styles))
1560 (completing-read prompt 1560 (completing-read prompt
1561 ;; Old XEmacs (at least 21.4) expect an alist, 1561 (if (featurep 'xemacs)
1562 ;; in which the car of each element is a string, 1562 ;; Old XEmacs (at least 21.4) expect an alist,
1563 ;; for collection. 1563 ;; in which the car of each element is a string,
1564 (mapcar (lambda (elem) 1564 ;; for collection.
1565 (list (format "%s" (or (car-safe elem) elem)))) 1565 (mapcar
1566 collection) 1566 (lambda (elem)
1567 (list (format "%s" (or (car-safe elem) elem))))
1568 collection)
1569 collection)
1567 nil require-match initial-input history def))) 1570 nil require-match initial-input history def)))
1568 1571
1569(autoload 'ido-completing-read "ido") 1572(autoload 'ido-completing-read "ido")
diff --git a/lisp/gnus/gnus-uu.el b/lisp/gnus/gnus-uu.el
index c50dcde0034..16ed4f17801 100644
--- a/lisp/gnus/gnus-uu.el
+++ b/lisp/gnus/gnus-uu.el
@@ -640,7 +640,7 @@ When called interactively, prompt for REGEXP."
640 (let ((level (gnus-summary-thread-level))) 640 (let ((level (gnus-summary-thread-level)))
641 (while (and (gnus-summary-set-process-mark 641 (while (and (gnus-summary-set-process-mark
642 (gnus-summary-article-number)) 642 (gnus-summary-article-number))
643 (zerop (gnus-summary-next-subject 1 nil t)) 643 (zerop (forward-line 1))
644 (> (gnus-summary-thread-level) level))))) 644 (> (gnus-summary-thread-level) level)))))
645 (gnus-summary-position-point)) 645 (gnus-summary-position-point))
646 646
@@ -650,7 +650,7 @@ When called interactively, prompt for REGEXP."
650 (let ((level (gnus-summary-thread-level))) 650 (let ((level (gnus-summary-thread-level)))
651 (while (and (gnus-summary-remove-process-mark 651 (while (and (gnus-summary-remove-process-mark
652 (gnus-summary-article-number)) 652 (gnus-summary-article-number))
653 (zerop (gnus-summary-next-subject 1)) 653 (zerop (forward-line 1))
654 (> (gnus-summary-thread-level) level)))) 654 (> (gnus-summary-thread-level) level))))
655 (gnus-summary-position-point)) 655 (gnus-summary-position-point))
656 656
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index b35eb9dca12..d6d6b3f8bed 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -264,7 +264,7 @@ This is a list of regexps and regexp matches."
264 :type 'sexp) 264 :type 'sexp)
265 265
266(defcustom message-ignored-news-headers 266(defcustom message-ignored-news-headers
267 "^NNTP-Posting-Host:\\|^Xref:\\|^[BGF]cc:\\|^Resent-Fcc:\\|^X-Draft-From:\\|^X-Gnus-Agent-Meta-Information:\\|^X-Message-SMTP-Method:" 267 "^NNTP-Posting-Host:\\|^Xref:\\|^[BGF]cc:\\|^Resent-Fcc:\\|^X-Draft-From:\\|^X-Gnus-Agent-Meta-Information:\\|^X-Message-SMTP-Method:\\|^X-Gnus-Delayed:"
268 "*Regexp of headers to be removed unconditionally before posting." 268 "*Regexp of headers to be removed unconditionally before posting."
269 :group 'message-news 269 :group 'message-news
270 :group 'message-headers 270 :group 'message-headers
diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el
index 98be1c5def2..7274708f014 100644
--- a/lisp/gnus/mm-decode.el
+++ b/lisp/gnus/mm-decode.el
@@ -63,6 +63,18 @@
63 :group 'news 63 :group 'news
64 :group 'multimedia) 64 :group 'multimedia)
65 65
66(defface mm-command-output
67 '((((class color)
68 (background dark))
69 (:foreground "ForestGreen"))
70 (((class color)
71 (background light))
72 (:foreground "red3"))
73 (t
74 (:italic t)))
75 "Face used for displaying output from commands."
76 :group 'mime-display)
77
66;;; Convenience macros. 78;;; Convenience macros.
67 79
68(defmacro mm-handle-buffer (handle) 80(defmacro mm-handle-buffer (handle)
@@ -983,9 +995,12 @@ external if displayed external."
983 (let ((buffer-read-only nil) 995 (let ((buffer-read-only nil)
984 (point (point))) 996 (point (point)))
985 (forward-line 2) 997 (forward-line 2)
986 (mm-insert-inline 998 (let ((start (point)))
987 handle (with-current-buffer buffer 999 (mm-insert-inline
988 (buffer-string))) 1000 handle (with-current-buffer buffer
1001 (buffer-string)))
1002 (put-text-property start (point)
1003 'face 'mm-command-output))
989 (goto-char point)))) 1004 (goto-char point))))
990 (when (buffer-live-p buffer) 1005 (when (buffer-live-p buffer)
991 (kill-buffer buffer))) 1006 (kill-buffer buffer)))
diff --git a/lisp/gnus/mml2015.el b/lisp/gnus/mml2015.el
index 2c2187a5f8d..3efa5c23bb3 100644
--- a/lisp/gnus/mml2015.el
+++ b/lisp/gnus/mml2015.el
@@ -885,17 +885,19 @@ If set, it overrides the setting of `mml2015-sign-with-sender'."
885 885
886(defun mml2015-epg-key-image-to-string (key-id) 886(defun mml2015-epg-key-image-to-string (key-id)
887 "Return a string with the image of a key, if any" 887 "Return a string with the image of a key, if any"
888 (let* ((result "") 888 (let ((key-image (mml2015-epg-key-image key-id)))
889 (key-image (mml2015-epg-key-image key-id))) 889 (if (not key-image)
890 (when key-image 890 ""
891 (setq result " ") 891 (condition-case error
892 (put-text-property 892 (let ((result " "))
893 1 2 'display 893 (put-text-property
894 (gnus-rescale-image key-image 894 1 2 'display
895 (cons mml2015-maximum-key-image-dimension 895 (gnus-rescale-image key-image
896 mml2015-maximum-key-image-dimension)) 896 (cons mml2015-maximum-key-image-dimension
897 result)) 897 mml2015-maximum-key-image-dimension))
898 result)) 898 result)
899 result)
900 (error "")))))
899 901
900(defun mml2015-epg-signature-to-string (signature) 902(defun mml2015-epg-signature-to-string (signature)
901 (concat (epg-signature-to-string signature) 903 (concat (epg-signature-to-string signature)
diff --git a/lisp/gnus/nnmbox.el b/lisp/gnus/nnmbox.el
index 3228eacdd0a..c605541e7f1 100644
--- a/lisp/gnus/nnmbox.el
+++ b/lisp/gnus/nnmbox.el
@@ -148,28 +148,29 @@
148(deffoo nnmbox-request-article (article &optional newsgroup server buffer) 148(deffoo nnmbox-request-article (article &optional newsgroup server buffer)
149 (nnmbox-possibly-change-newsgroup newsgroup server) 149 (nnmbox-possibly-change-newsgroup newsgroup server)
150 (with-current-buffer nnmbox-mbox-buffer 150 (with-current-buffer nnmbox-mbox-buffer
151 (when (nnmbox-find-article article) 151 (save-excursion
152 (let (start stop) 152 (when (nnmbox-find-article article)
153 (re-search-backward (concat "^" message-unix-mail-delimiter) nil t) 153 (let (start stop)
154 (setq start (point)) 154 (re-search-backward (concat "^" message-unix-mail-delimiter) nil t)
155 (forward-line 1) 155 (setq start (point))
156 (setq stop (if (re-search-forward (concat "^" 156 (forward-line 1)
157 message-unix-mail-delimiter) 157 (setq stop (if (re-search-forward (concat "^"
158 nil 'move) 158 message-unix-mail-delimiter)
159 (match-beginning 0) 159 nil 'move)
160 (point))) 160 (match-beginning 0)
161 (let ((nntp-server-buffer (or buffer nntp-server-buffer))) 161 (point)))
162 (set-buffer nntp-server-buffer) 162 (let ((nntp-server-buffer (or buffer nntp-server-buffer)))
163 (erase-buffer) 163 (set-buffer nntp-server-buffer)
164 (insert-buffer-substring nnmbox-mbox-buffer start stop) 164 (erase-buffer)
165 (goto-char (point-min)) 165 (insert-buffer-substring nnmbox-mbox-buffer start stop)
166 (while (looking-at "From ") 166 (goto-char (point-min))
167 (delete-char 5) 167 (while (looking-at "From ")
168 (insert "X-From-Line: ") 168 (delete-char 5)
169 (forward-line 1)) 169 (insert "X-From-Line: ")
170 (if (numberp article) 170 (forward-line 1))
171 (cons nnmbox-current-group article) 171 (if (numberp article)
172 (nnmbox-article-group-number nil))))))) 172 (cons nnmbox-current-group article)
173 (nnmbox-article-group-number nil))))))))
173 174
174(deffoo nnmbox-request-group (group &optional server dont-check info) 175(deffoo nnmbox-request-group (group &optional server dont-check info)
175 (nnmbox-possibly-change-newsgroup nil server) 176 (nnmbox-possibly-change-newsgroup nil server)
@@ -255,14 +256,14 @@
255 (if (setq is-old 256 (if (setq is-old
256 (nnmail-expired-article-p 257 (nnmail-expired-article-p
257 newsgroup 258 newsgroup
258 (buffer-substring 259 (buffer-substring (point) (line-end-position))
259 (point) (progn (end-of-line) (point))) force)) 260 force))
260 (progn 261 (progn
261 (unless (eq nnmail-expiry-target 'delete) 262 (unless (eq nnmail-expiry-target 'delete)
262 (with-temp-buffer 263 (with-temp-buffer
263 (nnmbox-request-article (car articles) 264 (nnmbox-request-article (car articles)
264 newsgroup server 265 newsgroup server
265 (current-buffer)) 266 (current-buffer))
266 (let ((nnml-current-directory nil)) 267 (let ((nnml-current-directory nil))
267 (nnmail-expiry-target-group 268 (nnmail-expiry-target-group
268 nnmail-expiry-target newsgroup))) 269 nnmail-expiry-target newsgroup)))
diff --git a/lisp/gnus/nnrss.el b/lisp/gnus/nnrss.el
index b1e5c4cc9fd..80bb7c4f7df 100644
--- a/lisp/gnus/nnrss.el
+++ b/lisp/gnus/nnrss.el
@@ -933,30 +933,30 @@ whether they are `offsite' or `onsite'."
933 rss-offsite-in rdf-offsite-in xml-offsite-in))) 933 rss-offsite-in rdf-offsite-in xml-offsite-in)))
934 934
935(defun nnrss-discover-feed (url) 935(defun nnrss-discover-feed (url)
936 "Given a page, find an RSS feed using Mark Pilgrim's 936 "Given a page, find an RSS feed.
937`ultra-liberal rss locator'." 937Use Mark Pilgrim's `ultra-liberal rss locator'."
938
939 (let ((parsed-page (nnrss-fetch url))) 938 (let ((parsed-page (nnrss-fetch url)))
940 939 ;; 1. if this url is the rss, use it.
941;; 1. if this url is the rss, use it.
942 (if (nnrss-rss-p parsed-page) 940 (if (nnrss-rss-p parsed-page)
943 (let ((rss-ns (nnrss-get-namespace-prefix parsed-page "http://purl.org/rss/1.0/"))) 941 (let ((rss-ns (nnrss-get-namespace-prefix parsed-page "http://purl.org/rss/1.0/")))
944 (nnrss-rss-title-description rss-ns parsed-page url)) 942 (nnrss-rss-title-description rss-ns parsed-page url))
945 943
946;; 2. look for the <link rel="alternate" 944 ;; 2. look for the <link rel="alternate"
947;; type="application/rss+xml" and use that if it is there. 945 ;; type="application/rss+xml" and use that if it is there.
948 (let ((links (nnrss-get-rsslinks parsed-page))) 946 (let ((links (nnrss-get-rsslinks parsed-page)))
949 (if links 947 (if links
950 (let* ((xml (nnrss-fetch 948 (let* ((xml (nnrss-fetch
951 (cdr (assoc 'href (cadar links))))) 949 (cdr (assoc 'href (cadar links)))))
952 (rss-ns (nnrss-get-namespace-prefix xml "http://purl.org/rss/1.0/"))) 950 (rss-ns (nnrss-get-namespace-prefix
953 (nnrss-rss-title-description rss-ns xml (cdr (assoc 'href (cadar links))))) 951 xml "http://purl.org/rss/1.0/")))
954 952 (nnrss-rss-title-description
955;; 3. look for links on the site in the following order: 953 rss-ns xml (cdr (assoc 'href (cadar links)))))
956;; - onsite links ending in .rss, .rdf, or .xml 954
957;; - onsite links containing any of the above 955 ;; 3. look for links on the site in the following order:
958;; - offsite links ending in .rss, .rdf, or .xml 956 ;; - onsite links ending in .rss, .rdf, or .xml
959;; - offsite links containing any of the above 957 ;; - onsite links containing any of the above
958 ;; - offsite links ending in .rss, .rdf, or .xml
959 ;; - offsite links containing any of the above
960 (let* ((base-uri (progn (string-match ".*://[^/]+/?" url) 960 (let* ((base-uri (progn (string-match ".*://[^/]+/?" url)
961 (match-string 0 url))) 961 (match-string 0 url)))
962 (hrefs (nnrss-order-hrefs 962 (hrefs (nnrss-order-hrefs
@@ -969,9 +969,9 @@ whether they are `offsite' or `onsite'."
969 (setq rss-link (nnrss-rss-title-description 969 (setq rss-link (nnrss-rss-title-description
970 rss-ns href-data (car hrefs)))) 970 rss-ns href-data (car hrefs))))
971 (setq hrefs (cdr hrefs))))) 971 (setq hrefs (cdr hrefs)))))
972 (if rss-link rss-link 972 (if rss-link
973 973 rss-link
974;; 4. check syndic8 974 ;; 4. check syndic8
975 (nnrss-find-rss-via-syndic8 url)))))))) 975 (nnrss-find-rss-via-syndic8 url))))))))
976 976
977(defun nnrss-find-rss-via-syndic8 (url) 977(defun nnrss-find-rss-via-syndic8 (url)
diff --git a/lisp/gnus/rfc2047.el b/lisp/gnus/rfc2047.el
index a9498d46e79..ebf597423b8 100644
--- a/lisp/gnus/rfc2047.el
+++ b/lisp/gnus/rfc2047.el
@@ -235,85 +235,96 @@ Should be called narrowed to the head of the message."
235 (interactive "*") 235 (interactive "*")
236 (save-excursion 236 (save-excursion
237 (goto-char (point-min)) 237 (goto-char (point-min))
238 (let (alist elem method) 238 (let (alist elem method charsets)
239 (while (not (eobp)) 239 (while (not (eobp))
240 (save-restriction 240 (save-restriction
241 (rfc2047-narrow-to-field) 241 (rfc2047-narrow-to-field)
242 (setq method nil 242 (setq method nil
243 alist rfc2047-header-encoding-alist) 243 alist rfc2047-header-encoding-alist
244 (while (setq elem (pop alist)) 244 charsets (mm-find-mime-charset-region (point-min) (point-max)))
245 (when (or (and (stringp (car elem)) 245 ;; M$ Outlook boycotts decoding of a header if it consists
246 (looking-at (car elem))) 246 ;; of two or more encoded words and those charsets differ;
247 (eq (car elem) t)) 247 ;; it seems to decode all words in a header from a charset
248 (setq alist nil 248 ;; found first in the header. So, we unify the charsets into
249 method (cdr elem)))) 249 ;; a single one used for encoding the whole text in a header.
250 (if (not (rfc2047-encodable-p)) 250 (let ((mm-coding-system-priorities
251 (prog2 251 (if (= (length charsets) 1)
252 (when (eq method 'address-mime) 252 (cons (mm-charset-to-coding-system (car charsets))
253 (rfc2047-quote-special-characters-in-quoted-strings)) 253 mm-coding-system-priorities)
254 (if (and (eq (mm-body-7-or-8) '8bit) 254 mm-coding-system-priorities)))
255 (mm-multibyte-p) 255 (while (setq elem (pop alist))
256 (mm-coding-system-p 256 (when (or (and (stringp (car elem))
257 (car message-posting-charset))) 257 (looking-at (car elem)))
258 ;; 8 bit must be decoded. 258 (eq (car elem) t))
259 (mm-encode-coding-region 259 (setq alist nil
260 (point-min) (point-max) 260 method (cdr elem))))
261 (mm-charset-to-coding-system 261 (if (not (rfc2047-encodable-p))
262 (car message-posting-charset)))) 262 (prog2
263 ;; No encoding necessary, but folding is nice 263 (when (eq method 'address-mime)
264 (when nil 264 (rfc2047-quote-special-characters-in-quoted-strings))
265 (rfc2047-fold-region 265 (if (and (eq (mm-body-7-or-8) '8bit)
266 (save-excursion 266 (mm-multibyte-p)
267 (goto-char (point-min)) 267 (mm-coding-system-p
268 (skip-chars-forward "^:") 268 (car message-posting-charset)))
269 (when (looking-at ": ") 269 ;; 8 bit must be decoded.
270 (forward-char 2)) 270 (mm-encode-coding-region
271 (point)) 271 (point-min) (point-max)
272 (point-max)))) 272 (mm-charset-to-coding-system
273 ;; We found something that may perhaps be encoded. 273 (car message-posting-charset))))
274 (re-search-forward "^[^:]+: *" nil t) 274 ;; No encoding necessary, but folding is nice
275 (cond 275 (when nil
276 ((eq method 'address-mime) 276 (rfc2047-fold-region
277 (rfc2047-encode-region (point) (point-max))) 277 (save-excursion
278 ((eq method 'mime) 278 (goto-char (point-min))
279 (let ((rfc2047-encoding-type 'mime)) 279 (skip-chars-forward "^:")
280 (rfc2047-encode-region (point) (point-max)))) 280 (when (looking-at ": ")
281 ((eq method 'default) 281 (forward-char 2))
282 (if (and (featurep 'mule) 282 (point))
283 (if (boundp 'enable-multibyte-characters) 283 (point-max))))
284 (default-value 'enable-multibyte-characters)) 284 ;; We found something that may perhaps be encoded.
285 mail-parse-charset) 285 (re-search-forward "^[^:]+: *" nil t)
286 (mm-encode-coding-region (point) (point-max) 286 (cond
287 mail-parse-charset))) 287 ((eq method 'address-mime)
288 ;; We get this when CC'ing messages to newsgroups with 288 (rfc2047-encode-region (point) (point-max)))
289 ;; 8-bit names. The group name mail copy just got 289 ((eq method 'mime)
290 ;; unconditionally encoded. Previously, it would ask 290 (let ((rfc2047-encoding-type 'mime))
291 ;; whether to encode, which was quite confusing for the 291 (rfc2047-encode-region (point) (point-max))))
292 ;; user. If the new behavior is wrong, tell me. I have 292 ((eq method 'default)
293 ;; left the old code commented out below. 293 (if (and (featurep 'mule)
294 ;; -- Per Abrahamsen <abraham@dina.kvl.dk> Date: 2001-10-07. 294 (if (boundp 'enable-multibyte-characters)
295 ;; Modified by Dave Love, with the commented-out code changed 295 (default-value 'enable-multibyte-characters))
296 ;; in accordance with changes elsewhere. 296 mail-parse-charset)
297 ((null method) 297 (mm-encode-coding-region (point) (point-max)
298 (rfc2047-encode-region (point) (point-max))) 298 mail-parse-charset)))
299;;; ((null method) 299 ;; We get this when CC'ing messages to newsgroups with
300;;; (if (or (message-options-get 300 ;; 8-bit names. The group name mail copy just got
301;;; 'rfc2047-encode-message-header-encode-any) 301 ;; unconditionally encoded. Previously, it would ask
302;;; (message-options-set 302 ;; whether to encode, which was quite confusing for the
303;;; 'rfc2047-encode-message-header-encode-any 303 ;; user. If the new behavior is wrong, tell me. I have
304;;; (y-or-n-p 304 ;; left the old code commented out below.
305;;; "Some texts are not encoded. Encode anyway?"))) 305 ;; -- Per Abrahamsen <abraham@dina.kvl.dk> Date: 2001-10-07.
306;;; (rfc2047-encode-region (point-min) (point-max)) 306 ;; Modified by Dave Love, with the commented-out code changed
307;;; (error "Cannot send unencoded text"))) 307 ;; in accordance with changes elsewhere.
308 ((mm-coding-system-p method) 308 ((null method)
309 (if (or (and (featurep 'mule) 309 (rfc2047-encode-region (point) (point-max)))
310 (if (boundp 'enable-multibyte-characters) 310;;; ((null method)
311 (default-value 'enable-multibyte-characters))) 311;;; (if (or (message-options-get
312 (featurep 'file-coding)) 312;;; 'rfc2047-encode-message-header-encode-any)
313 (mm-encode-coding-region (point) (point-max) method))) 313;;; (message-options-set
314 ;; Hm. 314;;; 'rfc2047-encode-message-header-encode-any
315 (t))) 315;;; (y-or-n-p
316 (goto-char (point-max))))))) 316;;; "Some texts are not encoded. Encode anyway?")))
317;;; (rfc2047-encode-region (point-min) (point-max))
318;;; (error "Cannot send unencoded text")))
319 ((mm-coding-system-p method)
320 (if (or (and (featurep 'mule)
321 (if (boundp 'enable-multibyte-characters)
322 (default-value 'enable-multibyte-characters)))
323 (featurep 'file-coding))
324 (mm-encode-coding-region (point) (point-max) method)))
325 ;; Hm.
326 (t)))
327 (goto-char (point-max))))))))
317 328
318;; Fixme: This, and the require below may not be the Right Thing, but 329;; Fixme: This, and the require below may not be the Right Thing, but
319;; should be safe just before release. -- fx 2001-02-08 330;; should be safe just before release. -- fx 2001-02-08
diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el
index de36c6c86ce..1ba0b0f0779 100644
--- a/lisp/ibuf-ext.el
+++ b/lisp/ibuf-ext.el
@@ -1050,7 +1050,7 @@ currently used by buffers."
1050 "Toggle current view to buffers with filename matching QUALIFIER." 1050 "Toggle current view to buffers with filename matching QUALIFIER."
1051 (:description "filename" 1051 (:description "filename"
1052 :reader (read-from-minibuffer "Filter by filename (regexp): ")) 1052 :reader (read-from-minibuffer "Filter by filename (regexp): "))
1053 (ibuffer-awhen (buffer-local-value 'buffer-file-name buf) 1053 (ibuffer-awhen (with-current-buffer buf (ibuffer-buffer-file-name))
1054 (string-match qualifier it))) 1054 (string-match qualifier it)))
1055 1055
1056;;;###autoload (autoload 'ibuffer-filter-by-size-gt "ibuf-ext") 1056;;;###autoload (autoload 'ibuffer-filter-by-size-gt "ibuf-ext")
diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el
index a4f18201a3f..09d7c143346 100644
--- a/lisp/ibuffer.el
+++ b/lisp/ibuffer.el
@@ -2631,29 +2631,7 @@ will be inserted before the group at point."
2631 2631
2632;;; Start of automatically extracted autoloads. 2632;;; Start of automatically extracted autoloads.
2633 2633
2634;;;### (autoloads (ibuffer-do-occur ibuffer-mark-dired-buffers ibuffer-mark-read-only-buffers 2634;;;### (autoloads nil "ibuf-ext" "ibuf-ext.el" "d06b2735a74954e0c6922a811de7608c")
2635;;;;;; ibuffer-mark-special-buffers ibuffer-mark-old-buffers ibuffer-mark-compressed-file-buffers
2636;;;;;; ibuffer-mark-help-buffers ibuffer-mark-dissociated-buffers
2637;;;;;; ibuffer-mark-unsaved-buffers ibuffer-mark-modified-buffers
2638;;;;;; ibuffer-mark-by-mode ibuffer-mark-by-file-name-regexp ibuffer-mark-by-mode-regexp
2639;;;;;; ibuffer-mark-by-name-regexp ibuffer-copy-filename-as-kill
2640;;;;;; ibuffer-diff-with-file ibuffer-jump-to-buffer ibuffer-do-kill-lines
2641;;;;;; ibuffer-backwards-next-marked ibuffer-forward-next-marked
2642;;;;;; ibuffer-add-to-tmp-show ibuffer-add-to-tmp-hide ibuffer-bs-show
2643;;;;;; ibuffer-invert-sorting ibuffer-toggle-sorting-mode ibuffer-switch-to-saved-filters
2644;;;;;; ibuffer-add-saved-filters ibuffer-delete-saved-filters ibuffer-save-filters
2645;;;;;; ibuffer-or-filter ibuffer-negate-filter ibuffer-exchange-filters
2646;;;;;; ibuffer-decompose-filter ibuffer-pop-filter ibuffer-filter-disable
2647;;;;;; ibuffer-switch-to-saved-filter-groups ibuffer-delete-saved-filter-groups
2648;;;;;; ibuffer-save-filter-groups ibuffer-yank-filter-group ibuffer-yank
2649;;;;;; ibuffer-kill-line ibuffer-kill-filter-group ibuffer-jump-to-filter-group
2650;;;;;; ibuffer-clear-filter-groups ibuffer-decompose-filter-group
2651;;;;;; ibuffer-pop-filter-group ibuffer-set-filter-groups-by-mode
2652;;;;;; ibuffer-filters-to-filter-group ibuffer-included-in-filters-p
2653;;;;;; ibuffer-backward-filter-group ibuffer-forward-filter-group
2654;;;;;; ibuffer-toggle-filter-group ibuffer-mouse-toggle-filter-group
2655;;;;;; ibuffer-interactive-filter-by-mode ibuffer-mouse-filter-by-mode
2656;;;;;; ibuffer-auto-mode) "ibuf-ext" "ibuf-ext.el" "2c628e6cde385119c5f7b43cc1efe1a1")
2657;;; Generated autoloads from ibuf-ext.el 2635;;; Generated autoloads from ibuf-ext.el
2658 2636
2659(autoload 'ibuffer-auto-mode "ibuf-ext" "\ 2637(autoload 'ibuffer-auto-mode "ibuf-ext" "\
diff --git a/lisp/mh-e/mh-e.el b/lisp/mh-e/mh-e.el
index 303d817dede..752e2c5e9c6 100644
--- a/lisp/mh-e/mh-e.el
+++ b/lisp/mh-e/mh-e.el
@@ -1019,6 +1019,7 @@ windows in the frame are removed."
1019 (when delete-other-windows-flag 1019 (when delete-other-windows-flag
1020 (delete-other-windows))) 1020 (delete-other-windows)))
1021 1021
1022;; FIXME: Maybe out of date? --xfq
1022(if (boundp 'customize-package-emacs-version-alist) 1023(if (boundp 'customize-package-emacs-version-alist)
1023 (add-to-list 'customize-package-emacs-version-alist 1024 (add-to-list 'customize-package-emacs-version-alist
1024 '(MH-E ("6.0" . "22.1") ("6.1" . "22.1") ("7.0" . "22.1") 1025 '(MH-E ("6.0" . "22.1") ("6.1" . "22.1") ("7.0" . "22.1")
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 8bcf3afae05..e07d28a54d0 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -568,6 +568,17 @@ for use at QPOS."
568 (cl-assert (string-prefix-p prefix completion 'ignore-case) t) 568 (cl-assert (string-prefix-p prefix completion 'ignore-case) t)
569 (let* ((new (substring completion (length prefix))) 569 (let* ((new (substring completion (length prefix)))
570 (qnew (funcall qfun new)) 570 (qnew (funcall qfun new))
571 (qprefix
572 (if (not completion-ignore-case)
573 qprefix
574 ;; Make qprefix inherit the case from `completion'.
575 (let* ((rest (substring completion
576 0 (length prefix)))
577 (qrest (funcall qfun rest)))
578 (if (completion--string-equal-p qprefix qrest)
579 (propertize qrest 'face
580 'completions-common-part)
581 qprefix))))
571 (qcompletion (concat qprefix qnew))) 582 (qcompletion (concat qprefix qnew)))
572 ;; FIXME: Similarly here, Cygwin's mapping trips this 583 ;; FIXME: Similarly here, Cygwin's mapping trips this
573 ;; assertion. 584 ;; assertion.
diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el
index feae435c779..70173dbc0b3 100644
--- a/lisp/net/browse-url.el
+++ b/lisp/net/browse-url.el
@@ -816,8 +816,8 @@ first, if that exists."
816 ;; When connected to various displays, be careful to use the display of 816 ;; When connected to various displays, be careful to use the display of
817 ;; the currently selected frame, rather than the original start display, 817 ;; the currently selected frame, rather than the original start display,
818 ;; which may not even exist any more. 818 ;; which may not even exist any more.
819 (if (stringp (frame-parameter (selected-frame) 'display)) 819 (if (stringp (frame-parameter nil 'display))
820 (setenv "DISPLAY" (frame-parameter (selected-frame) 'display))) 820 (setenv "DISPLAY" (frame-parameter nil 'display)))
821 (if (and (consp function) 821 (if (and (consp function)
822 (not (functionp function))) 822 (not (functionp function)))
823 ;; The `function' can be an alist; look down it for first match 823 ;; The `function' can be an alist; look down it for first match
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index d65932ae7c9..70c11c3201f 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -309,7 +309,7 @@ word(s) will be searched for via `eww-search-prefix'."
309 (goto-char (point-min)))) 309 (goto-char (point-min))))
310 310
311(defun eww-setup-buffer () 311(defun eww-setup-buffer ()
312 (pop-to-buffer (get-buffer-create "*eww*")) 312 (switch-to-buffer (get-buffer-create "*eww*"))
313 (let ((inhibit-read-only t)) 313 (let ((inhibit-read-only t))
314 (remove-overlays) 314 (remove-overlays)
315 (erase-buffer)) 315 (erase-buffer))
diff --git a/lisp/net/network-stream.el b/lisp/net/network-stream.el
index fd21997ba28..ab7d02cc802 100644
--- a/lisp/net/network-stream.el
+++ b/lisp/net/network-stream.el
@@ -128,6 +128,9 @@ values:
128:use-starttls-if-possible is a boolean that says to do opportunistic 128:use-starttls-if-possible is a boolean that says to do opportunistic
129STARTTLS upgrades even if Emacs doesn't have built-in TLS functionality. 129STARTTLS upgrades even if Emacs doesn't have built-in TLS functionality.
130 130
131:nogreeting is a boolean that can be used to inhibit waiting for
132a greeting from the server.
133
131:nowait is a boolean that says the connection should be made 134:nowait is a boolean that says the connection should be made
132 asynchronously, if possible." 135 asynchronously, if possible."
133 (unless (featurep 'make-network-process) 136 (unless (featurep 'make-network-process)
@@ -211,7 +214,8 @@ STARTTLS upgrades even if Emacs doesn't have built-in TLS functionality.
211 ;; Return (STREAM GREETING CAPABILITIES RESULTING-TYPE) 214 ;; Return (STREAM GREETING CAPABILITIES RESULTING-TYPE)
212 (stream (make-network-process :name name :buffer buffer 215 (stream (make-network-process :name name :buffer buffer
213 :host host :service service)) 216 :host host :service service))
214 (greeting (network-stream-get-response stream start eoc)) 217 (greeting (and (not (plist-get parameters :nogreeting))
218 (network-stream-get-response stream start eoc)))
215 (capabilities (network-stream-command stream capability-command 219 (capabilities (network-stream-command stream capability-command
216 eo-capa)) 220 eo-capa))
217 (resulting-type 'plain) 221 (resulting-type 'plain)
diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 6ddf8d2af90..89791511e09 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -143,7 +143,7 @@ cid: URL as the argument.")
143 (define-key map [tab] 'shr-next-link) 143 (define-key map [tab] 'shr-next-link)
144 (define-key map [backtab] 'shr-previous-link) 144 (define-key map [backtab] 'shr-previous-link)
145 (define-key map [follow-link] 'mouse-face) 145 (define-key map [follow-link] 'mouse-face)
146 (define-key map [mouse-2] 'shr-mouse-browse-url) 146 (define-key map [mouse-2] 'shr-browse-url)
147 (define-key map "I" 'shr-insert-image) 147 (define-key map "I" 'shr-insert-image)
148 (define-key map "w" 'shr-copy-url) 148 (define-key map "w" 'shr-copy-url)
149 (define-key map "u" 'shr-copy-url) 149 (define-key map "u" 'shr-copy-url)
@@ -664,10 +664,11 @@ size, and full-buffer size."
664 (mouse-set-point ev) 664 (mouse-set-point ev)
665 (shr-browse-url)) 665 (shr-browse-url))
666 666
667(defun shr-browse-url (&optional external) 667(defun shr-browse-url (&optional external mouse-event)
668 "Browse the URL under point. 668 "Browse the URL under point.
669If EXTERNAL, browse the URL using `shr-external-browser'." 669If EXTERNAL, browse the URL using `shr-external-browser'."
670 (interactive "P") 670 (interactive (list current-prefix-arg last-nonmenu-event))
671 (mouse-set-point mouse-event)
671 (let ((url (get-text-property (point) 'shr-url))) 672 (let ((url (get-text-property (point) 'shr-url)))
672 (cond 673 (cond
673 ((not url) 674 ((not url)
@@ -832,6 +833,8 @@ START, and END. Note that START and END should be markers."
832 start (point) 833 start (point)
833 (list 'shr-url url 834 (list 'shr-url url
834 'help-echo (if title (format "%s (%s)" url title) url) 835 'help-echo (if title (format "%s (%s)" url title) url)
836 'follow-link t
837 'mouse-face 'highlight
835 'keymap shr-map))) 838 'keymap shr-map)))
836 839
837(defun shr-encode-url (url) 840(defun shr-encode-url (url)
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index 82b017fa230..33e9e5aa44b 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -85,53 +85,74 @@
85 (cons 'tramp-adb-file-name-p 'tramp-adb-file-name-handler)) 85 (cons 'tramp-adb-file-name-p 'tramp-adb-file-name-handler))
86 86
87(defconst tramp-adb-file-name-handler-alist 87(defconst tramp-adb-file-name-handler-alist
88 '((directory-file-name . tramp-handle-directory-file-name) 88 '((access-file . ignore)
89 (add-name-to-file . tramp-adb-handle-copy-file)
90 ;; `byte-compiler-base-file-name' performed by default handler.
91 ;; `copy-directory' performed by default handler.
92 (copy-file . tramp-adb-handle-copy-file)
93 (delete-directory . tramp-adb-handle-delete-directory)
94 (delete-file . tramp-adb-handle-delete-file)
95 ;; `diff-latest-backup-file' performed by default handler.
96 (directory-file-name . tramp-handle-directory-file-name)
97 (directory-files . tramp-handle-directory-files)
98 (directory-files-and-attributes
99 . tramp-adb-handle-directory-files-and-attributes)
100 (dired-call-process . ignore)
101 (dired-compress-file . ignore)
89 (dired-uncache . tramp-handle-dired-uncache) 102 (dired-uncache . tramp-handle-dired-uncache)
103 (expand-file-name . tramp-adb-handle-expand-file-name)
104 (file-accessible-directory-p . tramp-handle-file-accessible-directory-p)
105 (file-acl . ignore)
106 (file-attributes . tramp-adb-handle-file-attributes)
107 (file-directory-p . tramp-adb-handle-file-directory-p)
108 ;; `file-equal-p' performed by default handler.
109 ;; FIXME: This is too sloppy.
110 (file-executable-p . tramp-handle-file-exists-p)
111 (file-exists-p . tramp-handle-file-exists-p)
112 ;; `file-in-directory-p' performed by default handler.
113 (file-local-copy . tramp-adb-handle-file-local-copy)
114 (file-modes . tramp-handle-file-modes)
115 (file-name-all-completions . tramp-adb-handle-file-name-all-completions)
90 (file-name-as-directory . tramp-handle-file-name-as-directory) 116 (file-name-as-directory . tramp-handle-file-name-as-directory)
91 (file-name-completion . tramp-handle-file-name-completion) 117 (file-name-completion . tramp-handle-file-name-completion)
92 (file-name-all-completions . tramp-adb-handle-file-name-all-completions)
93 (file-attributes . tramp-adb-handle-file-attributes)
94 (file-name-directory . tramp-handle-file-name-directory) 118 (file-name-directory . tramp-handle-file-name-directory)
95 (file-name-nondirectory . tramp-handle-file-name-nondirectory) 119 (file-name-nondirectory . tramp-handle-file-name-nondirectory)
96 (file-truename . tramp-adb-handle-file-truename) 120 ;; `file-name-sans-versions' performed by default handler.
97 (file-newer-than-file-p . tramp-handle-file-newer-than-file-p) 121 (file-newer-than-file-p . tramp-handle-file-newer-than-file-p)
98 (file-name-as-directory . tramp-handle-file-name-as-directory) 122 (file-notify-add-watch . tramp-handle-file-notify-add-watch)
123 (file-notify-rm-watch . tramp-handle-file-notify-rm-watch)
124 (file-ownership-preserved-p . ignore)
125 (file-readable-p . tramp-handle-file-exists-p)
99 (file-regular-p . tramp-handle-file-regular-p) 126 (file-regular-p . tramp-handle-file-regular-p)
100 (file-remote-p . tramp-handle-file-remote-p) 127 (file-remote-p . tramp-handle-file-remote-p)
101 (file-accessible-directory-p . tramp-handle-file-accessible-directory-p) 128 (file-selinux-context . ignore)
102 (file-directory-p . tramp-adb-handle-file-directory-p)
103 (file-symlink-p . tramp-handle-file-symlink-p) 129 (file-symlink-p . tramp-handle-file-symlink-p)
104 ;; FIXME: This is too sloppy. 130 (file-truename . tramp-adb-handle-file-truename)
105 (file-executable-p . tramp-handle-file-exists-p)
106 (file-exists-p . tramp-handle-file-exists-p)
107 (file-readable-p . tramp-handle-file-exists-p)
108 (file-writable-p . tramp-adb-handle-file-writable-p) 131 (file-writable-p . tramp-adb-handle-file-writable-p)
109 (file-local-copy . tramp-adb-handle-file-local-copy)
110 (file-modes . tramp-handle-file-modes)
111 (file-notify-add-watch . tramp-handle-file-notify-add-watch)
112 (file-notify-rm-watch . ignore)
113 (expand-file-name . tramp-adb-handle-expand-file-name)
114 (find-backup-file-name . tramp-handle-find-backup-file-name) 132 (find-backup-file-name . tramp-handle-find-backup-file-name)
115 (directory-files . tramp-handle-directory-files) 133 ;; `find-file-noselect' performed by default handler.
116 (directory-files-and-attributes 134 ;; `get-file-buffer' performed by default handler.
117 . tramp-adb-handle-directory-files-and-attributes)
118 (make-directory . tramp-adb-handle-make-directory)
119 (delete-directory . tramp-adb-handle-delete-directory)
120 (delete-file . tramp-adb-handle-delete-file)
121 (load . tramp-handle-load)
122 (insert-directory . tramp-adb-handle-insert-directory) 135 (insert-directory . tramp-adb-handle-insert-directory)
123 (insert-file-contents . tramp-handle-insert-file-contents) 136 (insert-file-contents . tramp-handle-insert-file-contents)
124 (substitute-in-file-name . tramp-handle-substitute-in-file-name) 137 (load . tramp-handle-load)
125 (unhandled-file-name-directory . tramp-handle-unhandled-file-name-directory) 138 ;; `make-auto-save-file-name' performed by default handler.
126 (vc-registered . ignore) ;no vc control files on Android devices 139 (make-directory . tramp-adb-handle-make-directory)
127 (write-region . tramp-adb-handle-write-region) 140 (make-directory-internal . ignore)
141 (make-symbolic-link . ignore)
142 (process-file . tramp-adb-handle-process-file)
143 (rename-file . tramp-adb-handle-rename-file)
144 (set-file-acl . ignore)
128 (set-file-modes . tramp-adb-handle-set-file-modes) 145 (set-file-modes . tramp-adb-handle-set-file-modes)
146 (set-file-selinux-context . ignore)
129 (set-file-times . tramp-adb-handle-set-file-times) 147 (set-file-times . tramp-adb-handle-set-file-times)
130 (copy-file . tramp-adb-handle-copy-file) 148 (set-visited-file-modtime . tramp-handle-set-visited-file-modtime)
131 (rename-file . tramp-adb-handle-rename-file)
132 (process-file . tramp-adb-handle-process-file)
133 (shell-command . tramp-adb-handle-shell-command) 149 (shell-command . tramp-adb-handle-shell-command)
134 (start-file-process . tramp-adb-handle-start-file-process)) 150 (start-file-process . tramp-adb-handle-start-file-process)
151 (substitute-in-file-name . tramp-handle-substitute-in-file-name)
152 (unhandled-file-name-directory . tramp-handle-unhandled-file-name-directory)
153 (vc-registered . ignore)
154 (verify-visited-file-modtime . tramp-handle-verify-visited-file-modtime)
155 (write-region . tramp-adb-handle-write-region))
135 "Alist of handler functions for Tramp ADB method.") 156 "Alist of handler functions for Tramp ADB method.")
136 157
137;; It must be a `defsubst' in order to push the whole code into 158;; It must be a `defsubst' in order to push the whole code into
@@ -599,6 +620,9 @@ But handle the case, if the \"test\" command is not available."
599 (tramp-error v 'file-error "Cannot write: `%s' filename")) 620 (tramp-error v 'file-error "Cannot write: `%s' filename"))
600 (delete-file tmpfile))) 621 (delete-file tmpfile)))
601 622
623 (when (or (eq visit t) (stringp visit))
624 (set-visited-file-modtime))
625
602 (unless (equal curbuf (current-buffer)) 626 (unless (equal curbuf (current-buffer))
603 (tramp-error 627 (tramp-error
604 v 'file-error 628 v 'file-error
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index e25c9bd4caf..5bb30b04643 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -403,10 +403,10 @@ Every entry is a list (NAME ADDRESS).")
403 403
404;; New handlers should be added here. 404;; New handlers should be added here.
405(defconst tramp-gvfs-file-name-handler-alist 405(defconst tramp-gvfs-file-name-handler-alist
406 '( 406 '((access-file . ignore)
407 (access-file . ignore)
408 (add-name-to-file . tramp-gvfs-handle-copy-file) 407 (add-name-to-file . tramp-gvfs-handle-copy-file)
409 ;; `byte-compiler-base-file-name' performed by default handler. 408 ;; `byte-compiler-base-file-name' performed by default handler.
409 ;; `copy-directory' performed by default handler.
410 (copy-file . tramp-gvfs-handle-copy-file) 410 (copy-file . tramp-gvfs-handle-copy-file)
411 (delete-directory . tramp-gvfs-handle-delete-directory) 411 (delete-directory . tramp-gvfs-handle-delete-directory)
412 (delete-file . tramp-gvfs-handle-delete-file) 412 (delete-file . tramp-gvfs-handle-delete-file)
@@ -418,14 +418,15 @@ Every entry is a list (NAME ADDRESS).")
418 (dired-call-process . ignore) 418 (dired-call-process . ignore)
419 (dired-compress-file . ignore) 419 (dired-compress-file . ignore)
420 (dired-uncache . tramp-handle-dired-uncache) 420 (dired-uncache . tramp-handle-dired-uncache)
421 ;; `executable-find' is not official yet. performed by default handler.
422 (expand-file-name . tramp-gvfs-handle-expand-file-name) 421 (expand-file-name . tramp-gvfs-handle-expand-file-name)
423 (file-accessible-directory-p . tramp-handle-file-accessible-directory-p) 422 (file-accessible-directory-p . tramp-handle-file-accessible-directory-p)
424 (file-acl . ignore) 423 (file-acl . ignore)
425 (file-attributes . tramp-gvfs-handle-file-attributes) 424 (file-attributes . tramp-gvfs-handle-file-attributes)
426 (file-directory-p . tramp-gvfs-handle-file-directory-p) 425 (file-directory-p . tramp-gvfs-handle-file-directory-p)
426 ;; `file-equal-p' performed by default handler.
427 (file-executable-p . tramp-gvfs-handle-file-executable-p) 427 (file-executable-p . tramp-gvfs-handle-file-executable-p)
428 (file-exists-p . tramp-handle-file-exists-p) 428 (file-exists-p . tramp-handle-file-exists-p)
429 ;; `file-in-directory-p' performed by default handler.
429 (file-local-copy . tramp-gvfs-handle-file-local-copy) 430 (file-local-copy . tramp-gvfs-handle-file-local-copy)
430 (file-modes . tramp-handle-file-modes) 431 (file-modes . tramp-handle-file-modes)
431 (file-name-all-completions . tramp-gvfs-handle-file-name-all-completions) 432 (file-name-all-completions . tramp-gvfs-handle-file-name-all-completions)
@@ -435,8 +436,8 @@ Every entry is a list (NAME ADDRESS).")
435 (file-name-nondirectory . tramp-handle-file-name-nondirectory) 436 (file-name-nondirectory . tramp-handle-file-name-nondirectory)
436 ;; `file-name-sans-versions' performed by default handler. 437 ;; `file-name-sans-versions' performed by default handler.
437 (file-newer-than-file-p . tramp-handle-file-newer-than-file-p) 438 (file-newer-than-file-p . tramp-handle-file-newer-than-file-p)
438 (file-notify-add-watch . tramp-handle-file-notify-add-watch) 439 (file-notify-add-watch . tramp-gvfs-handle-file-notify-add-watch)
439 (file-notify-rm-watch . ignore) 440 (file-notify-rm-watch . tramp-handle-file-notify-rm-watch)
440 (file-ownership-preserved-p . ignore) 441 (file-ownership-preserved-p . ignore)
441 (file-readable-p . tramp-gvfs-handle-file-readable-p) 442 (file-readable-p . tramp-gvfs-handle-file-readable-p)
442 (file-regular-p . tramp-handle-file-regular-p) 443 (file-regular-p . tramp-handle-file-regular-p)
@@ -451,6 +452,7 @@ Every entry is a list (NAME ADDRESS).")
451 (insert-directory . tramp-gvfs-handle-insert-directory) 452 (insert-directory . tramp-gvfs-handle-insert-directory)
452 (insert-file-contents . tramp-gvfs-handle-insert-file-contents) 453 (insert-file-contents . tramp-gvfs-handle-insert-file-contents)
453 (load . tramp-handle-load) 454 (load . tramp-handle-load)
455 ;; `make-auto-save-file-name' performed by default handler.
454 (make-directory . tramp-gvfs-handle-make-directory) 456 (make-directory . tramp-gvfs-handle-make-directory)
455 (make-directory-internal . ignore) 457 (make-directory-internal . ignore)
456 (make-symbolic-link . ignore) 458 (make-symbolic-link . ignore)
@@ -459,15 +461,15 @@ Every entry is a list (NAME ADDRESS).")
459 (set-file-acl . ignore) 461 (set-file-acl . ignore)
460 (set-file-modes . ignore) 462 (set-file-modes . ignore)
461 (set-file-selinux-context . ignore) 463 (set-file-selinux-context . ignore)
462 (set-visited-file-modtime . tramp-gvfs-handle-set-visited-file-modtime) 464 (set-file-times . ignore)
465 (set-visited-file-modtime . tramp-handle-set-visited-file-modtime)
463 (shell-command . ignore) 466 (shell-command . ignore)
464 (start-file-process . ignore) 467 (start-file-process . ignore)
465 (substitute-in-file-name . tramp-handle-substitute-in-file-name) 468 (substitute-in-file-name . tramp-handle-substitute-in-file-name)
466 (unhandled-file-name-directory . tramp-handle-unhandled-file-name-directory) 469 (unhandled-file-name-directory . tramp-handle-unhandled-file-name-directory)
467 (vc-registered . ignore) 470 (vc-registered . ignore)
468 ;; `verify-visited-file-modtime' performed by default handler. 471 (verify-visited-file-modtime . tramp-handle-verify-visited-file-modtime)
469 (write-region . tramp-gvfs-handle-write-region) 472 (write-region . tramp-gvfs-handle-write-region))
470)
471 "Alist of handler functions for Tramp GVFS method. 473 "Alist of handler functions for Tramp GVFS method.
472Operations not mentioned here will be handled by the default Emacs primitives.") 474Operations not mentioned here will be handled by the default Emacs primitives.")
473 475
@@ -555,28 +557,6 @@ will be traced by Tramp with trace level 6."
555(tramp-compat-font-lock-add-keywords 557(tramp-compat-font-lock-add-keywords
556 'emacs-lisp-mode '("\\<with-tramp-dbus-call-method\\>")) 558 'emacs-lisp-mode '("\\<with-tramp-dbus-call-method\\>"))
557 559
558(defmacro with-tramp-gvfs-error-message (filename handler &rest args)
559 "Apply a Tramp GVFS `handler'.
560In case of an error, modify the error message by replacing
561`filename' with its GVFS mounted name."
562 `(let ((fuse-file-name (regexp-quote (tramp-gvfs-fuse-file-name ,filename)))
563 elt)
564 (condition-case err
565 (tramp-compat-funcall ,handler ,@args)
566 (error
567 (setq elt (cdr err))
568 (while elt
569 (when (and (stringp (car elt))
570 (string-match fuse-file-name (car elt)))
571 (setcar elt (replace-match ,filename t t (car elt))))
572 (setq elt (cdr elt)))
573 (signal (car err) (cdr err))))))
574
575(put 'with-tramp-gvfs-error-message 'lisp-indent-function 2)
576(put 'with-tramp-gvfs-error-message 'edebug-form-spec '(form symbolp body))
577(tramp-compat-font-lock-add-keywords
578 'emacs-lisp-mode '("\\<with-tramp-gvfs-error-message\\>"))
579
580(defvar tramp-gvfs-dbus-event-vector nil 560(defvar tramp-gvfs-dbus-event-vector nil
581 "Current Tramp file name to be used, as vector. 561 "Current Tramp file name to be used, as vector.
582It is needed when D-Bus signals or errors arrive, because there 562It is needed when D-Bus signals or errors arrive, because there
@@ -943,6 +923,64 @@ is no information where to trace the message.")
943 v (concat localname filename) 923 v (concat localname filename)
944 "file-name-all-completions" result)))))))) 924 "file-name-all-completions" result))))))))
945 925
926(defun tramp-gvfs-handle-file-notify-add-watch (file-name flags callback)
927 "Like `file-notify-add-watch' for Tramp files."
928 (setq file-name (expand-file-name file-name))
929 (with-parsed-tramp-file-name file-name nil
930 (let ((p (start-process
931 "gvfs-monitor-file" (generate-new-buffer " *gvfs-monitor-file*")
932 "gvfs-monitor-file" (tramp-gvfs-url-file-name file-name))))
933 (if (not (processp p))
934 (tramp-error
935 v 'file-notify-error "gvfs-monitor-file failed to start")
936 (tramp-compat-set-process-query-on-exit-flag p nil)
937 (set-process-filter p 'tramp-gvfs-file-gvfs-monitor-file-process-filter)
938 (with-current-buffer (process-buffer p)
939 (setq default-directory (file-name-directory file-name)))
940 p))))
941
942(defun tramp-gvfs-file-gvfs-monitor-file-process-filter (proc string)
943 "Read output from \"gvfs-monitor-file\" and add corresponding file-notify events."
944 (let* ((rest-string (tramp-compat-process-get proc 'rest-string))
945 (dd (with-current-buffer (process-buffer proc) default-directory))
946 (ddu (regexp-quote (tramp-gvfs-url-file-name dd))))
947 (when rest-string
948 (tramp-message proc 10 "Previous string:\n%s" rest-string))
949 (tramp-message proc 6 "%S\n%s" proc string)
950 (setq string (concat rest-string string)
951 ;; Attribute change is returned in unused wording.
952 string (replace-regexp-in-string
953 "ATTRIB CHANGED" "ATTRIBUTE_CHANGED" string))
954
955 (while (string-match
956 (concat "^[\n\r]*"
957 "File Monitor Event:[\n\r]+"
958 "File = \\([^\n\r]+\\)[\n\r]+"
959 "Event = \\([^[:blank:]]+\\)[\n\r]+")
960 string)
961 (let ((action (intern-soft
962 (replace-regexp-in-string
963 "_" "-" (downcase (match-string 2 string)))))
964 (file (match-string 1 string)))
965 (setq string (replace-match "" nil nil string))
966 ;; File names are returned as URL paths. We must convert them.
967 (when (string-match ddu file)
968 (setq file (replace-match dd nil nil file)))
969 (while (string-match "%\\([0-9A-F]\\{2\\}\\)" file)
970 (setq file
971 (replace-match
972 (char-to-string (string-to-number (match-string 1 file) 16))
973 nil nil file)))
974 ;; Usually, we would add an Emacs event now. Unfortunately,
975 ;; `unread-command-events' does not accept several events at
976 ;; once. Therefore, we apply the callback directly.
977 (tramp-compat-funcall 'file-notify-callback (list proc action file))))
978
979 ;; Save rest of the string.
980 (when (zerop (length string)) (setq string nil))
981 (when string (tramp-message proc 10 "Rest string:\n%s" string))
982 (tramp-compat-process-put proc 'rest-string string)))
983
946(defun tramp-gvfs-handle-file-readable-p (filename) 984(defun tramp-gvfs-handle-file-readable-p (filename)
947 "Like `file-readable-p' for Tramp files." 985 "Like `file-readable-p' for Tramp files."
948 (with-parsed-tramp-file-name filename nil 986 (with-parsed-tramp-file-name filename nil
@@ -1054,22 +1092,6 @@ is no information where to trace the message.")
1054 (tramp-flush-file-property v (file-name-directory localname)) 1092 (tramp-flush-file-property v (file-name-directory localname))
1055 (tramp-flush-file-property v localname)))))) 1093 (tramp-flush-file-property v localname))))))
1056 1094
1057(defun tramp-gvfs-handle-set-visited-file-modtime (&optional time-list)
1058 "Like `set-visited-file-modtime' for Tramp files."
1059 (unless (buffer-file-name)
1060 (error "Can't set-visited-file-modtime: buffer `%s' not visiting a file"
1061 (buffer-name)))
1062 (unless time-list
1063 (let ((f (buffer-file-name)))
1064 (with-parsed-tramp-file-name f nil
1065 (let ((remote-file-name-inhibit-cache t)
1066 (attr (file-attributes f)))
1067 ;; '(-1 65535) means file doesn't exists yet.
1068 (setq time-list (or (nth 5 attr) '(-1 65535)))))))
1069 ;; We use '(0 0) as a don't-know value.
1070 (unless (not (equal time-list '(0 0)))
1071 (tramp-run-real-handler 'set-visited-file-modtime (list time-list))))
1072
1073(defun tramp-gvfs-handle-write-region 1095(defun tramp-gvfs-handle-write-region
1074 (start end filename &optional append visit lockname confirm) 1096 (start end filename &optional append visit lockname confirm)
1075 "Like `write-region' for Tramp files." 1097 "Like `write-region' for Tramp files."
@@ -1082,7 +1104,7 @@ is no information where to trace the message.")
1082 (let ((tmpfile (tramp-compat-make-temp-file filename))) 1104 (let ((tmpfile (tramp-compat-make-temp-file filename)))
1083 (write-region start end tmpfile) 1105 (write-region start end tmpfile)
1084 (condition-case nil 1106 (condition-case nil
1085 (rename-file tmpfile filename) 1107 (rename-file tmpfile filename 'ok-if-already-exists)
1086 (error 1108 (error
1087 (delete-file tmpfile) 1109 (delete-file tmpfile)
1088 (tramp-error 1110 (tramp-error
@@ -1137,24 +1159,6 @@ is no information where to trace the message.")
1137 (dbus-unescape-from-identifier 1159 (dbus-unescape-from-identifier
1138 (replace-regexp-in-string "^.*/\\([^/]+\\)$" "\\1" object-path))) 1160 (replace-regexp-in-string "^.*/\\([^/]+\\)$" "\\1" object-path)))
1139 1161
1140(defun tramp-gvfs-fuse-file-name (filename)
1141 "Return FUSE file name, which is directly accessible."
1142 (with-parsed-tramp-file-name (expand-file-name filename) nil
1143 (tramp-gvfs-maybe-open-connection v)
1144 (let ((prefix (tramp-get-file-property v "/" "prefix" ""))
1145 (fuse-mountpoint
1146 (tramp-get-file-property v "/" "fuse-mountpoint" nil)))
1147 (unless fuse-mountpoint
1148 (tramp-error
1149 v 'file-error "There is no FUSE mount point for `%s'" filename))
1150 ;; We must hide the prefix, if any.
1151 (when (string-match (concat "^" (regexp-quote prefix)) localname)
1152 (setq localname (replace-match "" t t localname)))
1153 (tramp-message
1154 v 10 "remote file `%s' is local file `%s'"
1155 filename (concat fuse-mountpoint localname))
1156 (concat fuse-mountpoint localname))))
1157
1158(defun tramp-bluez-address (device) 1162(defun tramp-bluez-address (device)
1159 "Return bluetooth device address from a given bluetooth DEVICE name." 1163 "Return bluetooth device address from a given bluetooth DEVICE name."
1160 (when (stringp device) 1164 (when (stringp device)
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 441849fd2af..f9e68d0dad0 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -801,73 +801,78 @@ existence, and file readability. Input shall be read via
801here-document, otherwise the command could exceed maximum length 801here-document, otherwise the command could exceed maximum length
802of command line.") 802of command line.")
803 803
804;; New handlers should be added here. The following operations can be 804;; New handlers should be added here.
805;; handled using the normal primitives: file-name-sans-versions,
806;; get-file-buffer.
807(defconst tramp-sh-file-name-handler-alist 805(defconst tramp-sh-file-name-handler-alist
808 '((load . tramp-handle-load) 806 '(;; `access-file' performed by default handler.
809 (make-symbolic-link . tramp-sh-handle-make-symbolic-link)
810 (file-name-as-directory . tramp-handle-file-name-as-directory)
811 (file-name-directory . tramp-handle-file-name-directory)
812 (file-name-nondirectory . tramp-handle-file-name-nondirectory)
813 (file-truename . tramp-sh-handle-file-truename)
814 (file-exists-p . tramp-sh-handle-file-exists-p)
815 (file-accessible-directory-p . tramp-handle-file-accessible-directory-p)
816 (file-directory-p . tramp-sh-handle-file-directory-p)
817 (file-executable-p . tramp-sh-handle-file-executable-p)
818 (file-readable-p . tramp-sh-handle-file-readable-p)
819 (file-regular-p . tramp-handle-file-regular-p)
820 (file-symlink-p . tramp-handle-file-symlink-p)
821 (file-writable-p . tramp-sh-handle-file-writable-p)
822 (file-ownership-preserved-p . tramp-sh-handle-file-ownership-preserved-p)
823 (file-newer-than-file-p . tramp-sh-handle-file-newer-than-file-p)
824 (file-attributes . tramp-sh-handle-file-attributes)
825 (file-modes . tramp-handle-file-modes)
826 (directory-files . tramp-handle-directory-files)
827 (directory-files-and-attributes
828 . tramp-sh-handle-directory-files-and-attributes)
829 (file-name-all-completions . tramp-sh-handle-file-name-all-completions)
830 (file-name-completion . tramp-handle-file-name-completion)
831 (add-name-to-file . tramp-sh-handle-add-name-to-file) 807 (add-name-to-file . tramp-sh-handle-add-name-to-file)
832 (copy-file . tramp-sh-handle-copy-file) 808 ;; `byte-compiler-base-file-name' performed by default handler.
833 (copy-directory . tramp-sh-handle-copy-directory) 809 (copy-directory . tramp-sh-handle-copy-directory)
834 (rename-file . tramp-sh-handle-rename-file) 810 (copy-file . tramp-sh-handle-copy-file)
835 (set-file-modes . tramp-sh-handle-set-file-modes)
836 (set-file-times . tramp-sh-handle-set-file-times)
837 (make-directory . tramp-sh-handle-make-directory)
838 (delete-directory . tramp-sh-handle-delete-directory) 811 (delete-directory . tramp-sh-handle-delete-directory)
839 (delete-file . tramp-sh-handle-delete-file) 812 (delete-file . tramp-sh-handle-delete-file)
813 ;; `diff-latest-backup-file' performed by default handler.
840 (directory-file-name . tramp-handle-directory-file-name) 814 (directory-file-name . tramp-handle-directory-file-name)
841 ;; `executable-find' is not official yet. 815 (directory-files . tramp-handle-directory-files)
842 (executable-find . tramp-sh-handle-executable-find) 816 (directory-files-and-attributes
843 (start-file-process . tramp-sh-handle-start-file-process) 817 . tramp-sh-handle-directory-files-and-attributes)
844 (process-file . tramp-sh-handle-process-file) 818 ;; `dired-call-process' performed by default handler.
845 (shell-command . tramp-handle-shell-command) 819 (dired-compress-file . tramp-sh-handle-dired-compress-file)
846 (insert-directory . tramp-sh-handle-insert-directory) 820 (dired-recursive-delete-directory
821 . tramp-sh-handle-dired-recursive-delete-directory)
822 (dired-uncache . tramp-handle-dired-uncache)
847 (expand-file-name . tramp-sh-handle-expand-file-name) 823 (expand-file-name . tramp-sh-handle-expand-file-name)
848 (substitute-in-file-name . tramp-handle-substitute-in-file-name) 824 (file-accessible-directory-p . tramp-handle-file-accessible-directory-p)
825 (file-acl . tramp-sh-handle-file-acl)
826 (file-attributes . tramp-sh-handle-file-attributes)
827 (file-directory-p . tramp-sh-handle-file-directory-p)
828 ;; `file-equal-p' performed by default handler.
829 (file-executable-p . tramp-sh-handle-file-executable-p)
830 (file-exists-p . tramp-sh-handle-file-exists-p)
831 ;; `file-in-directory-p' performed by default handler.
849 (file-local-copy . tramp-sh-handle-file-local-copy) 832 (file-local-copy . tramp-sh-handle-file-local-copy)
833 (file-modes . tramp-handle-file-modes)
834 (file-name-all-completions . tramp-sh-handle-file-name-all-completions)
835 (file-name-as-directory . tramp-handle-file-name-as-directory)
836 (file-name-completion . tramp-handle-file-name-completion)
837 (file-name-directory . tramp-handle-file-name-directory)
838 (file-name-nondirectory . tramp-handle-file-name-nondirectory)
839 ;; `file-name-sans-versions' performed by default handler.
840 (file-newer-than-file-p . tramp-sh-handle-file-newer-than-file-p)
841 (file-notify-add-watch . tramp-sh-handle-file-notify-add-watch)
842 (file-notify-rm-watch . tramp-handle-file-notify-rm-watch)
843 (file-ownership-preserved-p . tramp-sh-handle-file-ownership-preserved-p)
844 (file-readable-p . tramp-sh-handle-file-readable-p)
845 (file-regular-p . tramp-handle-file-regular-p)
850 (file-remote-p . tramp-handle-file-remote-p) 846 (file-remote-p . tramp-handle-file-remote-p)
847 (file-selinux-context . tramp-sh-handle-file-selinux-context)
848 (file-symlink-p . tramp-handle-file-symlink-p)
849 (file-truename . tramp-sh-handle-file-truename)
850 (file-writable-p . tramp-sh-handle-file-writable-p)
851 (find-backup-file-name . tramp-handle-find-backup-file-name)
852 ;; `find-file-noselect' performed by default handler.
853 ;; `get-file-buffer' performed by default handler.
854 (insert-directory . tramp-sh-handle-insert-directory)
851 (insert-file-contents . tramp-handle-insert-file-contents) 855 (insert-file-contents . tramp-handle-insert-file-contents)
852 (insert-file-contents-literally 856 (insert-file-contents-literally
853 . tramp-sh-handle-insert-file-contents-literally) 857 . tramp-sh-handle-insert-file-contents-literally)
854 (write-region . tramp-sh-handle-write-region) 858 (load . tramp-handle-load)
855 (find-backup-file-name . tramp-handle-find-backup-file-name)
856 (make-auto-save-file-name . tramp-sh-handle-make-auto-save-file-name) 859 (make-auto-save-file-name . tramp-sh-handle-make-auto-save-file-name)
857 (unhandled-file-name-directory . tramp-handle-unhandled-file-name-directory) 860 (make-directory . tramp-sh-handle-make-directory)
858 (dired-compress-file . tramp-sh-handle-dired-compress-file) 861 (make-symbolic-link . tramp-sh-handle-make-symbolic-link)
859 (dired-recursive-delete-directory 862 (process-file . tramp-sh-handle-process-file)
860 . tramp-sh-handle-dired-recursive-delete-directory) 863 (rename-file . tramp-sh-handle-rename-file)
861 (dired-uncache . tramp-handle-dired-uncache)
862 (set-visited-file-modtime . tramp-sh-handle-set-visited-file-modtime)
863 (verify-visited-file-modtime . tramp-sh-handle-verify-visited-file-modtime)
864 (file-selinux-context . tramp-sh-handle-file-selinux-context)
865 (set-file-selinux-context . tramp-sh-handle-set-file-selinux-context)
866 (file-acl . tramp-sh-handle-file-acl)
867 (set-file-acl . tramp-sh-handle-set-file-acl) 864 (set-file-acl . tramp-sh-handle-set-file-acl)
865 (set-file-modes . tramp-sh-handle-set-file-modes)
866 (set-file-selinux-context . tramp-sh-handle-set-file-selinux-context)
867 (set-file-times . tramp-sh-handle-set-file-times)
868 (set-visited-file-modtime . tramp-sh-handle-set-visited-file-modtime)
869 (shell-command . tramp-handle-shell-command)
870 (start-file-process . tramp-sh-handle-start-file-process)
871 (substitute-in-file-name . tramp-handle-substitute-in-file-name)
872 (unhandled-file-name-directory . tramp-handle-unhandled-file-name-directory)
868 (vc-registered . tramp-sh-handle-vc-registered) 873 (vc-registered . tramp-sh-handle-vc-registered)
869 (file-notify-add-watch . tramp-sh-handle-file-notify-add-watch) 874 (verify-visited-file-modtime . tramp-sh-handle-verify-visited-file-modtime)
870 (file-notify-rm-watch . tramp-sh-handle-file-notify-rm-watch)) 875 (write-region . tramp-sh-handle-write-region))
871 "Alist of handler functions. 876 "Alist of handler functions.
872Operations not mentioned here will be handled by the normal Emacs functions.") 877Operations not mentioned here will be handled by the normal Emacs functions.")
873 878
@@ -2284,9 +2289,7 @@ The method used must be an out-of-band method."
2284 (tramp-get-method-parameter method 'tramp-copy-env)))) 2289 (tramp-get-method-parameter method 'tramp-copy-env))))
2285 2290
2286 ;; Check for program. 2291 ;; Check for program.
2287 (unless (let ((default-directory 2292 (unless (executable-find copy-program)
2288 (tramp-compat-temporary-file-directory)))
2289 (executable-find copy-program))
2290 (tramp-error 2293 (tramp-error
2291 v 'file-error "Cannot find copy program: %s" copy-program)) 2294 v 'file-error "Cannot find copy program: %s" copy-program))
2292 2295
@@ -2667,11 +2670,6 @@ the result will be a local, non-Tramp, filename."
2667 2670
2668;;; Remote commands: 2671;;; Remote commands:
2669 2672
2670(defun tramp-sh-handle-executable-find (command)
2671 "Like `executable-find' for Tramp files."
2672 (with-parsed-tramp-file-name default-directory nil
2673 (tramp-find-executable v command (tramp-get-remote-path v) t)))
2674
2675(defun tramp-process-sentinel (proc event) 2673(defun tramp-process-sentinel (proc event)
2676 "Flush file caches." 2674 "Flush file caches."
2677 (unless (memq (process-status proc) '(run open)) 2675 (unless (memq (process-status proc) '(run open))
@@ -3430,8 +3428,8 @@ Fall back to normal file name handler if no Tramp handler exists."
3430 (file-remote-p default-directory))) 3428 (file-remote-p default-directory)))
3431 (rest-string (tramp-compat-process-get proc 'rest-string))) 3429 (rest-string (tramp-compat-process-get proc 'rest-string)))
3432 (when rest-string 3430 (when rest-string
3433 (tramp-message proc 10 (format "Previous string:\n%s" rest-string))) 3431 (tramp-message proc 10 "Previous string:\n%s" rest-string))
3434 (tramp-message proc 6 (format "%S\n%s" proc string)) 3432 (tramp-message proc 6 "%S\n%s" proc string)
3435 (setq string (concat rest-string string) 3433 (setq string (concat rest-string string)
3436 ;; Attribute change is returned in unused wording. 3434 ;; Attribute change is returned in unused wording.
3437 string (replace-regexp-in-string 3435 string (replace-regexp-in-string
@@ -3463,12 +3461,12 @@ Fall back to normal file name handler if no Tramp handler exists."
3463 3461
3464 ;; Save rest of the string. 3462 ;; Save rest of the string.
3465 (when (zerop (length string)) (setq string nil)) 3463 (when (zerop (length string)) (setq string nil))
3466 (when string (tramp-message proc 10 (format "Rest string:\n%s" string))) 3464 (when string (tramp-message proc 10 "Rest string:\n%s" string))
3467 (tramp-compat-process-put proc 'rest-string string))) 3465 (tramp-compat-process-put proc 'rest-string string)))
3468 3466
3469(defun tramp-sh-file-inotifywait-process-filter (proc string) 3467(defun tramp-sh-file-inotifywait-process-filter (proc string)
3470 "Read output from \"inotifywait\" and add corresponding file-notify events." 3468 "Read output from \"inotifywait\" and add corresponding file-notify events."
3471 (tramp-message proc 6 (format "%S\n%s" proc string)) 3469 (tramp-message proc 6 "%S\n%s" proc string)
3472 (dolist (line (split-string string "[\n\r]+" 'omit-nulls)) 3470 (dolist (line (split-string string "[\n\r]+" 'omit-nulls))
3473 ;; Check, whether there is a problem. 3471 ;; Check, whether there is a problem.
3474 (unless 3472 (unless
@@ -3492,15 +3490,6 @@ Fall back to normal file name handler if no Tramp handler exists."
3492 ;; once. Therefore, we apply the callback directly. 3490 ;; once. Therefore, we apply the callback directly.
3493 (tramp-compat-funcall 'file-notify-callback object)))) 3491 (tramp-compat-funcall 'file-notify-callback object))))
3494 3492
3495(defvar file-notify-descriptors)
3496(defun tramp-sh-handle-file-notify-rm-watch (proc)
3497 "Like `file-notify-rm-watch' for Tramp files."
3498 ;; The descriptor must be a process object.
3499 (unless (and (processp proc) (gethash proc file-notify-descriptors))
3500 (tramp-error proc 'file-notify-error "Not a valid descriptor %S" proc))
3501 (tramp-message proc 6 (format "Kill %S" proc))
3502 (kill-process proc))
3503
3504;;; Internal Functions: 3493;;; Internal Functions:
3505 3494
3506(defun tramp-maybe-send-script (vec script name) 3495(defun tramp-maybe-send-script (vec script name)
@@ -3618,7 +3607,7 @@ This function expects to be in the right *tramp* buffer."
3618I.e., for each directory in `tramp-remote-path', it is tested 3607I.e., for each directory in `tramp-remote-path', it is tested
3619whether it exists and if so, it is added to the environment 3608whether it exists and if so, it is added to the environment
3620variable PATH." 3609variable PATH."
3621 (tramp-message vec 5 (format "Setting $PATH environment variable")) 3610 (tramp-message vec 5 "Setting $PATH environment variable")
3622 (tramp-send-command 3611 (tramp-send-command
3623 vec (format "PATH=%s; export PATH" 3612 vec (format "PATH=%s; export PATH"
3624 (mapconcat 'identity (tramp-get-remote-path vec) ":")))) 3613 (mapconcat 'identity (tramp-get-remote-path vec) ":"))))
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index fee34f856dd..29847556dfe 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -177,8 +177,7 @@ See `tramp-actions-before-shell' for more info.")
177 177
178;; New handlers should be added here. 178;; New handlers should be added here.
179(defconst tramp-smb-file-name-handler-alist 179(defconst tramp-smb-file-name-handler-alist
180 '( 180 '(;; `access-file' performed by default handler.
181 ;; `access-file' performed by default handler.
182 (add-name-to-file . tramp-smb-handle-add-name-to-file) 181 (add-name-to-file . tramp-smb-handle-add-name-to-file)
183 ;; `byte-compiler-base-file-name' performed by default handler. 182 ;; `byte-compiler-base-file-name' performed by default handler.
184 (copy-directory . tramp-smb-handle-copy-directory) 183 (copy-directory . tramp-smb-handle-copy-directory)
@@ -198,8 +197,10 @@ See `tramp-actions-before-shell' for more info.")
198 (file-acl . tramp-smb-handle-file-acl) 197 (file-acl . tramp-smb-handle-file-acl)
199 (file-attributes . tramp-smb-handle-file-attributes) 198 (file-attributes . tramp-smb-handle-file-attributes)
200 (file-directory-p . tramp-smb-handle-file-directory-p) 199 (file-directory-p . tramp-smb-handle-file-directory-p)
200 ;; `file-equal-p' performed by default handler.
201 (file-executable-p . tramp-handle-file-exists-p) 201 (file-executable-p . tramp-handle-file-exists-p)
202 (file-exists-p . tramp-handle-file-exists-p) 202 (file-exists-p . tramp-handle-file-exists-p)
203 ;; `file-in-directory-p' performed by default handler.
203 (file-local-copy . tramp-smb-handle-file-local-copy) 204 (file-local-copy . tramp-smb-handle-file-local-copy)
204 (file-modes . tramp-handle-file-modes) 205 (file-modes . tramp-handle-file-modes)
205 (file-name-all-completions . tramp-smb-handle-file-name-all-completions) 206 (file-name-all-completions . tramp-smb-handle-file-name-all-completions)
@@ -210,7 +211,7 @@ See `tramp-actions-before-shell' for more info.")
210 ;; `file-name-sans-versions' performed by default handler. 211 ;; `file-name-sans-versions' performed by default handler.
211 (file-newer-than-file-p . tramp-handle-file-newer-than-file-p) 212 (file-newer-than-file-p . tramp-handle-file-newer-than-file-p)
212 (file-notify-add-watch . tramp-handle-file-notify-add-watch) 213 (file-notify-add-watch . tramp-handle-file-notify-add-watch)
213 (file-notify-rm-watch . ignore) 214 (file-notify-rm-watch . tramp-handle-file-notify-rm-watch)
214 (file-ownership-preserved-p . ignore) 215 (file-ownership-preserved-p . ignore)
215 (file-readable-p . tramp-handle-file-exists-p) 216 (file-readable-p . tramp-handle-file-exists-p)
216 (file-regular-p . tramp-handle-file-regular-p) 217 (file-regular-p . tramp-handle-file-regular-p)
@@ -225,6 +226,7 @@ See `tramp-actions-before-shell' for more info.")
225 (insert-directory . tramp-smb-handle-insert-directory) 226 (insert-directory . tramp-smb-handle-insert-directory)
226 (insert-file-contents . tramp-handle-insert-file-contents) 227 (insert-file-contents . tramp-handle-insert-file-contents)
227 (load . tramp-handle-load) 228 (load . tramp-handle-load)
229 ;; `make-auto-save-file-name' performed by default handler.
228 (make-directory . tramp-smb-handle-make-directory) 230 (make-directory . tramp-smb-handle-make-directory)
229 (make-directory-internal . tramp-smb-handle-make-directory-internal) 231 (make-directory-internal . tramp-smb-handle-make-directory-internal)
230 (make-symbolic-link . tramp-smb-handle-make-symbolic-link) 232 (make-symbolic-link . tramp-smb-handle-make-symbolic-link)
@@ -234,15 +236,14 @@ See `tramp-actions-before-shell' for more info.")
234 (set-file-modes . tramp-smb-handle-set-file-modes) 236 (set-file-modes . tramp-smb-handle-set-file-modes)
235 (set-file-selinux-context . ignore) 237 (set-file-selinux-context . ignore)
236 (set-file-times . ignore) 238 (set-file-times . ignore)
237 (set-visited-file-modtime . ignore) 239 (set-visited-file-modtime . tramp-handle-set-visited-file-modtime)
238 (shell-command . tramp-handle-shell-command) 240 (shell-command . tramp-handle-shell-command)
239 (start-file-process . tramp-smb-handle-start-file-process) 241 (start-file-process . tramp-smb-handle-start-file-process)
240 (substitute-in-file-name . tramp-smb-handle-substitute-in-file-name) 242 (substitute-in-file-name . tramp-smb-handle-substitute-in-file-name)
241 (unhandled-file-name-directory . tramp-handle-unhandled-file-name-directory) 243 (unhandled-file-name-directory . tramp-handle-unhandled-file-name-directory)
242 (vc-registered . ignore) 244 (vc-registered . ignore)
243 (verify-visited-file-modtime . ignore) 245 (verify-visited-file-modtime . tramp-handle-verify-visited-file-modtime)
244 (write-region . tramp-smb-handle-write-region) 246 (write-region . tramp-smb-handle-write-region))
245)
246 "Alist of handler functions for Tramp SMB method. 247 "Alist of handler functions for Tramp SMB method.
247Operations not mentioned here will be handled by the default Emacs primitives.") 248Operations not mentioned here will be handled by the default Emacs primitives.")
248 249
@@ -1786,9 +1787,7 @@ Returns nil if an error message has appeared."
1786 (tramp-get-buffer vec) 1787 (tramp-get-buffer vec)
1787 1788
1788 ;; Check for program. 1789 ;; Check for program.
1789 (unless (let ((default-directory 1790 (unless (executable-find tramp-smb-winexe-program)
1790 (tramp-compat-temporary-file-directory)))
1791 (executable-find tramp-smb-winexe-program))
1792 (tramp-error 1791 (tramp-error
1793 vec 'file-error "Cannot find program: %s" tramp-smb-winexe-program)) 1792 vec 'file-error "Cannot find program: %s" tramp-smb-winexe-program))
1794 1793
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 48e13004c36..8ce5f2eae9b 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1975,11 +1975,11 @@ ARGS are the arguments OPERATION has been called with."
1975 'dired-compress-file 'dired-uncache 1975 'dired-compress-file 'dired-uncache
1976 'file-accessible-directory-p 'file-attributes 1976 'file-accessible-directory-p 'file-attributes
1977 'file-directory-p 'file-executable-p 'file-exists-p 1977 'file-directory-p 'file-executable-p 'file-exists-p
1978 'file-local-copy 'file-remote-p 'file-modes 1978 'file-local-copy 'file-modes
1979 'file-name-as-directory 'file-name-directory 1979 'file-name-as-directory 'file-name-directory
1980 'file-name-nondirectory 'file-name-sans-versions 1980 'file-name-nondirectory 'file-name-sans-versions
1981 'file-ownership-preserved-p 'file-readable-p 1981 'file-ownership-preserved-p 'file-readable-p
1982 'file-regular-p 'file-symlink-p 'file-truename 1982 'file-regular-p 'file-remote-p 'file-symlink-p 'file-truename
1983 'file-writable-p 'find-backup-file-name 'find-file-noselect 1983 'file-writable-p 'find-backup-file-name 'find-file-noselect
1984 'get-file-buffer 'insert-directory 'insert-file-contents 1984 'get-file-buffer 'insert-directory 'insert-file-contents
1985 'load 'make-directory 'make-directory-internal 1985 'load 'make-directory 'make-directory-internal
@@ -2008,7 +2008,7 @@ ARGS are the arguments OPERATION has been called with."
2008 ;; Emacs 23+ only. 2008 ;; Emacs 23+ only.
2009 'copy-directory 2009 'copy-directory
2010 ;; Emacs 24+ only. 2010 ;; Emacs 24+ only.
2011 'file-in-directory-p 'file-equal-p 2011 'file-equal-p 'file-in-directory-p
2012 ;; XEmacs only. 2012 ;; XEmacs only.
2013 'dired-make-relative-symlink 2013 'dired-make-relative-symlink
2014 'vm-imap-move-mail 'vm-pop-move-mail 'vm-spool-move-mail)) 2014 'vm-imap-move-mail 'vm-pop-move-mail 'vm-spool-move-mail))
@@ -3287,14 +3287,78 @@ beginning of local filename are not substituted."
3287 ;; for backward compatibility. 3287 ;; for backward compatibility.
3288 (expand-file-name "~/")) 3288 (expand-file-name "~/"))
3289 3289
3290(defun tramp-handle-set-visited-file-modtime (&optional time-list)
3291 "Like `set-visited-file-modtime' for Tramp files."
3292 (unless (buffer-file-name)
3293 (error "Can't set-visited-file-modtime: buffer `%s' not visiting a file"
3294 (buffer-name)))
3295 (unless time-list
3296 (let ((remote-file-name-inhibit-cache t))
3297 ;; '(-1 65535) means file doesn't exists yet.
3298 (setq time-list
3299 (or (nth 5 (file-attributes (buffer-file-name))) '(-1 65535)))))
3300 ;; We use '(0 0) as a don't-know value.
3301 (unless (equal time-list '(0 0))
3302 (tramp-run-real-handler 'set-visited-file-modtime (list time-list))))
3303
3304(defun tramp-handle-verify-visited-file-modtime (&optional buf)
3305 "Like `verify-visited-file-modtime' for Tramp files.
3306At the time `verify-visited-file-modtime' calls this function, we
3307already know that the buffer is visiting a file and that
3308`visited-file-modtime' does not return 0. Do not call this
3309function directly, unless those two cases are already taken care
3310of."
3311 (with-current-buffer (or buf (current-buffer))
3312 (let ((f (buffer-file-name)))
3313 ;; There is no file visiting the buffer, or the buffer has no
3314 ;; recorded last modification time, or there is no established
3315 ;; connection.
3316 (if (or (not f)
3317 (eq (visited-file-modtime) 0)
3318 (not (tramp-file-name-handler 'file-remote-p f nil 'connected)))
3319 t
3320 (with-parsed-tramp-file-name f nil
3321 (let* ((remote-file-name-inhibit-cache t)
3322 (attr (file-attributes f))
3323 (modtime (nth 5 attr))
3324 (mt (visited-file-modtime)))
3325
3326 (cond
3327 ;; File exists, and has a known modtime.
3328 ((and attr (not (equal modtime '(0 0))))
3329 (< (abs (tramp-time-diff
3330 modtime
3331 ;; For compatibility, deal with both the old
3332 ;; (HIGH . LOW) and the new (HIGH LOW) return
3333 ;; values of `visited-file-modtime'.
3334 (if (atom (cdr mt))
3335 (list (car mt) (cdr mt))
3336 mt)))
3337 2))
3338 ;; Modtime has the don't know value.
3339 (attr t)
3340 ;; If file does not exist, say it is not modified if and
3341 ;; only if that agrees with the buffer's record.
3342 (t (equal mt '(-1 65535))))))))))
3343
3290(defun tramp-handle-file-notify-add-watch (filename flags callback) 3344(defun tramp-handle-file-notify-add-watch (filename flags callback)
3291 "Like `file-notify-add-watch' for Tramp files." 3345 "Like `file-notify-add-watch' for Tramp files."
3292 ;; This is the default handler. Some packages might have its own one. 3346 ;; This is the default handler. tramp-gvfs.el and tramp-sh.el have
3347 ;; its own one.
3293 (setq filename (expand-file-name filename)) 3348 (setq filename (expand-file-name filename))
3294 (with-parsed-tramp-file-name filename nil 3349 (with-parsed-tramp-file-name filename nil
3295 (tramp-error 3350 (tramp-error
3296 v 'file-notify-error "File notification not supported for `%s'" filename))) 3351 v 'file-notify-error "File notification not supported for `%s'" filename)))
3297 3352
3353(defvar file-notify-descriptors)
3354(defun tramp-handle-file-notify-rm-watch (proc)
3355 "Like `file-notify-rm-watch' for Tramp files."
3356 ;; The descriptor must be a process object.
3357 (unless (and (processp proc) (gethash proc file-notify-descriptors))
3358 (tramp-error proc 'file-notify-error "Not a valid descriptor %S" proc))
3359 (tramp-message proc 6 "Kill %S" proc)
3360 (kill-process proc))
3361
3298;;; Functions for establishing connection: 3362;;; Functions for establishing connection:
3299 3363
3300;; The following functions are actions to be taken when seeing certain 3364;; The following functions are actions to be taken when seeing certain
@@ -3951,16 +4015,12 @@ This is needed because for some Emacs flavors Tramp has
3951defadvised `call-process' to behave like `process-file'. The 4015defadvised `call-process' to behave like `process-file'. The
3952Lisp error raised when PROGRAM is nil is trapped also, returning 1. 4016Lisp error raised when PROGRAM is nil is trapped also, returning 1.
3953Furthermore, traces are written with verbosity of 6." 4017Furthermore, traces are written with verbosity of 6."
3954 (let ((default-directory 4018 (tramp-message
3955 (if (file-remote-p default-directory) 4019 (vector tramp-current-method tramp-current-user tramp-current-host nil nil)
3956 (tramp-compat-temporary-file-directory) 4020 6 "%s %s %s" program infile args)
3957 default-directory))) 4021 (if (executable-find program)
3958 (tramp-message 4022 (apply 'call-process program infile destination display args)
3959 (vector tramp-current-method tramp-current-user tramp-current-host nil nil) 4023 1))
3960 6 "%s %s %s" program infile args)
3961 (if (executable-find program)
3962 (apply 'call-process program infile destination display args)
3963 1)))
3964 4024
3965;;;###tramp-autoload 4025;;;###tramp-autoload
3966(defun tramp-read-passwd (proc &optional prompt) 4026(defun tramp-read-passwd (proc &optional prompt)
diff --git a/lisp/server.el b/lisp/server.el
index 05ac345d904..8a2a466a315 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -1611,7 +1611,7 @@ With ARG non-nil, silently save all file-visiting buffers, then kill.
1611 1611
1612If emacsclient was started with a list of filenames to edit, then 1612If emacsclient was started with a list of filenames to edit, then
1613only these files will be asked to be saved." 1613only these files will be asked to be saved."
1614 (let ((proc (frame-parameter (selected-frame) 'client))) 1614 (let ((proc (frame-parameter nil 'client)))
1615 (cond ((eq proc 'nowait) 1615 (cond ((eq proc 'nowait)
1616 ;; Nowait frames have no client buffer list. 1616 ;; Nowait frames have no client buffer list.
1617 (if (cdr (frame-list)) 1617 (if (cdr (frame-list))
diff --git a/lisp/speedbar.el b/lisp/speedbar.el
index 9daa77b740f..2f995219193 100644
--- a/lisp/speedbar.el
+++ b/lisp/speedbar.el
@@ -250,7 +250,7 @@ frame."
250 250
251(defcustom speedbar-query-confirmation-method 'all 251(defcustom speedbar-query-confirmation-method 'all
252 "Query control for file operations. 252 "Query control for file operations.
253The 'always flag means to always query before file operations. 253The 'all flag means to always query before file operations.
254The 'none-but-delete flag means to not query before any file 254The 'none-but-delete flag means to not query before any file
255operations, except before a file deletion." 255operations, except before a file deletion."
256 :group 'speedbar 256 :group 'speedbar
diff --git a/lisp/textmodes/reftex-toc.el b/lisp/textmodes/reftex-toc.el
index 248e36a5299..b7d57733467 100644
--- a/lisp/textmodes/reftex-toc.el
+++ b/lisp/textmodes/reftex-toc.el
@@ -229,7 +229,7 @@ When called with a raw C-u prefix, rescan the document first."
229 (car (reftex-where-am-I)))) 229 (car (reftex-where-am-I))))
230 (unsplittable (if (fboundp 'frame-property) 230 (unsplittable (if (fboundp 'frame-property)
231 (frame-property (selected-frame) 'unsplittable) 231 (frame-property (selected-frame) 'unsplittable)
232 (frame-parameter (selected-frame) 'unsplittable))) 232 (frame-parameter nil 'unsplittable)))
233 offset toc-window) 233 offset toc-window)
234 234
235 (if (setq toc-window (get-buffer-window 235 (if (setq toc-window (get-buffer-window
@@ -587,7 +587,7 @@ With prefix arg 1, restrict index to the section at point."
587 (let ((unsplittable 587 (let ((unsplittable
588 (if (fboundp 'frame-property) 588 (if (fboundp 'frame-property)
589 (frame-property (selected-frame) 'unsplittable) 589 (frame-property (selected-frame) 'unsplittable)
590 (frame-parameter (selected-frame) 'unsplittable))) 590 (frame-parameter nil 'unsplittable)))
591 (reftex-rebuilding-toc t)) 591 (reftex-rebuilding-toc t))
592 (if unsplittable 592 (if unsplittable
593 (switch-to-buffer 593 (switch-to-buffer
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog
index 254ea5db4e4..120d00002e4 100644
--- a/lisp/url/ChangeLog
+++ b/lisp/url/ChangeLog
@@ -1,3 +1,8 @@
12013-07-31 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * url-handlers.el (url-file-name-completion)
4 (url-file-name-all-completions): Don't signal errors (bug#14806).
5
12013-07-22 Stefan Monnier <monnier@iro.umontreal.ca> 62013-07-22 Stefan Monnier <monnier@iro.umontreal.ca>
2 7
3 * url-http.el (status): Remove, unused. 8 * url-http.el (status): Remove, unused.
diff --git a/lisp/url/url-handlers.el b/lisp/url/url-handlers.el
index ae807d6eab9..e9bd1628c99 100644
--- a/lisp/url/url-handlers.el
+++ b/lisp/url/url-handlers.el
@@ -311,11 +311,17 @@ They count bytes from the beginning of the body."
311(put 'insert-file-contents 'url-file-handlers 'url-insert-file-contents) 311(put 'insert-file-contents 'url-file-handlers 'url-insert-file-contents)
312 312
313(defun url-file-name-completion (url directory &optional predicate) 313(defun url-file-name-completion (url directory &optional predicate)
314 (error "Unimplemented")) 314 ;; Even if it's not implemented, it's not an error to ask for completion,
315 ;; in case it's available (bug#14806).
316 ;; (error "Unimplemented")
317 url)
315(put 'file-name-completion 'url-file-handlers 'url-file-name-completion) 318(put 'file-name-completion 'url-file-handlers 'url-file-name-completion)
316 319
317(defun url-file-name-all-completions (file directory) 320(defun url-file-name-all-completions (file directory)
318 (error "Unimplemented")) 321 ;; Even if it's not implemented, it's not an error to ask for completion,
322 ;; in case it's available (bug#14806).
323 ;; (error "Unimplemented")
324 nil)
319(put 'file-name-all-completions 325(put 'file-name-all-completions
320 'url-file-handlers 'url-file-name-all-completions) 326 'url-file-handlers 'url-file-name-all-completions)
321 327
diff --git a/lisp/vc/log-view.el b/lisp/vc/log-view.el
index de103c0cdb6..be985866532 100644
--- a/lisp/vc/log-view.el
+++ b/lisp/vc/log-view.el
@@ -562,19 +562,7 @@ file(s)."
562 (interactive 562 (interactive
563 (list (if (use-region-p) (region-beginning) (point)) 563 (list (if (use-region-p) (region-beginning) (point))
564 (if (use-region-p) (region-end) (point)))) 564 (if (use-region-p) (region-end) (point))))
565 (let ((fr (log-view-current-tag beg)) 565 (log-view-diff-common beg end))
566 (to (log-view-current-tag end)))
567 (when (string-equal fr to)
568 (save-excursion
569 (goto-char end)
570 (log-view-msg-next)
571 (setq to (log-view-current-tag))))
572 (vc-diff-internal
573 t (list log-view-vc-backend
574 (if log-view-per-file-logs
575 (list (log-view-current-file))
576 log-view-vc-fileset))
577 to fr)))
578 566
579(defun log-view-diff-changeset (beg end) 567(defun log-view-diff-changeset (beg end)
580 "Get the diff between two revisions. 568 "Get the diff between two revisions.
@@ -589,20 +577,29 @@ considered file(s)."
589 (interactive 577 (interactive
590 (list (if (use-region-p) (region-beginning) (point)) 578 (list (if (use-region-p) (region-beginning) (point))
591 (if (use-region-p) (region-end) (point)))) 579 (if (use-region-p) (region-end) (point))))
592 (when (eq (vc-call-backend log-view-vc-backend 'revision-granularity) 'file) 580 (log-view-diff-common beg end t))
581
582(defun log-view-diff-common (beg end &optional whole-changeset)
583 (when (and whole-changeset
584 (eq (vc-call-backend log-view-vc-backend 'revision-granularity)
585 'file))
593 (error "The %s backend does not support changeset diffs" log-view-vc-backend)) 586 (error "The %s backend does not support changeset diffs" log-view-vc-backend))
594 (let ((fr (log-view-current-tag beg)) 587 (let ((to (log-view-current-tag beg))
595 (to (log-view-current-tag end))) 588 (fr (log-view-current-tag end)))
596 (when (string-equal fr to) 589 (when (string-equal fr to)
597 ;; TO and FR are the same, look at the previous revision. 590 ;; TO and FR are the same, look at the previous revision.
598 (setq to (vc-call-backend log-view-vc-backend 'previous-revision nil fr))) 591 (setq fr (vc-call-backend log-view-vc-backend 'previous-revision nil fr)))
599 (vc-diff-internal 592 (vc-diff-internal
600 t 593 t (list log-view-vc-backend
601 ;; We want to see the diff for all the files in the changeset, so 594 ;; The value passed here should follow what
602 ;; pass NIL for the file list. The value passed here should 595 ;; `vc-deduce-fileset' returns. If we want to see the
603 ;; follow what `vc-deduce-fileset' returns. 596 ;; diff for all the files in the changeset, pass NIL for
604 (list log-view-vc-backend nil) 597 ;; the file list.
605 to fr))) 598 (unless whole-changeset
599 (if log-view-per-file-logs
600 (list (log-view-current-file))
601 log-view-vc-fileset)))
602 fr to)))
606 603
607(provide 'log-view) 604(provide 'log-view)
608 605
diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el
index 441b3725968..5ddcfd57748 100644
--- a/lisp/vc/vc-dir.el
+++ b/lisp/vc/vc-dir.el
@@ -282,7 +282,7 @@ See `run-hooks'."
282 (define-key map "Q" 'vc-dir-query-replace-regexp) 282 (define-key map "Q" 'vc-dir-query-replace-regexp)
283 (define-key map (kbd "M-s a C-s") 'vc-dir-isearch) 283 (define-key map (kbd "M-s a C-s") 'vc-dir-isearch)
284 (define-key map (kbd "M-s a M-C-s") 'vc-dir-isearch-regexp) 284 (define-key map (kbd "M-s a M-C-s") 'vc-dir-isearch-regexp)
285 (define-key map "I" 'vc-dir-ignore) 285 (define-key map "G" 'vc-dir-ignore)
286 286
287 ;; Hook up the menu. 287 ;; Hook up the menu.
288 (define-key map [menu-bar vc-dir-mode] 288 (define-key map [menu-bar vc-dir-mode]
diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el
index 284481ee524..ae9aa0118ae 100644
--- a/lisp/vc/vc-hooks.el
+++ b/lisp/vc/vc-hooks.el
@@ -918,6 +918,7 @@ current, and kill the buffer that visits the link."
918 (define-key map "c" 'vc-rollback) 918 (define-key map "c" 'vc-rollback)
919 (define-key map "d" 'vc-dir) 919 (define-key map "d" 'vc-dir)
920 (define-key map "g" 'vc-annotate) 920 (define-key map "g" 'vc-annotate)
921 (define-key map "G" 'vc-ignore)
921 (define-key map "h" 'vc-insert-headers) 922 (define-key map "h" 'vc-insert-headers)
922 (define-key map "i" 'vc-register) 923 (define-key map "i" 'vc-register)
923 (define-key map "l" 'vc-print-log) 924 (define-key map "l" 'vc-print-log)
@@ -1002,6 +1003,9 @@ current, and kill the buffer that visits the link."
1002 (bindings--define-key map [vc-register] 1003 (bindings--define-key map [vc-register]
1003 '(menu-item "Register" vc-register 1004 '(menu-item "Register" vc-register
1004 :help "Register file set into a version control system")) 1005 :help "Register file set into a version control system"))
1006 (bindings--define-key map [vc-ignore]
1007 '(menu-item "Ignore File..." vc-ignore
1008 :help "Ignore a file under current version control system"))
1005 (bindings--define-key map [vc-dir] 1009 (bindings--define-key map [vc-dir]
1006 '(menu-item "VC Dir" vc-dir 1010 '(menu-item "VC Dir" vc-dir
1007 :help "Show the VC status of files in a directory")) 1011 :help "Show the VC status of files in a directory"))
diff --git a/lisp/whitespace.el b/lisp/whitespace.el
index 801cdc52047..b462cf0b811 100644
--- a/lisp/whitespace.el
+++ b/lisp/whitespace.el
@@ -1471,6 +1471,12 @@ documentation."
1471 ;; PROBLEM 6: 8 or more SPACEs after TAB 1471 ;; PROBLEM 6: 8 or more SPACEs after TAB
1472 (whitespace-cleanup-region (point-min) (point-max))))) 1472 (whitespace-cleanup-region (point-min) (point-max)))))
1473 1473
1474(defun whitespace-ensure-local-variables ()
1475 "Set `whitespace-indent-tabs-mode' and `whitespace-tab-width' locally."
1476 (set (make-local-variable 'whitespace-indent-tabs-mode)
1477 indent-tabs-mode)
1478 (set (make-local-variable 'whitespace-tab-width)
1479 tab-width))
1474 1480
1475;;;###autoload 1481;;;###autoload
1476(defun whitespace-cleanup-region (start end) 1482(defun whitespace-cleanup-region (start end)
@@ -1517,6 +1523,7 @@ documentation."
1517 ;; read-only buffer 1523 ;; read-only buffer
1518 (whitespace-warn-read-only "cleanup region") 1524 (whitespace-warn-read-only "cleanup region")
1519 ;; non-read-only buffer 1525 ;; non-read-only buffer
1526 (whitespace-ensure-local-variables)
1520 (let ((rstart (min start end)) 1527 (let ((rstart (min start end))
1521 (rend (copy-marker (max start end))) 1528 (rend (copy-marker (max start end)))
1522 (indent-tabs-mode whitespace-indent-tabs-mode) 1529 (indent-tabs-mode whitespace-indent-tabs-mode)
@@ -2095,7 +2102,6 @@ resultant list will be returned."
2095(defvar whitespace-display-table-was-local nil 2102(defvar whitespace-display-table-was-local nil
2096 "Used to remember whether a buffer initially had a local display table.") 2103 "Used to remember whether a buffer initially had a local display table.")
2097 2104
2098
2099(defun whitespace-turn-on () 2105(defun whitespace-turn-on ()
2100 "Turn on whitespace visualization." 2106 "Turn on whitespace visualization."
2101 ;; prepare local hooks 2107 ;; prepare local hooks
@@ -2108,10 +2114,7 @@ resultant list will be returned."
2108 (if (listp whitespace-style) 2114 (if (listp whitespace-style)
2109 whitespace-style 2115 whitespace-style
2110 (list whitespace-style))) 2116 (list whitespace-style)))
2111 (set (make-local-variable 'whitespace-indent-tabs-mode) 2117 (whitespace-ensure-local-variables)
2112 indent-tabs-mode)
2113 (set (make-local-variable 'whitespace-tab-width)
2114 tab-width)
2115 ;; turn on whitespace 2118 ;; turn on whitespace
2116 (when whitespace-active-style 2119 (when whitespace-active-style
2117 (whitespace-color-on) 2120 (whitespace-color-on)
diff --git a/src/ChangeLog b/src/ChangeLog
index bfe4dfaf39a..69e00cadbe9 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,191 @@
12013-08-03 Paul Eggert <eggert@cs.ucla.edu>
2
3 * composite.h: Minor fixups.
4 (composition_registered_p): Rename from COMPOSITION_REGISTERD_P
5 to fix a misspelling, and change it to an inline function while
6 we're at it (it need not be a macro). All uses changed.
7 (composition_method, composition_valid_p):
8 Rewrite to avoid assignments in if-conditions.
9
102013-08-03 Dmitry Antipov <dmantipov@yandex.ru>
11
12 Do not use global Lisp_Object in composition macros.
13 * composite.h (composition_temp): Remove declaration.
14 (COMPOSITION_METHOD, COMPOSITION_VALID_P): Replace with...
15 (composition_method, composition_valid_p): ...inline functions.
16 (compose_region): Remove the leftover.
17 * composite.c (composition_temp): Remove.
18 (run_composition_function, update_compositions)
19 (composition_compute_stop_pos, composition_adjust_point)
20 (Ffind_composition_internal):
21 * coding.c (handle_composition_annotation):
22 * xdisp.c (handle_composition_prop, check_point_in_composition):
23 Related users changed.
24
252013-08-03 Dmitry Antipov <dmantipov@yandex.ru>
26
27 Drop FRAME_PTR typedef.
28 * composite.c, font.c, font.h, fontset.c, fontset.h, frame.c, frame.h:
29 * ftfont.c, ftxfont.c, gtkutil.c, gtkutil.h, image.c, keyboard.c:
30 * menu.c, menu.h, msdos.c, nsfns.m, nsfont.m, nsmenu.m, nsterm.h:
31 * nsterm.m, scroll.c, term.c, w32fns.c, w32font.c, w32font.h:
32 * w32inevt.c, w32inevt.h, w32menu.c, w32notify.c, w32term.c, w32term.h:
33 * w32uniscribe.c, w32xfns.c, widget.c, window.c, xdisp.c, xfaces.c:
34 * xfns.c, xfont.c, xftfont.c, xmenu.c, xselect.c, xterm.c:
35 All related users changed.
36
372013-08-02 Stefan Monnier <monnier@iro.umontreal.ca>
38
39 * eval.c (default_toplevel_binding): New function.
40 (Fdefvar): Use it.
41 (unbind_to, backtrace_eval_unrewind): Do a bit of CSE simplification.
42 (Fdefault_toplevel_value, Fset_default_toplevel_value): New subrs.
43 (syms_of_eval): Export them.
44 * data.c (Fdefault_value): Micro cleanup.
45 * term.c (init_tty): Use "false".
46
472013-08-02 Dmitry Antipov <dmantipov@yandex.ru>
48
49 Fix X GC leak in GTK and raw (no toolkit) X ports.
50 * xterm.c (x_free_frame_resources): If white and black relief
51 GCs are allocated, always free them here.
52 * xfns.c (x_make_gc): Omit redundant initialization.
53 * widget.c (create_frame_gcs): Remove the leftover.
54 (EmacsFrameDestroy): Do nothing because all GCs are now freed
55 in x_free_frame_resources.
56
572013-08-02 Jan Djärv <jan.h.d@swipnet.se>
58
59 * nsterm.m (windowWillResize:toSize:): Only change title if
60 ! maximizing_resize && FULLSCREEN_NONE (Bug#15005). strdup title before
61 modifying it.
62 (viewDidEndLiveResize): New method.
63
64 * nsterm.h (EmacsView): Add maximizing_resize, put it and old_title
65 inside NS_IMPL_COCOA.
66
672013-08-02 Dmitry Antipov <dmantipov@yandex.ru>
68
69 * insdel.c (adjust_after_replace, replace_range, del_range_2):
70 Do not check whether undo is enabled because record_insert and
71 record_delete does that themselves.
72
732013-08-02 Dmitry Antipov <dmantipov@yandex.ru>
74
75 * xterm.h (struct x_output) [HAVE_X_I18N]: Remove xic_base_fontname
76 member which is not really used any more.
77 (FRAME_XIC_BASE_FONTNAME): Remove.
78 * xfns.c (xic_free_fontset): Adjust user.
79 * xmenu.c (mouse_position_for_popup, x_activate_menubar)
80 (update_frame_menubar, set_frame_menubar, free_frame_menubar)
81 (create_and_show_popup_menu, xmenu_show, create_and_show_dialog)
82 (xdialog_show): Use eassert for debugging check.
83 * w32term.c (x_unfocus_frame): Remove unused dummy function.
84
852013-08-01 Paul Eggert <eggert@cs.ucla.edu>
86
87 * fileio.c, fns.c (merge): Move extern decl from here ...
88 * lisp.h (merge): ... to here.
89
902013-08-01 Dmitry Antipov <dmantipov@yandex.ru>
91
92 Fix last font-related change.
93 * w32font.h (w32font_list_internal, w32font_match_internal):
94 Fix prototype.
95 * w32uniscribe.c (uniscribe_list, uniscribe_match):
96 (uniscribe_list_family): Adjust to match font API change.
97 MS-Windows breakage reported by Juanma Barranquero <lekktu@gmail.com>
98 at http://lists.gnu.org/archive/html/emacs-devel/2013-08/msg00006.html.
99
1002013-08-01 Dmitry Antipov <dmantipov@yandex.ru>
101
102 * frame.h (FRAME_MOUSE_UPDATE):
103 * nsterm.m (ns_frame_up_to_date): Omit redundant check
104 whether hlinfo->mouse_face_mouse_frame is non-NULL.
105
1062013-08-01 Dmitry Antipov <dmantipov@yandex.ru>
107
108 Avoid redundant Lisp_Object <-> struct frame conversions in font API.
109 * font.h (struct font_driver): Change list, match, and list_family
110 functions to accept struct frame * as first arg.
111 * font.c (font_score, font_compare, font_sort_entities): Remove
112 prototypes.
113 (font_sort_entities, font_list_entities, font_select_entity):
114 (font_find_for_lface, Flist_fonts, Ffont_family_list): Adjust to
115 match font API change.
116 * xfont.c (xfont_list, xfont_match, xfont_list_family):
117 * ftfont.c (ftfont_list, ftfont_match, ftfont_list_family):
118 * ftxfont.c (ftxfont_list, ftxfont_match):
119 * xftfont.c (xftfont_list, xftfont_match):
120 * nsfont.m (nsfont_list, nsfont_match, nsfont_list_family):
121 * w32font.c (w32font_list, w32font_match, w32font_list):
122 (w32font_list_internal, w32_font_match_internal): Likewise.
123 * xfaces.c (Fx_family_fonts): Adjust user.
124
1252013-08-01 Dmitry Antipov <dmantipov@yandex.ru>
126
127 Do not use pure Xism x_wm_set_icon_position in non-X ports.
128 * frame.c (x_set_frame_parameters): Call to x_wm_set_icon_position
129 only if HAVE_X_WINDOWS is in use.
130 * frame.h (x_set_frame_parameters): Move under HAVE_X_WINDOWS.
131 * nsterm.m (x_wm_set_icon_position): Remove no-op.
132 * w32term.c (x_wm_set_icon_position): Likewise.
133 * w32fns.c (x_icon): Adjust user.
134
1352013-08-01 Dmitry Antipov <dmantipov@yandex.ru>
136
137 * xterm.c (last_mouse_press_frame): Remove the
138 leftover which is not really used any more.
139 (handle_one_xevent, syms_of_xterm): Adjust users.
140 (x_flush): Call XFlush once per each X display, not frame.
141 This is better because this code always unconditionally skips
142 non-X frames in Vframe_list and issues the only XFlush if we
143 have more than one X frame on the same X display.
144 (any_help_event_p, x_draw_glyph_string_background, x_display_ok):
145 Use bool for booleans.
146 (x_draw_glyph_string_background, cvt_string_to_pixel):
147 (cvt_pixel_dtor): Drop unnecessary prototypes.
148 * xterm.h (x_display_ok): Adjust prototype.
149
1502013-07-31 Dmitry Antipov <dmantipov@yandex.ru>
151
152 Drop unnecessary functions that deals with frame pixel size.
153 * frame.h, msdos.h, w32term.h, xterm.h (x_pixel_width)
154 (x_pixel_height): Drop prototypes.
155 * msdos.c, nsfns.m, w32fns.c, xfns.c (x_pixel_width)
156 (x_pixel_height): Drop implementations.
157 * frame.c (Fframe_pixel_height): Use FRAME_PIXEL_HEIGHT
158 which should be always valid for window frame.
159 (Frame_pixel_width): Likewise with FRAME_PIXEL_WIDTH.
160 * w32menu.c (Fx_popup_dialog):
161 * xmenu.c (Fx_popup_dialog): Likewise for both.
162
1632013-07-31 Dmitry Antipov <dmantipov@yandex.ru>
164
165 * frame.c (Fmake_terminal_frame): Use store_in_alist to setup
166 frame parameters and call to Fmodify_frame_parameters just once.
167 (Fset_frame_height, Fset_frame_width): Mention nil frame in docstring.
168 (Fset_frame_size, Fset_frame_position): Use decode_live_frame
169 and mention nil frame in docstring.
170
1712013-07-31 Dmitry Antipov <dmantipov@yandex.ru>
172
173 * frame.c (make_frame, x_set_frame_parameters): Use bool for boolean.
174 (x_figure_window_size): Likewise. Adjust to return long.
175 (syms_of_frame): Do not DEFSYM Qterminal_live_p.
176 (toplevel): Move Qterminal_live_p to...
177 * terminal.c (toplevel): ...here, make it static, and...
178 (syms_of_terminal): ...DEFSYM here.
179 * frame.h (Qterminal_live_p): Remove declaration.
180 (make_frame, x_figure_window_size): Adjust prototype.
181 * nsfns.m (Fx_create_frame): Use long for window flags.
182
1832013-07-30 Paul Eggert <eggert@cs.ucla.edu>
184
185 Fix tempfile bug on platforms lacking mkostemp and mkstemp (Bug#14986).
186 * callproc.c (create_temp_file) [! (HAVE_MKOSTEMP || HAVE_MKSTEMP)]:
187 Do not assume that emacs_close (INT_MAX) is a no-op.
188
12013-07-30 Dmitry Antipov <dmantipov@yandex.ru> 1892013-07-30 Dmitry Antipov <dmantipov@yandex.ru>
2 190
3 * xfaces.c (make_face_cache): For struct face_cache, prefer 191 * xfaces.c (make_face_cache): For struct face_cache, prefer
@@ -325,7 +513,7 @@
325 code a bit. It makes no difference on POSIXish platforms but 513 code a bit. It makes no difference on POSIXish platforms but
326 apparently it fixes a bug on w32. 514 apparently it fixes a bug on w32.
327 515
328 Fix bug where insert-file-contents closes a file twice. (Bug#14839). 516 Fix bug where insert-file-contents closes a file twice (Bug#14839).
329 * fileio.c (close_file_unwind): Don't close if FD is negative; 517 * fileio.c (close_file_unwind): Don't close if FD is negative;
330 this can happen when unwinding a zapped file descriptor. 518 this can happen when unwinding a zapped file descriptor.
331 (Finsert_file_contents): Unwind-protect the fd before the point marker, 519 (Finsert_file_contents): Unwind-protect the fd before the point marker,
@@ -478,7 +666,7 @@
478 (make_lispy_focus_in, make_lispy_focus_out): Declare and define. 666 (make_lispy_focus_in, make_lispy_focus_out): Declare and define.
479 (kbd_buffer_get_event): For FOCUS_IN, make a focus_in event if no 667 (kbd_buffer_get_event): For FOCUS_IN, make a focus_in event if no
480 switch frame event is made. Check ! NILP (event->arg) if X11 (moved 668 switch frame event is made. Check ! NILP (event->arg) if X11 (moved
481 from xterm.c). Make focus_out event for FOCUS_OUT_EVENT if NS or X11 669 from xterm.c). Make focus_out event for FOCUS_OUT_EVENT if NS or X11
482 and there is a focused frame. 670 and there is a focused frame.
483 (head_table): Add focus-in and focus-out. 671 (head_table): Add focus-in and focus-out.
484 (keys_of_keyboard): Add focus-in and focus-out to Vspecial_event_map, 672 (keys_of_keyboard): Add focus-in and focus-out to Vspecial_event_map,
@@ -851,7 +1039,7 @@
851 (emacswrite_sig, emacs_perror): New functions. 1039 (emacswrite_sig, emacs_perror): New functions.
852 * xrdb.c (fatal): Don't invoke perror, since errno might be garbage. 1040 * xrdb.c (fatal): Don't invoke perror, since errno might be garbage.
853 1041
8542013-07-08 Magnus Henoch <magnus.henoch@gmail.com> (tiny change). 10422013-07-08 Magnus Henoch <magnus.henoch@gmail.com> (tiny change)
855 1043
856 * image.c (imagemagick_load_image): Do not use MagickExportImagePixels 1044 * image.c (imagemagick_load_image): Do not use MagickExportImagePixels
857 on NS even if it is present. Pixmap on NS is a void*. 1045 on NS even if it is present. Pixmap on NS is a void*.
@@ -1526,7 +1714,7 @@
1526 Now static. 1714 Now static.
1527 * lisp.h: Remove the abovementioned defns and decls. 1715 * lisp.h: Remove the abovementioned defns and decls.
1528 1716
1529 Use functions, not macros, for XINT etc. (Bug#11935). 1717 Use functions, not macros, for XINT etc (Bug#11935).
1530 In lisp.h, prefer functions to function-like macros, and 1718 In lisp.h, prefer functions to function-like macros, and
1531 constants to object-like macros, when either will do. This: 1719 constants to object-like macros, when either will do. This:
1532 . simplifies use, as there's no more need to worry about 1720 . simplifies use, as there's no more need to worry about
diff --git a/src/callproc.c b/src/callproc.c
index 91f29bd589b..450fc57f929 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -1018,13 +1018,14 @@ create_temp_file (ptrdiff_t nargs, Lisp_Object *args)
1018#else 1018#else
1019 errno = EEXIST; 1019 errno = EEXIST;
1020 mktemp (tempfile); 1020 mktemp (tempfile);
1021 /* INT_MAX denotes success, because close (INT_MAX) does nothing. */ 1021 fd = *tempfile ? 0 : -1;
1022 fd = *tempfile ? INT_MAX : -1;
1023#endif 1022#endif
1024 if (fd < 0) 1023 if (fd < 0)
1025 report_file_error ("Failed to open temporary file using pattern", 1024 report_file_error ("Failed to open temporary file using pattern",
1026 pattern); 1025 pattern);
1026#if defined HAVE_MKOSTEMP || defined HAVE_MKSTEMP
1027 emacs_close (fd); 1027 emacs_close (fd);
1028#endif
1028 } 1029 }
1029 1030
1030 record_unwind_protect (delete_temp_file, filename_string); 1031 record_unwind_protect (delete_temp_file, filename_string);
diff --git a/src/coding.c b/src/coding.c
index 0cdd8f9cd9e..5b637627763 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -7497,7 +7497,7 @@ handle_composition_annotation (ptrdiff_t pos, ptrdiff_t limit,
7497 /* We found a composition. Store the corresponding 7497 /* We found a composition. Store the corresponding
7498 annotation data in BUF. */ 7498 annotation data in BUF. */
7499 int *head = buf; 7499 int *head = buf;
7500 enum composition_method method = COMPOSITION_METHOD (prop); 7500 enum composition_method method = composition_method (prop);
7501 int nchars = COMPOSITION_LENGTH (prop); 7501 int nchars = COMPOSITION_LENGTH (prop);
7502 7502
7503 ADD_COMPOSITION_DATA (buf, nchars, 0, method); 7503 ADD_COMPOSITION_DATA (buf, nchars, 0, method);
diff --git a/src/composite.c b/src/composite.c
index 99b5da22af5..28942fe4f74 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -160,10 +160,6 @@ static Lisp_Object Qauto_composition_function;
160 auto-compositions. */ 160 auto-compositions. */
161#define MAX_AUTO_COMPOSITION_LOOKBACK 3 161#define MAX_AUTO_COMPOSITION_LOOKBACK 3
162 162
163/* Temporary variable used in macros COMPOSITION_XXX. */
164Lisp_Object composition_temp;
165
166
167/* Return COMPOSITION-ID of a composition at buffer position 163/* Return COMPOSITION-ID of a composition at buffer position
168 CHARPOS/BYTEPOS and length NCHARS. The `composition' property of 164 CHARPOS/BYTEPOS and length NCHARS. The `composition' property of
169 the sequence is PROP. STRING, if non-nil, is a string that 165 the sequence is PROP. STRING, if non-nil, is a string that
@@ -478,11 +474,11 @@ run_composition_function (ptrdiff_t from, ptrdiff_t to, Lisp_Object prop)
478 valid too. */ 474 valid too. */
479 if (from > BEGV 475 if (from > BEGV
480 && find_composition (from - 1, -1, &start, &end, &prop, Qnil) 476 && find_composition (from - 1, -1, &start, &end, &prop, Qnil)
481 && !COMPOSITION_VALID_P (start, end, prop)) 477 && !composition_valid_p (start, end, prop))
482 from = start; 478 from = start;
483 if (to < ZV 479 if (to < ZV
484 && find_composition (to, -1, &start, &end, &prop, Qnil) 480 && find_composition (to, -1, &start, &end, &prop, Qnil)
485 && !COMPOSITION_VALID_P (start, end, prop)) 481 && !composition_valid_p (start, end, prop))
486 to = end; 482 to = end;
487 if (!NILP (Ffboundp (func))) 483 if (!NILP (Ffboundp (func)))
488 call2 (func, make_number (from), make_number (to)); 484 call2 (func, make_number (from), make_number (to));
@@ -524,7 +520,7 @@ update_compositions (ptrdiff_t from, ptrdiff_t to, int check_mask)
524 latter to the copy of it. */ 520 latter to the copy of it. */
525 if (from > BEGV 521 if (from > BEGV
526 && find_composition (from - 1, -1, &start, &end, &prop, Qnil) 522 && find_composition (from - 1, -1, &start, &end, &prop, Qnil)
527 && COMPOSITION_VALID_P (start, end, prop)) 523 && composition_valid_p (start, end, prop))
528 { 524 {
529 min_pos = start; 525 min_pos = start;
530 if (end > to) 526 if (end > to)
@@ -538,7 +534,7 @@ update_compositions (ptrdiff_t from, ptrdiff_t to, int check_mask)
538 } 534 }
539 else if (from < ZV 535 else if (from < ZV
540 && find_composition (from, -1, &start, &from, &prop, Qnil) 536 && find_composition (from, -1, &start, &from, &prop, Qnil)
541 && COMPOSITION_VALID_P (start, from, prop)) 537 && composition_valid_p (start, from, prop))
542 { 538 {
543 if (from > to) 539 if (from > to)
544 max_pos = from; 540 max_pos = from;
@@ -553,7 +549,7 @@ update_compositions (ptrdiff_t from, ptrdiff_t to, int check_mask)
553 (to - 1). */ 549 (to - 1). */
554 while (from < to - 1 550 while (from < to - 1
555 && find_composition (from, to, &start, &from, &prop, Qnil) 551 && find_composition (from, to, &start, &from, &prop, Qnil)
556 && COMPOSITION_VALID_P (start, from, prop) 552 && composition_valid_p (start, from, prop)
557 && from < to - 1) 553 && from < to - 1)
558 run_composition_function (start, from, prop); 554 run_composition_function (start, from, prop);
559 } 555 }
@@ -562,7 +558,7 @@ update_compositions (ptrdiff_t from, ptrdiff_t to, int check_mask)
562 { 558 {
563 if (from < to 559 if (from < to
564 && find_composition (to - 1, -1, &start, &end, &prop, Qnil) 560 && find_composition (to - 1, -1, &start, &end, &prop, Qnil)
565 && COMPOSITION_VALID_P (start, end, prop)) 561 && composition_valid_p (start, end, prop))
566 { 562 {
567 /* TO should be also at composition boundary. But, 563 /* TO should be also at composition boundary. But,
568 insertion or deletion will make two compositions adjacent 564 insertion or deletion will make two compositions adjacent
@@ -580,7 +576,7 @@ update_compositions (ptrdiff_t from, ptrdiff_t to, int check_mask)
580 } 576 }
581 else if (to < ZV 577 else if (to < ZV
582 && find_composition (to, -1, &start, &end, &prop, Qnil) 578 && find_composition (to, -1, &start, &end, &prop, Qnil)
583 && COMPOSITION_VALID_P (start, end, prop)) 579 && composition_valid_p (start, end, prop))
584 { 580 {
585 run_composition_function (start, end, prop); 581 run_composition_function (start, end, prop);
586 max_pos = end; 582 max_pos = end;
@@ -901,7 +897,7 @@ autocmp_chars (Lisp_Object rule, ptrdiff_t charpos, ptrdiff_t bytepos,
901 Lisp_Object string) 897 Lisp_Object string)
902{ 898{
903 ptrdiff_t count = SPECPDL_INDEX (); 899 ptrdiff_t count = SPECPDL_INDEX ();
904 FRAME_PTR f = XFRAME (win->frame); 900 struct frame *f = XFRAME (win->frame);
905 Lisp_Object pos = make_number (charpos); 901 Lisp_Object pos = make_number (charpos);
906 ptrdiff_t to; 902 ptrdiff_t to;
907 ptrdiff_t pt = PT, pt_byte = PT_BYTE; 903 ptrdiff_t pt = PT, pt_byte = PT_BYTE;
@@ -1012,7 +1008,7 @@ composition_compute_stop_pos (struct composition_it *cmp_it, ptrdiff_t charpos,
1012 if (charpos < endpos 1008 if (charpos < endpos
1013 && find_composition (charpos, endpos, &start, &end, &prop, string) 1009 && find_composition (charpos, endpos, &start, &end, &prop, string)
1014 && start >= charpos 1010 && start >= charpos
1015 && COMPOSITION_VALID_P (start, end, prop)) 1011 && composition_valid_p (start, end, prop))
1016 { 1012 {
1017 cmp_it->stop_pos = endpos = start; 1013 cmp_it->stop_pos = endpos = start;
1018 cmp_it->ch = -1; 1014 cmp_it->ch = -1;
@@ -1672,7 +1668,7 @@ composition_adjust_point (ptrdiff_t last_pt, ptrdiff_t new_pt)
1672 1668
1673 /* At first check the static composition. */ 1669 /* At first check the static composition. */
1674 if (get_property_and_range (new_pt, Qcomposition, &val, &beg, &end, Qnil) 1670 if (get_property_and_range (new_pt, Qcomposition, &val, &beg, &end, Qnil)
1675 && COMPOSITION_VALID_P (beg, end, val)) 1671 && composition_valid_p (beg, end, val))
1676 { 1672 {
1677 if (beg < new_pt /* && end > new_pt <- It's always the case. */ 1673 if (beg < new_pt /* && end > new_pt <- It's always the case. */
1678 && (last_pt <= beg || last_pt >= end)) 1674 && (last_pt <= beg || last_pt >= end))
@@ -1872,12 +1868,12 @@ See `find-composition' for more details. */)
1872 && (e <= XINT (pos) ? e > end : s < start)) 1868 && (e <= XINT (pos) ? e > end : s < start))
1873 return list3 (make_number (s), make_number (e), gstring); 1869 return list3 (make_number (s), make_number (e), gstring);
1874 } 1870 }
1875 if (!COMPOSITION_VALID_P (start, end, prop)) 1871 if (!composition_valid_p (start, end, prop))
1876 return list3 (make_number (start), make_number (end), Qnil); 1872 return list3 (make_number (start), make_number (end), Qnil);
1877 if (NILP (detail_p)) 1873 if (NILP (detail_p))
1878 return list3 (make_number (start), make_number (end), Qt); 1874 return list3 (make_number (start), make_number (end), Qt);
1879 1875
1880 if (COMPOSITION_REGISTERD_P (prop)) 1876 if (composition_registered_p (prop))
1881 id = COMPOSITION_ID (prop); 1877 id = COMPOSITION_ID (prop);
1882 else 1878 else
1883 { 1879 {
@@ -1890,7 +1886,7 @@ See `find-composition' for more details. */)
1890 if (id >= 0) 1886 if (id >= 0)
1891 { 1887 {
1892 Lisp_Object components, relative_p, mod_func; 1888 Lisp_Object components, relative_p, mod_func;
1893 enum composition_method method = COMPOSITION_METHOD (prop); 1889 enum composition_method method = composition_method (prop);
1894 int width = composition_table[id]->width; 1890 int width = composition_table[id]->width;
1895 1891
1896 components = Fcopy_sequence (COMPOSITION_COMPONENTS (prop)); 1892 components = Fcopy_sequence (COMPOSITION_COMPONENTS (prop));
diff --git a/src/composite.h b/src/composite.h
index 603291044bc..53665b36bd1 100644
--- a/src/composite.h
+++ b/src/composite.h
@@ -49,69 +49,41 @@ enum composition_method {
49/* Maximum number of components a single composition can have. */ 49/* Maximum number of components a single composition can have. */
50#define MAX_COMPOSITION_COMPONENTS 16 50#define MAX_COMPOSITION_COMPONENTS 16
51 51
52/* These macros access information about a composition that 52/* These operations access information about a composition that
53 has `composition' property PROP. PROP is: 53 has `composition' property PROP. PROP is:
54 ((LENGTH . COMPONENTS) . MODIFICATION-FUNC) 54 ((LENGTH . COMPONENTS) . MODIFICATION-FUNC)
55 or 55 or
56 (COMPOSITION-ID . (LENGTH COMPONENTS . MODIFICATION-FUNC)) 56 (COMPOSITION-ID . (LENGTH COMPONENTS . MODIFICATION-FUNC))
57 They don't check validity of PROP. */ 57 They don't check validity of PROP. */
58 58
59/* Temporary variable used only in the following macros. */ 59/* Return true if PROP is already registered. */
60extern Lisp_Object composition_temp; 60COMPOSITE_INLINE bool
61 61composition_registered_p (Lisp_Object prop)
62/* Return 1 if the composition is already registered. */ 62{
63#define COMPOSITION_REGISTERD_P(prop) INTEGERP (XCAR (prop)) 63 return INTEGERP (XCAR (prop));
64}
64 65
65/* Return ID number of the already registered composition. */ 66/* Return ID number of the already registered composition. */
66#define COMPOSITION_ID(prop) XINT (XCAR (prop)) 67#define COMPOSITION_ID(prop) XINT (XCAR (prop))
67 68
68/* Return length of the composition. */ 69/* Return length of the composition. */
69#define COMPOSITION_LENGTH(prop) \ 70#define COMPOSITION_LENGTH(prop) \
70 (COMPOSITION_REGISTERD_P (prop) \ 71 (composition_registered_p (prop) \
71 ? XINT (XCAR (XCDR (prop))) \ 72 ? XINT (XCAR (XCDR (prop))) \
72 : XINT (XCAR (XCAR (prop)))) 73 : XINT (XCAR (XCAR (prop))))
73 74
74/* Return components of the composition. */ 75/* Return components of the composition. */
75#define COMPOSITION_COMPONENTS(prop) \ 76#define COMPOSITION_COMPONENTS(prop) \
76 (COMPOSITION_REGISTERD_P (prop) \ 77 (composition_registered_p (prop) \
77 ? XCAR (XCDR (XCDR (prop))) \ 78 ? XCAR (XCDR (XCDR (prop))) \
78 : XCDR (XCAR (prop))) 79 : XCDR (XCAR (prop)))
79 80
80/* Return modification function of the composition. */ 81/* Return modification function of the composition. */
81#define COMPOSITION_MODIFICATION_FUNC(prop) \ 82#define COMPOSITION_MODIFICATION_FUNC(prop) \
82 (COMPOSITION_REGISTERD_P (prop) \ 83 (composition_registered_p (prop) \
83 ? XCDR (XCDR (XCDR (prop))) \ 84 ? XCDR (XCDR (XCDR (prop))) \
84 : CONSP (prop) ? XCDR (prop) : Qnil) 85 : CONSP (prop) ? XCDR (prop) : Qnil)
85 86
86/* Return the method of composition. */
87#define COMPOSITION_METHOD(prop) \
88 (COMPOSITION_REGISTERD_P (prop) \
89 ? composition_table[COMPOSITION_ID (prop)]->method \
90 : (composition_temp = XCDR (XCAR (prop)), \
91 (NILP (composition_temp) \
92 ? COMPOSITION_RELATIVE \
93 : (INTEGERP (composition_temp) || STRINGP (composition_temp)) \
94 ? COMPOSITION_WITH_ALTCHARS \
95 : COMPOSITION_WITH_RULE_ALTCHARS)))
96
97/* Return 1 if the composition is valid. It is valid if length of
98 the composition equals to (END - START). */
99#define COMPOSITION_VALID_P(start, end, prop) \
100 (CONSP (prop) \
101 && (COMPOSITION_REGISTERD_P (prop) \
102 ? (COMPOSITION_ID (prop) >= 0 \
103 && COMPOSITION_ID (prop) <= n_compositions \
104 && CONSP (XCDR (prop))) \
105 : (composition_temp = XCAR (prop), \
106 (CONSP (composition_temp) \
107 && (composition_temp = XCDR (composition_temp), \
108 (NILP (composition_temp) \
109 || STRINGP (composition_temp) \
110 || VECTORP (composition_temp) \
111 || INTEGERP (composition_temp) \
112 || CONSP (composition_temp)))))) \
113 && (end - start) == COMPOSITION_LENGTH (prop))
114
115/* Return the Nth glyph of composition specified by CMP. CMP is a 87/* Return the Nth glyph of composition specified by CMP. CMP is a
116 pointer to `struct composition'. */ 88 pointer to `struct composition'. */
117#define COMPOSITION_GLYPH(cmp, n) \ 89#define COMPOSITION_GLYPH(cmp, n) \
@@ -227,12 +199,48 @@ extern bool find_composition (ptrdiff_t, ptrdiff_t, ptrdiff_t *, ptrdiff_t *,
227 Lisp_Object *, Lisp_Object); 199 Lisp_Object *, Lisp_Object);
228extern void update_compositions (ptrdiff_t, ptrdiff_t, int); 200extern void update_compositions (ptrdiff_t, ptrdiff_t, int);
229extern void make_composition_value_copy (Lisp_Object); 201extern void make_composition_value_copy (Lisp_Object);
230extern void compose_region (int, int, Lisp_Object, Lisp_Object,
231 Lisp_Object);
232extern void syms_of_composite (void); 202extern void syms_of_composite (void);
233extern void compose_text (ptrdiff_t, ptrdiff_t, Lisp_Object, Lisp_Object, 203extern void compose_text (ptrdiff_t, ptrdiff_t, Lisp_Object, Lisp_Object,
234 Lisp_Object); 204 Lisp_Object);
235 205
206/* Return the method of a composition with property PROP. */
207
208COMPOSITE_INLINE enum composition_method
209composition_method (Lisp_Object prop)
210{
211 if (composition_registered_p (prop))
212 return composition_table[COMPOSITION_ID (prop)]->method;
213 else
214 {
215 Lisp_Object temp = XCDR (XCAR (prop));
216 return (NILP (temp)
217 ? COMPOSITION_RELATIVE
218 : INTEGERP (temp) || STRINGP (temp)
219 ? COMPOSITION_WITH_ALTCHARS
220 : COMPOSITION_WITH_RULE_ALTCHARS);
221 }
222}
223
224/* Given offsets START and END, return true if PROP is a valid composition
225 property with length END - START. */
226
227COMPOSITE_INLINE bool
228composition_valid_p (ptrdiff_t start, ptrdiff_t end, Lisp_Object prop)
229{
230 return (CONSP (prop)
231 && (composition_registered_p (prop)
232 ? (COMPOSITION_ID (prop) >= 0
233 && COMPOSITION_ID (prop) <= n_compositions
234 && CONSP (XCDR (prop)))
235 : (CONSP (XCAR (prop))
236 && (NILP (XCDR (XCAR (prop)))
237 || STRINGP (XCDR (XCAR (prop)))
238 || VECTORP (XCDR (XCAR (prop)))
239 || INTEGERP (XCDR (XCAR (prop)))
240 || CONSP (XCDR (XCAR (prop))))))
241 && COMPOSITION_LENGTH (prop) == end - start);
242}
243
236/* Macros for lispy glyph-string. This is completely different from 244/* Macros for lispy glyph-string. This is completely different from
237 struct glyph_string. */ 245 struct glyph_string. */
238 246
diff --git a/src/data.c b/src/data.c
index f04d6da618f..d1e43ac1b5f 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1384,9 +1384,7 @@ for this variable. The default value is meaningful for variables with
1384local bindings in certain buffers. */) 1384local bindings in certain buffers. */)
1385 (Lisp_Object symbol) 1385 (Lisp_Object symbol)
1386{ 1386{
1387 register Lisp_Object value; 1387 Lisp_Object value = default_value (symbol);
1388
1389 value = default_value (symbol);
1390 if (!EQ (value, Qunbound)) 1388 if (!EQ (value, Qunbound))
1391 return value; 1389 return value;
1392 1390
diff --git a/src/eval.c b/src/eval.c
index cb716690e3c..8ee259110f4 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -658,6 +658,51 @@ The return value is BASE-VARIABLE. */)
658 return base_variable; 658 return base_variable;
659} 659}
660 660
661static union specbinding *
662default_toplevel_binding (Lisp_Object symbol)
663{
664 union specbinding *binding = NULL;
665 union specbinding *pdl = specpdl_ptr;
666 while (pdl > specpdl)
667 {
668 switch ((--pdl)->kind)
669 {
670 case SPECPDL_LET_DEFAULT:
671 case SPECPDL_LET:
672 if (EQ (specpdl_symbol (pdl), symbol))
673 binding = pdl;
674 break;
675 }
676 }
677 return binding;
678}
679
680DEFUN ("default-toplevel-value", Fdefault_toplevel_value, Sdefault_toplevel_value, 1, 1, 0,
681 doc: /* Return SYMBOL's toplevel default value.
682"Toplevel" means outside of any let binding. */)
683 (Lisp_Object symbol)
684{
685 union specbinding *binding = default_toplevel_binding (symbol);
686 Lisp_Object value
687 = binding ? specpdl_old_value (binding) : Fdefault_value (symbol);
688 if (!EQ (value, Qunbound))
689 return value;
690 xsignal1 (Qvoid_variable, symbol);
691}
692
693DEFUN ("set-default-toplevel-value", Fset_default_toplevel_value,
694 Sset_default_toplevel_value, 2, 2, 0,
695 doc: /* Set SYMBOL's toplevel default value to VALUE.
696"Toplevel" means outside of any let binding. */)
697 (Lisp_Object symbol, Lisp_Object value)
698{
699 union specbinding *binding = default_toplevel_binding (symbol);
700 if (binding)
701 set_specpdl_old_value (binding, value);
702 else
703 Fset_default (symbol, value);
704 return Qnil;
705}
661 706
662DEFUN ("defvar", Fdefvar, Sdefvar, 1, UNEVALLED, 0, 707DEFUN ("defvar", Fdefvar, Sdefvar, 1, UNEVALLED, 0,
663 doc: /* Define SYMBOL as a variable, and return SYMBOL. 708 doc: /* Define SYMBOL as a variable, and return SYMBOL.
@@ -706,18 +751,10 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */)
706 else 751 else
707 { /* Check if there is really a global binding rather than just a let 752 { /* Check if there is really a global binding rather than just a let
708 binding that shadows the global unboundness of the var. */ 753 binding that shadows the global unboundness of the var. */
709 union specbinding *pdl = specpdl_ptr; 754 union specbinding *binding = default_toplevel_binding (sym);
710 while (pdl > specpdl) 755 if (binding && EQ (specpdl_old_value (binding), Qunbound))
711 { 756 {
712 if ((--pdl)->kind >= SPECPDL_LET 757 set_specpdl_old_value (binding, eval_sub (XCAR (tail)));
713 && EQ (specpdl_symbol (pdl), sym)
714 && EQ (specpdl_old_value (pdl), Qunbound))
715 {
716 message_with_string
717 ("Warning: defvar ignored because %s is let-bound",
718 SYMBOL_NAME (sym), 1);
719 break;
720 }
721 } 758 }
722 } 759 }
723 tail = XCDR (tail); 760 tail = XCDR (tail);
@@ -3311,19 +3348,21 @@ unbind_to (ptrdiff_t count, Lisp_Object value)
3311 case SPECPDL_BACKTRACE: 3348 case SPECPDL_BACKTRACE:
3312 break; 3349 break;
3313 case SPECPDL_LET: 3350 case SPECPDL_LET:
3314 /* If variable has a trivial value (no forwarding), we can 3351 { /* If variable has a trivial value (no forwarding), we can
3315 just set it. No need to check for constant symbols here, 3352 just set it. No need to check for constant symbols here,
3316 since that was already done by specbind. */ 3353 since that was already done by specbind. */
3317 if (XSYMBOL (specpdl_symbol (specpdl_ptr))->redirect 3354 struct Lisp_Symbol *sym = XSYMBOL (specpdl_symbol (specpdl_ptr));
3318 == SYMBOL_PLAINVAL) 3355 if (sym->redirect == SYMBOL_PLAINVAL)
3319 SET_SYMBOL_VAL (XSYMBOL (specpdl_symbol (specpdl_ptr)), 3356 {
3320 specpdl_old_value (specpdl_ptr)); 3357 SET_SYMBOL_VAL (sym, specpdl_old_value (specpdl_ptr));
3321 else 3358 break;
3322 /* NOTE: we only ever come here if make_local_foo was used for 3359 }
3323 the first time on this var within this let. */ 3360 else
3324 Fset_default (specpdl_symbol (specpdl_ptr), 3361 { /* FALLTHROUGH!!
3325 specpdl_old_value (specpdl_ptr)); 3362 NOTE: we only ever come here if make_local_foo was used for
3326 break; 3363 the first time on this var within this let. */
3364 }
3365 }
3327 case SPECPDL_LET_DEFAULT: 3366 case SPECPDL_LET_DEFAULT:
3328 Fset_default (specpdl_symbol (specpdl_ptr), 3367 Fset_default (specpdl_symbol (specpdl_ptr),
3329 specpdl_old_value (specpdl_ptr)); 3368 specpdl_old_value (specpdl_ptr));
@@ -3511,24 +3550,23 @@ backtrace_eval_unrewind (int distance)
3511 case SPECPDL_BACKTRACE: 3550 case SPECPDL_BACKTRACE:
3512 break; 3551 break;
3513 case SPECPDL_LET: 3552 case SPECPDL_LET:
3514 /* If variable has a trivial value (no forwarding), we can 3553 { /* If variable has a trivial value (no forwarding), we can
3515 just set it. No need to check for constant symbols here, 3554 just set it. No need to check for constant symbols here,
3516 since that was already done by specbind. */ 3555 since that was already done by specbind. */
3517 if (XSYMBOL (specpdl_symbol (tmp))->redirect 3556 struct Lisp_Symbol *sym = XSYMBOL (specpdl_symbol (tmp));
3518 == SYMBOL_PLAINVAL) 3557 if (sym->redirect == SYMBOL_PLAINVAL)
3519 { 3558 {
3520 struct Lisp_Symbol *sym = XSYMBOL (specpdl_symbol (tmp)); 3559 Lisp_Object old_value = specpdl_old_value (tmp);
3521 Lisp_Object old_value = specpdl_old_value (tmp); 3560 set_specpdl_old_value (tmp, SYMBOL_VAL (sym));
3522 set_specpdl_old_value (tmp, SYMBOL_VAL (sym)); 3561 SET_SYMBOL_VAL (sym, old_value);
3523 SET_SYMBOL_VAL (sym, old_value); 3562 break;
3524 break; 3563 }
3525 } 3564 else
3526 else 3565 { /* FALLTHROUGH!!
3527 { 3566 NOTE: we only ever come here if make_local_foo was used for
3528 /* FALLTHROUGH! 3567 the first time on this var within this let. */
3529 NOTE: we only ever come here if make_local_foo was used for 3568 }
3530 the first time on this var within this let. */ 3569 }
3531 }
3532 case SPECPDL_LET_DEFAULT: 3570 case SPECPDL_LET_DEFAULT:
3533 { 3571 {
3534 Lisp_Object sym = specpdl_symbol (tmp); 3572 Lisp_Object sym = specpdl_symbol (tmp);
@@ -3796,6 +3834,8 @@ alist of active lexical bindings. */);
3796 defsubr (&Ssetq); 3834 defsubr (&Ssetq);
3797 defsubr (&Squote); 3835 defsubr (&Squote);
3798 defsubr (&Sfunction); 3836 defsubr (&Sfunction);
3837 defsubr (&Sdefault_toplevel_value);
3838 defsubr (&Sset_default_toplevel_value);
3799 defsubr (&Sdefvar); 3839 defsubr (&Sdefvar);
3800 defsubr (&Sdefvaralias); 3840 defsubr (&Sdefvaralias);
3801 defsubr (&Sdefconst); 3841 defsubr (&Sdefconst);
diff --git a/src/fileio.c b/src/fileio.c
index c47b3533145..59e84053773 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -5096,8 +5096,6 @@ This calls `write-region-annotate-functions' at the start, and
5096 return Qnil; 5096 return Qnil;
5097} 5097}
5098 5098
5099Lisp_Object merge (Lisp_Object, Lisp_Object, Lisp_Object);
5100
5101DEFUN ("car-less-than-car", Fcar_less_than_car, Scar_less_than_car, 2, 2, 0, 5099DEFUN ("car-less-than-car", Fcar_less_than_car, Scar_less_than_car, 2, 2, 0,
5102 doc: /* Return t if (car A) is numerically less than (car B). */) 5100 doc: /* Return t if (car A) is numerically less than (car B). */)
5103 (Lisp_Object a, Lisp_Object b) 5101 (Lisp_Object a, Lisp_Object b)
diff --git a/src/fns.c b/src/fns.c
index 6f81635ab9d..de90fd731fb 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -1738,8 +1738,6 @@ See also the function `nreverse', which is used more often. */)
1738 return new; 1738 return new;
1739} 1739}
1740 1740
1741Lisp_Object merge (Lisp_Object org_l1, Lisp_Object org_l2, Lisp_Object pred);
1742
1743DEFUN ("sort", Fsort, Ssort, 2, 2, 0, 1741DEFUN ("sort", Fsort, Ssort, 2, 2, 0,
1744 doc: /* Sort LIST, stably, comparing elements using PREDICATE. 1742 doc: /* Sort LIST, stably, comparing elements using PREDICATE.
1745Returns the sorted list. LIST is modified by side effects. 1743Returns the sorted list. LIST is modified by side effects.
diff --git a/src/font.c b/src/font.c
index 124d5f9bd9e..073487b540d 100644
--- a/src/font.c
+++ b/src/font.c
@@ -204,9 +204,9 @@ font_make_object (int size, Lisp_Object entity, int pixelsize)
204 204
205 205
206 206
207static int font_pixel_size (FRAME_PTR f, Lisp_Object); 207static int font_pixel_size (struct frame *f, Lisp_Object);
208static Lisp_Object font_open_entity (FRAME_PTR, Lisp_Object, int); 208static Lisp_Object font_open_entity (struct frame *, Lisp_Object, int);
209static Lisp_Object font_matching_entity (FRAME_PTR, Lisp_Object *, 209static Lisp_Object font_matching_entity (struct frame *, Lisp_Object *,
210 Lisp_Object); 210 Lisp_Object);
211static unsigned font_encode_char (Lisp_Object, int); 211static unsigned font_encode_char (Lisp_Object, int);
212 212
@@ -269,7 +269,7 @@ font_intern_prop (const char *str, ptrdiff_t len, bool force_symbol)
269/* Return a pixel size of font-spec SPEC on frame F. */ 269/* Return a pixel size of font-spec SPEC on frame F. */
270 270
271static int 271static int
272font_pixel_size (FRAME_PTR f, Lisp_Object spec) 272font_pixel_size (struct frame *f, Lisp_Object spec)
273{ 273{
274#ifdef HAVE_WINDOW_SYSTEM 274#ifdef HAVE_WINDOW_SYSTEM
275 Lisp_Object size = AREF (spec, FONT_SIZE_INDEX); 275 Lisp_Object size = AREF (spec, FONT_SIZE_INDEX);
@@ -2037,11 +2037,6 @@ font_otf_Anchor (OTF_Anchor *anchor)
2037 2037
2038/* Font sorting. */ 2038/* Font sorting. */
2039 2039
2040static unsigned font_score (Lisp_Object, Lisp_Object *);
2041static int font_compare (const void *, const void *);
2042static Lisp_Object font_sort_entities (Lisp_Object, Lisp_Object,
2043 Lisp_Object, int);
2044
2045static double 2040static double
2046font_rescale_ratio (Lisp_Object font_entity) 2041font_rescale_ratio (Lisp_Object font_entity)
2047{ 2042{
@@ -2186,14 +2181,14 @@ font_compare (const void *d1, const void *d2)
2186 such a case. */ 2181 such a case. */
2187 2182
2188static Lisp_Object 2183static Lisp_Object
2189font_sort_entities (Lisp_Object list, Lisp_Object prefer, Lisp_Object frame, int best_only) 2184font_sort_entities (Lisp_Object list, Lisp_Object prefer,
2185 struct frame *f, int best_only)
2190{ 2186{
2191 Lisp_Object prefer_prop[FONT_SPEC_MAX]; 2187 Lisp_Object prefer_prop[FONT_SPEC_MAX];
2192 int len, maxlen, i; 2188 int len, maxlen, i;
2193 struct font_sort_data *data; 2189 struct font_sort_data *data;
2194 unsigned best_score; 2190 unsigned best_score;
2195 Lisp_Object best_entity; 2191 Lisp_Object best_entity;
2196 struct frame *f = XFRAME (frame);
2197 Lisp_Object tail, vec IF_LINT (= Qnil); 2192 Lisp_Object tail, vec IF_LINT (= Qnil);
2198 USE_SAFE_ALLOCA; 2193 USE_SAFE_ALLOCA;
2199 2194
@@ -2201,7 +2196,7 @@ font_sort_entities (Lisp_Object list, Lisp_Object prefer, Lisp_Object frame, int
2201 prefer_prop[i] = AREF (prefer, i); 2196 prefer_prop[i] = AREF (prefer, i);
2202 if (FLOATP (prefer_prop[FONT_SIZE_INDEX])) 2197 if (FLOATP (prefer_prop[FONT_SIZE_INDEX]))
2203 prefer_prop[FONT_SIZE_INDEX] 2198 prefer_prop[FONT_SIZE_INDEX]
2204 = make_number (font_pixel_size (XFRAME (frame), prefer)); 2199 = make_number (font_pixel_size (f, prefer));
2205 2200
2206 if (NILP (XCDR (list))) 2201 if (NILP (XCDR (list)))
2207 { 2202 {
@@ -2502,14 +2497,14 @@ font_match_p (Lisp_Object spec, Lisp_Object font)
2502 is a number frames sharing this cache, and FONT-CACHE-DATA is a 2497 is a number frames sharing this cache, and FONT-CACHE-DATA is a
2503 cons (FONT-SPEC FONT-ENTITY ...). */ 2498 cons (FONT-SPEC FONT-ENTITY ...). */
2504 2499
2505static void font_prepare_cache (FRAME_PTR, struct font_driver *); 2500static void font_prepare_cache (struct frame *, struct font_driver *);
2506static void font_finish_cache (FRAME_PTR, struct font_driver *); 2501static void font_finish_cache (struct frame *, struct font_driver *);
2507static Lisp_Object font_get_cache (FRAME_PTR, struct font_driver *); 2502static Lisp_Object font_get_cache (struct frame *, struct font_driver *);
2508static void font_clear_cache (FRAME_PTR, Lisp_Object, 2503static void font_clear_cache (struct frame *, Lisp_Object,
2509 struct font_driver *); 2504 struct font_driver *);
2510 2505
2511static void 2506static void
2512font_prepare_cache (FRAME_PTR f, struct font_driver *driver) 2507font_prepare_cache (struct frame *f, struct font_driver *driver)
2513{ 2508{
2514 Lisp_Object cache, val; 2509 Lisp_Object cache, val;
2515 2510
@@ -2531,7 +2526,7 @@ font_prepare_cache (FRAME_PTR f, struct font_driver *driver)
2531 2526
2532 2527
2533static void 2528static void
2534font_finish_cache (FRAME_PTR f, struct font_driver *driver) 2529font_finish_cache (struct frame *f, struct font_driver *driver)
2535{ 2530{
2536 Lisp_Object cache, val, tmp; 2531 Lisp_Object cache, val, tmp;
2537 2532
@@ -2552,7 +2547,7 @@ font_finish_cache (FRAME_PTR f, struct font_driver *driver)
2552 2547
2553 2548
2554static Lisp_Object 2549static Lisp_Object
2555font_get_cache (FRAME_PTR f, struct font_driver *driver) 2550font_get_cache (struct frame *f, struct font_driver *driver)
2556{ 2551{
2557 Lisp_Object val = driver->get_cache (f); 2552 Lisp_Object val = driver->get_cache (f);
2558 Lisp_Object type = driver->type; 2553 Lisp_Object type = driver->type;
@@ -2567,7 +2562,7 @@ font_get_cache (FRAME_PTR f, struct font_driver *driver)
2567 2562
2568 2563
2569static void 2564static void
2570font_clear_cache (FRAME_PTR f, Lisp_Object cache, struct font_driver *driver) 2565font_clear_cache (struct frame *f, Lisp_Object cache, struct font_driver *driver)
2571{ 2566{
2572 Lisp_Object tail, elt; 2567 Lisp_Object tail, elt;
2573 Lisp_Object tail2, entity; 2568 Lisp_Object tail2, entity;
@@ -2692,9 +2687,8 @@ font_delete_unmatched (Lisp_Object vec, Lisp_Object spec, int size)
2692 same font-driver. */ 2687 same font-driver. */
2693 2688
2694Lisp_Object 2689Lisp_Object
2695font_list_entities (Lisp_Object frame, Lisp_Object spec) 2690font_list_entities (struct frame *f, Lisp_Object spec)
2696{ 2691{
2697 FRAME_PTR f = XFRAME (frame);
2698 struct font_driver_list *driver_list = f->font_driver_list; 2692 struct font_driver_list *driver_list = f->font_driver_list;
2699 Lisp_Object ftype, val; 2693 Lisp_Object ftype, val;
2700 Lisp_Object list = Qnil; 2694 Lisp_Object list = Qnil;
@@ -2738,7 +2732,7 @@ font_list_entities (Lisp_Object frame, Lisp_Object spec)
2738 { 2732 {
2739 Lisp_Object copy; 2733 Lisp_Object copy;
2740 2734
2741 val = driver_list->driver->list (frame, scratch_font_spec); 2735 val = driver_list->driver->list (f, scratch_font_spec);
2742 if (NILP (val)) 2736 if (NILP (val))
2743 val = zero_vector; 2737 val = zero_vector;
2744 else 2738 else
@@ -2766,14 +2760,12 @@ font_list_entities (Lisp_Object frame, Lisp_Object spec)
2766 font-related attributes. */ 2760 font-related attributes. */
2767 2761
2768static Lisp_Object 2762static Lisp_Object
2769font_matching_entity (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec) 2763font_matching_entity (struct frame *f, Lisp_Object *attrs, Lisp_Object spec)
2770{ 2764{
2771 struct font_driver_list *driver_list = f->font_driver_list; 2765 struct font_driver_list *driver_list = f->font_driver_list;
2772 Lisp_Object ftype, size, entity; 2766 Lisp_Object ftype, size, entity;
2773 Lisp_Object frame;
2774 Lisp_Object work = copy_font_spec (spec); 2767 Lisp_Object work = copy_font_spec (spec);
2775 2768
2776 XSETFRAME (frame, f);
2777 ftype = AREF (spec, FONT_TYPE_INDEX); 2769 ftype = AREF (spec, FONT_TYPE_INDEX);
2778 size = AREF (spec, FONT_SIZE_INDEX); 2770 size = AREF (spec, FONT_SIZE_INDEX);
2779 2771
@@ -2797,7 +2789,7 @@ font_matching_entity (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec)
2797 entity = XCDR (entity); 2789 entity = XCDR (entity);
2798 else 2790 else
2799 { 2791 {
2800 entity = driver_list->driver->match (frame, work); 2792 entity = driver_list->driver->match (f, work);
2801 copy = copy_font_spec (work); 2793 copy = copy_font_spec (work);
2802 ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type); 2794 ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type);
2803 XSETCDR (cache, Fcons (Fcons (copy, entity), XCDR (cache))); 2795 XSETCDR (cache, Fcons (Fcons (copy, entity), XCDR (cache)));
@@ -2814,7 +2806,7 @@ font_matching_entity (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec)
2814 opened font object. */ 2806 opened font object. */
2815 2807
2816static Lisp_Object 2808static Lisp_Object
2817font_open_entity (FRAME_PTR f, Lisp_Object entity, int pixel_size) 2809font_open_entity (struct frame *f, Lisp_Object entity, int pixel_size)
2818{ 2810{
2819 struct font_driver_list *driver_list; 2811 struct font_driver_list *driver_list;
2820 Lisp_Object objlist, size, val, font_object; 2812 Lisp_Object objlist, size, val, font_object;
@@ -2892,7 +2884,7 @@ font_open_entity (FRAME_PTR f, Lisp_Object entity, int pixel_size)
2892/* Close FONT_OBJECT that is opened on frame F. */ 2884/* Close FONT_OBJECT that is opened on frame F. */
2893 2885
2894static void 2886static void
2895font_close_object (FRAME_PTR f, Lisp_Object font_object) 2887font_close_object (struct frame *f, Lisp_Object font_object)
2896{ 2888{
2897 struct font *font = XFONT_OBJECT (font_object); 2889 struct font *font = XFONT_OBJECT (font_object);
2898 2890
@@ -2912,7 +2904,7 @@ font_close_object (FRAME_PTR f, Lisp_Object font_object)
2912 FONT is a font-entity and it must be opened to check. */ 2904 FONT is a font-entity and it must be opened to check. */
2913 2905
2914int 2906int
2915font_has_char (FRAME_PTR f, Lisp_Object font, int c) 2907font_has_char (struct frame *f, Lisp_Object font, int c)
2916{ 2908{
2917 struct font *fontp; 2909 struct font *fontp;
2918 2910
@@ -3039,12 +3031,12 @@ font_clear_prop (Lisp_Object *attrs, enum font_property_index prop)
3039 supports C and is the best match for ATTRS and PIXEL_SIZE. */ 3031 supports C and is the best match for ATTRS and PIXEL_SIZE. */
3040 3032
3041static Lisp_Object 3033static Lisp_Object
3042font_select_entity (Lisp_Object frame, Lisp_Object entities, Lisp_Object *attrs, int pixel_size, int c) 3034font_select_entity (struct frame *f, Lisp_Object entities,
3035 Lisp_Object *attrs, int pixel_size, int c)
3043{ 3036{
3044 Lisp_Object font_entity; 3037 Lisp_Object font_entity;
3045 Lisp_Object prefer; 3038 Lisp_Object prefer;
3046 int i; 3039 int i;
3047 FRAME_PTR f = XFRAME (frame);
3048 3040
3049 if (NILP (XCDR (entities)) 3041 if (NILP (XCDR (entities))
3050 && ASIZE (XCAR (entities)) == 1) 3042 && ASIZE (XCAR (entities)) == 1)
@@ -3075,7 +3067,7 @@ font_select_entity (Lisp_Object frame, Lisp_Object entities, Lisp_Object *attrs,
3075 FONT_SET_STYLE (prefer, FONT_WIDTH_INDEX, attrs[LFACE_SWIDTH_INDEX]); 3067 FONT_SET_STYLE (prefer, FONT_WIDTH_INDEX, attrs[LFACE_SWIDTH_INDEX]);
3076 ASET (prefer, FONT_SIZE_INDEX, make_number (pixel_size)); 3068 ASET (prefer, FONT_SIZE_INDEX, make_number (pixel_size));
3077 3069
3078 return font_sort_entities (entities, prefer, frame, c); 3070 return font_sort_entities (entities, prefer, f, c);
3079} 3071}
3080 3072
3081/* Return a font-entity that satisfies SPEC and is the best match for 3073/* Return a font-entity that satisfies SPEC and is the best match for
@@ -3083,10 +3075,10 @@ font_select_entity (Lisp_Object frame, Lisp_Object entities, Lisp_Object *attrs,
3083 character that the entity must support. */ 3075 character that the entity must support. */
3084 3076
3085Lisp_Object 3077Lisp_Object
3086font_find_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec, int c) 3078font_find_for_lface (struct frame *f, Lisp_Object *attrs, Lisp_Object spec, int c)
3087{ 3079{
3088 Lisp_Object work; 3080 Lisp_Object work;
3089 Lisp_Object frame, entities, val; 3081 Lisp_Object entities, val;
3090 Lisp_Object foundry[3], *family, registry[3], adstyle[3]; 3082 Lisp_Object foundry[3], *family, registry[3], adstyle[3];
3091 int pixel_size; 3083 int pixel_size;
3092 int i, j, k, l; 3084 int i, j, k, l;
@@ -3118,7 +3110,6 @@ font_find_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec, int c)
3118 3110
3119 work = copy_font_spec (spec); 3111 work = copy_font_spec (spec);
3120 ASET (work, FONT_TYPE_INDEX, AREF (spec, FONT_TYPE_INDEX)); 3112 ASET (work, FONT_TYPE_INDEX, AREF (spec, FONT_TYPE_INDEX));
3121 XSETFRAME (frame, f);
3122 pixel_size = font_pixel_size (f, spec); 3113 pixel_size = font_pixel_size (f, spec);
3123 if (pixel_size == 0 && INTEGERP (attrs[LFACE_HEIGHT_INDEX])) 3114 if (pixel_size == 0 && INTEGERP (attrs[LFACE_HEIGHT_INDEX]))
3124 { 3115 {
@@ -3212,10 +3203,10 @@ font_find_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec, int c)
3212 for (l = 0; SYMBOLP (adstyle[l]); l++) 3203 for (l = 0; SYMBOLP (adstyle[l]); l++)
3213 { 3204 {
3214 ASET (work, FONT_ADSTYLE_INDEX, adstyle[l]); 3205 ASET (work, FONT_ADSTYLE_INDEX, adstyle[l]);
3215 entities = font_list_entities (frame, work); 3206 entities = font_list_entities (f, work);
3216 if (! NILP (entities)) 3207 if (! NILP (entities))
3217 { 3208 {
3218 val = font_select_entity (frame, entities, 3209 val = font_select_entity (f, entities,
3219 attrs, pixel_size, c); 3210 attrs, pixel_size, c);
3220 if (! NILP (val)) 3211 if (! NILP (val))
3221 return val; 3212 return val;
@@ -3231,7 +3222,7 @@ font_find_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec, int c)
3231 3222
3232 3223
3233Lisp_Object 3224Lisp_Object
3234font_open_for_lface (FRAME_PTR f, Lisp_Object entity, Lisp_Object *attrs, Lisp_Object spec) 3225font_open_for_lface (struct frame *f, Lisp_Object entity, Lisp_Object *attrs, Lisp_Object spec)
3235{ 3226{
3236 int size; 3227 int size;
3237 3228
@@ -3278,7 +3269,7 @@ font_open_for_lface (FRAME_PTR f, Lisp_Object entity, Lisp_Object *attrs, Lisp_O
3278 font-object. */ 3269 font-object. */
3279 3270
3280Lisp_Object 3271Lisp_Object
3281font_load_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec) 3272font_load_for_lface (struct frame *f, Lisp_Object *attrs, Lisp_Object spec)
3282{ 3273{
3283 Lisp_Object entity, name; 3274 Lisp_Object entity, name;
3284 3275
@@ -3307,7 +3298,7 @@ font_load_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec)
3307/* Make FACE on frame F ready to use the font opened for FACE. */ 3298/* Make FACE on frame F ready to use the font opened for FACE. */
3308 3299
3309void 3300void
3310font_prepare_for_face (FRAME_PTR f, struct face *face) 3301font_prepare_for_face (struct frame *f, struct face *face)
3311{ 3302{
3312 if (face->font->driver->prepare_face) 3303 if (face->font->driver->prepare_face)
3313 face->font->driver->prepare_face (f, face); 3304 face->font->driver->prepare_face (f, face);
@@ -3317,7 +3308,7 @@ font_prepare_for_face (FRAME_PTR f, struct face *face)
3317/* Make FACE on frame F stop using the font opened for FACE. */ 3308/* Make FACE on frame F stop using the font opened for FACE. */
3318 3309
3319void 3310void
3320font_done_for_face (FRAME_PTR f, struct face *face) 3311font_done_for_face (struct frame *f, struct face *face)
3321{ 3312{
3322 if (face->font->driver->done_face) 3313 if (face->font->driver->done_face)
3323 face->font->driver->done_face (f, face); 3314 face->font->driver->done_face (f, face);
@@ -3329,7 +3320,7 @@ font_done_for_face (FRAME_PTR f, struct face *face)
3329 font is found, return Qnil. */ 3320 font is found, return Qnil. */
3330 3321
3331Lisp_Object 3322Lisp_Object
3332font_open_by_spec (FRAME_PTR f, Lisp_Object spec) 3323font_open_by_spec (struct frame *f, Lisp_Object spec)
3333{ 3324{
3334 Lisp_Object attrs[LFACE_VECTOR_SIZE]; 3325 Lisp_Object attrs[LFACE_VECTOR_SIZE];
3335 3326
@@ -3353,7 +3344,7 @@ font_open_by_spec (FRAME_PTR f, Lisp_Object spec)
3353 found, return Qnil. */ 3344 found, return Qnil. */
3354 3345
3355Lisp_Object 3346Lisp_Object
3356font_open_by_name (FRAME_PTR f, Lisp_Object name) 3347font_open_by_name (struct frame *f, Lisp_Object name)
3357{ 3348{
3358 Lisp_Object args[2]; 3349 Lisp_Object args[2];
3359 Lisp_Object spec, ret; 3350 Lisp_Object spec, ret;
@@ -3383,7 +3374,7 @@ font_open_by_name (FRAME_PTR f, Lisp_Object name)
3383 (e.g. syms_of_xfont). */ 3374 (e.g. syms_of_xfont). */
3384 3375
3385void 3376void
3386register_font_driver (struct font_driver *driver, FRAME_PTR f) 3377register_font_driver (struct font_driver *driver, struct frame *f)
3387{ 3378{
3388 struct font_driver_list *root = f ? f->font_driver_list : font_driver_list; 3379 struct font_driver_list *root = f ? f->font_driver_list : font_driver_list;
3389 struct font_driver_list *prev, *list; 3380 struct font_driver_list *prev, *list;
@@ -3411,7 +3402,7 @@ register_font_driver (struct font_driver *driver, FRAME_PTR f)
3411} 3402}
3412 3403
3413void 3404void
3414free_font_driver_list (FRAME_PTR f) 3405free_font_driver_list (struct frame *f)
3415{ 3406{
3416 struct font_driver_list *list, *next; 3407 struct font_driver_list *list, *next;
3417 3408
@@ -3433,7 +3424,7 @@ free_font_driver_list (FRAME_PTR f)
3433 F. */ 3424 F. */
3434 3425
3435Lisp_Object 3426Lisp_Object
3436font_update_drivers (FRAME_PTR f, Lisp_Object new_drivers) 3427font_update_drivers (struct frame *f, Lisp_Object new_drivers)
3437{ 3428{
3438 Lisp_Object active_drivers = Qnil; 3429 Lisp_Object active_drivers = Qnil;
3439 struct font_driver_list *list; 3430 struct font_driver_list *list;
@@ -3522,7 +3513,7 @@ font_update_drivers (FRAME_PTR f, Lisp_Object new_drivers)
3522} 3513}
3523 3514
3524int 3515int
3525font_put_frame_data (FRAME_PTR f, struct font_driver *driver, void *data) 3516font_put_frame_data (struct frame *f, struct font_driver *driver, void *data)
3526{ 3517{
3527 struct font_data_list *list, *prev; 3518 struct font_data_list *list, *prev;
3528 3519
@@ -3556,7 +3547,7 @@ font_put_frame_data (FRAME_PTR f, struct font_driver *driver, void *data)
3556 3547
3557 3548
3558void * 3549void *
3559font_get_frame_data (FRAME_PTR f, struct font_driver *driver) 3550font_get_frame_data (struct frame *f, struct font_driver *driver)
3560{ 3551{
3561 struct font_data_list *list; 3552 struct font_data_list *list;
3562 3553
@@ -3630,7 +3621,7 @@ static Lisp_Object
3630font_at (int c, ptrdiff_t pos, struct face *face, struct window *w, 3621font_at (int c, ptrdiff_t pos, struct face *face, struct window *w,
3631 Lisp_Object string) 3622 Lisp_Object string)
3632{ 3623{
3633 FRAME_PTR f; 3624 struct frame *f;
3634 bool multibyte; 3625 bool multibyte;
3635 Lisp_Object font_object; 3626 Lisp_Object font_object;
3636 3627
@@ -4110,12 +4101,10 @@ control the order of the returned list. Fonts are sorted by
4110how close they are to PREFER. */) 4101how close they are to PREFER. */)
4111 (Lisp_Object font_spec, Lisp_Object frame, Lisp_Object num, Lisp_Object prefer) 4102 (Lisp_Object font_spec, Lisp_Object frame, Lisp_Object num, Lisp_Object prefer)
4112{ 4103{
4104 struct frame *f = decode_live_frame (frame);
4113 Lisp_Object vec, list; 4105 Lisp_Object vec, list;
4114 EMACS_INT n = 0; 4106 EMACS_INT n = 0;
4115 4107
4116 if (NILP (frame))
4117 frame = selected_frame;
4118 CHECK_LIVE_FRAME (frame);
4119 CHECK_FONT_SPEC (font_spec); 4108 CHECK_FONT_SPEC (font_spec);
4120 if (! NILP (num)) 4109 if (! NILP (num))
4121 { 4110 {
@@ -4127,7 +4116,7 @@ how close they are to PREFER. */)
4127 if (! NILP (prefer)) 4116 if (! NILP (prefer))
4128 CHECK_FONT_SPEC (prefer); 4117 CHECK_FONT_SPEC (prefer);
4129 4118
4130 list = font_list_entities (frame, font_spec); 4119 list = font_list_entities (f, font_spec);
4131 if (NILP (list)) 4120 if (NILP (list))
4132 return Qnil; 4121 return Qnil;
4133 if (NILP (XCDR (list)) 4122 if (NILP (XCDR (list))
@@ -4135,7 +4124,7 @@ how close they are to PREFER. */)
4135 return list1 (AREF (XCAR (list), 0)); 4124 return list1 (AREF (XCAR (list), 0));
4136 4125
4137 if (! NILP (prefer)) 4126 if (! NILP (prefer))
4138 vec = font_sort_entities (list, prefer, frame, 0); 4127 vec = font_sort_entities (list, prefer, f, 0);
4139 else 4128 else
4140 vec = font_vconcat_entity_vectors (list); 4129 vec = font_vconcat_entity_vectors (list);
4141 if (n == 0 || n >= ASIZE (vec)) 4130 if (n == 0 || n >= ASIZE (vec))
@@ -4163,13 +4152,11 @@ If FRAME is omitted or nil, the selected frame is used. */)
4163 struct font_driver_list *driver_list; 4152 struct font_driver_list *driver_list;
4164 Lisp_Object list = Qnil; 4153 Lisp_Object list = Qnil;
4165 4154
4166 XSETFRAME (frame, f);
4167
4168 for (driver_list = f->font_driver_list; driver_list; 4155 for (driver_list = f->font_driver_list; driver_list;
4169 driver_list = driver_list->next) 4156 driver_list = driver_list->next)
4170 if (driver_list->driver->list_family) 4157 if (driver_list->driver->list_family)
4171 { 4158 {
4172 Lisp_Object val = driver_list->driver->list_family (frame); 4159 Lisp_Object val = driver_list->driver->list_family (f);
4173 Lisp_Object tail = list; 4160 Lisp_Object tail = list;
4174 4161
4175 for (; CONSP (val); val = XCDR (val)) 4162 for (; CONSP (val); val = XCDR (val))
@@ -4247,7 +4234,7 @@ DEFUN ("clear-font-cache", Fclear_font_cache, Sclear_font_cache, 0, 0, 0,
4247 4234
4248 FOR_EACH_FRAME (list, frame) 4235 FOR_EACH_FRAME (list, frame)
4249 { 4236 {
4250 FRAME_PTR f = XFRAME (frame); 4237 struct frame *f = XFRAME (frame);
4251 struct font_driver_list *driver_list = f->font_driver_list; 4238 struct font_driver_list *driver_list = f->font_driver_list;
4252 4239
4253 for (; driver_list; driver_list = driver_list->next) 4240 for (; driver_list; driver_list = driver_list->next)
@@ -4795,7 +4782,7 @@ Type C-l to recover what previously shown. */)
4795 (Lisp_Object font_object, Lisp_Object string) 4782 (Lisp_Object font_object, Lisp_Object string)
4796{ 4783{
4797 Lisp_Object frame = selected_frame; 4784 Lisp_Object frame = selected_frame;
4798 FRAME_PTR f = XFRAME (frame); 4785 struct frame *f = XFRAME (frame);
4799 struct font *font; 4786 struct font *font;
4800 struct face *face; 4787 struct face *face;
4801 int i, len, width; 4788 int i, len, width;
diff --git a/src/font.h b/src/font.h
index ffed0461ff7..daeb320c1ab 100644
--- a/src/font.h
+++ b/src/font.h
@@ -504,7 +504,7 @@ struct font_driver
504 504
505 /* Return a cache of font-entities on frame F. The cache must be a 505 /* Return a cache of font-entities on frame F. The cache must be a
506 cons whose cdr part is the actual cache area. */ 506 cons whose cdr part is the actual cache area. */
507 Lisp_Object (*get_cache) (FRAME_PTR F); 507 Lisp_Object (*get_cache) (struct frame *f);
508 508
509 /* List fonts exactly matching with FONT_SPEC on FRAME. The value 509 /* List fonts exactly matching with FONT_SPEC on FRAME. The value
510 is a list of font-entities. The font properties to be considered 510 is a list of font-entities. The font properties to be considered
@@ -527,7 +527,7 @@ struct font_driver
527 527
528 This and the following `match' are the only APIs that allocate 528 This and the following `match' are the only APIs that allocate
529 font-entities. */ 529 font-entities. */
530 Lisp_Object (*list) (Lisp_Object frame, Lisp_Object font_spec); 530 Lisp_Object (*list) (struct frame *frame, Lisp_Object font_spec);
531 531
532 /* Return a font-entity most closely matching with FONT_SPEC on 532 /* Return a font-entity most closely matching with FONT_SPEC on
533 FRAME. Which font property to consider, and how to calculate the 533 FRAME. Which font property to consider, and how to calculate the
@@ -536,12 +536,12 @@ struct font_driver
536 536
537 The properties that the font-entity has is the same as `list' 537 The properties that the font-entity has is the same as `list'
538 method. */ 538 method. */
539 Lisp_Object (*match) (Lisp_Object frame, Lisp_Object font_spec); 539 Lisp_Object (*match) (struct frame *f, Lisp_Object spec);
540 540
541 /* Optional. 541 /* Optional.
542 List available families. The value is a list of family names 542 List available families. The value is a list of family names
543 (symbols). */ 543 (symbols). */
544 Lisp_Object (*list_family) (Lisp_Object frame); 544 Lisp_Object (*list_family) (struct frame *f);
545 545
546 /* Optional (if FONT_EXTRA_INDEX is not Lisp_Save_Value). 546 /* Optional (if FONT_EXTRA_INDEX is not Lisp_Save_Value).
547 Free FONT_EXTRA_INDEX field of FONT_ENTITY. */ 547 Free FONT_EXTRA_INDEX field of FONT_ENTITY. */
@@ -549,21 +549,21 @@ struct font_driver
549 549
550 /* Open a font specified by FONT_ENTITY on frame F. If the font is 550 /* Open a font specified by FONT_ENTITY on frame F. If the font is
551 scalable, open it with PIXEL_SIZE. */ 551 scalable, open it with PIXEL_SIZE. */
552 Lisp_Object (*open) (FRAME_PTR f, Lisp_Object font_entity, 552 Lisp_Object (*open) (struct frame *f, Lisp_Object font_entity,
553 int pixel_size); 553 int pixel_size);
554 554
555 /* Close FONT on frame F. */ 555 /* Close FONT on frame F. */
556 void (*close) (FRAME_PTR f, struct font *font); 556 void (*close) (struct frame *f, struct font *font);
557 557
558 /* Optional (if FACE->extra is not used). 558 /* Optional (if FACE->extra is not used).
559 Prepare FACE for displaying characters by FONT on frame F by 559 Prepare FACE for displaying characters by FONT on frame F by
560 storing some data in FACE->extra. If successful, return 0. 560 storing some data in FACE->extra. If successful, return 0.
561 Otherwise, return -1. */ 561 Otherwise, return -1. */
562 int (*prepare_face) (FRAME_PTR f, struct face *face); 562 int (*prepare_face) (struct frame *f, struct face *face);
563 563
564 /* Optional. 564 /* Optional.
565 Done FACE for displaying characters by FACE->font on frame F. */ 565 Done FACE for displaying characters by FACE->font on frame F. */
566 void (*done_face) (FRAME_PTR f, struct face *face); 566 void (*done_face) (struct frame *f, struct face *face);
567 567
568 /* Optional. 568 /* Optional.
569 If FONT (FONT-ENTITY or FONT-OBJECT) has a glyph for character C 569 If FONT (FONT-ENTITY or FONT-OBJECT) has a glyph for character C
@@ -646,12 +646,12 @@ struct font_driver
646 Make the font driver ready for frame F. Usually this function 646 Make the font driver ready for frame F. Usually this function
647 makes some data specific to F and stores it in F by calling 647 makes some data specific to F and stores it in F by calling
648 font_put_frame_data (). */ 648 font_put_frame_data (). */
649 int (*start_for_frame) (FRAME_PTR f); 649 int (*start_for_frame) (struct frame *f);
650 650
651 /* Optional. 651 /* Optional.
652 End using the driver for frame F. Usually this function free 652 End using the driver for frame F. Usually this function free
653 some data stored for F. */ 653 some data stored for F. */
654 int (*end_for_frame) (FRAME_PTR f); 654 int (*end_for_frame) (struct frame *f);
655 655
656 /* Optional. 656 /* Optional.
657 657
@@ -674,7 +674,7 @@ struct font_driver
674 If FONT is usable on frame F, return 0. Otherwise return -1. 674 If FONT is usable on frame F, return 0. Otherwise return -1.
675 This method is used only for debugging. If this method is NULL, 675 This method is used only for debugging. If this method is NULL,
676 Emacs assumes that the font is usable on any frame. */ 676 Emacs assumes that the font is usable on any frame. */
677 int (*check) (FRAME_PTR F, struct font *font); 677 int (*check) (struct frame *f, struct font *font);
678 678
679 /* Optional. 679 /* Optional.
680 680
@@ -698,8 +698,8 @@ struct font_driver
698 698
699 699
700/* Chain of font drivers. There's one global font driver list 700/* Chain of font drivers. There's one global font driver list
701 (font_driver_list in font.c). In addition, each frame has its own 701 (font_driver_list in font.c). In addition, each frame has
702 font driver list at FRAME_PTR->font_driver_list. */ 702 its own font driver list at F->font_driver_list. */
703 703
704struct font_driver_list 704struct font_driver_list
705{ 705{
@@ -713,8 +713,8 @@ struct font_driver_list
713}; 713};
714 714
715 715
716/* Chain of arbitrary data specific to each font driver. Each frame 716/* Chain of arbitrary data specific to each font driver.
717 has its own font data list at FRAME_PTR->font_data_list. */ 717 Each frame has its own font data list at F->font_data_list. */
718 718
719struct font_data_list 719struct font_data_list
720{ 720{
@@ -742,28 +742,27 @@ extern Lisp_Object font_style_symbolic (Lisp_Object font,
742 bool for_face); 742 bool for_face);
743 743
744extern bool font_match_p (Lisp_Object spec, Lisp_Object font); 744extern bool font_match_p (Lisp_Object spec, Lisp_Object font);
745extern Lisp_Object font_list_entities (Lisp_Object frame, 745extern Lisp_Object font_list_entities (struct frame *, Lisp_Object);
746 Lisp_Object spec);
747 746
748extern Lisp_Object font_get_name (Lisp_Object font_object); 747extern Lisp_Object font_get_name (Lisp_Object font_object);
749extern Lisp_Object font_spec_from_name (Lisp_Object font_name); 748extern Lisp_Object font_spec_from_name (Lisp_Object font_name);
750extern Lisp_Object font_get_frame (Lisp_Object font_object); 749extern Lisp_Object font_get_frame (Lisp_Object font_object);
751extern int font_has_char (FRAME_PTR, Lisp_Object, int); 750extern int font_has_char (struct frame *, Lisp_Object, int);
752 751
753extern void font_clear_prop (Lisp_Object *attrs, 752extern void font_clear_prop (Lisp_Object *attrs,
754 enum font_property_index prop); 753 enum font_property_index prop);
755extern Lisp_Object font_find_for_lface (FRAME_PTR f, Lisp_Object *lface, 754extern Lisp_Object font_find_for_lface (struct frame *f, Lisp_Object *lface,
756 Lisp_Object spec, int c); 755 Lisp_Object spec, int c);
757extern Lisp_Object font_open_for_lface (FRAME_PTR f, Lisp_Object entity, 756extern Lisp_Object font_open_for_lface (struct frame *f, Lisp_Object entity,
758 Lisp_Object *lface, 757 Lisp_Object *lface,
759 Lisp_Object spec); 758 Lisp_Object spec);
760extern Lisp_Object font_load_for_lface (FRAME_PTR f, Lisp_Object *lface, 759extern Lisp_Object font_load_for_lface (struct frame *f, Lisp_Object *lface,
761 Lisp_Object spec); 760 Lisp_Object spec);
762extern void font_prepare_for_face (FRAME_PTR f, struct face *face); 761extern void font_prepare_for_face (struct frame *f, struct face *face);
763extern void font_done_for_face (FRAME_PTR f, struct face *face); 762extern void font_done_for_face (struct frame *f, struct face *face);
764 763
765extern Lisp_Object font_open_by_spec (FRAME_PTR f, Lisp_Object spec); 764extern Lisp_Object font_open_by_spec (struct frame *f, Lisp_Object spec);
766extern Lisp_Object font_open_by_name (FRAME_PTR f, Lisp_Object name); 765extern Lisp_Object font_open_by_name (struct frame *f, Lisp_Object name);
767 766
768extern Lisp_Object font_intern_prop (const char *str, ptrdiff_t len, 767extern Lisp_Object font_intern_prop (const char *str, ptrdiff_t len,
769 bool force_symbol); 768 bool force_symbol);
@@ -778,9 +777,9 @@ extern ptrdiff_t font_unparse_xlfd (Lisp_Object font, int pixel_size,
778 char *name, int bytes); 777 char *name, int bytes);
779extern int font_unparse_fcname (Lisp_Object font, int pixel_size, 778extern int font_unparse_fcname (Lisp_Object font, int pixel_size,
780 char *name, int bytes); 779 char *name, int bytes);
781extern void register_font_driver (struct font_driver *driver, FRAME_PTR f); 780extern void register_font_driver (struct font_driver *driver, struct frame *f);
782extern void free_font_driver_list (FRAME_PTR f); 781extern void free_font_driver_list (struct frame *f);
783extern Lisp_Object font_update_drivers (FRAME_PTR f, Lisp_Object list); 782extern Lisp_Object font_update_drivers (struct frame *f, Lisp_Object list);
784extern Lisp_Object font_range (ptrdiff_t, ptrdiff_t, ptrdiff_t *, 783extern Lisp_Object font_range (ptrdiff_t, ptrdiff_t, ptrdiff_t *,
785 struct window *, struct face *, 784 struct window *, struct face *,
786 Lisp_Object); 785 Lisp_Object);
@@ -789,10 +788,10 @@ extern void font_fill_lglyph_metrics (Lisp_Object, Lisp_Object);
789extern Lisp_Object font_put_extra (Lisp_Object font, Lisp_Object prop, 788extern Lisp_Object font_put_extra (Lisp_Object font, Lisp_Object prop,
790 Lisp_Object val); 789 Lisp_Object val);
791 790
792extern int font_put_frame_data (FRAME_PTR f, 791extern int font_put_frame_data (struct frame *f,
793 struct font_driver *driver, 792 struct font_driver *driver,
794 void *data); 793 void *data);
795extern void *font_get_frame_data (FRAME_PTR f, 794extern void *font_get_frame_data (struct frame *f,
796 struct font_driver *driver); 795 struct font_driver *driver);
797 796
798extern void font_filter_properties (Lisp_Object font, 797extern void font_filter_properties (Lisp_Object font,
diff --git a/src/fontset.c b/src/fontset.c
index 6a6a434add0..0bf716bf1b2 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -539,8 +539,9 @@ fontset_find_font (Lisp_Object fontset, int c, struct face *face, int id,
539{ 539{
540 Lisp_Object vec, font_group; 540 Lisp_Object vec, font_group;
541 int i, charset_matched = 0, found_index; 541 int i, charset_matched = 0, found_index;
542 FRAME_PTR f = (FRAMEP (FONTSET_FRAME (fontset)) 542 struct frame *f = (FRAMEP (FONTSET_FRAME (fontset))
543 ? XFRAME (FONTSET_FRAME (fontset)) : XFRAME (selected_frame)); 543 ? XFRAME (FONTSET_FRAME (fontset))
544 : XFRAME (selected_frame));
544 Lisp_Object rfont_def; 545 Lisp_Object rfont_def;
545 546
546 font_group = fontset_get_font_group (fontset, fallback ? -1 : c); 547 font_group = fontset_get_font_group (fontset, fallback ? -1 : c);
@@ -859,7 +860,7 @@ fontset_ascii (int id)
859} 860}
860 861
861static void 862static void
862free_realized_fontset (FRAME_PTR f, Lisp_Object fontset) 863free_realized_fontset (struct frame *f, Lisp_Object fontset)
863{ 864{
864#if 0 865#if 0
865 Lisp_Object tail; 866 Lisp_Object tail;
@@ -877,7 +878,7 @@ free_realized_fontset (FRAME_PTR f, Lisp_Object fontset)
877 free_realized_face. */ 878 free_realized_face. */
878 879
879void 880void
880free_face_fontset (FRAME_PTR f, struct face *face) 881free_face_fontset (struct frame *f, struct face *face)
881{ 882{
882 Lisp_Object fontset; 883 Lisp_Object fontset;
883 884
@@ -930,7 +931,7 @@ face_suitable_for_char_p (struct face *face, int c)
930 the macro FACE_FOR_CHAR. */ 931 the macro FACE_FOR_CHAR. */
931 932
932int 933int
933face_for_char (FRAME_PTR f, struct face *face, int c, int pos, Lisp_Object object) 934face_for_char (struct frame *f, struct face *face, int c, int pos, Lisp_Object object)
934{ 935{
935 Lisp_Object fontset, rfont_def, charset; 936 Lisp_Object fontset, rfont_def, charset;
936 int face_id; 937 int face_id;
@@ -1048,7 +1049,7 @@ font_for_char (struct face *face, int c, int pos, Lisp_Object object)
1048 Called from realize_x_face. */ 1049 Called from realize_x_face. */
1049 1050
1050int 1051int
1051make_fontset_for_ascii_face (FRAME_PTR f, int base_fontset_id, struct face *face) 1052make_fontset_for_ascii_face (struct frame *f, int base_fontset_id, struct face *face)
1052{ 1053{
1053 Lisp_Object base_fontset, fontset, frame; 1054 Lisp_Object base_fontset, fontset, frame;
1054 1055
@@ -1227,7 +1228,7 @@ If REGEXPP is non-nil, PATTERN is a regular expression. */)
1227/* Return a list of base fontset names matching PATTERN on frame F. */ 1228/* Return a list of base fontset names matching PATTERN on frame F. */
1228 1229
1229Lisp_Object 1230Lisp_Object
1230list_fontsets (FRAME_PTR f, Lisp_Object pattern, int size) 1231list_fontsets (struct frame *f, Lisp_Object pattern, int size)
1231{ 1232{
1232 Lisp_Object frame, regexp, val; 1233 Lisp_Object frame, regexp, val;
1233 int id; 1234 int id;
@@ -1284,7 +1285,7 @@ free_realized_fontsets (Lisp_Object base)
1284 for (tail = FONTSET_FACE_ALIST (this); CONSP (tail); 1285 for (tail = FONTSET_FACE_ALIST (this); CONSP (tail);
1285 tail = XCDR (tail)) 1286 tail = XCDR (tail))
1286 { 1287 {
1287 FRAME_PTR f = XFRAME (FONTSET_FRAME (this)); 1288 struct frame *f = XFRAME (FONTSET_FRAME (this));
1288 int face_id = XINT (XCDR (XCAR (tail))); 1289 int face_id = XINT (XCDR (XCAR (tail)));
1289 struct face *face = FACE_FROM_ID (f, face_id); 1290 struct face *face = FACE_FROM_ID (f, face_id);
1290 1291
@@ -1612,7 +1613,7 @@ appended. By default, FONT-SPEC overrides the previous settings. */)
1612 name = FONTSET_NAME (fontset); 1613 name = FONTSET_NAME (fontset);
1613 FOR_EACH_FRAME (tail, fr) 1614 FOR_EACH_FRAME (tail, fr)
1614 { 1615 {
1615 FRAME_PTR f = XFRAME (fr); 1616 struct frame *f = XFRAME (fr);
1616 Lisp_Object font_object; 1617 Lisp_Object font_object;
1617 struct face *face; 1618 struct face *face;
1618 1619
@@ -2140,7 +2141,7 @@ dump_fontset (Lisp_Object fontset)
2140 frame = FONTSET_FRAME (fontset); 2141 frame = FONTSET_FRAME (fontset);
2141 if (FRAMEP (frame)) 2142 if (FRAMEP (frame))
2142 { 2143 {
2143 FRAME_PTR f = XFRAME (frame); 2144 struct frame *f = XFRAME (frame);
2144 2145
2145 if (FRAME_LIVE_P (f)) 2146 if (FRAME_LIVE_P (f))
2146 ASET (vec, 1, 2147 ASET (vec, 1,
diff --git a/src/fontset.h b/src/fontset.h
index 926520c8001..fd16c7178f5 100644
--- a/src/fontset.h
+++ b/src/fontset.h
@@ -28,12 +28,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
28 28
29struct face; 29struct face;
30 30
31extern void free_face_fontset (FRAME_PTR, struct face *); 31extern void free_face_fontset (struct frame *, struct face *);
32extern int face_for_char (FRAME_PTR, struct face *, int, 32extern int face_for_char (struct frame *, struct face *, int,
33 int, Lisp_Object); 33 int, Lisp_Object);
34extern Lisp_Object font_for_char (struct face *, int, int, Lisp_Object); 34extern Lisp_Object font_for_char (struct face *, int, int, Lisp_Object);
35 35
36extern int make_fontset_for_ascii_face (FRAME_PTR, int, struct face *); 36extern int make_fontset_for_ascii_face (struct frame *, int, struct face *);
37extern int fontset_from_font (Lisp_Object); 37extern int fontset_from_font (Lisp_Object);
38extern int fs_query_fontset (Lisp_Object, int); 38extern int fs_query_fontset (Lisp_Object, int);
39extern Lisp_Object list_fontsets (struct frame *, Lisp_Object, int); 39extern Lisp_Object list_fontsets (struct frame *, Lisp_Object, int);
diff --git a/src/frame.c b/src/frame.c
index f8b7201e984..14fc15c4717 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -69,7 +69,6 @@ Lisp_Object Qnoelisp;
69static Lisp_Object Qx_frame_parameter; 69static Lisp_Object Qx_frame_parameter;
70Lisp_Object Qx_resource_name; 70Lisp_Object Qx_resource_name;
71Lisp_Object Qterminal; 71Lisp_Object Qterminal;
72Lisp_Object Qterminal_live_p;
73 72
74/* Frame parameters (set or reported). */ 73/* Frame parameters (set or reported). */
75 74
@@ -310,7 +309,7 @@ predicates which report frame's specific UI-related capabilities. */)
310} 309}
311 310
312struct frame * 311struct frame *
313make_frame (int mini_p) 312make_frame (bool mini_p)
314{ 313{
315 Lisp_Object frame; 314 Lisp_Object frame;
316 register struct frame *f; 315 register struct frame *f;
@@ -725,16 +724,13 @@ affects all frames on the same terminal device. */)
725 adjust_glyphs (f); 724 adjust_glyphs (f);
726 calculate_costs (f); 725 calculate_costs (f);
727 XSETFRAME (frame, f); 726 XSETFRAME (frame, f);
727
728 store_in_alist (&parms, Qtty_type, build_string (t->display_info.tty->type));
729 store_in_alist (&parms, Qtty,
730 (t->display_info.tty->name
731 ? build_string (t->display_info.tty->name)
732 : Qnil));
728 Fmodify_frame_parameters (frame, parms); 733 Fmodify_frame_parameters (frame, parms);
729 Fmodify_frame_parameters
730 (frame, list1 (Fcons (Qtty_type,
731 build_string (t->display_info.tty->type))));
732 if (t->display_info.tty->name != NULL)
733 Fmodify_frame_parameters
734 (frame, list1 (Fcons (Qtty,
735 build_string (t->display_info.tty->name))));
736 else
737 Fmodify_frame_parameters (frame, list1 (Fcons (Qtty, Qnil)));
738 734
739 /* Make the frame face alist be frame-specific, so that each 735 /* Make the frame face alist be frame-specific, so that each
740 frame could change its face definitions independently. */ 736 frame could change its face definitions independently. */
@@ -1097,7 +1093,7 @@ Otherwise, include all frames. */)
1097 (Exception: if F is the terminal frame, and we are using X, return 1.) */ 1093 (Exception: if F is the terminal frame, and we are using X, return 1.) */
1098 1094
1099static int 1095static int
1100other_visible_frames (FRAME_PTR f) 1096other_visible_frames (struct frame *f)
1101{ 1097{
1102 Lisp_Object frames, this; 1098 Lisp_Object frames, this;
1103 1099
@@ -1471,7 +1467,7 @@ passing the normal return value to that function as an argument,
1471and returns whatever that function returns. */) 1467and returns whatever that function returns. */)
1472 (void) 1468 (void)
1473{ 1469{
1474 FRAME_PTR f; 1470 struct frame *f;
1475 Lisp_Object lispy_dummy; 1471 Lisp_Object lispy_dummy;
1476 Lisp_Object x, y, retval; 1472 Lisp_Object x, y, retval;
1477 struct gcpro gcpro1; 1473 struct gcpro gcpro1;
@@ -1517,7 +1513,7 @@ to read the mouse position, it returns the selected frame for FRAME
1517and nil for X and Y. */) 1513and nil for X and Y. */)
1518 (void) 1514 (void)
1519{ 1515{
1520 FRAME_PTR f; 1516 struct frame *f;
1521 Lisp_Object lispy_dummy; 1517 Lisp_Object lispy_dummy;
1522 Lisp_Object x, y; 1518 Lisp_Object x, y;
1523 1519
@@ -2365,7 +2361,7 @@ to `frame-height'). */)
2365 2361
2366#ifdef HAVE_WINDOW_SYSTEM 2362#ifdef HAVE_WINDOW_SYSTEM
2367 if (FRAME_WINDOW_P (f)) 2363 if (FRAME_WINDOW_P (f))
2368 return make_number (x_pixel_height (f)); 2364 return make_number (FRAME_PIXEL_HEIGHT (f));
2369 else 2365 else
2370#endif 2366#endif
2371 return make_number (FRAME_LINES (f)); 2367 return make_number (FRAME_LINES (f));
@@ -2382,7 +2378,7 @@ If FRAME is omitted or nil, the selected frame is used. */)
2382 2378
2383#ifdef HAVE_WINDOW_SYSTEM 2379#ifdef HAVE_WINDOW_SYSTEM
2384 if (FRAME_WINDOW_P (f)) 2380 if (FRAME_WINDOW_P (f))
2385 return make_number (x_pixel_width (f)); 2381 return make_number (FRAME_PIXEL_WIDTH (f));
2386 else 2382 else
2387#endif 2383#endif
2388 return make_number (FRAME_COLS (f)); 2384 return make_number (FRAME_COLS (f));
@@ -2407,8 +2403,9 @@ is used. */)
2407 2403
2408DEFUN ("set-frame-height", Fset_frame_height, Sset_frame_height, 2, 3, 0, 2404DEFUN ("set-frame-height", Fset_frame_height, Sset_frame_height, 2, 3, 0,
2409 doc: /* Specify that the frame FRAME has LINES lines. 2405 doc: /* Specify that the frame FRAME has LINES lines.
2410Optional third arg non-nil means that redisplay should use LINES lines 2406If FRAME is nil, the selected frame is used. Optional third arg
2411but that the idea of the actual height of the frame should not be changed. */) 2407non-nil means that redisplay should use LINES lines but that the
2408idea of the actual height of the frame should not be changed. */)
2412 (Lisp_Object frame, Lisp_Object lines, Lisp_Object pretend) 2409 (Lisp_Object frame, Lisp_Object lines, Lisp_Object pretend)
2413{ 2410{
2414 register struct frame *f = decode_live_frame (frame); 2411 register struct frame *f = decode_live_frame (frame);
@@ -2431,8 +2428,9 @@ but that the idea of the actual height of the frame should not be changed. */)
2431 2428
2432DEFUN ("set-frame-width", Fset_frame_width, Sset_frame_width, 2, 3, 0, 2429DEFUN ("set-frame-width", Fset_frame_width, Sset_frame_width, 2, 3, 0,
2433 doc: /* Specify that the frame FRAME has COLS columns. 2430 doc: /* Specify that the frame FRAME has COLS columns.
2434Optional third arg non-nil means that redisplay should use COLS columns 2431If FRAME is nil, the selected frame is used. Optional third arg
2435but that the idea of the actual width of the frame should not be changed. */) 2432non-nil means that redisplay should use COLS columns but that the
2433idea of the actual width of the frame should not be changed. */)
2436 (Lisp_Object frame, Lisp_Object cols, Lisp_Object pretend) 2434 (Lisp_Object frame, Lisp_Object cols, Lisp_Object pretend)
2437{ 2435{
2438 register struct frame *f = decode_live_frame (frame); 2436 register struct frame *f = decode_live_frame (frame);
@@ -2454,15 +2452,14 @@ but that the idea of the actual width of the frame should not be changed. */)
2454} 2452}
2455 2453
2456DEFUN ("set-frame-size", Fset_frame_size, Sset_frame_size, 3, 3, 0, 2454DEFUN ("set-frame-size", Fset_frame_size, Sset_frame_size, 3, 3, 0,
2457 doc: /* Sets size of FRAME to COLS by ROWS, measured in characters. */) 2455 doc: /* Sets size of FRAME to COLS by ROWS, measured in characters.
2456If FRAME is nil, the selected frame is used. */)
2458 (Lisp_Object frame, Lisp_Object cols, Lisp_Object rows) 2457 (Lisp_Object frame, Lisp_Object cols, Lisp_Object rows)
2459{ 2458{
2460 register struct frame *f; 2459 register struct frame *f = decode_live_frame (frame);
2461 2460
2462 CHECK_LIVE_FRAME (frame);
2463 CHECK_TYPE_RANGED_INTEGER (int, cols); 2461 CHECK_TYPE_RANGED_INTEGER (int, cols);
2464 CHECK_TYPE_RANGED_INTEGER (int, rows); 2462 CHECK_TYPE_RANGED_INTEGER (int, rows);
2465 f = XFRAME (frame);
2466 2463
2467 /* I think this should be done with a hook. */ 2464 /* I think this should be done with a hook. */
2468#ifdef HAVE_WINDOW_SYSTEM 2465#ifdef HAVE_WINDOW_SYSTEM
@@ -2484,17 +2481,16 @@ DEFUN ("set-frame-size", Fset_frame_size, Sset_frame_size, 3, 3, 0,
2484DEFUN ("set-frame-position", Fset_frame_position, 2481DEFUN ("set-frame-position", Fset_frame_position,
2485 Sset_frame_position, 3, 3, 0, 2482 Sset_frame_position, 3, 3, 0,
2486 doc: /* Sets position of FRAME in pixels to XOFFSET by YOFFSET. 2483 doc: /* Sets position of FRAME in pixels to XOFFSET by YOFFSET.
2487This is actually the position of the upper left corner of the frame. 2484If FRAME is nil, the selected frame is used. XOFFSET and YOFFSET are
2488Negative values for XOFFSET or YOFFSET are interpreted relative to 2485actually the position of the upper left corner of the frame. Negative
2489the rightmost or bottommost possible position (that stays within the screen). */) 2486values for XOFFSET or YOFFSET are interpreted relative to the rightmost
2487or bottommost possible position (that stays within the screen). */)
2490 (Lisp_Object frame, Lisp_Object xoffset, Lisp_Object yoffset) 2488 (Lisp_Object frame, Lisp_Object xoffset, Lisp_Object yoffset)
2491{ 2489{
2492 register struct frame *f; 2490 register struct frame *f = decode_live_frame (frame);
2493 2491
2494 CHECK_LIVE_FRAME (frame);
2495 CHECK_TYPE_RANGED_INTEGER (int, xoffset); 2492 CHECK_TYPE_RANGED_INTEGER (int, xoffset);
2496 CHECK_TYPE_RANGED_INTEGER (int, yoffset); 2493 CHECK_TYPE_RANGED_INTEGER (int, yoffset);
2497 f = XFRAME (frame);
2498 2494
2499 /* I think this should be done with a hook. */ 2495 /* I think this should be done with a hook. */
2500#ifdef HAVE_WINDOW_SYSTEM 2496#ifdef HAVE_WINDOW_SYSTEM
@@ -2614,7 +2610,7 @@ x_fullscreen_adjust (struct frame *f, int *width, int *height, int *top_pos, int
2614 to store the new value in the parameter alist. */ 2610 to store the new value in the parameter alist. */
2615 2611
2616void 2612void
2617x_set_frame_parameters (FRAME_PTR f, Lisp_Object alist) 2613x_set_frame_parameters (struct frame *f, Lisp_Object alist)
2618{ 2614{
2619 Lisp_Object tail; 2615 Lisp_Object tail;
2620 2616
@@ -2633,9 +2629,9 @@ x_set_frame_parameters (FRAME_PTR f, Lisp_Object alist)
2633 Lisp_Object *parms; 2629 Lisp_Object *parms;
2634 Lisp_Object *values; 2630 Lisp_Object *values;
2635 ptrdiff_t i, p; 2631 ptrdiff_t i, p;
2636 int left_no_change = 0, top_no_change = 0; 2632 bool left_no_change = 0, top_no_change = 0;
2637 int icon_left_no_change = 0, icon_top_no_change = 0; 2633 bool icon_left_no_change = 0, icon_top_no_change = 0;
2638 int size_changed = 0; 2634 bool size_changed = 0;
2639 struct gcpro gcpro1, gcpro2; 2635 struct gcpro gcpro1, gcpro2;
2640 2636
2641 i = 0; 2637 i = 0;
@@ -2871,10 +2867,11 @@ x_set_frame_parameters (FRAME_PTR f, Lisp_Object alist)
2871 /* Actually set that position, and convert to absolute. */ 2867 /* Actually set that position, and convert to absolute. */
2872 x_set_offset (f, leftpos, toppos, -1); 2868 x_set_offset (f, leftpos, toppos, -1);
2873 } 2869 }
2874 2870#ifdef HAVE_X_WINDOWS
2875 if ((!NILP (icon_left) || !NILP (icon_top)) 2871 if ((!NILP (icon_left) || !NILP (icon_top))
2876 && ! (icon_left_no_change && icon_top_no_change)) 2872 && ! (icon_left_no_change && icon_top_no_change))
2877 x_wm_set_icon_position (f, XINT (icon_left), XINT (icon_top)); 2873 x_wm_set_icon_position (f, XINT (icon_left), XINT (icon_top));
2874#endif /* HAVE_X_WINDOWS */
2878 } 2875 }
2879 2876
2880 UNGCPRO; 2877 UNGCPRO;
@@ -3351,7 +3348,7 @@ x_set_scroll_bar_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
3351/* Return non-nil if frame F wants a bitmap icon. */ 3348/* Return non-nil if frame F wants a bitmap icon. */
3352 3349
3353Lisp_Object 3350Lisp_Object
3354x_icon_type (FRAME_PTR f) 3351x_icon_type (struct frame *f)
3355{ 3352{
3356 Lisp_Object tem; 3353 Lisp_Object tem;
3357 3354
@@ -3939,8 +3936,8 @@ On Nextstep, this just calls `ns-parse-geometry'. */)
3939#define DEFAULT_ROWS 35 3936#define DEFAULT_ROWS 35
3940#define DEFAULT_COLS 80 3937#define DEFAULT_COLS 80
3941 3938
3942int 3939long
3943x_figure_window_size (struct frame *f, Lisp_Object parms, int toolbar_p) 3940x_figure_window_size (struct frame *f, Lisp_Object parms, bool toolbar_p)
3944{ 3941{
3945 register Lisp_Object tem0, tem1, tem2; 3942 register Lisp_Object tem0, tem1, tem2;
3946 long window_prompting = 0; 3943 long window_prompting = 0;
@@ -4291,7 +4288,6 @@ syms_of_frame (void)
4291 DEFSYM (Qx_frame_parameter, "x-frame-parameter"); 4288 DEFSYM (Qx_frame_parameter, "x-frame-parameter");
4292 4289
4293 DEFSYM (Qterminal, "terminal"); 4290 DEFSYM (Qterminal, "terminal");
4294 DEFSYM (Qterminal_live_p, "terminal-live-p");
4295 4291
4296 DEFSYM (Qgeometry, "geometry"); 4292 DEFSYM (Qgeometry, "geometry");
4297 DEFSYM (Qworkarea, "workarea"); 4293 DEFSYM (Qworkarea, "workarea");
diff --git a/src/frame.h b/src/frame.h
index 31d3e73c3c3..33e4bb71d7a 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -591,8 +591,6 @@ default_pixels_per_inch_y (void)
591/* Return a pointer to the image cache of frame F. */ 591/* Return a pointer to the image cache of frame F. */
592#define FRAME_IMAGE_CACHE(F) ((F)->terminal->image_cache) 592#define FRAME_IMAGE_CACHE(F) ((F)->terminal->image_cache)
593 593
594typedef struct frame *FRAME_PTR;
595
596#define XFRAME(p) \ 594#define XFRAME(p) \
597 (eassert (FRAMEP (p)), (struct frame *) XUNTAG (p, Lisp_Vectorlike)) 595 (eassert (FRAMEP (p)), (struct frame *) XUNTAG (p, Lisp_Vectorlike))
598#define XSETFRAME(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FRAME)) 596#define XSETFRAME(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FRAME))
@@ -929,10 +927,9 @@ typedef struct frame *FRAME_PTR;
929 if (frame == hlinfo->mouse_face_mouse_frame) \ 927 if (frame == hlinfo->mouse_face_mouse_frame) \
930 { \ 928 { \
931 block_input (); \ 929 block_input (); \
932 if (hlinfo->mouse_face_mouse_frame) \ 930 note_mouse_highlight (hlinfo->mouse_face_mouse_frame, \
933 note_mouse_highlight (hlinfo->mouse_face_mouse_frame, \ 931 hlinfo->mouse_face_mouse_x, \
934 hlinfo->mouse_face_mouse_x, \ 932 hlinfo->mouse_face_mouse_y); \
935 hlinfo->mouse_face_mouse_y); \
936 unblock_input (); \ 933 unblock_input (); \
937 } \ 934 } \
938 } while (0) 935 } while (0)
@@ -952,7 +949,7 @@ typedef struct frame *FRAME_PTR;
952extern Lisp_Object Qframep, Qframe_live_p; 949extern Lisp_Object Qframep, Qframe_live_p;
953extern Lisp_Object Qtty, Qtty_type; 950extern Lisp_Object Qtty, Qtty_type;
954extern Lisp_Object Qtty_color_mode; 951extern Lisp_Object Qtty_color_mode;
955extern Lisp_Object Qterminal, Qterminal_live_p; 952extern Lisp_Object Qterminal;
956extern Lisp_Object Qnoelisp; 953extern Lisp_Object Qnoelisp;
957 954
958extern struct frame *last_nonminibuf_frame; 955extern struct frame *last_nonminibuf_frame;
@@ -962,7 +959,7 @@ extern struct frame *decode_window_system_frame (Lisp_Object);
962extern struct frame *decode_live_frame (Lisp_Object); 959extern struct frame *decode_live_frame (Lisp_Object);
963extern struct frame *decode_any_frame (Lisp_Object); 960extern struct frame *decode_any_frame (Lisp_Object);
964extern struct frame *make_initial_frame (void); 961extern struct frame *make_initial_frame (void);
965extern struct frame *make_frame (int); 962extern struct frame *make_frame (bool);
966#ifdef HAVE_WINDOW_SYSTEM 963#ifdef HAVE_WINDOW_SYSTEM
967extern struct frame *make_minibuffer_frame (void); 964extern struct frame *make_minibuffer_frame (void);
968extern struct frame *make_frame_without_minibuffer (Lisp_Object, 965extern struct frame *make_frame_without_minibuffer (Lisp_Object,
@@ -1207,8 +1204,7 @@ extern Lisp_Object Qrun_hook_with_args;
1207 1204
1208extern void x_set_scroll_bar_default_width (struct frame *); 1205extern void x_set_scroll_bar_default_width (struct frame *);
1209extern void x_set_offset (struct frame *, int, int, int); 1206extern void x_set_offset (struct frame *, int, int, int);
1210extern void x_wm_set_icon_position (struct frame *, int, int); 1207extern void x_wm_set_size_hint (struct frame *f, long flags, bool user_position);
1211extern void x_wm_set_size_hint (FRAME_PTR f, long flags, bool user_position);
1212 1208
1213extern Lisp_Object x_new_font (struct frame *, Lisp_Object, int); 1209extern Lisp_Object x_new_font (struct frame *, Lisp_Object, int);
1214 1210
@@ -1242,7 +1238,7 @@ extern void x_set_scroll_bar_width (struct frame *, Lisp_Object,
1242 1238
1243extern Lisp_Object x_icon_type (struct frame *); 1239extern Lisp_Object x_icon_type (struct frame *);
1244 1240
1245extern int x_figure_window_size (struct frame *, Lisp_Object, int); 1241extern long x_figure_window_size (struct frame *, Lisp_Object, bool);
1246 1242
1247extern void x_set_alpha (struct frame *, Lisp_Object, Lisp_Object); 1243extern void x_set_alpha (struct frame *, Lisp_Object, Lisp_Object);
1248 1244
@@ -1264,8 +1260,6 @@ extern void x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y);
1264extern void x_make_frame_visible (struct frame *f); 1260extern void x_make_frame_visible (struct frame *f);
1265extern void x_make_frame_invisible (struct frame *f); 1261extern void x_make_frame_invisible (struct frame *f);
1266extern void x_iconify_frame (struct frame *f); 1262extern void x_iconify_frame (struct frame *f);
1267extern int x_pixel_width (struct frame *f);
1268extern int x_pixel_height (struct frame *f);
1269extern void x_set_frame_alpha (struct frame *f); 1263extern void x_set_frame_alpha (struct frame *f);
1270extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object); 1264extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
1271extern void x_set_tool_bar_lines (struct frame *f, 1265extern void x_set_tool_bar_lines (struct frame *f,
@@ -1280,9 +1274,12 @@ extern void x_set_menu_bar_lines (struct frame *,
1280extern void free_frame_menubar (struct frame *); 1274extern void free_frame_menubar (struct frame *);
1281extern void x_free_frame_resources (struct frame *); 1275extern void x_free_frame_resources (struct frame *);
1282 1276
1283#if defined HAVE_X_WINDOWS && !defined USE_X_TOOLKIT 1277#if defined HAVE_X_WINDOWS
1278extern void x_wm_set_icon_position (struct frame *, int, int);
1279#if !defined USE_X_TOOLKIT
1284extern char *x_get_resource_string (const char *, const char *); 1280extern char *x_get_resource_string (const char *, const char *);
1285#endif 1281#endif
1282#endif
1286 1283
1287extern void x_query_colors (struct frame *f, XColor *, int); 1284extern void x_query_colors (struct frame *f, XColor *, int);
1288extern void x_query_color (struct frame *f, XColor *); 1285extern void x_query_color (struct frame *f, XColor *);
diff --git a/src/ftfont.c b/src/ftfont.c
index 10090cb3bda..3636f86f5c4 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -493,12 +493,12 @@ ftfont_get_otf (struct ftfont_info *ftfont_info)
493} 493}
494#endif /* HAVE_LIBOTF */ 494#endif /* HAVE_LIBOTF */
495 495
496static Lisp_Object ftfont_get_cache (FRAME_PTR); 496static Lisp_Object ftfont_get_cache (struct frame *);
497static Lisp_Object ftfont_list (Lisp_Object, Lisp_Object); 497static Lisp_Object ftfont_list (struct frame *, Lisp_Object);
498static Lisp_Object ftfont_match (Lisp_Object, Lisp_Object); 498static Lisp_Object ftfont_match (struct frame *, Lisp_Object);
499static Lisp_Object ftfont_list_family (Lisp_Object); 499static Lisp_Object ftfont_list_family (struct frame *);
500static Lisp_Object ftfont_open (FRAME_PTR, Lisp_Object, int); 500static Lisp_Object ftfont_open (struct frame *, Lisp_Object, int);
501static void ftfont_close (FRAME_PTR, struct font *); 501static void ftfont_close (struct frame *, struct font *);
502static int ftfont_has_char (Lisp_Object, int); 502static int ftfont_has_char (Lisp_Object, int);
503static unsigned ftfont_encode_char (struct font *, int); 503static unsigned ftfont_encode_char (struct font *, int);
504static int ftfont_text_extents (struct font *, unsigned *, int, 504static int ftfont_text_extents (struct font *, unsigned *, int,
@@ -568,7 +568,7 @@ struct font_driver ftfont_driver =
568 }; 568 };
569 569
570static Lisp_Object 570static Lisp_Object
571ftfont_get_cache (FRAME_PTR f) 571ftfont_get_cache (struct frame *f)
572{ 572{
573 return freetype_font_cache; 573 return freetype_font_cache;
574} 574}
@@ -884,7 +884,7 @@ ftfont_spec_pattern (Lisp_Object spec, char *otlayout, struct OpenTypeSpec **ots
884} 884}
885 885
886static Lisp_Object 886static Lisp_Object
887ftfont_list (Lisp_Object frame, Lisp_Object spec) 887ftfont_list (struct frame *f, Lisp_Object spec)
888{ 888{
889 Lisp_Object val = Qnil, family, adstyle; 889 Lisp_Object val = Qnil, family, adstyle;
890 int i; 890 int i;
@@ -1080,7 +1080,7 @@ ftfont_list (Lisp_Object frame, Lisp_Object spec)
1080} 1080}
1081 1081
1082static Lisp_Object 1082static Lisp_Object
1083ftfont_match (Lisp_Object frame, Lisp_Object spec) 1083ftfont_match (struct frame *f, Lisp_Object spec)
1084{ 1084{
1085 Lisp_Object entity = Qnil; 1085 Lisp_Object entity = Qnil;
1086 FcPattern *pattern, *match = NULL; 1086 FcPattern *pattern, *match = NULL;
@@ -1130,7 +1130,7 @@ ftfont_match (Lisp_Object frame, Lisp_Object spec)
1130} 1130}
1131 1131
1132static Lisp_Object 1132static Lisp_Object
1133ftfont_list_family (Lisp_Object frame) 1133ftfont_list_family (struct frame *f)
1134{ 1134{
1135 Lisp_Object list = Qnil; 1135 Lisp_Object list = Qnil;
1136 FcPattern *pattern = NULL; 1136 FcPattern *pattern = NULL;
@@ -1173,7 +1173,7 @@ ftfont_list_family (Lisp_Object frame)
1173 1173
1174 1174
1175static Lisp_Object 1175static Lisp_Object
1176ftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) 1176ftfont_open (struct frame *f, Lisp_Object entity, int pixel_size)
1177{ 1177{
1178 struct ftfont_info *ftfont_info; 1178 struct ftfont_info *ftfont_info;
1179 struct font *font; 1179 struct font *font;
@@ -1317,7 +1317,7 @@ ftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
1317} 1317}
1318 1318
1319static void 1319static void
1320ftfont_close (FRAME_PTR f, struct font *font) 1320ftfont_close (struct frame *f, struct font *font)
1321{ 1321{
1322 struct ftfont_info *ftfont_info = (struct ftfont_info *) font; 1322 struct ftfont_info *ftfont_info = (struct ftfont_info *) font;
1323 Lisp_Object val, cache; 1323 Lisp_Object val, cache;
diff --git a/src/ftxfont.c b/src/ftxfont.c
index 8c56ee05adc..63d03b0e244 100644
--- a/src/ftxfont.c
+++ b/src/ftxfont.c
@@ -57,7 +57,7 @@ struct ftxfont_frame_data
57/* Return an array of 6 GCs for antialiasing. */ 57/* Return an array of 6 GCs for antialiasing. */
58 58
59static GC * 59static GC *
60ftxfont_get_gcs (FRAME_PTR f, long unsigned int foreground, long unsigned int background) 60ftxfont_get_gcs (struct frame *f, long unsigned int foreground, long unsigned int background)
61{ 61{
62 XColor color; 62 XColor color;
63 XGCValues xgcv; 63 XGCValues xgcv;
@@ -134,7 +134,7 @@ ftxfont_get_gcs (FRAME_PTR f, long unsigned int foreground, long unsigned int ba
134} 134}
135 135
136static int 136static int
137ftxfont_draw_bitmap (FRAME_PTR f, GC gc_fore, GC *gcs, struct font *font, 137ftxfont_draw_bitmap (struct frame *f, GC gc_fore, GC *gcs, struct font *font,
138 unsigned int code, int x, int y, XPoint *p, int size, 138 unsigned int code, int x, int y, XPoint *p, int size,
139 int *n, bool flush) 139 int *n, bool flush)
140{ 140{
@@ -212,7 +212,7 @@ ftxfont_draw_bitmap (FRAME_PTR f, GC gc_fore, GC *gcs, struct font *font,
212} 212}
213 213
214static void 214static void
215ftxfont_draw_background (FRAME_PTR f, struct font *font, GC gc, int x, int y, 215ftxfont_draw_background (struct frame *f, struct font *font, GC gc, int x, int y,
216 int width) 216 int width)
217{ 217{
218 XGCValues xgcv; 218 XGCValues xgcv;
@@ -226,9 +226,9 @@ ftxfont_draw_background (FRAME_PTR f, struct font *font, GC gc, int x, int y,
226} 226}
227 227
228static Lisp_Object 228static Lisp_Object
229ftxfont_list (Lisp_Object frame, Lisp_Object spec) 229ftxfont_list (struct frame *f, Lisp_Object spec)
230{ 230{
231 Lisp_Object list = ftfont_driver.list (frame, spec), tail; 231 Lisp_Object list = ftfont_driver.list (f, spec), tail;
232 232
233 for (tail = list; CONSP (tail); tail = XCDR (tail)) 233 for (tail = list; CONSP (tail); tail = XCDR (tail))
234 ASET (XCAR (tail), FONT_TYPE_INDEX, Qftx); 234 ASET (XCAR (tail), FONT_TYPE_INDEX, Qftx);
@@ -236,9 +236,9 @@ ftxfont_list (Lisp_Object frame, Lisp_Object spec)
236} 236}
237 237
238static Lisp_Object 238static Lisp_Object
239ftxfont_match (Lisp_Object frame, Lisp_Object spec) 239ftxfont_match (struct frame *f, Lisp_Object spec)
240{ 240{
241 Lisp_Object entity = ftfont_driver.match (frame, spec); 241 Lisp_Object entity = ftfont_driver.match (f, spec);
242 242
243 if (VECTORP (entity)) 243 if (VECTORP (entity))
244 ASET (entity, FONT_TYPE_INDEX, Qftx); 244 ASET (entity, FONT_TYPE_INDEX, Qftx);
@@ -246,7 +246,7 @@ ftxfont_match (Lisp_Object frame, Lisp_Object spec)
246} 246}
247 247
248static Lisp_Object 248static Lisp_Object
249ftxfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) 249ftxfont_open (struct frame *f, Lisp_Object entity, int pixel_size)
250{ 250{
251 Lisp_Object font_object; 251 Lisp_Object font_object;
252 struct font *font; 252 struct font *font;
@@ -260,7 +260,7 @@ ftxfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
260} 260}
261 261
262static void 262static void
263ftxfont_close (FRAME_PTR f, struct font *font) 263ftxfont_close (struct frame *f, struct font *font)
264{ 264{
265 ftfont_driver.close (f, font); 265 ftfont_driver.close (f, font);
266} 266}
@@ -269,7 +269,7 @@ static int
269ftxfont_draw (struct glyph_string *s, int from, int to, int x, int y, 269ftxfont_draw (struct glyph_string *s, int from, int to, int x, int y,
270 bool with_background) 270 bool with_background)
271{ 271{
272 FRAME_PTR f = s->f; 272 struct frame *f = s->f;
273 struct face *face = s->face; 273 struct face *face = s->face;
274 struct font *font = s->font; 274 struct font *font = s->font;
275 XPoint p[0x700]; 275 XPoint p[0x700];
@@ -338,7 +338,7 @@ ftxfont_draw (struct glyph_string *s, int from, int to, int x, int y,
338} 338}
339 339
340static int 340static int
341ftxfont_end_for_frame (FRAME_PTR f) 341ftxfont_end_for_frame (struct frame *f)
342{ 342{
343 struct ftxfont_frame_data *data = font_get_frame_data (f, &ftxfont_driver); 343 struct ftxfont_frame_data *data = font_get_frame_data (f, &ftxfont_driver);
344 344
diff --git a/src/gtkutil.c b/src/gtkutil.c
index f8ddf6a90f6..237d031295c 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -136,7 +136,7 @@ static GdkDisplay *gdpy_def;
136 W can be a GtkMenu or a GtkWindow widget. */ 136 W can be a GtkMenu or a GtkWindow widget. */
137 137
138static void 138static void
139xg_set_screen (GtkWidget *w, FRAME_PTR f) 139xg_set_screen (GtkWidget *w, struct frame *f)
140{ 140{
141 if (FRAME_X_DISPLAY (f) != DEFAULT_GDK_DISPLAY ()) 141 if (FRAME_X_DISPLAY (f) != DEFAULT_GDK_DISPLAY ())
142 { 142 {
@@ -280,7 +280,7 @@ xg_create_default_cursor (Display *dpy)
280} 280}
281 281
282static GdkPixbuf * 282static GdkPixbuf *
283xg_get_pixbuf_from_pixmap (FRAME_PTR f, Pixmap pix) 283xg_get_pixbuf_from_pixmap (struct frame *f, Pixmap pix)
284{ 284{
285 int iunused; 285 int iunused;
286 GdkPixbuf *tmp_buf; 286 GdkPixbuf *tmp_buf;
@@ -311,7 +311,7 @@ xg_get_pixbuf_from_pixmap (FRAME_PTR f, Pixmap pix)
311/* Apply GMASK to GPIX and return a GdkPixbuf with an alpha channel. */ 311/* Apply GMASK to GPIX and return a GdkPixbuf with an alpha channel. */
312 312
313static GdkPixbuf * 313static GdkPixbuf *
314xg_get_pixbuf_from_pix_and_mask (FRAME_PTR f, 314xg_get_pixbuf_from_pix_and_mask (struct frame *f,
315 Pixmap pix, 315 Pixmap pix,
316 Pixmap mask) 316 Pixmap mask)
317{ 317{
@@ -387,7 +387,7 @@ file_for_image (Lisp_Object image)
387 If OLD_WIDGET is not NULL, that widget is modified. */ 387 If OLD_WIDGET is not NULL, that widget is modified. */
388 388
389static GtkWidget * 389static GtkWidget *
390xg_get_image_for_pixmap (FRAME_PTR f, 390xg_get_image_for_pixmap (struct frame *f,
391 struct image *img, 391 struct image *img,
392 GtkWidget *widget, 392 GtkWidget *widget,
393 GtkImage *old_widget) 393 GtkImage *old_widget)
@@ -641,7 +641,7 @@ hierarchy_ch_cb (GtkWidget *widget,
641 GtkWidget *previous_toplevel, 641 GtkWidget *previous_toplevel,
642 gpointer user_data) 642 gpointer user_data)
643{ 643{
644 FRAME_PTR f = (FRAME_PTR) user_data; 644 struct frame *f = (struct frame *) user_data;
645 struct x_output *x = f->output_data.x; 645 struct x_output *x = f->output_data.x;
646 GtkWidget *top = gtk_widget_get_toplevel (x->ttip_lbl); 646 GtkWidget *top = gtk_widget_get_toplevel (x->ttip_lbl);
647 647
@@ -663,7 +663,7 @@ qttip_cb (GtkWidget *widget,
663 GtkTooltip *tooltip, 663 GtkTooltip *tooltip,
664 gpointer user_data) 664 gpointer user_data)
665{ 665{
666 FRAME_PTR f = (FRAME_PTR) user_data; 666 struct frame *f = (struct frame *) user_data;
667 struct x_output *x = f->output_data.x; 667 struct x_output *x = f->output_data.x;
668 if (x->ttip_widget == NULL) 668 if (x->ttip_widget == NULL)
669 { 669 {
@@ -707,7 +707,7 @@ qttip_cb (GtkWidget *widget,
707 Return true if a system tooltip is available. */ 707 Return true if a system tooltip is available. */
708 708
709bool 709bool
710xg_prepare_tooltip (FRAME_PTR f, 710xg_prepare_tooltip (struct frame *f,
711 Lisp_Object string, 711 Lisp_Object string,
712 int *width, 712 int *width,
713 int *height) 713 int *height)
@@ -764,7 +764,7 @@ xg_prepare_tooltip (FRAME_PTR f,
764 xg_prepare_tooltip must have been called before this function. */ 764 xg_prepare_tooltip must have been called before this function. */
765 765
766void 766void
767xg_show_tooltip (FRAME_PTR f, int root_x, int root_y) 767xg_show_tooltip (struct frame *f, int root_x, int root_y)
768{ 768{
769#ifdef USE_GTK_TOOLTIP 769#ifdef USE_GTK_TOOLTIP
770 struct x_output *x = f->output_data.x; 770 struct x_output *x = f->output_data.x;
@@ -783,7 +783,7 @@ xg_show_tooltip (FRAME_PTR f, int root_x, int root_y)
783 system tooltips). */ 783 system tooltips). */
784 784
785bool 785bool
786xg_hide_tooltip (FRAME_PTR f) 786xg_hide_tooltip (struct frame *f)
787{ 787{
788 bool ret = 0; 788 bool ret = 0;
789#ifdef USE_GTK_TOOLTIP 789#ifdef USE_GTK_TOOLTIP
@@ -827,7 +827,7 @@ my_log_handler (const gchar *log_domain, GLogLevelFlags log_level,
827 F is the frame we shall set geometry for. */ 827 F is the frame we shall set geometry for. */
828 828
829static void 829static void
830xg_set_geometry (FRAME_PTR f) 830xg_set_geometry (struct frame *f)
831{ 831{
832 if (f->size_hint_flags & (USPosition | PPosition)) 832 if (f->size_hint_flags & (USPosition | PPosition))
833 { 833 {
@@ -865,7 +865,7 @@ xg_set_geometry (FRAME_PTR f)
865 and use a GtkFixed widget, this doesn't happen automatically. */ 865 and use a GtkFixed widget, this doesn't happen automatically. */
866 866
867static void 867static void
868xg_clear_under_internal_border (FRAME_PTR f) 868xg_clear_under_internal_border (struct frame *f)
869{ 869{
870 if (FRAME_INTERNAL_BORDER_WIDTH (f) > 0) 870 if (FRAME_INTERNAL_BORDER_WIDTH (f) > 0)
871 { 871 {
@@ -903,7 +903,7 @@ xg_clear_under_internal_border (FRAME_PTR f)
903 PIXELWIDTH, PIXELHEIGHT is the new size in pixels. */ 903 PIXELWIDTH, PIXELHEIGHT is the new size in pixels. */
904 904
905void 905void
906xg_frame_resized (FRAME_PTR f, int pixelwidth, int pixelheight) 906xg_frame_resized (struct frame *f, int pixelwidth, int pixelheight)
907{ 907{
908 int rows, columns; 908 int rows, columns;
909 909
@@ -939,7 +939,7 @@ xg_frame_resized (FRAME_PTR f, int pixelwidth, int pixelheight)
939 COLUMNS/ROWS is the size the edit area shall have after the resize. */ 939 COLUMNS/ROWS is the size the edit area shall have after the resize. */
940 940
941void 941void
942xg_frame_set_char_size (FRAME_PTR f, int cols, int rows) 942xg_frame_set_char_size (struct frame *f, int cols, int rows)
943{ 943{
944 int pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows) 944 int pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows)
945 + FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f); 945 + FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f);
@@ -1002,7 +1002,7 @@ xg_frame_set_char_size (FRAME_PTR f, int cols, int rows)
1002 The policy is to keep the number of editable lines. */ 1002 The policy is to keep the number of editable lines. */
1003 1003
1004static void 1004static void
1005xg_height_or_width_changed (FRAME_PTR f) 1005xg_height_or_width_changed (struct frame *f)
1006{ 1006{
1007 gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), 1007 gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
1008 FRAME_TOTAL_PIXEL_WIDTH (f), 1008 FRAME_TOTAL_PIXEL_WIDTH (f),
@@ -1042,7 +1042,7 @@ xg_win_to_widget (Display *dpy, Window wdesc)
1042/* Set the background of widget W to PIXEL. */ 1042/* Set the background of widget W to PIXEL. */
1043 1043
1044static void 1044static void
1045xg_set_widget_bg (FRAME_PTR f, GtkWidget *w, long unsigned int pixel) 1045xg_set_widget_bg (struct frame *f, GtkWidget *w, long unsigned int pixel)
1046{ 1046{
1047#ifdef HAVE_GTK3 1047#ifdef HAVE_GTK3
1048 GdkRGBA bg; 1048 GdkRGBA bg;
@@ -1093,7 +1093,7 @@ style_changed_cb (GObject *go,
1093 Lisp_Object rest, frame; 1093 Lisp_Object rest, frame;
1094 FOR_EACH_FRAME (rest, frame) 1094 FOR_EACH_FRAME (rest, frame)
1095 { 1095 {
1096 FRAME_PTR f = XFRAME (frame); 1096 struct frame *f = XFRAME (frame);
1097 if (FRAME_LIVE_P (f) 1097 if (FRAME_LIVE_P (f)
1098 && FRAME_X_P (f) 1098 && FRAME_X_P (f)
1099 && FRAME_X_DISPLAY (f) == dpy) 1099 && FRAME_X_DISPLAY (f) == dpy)
@@ -1115,7 +1115,7 @@ delete_cb (GtkWidget *widget,
1115#ifdef HAVE_GTK3 1115#ifdef HAVE_GTK3
1116 /* The event doesn't arrive in the normal event loop. Send event 1116 /* The event doesn't arrive in the normal event loop. Send event
1117 here. */ 1117 here. */
1118 FRAME_PTR f = (FRAME_PTR) user_data; 1118 struct frame *f = (struct frame *) user_data;
1119 struct input_event ie; 1119 struct input_event ie;
1120 1120
1121 EVENT_INIT (ie); 1121 EVENT_INIT (ie);
@@ -1131,7 +1131,7 @@ delete_cb (GtkWidget *widget,
1131 Return true if creation succeeded. */ 1131 Return true if creation succeeded. */
1132 1132
1133bool 1133bool
1134xg_create_frame_widgets (FRAME_PTR f) 1134xg_create_frame_widgets (struct frame *f)
1135{ 1135{
1136 GtkWidget *wtop; 1136 GtkWidget *wtop;
1137 GtkWidget *wvbox, *whbox; 1137 GtkWidget *wvbox, *whbox;
@@ -1300,7 +1300,7 @@ xg_create_frame_widgets (FRAME_PTR f)
1300} 1300}
1301 1301
1302void 1302void
1303xg_free_frame_widgets (FRAME_PTR f) 1303xg_free_frame_widgets (struct frame *f)
1304{ 1304{
1305 if (FRAME_GTK_OUTER_WIDGET (f)) 1305 if (FRAME_GTK_OUTER_WIDGET (f))
1306 { 1306 {
@@ -1332,7 +1332,7 @@ xg_free_frame_widgets (FRAME_PTR f)
1332 flag (this is useful when FLAGS is 0). */ 1332 flag (this is useful when FLAGS is 0). */
1333 1333
1334void 1334void
1335x_wm_set_size_hint (FRAME_PTR f, long int flags, bool user_position) 1335x_wm_set_size_hint (struct frame *f, long int flags, bool user_position)
1336{ 1336{
1337 /* Must use GTK routines here, otherwise GTK resets the size hints 1337 /* Must use GTK routines here, otherwise GTK resets the size hints
1338 to its own defaults. */ 1338 to its own defaults. */
@@ -1432,7 +1432,7 @@ x_wm_set_size_hint (FRAME_PTR f, long int flags, bool user_position)
1432 BG is the pixel value to change to. */ 1432 BG is the pixel value to change to. */
1433 1433
1434void 1434void
1435xg_set_background_color (FRAME_PTR f, long unsigned int bg) 1435xg_set_background_color (struct frame *f, long unsigned int bg)
1436{ 1436{
1437 if (FRAME_GTK_WIDGET (f)) 1437 if (FRAME_GTK_WIDGET (f))
1438 { 1438 {
@@ -1447,7 +1447,7 @@ xg_set_background_color (FRAME_PTR f, long unsigned int bg)
1447 functions so GTK does not overwrite the icon. */ 1447 functions so GTK does not overwrite the icon. */
1448 1448
1449void 1449void
1450xg_set_frame_icon (FRAME_PTR f, Pixmap icon_pixmap, Pixmap icon_mask) 1450xg_set_frame_icon (struct frame *f, Pixmap icon_pixmap, Pixmap icon_mask)
1451{ 1451{
1452 GdkPixbuf *gp = xg_get_pixbuf_from_pix_and_mask (f, 1452 GdkPixbuf *gp = xg_get_pixbuf_from_pix_and_mask (f,
1453 icon_pixmap, 1453 icon_pixmap,
@@ -1693,7 +1693,7 @@ xg_maybe_add_timer (gpointer data)
1693 The dialog W is not destroyed when this function returns. */ 1693 The dialog W is not destroyed when this function returns. */
1694 1694
1695static int 1695static int
1696xg_dialog_run (FRAME_PTR f, GtkWidget *w) 1696xg_dialog_run (struct frame *f, GtkWidget *w)
1697{ 1697{
1698 ptrdiff_t count = SPECPDL_INDEX (); 1698 ptrdiff_t count = SPECPDL_INDEX ();
1699 struct xg_dialog_data dd; 1699 struct xg_dialog_data dd;
@@ -1813,7 +1813,7 @@ xg_toggle_notify_cb (GObject *gobject, GParamSpec *arg1, gpointer user_data)
1813 Returns the created widget. */ 1813 Returns the created widget. */
1814 1814
1815static GtkWidget * 1815static GtkWidget *
1816xg_get_file_with_chooser (FRAME_PTR f, 1816xg_get_file_with_chooser (struct frame *f,
1817 char *prompt, 1817 char *prompt,
1818 char *default_filename, 1818 char *default_filename,
1819 bool mustmatch_p, bool only_dir_p, 1819 bool mustmatch_p, bool only_dir_p,
@@ -1935,7 +1935,7 @@ xg_get_file_name_from_selector (GtkWidget *w)
1935 Returns the created widget. */ 1935 Returns the created widget. */
1936 1936
1937static GtkWidget * 1937static GtkWidget *
1938xg_get_file_with_selection (FRAME_PTR f, 1938xg_get_file_with_selection (struct frame *f,
1939 char *prompt, 1939 char *prompt,
1940 char *default_filename, 1940 char *default_filename,
1941 bool mustmatch_p, bool only_dir_p, 1941 bool mustmatch_p, bool only_dir_p,
@@ -1977,7 +1977,7 @@ xg_get_file_with_selection (FRAME_PTR f,
1977 The returned string must be freed by the caller. */ 1977 The returned string must be freed by the caller. */
1978 1978
1979char * 1979char *
1980xg_get_file_name (FRAME_PTR f, 1980xg_get_file_name (struct frame *f,
1981 char *prompt, 1981 char *prompt,
1982 char *default_filename, 1982 char *default_filename,
1983 bool mustmatch_p, 1983 bool mustmatch_p,
@@ -2051,7 +2051,7 @@ extern Lisp_Object Qxft;
2051 DEFAULT_NAME, if non-zero, is the default font name. */ 2051 DEFAULT_NAME, if non-zero, is the default font name. */
2052 2052
2053Lisp_Object 2053Lisp_Object
2054xg_get_font (FRAME_PTR f, const char *default_name) 2054xg_get_font (struct frame *f, const char *default_name)
2055{ 2055{
2056 GtkWidget *w; 2056 GtkWidget *w;
2057 int done = 0; 2057 int done = 0;
@@ -2169,7 +2169,7 @@ static xg_list_node xg_menu_item_cb_list;
2169 allocated xg_menu_cb_data if CL_DATA is NULL. */ 2169 allocated xg_menu_cb_data if CL_DATA is NULL. */
2170 2170
2171static xg_menu_cb_data * 2171static xg_menu_cb_data *
2172make_cl_data (xg_menu_cb_data *cl_data, FRAME_PTR f, GCallback highlight_cb) 2172make_cl_data (xg_menu_cb_data *cl_data, struct frame *f, GCallback highlight_cb)
2173{ 2173{
2174 if (! cl_data) 2174 if (! cl_data)
2175 { 2175 {
@@ -2201,7 +2201,7 @@ make_cl_data (xg_menu_cb_data *cl_data, FRAME_PTR f, GCallback highlight_cb)
2201 2201
2202static void 2202static void
2203update_cl_data (xg_menu_cb_data *cl_data, 2203update_cl_data (xg_menu_cb_data *cl_data,
2204 FRAME_PTR f, 2204 struct frame *f,
2205 GCallback highlight_cb) 2205 GCallback highlight_cb)
2206{ 2206{
2207 if (cl_data) 2207 if (cl_data)
@@ -2251,7 +2251,7 @@ xg_mark_data (void)
2251 2251
2252 FOR_EACH_FRAME (rest, frame) 2252 FOR_EACH_FRAME (rest, frame)
2253 { 2253 {
2254 FRAME_PTR f = XFRAME (frame); 2254 struct frame *f = XFRAME (frame);
2255 2255
2256 if (FRAME_X_P (f) && FRAME_GTK_OUTER_WIDGET (f)) 2256 if (FRAME_X_P (f) && FRAME_GTK_OUTER_WIDGET (f))
2257 { 2257 {
@@ -2480,7 +2480,7 @@ xg_have_tear_offs (void)
2480 2480
2481static GtkWidget * 2481static GtkWidget *
2482xg_create_one_menuitem (widget_value *item, 2482xg_create_one_menuitem (widget_value *item,
2483 FRAME_PTR f, 2483 struct frame *f,
2484 GCallback select_cb, 2484 GCallback select_cb,
2485 GCallback highlight_cb, 2485 GCallback highlight_cb,
2486 xg_menu_cb_data *cl_data, 2486 xg_menu_cb_data *cl_data,
@@ -2551,7 +2551,7 @@ xg_create_one_menuitem (widget_value *item,
2551 2551
2552static GtkWidget * 2552static GtkWidget *
2553create_menus (widget_value *data, 2553create_menus (widget_value *data,
2554 FRAME_PTR f, 2554 struct frame *f,
2555 GCallback select_cb, 2555 GCallback select_cb,
2556 GCallback deactivate_cb, 2556 GCallback deactivate_cb,
2557 GCallback highlight_cb, 2557 GCallback highlight_cb,
@@ -2694,9 +2694,9 @@ create_menus (widget_value *data,
2694 Returns the widget created. */ 2694 Returns the widget created. */
2695 2695
2696GtkWidget * 2696GtkWidget *
2697xg_create_widget (const char *type, const char *name, FRAME_PTR f, widget_value *val, 2697xg_create_widget (const char *type, const char *name, struct frame *f,
2698 GCallback select_cb, GCallback deactivate_cb, 2698 widget_value *val, GCallback select_cb,
2699 GCallback highlight_cb) 2699 GCallback deactivate_cb, GCallback highlight_cb)
2700{ 2700{
2701 GtkWidget *w = 0; 2701 GtkWidget *w = 0;
2702 bool menu_bar_p = strcmp (type, "menubar") == 0; 2702 bool menu_bar_p = strcmp (type, "menubar") == 0;
@@ -2802,7 +2802,7 @@ xg_destroy_widgets (GList *list)
2802 2802
2803static void 2803static void
2804xg_update_menubar (GtkWidget *menubar, 2804xg_update_menubar (GtkWidget *menubar,
2805 FRAME_PTR f, 2805 struct frame *f,
2806 GList **list, 2806 GList **list,
2807 GList *iter, 2807 GList *iter,
2808 int pos, 2808 int pos,
@@ -3119,7 +3119,7 @@ xg_update_radio_item (widget_value *val, GtkWidget *w)
3119 3119
3120static GtkWidget * 3120static GtkWidget *
3121xg_update_submenu (GtkWidget *submenu, 3121xg_update_submenu (GtkWidget *submenu,
3122 FRAME_PTR f, 3122 struct frame *f,
3123 widget_value *val, 3123 widget_value *val,
3124 GCallback select_cb, 3124 GCallback select_cb,
3125 GCallback deactivate_cb, 3125 GCallback deactivate_cb,
@@ -3261,8 +3261,8 @@ xg_update_submenu (GtkWidget *submenu,
3261 HIGHLIGHT_CB is the callback to call when entering/leaving menu items. */ 3261 HIGHLIGHT_CB is the callback to call when entering/leaving menu items. */
3262 3262
3263void 3263void
3264xg_modify_menubar_widgets (GtkWidget *menubar, FRAME_PTR f, widget_value *val, 3264xg_modify_menubar_widgets (GtkWidget *menubar, struct frame *f,
3265 bool deep_p, 3265 widget_value *val, bool deep_p,
3266 GCallback select_cb, GCallback deactivate_cb, 3266 GCallback select_cb, GCallback deactivate_cb,
3267 GCallback highlight_cb) 3267 GCallback highlight_cb)
3268{ 3268{
@@ -3336,7 +3336,7 @@ static void
3336menubar_map_cb (GtkWidget *w, gpointer user_data) 3336menubar_map_cb (GtkWidget *w, gpointer user_data)
3337{ 3337{
3338 GtkRequisition req; 3338 GtkRequisition req;
3339 FRAME_PTR f = (FRAME_PTR) user_data; 3339 struct frame *f = (struct frame *) user_data;
3340 gtk_widget_get_preferred_size (w, NULL, &req); 3340 gtk_widget_get_preferred_size (w, NULL, &req);
3341 if (FRAME_MENUBAR_HEIGHT (f) != req.height) 3341 if (FRAME_MENUBAR_HEIGHT (f) != req.height)
3342 { 3342 {
@@ -3349,7 +3349,7 @@ menubar_map_cb (GtkWidget *w, gpointer user_data)
3349 changed. */ 3349 changed. */
3350 3350
3351void 3351void
3352xg_update_frame_menubar (FRAME_PTR f) 3352xg_update_frame_menubar (struct frame *f)
3353{ 3353{
3354 struct x_output *x = f->output_data.x; 3354 struct x_output *x = f->output_data.x;
3355 GtkRequisition req; 3355 GtkRequisition req;
@@ -3387,7 +3387,7 @@ xg_update_frame_menubar (FRAME_PTR f)
3387 This is used when deleting a frame, and when turning off the menu bar. */ 3387 This is used when deleting a frame, and when turning off the menu bar. */
3388 3388
3389void 3389void
3390free_frame_menubar (FRAME_PTR f) 3390free_frame_menubar (struct frame *f)
3391{ 3391{
3392 struct x_output *x = f->output_data.x; 3392 struct x_output *x = f->output_data.x;
3393 3393
@@ -3406,7 +3406,7 @@ free_frame_menubar (FRAME_PTR f)
3406} 3406}
3407 3407
3408bool 3408bool
3409xg_event_is_for_menubar (FRAME_PTR f, XEvent *event) 3409xg_event_is_for_menubar (struct frame *f, XEvent *event)
3410{ 3410{
3411 struct x_output *x = f->output_data.x; 3411 struct x_output *x = f->output_data.x;
3412 GList *iter; 3412 GList *iter;
@@ -3619,7 +3619,7 @@ xg_gtk_scroll_destroy (GtkWidget *widget, gpointer data)
3619 to set resources for the widget. */ 3619 to set resources for the widget. */
3620 3620
3621void 3621void
3622xg_create_scroll_bar (FRAME_PTR f, 3622xg_create_scroll_bar (struct frame *f,
3623 struct scroll_bar *bar, 3623 struct scroll_bar *bar,
3624 GCallback scroll_callback, 3624 GCallback scroll_callback,
3625 GCallback end_callback, 3625 GCallback end_callback,
@@ -3681,7 +3681,7 @@ xg_create_scroll_bar (FRAME_PTR f,
3681/* Remove the scroll bar represented by SCROLLBAR_ID from the frame F. */ 3681/* Remove the scroll bar represented by SCROLLBAR_ID from the frame F. */
3682 3682
3683void 3683void
3684xg_remove_scroll_bar (FRAME_PTR f, ptrdiff_t scrollbar_id) 3684xg_remove_scroll_bar (struct frame *f, ptrdiff_t scrollbar_id)
3685{ 3685{
3686 GtkWidget *w = xg_get_widget_from_map (scrollbar_id); 3686 GtkWidget *w = xg_get_widget_from_map (scrollbar_id);
3687 if (w) 3687 if (w)
@@ -3699,7 +3699,7 @@ xg_remove_scroll_bar (FRAME_PTR f, ptrdiff_t scrollbar_id)
3699 WIDTH, HEIGHT is the size in pixels the bar shall have. */ 3699 WIDTH, HEIGHT is the size in pixels the bar shall have. */
3700 3700
3701void 3701void
3702xg_update_scrollbar_pos (FRAME_PTR f, 3702xg_update_scrollbar_pos (struct frame *f,
3703 ptrdiff_t scrollbar_id, 3703 ptrdiff_t scrollbar_id,
3704 int top, 3704 int top,
3705 int left, 3705 int left,
@@ -3781,7 +3781,7 @@ xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar,
3781{ 3781{
3782 GtkWidget *wscroll = xg_get_widget_from_map (bar->x_window); 3782 GtkWidget *wscroll = xg_get_widget_from_map (bar->x_window);
3783 3783
3784 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); 3784 struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
3785 3785
3786 if (wscroll && NILP (bar->dragging)) 3786 if (wscroll && NILP (bar->dragging))
3787 { 3787 {
@@ -3861,7 +3861,7 @@ xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar,
3861 frame. This function does additional checks. */ 3861 frame. This function does additional checks. */
3862 3862
3863bool 3863bool
3864xg_event_is_for_scrollbar (FRAME_PTR f, XEvent *event) 3864xg_event_is_for_scrollbar (struct frame *f, XEvent *event)
3865{ 3865{
3866 bool retval = 0; 3866 bool retval = 0;
3867 3867
@@ -3946,7 +3946,8 @@ xg_tool_bar_callback (GtkWidget *w, gpointer client_data)
3946 gpointer gmod = g_object_get_data (G_OBJECT (w), XG_TOOL_BAR_LAST_MODIFIER); 3946 gpointer gmod = g_object_get_data (G_OBJECT (w), XG_TOOL_BAR_LAST_MODIFIER);
3947 intptr_t mod = (intptr_t) gmod; 3947 intptr_t mod = (intptr_t) gmod;
3948 3948
3949 FRAME_PTR f = (FRAME_PTR) g_object_get_data (G_OBJECT (w), XG_FRAME_DATA); 3949 struct frame *f = (struct frame *) g_object_get_data (G_OBJECT (w),
3950 XG_FRAME_DATA);
3950 Lisp_Object key, frame; 3951 Lisp_Object key, frame;
3951 struct input_event event; 3952 struct input_event event;
3952 EVENT_INIT (event); 3953 EVENT_INIT (event);
@@ -4149,7 +4150,7 @@ xg_tool_bar_detach_callback (GtkHandleBox *wbox,
4149 GtkWidget *w, 4150 GtkWidget *w,
4150 gpointer client_data) 4151 gpointer client_data)
4151{ 4152{
4152 FRAME_PTR f = (FRAME_PTR) client_data; 4153 struct frame *f = (struct frame *) client_data;
4153 4154
4154 g_object_set (G_OBJECT (w), "show-arrow", !x_gtk_whole_detached_tool_bar, 4155 g_object_set (G_OBJECT (w), "show-arrow", !x_gtk_whole_detached_tool_bar,
4155 NULL); 4156 NULL);
@@ -4186,7 +4187,7 @@ xg_tool_bar_attach_callback (GtkHandleBox *wbox,
4186 GtkWidget *w, 4187 GtkWidget *w,
4187 gpointer client_data) 4188 gpointer client_data)
4188{ 4189{
4189 FRAME_PTR f = (FRAME_PTR) client_data; 4190 struct frame *f = (struct frame *) client_data;
4190 g_object_set (G_OBJECT (w), "show-arrow", TRUE, NULL); 4191 g_object_set (G_OBJECT (w), "show-arrow", TRUE, NULL);
4191 4192
4192 if (f) 4193 if (f)
@@ -4224,7 +4225,8 @@ xg_tool_bar_help_callback (GtkWidget *w,
4224 gpointer client_data) 4225 gpointer client_data)
4225{ 4226{
4226 intptr_t idx = (intptr_t) client_data; 4227 intptr_t idx = (intptr_t) client_data;
4227 FRAME_PTR f = (FRAME_PTR) g_object_get_data (G_OBJECT (w), XG_FRAME_DATA); 4228 struct frame *f = (struct frame *) g_object_get_data (G_OBJECT (w),
4229 XG_FRAME_DATA);
4228 Lisp_Object help, frame; 4230 Lisp_Object help, frame;
4229 4231
4230 if (! f || ! f->n_tool_bar_items || NILP (f->tool_bar_items)) 4232 if (! f || ! f->n_tool_bar_items || NILP (f->tool_bar_items))
@@ -4297,7 +4299,7 @@ xg_tool_bar_item_expose_callback (GtkWidget *w,
4297/* Attach a tool bar to frame F. */ 4299/* Attach a tool bar to frame F. */
4298 4300
4299static void 4301static void
4300xg_pack_tool_bar (FRAME_PTR f, Lisp_Object pos) 4302xg_pack_tool_bar (struct frame *f, Lisp_Object pos)
4301{ 4303{
4302 struct x_output *x = f->output_data.x; 4304 struct x_output *x = f->output_data.x;
4303 bool into_hbox = EQ (pos, Qleft) || EQ (pos, Qright); 4305 bool into_hbox = EQ (pos, Qleft) || EQ (pos, Qright);
@@ -4354,7 +4356,7 @@ xg_pack_tool_bar (FRAME_PTR f, Lisp_Object pos)
4354 x->toolbar_is_packed = true; 4356 x->toolbar_is_packed = true;
4355} 4357}
4356 4358
4357static bool xg_update_tool_bar_sizes (FRAME_PTR f); 4359static bool xg_update_tool_bar_sizes (struct frame *f);
4358 4360
4359static void 4361static void
4360tb_size_cb (GtkWidget *widget, 4362tb_size_cb (GtkWidget *widget,
@@ -4364,7 +4366,7 @@ tb_size_cb (GtkWidget *widget,
4364 /* When tool bar is created it has one preferred size. But when size is 4366 /* When tool bar is created it has one preferred size. But when size is
4365 allocated between widgets, it may get another. So we must update 4367 allocated between widgets, it may get another. So we must update
4366 size hints if tool bar size changes. Seen on Fedora 18 at least. */ 4368 size hints if tool bar size changes. Seen on Fedora 18 at least. */
4367 FRAME_PTR f = (FRAME_PTR) user_data; 4369 struct frame *f = (struct frame *) user_data;
4368 if (xg_update_tool_bar_sizes (f)) 4370 if (xg_update_tool_bar_sizes (f))
4369 x_wm_set_size_hint (f, 0, 0); 4371 x_wm_set_size_hint (f, 0, 0);
4370} 4372}
@@ -4372,7 +4374,7 @@ tb_size_cb (GtkWidget *widget,
4372/* Create a tool bar for frame F. */ 4374/* Create a tool bar for frame F. */
4373 4375
4374static void 4376static void
4375xg_create_tool_bar (FRAME_PTR f) 4377xg_create_tool_bar (struct frame *f)
4376{ 4378{
4377 struct x_output *x = f->output_data.x; 4379 struct x_output *x = f->output_data.x;
4378#if GTK_CHECK_VERSION (3, 3, 6) 4380#if GTK_CHECK_VERSION (3, 3, 6)
@@ -4415,7 +4417,7 @@ xg_create_tool_bar (FRAME_PTR f)
4415 Returns IMAGE if RTL is not found. */ 4417 Returns IMAGE if RTL is not found. */
4416 4418
4417static Lisp_Object 4419static Lisp_Object
4418find_rtl_image (FRAME_PTR f, Lisp_Object image, Lisp_Object rtl) 4420find_rtl_image (struct frame *f, Lisp_Object image, Lisp_Object rtl)
4419{ 4421{
4420 int i; 4422 int i;
4421 Lisp_Object file, rtl_name; 4423 Lisp_Object file, rtl_name;
@@ -4443,7 +4445,7 @@ find_rtl_image (FRAME_PTR f, Lisp_Object image, Lisp_Object rtl)
4443} 4445}
4444 4446
4445static GtkToolItem * 4447static GtkToolItem *
4446xg_make_tool_item (FRAME_PTR f, 4448xg_make_tool_item (struct frame *f,
4447 GtkWidget *wimage, 4449 GtkWidget *wimage,
4448 GtkWidget **wbutton, 4450 GtkWidget **wbutton,
4449 const char *label, 4451 const char *label,
@@ -4606,7 +4608,7 @@ xg_tool_item_stale_p (GtkWidget *wbutton, const char *stock_name,
4606} 4608}
4607 4609
4608static bool 4610static bool
4609xg_update_tool_bar_sizes (FRAME_PTR f) 4611xg_update_tool_bar_sizes (struct frame *f)
4610{ 4612{
4611 struct x_output *x = f->output_data.x; 4613 struct x_output *x = f->output_data.x;
4612 GtkRequisition req; 4614 GtkRequisition req;
@@ -4654,7 +4656,7 @@ xg_update_tool_bar_sizes (FRAME_PTR f)
4654/* Update the tool bar for frame F. Add new buttons and remove old. */ 4656/* Update the tool bar for frame F. Add new buttons and remove old. */
4655 4657
4656void 4658void
4657update_frame_tool_bar (FRAME_PTR f) 4659update_frame_tool_bar (struct frame *f)
4658{ 4660{
4659 int i, j; 4661 int i, j;
4660 struct x_output *x = f->output_data.x; 4662 struct x_output *x = f->output_data.x;
@@ -4929,7 +4931,7 @@ update_frame_tool_bar (FRAME_PTR f)
4929 Remove the tool bar. */ 4931 Remove the tool bar. */
4930 4932
4931void 4933void
4932free_frame_tool_bar (FRAME_PTR f) 4934free_frame_tool_bar (struct frame *f)
4933{ 4935{
4934 struct x_output *x = f->output_data.x; 4936 struct x_output *x = f->output_data.x;
4935 4937
@@ -4976,7 +4978,7 @@ free_frame_tool_bar (FRAME_PTR f)
4976} 4978}
4977 4979
4978void 4980void
4979xg_change_toolbar_position (FRAME_PTR f, Lisp_Object pos) 4981xg_change_toolbar_position (struct frame *f, Lisp_Object pos)
4980{ 4982{
4981 struct x_output *x = f->output_data.x; 4983 struct x_output *x = f->output_data.x;
4982 GtkWidget *top_widget = TOOLBAR_TOP_WIDGET (x); 4984 GtkWidget *top_widget = TOOLBAR_TOP_WIDGET (x);
diff --git a/src/gtkutil.h b/src/gtkutil.h
index 288b3e99299..482331a8934 100644
--- a/src/gtkutil.h
+++ b/src/gtkutil.h
@@ -55,7 +55,7 @@ typedef struct xg_menu_cb_data_
55{ 55{
56 xg_list_node ptrs; 56 xg_list_node ptrs;
57 57
58 FRAME_PTR f; 58 struct frame *f;
59 Lisp_Object menu_bar_vector; 59 Lisp_Object menu_bar_vector;
60 int menu_bar_items_used; 60 int menu_bar_items_used;
61 GCallback highlight_cb; 61 GCallback highlight_cb;
@@ -81,46 +81,46 @@ extern void free_widget_value (struct _widget_value *);
81 81
82extern bool xg_uses_old_file_dialog (void) ATTRIBUTE_CONST; 82extern bool xg_uses_old_file_dialog (void) ATTRIBUTE_CONST;
83 83
84extern char *xg_get_file_name (FRAME_PTR f, 84extern char *xg_get_file_name (struct frame *f,
85 char *prompt, 85 char *prompt,
86 char *default_filename, 86 char *default_filename,
87 bool mustmatch_p, 87 bool mustmatch_p,
88 bool only_dir_p); 88 bool only_dir_p);
89 89
90extern Lisp_Object xg_get_font (FRAME_PTR f, const char *); 90extern Lisp_Object xg_get_font (struct frame *f, const char *);
91 91
92extern GtkWidget *xg_create_widget (const char *type, 92extern GtkWidget *xg_create_widget (const char *type,
93 const char *name, 93 const char *name,
94 FRAME_PTR f, 94 struct frame *f,
95 struct _widget_value *val, 95 struct _widget_value *val,
96 GCallback select_cb, 96 GCallback select_cb,
97 GCallback deactivate_cb, 97 GCallback deactivate_cb,
98 GCallback highlight_cb); 98 GCallback highlight_cb);
99 99
100extern void xg_modify_menubar_widgets (GtkWidget *menubar, 100extern void xg_modify_menubar_widgets (GtkWidget *menubar,
101 FRAME_PTR f, 101 struct frame *f,
102 struct _widget_value *val, 102 struct _widget_value *val,
103 bool deep_p, 103 bool deep_p,
104 GCallback select_cb, 104 GCallback select_cb,
105 GCallback deactivate_cb, 105 GCallback deactivate_cb,
106 GCallback highlight_cb); 106 GCallback highlight_cb);
107 107
108extern void xg_update_frame_menubar (FRAME_PTR f); 108extern void xg_update_frame_menubar (struct frame *f);
109 109
110extern bool xg_event_is_for_menubar (FRAME_PTR f, XEvent *event); 110extern bool xg_event_is_for_menubar (struct frame *f, XEvent *event);
111 111
112extern bool xg_have_tear_offs (void); 112extern bool xg_have_tear_offs (void);
113 113
114extern ptrdiff_t xg_get_scroll_id_for_window (Display *dpy, Window wid); 114extern ptrdiff_t xg_get_scroll_id_for_window (Display *dpy, Window wid);
115 115
116extern void xg_create_scroll_bar (FRAME_PTR f, 116extern void xg_create_scroll_bar (struct frame *f,
117 struct scroll_bar *bar, 117 struct scroll_bar *bar,
118 GCallback scroll_callback, 118 GCallback scroll_callback,
119 GCallback end_callback, 119 GCallback end_callback,
120 const char *scroll_bar_name); 120 const char *scroll_bar_name);
121extern void xg_remove_scroll_bar (FRAME_PTR f, ptrdiff_t scrollbar_id); 121extern void xg_remove_scroll_bar (struct frame *f, ptrdiff_t scrollbar_id);
122 122
123extern void xg_update_scrollbar_pos (FRAME_PTR f, 123extern void xg_update_scrollbar_pos (struct frame *f,
124 ptrdiff_t scrollbar_id, 124 ptrdiff_t scrollbar_id,
125 int top, 125 int top,
126 int left, 126 int left,
@@ -131,40 +131,40 @@ extern void xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar,
131 int portion, 131 int portion,
132 int position, 132 int position,
133 int whole); 133 int whole);
134extern bool xg_event_is_for_scrollbar (FRAME_PTR f, XEvent *event); 134extern bool xg_event_is_for_scrollbar (struct frame *f, XEvent *event);
135extern int xg_get_default_scrollbar_width (void); 135extern int xg_get_default_scrollbar_width (void);
136 136
137extern void update_frame_tool_bar (FRAME_PTR f); 137extern void update_frame_tool_bar (struct frame *f);
138extern void free_frame_tool_bar (FRAME_PTR f); 138extern void free_frame_tool_bar (struct frame *f);
139extern void xg_change_toolbar_position (FRAME_PTR f, Lisp_Object pos); 139extern void xg_change_toolbar_position (struct frame *f, Lisp_Object pos);
140 140
141extern void xg_frame_resized (FRAME_PTR f, 141extern void xg_frame_resized (struct frame *f,
142 int pixelwidth, 142 int pixelwidth,
143 int pixelheight); 143 int pixelheight);
144extern void xg_frame_set_char_size (FRAME_PTR f, int cols, int rows); 144extern void xg_frame_set_char_size (struct frame *f, int cols, int rows);
145extern GtkWidget * xg_win_to_widget (Display *dpy, Window wdesc); 145extern GtkWidget * xg_win_to_widget (Display *dpy, Window wdesc);
146 146
147extern void xg_display_open (char *display_name, Display **dpy); 147extern void xg_display_open (char *display_name, Display **dpy);
148extern void xg_display_close (Display *dpy); 148extern void xg_display_close (Display *dpy);
149extern GdkCursor * xg_create_default_cursor (Display *dpy); 149extern GdkCursor * xg_create_default_cursor (Display *dpy);
150 150
151extern bool xg_create_frame_widgets (FRAME_PTR f); 151extern bool xg_create_frame_widgets (struct frame *f);
152extern void xg_free_frame_widgets (FRAME_PTR f); 152extern void xg_free_frame_widgets (struct frame *f);
153extern void xg_set_background_color (FRAME_PTR f, unsigned long bg); 153extern void xg_set_background_color (struct frame *f, unsigned long bg);
154extern bool xg_check_special_colors (struct frame *f, 154extern bool xg_check_special_colors (struct frame *f,
155 const char *color_name, 155 const char *color_name,
156 XColor *color); 156 XColor *color);
157 157
158extern void xg_set_frame_icon (FRAME_PTR f, 158extern void xg_set_frame_icon (struct frame *f,
159 Pixmap icon_pixmap, 159 Pixmap icon_pixmap,
160 Pixmap icon_mask); 160 Pixmap icon_mask);
161 161
162extern bool xg_prepare_tooltip (FRAME_PTR f, 162extern bool xg_prepare_tooltip (struct frame *f,
163 Lisp_Object string, 163 Lisp_Object string,
164 int *width, 164 int *width,
165 int *height); 165 int *height);
166extern void xg_show_tooltip (FRAME_PTR f, int root_x, int root_y); 166extern void xg_show_tooltip (struct frame *f, int root_x, int root_y);
167extern bool xg_hide_tooltip (FRAME_PTR f); 167extern bool xg_hide_tooltip (struct frame *f);
168 168
169 169
170/* Mark all callback data that are Lisp_object:s during GC. */ 170/* Mark all callback data that are Lisp_object:s during GC. */
diff --git a/src/image.c b/src/image.c
index 1f8cb520dca..911ca8e6681 100644
--- a/src/image.c
+++ b/src/image.c
@@ -164,20 +164,20 @@ XPutPixel (XImagePtr ximage, int x, int y, unsigned long pixel)
164/* Functions to access the contents of a bitmap, given an id. */ 164/* Functions to access the contents of a bitmap, given an id. */
165 165
166int 166int
167x_bitmap_height (FRAME_PTR f, ptrdiff_t id) 167x_bitmap_height (struct frame *f, ptrdiff_t id)
168{ 168{
169 return FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].height; 169 return FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].height;
170} 170}
171 171
172int 172int
173x_bitmap_width (FRAME_PTR f, ptrdiff_t id) 173x_bitmap_width (struct frame *f, ptrdiff_t id)
174{ 174{
175 return FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].width; 175 return FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].width;
176} 176}
177 177
178#if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI) 178#if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI)
179ptrdiff_t 179ptrdiff_t
180x_bitmap_pixmap (FRAME_PTR f, ptrdiff_t id) 180x_bitmap_pixmap (struct frame *f, ptrdiff_t id)
181{ 181{
182 /* HAVE_NTGUI needs the explicit cast here. */ 182 /* HAVE_NTGUI needs the explicit cast here. */
183 return (ptrdiff_t) FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].pixmap; 183 return (ptrdiff_t) FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].pixmap;
@@ -186,7 +186,7 @@ x_bitmap_pixmap (FRAME_PTR f, ptrdiff_t id)
186 186
187#ifdef HAVE_X_WINDOWS 187#ifdef HAVE_X_WINDOWS
188int 188int
189x_bitmap_mask (FRAME_PTR f, ptrdiff_t id) 189x_bitmap_mask (struct frame *f, ptrdiff_t id)
190{ 190{
191 return FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].mask; 191 return FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].mask;
192} 192}
@@ -195,7 +195,7 @@ x_bitmap_mask (FRAME_PTR f, ptrdiff_t id)
195/* Allocate a new bitmap record. Returns index of new record. */ 195/* Allocate a new bitmap record. Returns index of new record. */
196 196
197static ptrdiff_t 197static ptrdiff_t
198x_allocate_bitmap_record (FRAME_PTR f) 198x_allocate_bitmap_record (struct frame *f)
199{ 199{
200 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 200 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
201 ptrdiff_t i; 201 ptrdiff_t i;
@@ -216,7 +216,7 @@ x_allocate_bitmap_record (FRAME_PTR f)
216/* Add one reference to the reference count of the bitmap with id ID. */ 216/* Add one reference to the reference count of the bitmap with id ID. */
217 217
218void 218void
219x_reference_bitmap (FRAME_PTR f, ptrdiff_t id) 219x_reference_bitmap (struct frame *f, ptrdiff_t id)
220{ 220{
221 ++FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].refcount; 221 ++FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].refcount;
222} 222}
@@ -384,7 +384,7 @@ free_bitmap_record (Display_Info *dpyinfo, Bitmap_Record *bm)
384/* Remove reference to bitmap with id number ID. */ 384/* Remove reference to bitmap with id number ID. */
385 385
386void 386void
387x_destroy_bitmap (FRAME_PTR f, ptrdiff_t id) 387x_destroy_bitmap (struct frame *f, ptrdiff_t id)
388{ 388{
389 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 389 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
390 390
diff --git a/src/insdel.c b/src/insdel.c
index 15d585568a0..58c3e15c233 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -1211,12 +1211,9 @@ adjust_after_replace (ptrdiff_t from, ptrdiff_t from_byte,
1211 adjust_markers_for_insert (from, from_byte, 1211 adjust_markers_for_insert (from, from_byte,
1212 from + len, from_byte + len_byte, 0); 1212 from + len, from_byte + len_byte, 0);
1213 1213
1214 if (! EQ (BVAR (current_buffer, undo_list), Qt)) 1214 if (nchars_del > 0)
1215 { 1215 record_delete (from, prev_text);
1216 if (nchars_del > 0) 1216 record_insert (from, len);
1217 record_delete (from, prev_text);
1218 record_insert (from, len);
1219 }
1220 1217
1221 if (len > nchars_del) 1218 if (len > nchars_del)
1222 adjust_overlays_for_insert (from, len - nchars_del); 1219 adjust_overlays_for_insert (from, len - nchars_del);
@@ -1373,12 +1370,12 @@ replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new,
1373 emacs_abort (); 1370 emacs_abort ();
1374#endif 1371#endif
1375 1372
1376 if (! EQ (BVAR (current_buffer, undo_list), Qt)) 1373 /* Record the insertion first, so that when we undo,
1374 the deletion will be undone first. Thus, undo
1375 will insert before deleting, and thus will keep
1376 the markers before and after this text separate. */
1377 if (!NILP (deletion))
1377 { 1378 {
1378 /* Record the insertion first, so that when we undo,
1379 the deletion will be undone first. Thus, undo
1380 will insert before deleting, and thus will keep
1381 the markers before and after this text separate. */
1382 record_insert (from + SCHARS (deletion), inschars); 1379 record_insert (from + SCHARS (deletion), inschars);
1383 record_delete (from, deletion); 1380 record_delete (from, deletion);
1384 } 1381 }
@@ -1718,8 +1715,7 @@ del_range_2 (ptrdiff_t from, ptrdiff_t from_byte,
1718 so that undo handles this after reinserting the text. */ 1715 so that undo handles this after reinserting the text. */
1719 adjust_markers_for_delete (from, from_byte, to, to_byte); 1716 adjust_markers_for_delete (from, from_byte, to, to_byte);
1720 1717
1721 if (! EQ (BVAR (current_buffer, undo_list), Qt)) 1718 record_delete (from, deletion);
1722 record_delete (from, deletion);
1723 MODIFF++; 1719 MODIFF++;
1724 CHARS_MODIFF = MODIFF; 1720 CHARS_MODIFF = MODIFF;
1725 1721
diff --git a/src/keyboard.c b/src/keyboard.c
index 830f70bc1f5..c026b16e689 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1281,7 +1281,7 @@ static
1281#endif 1281#endif
1282bool ignore_mouse_drag_p; 1282bool ignore_mouse_drag_p;
1283 1283
1284static FRAME_PTR 1284static struct frame *
1285some_mouse_moved (void) 1285some_mouse_moved (void)
1286{ 1286{
1287 Lisp_Object tail, frame; 1287 Lisp_Object tail, frame;
@@ -2163,7 +2163,7 @@ show_help_echo (Lisp_Object help, Lisp_Object window, Lisp_Object object,
2163 This causes trouble if we are trying to read a mouse motion 2163 This causes trouble if we are trying to read a mouse motion
2164 event (i.e., if we are inside a `track-mouse' form), so we 2164 event (i.e., if we are inside a `track-mouse' form), so we
2165 restore the mouse_moved flag. */ 2165 restore the mouse_moved flag. */
2166 FRAME_PTR f = NILP (do_mouse_tracking) ? NULL : some_mouse_moved (); 2166 struct frame *f = NILP (do_mouse_tracking) ? NULL : some_mouse_moved ();
2167 help = call1 (Qmouse_fixup_help_message, help); 2167 help = call1 (Qmouse_fixup_help_message, help);
2168 if (f) 2168 if (f)
2169 f->mouse_moved = 1; 2169 f->mouse_moved = 1;
@@ -4152,7 +4152,7 @@ kbd_buffer_get_event (KBOARD **kbp,
4152 /* Try generating a mouse motion event. */ 4152 /* Try generating a mouse motion event. */
4153 else if (!NILP (do_mouse_tracking) && some_mouse_moved ()) 4153 else if (!NILP (do_mouse_tracking) && some_mouse_moved ())
4154 { 4154 {
4155 FRAME_PTR f = some_mouse_moved (); 4155 struct frame *f = some_mouse_moved ();
4156 Lisp_Object bar_window; 4156 Lisp_Object bar_window;
4157 enum scroll_bar_part part; 4157 enum scroll_bar_part part;
4158 Lisp_Object x, y; 4158 Lisp_Object x, y;
@@ -5898,7 +5898,7 @@ make_lispy_event (struct input_event *event)
5898 5898
5899 case DRAG_N_DROP_EVENT: 5899 case DRAG_N_DROP_EVENT:
5900 { 5900 {
5901 FRAME_PTR f; 5901 struct frame *f;
5902 Lisp_Object head, position; 5902 Lisp_Object head, position;
5903 Lisp_Object files; 5903 Lisp_Object files;
5904 5904
@@ -5977,7 +5977,7 @@ make_lispy_event (struct input_event *event)
5977#ifdef HAVE_GPM 5977#ifdef HAVE_GPM
5978 case GPM_CLICK_EVENT: 5978 case GPM_CLICK_EVENT:
5979 { 5979 {
5980 FRAME_PTR f = XFRAME (event->frame_or_window); 5980 struct frame *f = XFRAME (event->frame_or_window);
5981 Lisp_Object head, position; 5981 Lisp_Object head, position;
5982 Lisp_Object *start_pos_ptr; 5982 Lisp_Object *start_pos_ptr;
5983 Lisp_Object start_pos; 5983 Lisp_Object start_pos;
@@ -6031,7 +6031,7 @@ make_lispy_event (struct input_event *event)
6031} 6031}
6032 6032
6033static Lisp_Object 6033static Lisp_Object
6034make_lispy_movement (FRAME_PTR frame, Lisp_Object bar_window, enum scroll_bar_part part, 6034make_lispy_movement (struct frame *frame, Lisp_Object bar_window, enum scroll_bar_part part,
6035 Lisp_Object x, Lisp_Object y, Time t) 6035 Lisp_Object x, Lisp_Object y, Time t)
6036{ 6036{
6037 /* Is it a scroll bar movement? */ 6037 /* Is it a scroll bar movement? */
diff --git a/src/lisp.h b/src/lisp.h
index 254ead231b9..5daddb7d335 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3302,6 +3302,7 @@ extern struct hash_table_test hashtest_eql, hashtest_equal;
3302 3302
3303extern Lisp_Object substring_both (Lisp_Object, ptrdiff_t, ptrdiff_t, 3303extern Lisp_Object substring_both (Lisp_Object, ptrdiff_t, ptrdiff_t,
3304 ptrdiff_t, ptrdiff_t); 3304 ptrdiff_t, ptrdiff_t);
3305extern Lisp_Object merge (Lisp_Object, Lisp_Object, Lisp_Object);
3305extern Lisp_Object do_yes_or_no_p (Lisp_Object); 3306extern Lisp_Object do_yes_or_no_p (Lisp_Object);
3306extern Lisp_Object concat2 (Lisp_Object, Lisp_Object); 3307extern Lisp_Object concat2 (Lisp_Object, Lisp_Object);
3307extern Lisp_Object concat3 (Lisp_Object, Lisp_Object, Lisp_Object); 3308extern Lisp_Object concat3 (Lisp_Object, Lisp_Object, Lisp_Object);
diff --git a/src/menu.c b/src/menu.c
index 6b4a22d3052..6fce5b91caf 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -867,7 +867,8 @@ update_submenu_strings (widget_value *first_wv)
867 VECTOR is an array of menu events for the whole menu. */ 867 VECTOR is an array of menu events for the whole menu. */
868 868
869void 869void
870find_and_call_menu_selection (FRAME_PTR f, int menu_bar_items_used, Lisp_Object vector, void *client_data) 870find_and_call_menu_selection (struct frame *f, int menu_bar_items_used,
871 Lisp_Object vector, void *client_data)
871{ 872{
872 Lisp_Object prefix, entry; 873 Lisp_Object prefix, entry;
873 Lisp_Object *subprefix_stack; 874 Lisp_Object *subprefix_stack;
@@ -950,7 +951,7 @@ find_and_call_menu_selection (FRAME_PTR f, int menu_bar_items_used, Lisp_Object
950/* As above, but return the menu selection instead of storing in kb buffer. 951/* As above, but return the menu selection instead of storing in kb buffer.
951 If KEYMAPS, return full prefixes to selection. */ 952 If KEYMAPS, return full prefixes to selection. */
952Lisp_Object 953Lisp_Object
953find_and_return_menu_selection (FRAME_PTR f, bool keymaps, void *client_data) 954find_and_return_menu_selection (struct frame *f, bool keymaps, void *client_data)
954{ 955{
955 Lisp_Object prefix, entry; 956 Lisp_Object prefix, entry;
956 int i; 957 int i;
@@ -1060,7 +1061,7 @@ no quit occurs and `x-popup-menu' returns nil. */)
1060 Lisp_Object title; 1061 Lisp_Object title;
1061 const char *error_name = NULL; 1062 const char *error_name = NULL;
1062 Lisp_Object selection = Qnil; 1063 Lisp_Object selection = Qnil;
1063 FRAME_PTR f = NULL; 1064 struct frame *f = NULL;
1064 Lisp_Object x, y, window; 1065 Lisp_Object x, y, window;
1065 bool keymaps = 0; 1066 bool keymaps = 0;
1066 bool for_click = 0; 1067 bool for_click = 0;
@@ -1116,7 +1117,7 @@ no quit occurs and `x-popup-menu' returns nil. */)
1116 if (get_current_pos_p) 1117 if (get_current_pos_p)
1117 { 1118 {
1118 /* Use the mouse's current position. */ 1119 /* Use the mouse's current position. */
1119 FRAME_PTR new_f = SELECTED_FRAME (); 1120 struct frame *new_f = SELECTED_FRAME ();
1120#ifdef HAVE_X_WINDOWS 1121#ifdef HAVE_X_WINDOWS
1121 /* Can't use mouse_position_hook for X since it returns 1122 /* Can't use mouse_position_hook for X since it returns
1122 coordinates relative to the window the mouse is in, 1123 coordinates relative to the window the mouse is in,
diff --git a/src/menu.h b/src/menu.h
index f60873eadb3..0f94ad8000b 100644
--- a/src/menu.h
+++ b/src/menu.h
@@ -35,20 +35,20 @@ extern void list_of_panes (Lisp_Object);
35 || defined (HAVE_NS) 35 || defined (HAVE_NS)
36extern void free_menubar_widget_value_tree (widget_value *); 36extern void free_menubar_widget_value_tree (widget_value *);
37extern void update_submenu_strings (widget_value *); 37extern void update_submenu_strings (widget_value *);
38extern void find_and_call_menu_selection (FRAME_PTR, int, 38extern void find_and_call_menu_selection (struct frame *, int,
39 Lisp_Object, void *); 39 Lisp_Object, void *);
40extern widget_value *xmalloc_widget_value (void); 40extern widget_value *xmalloc_widget_value (void);
41extern widget_value *digest_single_submenu (int, int, bool); 41extern widget_value *digest_single_submenu (int, int, bool);
42#endif 42#endif
43 43
44#ifdef HAVE_X_WINDOWS 44#ifdef HAVE_X_WINDOWS
45extern void mouse_position_for_popup (FRAME_PTR f, int *x, int *y); 45extern void mouse_position_for_popup (struct frame *f, int *x, int *y);
46#endif 46#endif
47 47
48extern Lisp_Object w32_menu_show (FRAME_PTR, int, int, int, int, 48extern Lisp_Object w32_menu_show (struct frame *, int, int, int, int,
49 Lisp_Object, const char **); 49 Lisp_Object, const char **);
50extern Lisp_Object ns_menu_show (FRAME_PTR, int, int, bool, bool, 50extern Lisp_Object ns_menu_show (struct frame *, int, int, bool, bool,
51 Lisp_Object, const char **); 51 Lisp_Object, const char **);
52extern Lisp_Object xmenu_show (FRAME_PTR, int, int, bool, bool, 52extern Lisp_Object xmenu_show (struct frame *, int, int, bool, bool,
53 Lisp_Object, const char **, Time); 53 Lisp_Object, const char **, Time);
54#endif /* MENU_H */ 54#endif /* MENU_H */
diff --git a/src/msdos.c b/src/msdos.c
index a2bcc06ac17..88a2eb60726 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -298,7 +298,7 @@ mouse_button_depressed (int b, int *xp, int *yp)
298} 298}
299 299
300void 300void
301mouse_get_pos (FRAME_PTR *f, int insist, Lisp_Object *bar_window, 301mouse_get_pos (struct frame **f, int insist, Lisp_Object *bar_window,
302 enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, 302 enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y,
303 Time *time) 303 Time *time)
304{ 304{
@@ -1158,7 +1158,7 @@ IT_display_cursor (int on)
1158 to put the cursor at the end of the text displayed there. */ 1158 to put the cursor at the end of the text displayed there. */
1159 1159
1160static void 1160static void
1161IT_cmgoto (FRAME_PTR f) 1161IT_cmgoto (struct frame *f)
1162{ 1162{
1163 /* Only set the cursor to where it should be if the display is 1163 /* Only set the cursor to where it should be if the display is
1164 already in sync with the window contents. */ 1164 already in sync with the window contents. */
@@ -1760,7 +1760,7 @@ IT_set_frame_parameters (struct frame *f, Lisp_Object alist)
1760 } 1760 }
1761} 1761}
1762 1762
1763extern void init_frame_faces (FRAME_PTR); 1763extern void init_frame_faces (struct frame *);
1764 1764
1765#endif /* !HAVE_X_WINDOWS */ 1765#endif /* !HAVE_X_WINDOWS */
1766 1766
@@ -3320,18 +3320,6 @@ XMenuDestroy (Display *foo, XMenu *menu)
3320 xfree (menu); 3320 xfree (menu);
3321 menu_help_message = prev_menu_help_message = NULL; 3321 menu_help_message = prev_menu_help_message = NULL;
3322} 3322}
3323
3324int
3325x_pixel_width (struct frame *f)
3326{
3327 return FRAME_COLS (f);
3328}
3329
3330int
3331x_pixel_height (struct frame *f)
3332{
3333 return FRAME_LINES (f);
3334}
3335#endif /* !HAVE_X_WINDOWS */ 3323#endif /* !HAVE_X_WINDOWS */
3336 3324
3337/* ----------------------- DOS / UNIX conversion --------------------- */ 3325/* ----------------------- DOS / UNIX conversion --------------------- */
diff --git a/src/msdos.h b/src/msdos.h
index ee0d49464ae..6a6fe349131 100644
--- a/src/msdos.h
+++ b/src/msdos.h
@@ -74,8 +74,6 @@ struct window;
74/* Defined in xfns.c; emulated on msdos.c */ 74/* Defined in xfns.c; emulated on msdos.c */
75 75
76extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object); 76extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
77extern int x_pixel_width (struct frame *);
78extern int x_pixel_height (struct frame *);
79 77
80#define XFreeGC (void) 78#define XFreeGC (void)
81#define x_destroy_bitmap(p1,p2) 79#define x_destroy_bitmap(p1,p2)
diff --git a/src/nsfns.m b/src/nsfns.m
index 121ac539646..3f43afde787 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -143,7 +143,7 @@ check_ns_display_info (Lisp_Object object)
143 dpyinfo = ns_display_info_for_name (object); 143 dpyinfo = ns_display_info_for_name (object);
144 else 144 else
145 { 145 {
146 FRAME_PTR f = decode_window_system_frame (object); 146 struct frame *f = decode_window_system_frame (object);
147 dpyinfo = FRAME_NS_DISPLAY_INFO (f); 147 dpyinfo = FRAME_NS_DISPLAY_INFO (f);
148 } 148 }
149 149
@@ -431,7 +431,7 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
431} 431}
432 432
433static void 433static void
434ns_set_name_internal (FRAME_PTR f, Lisp_Object name) 434ns_set_name_internal (struct frame *f, Lisp_Object name)
435{ 435{
436 struct gcpro gcpro1; 436 struct gcpro gcpro1;
437 Lisp_Object encoded_name, encoded_icon_name; 437 Lisp_Object encoded_name, encoded_icon_name;
@@ -503,7 +503,7 @@ ns_set_name (struct frame *f, Lisp_Object name, int explicit)
503 specified a name for the frame; the name will override any set by the 503 specified a name for the frame; the name will override any set by the
504 redisplay code. */ 504 redisplay code. */
505static void 505static void
506x_explicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval) 506x_explicitly_set_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
507{ 507{
508 NSTRACE (x_explicitly_set_name); 508 NSTRACE (x_explicitly_set_name);
509 ns_set_name (f, arg, 1); 509 ns_set_name (f, arg, 1);
@@ -514,7 +514,7 @@ x_explicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval)
514 name; names set this way will never override names set by the user's 514 name; names set this way will never override names set by the user's
515 lisp code. */ 515 lisp code. */
516void 516void
517x_implicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval) 517x_implicitly_set_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
518{ 518{
519 NSTRACE (x_implicitly_set_name); 519 NSTRACE (x_implicitly_set_name);
520 520
@@ -857,7 +857,7 @@ ns_cursor_type_to_lisp (int arg)
857 857
858/* This is the same as the xfns.c definition. */ 858/* This is the same as the xfns.c definition. */
859static void 859static void
860x_set_cursor_type (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval) 860x_set_cursor_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
861{ 861{
862 set_frame_cursor_types (f, arg); 862 set_frame_cursor_types (f, arg);
863 863
@@ -1068,7 +1068,7 @@ This function is an internal primitive--use `make-frame' instead. */)
1068 Lisp_Object frame, tem; 1068 Lisp_Object frame, tem;
1069 Lisp_Object name; 1069 Lisp_Object name;
1070 int minibuffer_only = 0; 1070 int minibuffer_only = 0;
1071 int window_prompting = 0; 1071 long window_prompting = 0;
1072 int width, height; 1072 int width, height;
1073 ptrdiff_t count = specpdl_ptr - specpdl; 1073 ptrdiff_t count = specpdl_ptr - specpdl;
1074 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 1074 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
@@ -2231,21 +2231,6 @@ x_get_focus_frame (struct frame *frame)
2231 return nsfocus; 2231 return nsfocus;
2232} 2232}
2233 2233
2234
2235int
2236x_pixel_width (struct frame *f)
2237{
2238 return FRAME_PIXEL_WIDTH (f);
2239}
2240
2241
2242int
2243x_pixel_height (struct frame *f)
2244{
2245 return FRAME_PIXEL_HEIGHT (f);
2246}
2247
2248
2249void 2234void
2250x_sync (struct frame *f) 2235x_sync (struct frame *f)
2251{ 2236{
diff --git a/src/nsfont.m b/src/nsfont.m
index df7ef0bb0bc..ad169d7ddae 100644
--- a/src/nsfont.m
+++ b/src/nsfont.m
@@ -619,13 +619,13 @@ ns_findfonts (Lisp_Object font_spec, BOOL isMatch)
619 ========================================================================== */ 619 ========================================================================== */
620 620
621 621
622static Lisp_Object nsfont_get_cache (FRAME_PTR frame); 622static Lisp_Object nsfont_get_cache (struct frame *frame);
623static Lisp_Object nsfont_list (Lisp_Object frame, Lisp_Object font_spec); 623static Lisp_Object nsfont_list (struct frame *, Lisp_Object);
624static Lisp_Object nsfont_match (Lisp_Object frame, Lisp_Object font_spec); 624static Lisp_Object nsfont_match (struct frame *, Lisp_Object);
625static Lisp_Object nsfont_list_family (Lisp_Object frame); 625static Lisp_Object nsfont_list_family (struct frame *);
626static Lisp_Object nsfont_open (FRAME_PTR f, Lisp_Object font_entity, 626static Lisp_Object nsfont_open (struct frame *f, Lisp_Object font_entity,
627 int pixel_size); 627 int pixel_size);
628static void nsfont_close (FRAME_PTR f, struct font *font); 628static void nsfont_close (struct frame *f, struct font *font);
629static int nsfont_has_char (Lisp_Object entity, int c); 629static int nsfont_has_char (Lisp_Object entity, int c);
630static unsigned int nsfont_encode_char (struct font *font, int c); 630static unsigned int nsfont_encode_char (struct font *font, int c);
631static int nsfont_text_extents (struct font *font, unsigned int *code, 631static int nsfont_text_extents (struct font *font, unsigned int *code,
@@ -659,7 +659,7 @@ struct font_driver nsfont_driver =
659/* Return a cache of font-entities on FRAME. The cache must be a 659/* Return a cache of font-entities on FRAME. The cache must be a
660 cons whose cdr part is the actual cache area. */ 660 cons whose cdr part is the actual cache area. */
661static Lisp_Object 661static Lisp_Object
662nsfont_get_cache (FRAME_PTR frame) 662nsfont_get_cache (struct frame *frame)
663{ 663{
664 Display_Info *dpyinfo = FRAME_NS_DISPLAY_INFO (frame); 664 Display_Info *dpyinfo = FRAME_NS_DISPLAY_INFO (frame);
665 return (dpyinfo->name_list_element); 665 return (dpyinfo->name_list_element);
@@ -679,9 +679,9 @@ nsfont_get_cache (FRAME_PTR frame)
679 weight, slant, width, size (0 if scalable), 679 weight, slant, width, size (0 if scalable),
680 dpi, spacing, avgwidth (0 if scalable) */ 680 dpi, spacing, avgwidth (0 if scalable) */
681static Lisp_Object 681static Lisp_Object
682nsfont_list (Lisp_Object frame, Lisp_Object font_spec) 682nsfont_list (struct frame *f, Lisp_Object font_spec)
683{ 683{
684 return ns_findfonts (font_spec, NO); 684 return ns_findfonts (font_spec, NO);
685} 685}
686 686
687 687
@@ -690,16 +690,16 @@ nsfont_list (Lisp_Object frame, Lisp_Object font_spec)
690 `face-font-selection-order' is ignored here. 690 `face-font-selection-order' is ignored here.
691 Properties to be considered are same as for list(). */ 691 Properties to be considered are same as for list(). */
692static Lisp_Object 692static Lisp_Object
693nsfont_match (Lisp_Object frame, Lisp_Object font_spec) 693nsfont_match (struct frame *f, Lisp_Object font_spec)
694{ 694{
695 return ns_findfonts(font_spec, YES); 695 return ns_findfonts (font_spec, YES);
696} 696}
697 697
698 698
699/* List available families. The value is a list of family names 699/* List available families. The value is a list of family names
700 (symbols). */ 700 (symbols). */
701static Lisp_Object 701static Lisp_Object
702nsfont_list_family (Lisp_Object frame) 702nsfont_list_family (struct frame *f)
703{ 703{
704 Lisp_Object list = Qnil; 704 Lisp_Object list = Qnil;
705 NSEnumerator *families; 705 NSEnumerator *families;
@@ -724,7 +724,7 @@ nsfont_list_family (Lisp_Object frame)
724/* Open a font specified by FONT_ENTITY on frame F. If the font is 724/* Open a font specified by FONT_ENTITY on frame F. If the font is
725 scalable, open it with PIXEL_SIZE. */ 725 scalable, open it with PIXEL_SIZE. */
726static Lisp_Object 726static Lisp_Object
727nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size) 727nsfont_open (struct frame *f, Lisp_Object font_entity, int pixel_size)
728{ 728{
729 BOOL synthItal; 729 BOOL synthItal;
730 unsigned int traits = 0; 730 unsigned int traits = 0;
@@ -931,7 +931,7 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size)
931 931
932/* Close FONT on frame F. */ 932/* Close FONT on frame F. */
933static void 933static void
934nsfont_close (FRAME_PTR f, struct font *font) 934nsfont_close (struct frame *f, struct font *font)
935{ 935{
936 struct nsfont_info *font_info = (struct nsfont_info *)font; 936 struct nsfont_info *font_info = (struct nsfont_info *)font;
937 int i; 937 int i;
diff --git a/src/nsmenu.m b/src/nsmenu.m
index 02fe0b04ca0..464be89c524 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -806,7 +806,7 @@ extern NSString *NSMenuDidBeginTrackingNotification;
806 ========================================================================== */ 806 ========================================================================== */
807 807
808Lisp_Object 808Lisp_Object
809ns_menu_show (FRAME_PTR f, int x, int y, bool for_click, bool keymaps, 809ns_menu_show (struct frame *f, int x, int y, bool for_click, bool keymaps,
810 Lisp_Object title, const char **error) 810 Lisp_Object title, const char **error)
811{ 811{
812 EmacsMenu *pmenu; 812 EmacsMenu *pmenu;
@@ -1028,7 +1028,7 @@ ns_menu_show (FRAME_PTR f, int x, int y, bool for_click, bool keymaps,
1028 ========================================================================== */ 1028 ========================================================================== */
1029 1029
1030void 1030void
1031free_frame_tool_bar (FRAME_PTR f) 1031free_frame_tool_bar (struct frame *f)
1032/* -------------------------------------------------------------------------- 1032/* --------------------------------------------------------------------------
1033 Under NS we just hide the toolbar until it might be needed again. 1033 Under NS we just hide the toolbar until it might be needed again.
1034 -------------------------------------------------------------------------- */ 1034 -------------------------------------------------------------------------- */
@@ -1040,7 +1040,7 @@ free_frame_tool_bar (FRAME_PTR f)
1040} 1040}
1041 1041
1042void 1042void
1043update_frame_tool_bar (FRAME_PTR f) 1043update_frame_tool_bar (struct frame *f)
1044/* -------------------------------------------------------------------------- 1044/* --------------------------------------------------------------------------
1045 Update toolbar contents 1045 Update toolbar contents
1046 -------------------------------------------------------------------------- */ 1046 -------------------------------------------------------------------------- */
diff --git a/src/nsterm.h b/src/nsterm.h
index 745b8a4145b..1303a475547 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -109,7 +109,10 @@ typedef float EmacsCGFloat;
109@interface EmacsView : NSView <NSTextInput> 109@interface EmacsView : NSView <NSTextInput>
110#endif 110#endif
111 { 111 {
112#ifdef NS_IMPL_COCOA
112 char *old_title; 113 char *old_title;
114 BOOL maximizing_resize;
115#endif
113 BOOL windowClosing; 116 BOOL windowClosing;
114 NSString *workingText; 117 NSString *workingText;
115 BOOL processingCompose; 118 BOOL processingCompose;
@@ -778,7 +781,7 @@ void ns_dump_glyphstring (struct glyph_string *s);
778 781
779/* Implemented in nsterm, published in or needed from nsfns. */ 782/* Implemented in nsterm, published in or needed from nsfns. */
780extern Lisp_Object Qfontsize; 783extern Lisp_Object Qfontsize;
781extern Lisp_Object ns_list_fonts (FRAME_PTR f, Lisp_Object pattern, 784extern Lisp_Object ns_list_fonts (struct frame *f, Lisp_Object pattern,
782 int size, int maxnames); 785 int size, int maxnames);
783extern void ns_clear_frame (struct frame *f); 786extern void ns_clear_frame (struct frame *f);
784 787
@@ -824,11 +827,11 @@ extern void ns_release_autorelease_pool (void *);
824extern const char *ns_get_defaults_value (const char *key); 827extern const char *ns_get_defaults_value (const char *key);
825 828
826/* in nsmenu */ 829/* in nsmenu */
827extern void update_frame_tool_bar (FRAME_PTR f); 830extern void update_frame_tool_bar (struct frame *f);
828extern void free_frame_tool_bar (FRAME_PTR f); 831extern void free_frame_tool_bar (struct frame *f);
829extern void find_and_call_menu_selection (FRAME_PTR f, 832extern void find_and_call_menu_selection (struct frame *f,
830 int menu_bar_items_used, Lisp_Object vector, void *client_data); 833 int menu_bar_items_used, Lisp_Object vector, void *client_data);
831extern Lisp_Object find_and_return_menu_selection (FRAME_PTR f, 834extern Lisp_Object find_and_return_menu_selection (struct frame *f,
832 bool keymaps, 835 bool keymaps,
833 void *client_data); 836 void *client_data);
834extern Lisp_Object ns_popup_dialog (Lisp_Object position, Lisp_Object contents, 837extern Lisp_Object ns_popup_dialog (Lisp_Object position, Lisp_Object contents,
diff --git a/src/nsterm.m b/src/nsterm.m
index 14706f6b91d..3672c7656da 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1353,7 +1353,7 @@ x_set_window_size (struct frame *f, int change_grav, int cols, int rows)
1353 1353
1354 1354
1355static void 1355static void
1356ns_fullscreen_hook (FRAME_PTR f) 1356ns_fullscreen_hook (struct frame *f)
1357{ 1357{
1358 EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f); 1358 EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f);
1359 1359
@@ -1883,10 +1883,9 @@ ns_frame_up_to_date (struct frame *f)
1883 { 1883 {
1884 block_input (); 1884 block_input ();
1885 ns_update_begin(f); 1885 ns_update_begin(f);
1886 if (hlinfo->mouse_face_mouse_frame) 1886 note_mouse_highlight (hlinfo->mouse_face_mouse_frame,
1887 note_mouse_highlight (hlinfo->mouse_face_mouse_frame, 1887 hlinfo->mouse_face_mouse_x,
1888 hlinfo->mouse_face_mouse_x, 1888 hlinfo->mouse_face_mouse_y);
1889 hlinfo->mouse_face_mouse_y);
1890 ns_update_end(f); 1889 ns_update_end(f);
1891 unblock_input (); 1890 unblock_input ();
1892 } 1891 }
@@ -3863,15 +3862,6 @@ ns_judge_scroll_bars (struct frame *f)
3863 [eview updateFrameSize: NO]; 3862 [eview updateFrameSize: NO];
3864} 3863}
3865 3864
3866
3867void
3868x_wm_set_icon_position (struct frame *f, int icon_x, int icon_y)
3869{
3870 /* XXX irrelevant under NS */
3871}
3872
3873
3874
3875/* ========================================================================== 3865/* ==========================================================================
3876 3866
3877 Initialization 3867 Initialization
@@ -5673,17 +5663,17 @@ not_in_argv (NSString *arg)
5673 old_title = 0; 5663 old_title = 0;
5674 } 5664 }
5675 } 5665 }
5676 else 5666 else if (fs_state == FULLSCREEN_NONE && ! maximizing_resize)
5677 { 5667 {
5678 char *size_title; 5668 char *size_title;
5679 NSWindow *window = [self window]; 5669 NSWindow *window = [self window];
5680 if (old_title == 0) 5670 if (old_title == 0)
5681 { 5671 {
5682 const char *t = [[[self window] title] UTF8String]; 5672 char *t = strdup ([[[self window] title] UTF8String]);
5683 char *pos = strstr (t, " — "); 5673 char *pos = strstr (t, " — ");
5684 if (pos) 5674 if (pos)
5685 *pos = '\0'; 5675 *pos = '\0';
5686 old_title = xstrdup (t); 5676 old_title = t;
5687 } 5677 }
5688 size_title = xmalloc (strlen (old_title) + 40); 5678 size_title = xmalloc (strlen (old_title) + 40);
5689 esprintf (size_title, "%s — (%d x %d)", old_title, cols, rows); 5679 esprintf (size_title, "%s — (%d x %d)", old_title, cols, rows);
@@ -5722,21 +5712,27 @@ not_in_argv (NSString *arg)
5722 NSTRACE (windowDidResize); 5712 NSTRACE (windowDidResize);
5723/*fprintf (stderr,"windowDidResize: %.0f\n",[theWindow frame].size.height); */ 5713/*fprintf (stderr,"windowDidResize: %.0f\n",[theWindow frame].size.height); */
5724 5714
5715if (cols > 0 && rows > 0)
5716 {
5717 [self updateFrameSize: YES];
5718 }
5719
5720 ns_send_appdefined (-1);
5721}
5722
5725#ifdef NS_IMPL_COCOA 5723#ifdef NS_IMPL_COCOA
5724- (void)viewDidEndLiveResize
5725{
5726 [super viewDidEndLiveResize];
5726 if (old_title != 0) 5727 if (old_title != 0)
5727 { 5728 {
5729 [[self window] setTitle: [NSString stringWithUTF8String: old_title]];
5728 xfree (old_title); 5730 xfree (old_title);
5729 old_title = 0; 5731 old_title = 0;
5730 } 5732 }
5731#endif /* NS_IMPL_COCOA */ 5733 maximizing_resize = NO;
5732
5733 if (cols > 0 && rows > 0)
5734 {
5735 [self updateFrameSize: YES];
5736 }
5737
5738 ns_send_appdefined (-1);
5739} 5734}
5735#endif /* NS_IMPL_COCOA */
5740 5736
5741 5737
5742- (void)windowDidBecomeKey: (NSNotification *)notification 5738- (void)windowDidBecomeKey: (NSNotification *)notification
@@ -5841,7 +5837,10 @@ not_in_argv (NSString *arg)
5841 5837
5842 FRAME_NS_VIEW (f) = self; 5838 FRAME_NS_VIEW (f) = self;
5843 emacsframe = f; 5839 emacsframe = f;
5840#ifdef NS_IMPL_COCOA
5844 old_title = 0; 5841 old_title = 0;
5842 maximizing_resize = NO;
5843#endif
5845 5844
5846 win = [[EmacsWindow alloc] 5845 win = [[EmacsWindow alloc]
5847 initWithContentRect: r 5846 initWithContentRect: r
@@ -5984,6 +5983,9 @@ not_in_argv (NSString *arg)
5984 maximized_width = -1; 5983 maximized_width = -1;
5985 result.origin.y = defaultFrame.origin.y; 5984 result.origin.y = defaultFrame.origin.y;
5986 [self setFSValue: FULLSCREEN_HEIGHT]; 5985 [self setFSValue: FULLSCREEN_HEIGHT];
5986#ifdef NS_IMPL_COCOA
5987 maximizing_resize = YES;
5988#endif
5987 } 5989 }
5988 else if (next_maximized == FULLSCREEN_WIDTH) 5990 else if (next_maximized == FULLSCREEN_WIDTH)
5989 { 5991 {
@@ -6002,12 +6004,18 @@ not_in_argv (NSString *arg)
6002 maximized_width = result.size.width; 6004 maximized_width = result.size.width;
6003 maximized_height = result.size.height; 6005 maximized_height = result.size.height;
6004 [self setFSValue: FULLSCREEN_MAXIMIZED]; 6006 [self setFSValue: FULLSCREEN_MAXIMIZED];
6007#ifdef NS_IMPL_COCOA
6008 maximizing_resize = YES;
6009#endif
6005 } 6010 }
6006 else 6011 else
6007 { 6012 {
6008 /* restore */ 6013 /* restore */
6009 result = ns_userRect.size.height ? ns_userRect : result; 6014 result = ns_userRect.size.height ? ns_userRect : result;
6010 ns_userRect = NSMakeRect (0, 0, 0, 0); 6015 ns_userRect = NSMakeRect (0, 0, 0, 0);
6016#ifdef NS_IMPL_COCOA
6017 maximizing_resize = fs_state != FULLSCREEN_NONE;
6018#endif
6011 [self setFSValue: FULLSCREEN_NONE]; 6019 [self setFSValue: FULLSCREEN_NONE];
6012 maximized_width = maximized_height = -1; 6020 maximized_width = maximized_height = -1;
6013 } 6021 }
diff --git a/src/scroll.c b/src/scroll.c
index 037e338c696..3e296068e8f 100644
--- a/src/scroll.c
+++ b/src/scroll.c
@@ -86,7 +86,7 @@ static void do_scrolling (struct frame *,
86 new contents appears. */ 86 new contents appears. */
87 87
88static void 88static void
89calculate_scrolling (FRAME_PTR frame, 89calculate_scrolling (struct frame *frame,
90 /* matrix is of size window_size + 1 on each side. */ 90 /* matrix is of size window_size + 1 on each side. */
91 struct matrix_elt *matrix, 91 struct matrix_elt *matrix,
92 int window_size, int lines_below, 92 int window_size, int lines_below,
@@ -422,7 +422,7 @@ do_scrolling (struct frame *frame, struct glyph_matrix *current_matrix,
422 is the equivalent of draw_cost for the old line contents */ 422 is the equivalent of draw_cost for the old line contents */
423 423
424static void 424static void
425calculate_direct_scrolling (FRAME_PTR frame, 425calculate_direct_scrolling (struct frame *frame,
426 /* matrix is of size window_size + 1 on each side. */ 426 /* matrix is of size window_size + 1 on each side. */
427 struct matrix_elt *matrix, 427 struct matrix_elt *matrix,
428 int window_size, int lines_below, 428 int window_size, int lines_below,
@@ -793,7 +793,7 @@ do_direct_scrolling (struct frame *frame, struct glyph_matrix *current_matrix,
793 793
794 794
795void 795void
796scrolling_1 (FRAME_PTR frame, int window_size, int unchanged_at_top, 796scrolling_1 (struct frame *frame, int window_size, int unchanged_at_top,
797 int unchanged_at_bottom, int *draw_cost, int *old_draw_cost, 797 int unchanged_at_bottom, int *draw_cost, int *old_draw_cost,
798 int *old_hash, int *new_hash, int free_at_end) 798 int *old_hash, int *new_hash, int free_at_end)
799{ 799{
@@ -883,7 +883,7 @@ scrolling_max_lines_saved (int start, int end,
883 overhead and multiply factor values */ 883 overhead and multiply factor values */
884 884
885static void 885static void
886line_ins_del (FRAME_PTR frame, int ov1, int pf1, int ovn, int pfn, 886line_ins_del (struct frame *frame, int ov1, int pf1, int ovn, int pfn,
887 register int *ov, register int *mf) 887 register int *ov, register int *mf)
888{ 888{
889 register int i; 889 register int i;
@@ -901,7 +901,7 @@ line_ins_del (FRAME_PTR frame, int ov1, int pf1, int ovn, int pfn,
901} 901}
902 902
903static void 903static void
904ins_del_costs (FRAME_PTR frame, 904ins_del_costs (struct frame *frame,
905 const char *one_line_string, const char *multi_string, 905 const char *one_line_string, const char *multi_string,
906 const char *setup_string, const char *cleanup_string, 906 const char *setup_string, const char *cleanup_string,
907 int *costvec, int *ncostvec, 907 int *costvec, int *ncostvec,
@@ -957,7 +957,7 @@ ins_del_costs (FRAME_PTR frame,
957 */ 957 */
958 958
959void 959void
960do_line_insertion_deletion_costs (FRAME_PTR frame, 960do_line_insertion_deletion_costs (struct frame *frame,
961 const char *ins_line_string, 961 const char *ins_line_string,
962 const char *multi_ins_string, 962 const char *multi_ins_string,
963 const char *del_line_string, 963 const char *del_line_string,
diff --git a/src/term.c b/src/term.c
index 376d6e7831a..fb69aefbe7a 100644
--- a/src/term.c
+++ b/src/term.c
@@ -2522,7 +2522,7 @@ tty_draw_row_with_mouse_face (struct window *w, struct glyph_row *row,
2522} 2522}
2523 2523
2524static bool 2524static bool
2525term_mouse_movement (FRAME_PTR frame, Gpm_Event *event) 2525term_mouse_movement (struct frame *frame, Gpm_Event *event)
2526{ 2526{
2527 /* Has the mouse moved off the glyph it was on at the last sighting? */ 2527 /* Has the mouse moved off the glyph it was on at the last sighting? */
2528 if (event->x != last_mouse_x || event->y != last_mouse_y) 2528 if (event->x != last_mouse_x || event->y != last_mouse_y)
@@ -2563,7 +2563,7 @@ timeval_to_Time (struct timeval const *t)
2563 This clears mouse_moved until the next motion 2563 This clears mouse_moved until the next motion
2564 event arrives. */ 2564 event arrives. */
2565static void 2565static void
2566term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, 2566term_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window,
2567 enum scroll_bar_part *part, Lisp_Object *x, 2567 enum scroll_bar_part *part, Lisp_Object *x,
2568 Lisp_Object *y, Time *timeptr) 2568 Lisp_Object *y, Time *timeptr)
2569{ 2569{
@@ -2933,7 +2933,7 @@ dissociate_if_controlling_tty (int fd)
2933 2933
2934 TERMINAL_TYPE is the termcap type of the device, e.g. "vt100". 2934 TERMINAL_TYPE is the termcap type of the device, e.g. "vt100".
2935 2935
2936 If MUST_SUCCEED is true, then all errors are fatal. */ 2936 If MUST_SUCCEED is true, then all errors are fatal. */
2937 2937
2938struct terminal * 2938struct terminal *
2939init_tty (const char *name, const char *terminal_type, bool must_succeed) 2939init_tty (const char *name, const char *terminal_type, bool must_succeed)
@@ -2944,7 +2944,7 @@ init_tty (const char *name, const char *terminal_type, bool must_succeed)
2944 int status; 2944 int status;
2945 struct tty_display_info *tty = NULL; 2945 struct tty_display_info *tty = NULL;
2946 struct terminal *terminal = NULL; 2946 struct terminal *terminal = NULL;
2947 bool ctty = 0; /* True if asked to open controlling tty. */ 2947 bool ctty = false; /* True if asked to open controlling tty. */
2948 2948
2949 if (!terminal_type) 2949 if (!terminal_type)
2950 maybe_fatal (must_succeed, 0, 2950 maybe_fatal (must_succeed, 0,
@@ -3031,7 +3031,7 @@ init_tty (const char *name, const char *terminal_type, bool must_succeed)
3031 tty->termcap_term_buffer = xmalloc (buffer_size); 3031 tty->termcap_term_buffer = xmalloc (buffer_size);
3032 3032
3033 /* On some systems, tgetent tries to access the controlling 3033 /* On some systems, tgetent tries to access the controlling
3034 terminal. */ 3034 terminal. */
3035 block_tty_out_signal (); 3035 block_tty_out_signal ();
3036 status = tgetent (tty->termcap_term_buffer, terminal_type); 3036 status = tgetent (tty->termcap_term_buffer, terminal_type);
3037 unblock_tty_out_signal (); 3037 unblock_tty_out_signal ();
@@ -3101,13 +3101,13 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
3101 Right (tty) = tgetstr ("nd", address); 3101 Right (tty) = tgetstr ("nd", address);
3102 Down (tty) = tgetstr ("do", address); 3102 Down (tty) = tgetstr ("do", address);
3103 if (!Down (tty)) 3103 if (!Down (tty))
3104 Down (tty) = tgetstr ("nl", address); /* Obsolete name for "do" */ 3104 Down (tty) = tgetstr ("nl", address); /* Obsolete name for "do". */
3105 if (tgetflag ("bs")) 3105 if (tgetflag ("bs"))
3106 Left (tty) = "\b"; /* can't possibly be longer! */ 3106 Left (tty) = "\b"; /* Can't possibly be longer! */
3107 else /* (Actually, "bs" is obsolete...) */ 3107 else /* (Actually, "bs" is obsolete...) */
3108 Left (tty) = tgetstr ("le", address); 3108 Left (tty) = tgetstr ("le", address);
3109 if (!Left (tty)) 3109 if (!Left (tty))
3110 Left (tty) = tgetstr ("bc", address); /* Obsolete name for "le" */ 3110 Left (tty) = tgetstr ("bc", address); /* Obsolete name for "le". */
3111 tty->TS_pad_char = tgetstr ("pc", address); 3111 tty->TS_pad_char = tgetstr ("pc", address);
3112 tty->TS_repeat = tgetstr ("rp", address); 3112 tty->TS_repeat = tgetstr ("rp", address);
3113 tty->TS_end_standout_mode = tgetstr ("se", address); 3113 tty->TS_end_standout_mode = tgetstr ("se", address);
@@ -3229,7 +3229,7 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
3229 don't think we're losing anything by turning it off. */ 3229 don't think we're losing anything by turning it off. */
3230 terminal->line_ins_del_ok = 0; 3230 terminal->line_ins_del_ok = 0;
3231 3231
3232 tty->TN_max_colors = 16; /* Required to be non-zero for tty-display-color-p */ 3232 tty->TN_max_colors = 16; /* Must be non-zero for tty-display-color-p. */
3233#endif /* DOS_NT */ 3233#endif /* DOS_NT */
3234 3234
3235#ifdef HAVE_GPM 3235#ifdef HAVE_GPM
@@ -3325,16 +3325,16 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
3325 tty->Wcm->cm_tab = 0; 3325 tty->Wcm->cm_tab = 0;
3326 /* We can't support standout mode, because it uses magic cookies. */ 3326 /* We can't support standout mode, because it uses magic cookies. */
3327 tty->TS_standout_mode = 0; 3327 tty->TS_standout_mode = 0;
3328 /* But that means we cannot rely on ^M to go to column zero! */ 3328 /* But that means we cannot rely on ^M to go to column zero! */
3329 CR (tty) = 0; 3329 CR (tty) = 0;
3330 /* LF can't be trusted either -- can alter hpos */ 3330 /* LF can't be trusted either -- can alter hpos. */
3331 /* if move at column 0 thru a line with TS_standout_mode */ 3331 /* If move at column 0 thru a line with TS_standout_mode. */
3332 Down (tty) = 0; 3332 Down (tty) = 0;
3333 } 3333 }
3334 3334
3335 tty->specified_window = FrameRows (tty); 3335 tty->specified_window = FrameRows (tty);
3336 3336
3337 if (Wcm_init (tty) == -1) /* can't do cursor motion */ 3337 if (Wcm_init (tty) == -1) /* Can't do cursor motion. */
3338 { 3338 {
3339 maybe_fatal (must_succeed, terminal, 3339 maybe_fatal (must_succeed, terminal,
3340 "Terminal type \"%s\" is not powerful enough to run Emacs", 3340 "Terminal type \"%s\" is not powerful enough to run Emacs",
diff --git a/src/terminal.c b/src/terminal.c
index c55fd4eb077..4b5532e3a44 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -39,6 +39,8 @@ static int next_terminal_id;
39/* The initial terminal device, created by initial_term_init. */ 39/* The initial terminal device, created by initial_term_init. */
40struct terminal *initial_terminal; 40struct terminal *initial_terminal;
41 41
42static Lisp_Object Qterminal_live_p;
43
42static void delete_initial_terminal (struct terminal *); 44static void delete_initial_terminal (struct terminal *);
43 45
44/* This setter is used only in this file, so it can be private. */ 46/* This setter is used only in this file, so it can be private. */
@@ -549,6 +551,8 @@ Each function is called with argument, the terminal.
549This may be called just before actually deleting the terminal, 551This may be called just before actually deleting the terminal,
550or some time later. */); 552or some time later. */);
551 Vdelete_terminal_functions = Qnil; 553 Vdelete_terminal_functions = Qnil;
554
555 DEFSYM (Qterminal_live_p, "terminal-live-p");
552 DEFSYM (Qdelete_terminal_functions, "delete-terminal-functions"); 556 DEFSYM (Qdelete_terminal_functions, "delete-terminal-functions");
553 DEFSYM (Qrun_hook_with_args, "run-hook-with-args"); 557 DEFSYM (Qrun_hook_with_args, "run-hook-with-args");
554 558
diff --git a/src/w32fns.c b/src/w32fns.c
index 2b06936d119..dff35de0973 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -285,7 +285,7 @@ check_x_display_info (Lisp_Object frame)
285 return x_display_info_for_name (frame); 285 return x_display_info_for_name (frame);
286 else 286 else
287 { 287 {
288 FRAME_PTR f; 288 struct frame *f;
289 289
290 CHECK_LIVE_FRAME (frame); 290 CHECK_LIVE_FRAME (frame);
291 f = XFRAME (frame); 291 f = XFRAME (frame);
@@ -344,7 +344,7 @@ void x_set_tool_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
344 not Emacs's own window. */ 344 not Emacs's own window. */
345 345
346void 346void
347x_real_positions (FRAME_PTR f, int *xptr, int *yptr) 347x_real_positions (struct frame *f, int *xptr, int *yptr)
348{ 348{
349 POINT pt; 349 POINT pt;
350 RECT rect; 350 RECT rect;
@@ -1019,7 +1019,7 @@ x_to_w32_color (const char * colorname)
1019} 1019}
1020 1020
1021void 1021void
1022w32_regenerate_palette (FRAME_PTR f) 1022w32_regenerate_palette (struct frame *f)
1023{ 1023{
1024 struct w32_palette_entry * list; 1024 struct w32_palette_entry * list;
1025 LOGPALETTE * log_palette; 1025 LOGPALETTE * log_palette;
@@ -1069,7 +1069,7 @@ w32_regenerate_palette (FRAME_PTR f)
1069#if 0 1069#if 0
1070/* Keep these around in case we ever want to track color usage. */ 1070/* Keep these around in case we ever want to track color usage. */
1071void 1071void
1072w32_map_color (FRAME_PTR f, COLORREF color) 1072w32_map_color (struct frame *f, COLORREF color)
1073{ 1073{
1074 struct w32_palette_entry * list = FRAME_W32_DISPLAY_INFO (f)->color_list; 1074 struct w32_palette_entry * list = FRAME_W32_DISPLAY_INFO (f)->color_list;
1075 1075
@@ -1100,7 +1100,7 @@ w32_map_color (FRAME_PTR f, COLORREF color)
1100} 1100}
1101 1101
1102void 1102void
1103w32_unmap_color (FRAME_PTR f, COLORREF color) 1103w32_unmap_color (struct frame *f, COLORREF color)
1104{ 1104{
1105 struct w32_palette_entry * list = FRAME_W32_DISPLAY_INFO (f)->color_list; 1105 struct w32_palette_entry * list = FRAME_W32_DISPLAY_INFO (f)->color_list;
1106 struct w32_palette_entry **prev = &FRAME_W32_DISPLAY_INFO (f)->color_list; 1106 struct w32_palette_entry **prev = &FRAME_W32_DISPLAY_INFO (f)->color_list;
@@ -1153,7 +1153,7 @@ gamma_correct (struct frame *f, COLORREF *color)
1153 If ALLOC is nonzero, allocate a new colormap cell. */ 1153 If ALLOC is nonzero, allocate a new colormap cell. */
1154 1154
1155int 1155int
1156w32_defined_color (FRAME_PTR f, const char *color, XColor *color_def, int alloc) 1156w32_defined_color (struct frame *f, const char *color, XColor *color_def, int alloc)
1157{ 1157{
1158 register Lisp_Object tem; 1158 register Lisp_Object tem;
1159 COLORREF w32_color_ref; 1159 COLORREF w32_color_ref;
@@ -1224,7 +1224,7 @@ w32_defined_color (FRAME_PTR f, const char *color, XColor *color_def, int alloc)
1224 ARG says. */ 1224 ARG says. */
1225 1225
1226int 1226int
1227x_decode_color (FRAME_PTR f, Lisp_Object arg, int def) 1227x_decode_color (struct frame *f, Lisp_Object arg, int def)
1228{ 1228{
1229 XColor cdef; 1229 XColor cdef;
1230 1230
@@ -1525,7 +1525,7 @@ x_set_border_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1525 1525
1526 1526
1527void 1527void
1528x_set_cursor_type (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval) 1528x_set_cursor_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1529{ 1529{
1530 set_frame_cursor_types (f, arg); 1530 set_frame_cursor_types (f, arg);
1531 1531
@@ -1787,7 +1787,7 @@ x_set_name (struct frame *f, Lisp_Object name, int explicit)
1787 specified a name for the frame; the name will override any set by the 1787 specified a name for the frame; the name will override any set by the
1788 redisplay code. */ 1788 redisplay code. */
1789void 1789void
1790x_explicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval) 1790x_explicitly_set_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1791{ 1791{
1792 x_set_name (f, arg, 1); 1792 x_set_name (f, arg, 1);
1793} 1793}
@@ -1796,7 +1796,7 @@ x_explicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval)
1796 name; names set this way will never override names set by the user's 1796 name; names set this way will never override names set by the user's
1797 lisp code. */ 1797 lisp code. */
1798void 1798void
1799x_implicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval) 1799x_implicitly_set_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1800{ 1800{
1801 x_set_name (f, arg, 0); 1801 x_set_name (f, arg, 0);
1802} 1802}
@@ -4182,9 +4182,6 @@ x_icon (struct frame *f, Lisp_Object parms)
4182 4182
4183 block_input (); 4183 block_input ();
4184 4184
4185 if (! EQ (icon_x, Qunbound))
4186 x_wm_set_icon_position (f, XINT (icon_x), XINT (icon_y));
4187
4188#if 0 /* TODO */ 4185#if 0 /* TODO */
4189 /* Start up iconic or window? */ 4186 /* Start up iconic or window? */
4190 x_wm_set_window_state 4187 x_wm_set_window_state
@@ -4648,7 +4645,7 @@ DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0,
4648 (Lisp_Object color, Lisp_Object frame) 4645 (Lisp_Object color, Lisp_Object frame)
4649{ 4646{
4650 XColor foo; 4647 XColor foo;
4651 FRAME_PTR f = decode_window_system_frame (frame); 4648 struct frame *f = decode_window_system_frame (frame);
4652 4649
4653 CHECK_STRING (color); 4650 CHECK_STRING (color);
4654 4651
@@ -4663,7 +4660,7 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0,
4663 (Lisp_Object color, Lisp_Object frame) 4660 (Lisp_Object color, Lisp_Object frame)
4664{ 4661{
4665 XColor foo; 4662 XColor foo;
4666 FRAME_PTR f = decode_window_system_frame (frame); 4663 struct frame *f = decode_window_system_frame (frame);
4667 4664
4668 CHECK_STRING (color); 4665 CHECK_STRING (color);
4669 4666
@@ -5139,19 +5136,6 @@ SOUND is nil to use the normal beep. */)
5139 return sound; 5136 return sound;
5140} 5137}
5141 5138
5142
5143int
5144x_pixel_width (register struct frame *f)
5145{
5146 return FRAME_PIXEL_WIDTH (f);
5147}
5148
5149int
5150x_pixel_height (register struct frame *f)
5151{
5152 return FRAME_PIXEL_HEIGHT (f);
5153}
5154
5155int 5139int
5156x_screen_planes (register struct frame *f) 5140x_screen_planes (register struct frame *f)
5157{ 5141{
@@ -6626,7 +6610,7 @@ screen saver if defined.
6626If optional parameter FRAME is not specified, use selected frame. */) 6610If optional parameter FRAME is not specified, use selected frame. */)
6627 (Lisp_Object command, Lisp_Object frame) 6611 (Lisp_Object command, Lisp_Object frame)
6628{ 6612{
6629 FRAME_PTR f = decode_window_system_frame (frame); 6613 struct frame *f = decode_window_system_frame (frame);
6630 6614
6631 CHECK_NUMBER (command); 6615 CHECK_NUMBER (command);
6632 6616
diff --git a/src/w32font.c b/src/w32font.c
index 105daa06365..4a97fd90a4e 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -99,7 +99,7 @@ static Lisp_Object Qw32_charset_thai, Qw32_charset_johab, Qw32_charset_mac;
99/* Font spacing symbols - defined in font.c. */ 99/* Font spacing symbols - defined in font.c. */
100extern Lisp_Object Qc, Qp, Qm; 100extern Lisp_Object Qc, Qp, Qm;
101 101
102static void fill_in_logfont (FRAME_PTR, LOGFONT *, Lisp_Object); 102static void fill_in_logfont (struct frame *, LOGFONT *, Lisp_Object);
103 103
104static BYTE w32_antialias_type (Lisp_Object); 104static BYTE w32_antialias_type (Lisp_Object);
105static Lisp_Object lispy_antialias_type (BYTE); 105static Lisp_Object lispy_antialias_type (BYTE);
@@ -297,7 +297,7 @@ intern_font_name (char * string)
297 Return a cache of font-entities on FRAME. The cache must be a 297 Return a cache of font-entities on FRAME. The cache must be a
298 cons whose cdr part is the actual cache area. */ 298 cons whose cdr part is the actual cache area. */
299Lisp_Object 299Lisp_Object
300w32font_get_cache (FRAME_PTR f) 300w32font_get_cache (struct frame *f)
301{ 301{
302 struct w32_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 302 struct w32_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
303 303
@@ -309,9 +309,9 @@ w32font_get_cache (FRAME_PTR f)
309 is a vector of font-entities. This is the sole API that 309 is a vector of font-entities. This is the sole API that
310 allocates font-entities. */ 310 allocates font-entities. */
311static Lisp_Object 311static Lisp_Object
312w32font_list (Lisp_Object frame, Lisp_Object font_spec) 312w32font_list (struct frame *f, Lisp_Object font_spec)
313{ 313{
314 Lisp_Object fonts = w32font_list_internal (frame, font_spec, 0); 314 Lisp_Object fonts = w32font_list_internal (f, font_spec, 0);
315 FONT_ADD_LOG ("w32font-list", font_spec, fonts); 315 FONT_ADD_LOG ("w32font-list", font_spec, fonts);
316 return fonts; 316 return fonts;
317} 317}
@@ -321,9 +321,9 @@ w32font_list (Lisp_Object frame, Lisp_Object font_spec)
321 FRAME. The closeness is determined by the font backend, thus 321 FRAME. The closeness is determined by the font backend, thus
322 `face-font-selection-order' is ignored here. */ 322 `face-font-selection-order' is ignored here. */
323static Lisp_Object 323static Lisp_Object
324w32font_match (Lisp_Object frame, Lisp_Object font_spec) 324w32font_match (struct frame *f, Lisp_Object font_spec)
325{ 325{
326 Lisp_Object entity = w32font_match_internal (frame, font_spec, 0); 326 Lisp_Object entity = w32font_match_internal (f, font_spec, 0);
327 FONT_ADD_LOG ("w32font-match", font_spec, entity); 327 FONT_ADD_LOG ("w32font-match", font_spec, entity);
328 return entity; 328 return entity;
329} 329}
@@ -332,12 +332,11 @@ w32font_match (Lisp_Object frame, Lisp_Object font_spec)
332 List available families. The value is a list of family names 332 List available families. The value is a list of family names
333 (symbols). */ 333 (symbols). */
334static Lisp_Object 334static Lisp_Object
335w32font_list_family (Lisp_Object frame) 335w32font_list_family (struct frame *f)
336{ 336{
337 Lisp_Object list = Qnil; 337 Lisp_Object list = Qnil;
338 LOGFONT font_match_pattern; 338 LOGFONT font_match_pattern;
339 HDC dc; 339 HDC dc;
340 FRAME_PTR f = XFRAME (frame);
341 340
342 memset (&font_match_pattern, 0, sizeof (font_match_pattern)); 341 memset (&font_match_pattern, 0, sizeof (font_match_pattern));
343 font_match_pattern.lfCharSet = DEFAULT_CHARSET; 342 font_match_pattern.lfCharSet = DEFAULT_CHARSET;
@@ -356,7 +355,7 @@ w32font_list_family (Lisp_Object frame)
356 Open a font specified by FONT_ENTITY on frame F. 355 Open a font specified by FONT_ENTITY on frame F.
357 If the font is scalable, open it with PIXEL_SIZE. */ 356 If the font is scalable, open it with PIXEL_SIZE. */
358static Lisp_Object 357static Lisp_Object
359w32font_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size) 358w32font_open (struct frame *f, Lisp_Object font_entity, int pixel_size)
360{ 359{
361 Lisp_Object font_object 360 Lisp_Object font_object
362 = font_make_object (VECSIZE (struct w32font_info), 361 = font_make_object (VECSIZE (struct w32font_info),
@@ -380,7 +379,7 @@ w32font_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size)
380/* w32 implementation of close for font_backend. 379/* w32 implementation of close for font_backend.
381 Close FONT on frame F. */ 380 Close FONT on frame F. */
382void 381void
383w32font_close (FRAME_PTR f, struct font *font) 382w32font_close (struct frame *f, struct font *font)
384{ 383{
385 int i; 384 int i;
386 struct w32font_info *w32_font = (struct w32font_info *) font; 385 struct w32font_info *w32_font = (struct w32font_info *) font;
@@ -732,13 +731,13 @@ w32font_free_entity (Lisp_Object entity);
732 storing some data in FACE->extra. If successful, return 0. 731 storing some data in FACE->extra. If successful, return 0.
733 Otherwise, return -1. 732 Otherwise, return -1.
734static int 733static int
735w32font_prepare_face (FRAME_PTR f, struct face *face); 734w32font_prepare_face (struct frame *f, struct face *face);
736 */ 735 */
737/* w32 implementation of done_face for font backend. 736/* w32 implementation of done_face for font backend.
738 Optional. 737 Optional.
739 Done FACE for displaying characters by FACE->font on frame F. 738 Done FACE for displaying characters by FACE->font on frame F.
740static void 739static void
741w32font_done_face (FRAME_PTR f, struct face *face); */ 740w32font_done_face (struct frame *f, struct face *face); */
742 741
743/* w32 implementation of get_bitmap for font backend. 742/* w32 implementation of get_bitmap for font backend.
744 Optional. 743 Optional.
@@ -811,15 +810,14 @@ w32font_otf_drive (struct font *font, Lisp_Object features,
811 Additional parameter opentype_only restricts the returned fonts to 810 Additional parameter opentype_only restricts the returned fonts to
812 opentype fonts, which can be used with the Uniscribe backend. */ 811 opentype fonts, which can be used with the Uniscribe backend. */
813Lisp_Object 812Lisp_Object
814w32font_list_internal (Lisp_Object frame, Lisp_Object font_spec, int opentype_only) 813w32font_list_internal (struct frame *f, Lisp_Object font_spec, int opentype_only)
815{ 814{
816 struct font_callback_data match_data; 815 struct font_callback_data match_data;
817 HDC dc; 816 HDC dc;
818 FRAME_PTR f = XFRAME (frame);
819 817
820 match_data.orig_font_spec = font_spec; 818 match_data.orig_font_spec = font_spec;
821 match_data.list = Qnil; 819 match_data.list = Qnil;
822 match_data.frame = frame; 820 XSETFRAME (match_data.frame, f);
823 821
824 memset (&match_data.pattern, 0, sizeof (LOGFONT)); 822 memset (&match_data.pattern, 0, sizeof (LOGFONT));
825 fill_in_logfont (f, &match_data.pattern, font_spec); 823 fill_in_logfont (f, &match_data.pattern, font_spec);
@@ -864,14 +862,13 @@ w32font_list_internal (Lisp_Object frame, Lisp_Object font_spec, int opentype_on
864 Additional parameter opentype_only restricts the returned fonts to 862 Additional parameter opentype_only restricts the returned fonts to
865 opentype fonts, which can be used with the Uniscribe backend. */ 863 opentype fonts, which can be used with the Uniscribe backend. */
866Lisp_Object 864Lisp_Object
867w32font_match_internal (Lisp_Object frame, Lisp_Object font_spec, int opentype_only) 865w32font_match_internal (struct frame *f, Lisp_Object font_spec, int opentype_only)
868{ 866{
869 struct font_callback_data match_data; 867 struct font_callback_data match_data;
870 HDC dc; 868 HDC dc;
871 FRAME_PTR f = XFRAME (frame);
872 869
873 match_data.orig_font_spec = font_spec; 870 match_data.orig_font_spec = font_spec;
874 match_data.frame = frame; 871 XSETFRAME (match_data.frame, f);
875 match_data.list = Qnil; 872 match_data.list = Qnil;
876 873
877 memset (&match_data.pattern, 0, sizeof (LOGFONT)); 874 memset (&match_data.pattern, 0, sizeof (LOGFONT));
@@ -892,7 +889,7 @@ w32font_match_internal (Lisp_Object frame, Lisp_Object font_spec, int opentype_o
892} 889}
893 890
894int 891int
895w32font_open_internal (FRAME_PTR f, Lisp_Object font_entity, 892w32font_open_internal (struct frame *f, Lisp_Object font_entity,
896 int pixel_size, Lisp_Object font_object) 893 int pixel_size, Lisp_Object font_object)
897{ 894{
898 int len, size; 895 int len, size;
@@ -1964,7 +1961,7 @@ w32_to_fc_weight (int n)
1964 1961
1965/* Fill in all the available details of LOGFONT from FONT_SPEC. */ 1962/* Fill in all the available details of LOGFONT from FONT_SPEC. */
1966static void 1963static void
1967fill_in_logfont (FRAME_PTR f, LOGFONT *logfont, Lisp_Object font_spec) 1964fill_in_logfont (struct frame *f, LOGFONT *logfont, Lisp_Object font_spec)
1968{ 1965{
1969 Lisp_Object tmp, extra; 1966 Lisp_Object tmp, extra;
1970 int dpi = FRAME_RES_Y (f); 1967 int dpi = FRAME_RES_Y (f);
@@ -2114,7 +2111,7 @@ static void
2114list_all_matching_fonts (struct font_callback_data *match_data) 2111list_all_matching_fonts (struct font_callback_data *match_data)
2115{ 2112{
2116 HDC dc; 2113 HDC dc;
2117 Lisp_Object families = w32font_list_family (match_data->frame); 2114 Lisp_Object families = w32font_list_family (XFRAME (match_data->frame));
2118 struct frame *f = XFRAME (match_data->frame); 2115 struct frame *f = XFRAME (match_data->frame);
2119 2116
2120 dc = get_frame_dc (f); 2117 dc = get_frame_dc (f);
@@ -2467,7 +2464,7 @@ If EXCLUDE-PROPORTIONAL is non-nil, exclude proportional fonts
2467in the font selection dialog. */) 2464in the font selection dialog. */)
2468 (Lisp_Object frame, Lisp_Object exclude_proportional) 2465 (Lisp_Object frame, Lisp_Object exclude_proportional)
2469{ 2466{
2470 FRAME_PTR f = decode_window_system_frame (frame); 2467 struct frame *f = decode_window_system_frame (frame);
2471 CHOOSEFONT cf; 2468 CHOOSEFONT cf;
2472 LOGFONT lf; 2469 LOGFONT lf;
2473 TEXTMETRIC tm; 2470 TEXTMETRIC tm;
diff --git a/src/w32font.h b/src/w32font.h
index b4345478a22..56220860863 100644
--- a/src/w32font.h
+++ b/src/w32font.h
@@ -63,16 +63,16 @@ struct w32font_info
63 63
64#define CACHE_BLOCKSIZE 128 64#define CACHE_BLOCKSIZE 128
65 65
66Lisp_Object w32font_get_cache (FRAME_PTR fe); 66Lisp_Object w32font_get_cache (struct frame *fe);
67Lisp_Object w32font_list_internal (Lisp_Object frame, 67Lisp_Object w32font_list_internal (struct frame *f,
68 Lisp_Object font_spec, 68 Lisp_Object font_spec,
69 int opentype_only); 69 int opentype_only);
70Lisp_Object w32font_match_internal (Lisp_Object frame, 70Lisp_Object w32font_match_internal (struct frame *f,
71 Lisp_Object font_spec, 71 Lisp_Object font_spec,
72 int opentype_only); 72 int opentype_only);
73int w32font_open_internal (FRAME_PTR f, Lisp_Object font_entity, 73int w32font_open_internal (struct frame *f, Lisp_Object font_entity,
74 int pixel_size, Lisp_Object font_object); 74 int pixel_size, Lisp_Object font_object);
75void w32font_close (FRAME_PTR f, struct font *font); 75void w32font_close (struct frame *f, struct font *font);
76int w32font_has_char (Lisp_Object entity, int c); 76int w32font_has_char (Lisp_Object entity, int c);
77int w32font_text_extents (struct font *font, unsigned *code, int nglyphs, 77int w32font_text_extents (struct font *font, unsigned *code, int nglyphs,
78 struct font_metrics *metrics); 78 struct font_metrics *metrics);
diff --git a/src/w32inevt.c b/src/w32inevt.c
index 88a3f9739cd..ce36f291b00 100644
--- a/src/w32inevt.c
+++ b/src/w32inevt.c
@@ -103,10 +103,10 @@ fill_queue (BOOL block)
103} 103}
104 104
105/* In a generic, multi-frame world this should take a console handle 105/* In a generic, multi-frame world this should take a console handle
106 and return the frame for it 106 and return the frame for it.
107 107
108 Right now, there's only one frame so return it. */ 108 Right now, there's only one frame so return it. */
109static FRAME_PTR 109static struct frame *
110get_frame (void) 110get_frame (void)
111{ 111{
112 return SELECTED_FRAME (); 112 return SELECTED_FRAME ();
@@ -394,7 +394,7 @@ key_event (KEY_EVENT_RECORD *event, struct input_event *emacs_ev, int *isdead)
394 394
395/* Mouse position hook. */ 395/* Mouse position hook. */
396void 396void
397w32_console_mouse_position (FRAME_PTR *f, 397w32_console_mouse_position (struct frame **f,
398 int insist, 398 int insist,
399 Lisp_Object *bar_window, 399 Lisp_Object *bar_window,
400 enum scroll_bar_part *part, 400 enum scroll_bar_part *part,
@@ -461,7 +461,7 @@ do_mouse_event (MOUSE_EVENT_RECORD *event,
461 461
462 if (event->dwEventFlags == MOUSE_MOVED) 462 if (event->dwEventFlags == MOUSE_MOVED)
463 { 463 {
464 FRAME_PTR f = SELECTED_FRAME (); 464 struct frame *f = SELECTED_FRAME ();
465 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); 465 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
466 int mx = event->dwMousePosition.X, my = event->dwMousePosition.Y; 466 int mx = event->dwMousePosition.X, my = event->dwMousePosition.Y;
467 467
@@ -555,7 +555,7 @@ do_mouse_event (MOUSE_EVENT_RECORD *event,
555static void 555static void
556resize_event (WINDOW_BUFFER_SIZE_RECORD *event) 556resize_event (WINDOW_BUFFER_SIZE_RECORD *event)
557{ 557{
558 FRAME_PTR f = get_frame (); 558 struct frame *f = get_frame ();
559 559
560 change_frame_size (f, event->dwSize.Y, event->dwSize.X, 0, 1, 0); 560 change_frame_size (f, event->dwSize.Y, event->dwSize.X, 0, 1, 0);
561 SET_FRAME_GARBAGED (f); 561 SET_FRAME_GARBAGED (f);
@@ -565,7 +565,7 @@ static void
565maybe_generate_resize_event (void) 565maybe_generate_resize_event (void)
566{ 566{
567 CONSOLE_SCREEN_BUFFER_INFO info; 567 CONSOLE_SCREEN_BUFFER_INFO info;
568 FRAME_PTR f = get_frame (); 568 struct frame *f = get_frame ();
569 569
570 GetConsoleScreenBufferInfo (GetStdHandle (STD_OUTPUT_HANDLE), &info); 570 GetConsoleScreenBufferInfo (GetStdHandle (STD_OUTPUT_HANDLE), &info);
571 571
diff --git a/src/w32inevt.h b/src/w32inevt.h
index 8a7e4fed06a..070d1ad7b03 100644
--- a/src/w32inevt.h
+++ b/src/w32inevt.h
@@ -23,7 +23,7 @@ extern int w32_console_unicode_input;
23 23
24extern int w32_console_read_socket (struct terminal *term, 24extern int w32_console_read_socket (struct terminal *term,
25 struct input_event *hold_quit); 25 struct input_event *hold_quit);
26extern void w32_console_mouse_position (FRAME_PTR *f, int insist, 26extern void w32_console_mouse_position (struct frame **f, int insist,
27 Lisp_Object *bar_window, 27 Lisp_Object *bar_window,
28 enum scroll_bar_part *part, 28 enum scroll_bar_part *part,
29 Lisp_Object *x, Lisp_Object *y, 29 Lisp_Object *x, Lisp_Object *y,
diff --git a/src/w32menu.c b/src/w32menu.c
index 346402b7c6b..34020fa61d2 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -100,13 +100,13 @@ MessageBoxW_Proc unicode_message_box = NULL;
100 100
101Lisp_Object Qdebug_on_next_call; 101Lisp_Object Qdebug_on_next_call;
102 102
103void set_frame_menubar (FRAME_PTR, bool, bool); 103void set_frame_menubar (struct frame *, bool, bool);
104 104
105#ifdef HAVE_DIALOGS 105#ifdef HAVE_DIALOGS
106static Lisp_Object w32_dialog_show (FRAME_PTR, int, Lisp_Object, char**); 106static Lisp_Object w32_dialog_show (struct frame *, int, Lisp_Object, char**);
107#else 107#else
108static int is_simple_dialog (Lisp_Object); 108static int is_simple_dialog (Lisp_Object);
109static Lisp_Object simple_dialog_show (FRAME_PTR, Lisp_Object, Lisp_Object); 109static Lisp_Object simple_dialog_show (struct frame *, Lisp_Object, Lisp_Object);
110#endif 110#endif
111 111
112static void utf8to16 (unsigned char *, int, WCHAR *); 112static void utf8to16 (unsigned char *, int, WCHAR *);
@@ -137,7 +137,7 @@ If HEADER is non-nil, the frame title for the box is "Information",
137otherwise it is "Question". */) 137otherwise it is "Question". */)
138 (Lisp_Object position, Lisp_Object contents, Lisp_Object header) 138 (Lisp_Object position, Lisp_Object contents, Lisp_Object header)
139{ 139{
140 FRAME_PTR f = NULL; 140 struct frame *f = NULL;
141 Lisp_Object window; 141 Lisp_Object window;
142 142
143 /* Decode the first argument: find the window or frame to use. */ 143 /* Decode the first argument: find the window or frame to use. */
@@ -147,7 +147,7 @@ otherwise it is "Question". */)
147 { 147 {
148#if 0 /* Using the frame the mouse is on may not be right. */ 148#if 0 /* Using the frame the mouse is on may not be right. */
149 /* Use the mouse's current position. */ 149 /* Use the mouse's current position. */
150 FRAME_PTR new_f = SELECTED_FRAME (); 150 struct frame *new_f = SELECTED_FRAME ();
151 Lisp_Object bar_window; 151 Lisp_Object bar_window;
152 enum scroll_bar_part part; 152 enum scroll_bar_part part;
153 Time time; 153 Time time;
@@ -206,8 +206,8 @@ otherwise it is "Question". */)
206 in the middle of frame F. */ 206 in the middle of frame F. */
207 Lisp_Object x, y, frame, newpos; 207 Lisp_Object x, y, frame, newpos;
208 XSETFRAME (frame, f); 208 XSETFRAME (frame, f);
209 XSETINT (x, x_pixel_width (f) / 2); 209 XSETINT (x, FRAME_PIXEL_WIDTH (f) / 2);
210 XSETINT (y, x_pixel_height (f) / 2); 210 XSETINT (y, FRAME_PIXEL_HEIGHT (f) / 2);
211 newpos = Fcons (Fcons (x, Fcons (y, Qnil)), Fcons (frame, Qnil)); 211 newpos = Fcons (Fcons (x, Fcons (y, Qnil)), Fcons (frame, Qnil));
212 return Fx_popup_menu (newpos, 212 return Fx_popup_menu (newpos,
213 Fcons (Fcar (contents), Fcons (contents, Qnil))); 213 Fcons (Fcar (contents), Fcons (contents, Qnil)));
@@ -252,7 +252,7 @@ otherwise it is "Question". */)
252 This way we can safely execute Lisp code. */ 252 This way we can safely execute Lisp code. */
253 253
254void 254void
255x_activate_menubar (FRAME_PTR f) 255x_activate_menubar (struct frame *f)
256{ 256{
257 set_frame_menubar (f, 0, 1); 257 set_frame_menubar (f, 0, 1);
258 258
@@ -269,7 +269,7 @@ x_activate_menubar (FRAME_PTR f)
269 and put the appropriate events into the keyboard buffer. */ 269 and put the appropriate events into the keyboard buffer. */
270 270
271void 271void
272menubar_selection_callback (FRAME_PTR f, void * client_data) 272menubar_selection_callback (struct frame *f, void * client_data)
273{ 273{
274 Lisp_Object prefix, entry; 274 Lisp_Object prefix, entry;
275 Lisp_Object vector; 275 Lisp_Object vector;
@@ -361,7 +361,7 @@ menubar_selection_callback (FRAME_PTR f, void * client_data)
361 it is set the first time this is called, from initialize_frame_menubar. */ 361 it is set the first time this is called, from initialize_frame_menubar. */
362 362
363void 363void
364set_frame_menubar (FRAME_PTR f, bool first_time, bool deep_p) 364set_frame_menubar (struct frame *f, bool first_time, bool deep_p)
365{ 365{
366 HMENU menubar_widget = f->output_data.w32->menubar_widget; 366 HMENU menubar_widget = f->output_data.w32->menubar_widget;
367 Lisp_Object items; 367 Lisp_Object items;
@@ -613,7 +613,7 @@ set_frame_menubar (FRAME_PTR f, bool first_time, bool deep_p)
613 is visible. */ 613 is visible. */
614 614
615void 615void
616initialize_frame_menubar (FRAME_PTR f) 616initialize_frame_menubar (struct frame *f)
617{ 617{
618 /* This function is called before the first chance to redisplay 618 /* This function is called before the first chance to redisplay
619 the frame. It has to be, so the frame will have the right size. */ 619 the frame. It has to be, so the frame will have the right size. */
@@ -625,7 +625,7 @@ initialize_frame_menubar (FRAME_PTR f)
625 This is used when deleting a frame, and when turning off the menu bar. */ 625 This is used when deleting a frame, and when turning off the menu bar. */
626 626
627void 627void
628free_frame_menubar (FRAME_PTR f) 628free_frame_menubar (struct frame *f)
629{ 629{
630 block_input (); 630 block_input ();
631 631
@@ -656,7 +656,7 @@ free_frame_menubar (FRAME_PTR f)
656 (We return nil on failure, but the value doesn't actually matter.) */ 656 (We return nil on failure, but the value doesn't actually matter.) */
657 657
658Lisp_Object 658Lisp_Object
659w32_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, 659w32_menu_show (struct frame *f, int x, int y, int for_click, int keymaps,
660 Lisp_Object title, const char **error) 660 Lisp_Object title, const char **error)
661{ 661{
662 int i; 662 int i;
@@ -983,7 +983,7 @@ static char * button_names [] = {
983 "button6", "button7", "button8", "button9", "button10" }; 983 "button6", "button7", "button8", "button9", "button10" };
984 984
985static Lisp_Object 985static Lisp_Object
986w32_dialog_show (FRAME_PTR f, int keymaps, 986w32_dialog_show (struct frame *f, int keymaps,
987 Lisp_Object title, Lisp_Object header, 987 Lisp_Object title, Lisp_Object header,
988 char **error) 988 char **error)
989{ 989{
@@ -1219,7 +1219,7 @@ is_simple_dialog (Lisp_Object contents)
1219} 1219}
1220 1220
1221static Lisp_Object 1221static Lisp_Object
1222simple_dialog_show (FRAME_PTR f, Lisp_Object contents, Lisp_Object header) 1222simple_dialog_show (struct frame *f, Lisp_Object contents, Lisp_Object header)
1223{ 1223{
1224 int answer; 1224 int answer;
1225 UINT type; 1225 UINT type;
@@ -1699,7 +1699,7 @@ DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_
1699 (void) 1699 (void)
1700{ 1700{
1701#ifdef HAVE_MENUS 1701#ifdef HAVE_MENUS
1702 FRAME_PTR f; 1702 struct frame *f;
1703 f = SELECTED_FRAME (); 1703 f = SELECTED_FRAME ();
1704 return (f->output_data.w32->menubar_active > 0) ? Qt : Qnil; 1704 return (f->output_data.w32->menubar_active > 0) ? Qt : Qnil;
1705#else 1705#else
diff --git a/src/w32notify.c b/src/w32notify.c
index 95ab298f2d3..a48a83daf53 100644
--- a/src/w32notify.c
+++ b/src/w32notify.c
@@ -129,7 +129,7 @@ send_notifications (BYTE *info, DWORD info_size, void *desc,
129 volatile int *terminate) 129 volatile int *terminate)
130{ 130{
131 int done = 0; 131 int done = 0;
132 FRAME_PTR f = SELECTED_FRAME (); 132 struct frame *f = SELECTED_FRAME ();
133 133
134 /* A single buffer is used to communicate all notifications to the 134 /* A single buffer is used to communicate all notifications to the
135 main thread. Since both the main thread and several watcher 135 main thread. Since both the main thread and several watcher
diff --git a/src/w32term.c b/src/w32term.c
index b97632dabca..59cfdee86b0 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -181,7 +181,7 @@ int w32_keyboard_codepage;
181 181
182/* Where the mouse was last time we reported a mouse event. */ 182/* Where the mouse was last time we reported a mouse event. */
183static RECT last_mouse_glyph; 183static RECT last_mouse_glyph;
184static FRAME_PTR last_mouse_glyph_frame; 184static struct frame *last_mouse_glyph_frame;
185 185
186/* The scroll bar in which the last motion event occurred. 186/* The scroll bar in which the last motion event occurred.
187 187
@@ -249,7 +249,7 @@ static void my_set_focus (struct frame *, HWND);
249#endif 249#endif
250static void my_set_foreground_window (HWND); 250static void my_set_foreground_window (HWND);
251static void my_destroy_window (struct frame *, HWND); 251static void my_destroy_window (struct frame *, HWND);
252static void w32fullscreen_hook (FRAME_PTR); 252static void w32fullscreen_hook (struct frame *);
253 253
254#ifdef GLYPH_DEBUG 254#ifdef GLYPH_DEBUG
255static void x_check_font (struct frame *, struct font *); 255static void x_check_font (struct frame *, struct font *);
@@ -450,7 +450,7 @@ w32_draw_rectangle (HDC hdc, XGCValues *gc, int x, int y,
450 450
451/* Draw a filled rectangle at the specified position. */ 451/* Draw a filled rectangle at the specified position. */
452void 452void
453w32_fill_rect (FRAME_PTR f, HDC hdc, COLORREF pix, RECT *lprect) 453w32_fill_rect (struct frame *f, HDC hdc, COLORREF pix, RECT *lprect)
454{ 454{
455 HBRUSH hb; 455 HBRUSH hb;
456 456
@@ -460,7 +460,7 @@ w32_fill_rect (FRAME_PTR f, HDC hdc, COLORREF pix, RECT *lprect)
460} 460}
461 461
462void 462void
463w32_clear_window (FRAME_PTR f) 463w32_clear_window (struct frame *f)
464{ 464{
465 RECT rect; 465 RECT rect;
466 HDC hdc = get_frame_dc (f); 466 HDC hdc = get_frame_dc (f);
@@ -3370,7 +3370,7 @@ static MSG last_mouse_motion_event;
3370static Lisp_Object last_mouse_motion_frame; 3370static Lisp_Object last_mouse_motion_frame;
3371 3371
3372static int 3372static int
3373note_mouse_movement (FRAME_PTR frame, MSG *msg) 3373note_mouse_movement (struct frame *frame, MSG *msg)
3374{ 3374{
3375 int mouse_x = LOWORD (msg->lParam); 3375 int mouse_x = LOWORD (msg->lParam);
3376 int mouse_y = HIWORD (msg->lParam); 3376 int mouse_y = HIWORD (msg->lParam);
@@ -3419,7 +3419,7 @@ note_mouse_movement (FRAME_PTR frame, MSG *msg)
3419 ************************************************************************/ 3419 ************************************************************************/
3420 3420
3421static struct scroll_bar *x_window_to_scroll_bar (Window); 3421static struct scroll_bar *x_window_to_scroll_bar (Window);
3422static void x_scroll_bar_report_motion (FRAME_PTR *, Lisp_Object *, 3422static void x_scroll_bar_report_motion (struct frame **, Lisp_Object *,
3423 enum scroll_bar_part *, 3423 enum scroll_bar_part *,
3424 Lisp_Object *, Lisp_Object *, 3424 Lisp_Object *, Lisp_Object *,
3425 unsigned long *); 3425 unsigned long *);
@@ -3461,11 +3461,11 @@ w32_define_cursor (Window window, Cursor cursor)
3461 movement. */ 3461 movement. */
3462 3462
3463static void 3463static void
3464w32_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, 3464w32_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window,
3465 enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, 3465 enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y,
3466 unsigned long *time) 3466 unsigned long *time)
3467{ 3467{
3468 FRAME_PTR f1; 3468 struct frame *f1;
3469 3469
3470 block_input (); 3470 block_input ();
3471 3471
@@ -3696,7 +3696,7 @@ my_create_scrollbar (struct frame * f, struct scroll_bar * bar)
3696/*#define ATTACH_THREADS*/ 3696/*#define ATTACH_THREADS*/
3697 3697
3698static BOOL 3698static BOOL
3699my_show_window (FRAME_PTR f, HWND hwnd, int how) 3699my_show_window (struct frame *f, HWND hwnd, int how)
3700{ 3700{
3701#ifndef ATTACH_THREADS 3701#ifndef ATTACH_THREADS
3702 return SendMessage (FRAME_W32_WINDOW (f), WM_EMACS_SHOWWINDOW, 3702 return SendMessage (FRAME_W32_WINDOW (f), WM_EMACS_SHOWWINDOW,
@@ -3816,7 +3816,7 @@ x_scroll_bar_create (struct window *w, int top, int left, int width, int height)
3816static void 3816static void
3817x_scroll_bar_remove (struct scroll_bar *bar) 3817x_scroll_bar_remove (struct scroll_bar *bar)
3818{ 3818{
3819 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); 3819 struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
3820 3820
3821 block_input (); 3821 block_input ();
3822 3822
@@ -3979,7 +3979,7 @@ w32_set_vertical_scroll_bar (struct window *w,
3979 `*redeem_scroll_bar_hook' is applied to its window before the judgment. */ 3979 `*redeem_scroll_bar_hook' is applied to its window before the judgment. */
3980 3980
3981static void 3981static void
3982w32_condemn_scroll_bars (FRAME_PTR frame) 3982w32_condemn_scroll_bars (struct frame *frame)
3983{ 3983{
3984 /* Transfer all the scroll bars to FRAME_CONDEMNED_SCROLL_BARS. */ 3984 /* Transfer all the scroll bars to FRAME_CONDEMNED_SCROLL_BARS. */
3985 while (! NILP (FRAME_SCROLL_BARS (frame))) 3985 while (! NILP (FRAME_SCROLL_BARS (frame)))
@@ -4047,7 +4047,7 @@ w32_redeem_scroll_bar (struct window *window)
4047 last call to `*condemn_scroll_bars_hook'. */ 4047 last call to `*condemn_scroll_bars_hook'. */
4048 4048
4049static void 4049static void
4050w32_judge_scroll_bars (FRAME_PTR f) 4050w32_judge_scroll_bars (struct frame *f)
4051{ 4051{
4052 Lisp_Object bar, next; 4052 Lisp_Object bar, next;
4053 4053
@@ -4185,14 +4185,14 @@ w32_scroll_bar_handle_click (struct scroll_bar *bar, W32Msg *msg,
4185 on the scroll bar. */ 4185 on the scroll bar. */
4186 4186
4187static void 4187static void
4188x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window, 4188x_scroll_bar_report_motion (struct frame **fp, Lisp_Object *bar_window,
4189 enum scroll_bar_part *part, 4189 enum scroll_bar_part *part,
4190 Lisp_Object *x, Lisp_Object *y, 4190 Lisp_Object *x, Lisp_Object *y,
4191 unsigned long *time) 4191 unsigned long *time)
4192{ 4192{
4193 struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar); 4193 struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar);
4194 Window w = SCROLL_BAR_W32_WINDOW (bar); 4194 Window w = SCROLL_BAR_W32_WINDOW (bar);
4195 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); 4195 struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
4196 int pos; 4196 int pos;
4197 int top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height)); 4197 int top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height));
4198 SCROLLINFO si; 4198 SCROLLINFO si;
@@ -4244,7 +4244,7 @@ x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window,
4244 redraw them. */ 4244 redraw them. */
4245 4245
4246void 4246void
4247x_scroll_bar_clear (FRAME_PTR f) 4247x_scroll_bar_clear (struct frame *f)
4248{ 4248{
4249 Lisp_Object bar; 4249 Lisp_Object bar;
4250 4250
@@ -4974,7 +4974,7 @@ w32_read_socket (struct terminal *terminal,
4974 if (f) 4974 if (f)
4975 { 4975 {
4976 extern void menubar_selection_callback 4976 extern void menubar_selection_callback
4977 (FRAME_PTR f, void * client_data); 4977 (struct frame *f, void * client_data);
4978 menubar_selection_callback (f, (void *)msg.msg.wParam); 4978 menubar_selection_callback (f, (void *)msg.msg.wParam);
4979 } 4979 }
4980 4980
@@ -5071,7 +5071,7 @@ w32_read_socket (struct terminal *terminal,
5071 5071
5072 FOR_EACH_FRAME (tail, frame) 5072 FOR_EACH_FRAME (tail, frame)
5073 { 5073 {
5074 FRAME_PTR f = XFRAME (frame); 5074 struct frame *f = XFRAME (frame);
5075 /* The tooltip has been drawn already. Avoid the 5075 /* The tooltip has been drawn already. Avoid the
5076 SET_FRAME_GARBAGED below. */ 5076 SET_FRAME_GARBAGED below. */
5077 if (EQ (frame, tip_frame)) 5077 if (EQ (frame, tip_frame))
@@ -5692,7 +5692,7 @@ x_check_fullscreen (struct frame *f)
5692} 5692}
5693 5693
5694static void 5694static void
5695w32fullscreen_hook (FRAME_PTR f) 5695w32fullscreen_hook (struct frame *f)
5696{ 5696{
5697 if (FRAME_VISIBLE_P (f)) 5697 if (FRAME_VISIBLE_P (f))
5698 { 5698 {
@@ -5889,11 +5889,6 @@ x_focus_on_frame (struct frame *f)
5889 unblock_input (); 5889 unblock_input ();
5890} 5890}
5891 5891
5892void
5893x_unfocus_frame (struct frame *f)
5894{
5895}
5896
5897/* Raise frame F. */ 5892/* Raise frame F. */
5898void 5893void
5899x_raise_frame (struct frame *f) 5894x_raise_frame (struct frame *f)
@@ -5969,7 +5964,7 @@ x_lower_frame (struct frame *f)
5969} 5964}
5970 5965
5971static void 5966static void
5972w32_frame_raise_lower (FRAME_PTR f, int raise_flag) 5967w32_frame_raise_lower (struct frame *f, int raise_flag)
5973{ 5968{
5974 if (! FRAME_W32_P (f)) 5969 if (! FRAME_W32_P (f))
5975 return; 5970 return;
@@ -6225,22 +6220,6 @@ x_wm_set_size_hint (struct frame *f, long flags, bool user_position)
6225 leave_crit (); 6220 leave_crit ();
6226} 6221}
6227 6222
6228/* Window manager things */
6229void
6230x_wm_set_icon_position (struct frame *f, int icon_x, int icon_y)
6231{
6232#if 0
6233 Window window = FRAME_W32_WINDOW (f);
6234
6235 f->display.x->wm_hints.flags |= IconPositionHint;
6236 f->display.x->wm_hints.icon_x = icon_x;
6237 f->display.x->wm_hints.icon_y = icon_y;
6238
6239 XSetWMHints (FRAME_X_DISPLAY (f), window, &f->display.x->wm_hints);
6240#endif
6241}
6242
6243
6244/*********************************************************************** 6223/***********************************************************************
6245 Fonts 6224 Fonts
6246 ***********************************************************************/ 6225 ***********************************************************************/
diff --git a/src/w32term.h b/src/w32term.h
index ace58758302..3c9cce35221 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -205,7 +205,7 @@ extern void x_focus_on_frame (struct frame *f);
205 205
206extern struct w32_display_info *w32_term_init (Lisp_Object, 206extern struct w32_display_info *w32_term_init (Lisp_Object,
207 char *, char *); 207 char *, char *);
208extern int w32_defined_color (FRAME_PTR f, const char *color, 208extern int w32_defined_color (struct frame *f, const char *color,
209 XColor *color_def, int alloc); 209 XColor *color_def, int alloc);
210extern void x_set_window_size (struct frame *f, int change_grav, 210extern void x_set_window_size (struct frame *f, int change_grav,
211 int cols, int rows); 211 int cols, int rows);
@@ -218,8 +218,6 @@ extern void x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y);
218extern void x_make_frame_visible (struct frame *f); 218extern void x_make_frame_visible (struct frame *f);
219extern void x_make_frame_invisible (struct frame *f); 219extern void x_make_frame_invisible (struct frame *f);
220extern void x_iconify_frame (struct frame *f); 220extern void x_iconify_frame (struct frame *f);
221extern int x_pixel_width (struct frame *f);
222extern int x_pixel_height (struct frame *f);
223extern void x_set_frame_alpha (struct frame *f); 221extern void x_set_frame_alpha (struct frame *f);
224extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object); 222extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
225extern void x_set_tool_bar_lines (struct frame *f, 223extern void x_set_tool_bar_lines (struct frame *f,
diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c
index c153c8f3565..b31baa0e65c 100644
--- a/src/w32uniscribe.c
+++ b/src/w32uniscribe.c
@@ -69,28 +69,27 @@ memq_no_quit (Lisp_Object elt, Lisp_Object list)
69 69
70/* Font backend interface implementation. */ 70/* Font backend interface implementation. */
71static Lisp_Object 71static Lisp_Object
72uniscribe_list (Lisp_Object frame, Lisp_Object font_spec) 72uniscribe_list (struct frame *f, Lisp_Object font_spec)
73{ 73{
74 Lisp_Object fonts = w32font_list_internal (frame, font_spec, 1); 74 Lisp_Object fonts = w32font_list_internal (f, font_spec, 1);
75 FONT_ADD_LOG ("uniscribe-list", font_spec, fonts); 75 FONT_ADD_LOG ("uniscribe-list", font_spec, fonts);
76 return fonts; 76 return fonts;
77} 77}
78 78
79static Lisp_Object 79static Lisp_Object
80uniscribe_match (Lisp_Object frame, Lisp_Object font_spec) 80uniscribe_match (struct frame *f, Lisp_Object font_spec)
81{ 81{
82 Lisp_Object entity = w32font_match_internal (frame, font_spec, 1); 82 Lisp_Object entity = w32font_match_internal (f, font_spec, 1);
83 FONT_ADD_LOG ("uniscribe-match", font_spec, entity); 83 FONT_ADD_LOG ("uniscribe-match", font_spec, entity);
84 return entity; 84 return entity;
85} 85}
86 86
87static Lisp_Object 87static Lisp_Object
88uniscribe_list_family (Lisp_Object frame) 88uniscribe_list_family (struct frame *f)
89{ 89{
90 Lisp_Object list = Qnil; 90 Lisp_Object list = Qnil;
91 LOGFONT font_match_pattern; 91 LOGFONT font_match_pattern;
92 HDC dc; 92 HDC dc;
93 FRAME_PTR f = XFRAME (frame);
94 93
95 memset (&font_match_pattern, 0, sizeof (font_match_pattern)); 94 memset (&font_match_pattern, 0, sizeof (font_match_pattern));
96 /* Limit enumerated fonts to outline fonts to save time. */ 95 /* Limit enumerated fonts to outline fonts to save time. */
@@ -107,7 +106,7 @@ uniscribe_list_family (Lisp_Object frame)
107} 106}
108 107
109static Lisp_Object 108static Lisp_Object
110uniscribe_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size) 109uniscribe_open (struct frame *f, Lisp_Object font_entity, int pixel_size)
111{ 110{
112 Lisp_Object font_object 111 Lisp_Object font_object
113 = font_make_object (VECSIZE (struct uniscribe_font_info), 112 = font_make_object (VECSIZE (struct uniscribe_font_info),
@@ -136,7 +135,7 @@ uniscribe_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size)
136} 135}
137 136
138static void 137static void
139uniscribe_close (FRAME_PTR f, struct font *font) 138uniscribe_close (struct frame *f, struct font *font)
140{ 139{
141 struct uniscribe_font_info *uniscribe_font 140 struct uniscribe_font_info *uniscribe_font
142 = (struct uniscribe_font_info *) font; 141 = (struct uniscribe_font_info *) font;
@@ -600,8 +599,8 @@ uniscribe_encode_char (struct font *font, int c)
600 int x, int y, int with_background); 599 int x, int y, int with_background);
601 600
602 Unused: 601 Unused:
603 int uniscribe_prepare_face (FRAME_PTR f, struct face *face); 602 int uniscribe_prepare_face (struct frame *f, struct face *face);
604 void uniscribe_done_face (FRAME_PTR f, struct face *face); 603 void uniscribe_done_face (struct frame *f, struct face *face);
605 int uniscribe_get_bitmap (struct font *font, unsigned code, 604 int uniscribe_get_bitmap (struct font *font, unsigned code,
606 struct font_bitmap *bitmap, int bits_per_pixel); 605 struct font_bitmap *bitmap, int bits_per_pixel);
607 void uniscribe_free_bitmap (struct font *font, struct font_bitmap *bitmap); 606 void uniscribe_free_bitmap (struct font *font, struct font_bitmap *bitmap);
@@ -609,8 +608,8 @@ uniscribe_encode_char (struct font *font, int c)
609 void uniscribe_free_outline (struct font *font, void *outline); 608 void uniscribe_free_outline (struct font *font, void *outline);
610 int uniscribe_anchor_point (struct font *font, unsigned code, 609 int uniscribe_anchor_point (struct font *font, unsigned code,
611 int index, int *x, int *y); 610 int index, int *x, int *y);
612 int uniscribe_start_for_frame (FRAME_PTR f); 611 int uniscribe_start_for_frame (struct frame *f);
613 int uniscribe_end_for_frame (FRAME_PTR f); 612 int uniscribe_end_for_frame (struct frame *f);
614 613
615*/ 614*/
616 615
diff --git a/src/w32xfns.c b/src/w32xfns.c
index 03611e19768..19c6b72bf89 100644
--- a/src/w32xfns.c
+++ b/src/w32xfns.c
@@ -90,7 +90,7 @@ signal_quit (void)
90} 90}
91 91
92void 92void
93select_palette (FRAME_PTR f, HDC hdc) 93select_palette (struct frame *f, HDC hdc)
94{ 94{
95 struct w32_display_info *display_info = FRAME_W32_DISPLAY_INFO (f); 95 struct w32_display_info *display_info = FRAME_W32_DISPLAY_INFO (f);
96 96
@@ -117,7 +117,7 @@ select_palette (FRAME_PTR f, HDC hdc)
117} 117}
118 118
119void 119void
120deselect_palette (FRAME_PTR f, HDC hdc) 120deselect_palette (struct frame *f, HDC hdc)
121{ 121{
122 if (f->output_data.w32->old_palette) 122 if (f->output_data.w32->old_palette)
123 SelectPalette (hdc, f->output_data.w32->old_palette, FALSE); 123 SelectPalette (hdc, f->output_data.w32->old_palette, FALSE);
@@ -126,7 +126,7 @@ deselect_palette (FRAME_PTR f, HDC hdc)
126/* Get a DC for frame and select palette for drawing; force an update of 126/* Get a DC for frame and select palette for drawing; force an update of
127 all frames if palette's mapping changes. */ 127 all frames if palette's mapping changes. */
128HDC 128HDC
129get_frame_dc (FRAME_PTR f) 129get_frame_dc (struct frame *f)
130{ 130{
131 HDC hdc; 131 HDC hdc;
132 132
@@ -146,7 +146,7 @@ get_frame_dc (FRAME_PTR f)
146} 146}
147 147
148int 148int
149release_frame_dc (FRAME_PTR f, HDC hdc) 149release_frame_dc (struct frame *f, HDC hdc)
150{ 150{
151 int ret; 151 int ret;
152 152
diff --git a/src/widget.c b/src/widget.c
index e2c8e9fa23f..ec0b506046b 100644
--- a/src/widget.c
+++ b/src/widget.c
@@ -503,26 +503,6 @@ widget_update_wm_size_hints (Widget widget)
503 update_wm_hints (ew); 503 update_wm_hints (ew);
504} 504}
505 505
506
507#if 0
508
509static void
510create_frame_gcs (EmacsFrame ew)
511{
512 struct frame *s = ew->emacs_frame.frame;
513
514 s->output_data.x->normal_gc
515 = XCreateGC (XtDisplay (ew), RootWindowOfScreen (XtScreen (ew)), 0, 0);
516 s->output_data.x->reverse_gc
517 = XCreateGC (XtDisplay (ew), RootWindowOfScreen (XtScreen (ew)), 0, 0);
518 s->output_data.x->cursor_gc
519 = XCreateGC (XtDisplay (ew), RootWindowOfScreen (XtScreen (ew)), 0, 0);
520 s->output_data.x->black_relief.gc = 0;
521 s->output_data.x->white_relief.gc = 0;
522}
523
524#endif /* 0 */
525
526static char setup_frame_cursor_bits[] = 506static char setup_frame_cursor_bits[] =
527{ 507{
528 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 508 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -683,19 +663,7 @@ EmacsFrameRealize (Widget widget, XtValueMask *mask, XSetWindowAttributes *attrs
683static void 663static void
684EmacsFrameDestroy (Widget widget) 664EmacsFrameDestroy (Widget widget)
685{ 665{
686 EmacsFrame ew = (EmacsFrame) widget; 666 /* All GCs are now freed in x_free_frame_resources. */
687 struct frame* s = ew->emacs_frame.frame;
688
689 if (! s) emacs_abort ();
690 if (! s->output_data.x) emacs_abort ();
691
692 block_input ();
693 x_free_gcs (s);
694 if (s->output_data.x->white_relief.gc)
695 XFreeGC (XtDisplay (widget), s->output_data.x->white_relief.gc);
696 if (s->output_data.x->black_relief.gc)
697 XFreeGC (XtDisplay (widget), s->output_data.x->black_relief.gc);
698 unblock_input ();
699} 667}
700 668
701static void 669static void
@@ -838,7 +806,7 @@ void
838widget_store_internal_border (Widget widget) 806widget_store_internal_border (Widget widget)
839{ 807{
840 EmacsFrame ew = (EmacsFrame) widget; 808 EmacsFrame ew = (EmacsFrame) widget;
841 FRAME_PTR f = ew->emacs_frame.frame; 809 struct frame *f = ew->emacs_frame.frame;
842 810
843 ew->emacs_frame.internal_border_width = f->internal_border_width; 811 ew->emacs_frame.internal_border_width = f->internal_border_width;
844} 812}
diff --git a/src/window.c b/src/window.c
index 6fd6849c6c3..1b288368884 100644
--- a/src/window.c
+++ b/src/window.c
@@ -3019,7 +3019,7 @@ replace_buffer_in_windows_safely (Lisp_Object buffer)
3019 minimum allowable size. */ 3019 minimum allowable size. */
3020 3020
3021void 3021void
3022check_frame_size (FRAME_PTR frame, int *rows, int *cols) 3022check_frame_size (struct frame *frame, int *rows, int *cols)
3023{ 3023{
3024 /* For height, we have to see: 3024 /* For height, we have to see:
3025 how many windows the frame has at minimum (one or two), 3025 how many windows the frame has at minimum (one or two),
@@ -5516,7 +5516,7 @@ the return value is nil. Otherwise the value is t. */)
5516 struct Lisp_Vector *saved_windows; 5516 struct Lisp_Vector *saved_windows;
5517 Lisp_Object new_current_buffer; 5517 Lisp_Object new_current_buffer;
5518 Lisp_Object frame; 5518 Lisp_Object frame;
5519 FRAME_PTR f; 5519 struct frame *f;
5520 ptrdiff_t old_point = -1; 5520 ptrdiff_t old_point = -1;
5521 5521
5522 CHECK_WINDOW_CONFIGURATION (configuration); 5522 CHECK_WINDOW_CONFIGURATION (configuration);
diff --git a/src/xdisp.c b/src/xdisp.c
index 1da7de5759c..7a1f03ce244 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1854,7 +1854,7 @@ estimate_mode_line_height (struct frame *f, enum face_id face_id)
1854 not force the value into range. */ 1854 not force the value into range. */
1855 1855
1856void 1856void
1857pixel_to_glyph_coords (FRAME_PTR f, register int pix_x, register int pix_y, 1857pixel_to_glyph_coords (struct frame *f, register int pix_x, register int pix_y,
1858 int *x, int *y, NativeRectangle *bounds, int noclip) 1858 int *x, int *y, NativeRectangle *bounds, int noclip)
1859{ 1859{
1860 1860
@@ -5346,7 +5346,7 @@ handle_composition_prop (struct it *it)
5346 composition (in the case that the composition is from the current 5346 composition (in the case that the composition is from the current
5347 buffer), draw a glyph composed from the composition components. */ 5347 buffer), draw a glyph composed from the composition components. */
5348 if (find_composition (pos, -1, &start, &end, &prop, string) 5348 if (find_composition (pos, -1, &start, &end, &prop, string)
5349 && COMPOSITION_VALID_P (start, end, prop) 5349 && composition_valid_p (start, end, prop)
5350 && (STRINGP (it->string) || (PT <= start || PT >= end))) 5350 && (STRINGP (it->string) || (PT <= start || PT >= end)))
5351 { 5351 {
5352 if (start < pos) 5352 if (start < pos)
@@ -11449,7 +11449,7 @@ x_cursor_to (int vpos, int hpos, int y, int x)
11449 11449
11450/* Where the mouse was last time we reported a mouse event. */ 11450/* Where the mouse was last time we reported a mouse event. */
11451 11451
11452FRAME_PTR last_mouse_frame; 11452struct frame *last_mouse_frame;
11453 11453
11454/* Tool-bar item index of the item on which a mouse button was pressed 11454/* Tool-bar item index of the item on which a mouse button was pressed
11455 or -1. */ 11455 or -1. */
@@ -12852,7 +12852,7 @@ check_point_in_composition (struct buffer *prev_buf, ptrdiff_t prev_pt,
12852 12852
12853 if (prev_pt > BUF_BEGV (buf) && prev_pt < BUF_ZV (buf) 12853 if (prev_pt > BUF_BEGV (buf) && prev_pt < BUF_ZV (buf)
12854 && find_composition (prev_pt, -1, &start, &end, &prop, buffer) 12854 && find_composition (prev_pt, -1, &start, &end, &prop, buffer)
12855 && COMPOSITION_VALID_P (start, end, prop) 12855 && composition_valid_p (start, end, prop)
12856 && start < prev_pt && end > prev_pt) 12856 && start < prev_pt && end > prev_pt)
12857 /* The last point was within the composition. Return 1 iff 12857 /* The last point was within the composition. Return 1 iff
12858 point moved out of the composition. */ 12858 point moved out of the composition. */
@@ -12862,7 +12862,7 @@ check_point_in_composition (struct buffer *prev_buf, ptrdiff_t prev_pt,
12862 /* Check a composition at the current point. */ 12862 /* Check a composition at the current point. */
12863 return (pt > BUF_BEGV (buf) && pt < BUF_ZV (buf) 12863 return (pt > BUF_BEGV (buf) && pt < BUF_ZV (buf)
12864 && find_composition (pt, -1, &start, &end, &prop, buffer) 12864 && find_composition (pt, -1, &start, &end, &prop, buffer)
12865 && COMPOSITION_VALID_P (start, end, prop) 12865 && composition_valid_p (start, end, prop)
12866 && start < pt && end > pt); 12866 && start < pt && end > pt);
12867} 12867}
12868 12868
diff --git a/src/xfaces.c b/src/xfaces.c
index 52cd65c029f..acd2d2b1116 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -869,7 +869,7 @@ the pixmap. Bits are stored row by row, each row occupies
869 if these pointers are not null. */ 869 if these pointers are not null. */
870 870
871static ptrdiff_t 871static ptrdiff_t
872load_pixmap (FRAME_PTR f, Lisp_Object name, unsigned int *w_ptr, 872load_pixmap (struct frame *f, Lisp_Object name, unsigned int *w_ptr,
873 unsigned int *h_ptr) 873 unsigned int *h_ptr)
874{ 874{
875 ptrdiff_t bitmap_id; 875 ptrdiff_t bitmap_id;
@@ -1530,15 +1530,12 @@ the face font sort order. */)
1530 (Lisp_Object family, Lisp_Object frame) 1530 (Lisp_Object family, Lisp_Object frame)
1531{ 1531{
1532 Lisp_Object font_spec, list, *drivers, vec; 1532 Lisp_Object font_spec, list, *drivers, vec;
1533 struct frame *f = decode_live_frame (frame);
1533 ptrdiff_t i, nfonts; 1534 ptrdiff_t i, nfonts;
1534 EMACS_INT ndrivers; 1535 EMACS_INT ndrivers;
1535 Lisp_Object result; 1536 Lisp_Object result;
1536 USE_SAFE_ALLOCA; 1537 USE_SAFE_ALLOCA;
1537 1538
1538 if (NILP (frame))
1539 frame = selected_frame;
1540 CHECK_LIVE_FRAME (frame);
1541
1542 font_spec = Ffont_spec (0, NULL); 1539 font_spec = Ffont_spec (0, NULL);
1543 if (!NILP (family)) 1540 if (!NILP (family))
1544 { 1541 {
@@ -1546,7 +1543,7 @@ the face font sort order. */)
1546 font_parse_family_registry (family, Qnil, font_spec); 1543 font_parse_family_registry (family, Qnil, font_spec);
1547 } 1544 }
1548 1545
1549 list = font_list_entities (frame, font_spec); 1546 list = font_list_entities (f, font_spec);
1550 if (NILP (list)) 1547 if (NILP (list))
1551 return Qnil; 1548 return Qnil;
1552 1549
@@ -1589,7 +1586,7 @@ the face font sort order. */)
1589 ASET (v, 0, AREF (font, FONT_FAMILY_INDEX)); 1586 ASET (v, 0, AREF (font, FONT_FAMILY_INDEX));
1590 ASET (v, 1, FONT_WIDTH_SYMBOLIC (font)); 1587 ASET (v, 1, FONT_WIDTH_SYMBOLIC (font));
1591 point = PIXEL_TO_POINT (XINT (AREF (font, FONT_SIZE_INDEX)) * 10, 1588 point = PIXEL_TO_POINT (XINT (AREF (font, FONT_SIZE_INDEX)) * 10,
1592 FRAME_RES_Y (XFRAME (frame))); 1589 FRAME_RES_Y (f));
1593 ASET (v, 2, make_number (point)); 1590 ASET (v, 2, make_number (point));
1594 ASET (v, 3, FONT_WEIGHT_SYMBOLIC (font)); 1591 ASET (v, 3, FONT_WEIGHT_SYMBOLIC (font));
1595 ASET (v, 4, FONT_SLANT_SYMBOLIC (font)); 1592 ASET (v, 4, FONT_SLANT_SYMBOLIC (font));
@@ -3078,7 +3075,7 @@ FRAME 0 means change the face on all frames, and change the default
3078 { 3075 {
3079 if (!UNSPECIFIEDP (value) && !IGNORE_DEFFACE_P (value)) 3076 if (!UNSPECIFIEDP (value) && !IGNORE_DEFFACE_P (value))
3080 { 3077 {
3081 FRAME_PTR f; 3078 struct frame *f;
3082 3079
3083 old_value = LFACE_FONT (lface); 3080 old_value = LFACE_FONT (lface);
3084 if (! FONTP (value)) 3081 if (! FONTP (value))
diff --git a/src/xfns.c b/src/xfns.c
index a4492a10fdb..a1e9e916aba 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -176,7 +176,7 @@ check_x_display_info (Lisp_Object object)
176 dpyinfo = x_display_info_for_name (object); 176 dpyinfo = x_display_info_for_name (object);
177 else 177 else
178 { 178 {
179 FRAME_PTR f = decode_window_system_frame (object); 179 struct frame *f = decode_window_system_frame (object);
180 dpyinfo = FRAME_X_DISPLAY_INFO (f); 180 dpyinfo = FRAME_X_DISPLAY_INFO (f);
181 } 181 }
182 182
@@ -369,7 +369,7 @@ x_top_window_to_frame (struct x_display_info *dpyinfo, int wdesc)
369 not Emacs's own window. */ 369 not Emacs's own window. */
370 370
371void 371void
372x_real_positions (FRAME_PTR f, int *xptr, int *yptr) 372x_real_positions (struct frame *f, int *xptr, int *yptr)
373{ 373{
374 int win_x, win_y, outer_x IF_LINT (= 0), outer_y IF_LINT (= 0); 374 int win_x, win_y, outer_x IF_LINT (= 0), outer_y IF_LINT (= 0);
375 int real_x = 0, real_y = 0; 375 int real_x = 0, real_y = 0;
@@ -565,7 +565,7 @@ x_defined_color (struct frame *f, const char *color_name,
565 Signal an error if color can't be allocated. */ 565 Signal an error if color can't be allocated. */
566 566
567static int 567static int
568x_decode_color (FRAME_PTR f, Lisp_Object color_name, int mono_color) 568x_decode_color (struct frame *f, Lisp_Object color_name, int mono_color)
569{ 569{
570 XColor cdef; 570 XColor cdef;
571 571
@@ -626,7 +626,7 @@ x_set_tool_bar_position (struct frame *f,
626 may be any format that GdkPixbuf knows about, i.e. not just bitmaps. */ 626 may be any format that GdkPixbuf knows about, i.e. not just bitmaps. */
627 627
628int 628int
629xg_set_icon (FRAME_PTR f, Lisp_Object file) 629xg_set_icon (struct frame *f, Lisp_Object file)
630{ 630{
631 int result = 0; 631 int result = 0;
632 Lisp_Object found; 632 Lisp_Object found;
@@ -660,7 +660,7 @@ xg_set_icon (FRAME_PTR f, Lisp_Object file)
660} 660}
661 661
662int 662int
663xg_set_icon_from_xpm_data (FRAME_PTR f, const char **data) 663xg_set_icon_from_xpm_data (struct frame *f, const char **data)
664{ 664{
665 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data (data); 665 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data (data);
666 666
@@ -1050,7 +1050,7 @@ x_set_border_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1050 1050
1051 1051
1052static void 1052static void
1053x_set_cursor_type (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval) 1053x_set_cursor_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1054{ 1054{
1055 set_frame_cursor_types (f, arg); 1055 set_frame_cursor_types (f, arg);
1056 1056
@@ -1449,7 +1449,7 @@ x_encode_text (Lisp_Object string, Lisp_Object coding_system, int selectionp,
1449 icon name to NAME. */ 1449 icon name to NAME. */
1450 1450
1451static void 1451static void
1452x_set_name_internal (FRAME_PTR f, Lisp_Object name) 1452x_set_name_internal (struct frame *f, Lisp_Object name)
1453{ 1453{
1454 if (FRAME_X_WINDOW (f)) 1454 if (FRAME_X_WINDOW (f))
1455 { 1455 {
@@ -1608,7 +1608,7 @@ x_set_name (struct frame *f, Lisp_Object name, int explicit)
1608 specified a name for the frame; the name will override any set by the 1608 specified a name for the frame; the name will override any set by the
1609 redisplay code. */ 1609 redisplay code. */
1610static void 1610static void
1611x_explicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval) 1611x_explicitly_set_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1612{ 1612{
1613 x_set_name (f, arg, 1); 1613 x_set_name (f, arg, 1);
1614} 1614}
@@ -1617,7 +1617,7 @@ x_explicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval)
1617 name; names set this way will never override names set by the user's 1617 name; names set this way will never override names set by the user's
1618 lisp code. */ 1618 lisp code. */
1619void 1619void
1620x_implicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval) 1620x_implicitly_set_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1621{ 1621{
1622 x_set_name (f, arg, 0); 1622 x_set_name (f, arg, 0);
1623} 1623}
@@ -1730,7 +1730,7 @@ x_default_scroll_bar_color_parameter (struct frame *f,
1730 for example, but Xt doesn't). */ 1730 for example, but Xt doesn't). */
1731 1731
1732static void 1732static void
1733hack_wm_protocols (FRAME_PTR f, Widget widget) 1733hack_wm_protocols (struct frame *f, Widget widget)
1734{ 1734{
1735 Display *dpy = XtDisplay (widget); 1735 Display *dpy = XtDisplay (widget);
1736 Window w = XtWindow (widget); 1736 Window w = XtWindow (widget);
@@ -2088,9 +2088,6 @@ xic_free_xfontset (struct frame *f)
2088 /* The fontset is not used anymore. It is safe to free it. */ 2088 /* The fontset is not used anymore. It is safe to free it. */
2089 XFreeFontSet (FRAME_X_DISPLAY (f), FRAME_XIC_FONTSET (f)); 2089 XFreeFontSet (FRAME_X_DISPLAY (f), FRAME_XIC_FONTSET (f));
2090 2090
2091 if (FRAME_XIC_BASE_FONTNAME (f))
2092 xfree (FRAME_XIC_BASE_FONTNAME (f));
2093 FRAME_XIC_BASE_FONTNAME (f) = NULL;
2094 FRAME_XIC_FONTSET (f) = NULL; 2091 FRAME_XIC_FONTSET (f) = NULL;
2095} 2092}
2096 2093
@@ -2541,7 +2538,7 @@ x_window (struct frame *f, long window_prompting, int minibuffer_only)
2541#else /* not USE_X_TOOLKIT */ 2538#else /* not USE_X_TOOLKIT */
2542#ifdef USE_GTK 2539#ifdef USE_GTK
2543static void 2540static void
2544x_window (FRAME_PTR f) 2541x_window (struct frame *f)
2545{ 2542{
2546 if (! xg_create_frame_widgets (f)) 2543 if (! xg_create_frame_widgets (f))
2547 error ("Unable to create window"); 2544 error ("Unable to create window");
@@ -2791,10 +2788,6 @@ x_make_gc (struct frame *f)
2791 | GCFillStyle | GCLineWidth), 2788 | GCFillStyle | GCLineWidth),
2792 &gc_values); 2789 &gc_values);
2793 2790
2794 /* Reliefs. */
2795 f->output_data.x->white_relief.gc = 0;
2796 f->output_data.x->black_relief.gc = 0;
2797
2798 /* Create the gray border tile used when the pointer is not in 2791 /* Create the gray border tile used when the pointer is not in
2799 the frame. Since this depends on the frame's pixel values, 2792 the frame. Since this depends on the frame's pixel values,
2800 this must be done on a per-frame basis. */ 2793 this must be done on a per-frame basis. */
@@ -3492,7 +3485,7 @@ DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0,
3492 (Lisp_Object color, Lisp_Object frame) 3485 (Lisp_Object color, Lisp_Object frame)
3493{ 3486{
3494 XColor foo; 3487 XColor foo;
3495 FRAME_PTR f = decode_window_system_frame (frame); 3488 struct frame *f = decode_window_system_frame (frame);
3496 3489
3497 CHECK_STRING (color); 3490 CHECK_STRING (color);
3498 3491
@@ -3507,7 +3500,7 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0,
3507 (Lisp_Object color, Lisp_Object frame) 3500 (Lisp_Object color, Lisp_Object frame)
3508{ 3501{
3509 XColor foo; 3502 XColor foo;
3510 FRAME_PTR f = decode_window_system_frame (frame); 3503 struct frame *f = decode_window_system_frame (frame);
3511 3504
3512 CHECK_STRING (color); 3505 CHECK_STRING (color);
3513 3506
@@ -4325,19 +4318,6 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
4325 return attributes_list; 4318 return attributes_list;
4326} 4319}
4327 4320
4328
4329int
4330x_pixel_width (register struct frame *f)
4331{
4332 return FRAME_PIXEL_WIDTH (f);
4333}
4334
4335int
4336x_pixel_height (register struct frame *f)
4337{
4338 return FRAME_PIXEL_HEIGHT (f);
4339}
4340
4341/************************************************************************ 4321/************************************************************************
4342 X Displays 4322 X Displays
4343 ************************************************************************/ 4323 ************************************************************************/
@@ -4606,7 +4586,7 @@ If TERMINAL is omitted or nil, that stands for the selected frame's display. */
4606/* Wait for responses to all X commands issued so far for frame F. */ 4586/* Wait for responses to all X commands issued so far for frame F. */
4607 4587
4608void 4588void
4609x_sync (FRAME_PTR f) 4589x_sync (struct frame *f)
4610{ 4590{
4611 block_input (); 4591 block_input ();
4612 XSync (FRAME_X_DISPLAY (f), False); 4592 XSync (FRAME_X_DISPLAY (f), False);
@@ -5790,7 +5770,8 @@ or directory must exist.
5790This function is only defined on NS, MS Windows, and X Windows with the 5770This function is only defined on NS, MS Windows, and X Windows with the
5791Motif or Gtk toolkits. With the Motif toolkit, ONLY-DIR-P is ignored. 5771Motif or Gtk toolkits. With the Motif toolkit, ONLY-DIR-P is ignored.
5792Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) 5772Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */)
5793 (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object only_dir_p) 5773 (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename,
5774 Lisp_Object mustmatch, Lisp_Object only_dir_p)
5794{ 5775{
5795 int result; 5776 int result;
5796 struct frame *f = SELECTED_FRAME (); 5777 struct frame *f = SELECTED_FRAME ();
@@ -5963,7 +5944,7 @@ Motif or Gtk toolkits. With the Motif toolkit, ONLY-DIR-P is ignored.
5963Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) 5944Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */)
5964 (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object only_dir_p) 5945 (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object only_dir_p)
5965{ 5946{
5966 FRAME_PTR f = SELECTED_FRAME (); 5947 struct frame *f = SELECTED_FRAME ();
5967 char *fn; 5948 char *fn;
5968 Lisp_Object file = Qnil; 5949 Lisp_Object file = Qnil;
5969 Lisp_Object decoded_file; 5950 Lisp_Object decoded_file;
@@ -6026,7 +6007,7 @@ FRAME is the frame on which to pop up the font chooser. If omitted or
6026nil, it defaults to the selected frame. */) 6007nil, it defaults to the selected frame. */)
6027 (Lisp_Object frame, Lisp_Object ignored) 6008 (Lisp_Object frame, Lisp_Object ignored)
6028{ 6009{
6029 FRAME_PTR f = decode_window_system_frame (frame); 6010 struct frame *f = decode_window_system_frame (frame);
6030 Lisp_Object font; 6011 Lisp_Object font;
6031 Lisp_Object font_param; 6012 Lisp_Object font_param;
6032 char *default_name = NULL; 6013 char *default_name = NULL;
diff --git a/src/xfont.c b/src/xfont.c
index 9647a51ac6e..f673adbbd5e 100644
--- a/src/xfont.c
+++ b/src/xfont.c
@@ -114,19 +114,19 @@ xfont_get_pcm (XFontStruct *xfont, XChar2b *char2b)
114 ? NULL : pcm); 114 ? NULL : pcm);
115} 115}
116 116
117static Lisp_Object xfont_get_cache (FRAME_PTR); 117static Lisp_Object xfont_get_cache (struct frame *);
118static Lisp_Object xfont_list (Lisp_Object, Lisp_Object); 118static Lisp_Object xfont_list (struct frame *, Lisp_Object);
119static Lisp_Object xfont_match (Lisp_Object, Lisp_Object); 119static Lisp_Object xfont_match (struct frame *, Lisp_Object);
120static Lisp_Object xfont_list_family (Lisp_Object); 120static Lisp_Object xfont_list_family (struct frame *);
121static Lisp_Object xfont_open (FRAME_PTR, Lisp_Object, int); 121static Lisp_Object xfont_open (struct frame *, Lisp_Object, int);
122static void xfont_close (FRAME_PTR, struct font *); 122static void xfont_close (struct frame *, struct font *);
123static int xfont_prepare_face (FRAME_PTR, struct face *); 123static int xfont_prepare_face (struct frame *, struct face *);
124static int xfont_has_char (Lisp_Object, int); 124static int xfont_has_char (Lisp_Object, int);
125static unsigned xfont_encode_char (struct font *, int); 125static unsigned xfont_encode_char (struct font *, int);
126static int xfont_text_extents (struct font *, unsigned *, int, 126static int xfont_text_extents (struct font *, unsigned *, int,
127 struct font_metrics *); 127 struct font_metrics *);
128static int xfont_draw (struct glyph_string *, int, int, int, int, bool); 128static int xfont_draw (struct glyph_string *, int, int, int, int, bool);
129static int xfont_check (FRAME_PTR, struct font *); 129static int xfont_check (struct frame *, struct font *);
130 130
131struct font_driver xfont_driver = 131struct font_driver xfont_driver =
132 { 132 {
@@ -152,7 +152,7 @@ struct font_driver xfont_driver =
152 }; 152 };
153 153
154static Lisp_Object 154static Lisp_Object
155xfont_get_cache (FRAME_PTR f) 155xfont_get_cache (struct frame *f)
156{ 156{
157 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 157 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
158 158
@@ -486,9 +486,8 @@ xfont_list_pattern (Display *display, const char *pattern,
486} 486}
487 487
488static Lisp_Object 488static Lisp_Object
489xfont_list (Lisp_Object frame, Lisp_Object spec) 489xfont_list (struct frame *f, Lisp_Object spec)
490{ 490{
491 FRAME_PTR f = XFRAME (frame);
492 Display *display = FRAME_X_DISPLAY_INFO (f)->display; 491 Display *display = FRAME_X_DISPLAY_INFO (f)->display;
493 Lisp_Object registry, list, val, extra, script; 492 Lisp_Object registry, list, val, extra, script;
494 int len; 493 int len;
@@ -565,9 +564,8 @@ xfont_list (Lisp_Object frame, Lisp_Object spec)
565} 564}
566 565
567static Lisp_Object 566static Lisp_Object
568xfont_match (Lisp_Object frame, Lisp_Object spec) 567xfont_match (struct frame *f, Lisp_Object spec)
569{ 568{
570 FRAME_PTR f = XFRAME (frame);
571 Display *display = FRAME_X_DISPLAY_INFO (f)->display; 569 Display *display = FRAME_X_DISPLAY_INFO (f)->display;
572 Lisp_Object extra, val, entity; 570 Lisp_Object extra, val, entity;
573 char name[512]; 571 char name[512];
@@ -622,9 +620,8 @@ xfont_match (Lisp_Object frame, Lisp_Object spec)
622} 620}
623 621
624static Lisp_Object 622static Lisp_Object
625xfont_list_family (Lisp_Object frame) 623xfont_list_family (struct frame *f)
626{ 624{
627 FRAME_PTR f = XFRAME (frame);
628 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 625 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
629 char **names; 626 char **names;
630 int num_fonts, i; 627 int num_fonts, i;
@@ -679,7 +676,7 @@ xfont_list_family (Lisp_Object frame)
679} 676}
680 677
681static Lisp_Object 678static Lisp_Object
682xfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) 679xfont_open (struct frame *f, Lisp_Object entity, int pixel_size)
683{ 680{
684 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 681 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
685 Display *display = dpyinfo->display; 682 Display *display = dpyinfo->display;
@@ -895,7 +892,7 @@ xfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
895} 892}
896 893
897static void 894static void
898xfont_close (FRAME_PTR f, struct font *font) 895xfont_close (struct frame *f, struct font *font)
899{ 896{
900 block_input (); 897 block_input ();
901 XFreeFont (FRAME_X_DISPLAY (f), ((struct xfont_info *) font)->xfont); 898 XFreeFont (FRAME_X_DISPLAY (f), ((struct xfont_info *) font)->xfont);
@@ -903,7 +900,7 @@ xfont_close (FRAME_PTR f, struct font *font)
903} 900}
904 901
905static int 902static int
906xfont_prepare_face (FRAME_PTR f, struct face *face) 903xfont_prepare_face (struct frame *f, struct face *face)
907{ 904{
908 block_input (); 905 block_input ();
909 XSetFont (FRAME_X_DISPLAY (f), face->gc, 906 XSetFont (FRAME_X_DISPLAY (f), face->gc,
@@ -1092,7 +1089,7 @@ xfont_draw (struct glyph_string *s, int from, int to, int x, int y,
1092} 1089}
1093 1090
1094static int 1091static int
1095xfont_check (FRAME_PTR f, struct font *font) 1092xfont_check (struct frame *f, struct font *font)
1096{ 1093{
1097 struct xfont_info *xfont = (struct xfont_info *) font; 1094 struct xfont_info *xfont = (struct xfont_info *) font;
1098 1095
diff --git a/src/xftfont.c b/src/xftfont.c
index 166a70acd85..f2b4c2abe2b 100644
--- a/src/xftfont.c
+++ b/src/xftfont.c
@@ -70,7 +70,7 @@ struct xftface_info
70 XftColor xft_bg; /* color for face->background */ 70 XftColor xft_bg; /* color for face->background */
71}; 71};
72 72
73static void xftfont_get_colors (FRAME_PTR, struct face *, GC gc, 73static void xftfont_get_colors (struct frame *, struct face *, GC gc,
74 struct xftface_info *, 74 struct xftface_info *,
75 XftColor *fg, XftColor *bg); 75 XftColor *fg, XftColor *bg);
76 76
@@ -80,7 +80,9 @@ static void xftfont_get_colors (FRAME_PTR, struct face *, GC gc,
80 may be NULL. */ 80 may be NULL. */
81 81
82static void 82static void
83xftfont_get_colors (FRAME_PTR f, struct face *face, GC gc, struct xftface_info *xftface_info, XftColor *fg, XftColor *bg) 83xftfont_get_colors (struct frame *f, struct face *face, GC gc,
84 struct xftface_info *xftface_info,
85 XftColor *fg, XftColor *bg)
84{ 86{
85 if (xftface_info && face->gc == gc) 87 if (xftface_info && face->gc == gc)
86 { 88 {
@@ -139,9 +141,9 @@ xftfont_get_colors (FRAME_PTR f, struct face *face, GC gc, struct xftface_info *
139struct font_driver xftfont_driver; 141struct font_driver xftfont_driver;
140 142
141static Lisp_Object 143static Lisp_Object
142xftfont_list (Lisp_Object frame, Lisp_Object spec) 144xftfont_list (struct frame *f, Lisp_Object spec)
143{ 145{
144 Lisp_Object list = ftfont_driver.list (frame, spec), tail; 146 Lisp_Object list = ftfont_driver.list (f, spec), tail;
145 147
146 for (tail = list; CONSP (tail); tail = XCDR (tail)) 148 for (tail = list; CONSP (tail); tail = XCDR (tail))
147 ASET (XCAR (tail), FONT_TYPE_INDEX, Qxft); 149 ASET (XCAR (tail), FONT_TYPE_INDEX, Qxft);
@@ -149,9 +151,9 @@ xftfont_list (Lisp_Object frame, Lisp_Object spec)
149} 151}
150 152
151static Lisp_Object 153static Lisp_Object
152xftfont_match (Lisp_Object frame, Lisp_Object spec) 154xftfont_match (struct frame *f, Lisp_Object spec)
153{ 155{
154 Lisp_Object entity = ftfont_driver.match (frame, spec); 156 Lisp_Object entity = ftfont_driver.match (f, spec);
155 157
156 if (! NILP (entity)) 158 if (! NILP (entity))
157 ASET (entity, FONT_TYPE_INDEX, Qxft); 159 ASET (entity, FONT_TYPE_INDEX, Qxft);
@@ -262,7 +264,7 @@ xftfont_add_rendering_parameters (FcPattern *pat, Lisp_Object entity)
262} 264}
263 265
264static Lisp_Object 266static Lisp_Object
265xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) 267xftfont_open (struct frame *f, Lisp_Object entity, int pixel_size)
266{ 268{
267 FcResult result; 269 FcResult result;
268 Display *display = FRAME_X_DISPLAY (f); 270 Display *display = FRAME_X_DISPLAY (f);
@@ -484,7 +486,7 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
484} 486}
485 487
486static void 488static void
487xftfont_close (FRAME_PTR f, struct font *font) 489xftfont_close (struct frame *f, struct font *font)
488{ 490{
489 struct xftfont_info *xftfont_info = (struct xftfont_info *) font; 491 struct xftfont_info *xftfont_info = (struct xftfont_info *) font;
490 492
@@ -499,7 +501,7 @@ xftfont_close (FRAME_PTR f, struct font *font)
499} 501}
500 502
501static int 503static int
502xftfont_prepare_face (FRAME_PTR f, struct face *face) 504xftfont_prepare_face (struct frame *f, struct face *face)
503{ 505{
504 struct xftface_info *xftface_info; 506 struct xftface_info *xftface_info;
505 507
@@ -522,7 +524,7 @@ xftfont_prepare_face (FRAME_PTR f, struct face *face)
522} 524}
523 525
524static void 526static void
525xftfont_done_face (FRAME_PTR f, struct face *face) 527xftfont_done_face (struct frame *f, struct face *face)
526{ 528{
527 struct xftface_info *xftface_info; 529 struct xftface_info *xftface_info;
528 530
@@ -595,7 +597,7 @@ xftfont_text_extents (struct font *font, unsigned int *code, int nglyphs, struct
595} 597}
596 598
597static XftDraw * 599static XftDraw *
598xftfont_get_xft_draw (FRAME_PTR f) 600xftfont_get_xft_draw (struct frame *f)
599{ 601{
600 XftDraw *xft_draw = font_get_frame_data (f, &xftfont_driver); 602 XftDraw *xft_draw = font_get_frame_data (f, &xftfont_driver);
601 603
@@ -617,7 +619,7 @@ static int
617xftfont_draw (struct glyph_string *s, int from, int to, int x, int y, 619xftfont_draw (struct glyph_string *s, int from, int to, int x, int y,
618 bool with_background) 620 bool with_background)
619{ 621{
620 FRAME_PTR f = s->f; 622 struct frame *f = s->f;
621 struct face *face = s->face; 623 struct face *face = s->face;
622 struct xftfont_info *xftfont_info = (struct xftfont_info *) s->font; 624 struct xftfont_info *xftfont_info = (struct xftfont_info *) s->font;
623 struct xftface_info *xftface_info = NULL; 625 struct xftface_info *xftface_info = NULL;
@@ -677,7 +679,7 @@ xftfont_shape (Lisp_Object lgstring)
677#endif 679#endif
678 680
679static int 681static int
680xftfont_end_for_frame (FRAME_PTR f) 682xftfont_end_for_frame (struct frame *f)
681{ 683{
682 XftDraw *xft_draw; 684 XftDraw *xft_draw;
683 685
diff --git a/src/xmenu.c b/src/xmenu.c
index 5cc37842da9..cad892444ff 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -111,7 +111,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
111static Lisp_Object Qdebug_on_next_call; 111static Lisp_Object Qdebug_on_next_call;
112 112
113#if defined (USE_X_TOOLKIT) || defined (USE_GTK) 113#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
114static Lisp_Object xdialog_show (FRAME_PTR, bool, Lisp_Object, Lisp_Object, 114static Lisp_Object xdialog_show (struct frame *, bool, Lisp_Object, Lisp_Object,
115 const char **); 115 const char **);
116#endif 116#endif
117 117
@@ -130,7 +130,7 @@ static struct frame *
130menubar_id_to_frame (LWLIB_ID id) 130menubar_id_to_frame (LWLIB_ID id)
131{ 131{
132 Lisp_Object tail, frame; 132 Lisp_Object tail, frame;
133 FRAME_PTR f; 133 struct frame *f;
134 134
135 FOR_EACH_FRAME (tail, frame) 135 FOR_EACH_FRAME (tail, frame)
136 { 136 {
@@ -154,13 +154,12 @@ menubar_id_to_frame (LWLIB_ID id)
154 the scroll bar or the edit window. Fx_popup_menu needs to be 154 the scroll bar or the edit window. Fx_popup_menu needs to be
155 sure it is the edit window. */ 155 sure it is the edit window. */
156void 156void
157mouse_position_for_popup (FRAME_PTR f, int *x, int *y) 157mouse_position_for_popup (struct frame *f, int *x, int *y)
158{ 158{
159 Window root, dummy_window; 159 Window root, dummy_window;
160 int dummy; 160 int dummy;
161 161
162 if (! FRAME_X_P (f)) 162 eassert (FRAME_X_P (f));
163 emacs_abort ();
164 163
165 block_input (); 164 block_input ();
166 165
@@ -220,7 +219,7 @@ for instance using the window manager, then this produces a quit and
220`x-popup-dialog' does not return. */) 219`x-popup-dialog' does not return. */)
221 (Lisp_Object position, Lisp_Object contents, Lisp_Object header) 220 (Lisp_Object position, Lisp_Object contents, Lisp_Object header)
222{ 221{
223 FRAME_PTR f = NULL; 222 struct frame *f = NULL;
224 Lisp_Object window; 223 Lisp_Object window;
225 224
226 /* Decode the first argument: find the window or frame to use. */ 225 /* Decode the first argument: find the window or frame to use. */
@@ -230,7 +229,7 @@ for instance using the window manager, then this produces a quit and
230 { 229 {
231#if 0 /* Using the frame the mouse is on may not be right. */ 230#if 0 /* Using the frame the mouse is on may not be right. */
232 /* Use the mouse's current position. */ 231 /* Use the mouse's current position. */
233 FRAME_PTR new_f = SELECTED_FRAME (); 232 struct frame *new_f = SELECTED_FRAME ();
234 Lisp_Object bar_window; 233 Lisp_Object bar_window;
235 enum scroll_bar_part part; 234 enum scroll_bar_part part;
236 Time time; 235 Time time;
@@ -294,8 +293,8 @@ for instance using the window manager, then this produces a quit and
294 { 293 {
295 Lisp_Object x, y, frame, newpos; 294 Lisp_Object x, y, frame, newpos;
296 XSETFRAME (frame, f); 295 XSETFRAME (frame, f);
297 XSETINT (x, x_pixel_width (f) / 2); 296 XSETINT (x, FRAME_PIXEL_WIDTH (f) / 2);
298 XSETINT (y, x_pixel_height (f) / 2); 297 XSETINT (y, FRAME_PIXEL_HEIGHT (f) / 2);
299 newpos = list2 (list2 (x, y), frame); 298 newpos = list2 (list2 (x, y), frame);
300 299
301 return Fx_popup_menu (newpos, 300 return Fx_popup_menu (newpos,
@@ -482,7 +481,7 @@ If FRAME is nil or not given, use the selected frame. */)
482 (Lisp_Object frame) 481 (Lisp_Object frame)
483{ 482{
484 XEvent ev; 483 XEvent ev;
485 FRAME_PTR f = decode_window_system_frame (frame); 484 struct frame *f = decode_window_system_frame (frame);
486 Widget menubar; 485 Widget menubar;
487 block_input (); 486 block_input ();
488 487
@@ -560,10 +559,7 @@ If FRAME is nil or not given, use the selected frame. */)
560 (Lisp_Object frame) 559 (Lisp_Object frame)
561{ 560{
562 GtkWidget *menubar; 561 GtkWidget *menubar;
563 FRAME_PTR f; 562 struct frame *f;
564
565 /* gcc 2.95 doesn't accept the FRAME_PTR declaration after
566 block_input (). */
567 563
568 block_input (); 564 block_input ();
569 f = decode_window_system_frame (frame); 565 f = decode_window_system_frame (frame);
@@ -621,10 +617,9 @@ popup_widget_loop (int do_timers, GtkWidget *widget)
621 execute Lisp code. */ 617 execute Lisp code. */
622 618
623void 619void
624x_activate_menubar (FRAME_PTR f) 620x_activate_menubar (struct frame *f)
625{ 621{
626 if (! FRAME_X_P (f)) 622 eassert (FRAME_X_P (f));
627 emacs_abort ();
628 623
629 if (!f->output_data.x->saved_menu_event->type) 624 if (!f->output_data.x->saved_menu_event->type)
630 return; 625 return;
@@ -684,7 +679,7 @@ popup_deactivate_callback (
684 for that widget. 679 for that widget.
685 F is the frame if known, or NULL if not known. */ 680 F is the frame if known, or NULL if not known. */
686static void 681static void
687show_help_event (FRAME_PTR f, xt_or_gtk_widget widget, Lisp_Object help) 682show_help_event (struct frame *f, xt_or_gtk_widget widget, Lisp_Object help)
688{ 683{
689 Lisp_Object frame; 684 Lisp_Object frame;
690 685
@@ -817,7 +812,7 @@ menubar_selection_callback (GtkWidget *widget, gpointer client_data)
817static void 812static void
818menubar_selection_callback (Widget widget, LWLIB_ID id, XtPointer client_data) 813menubar_selection_callback (Widget widget, LWLIB_ID id, XtPointer client_data)
819{ 814{
820 FRAME_PTR f; 815 struct frame *f;
821 816
822 f = menubar_id_to_frame (id); 817 f = menubar_id_to_frame (id);
823 if (!f) 818 if (!f)
@@ -831,7 +826,7 @@ menubar_selection_callback (Widget widget, LWLIB_ID id, XtPointer client_data)
831 changed. */ 826 changed. */
832 827
833static void 828static void
834update_frame_menubar (FRAME_PTR f) 829update_frame_menubar (struct frame *f)
835{ 830{
836#ifdef USE_GTK 831#ifdef USE_GTK
837 xg_update_frame_menubar (f); 832 xg_update_frame_menubar (f);
@@ -839,8 +834,7 @@ update_frame_menubar (FRAME_PTR f)
839 struct x_output *x; 834 struct x_output *x;
840 int columns, rows; 835 int columns, rows;
841 836
842 if (! FRAME_X_P (f)) 837 eassert (FRAME_X_P (f));
843 emacs_abort ();
844 838
845 x = f->output_data.x; 839 x = f->output_data.x;
846 840
@@ -914,7 +908,7 @@ apply_systemfont_to_menu (struct frame *f, Widget w)
914 it is set the first time this is called, from initialize_frame_menubar. */ 908 it is set the first time this is called, from initialize_frame_menubar. */
915 909
916void 910void
917set_frame_menubar (FRAME_PTR f, bool first_time, bool deep_p) 911set_frame_menubar (struct frame *f, bool first_time, bool deep_p)
918{ 912{
919 xt_or_gtk_widget menubar_widget; 913 xt_or_gtk_widget menubar_widget;
920#ifdef USE_X_TOOLKIT 914#ifdef USE_X_TOOLKIT
@@ -927,8 +921,7 @@ set_frame_menubar (FRAME_PTR f, bool first_time, bool deep_p)
927 bool *submenu_top_level_items; 921 bool *submenu_top_level_items;
928 int *submenu_n_panes; 922 int *submenu_n_panes;
929 923
930 if (! FRAME_X_P (f)) 924 eassert (FRAME_X_P (f));
931 emacs_abort ();
932 925
933 menubar_widget = f->output_data.x->menubar_widget; 926 menubar_widget = f->output_data.x->menubar_widget;
934 927
@@ -1267,7 +1260,7 @@ set_frame_menubar (FRAME_PTR f, bool first_time, bool deep_p)
1267 is visible. */ 1260 is visible. */
1268 1261
1269void 1262void
1270initialize_frame_menubar (FRAME_PTR f) 1263initialize_frame_menubar (struct frame *f)
1271{ 1264{
1272 /* This function is called before the first chance to redisplay 1265 /* This function is called before the first chance to redisplay
1273 the frame. It has to be, so the frame will have the right size. */ 1266 the frame. It has to be, so the frame will have the right size. */
@@ -1282,12 +1275,11 @@ initialize_frame_menubar (FRAME_PTR f)
1282 1275
1283#ifndef USE_GTK 1276#ifndef USE_GTK
1284void 1277void
1285free_frame_menubar (FRAME_PTR f) 1278free_frame_menubar (struct frame *f)
1286{ 1279{
1287 Widget menubar_widget; 1280 Widget menubar_widget;
1288 1281
1289 if (! FRAME_X_P (f)) 1282 eassert (FRAME_X_P (f));
1290 emacs_abort ();
1291 1283
1292 menubar_widget = f->output_data.x->menubar_widget; 1284 menubar_widget = f->output_data.x->menubar_widget;
1293 1285
@@ -1360,7 +1352,7 @@ static Lisp_Object *volatile menu_item_selection;
1360 create_and_show_popup_menu below. */ 1352 create_and_show_popup_menu below. */
1361struct next_popup_x_y 1353struct next_popup_x_y
1362{ 1354{
1363 FRAME_PTR f; 1355 struct frame *f;
1364 int x; 1356 int x;
1365 int y; 1357 int y;
1366}; 1358};
@@ -1418,7 +1410,7 @@ pop_down_menu (void *arg)
1418 menu pops down. 1410 menu pops down.
1419 menu_item_selection will be set to the selection. */ 1411 menu_item_selection will be set to the selection. */
1420static void 1412static void
1421create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y, 1413create_and_show_popup_menu (struct frame *f, widget_value *first_wv, int x, int y,
1422 bool for_click, Time timestamp) 1414 bool for_click, Time timestamp)
1423{ 1415{
1424 int i; 1416 int i;
@@ -1434,8 +1426,7 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y,
1434 use_pos_func = 1; 1426 use_pos_func = 1;
1435#endif 1427#endif
1436 1428
1437 if (! FRAME_X_P (f)) 1429 eassert (FRAME_X_P (f));
1438 emacs_abort ();
1439 1430
1440 xg_crazy_callback_abort = 1; 1431 xg_crazy_callback_abort = 1;
1441 menu = xg_create_widget ("popup", first_wv->name, f, first_wv, 1432 menu = xg_create_widget ("popup", first_wv->name, f, first_wv,
@@ -1528,7 +1519,7 @@ pop_down_menu (Lisp_Object arg)
1528 menu pops down. 1519 menu pops down.
1529 menu_item_selection will be set to the selection. */ 1520 menu_item_selection will be set to the selection. */
1530static void 1521static void
1531create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, 1522create_and_show_popup_menu (struct frame *f, widget_value *first_wv,
1532 int x, int y, bool for_click, Time timestamp) 1523 int x, int y, bool for_click, Time timestamp)
1533{ 1524{
1534 int i; 1525 int i;
@@ -1539,8 +1530,7 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv,
1539 LWLIB_ID menu_id; 1530 LWLIB_ID menu_id;
1540 Widget menu; 1531 Widget menu;
1541 1532
1542 if (! FRAME_X_P (f)) 1533 eassert (FRAME_X_P (f));
1543 emacs_abort ();
1544 1534
1545#ifdef USE_LUCID 1535#ifdef USE_LUCID
1546 apply_systemfont_to_menu (f, f->output_data.x->widget); 1536 apply_systemfont_to_menu (f, f->output_data.x->widget);
@@ -1608,7 +1598,7 @@ cleanup_widget_value_tree (void *arg)
1608} 1598}
1609 1599
1610Lisp_Object 1600Lisp_Object
1611xmenu_show (FRAME_PTR f, int x, int y, bool for_click, bool keymaps, 1601xmenu_show (struct frame *f, int x, int y, bool for_click, bool keymaps,
1612 Lisp_Object title, const char **error_name, Time timestamp) 1602 Lisp_Object title, const char **error_name, Time timestamp)
1613{ 1603{
1614 int i; 1604 int i;
@@ -1623,8 +1613,7 @@ xmenu_show (FRAME_PTR f, int x, int y, bool for_click, bool keymaps,
1623 1613
1624 ptrdiff_t specpdl_count = SPECPDL_INDEX (); 1614 ptrdiff_t specpdl_count = SPECPDL_INDEX ();
1625 1615
1626 if (! FRAME_X_P (f)) 1616 eassert (FRAME_X_P (f));
1627 emacs_abort ();
1628 1617
1629 *error_name = NULL; 1618 *error_name = NULL;
1630 1619
@@ -1902,12 +1891,11 @@ dialog_selection_callback (GtkWidget *widget, gpointer client_data)
1902 dialog pops down. 1891 dialog pops down.
1903 menu_item_selection will be set to the selection. */ 1892 menu_item_selection will be set to the selection. */
1904static void 1893static void
1905create_and_show_dialog (FRAME_PTR f, widget_value *first_wv) 1894create_and_show_dialog (struct frame *f, widget_value *first_wv)
1906{ 1895{
1907 GtkWidget *menu; 1896 GtkWidget *menu;
1908 1897
1909 if (! FRAME_X_P (f)) 1898 eassert (FRAME_X_P (f));
1910 emacs_abort ();
1911 1899
1912 menu = xg_create_widget ("dialog", first_wv->name, f, first_wv, 1900 menu = xg_create_widget ("dialog", first_wv->name, f, first_wv,
1913 G_CALLBACK (dialog_selection_callback), 1901 G_CALLBACK (dialog_selection_callback),
@@ -1949,12 +1937,11 @@ dialog_selection_callback (Widget widget, LWLIB_ID id, XtPointer client_data)
1949 dialog pops down. 1937 dialog pops down.
1950 menu_item_selection will be set to the selection. */ 1938 menu_item_selection will be set to the selection. */
1951static void 1939static void
1952create_and_show_dialog (FRAME_PTR f, widget_value *first_wv) 1940create_and_show_dialog (struct frame *f, widget_value *first_wv)
1953{ 1941{
1954 LWLIB_ID dialog_id; 1942 LWLIB_ID dialog_id;
1955 1943
1956 if (!FRAME_X_P (f)) 1944 eassert (FRAME_X_P (f));
1957 emacs_abort ();
1958 1945
1959 dialog_id = widget_id_tick++; 1946 dialog_id = widget_id_tick++;
1960#ifdef USE_LUCID 1947#ifdef USE_LUCID
@@ -1994,7 +1981,7 @@ static const char * button_names [] = {
1994 "button6", "button7", "button8", "button9", "button10" }; 1981 "button6", "button7", "button8", "button9", "button10" };
1995 1982
1996static Lisp_Object 1983static Lisp_Object
1997xdialog_show (FRAME_PTR f, 1984xdialog_show (struct frame *f,
1998 bool keymaps, 1985 bool keymaps,
1999 Lisp_Object title, 1986 Lisp_Object title,
2000 Lisp_Object header, 1987 Lisp_Object header,
@@ -2012,8 +1999,7 @@ xdialog_show (FRAME_PTR f,
2012 1999
2013 ptrdiff_t specpdl_count = SPECPDL_INDEX (); 2000 ptrdiff_t specpdl_count = SPECPDL_INDEX ();
2014 2001
2015 if (! FRAME_X_P (f)) 2002 eassert (FRAME_X_P (f));
2016 emacs_abort ();
2017 2003
2018 *error_name = NULL; 2004 *error_name = NULL;
2019 2005
@@ -2225,7 +2211,7 @@ menu_help_callback (char const *help_string, int pane, int item)
2225static void 2211static void
2226pop_down_menu (Lisp_Object arg) 2212pop_down_menu (Lisp_Object arg)
2227{ 2213{
2228 FRAME_PTR f = XSAVE_POINTER (arg, 0); 2214 struct frame *f = XSAVE_POINTER (arg, 0);
2229 XMenu *menu = XSAVE_POINTER (arg, 1); 2215 XMenu *menu = XSAVE_POINTER (arg, 1);
2230 2216
2231 block_input (); 2217 block_input ();
@@ -2253,7 +2239,7 @@ pop_down_menu (Lisp_Object arg)
2253 2239
2254 2240
2255Lisp_Object 2241Lisp_Object
2256xmenu_show (FRAME_PTR f, int x, int y, bool for_click, bool keymaps, 2242xmenu_show (struct frame *f, int x, int y, bool for_click, bool keymaps,
2257 Lisp_Object title, const char **error_name, Time timestamp) 2243 Lisp_Object title, const char **error_name, Time timestamp)
2258{ 2244{
2259 Window root; 2245 Window root;
@@ -2269,8 +2255,7 @@ xmenu_show (FRAME_PTR f, int x, int y, bool for_click, bool keymaps,
2269 unsigned int dummy_uint; 2255 unsigned int dummy_uint;
2270 ptrdiff_t specpdl_count = SPECPDL_INDEX (); 2256 ptrdiff_t specpdl_count = SPECPDL_INDEX ();
2271 2257
2272 if (! FRAME_X_P (f) && ! FRAME_MSDOS_P (f)) 2258 eassert (FRAME_X_P (f) || FRAME_MSDOS_P (f));
2273 emacs_abort ();
2274 2259
2275 *error_name = 0; 2260 *error_name = 0;
2276 if (menu_items_n_panes == 0) 2261 if (menu_items_n_panes == 0)
diff --git a/src/xselect.c b/src/xselect.c
index d9f7d9c29c7..3a16d7d3496 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -993,7 +993,7 @@ x_handle_selection_event (struct input_event *event)
993 We do this when about to delete a frame. */ 993 We do this when about to delete a frame. */
994 994
995void 995void
996x_clear_frame_selections (FRAME_PTR f) 996x_clear_frame_selections (struct frame *f)
997{ 997{
998 Lisp_Object frame; 998 Lisp_Object frame;
999 Lisp_Object rest; 999 Lisp_Object rest;
@@ -2377,7 +2377,7 @@ x_property_data_to_lisp (struct frame *f, const unsigned char *data,
2377/* Get the mouse position in frame relative coordinates. */ 2377/* Get the mouse position in frame relative coordinates. */
2378 2378
2379static void 2379static void
2380mouse_position_for_drop (FRAME_PTR f, int *x, int *y) 2380mouse_position_for_drop (struct frame *f, int *x, int *y)
2381{ 2381{
2382 Window root, dummy_window; 2382 Window root, dummy_window;
2383 int dummy; 2383 int dummy;
diff --git a/src/xterm.c b/src/xterm.c
index a2306935e4e..a486242b8c3 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -145,7 +145,7 @@ int use_xim = 0; /* configure --without-xim */
145/* Non-zero means that a HELP_EVENT has been generated since Emacs 145/* Non-zero means that a HELP_EVENT has been generated since Emacs
146 start. */ 146 start. */
147 147
148static int any_help_event_p; 148static bool any_help_event_p;
149 149
150/* Last window where we saw the mouse. Used by mouse-autoselect-window. */ 150/* Last window where we saw the mouse. Used by mouse-autoselect-window. */
151static Lisp_Object last_window; 151static Lisp_Object last_window;
@@ -212,8 +212,7 @@ static unsigned long ignore_next_mouse_click_timeout;
212/* Where the mouse was last time we reported a mouse event. */ 212/* Where the mouse was last time we reported a mouse event. */
213 213
214static XRectangle last_mouse_glyph; 214static XRectangle last_mouse_glyph;
215static FRAME_PTR last_mouse_glyph_frame; 215static struct frame *last_mouse_glyph_frame;
216static Lisp_Object last_mouse_press_frame;
217 216
218/* The scroll bar in which the last X motion event occurred. 217/* The scroll bar in which the last X motion event occurred.
219 218
@@ -288,8 +287,6 @@ enum xembed_message
288 XEMBED_ACTIVATE_ACCELERATOR = 14 287 XEMBED_ACTIVATE_ACCELERATOR = 14
289 }; 288 };
290 289
291/* Used in x_flush. */
292
293static bool x_alloc_nearest_color_1 (Display *, Colormap, XColor *); 290static bool x_alloc_nearest_color_1 (Display *, Colormap, XColor *);
294static void x_set_window_size_1 (struct frame *, int, int, int); 291static void x_set_window_size_1 (struct frame *, int, int, int);
295static void x_raise_frame (struct frame *); 292static void x_raise_frame (struct frame *);
@@ -357,15 +354,18 @@ x_flush (struct frame *f)
357 return; 354 return;
358 355
359 block_input (); 356 block_input ();
360 if (f == NULL) 357 if (f)
358 {
359 eassert (FRAME_X_P (f));
360 XFlush (FRAME_X_DISPLAY (f));
361 }
362 else
361 { 363 {
362 Lisp_Object rest, frame; 364 /* Flush all displays and so all frames on them. */
363 FOR_EACH_FRAME (rest, frame) 365 struct x_display_info *xdi;
364 if (FRAME_X_P (XFRAME (frame))) 366 for (xdi = x_display_list; xdi; xdi = xdi->next)
365 x_flush (XFRAME (frame)); 367 XFlush (xdi->display);
366 } 368 }
367 else if (FRAME_X_P (f))
368 XFlush (FRAME_X_DISPLAY (f));
369 unblock_input (); 369 unblock_input ();
370} 370}
371 371
@@ -877,8 +877,6 @@ XTreset_terminal_modes (struct terminal *terminal)
877 877
878static void x_set_glyph_string_clipping (struct glyph_string *); 878static void x_set_glyph_string_clipping (struct glyph_string *);
879static void x_set_glyph_string_gc (struct glyph_string *); 879static void x_set_glyph_string_gc (struct glyph_string *);
880static void x_draw_glyph_string_background (struct glyph_string *,
881 int);
882static void x_draw_glyph_string_foreground (struct glyph_string *); 880static void x_draw_glyph_string_foreground (struct glyph_string *);
883static void x_draw_composite_glyph_string_foreground (struct glyph_string *); 881static void x_draw_composite_glyph_string_foreground (struct glyph_string *);
884static void x_draw_glyph_string_box (struct glyph_string *); 882static void x_draw_glyph_string_box (struct glyph_string *);
@@ -1163,7 +1161,7 @@ x_clear_glyph_string_rect (struct glyph_string *s, int x, int y, int w, int h)
1163 contains the first component of a composition. */ 1161 contains the first component of a composition. */
1164 1162
1165static void 1163static void
1166x_draw_glyph_string_background (struct glyph_string *s, int force_p) 1164x_draw_glyph_string_background (struct glyph_string *s, bool force_p)
1167{ 1165{
1168 /* Nothing to do if background has already been drawn or if it 1166 /* Nothing to do if background has already been drawn or if it
1169 shouldn't be drawn in the first place. */ 1167 shouldn't be drawn in the first place. */
@@ -1413,11 +1411,6 @@ x_draw_glyphless_glyph_string_foreground (struct glyph_string *s)
1413 1411
1414#ifdef USE_X_TOOLKIT 1412#ifdef USE_X_TOOLKIT
1415 1413
1416static Boolean cvt_string_to_pixel (Display *, XrmValue *, Cardinal *,
1417 XrmValue *, XrmValue *, XtPointer *);
1418static void cvt_pixel_dtor (XtAppContext, XrmValue *, XtPointer,
1419 XrmValue *, Cardinal *);
1420
1421#ifdef USE_LUCID 1414#ifdef USE_LUCID
1422 1415
1423/* Return the frame on which widget WIDGET is used.. Abort if frame 1416/* Return the frame on which widget WIDGET is used.. Abort if frame
@@ -3195,7 +3188,7 @@ XTflash (struct frame *f)
3195 3188
3196 3189
3197static void 3190static void
3198XTtoggle_invisible_pointer (FRAME_PTR f, int invisible) 3191XTtoggle_invisible_pointer (struct frame *f, int invisible)
3199{ 3192{
3200 block_input (); 3193 block_input ();
3201 if (invisible) 3194 if (invisible)
@@ -3804,7 +3797,7 @@ static XMotionEvent last_mouse_motion_event;
3804static Lisp_Object last_mouse_motion_frame; 3797static Lisp_Object last_mouse_motion_frame;
3805 3798
3806static int 3799static int
3807note_mouse_movement (FRAME_PTR frame, XMotionEvent *event) 3800note_mouse_movement (struct frame *frame, XMotionEvent *event)
3808{ 3801{
3809 last_mouse_movement_time = event->time; 3802 last_mouse_movement_time = event->time;
3810 last_mouse_motion_event = *event; 3803 last_mouse_motion_event = *event;
@@ -3880,11 +3873,11 @@ redo_mouse_highlight (void)
3880 movement. */ 3873 movement. */
3881 3874
3882static void 3875static void
3883XTmouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, 3876XTmouse_position (struct frame **fp, int insist, Lisp_Object *bar_window,
3884 enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, 3877 enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y,
3885 Time *timestamp) 3878 Time *timestamp)
3886{ 3879{
3887 FRAME_PTR f1; 3880 struct frame *f1;
3888 3881
3889 block_input (); 3882 block_input ();
3890 3883
@@ -4423,7 +4416,8 @@ xg_scroll_callback (GtkRange *range,
4423 gdouble position; 4416 gdouble position;
4424 int part = -1, whole = 0, portion = 0; 4417 int part = -1, whole = 0, portion = 0;
4425 GtkAdjustment *adj = GTK_ADJUSTMENT (gtk_range_get_adjustment (range)); 4418 GtkAdjustment *adj = GTK_ADJUSTMENT (gtk_range_get_adjustment (range));
4426 FRAME_PTR f = (FRAME_PTR) g_object_get_data (G_OBJECT (range), XG_FRAME_DATA); 4419 struct frame *f = (struct frame *) g_object_get_data (G_OBJECT (range),
4420 XG_FRAME_DATA);
4427 4421
4428 if (xg_ignore_gtk_scrollbar) return FALSE; 4422 if (xg_ignore_gtk_scrollbar) return FALSE;
4429 position = gtk_adjustment_get_value (adj); 4423 position = gtk_adjustment_get_value (adj);
@@ -5040,7 +5034,7 @@ x_scroll_bar_set_handle (struct scroll_bar *bar, int start, int end, int rebuild
5040{ 5034{
5041 int dragging = ! NILP (bar->dragging); 5035 int dragging = ! NILP (bar->dragging);
5042 Window w = bar->x_window; 5036 Window w = bar->x_window;
5043 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); 5037 struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
5044 GC gc = f->output_data.x->normal_gc; 5038 GC gc = f->output_data.x->normal_gc;
5045 5039
5046 /* If the display is already accurate, do nothing. */ 5040 /* If the display is already accurate, do nothing. */
@@ -5381,7 +5375,7 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio
5381 `*redeem_scroll_bar_hook' is applied to its window before the judgment. */ 5375 `*redeem_scroll_bar_hook' is applied to its window before the judgment. */
5382 5376
5383static void 5377static void
5384XTcondemn_scroll_bars (FRAME_PTR frame) 5378XTcondemn_scroll_bars (struct frame *frame)
5385{ 5379{
5386 /* Transfer all the scroll bars to FRAME_CONDEMNED_SCROLL_BARS. */ 5380 /* Transfer all the scroll bars to FRAME_CONDEMNED_SCROLL_BARS. */
5387 while (! NILP (FRAME_SCROLL_BARS (frame))) 5381 while (! NILP (FRAME_SCROLL_BARS (frame)))
@@ -5449,7 +5443,7 @@ XTredeem_scroll_bar (struct window *window)
5449 last call to `*condemn_scroll_bars_hook'. */ 5443 last call to `*condemn_scroll_bars_hook'. */
5450 5444
5451static void 5445static void
5452XTjudge_scroll_bars (FRAME_PTR f) 5446XTjudge_scroll_bars (struct frame *f)
5453{ 5447{
5454 Lisp_Object bar, next; 5448 Lisp_Object bar, next;
5455 5449
@@ -5485,7 +5479,7 @@ static void
5485x_scroll_bar_expose (struct scroll_bar *bar, XEvent *event) 5479x_scroll_bar_expose (struct scroll_bar *bar, XEvent *event)
5486{ 5480{
5487 Window w = bar->x_window; 5481 Window w = bar->x_window;
5488 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); 5482 struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
5489 GC gc = f->output_data.x->normal_gc; 5483 GC gc = f->output_data.x->normal_gc;
5490 int width_trim = VERTICAL_SCROLL_BAR_WIDTH_TRIM; 5484 int width_trim = VERTICAL_SCROLL_BAR_WIDTH_TRIM;
5491 5485
@@ -5584,7 +5578,7 @@ x_scroll_bar_handle_click (struct scroll_bar *bar, XEvent *event, struct input_e
5584static void 5578static void
5585x_scroll_bar_note_movement (struct scroll_bar *bar, XEvent *event) 5579x_scroll_bar_note_movement (struct scroll_bar *bar, XEvent *event)
5586{ 5580{
5587 FRAME_PTR f = XFRAME (XWINDOW (bar->window)->frame); 5581 struct frame *f = XFRAME (XWINDOW (bar->window)->frame);
5588 5582
5589 last_mouse_movement_time = event->xmotion.time; 5583 last_mouse_movement_time = event->xmotion.time;
5590 5584
@@ -5612,13 +5606,13 @@ x_scroll_bar_note_movement (struct scroll_bar *bar, XEvent *event)
5612 on the scroll bar. */ 5606 on the scroll bar. */
5613 5607
5614static void 5608static void
5615x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window, 5609x_scroll_bar_report_motion (struct frame **fp, Lisp_Object *bar_window,
5616 enum scroll_bar_part *part, Lisp_Object *x, 5610 enum scroll_bar_part *part, Lisp_Object *x,
5617 Lisp_Object *y, Time *timestamp) 5611 Lisp_Object *y, Time *timestamp)
5618{ 5612{
5619 struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar); 5613 struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar);
5620 Window w = bar->x_window; 5614 Window w = bar->x_window;
5621 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); 5615 struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
5622 int win_x, win_y; 5616 int win_x, win_y;
5623 Window dummy_window; 5617 Window dummy_window;
5624 int dummy_coord; 5618 int dummy_coord;
@@ -5686,7 +5680,7 @@ x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window,
5686 redraw them. */ 5680 redraw them. */
5687 5681
5688static void 5682static void
5689x_scroll_bar_clear (FRAME_PTR f) 5683x_scroll_bar_clear (struct frame *f)
5690{ 5684{
5691#ifndef USE_TOOLKIT_SCROLL_BARS 5685#ifndef USE_TOOLKIT_SCROLL_BARS
5692 Lisp_Object bar; 5686 Lisp_Object bar;
@@ -6975,14 +6969,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6975 && event.xbutton.same_screen) 6969 && event.xbutton.same_screen)
6976 { 6970 {
6977 SET_SAVED_BUTTON_EVENT; 6971 SET_SAVED_BUTTON_EVENT;
6978 XSETFRAME (last_mouse_press_frame, f);
6979 *finish = X_EVENT_DROP; 6972 *finish = X_EVENT_DROP;
6980 } 6973 }
6981 else if (event.type == ButtonPress)
6982 {
6983 last_mouse_press_frame = Qnil;
6984 goto OTHER;
6985 }
6986 else 6974 else
6987 goto OTHER; 6975 goto OTHER;
6988#endif /* USE_X_TOOLKIT || USE_GTK */ 6976#endif /* USE_X_TOOLKIT || USE_GTK */
@@ -8537,7 +8525,7 @@ do_ewmh_fullscreen (struct frame *f)
8537} 8525}
8538 8526
8539static void 8527static void
8540XTfullscreen_hook (FRAME_PTR f) 8528XTfullscreen_hook (struct frame *f)
8541{ 8529{
8542 if (FRAME_VISIBLE_P (f)) 8530 if (FRAME_VISIBLE_P (f))
8543 { 8531 {
@@ -8938,7 +8926,7 @@ x_lower_frame (struct frame *f)
8938/* Request focus with XEmbed */ 8926/* Request focus with XEmbed */
8939 8927
8940void 8928void
8941xembed_request_focus (FRAME_PTR f) 8929xembed_request_focus (struct frame *f)
8942{ 8930{
8943 /* See XEmbed Protocol Specification at 8931 /* See XEmbed Protocol Specification at
8944 http://freedesktop.org/wiki/Specifications/xembed-spec */ 8932 http://freedesktop.org/wiki/Specifications/xembed-spec */
@@ -8950,7 +8938,7 @@ xembed_request_focus (FRAME_PTR f)
8950/* Activate frame with Extended Window Manager Hints */ 8938/* Activate frame with Extended Window Manager Hints */
8951 8939
8952void 8940void
8953x_ewmh_activate_frame (FRAME_PTR f) 8941x_ewmh_activate_frame (struct frame *f)
8954{ 8942{
8955 /* See Window Manager Specification/Extended Window Manager Hints at 8943 /* See Window Manager Specification/Extended Window Manager Hints at
8956 http://freedesktop.org/wiki/Specifications/wm-spec */ 8944 http://freedesktop.org/wiki/Specifications/wm-spec */
@@ -8968,7 +8956,7 @@ x_ewmh_activate_frame (FRAME_PTR f)
8968} 8956}
8969 8957
8970static void 8958static void
8971XTframe_raise_lower (FRAME_PTR f, int raise_flag) 8959XTframe_raise_lower (struct frame *f, int raise_flag)
8972{ 8960{
8973 if (raise_flag) 8961 if (raise_flag)
8974 x_raise_frame (f); 8962 x_raise_frame (f);
@@ -9452,6 +9440,19 @@ x_free_frame_resources (struct frame *f)
9452 unload_color (f, f->output_data.x->black_relief.pixel); 9440 unload_color (f, f->output_data.x->black_relief.pixel);
9453 9441
9454 x_free_gcs (f); 9442 x_free_gcs (f);
9443
9444 /* Free extra GCs allocated by x_setup_relief_colors. */
9445 if (f->output_data.x->white_relief.gc)
9446 {
9447 XFreeGC (dpyinfo->display, f->output_data.x->white_relief.gc);
9448 f->output_data.x->white_relief.gc = 0;
9449 }
9450 if (f->output_data.x->black_relief.gc)
9451 {
9452 XFreeGC (dpyinfo->display, f->output_data.x->black_relief.gc);
9453 f->output_data.x->black_relief.gc = 0;
9454 }
9455
9455 XFlush (FRAME_X_DISPLAY (f)); 9456 XFlush (FRAME_X_DISPLAY (f));
9456 } 9457 }
9457 9458
@@ -9817,18 +9818,11 @@ get_bits_and_offset (long unsigned int mask, int *bits, int *offset)
9817/* Return 1 if display DISPLAY is available for use, 0 otherwise. 9818/* Return 1 if display DISPLAY is available for use, 0 otherwise.
9818 But don't permanently open it, just test its availability. */ 9819 But don't permanently open it, just test its availability. */
9819 9820
9820int 9821bool
9821x_display_ok (const char *display) 9822x_display_ok (const char *display)
9822{ 9823{
9823 int dpy_ok = 1; 9824 Display *dpy = XOpenDisplay (display);
9824 Display *dpy; 9825 return dpy ? (XCloseDisplay (dpy), 1) : 0;
9825
9826 dpy = XOpenDisplay (display);
9827 if (dpy)
9828 XCloseDisplay (dpy);
9829 else
9830 dpy_ok = 0;
9831 return dpy_ok;
9832} 9826}
9833 9827
9834#ifdef USE_GTK 9828#ifdef USE_GTK
@@ -10728,9 +10722,6 @@ syms_of_xterm (void)
10728 DEFSYM (Qvendor_specific_keysyms, "vendor-specific-keysyms"); 10722 DEFSYM (Qvendor_specific_keysyms, "vendor-specific-keysyms");
10729 DEFSYM (Qlatin_1, "latin-1"); 10723 DEFSYM (Qlatin_1, "latin-1");
10730 10724
10731 staticpro (&last_mouse_press_frame);
10732 last_mouse_press_frame = Qnil;
10733
10734#ifdef USE_GTK 10725#ifdef USE_GTK
10735 xg_default_icon_file = build_pure_c_string ("icons/hicolor/scalable/apps/emacs.svg"); 10726 xg_default_icon_file = build_pure_c_string ("icons/hicolor/scalable/apps/emacs.svg");
10736 staticpro (&xg_default_icon_file); 10727 staticpro (&xg_default_icon_file);
diff --git a/src/xterm.h b/src/xterm.h
index 6bdc708220b..5324ef628e7 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -403,7 +403,7 @@ extern Lisp_Object x_display_name_list;
403extern struct x_display_info *x_display_info_for_display (Display *); 403extern struct x_display_info *x_display_info_for_display (Display *);
404 404
405extern struct x_display_info *x_term_init (Lisp_Object, char *, char *); 405extern struct x_display_info *x_term_init (Lisp_Object, char *, char *);
406extern int x_display_ok (const char *); 406extern bool x_display_ok (const char *);
407 407
408extern void select_visual (struct x_display_info *); 408extern void select_visual (struct x_display_info *);
409 409
@@ -590,7 +590,6 @@ struct x_output
590 XIC xic; 590 XIC xic;
591 XIMStyle xic_style; 591 XIMStyle xic_style;
592 XFontSet xic_xfs; 592 XFontSet xic_xfs;
593 char *xic_base_fontname;
594#endif 593#endif
595 594
596 /* Relief GCs, colors etc. */ 595 /* Relief GCs, colors etc. */
@@ -754,7 +753,6 @@ enum
754#define FRAME_X_XIM_STYLES(f) (FRAME_X_DISPLAY_INFO (f)->xim_styles) 753#define FRAME_X_XIM_STYLES(f) (FRAME_X_DISPLAY_INFO (f)->xim_styles)
755#define FRAME_XIC_STYLE(f) ((f)->output_data.x->xic_style) 754#define FRAME_XIC_STYLE(f) ((f)->output_data.x->xic_style)
756#define FRAME_XIC_FONTSET(f) ((f)->output_data.x->xic_xfs) 755#define FRAME_XIC_FONTSET(f) ((f)->output_data.x->xic_xfs)
757#define FRAME_XIC_BASE_FONTNAME(f) ((f)->output_data.x->xic_base_fontname)
758 756
759/* Value is the smallest width of any character in any font on frame F. */ 757/* Value is the smallest width of any character in any font on frame F. */
760 758
@@ -1031,8 +1029,6 @@ extern void destroy_frame_xic (struct frame *);
1031extern void xic_set_preeditarea (struct window *, int, int); 1029extern void xic_set_preeditarea (struct window *, int, int);
1032extern void xic_set_statusarea (struct frame *); 1030extern void xic_set_statusarea (struct frame *);
1033extern void xic_set_xfontset (struct frame *, const char *); 1031extern void xic_set_xfontset (struct frame *, const char *);
1034extern int x_pixel_width (struct frame *);
1035extern int x_pixel_height (struct frame *);
1036extern bool x_defined_color (struct frame *, const char *, XColor *, bool); 1032extern bool x_defined_color (struct frame *, const char *, XColor *, bool);
1037#ifdef HAVE_X_I18N 1033#ifdef HAVE_X_I18N
1038extern void free_frame_xic (struct frame *); 1034extern void free_frame_xic (struct frame *);
diff --git a/test/ChangeLog b/test/ChangeLog
index bffe85e6a7a..f3d14786bd9 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,30 @@
12013-08-04 Glenn Morris <rgm@gnu.org>
2
3 * automated/icalendar-tests.el (icalendar-tests--test-export)
4 (icalendar-tests--test-import): Try more precise TZ specification.
5
62013-08-03 Glenn Morris <rgm@gnu.org>
7
8 * automated/core-elisp-tests.el (core-elisp-tests): Fix defcustom.
9
10 * automated/icalendar-tests.el (icalendar-tests--test-export)
11 (icalendar-tests--test-import):
12 Use getenv/setenv rather than set-time-zone-rule. Add debug messages.
13 (icalendar-tests--test-import): Reset zone even if error occurred.
14
152013-08-02 Stefan Monnier <monnier@iro.umontreal.ca>
16
17 * automated/core-elisp-tests.el: New file.
18
192013-08-01 Glenn Morris <rgm@gnu.org>
20
21 * automated/file-notify-tests.el (file-notify--test-remote-enabled):
22 Try to check that the remote system has a notification program.
23
242013-07-31 Glenn Morris <rgm@gnu.org>
25
26 * automated/undo-tests.el (undo-test2, undo-test5): Be quieter.
27
12013-07-24 Michael Albinus <michael.albinus@gmx.de> 282013-07-24 Michael Albinus <michael.albinus@gmx.de>
2 29
3 * automated/file-notify-tests.el 30 * automated/file-notify-tests.el
diff --git a/test/automated/core-elisp-tests.el b/test/automated/core-elisp-tests.el
new file mode 100644
index 00000000000..40169b836d5
--- /dev/null
+++ b/test/automated/core-elisp-tests.el
@@ -0,0 +1,40 @@
1;;; core-elisp-tests.el --- Testing some core Elisp rules
2
3;; Copyright (C) 2013 Free Software Foundation, Inc.
4
5;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
6;; Keywords:
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;;
24
25;;; Code:
26
27(ert-deftest core-elisp-tests ()
28 "Test some core Elisp rules."
29 (with-temp-buffer
30 ;; Check that when defvar is run within a let-binding, the toplevel default
31 ;; is properly initialized.
32 (should (equal (list (let ((c-e-x 1)) (defvar c-e-x 2) c-e-x) c-e-x)
33 '(1 2)))
34 (should (equal (list (let ((c-e-x 1))
35 (defcustom c-e-x 2 "doc" :group 'blah) c-e-x)
36 c-e-x)
37 '(1 2)))))
38
39(provide 'core-elisp-tests)
40;;; core-elisp-tests.el ends here
diff --git a/test/automated/file-notify-tests.el b/test/automated/file-notify-tests.el
index 8bd4f258b1c..9f552ee7ab1 100644
--- a/test/automated/file-notify-tests.el
+++ b/test/automated/file-notify-tests.el
@@ -43,6 +43,7 @@
43(defvar file-notify--test-event nil) 43(defvar file-notify--test-event nil)
44 44
45(require 'tramp) 45(require 'tramp)
46(require 'tramp-sh)
46(setq tramp-verbose 0 47(setq tramp-verbose 0
47 tramp-message-show-message nil) 48 tramp-message-show-message nil)
48(when noninteractive (defalias 'tramp-read-passwd 'ignore)) 49(when noninteractive (defalias 'tramp-read-passwd 'ignore))
@@ -57,7 +58,18 @@
57 (ignore-errors 58 (ignore-errors
58 (and (file-remote-p file-notify-test-remote-temporary-file-directory) 59 (and (file-remote-p file-notify-test-remote-temporary-file-directory)
59 (file-directory-p file-notify-test-remote-temporary-file-directory) 60 (file-directory-p file-notify-test-remote-temporary-file-directory)
60 (file-writable-p file-notify-test-remote-temporary-file-directory)))) 61 (file-writable-p file-notify-test-remote-temporary-file-directory)
62 ;; Extracted from tramp-sh-handle-file-notify-add-watch.
63 ;; Even though the "remote" system is just ssh@localhost,
64 ;; the PATH might not be the same as the "local" PATH.
65 ;; Eg this seems to be the case on hydra.nixos.org.
66 ;; Without this, tests fail with:
67 ;; "No file notification program found on /ssh:localhost:"
68 ;; Try to fix PATH instead?
69 (with-parsed-tramp-file-name
70 file-notify-test-remote-temporary-file-directory nil
71 (or (tramp-get-remote-gvfs-monitor-dir v)
72 (tramp-get-remote-inotifywait v))))))
61 73
62(defmacro file-notify--deftest-remote (test docstring) 74(defmacro file-notify--deftest-remote (test docstring)
63 "Define ert `TEST-remote' for remote files." 75 "Define ert `TEST-remote' for remote files."
diff --git a/test/automated/icalendar-tests.el b/test/automated/icalendar-tests.el
index 28fa47630a8..227855681e8 100644
--- a/test/automated/icalendar-tests.el
+++ b/test/automated/icalendar-tests.el
@@ -428,12 +428,14 @@ Argument EXPECTED-OUTPUT expected iCalendar result string.
428 428
429European style input data must use german month names. American 429European style input data must use german month names. American
430and ISO style input data must use english month names." 430and ISO style input data must use english month names."
431 (let ((tz (cadr (current-time-zone))) 431 (let ((tz (getenv "TZ"))
432 (calendar-date-style 'iso) 432 (calendar-date-style 'iso)
433 (icalendar-recurring-start-year 2000)) 433 (icalendar-recurring-start-year 2000))
434 (unwind-protect 434 (unwind-protect
435 (progn 435 (progn
436 (set-time-zone-rule "CET") 436 (message "Current time zone: %s" (current-time-zone))
437 (setenv "TZ" "CET-1CEST,M3.5.0/2,M10.5.0/3")
438 (message "Current time zone: %s" (current-time-zone))
437 (when input-iso 439 (when input-iso
438 (let ((calendar-month-name-array 440 (let ((calendar-month-name-array
439 ["January" "February" "March" "April" "May" "June" "July" "August" 441 ["January" "February" "March" "April" "May" "June" "July" "August"
@@ -461,8 +463,8 @@ and ISO style input data must use english month names."
461 "Saturday"])) 463 "Saturday"]))
462 (setq calendar-date-style 'american) 464 (setq calendar-date-style 'american)
463 (icalendar-tests--do-test-export input-american expected-output)))) 465 (icalendar-tests--do-test-export input-american expected-output))))
464 ;; restore time-zone if something went terribly wrong 466 ;; restore time-zone even if something went terribly wrong
465 (set-time-zone-rule tz)))) 467 (setenv "TZ" tz))))
466 468
467(defun icalendar-tests--do-test-export (input expected-output) 469(defun icalendar-tests--do-test-export (input expected-output)
468 "Actually perform export test. 470 "Actually perform export test.
@@ -671,37 +673,41 @@ Argument INPUT icalendar event string.
671Argument EXPECTED-ISO expected iso style diary string. 673Argument EXPECTED-ISO expected iso style diary string.
672Argument EXPECTED-EUROPEAN expected european style diary string. 674Argument EXPECTED-EUROPEAN expected european style diary string.
673Argument EXPECTED-AMERICAN expected american style diary string." 675Argument EXPECTED-AMERICAN expected american style diary string."
674 (let ((timezone (cadr (current-time-zone)))) 676 (let ((timezone (getenv "TZ")))
675 (set-time-zone-rule "CET") 677 (unwind-protect
676 (with-temp-buffer 678 (progn
677 (if (string-match "^BEGIN:VCALENDAR" input) 679 (message "Current time zone: %s" (current-time-zone))
678 (insert input) 680 (setenv "TZ" "CET-1CEST,M3.5.0/2,M10.5.0/3")
679 (insert "BEGIN:VCALENDAR\nPRODID:-//Emacs//NONSGML icalendar.el//EN\n") 681 (message "Current time zone: %s" (current-time-zone))
680 (insert "VERSION:2.0\nBEGIN:VEVENT\n") 682 (with-temp-buffer
681 (insert input) 683 (if (string-match "^BEGIN:VCALENDAR" input)
682 (unless (eq (char-before) ?\n) 684 (insert input)
683 (insert "\n")) 685 (insert "BEGIN:VCALENDAR\nPRODID:-//Emacs//NONSGML icalendar.el//EN\n")
684 (insert "END:VEVENT\nEND:VCALENDAR\n")) 686 (insert "VERSION:2.0\nBEGIN:VEVENT\n")
685 (let ((icalendar-import-format "%s%d%l%o%t%u%c%U") 687 (insert input)
686 (icalendar-import-format-summary "%s") 688 (unless (eq (char-before) ?\n)
687 (icalendar-import-format-location "\n Location: %s") 689 (insert "\n"))
688 (icalendar-import-format-description "\n Desc: %s") 690 (insert "END:VEVENT\nEND:VCALENDAR\n"))
689 (icalendar-import-format-organizer "\n Organizer: %s") 691 (let ((icalendar-import-format "%s%d%l%o%t%u%c%U")
690 (icalendar-import-format-status "\n Status: %s") 692 (icalendar-import-format-summary "%s")
691 (icalendar-import-format-url "\n URL: %s") 693 (icalendar-import-format-location "\n Location: %s")
692 (icalendar-import-format-class "\n Class: %s") 694 (icalendar-import-format-description "\n Desc: %s")
693 (icalendar-import-format-uid "\n UID: %s") 695 (icalendar-import-format-organizer "\n Organizer: %s")
694 calendar-date-style) 696 (icalendar-import-format-status "\n Status: %s")
695 (when expected-iso 697 (icalendar-import-format-url "\n URL: %s")
696 (setq calendar-date-style 'iso) 698 (icalendar-import-format-class "\n Class: %s")
697 (icalendar-tests--do-test-import input expected-iso)) 699 (icalendar-import-format-uid "\n UID: %s")
698 (when expected-european 700 calendar-date-style)
699 (setq calendar-date-style 'european) 701 (when expected-iso
700 (icalendar-tests--do-test-import input expected-european)) 702 (setq calendar-date-style 'iso)
701 (when expected-american 703 (icalendar-tests--do-test-import input expected-iso))
702 (setq calendar-date-style 'american) 704 (when expected-european
703 (icalendar-tests--do-test-import input expected-american)))) 705 (setq calendar-date-style 'european)
704 (set-time-zone-rule timezone))) 706 (icalendar-tests--do-test-import input expected-european))
707 (when expected-american
708 (setq calendar-date-style 'american)
709 (icalendar-tests--do-test-import input expected-american)))))
710 (setenv "TZ" timezone))))
705 711
706(defun icalendar-tests--do-test-import (input expected-output) 712(defun icalendar-tests--do-test-import (input expected-output)
707 "Actually perform import test. 713 "Actually perform import test.
diff --git a/test/automated/undo-tests.el b/test/automated/undo-tests.el
index 87c55c5d374..7b6989a5ef0 100644
--- a/test/automated/undo-tests.el
+++ b/test/automated/undo-tests.el
@@ -124,7 +124,7 @@
124 (undo-boundary) 124 (undo-boundary)
125 (insert " Zero") 125 (insert " Zero")
126 (undo-boundary) 126 (undo-boundary)
127 (push-mark) 127 (push-mark nil t)
128 (delete-region (save-excursion 128 (delete-region (save-excursion
129 (forward-word -1) 129 (forward-word -1)
130 (point)) (point)) 130 (point)) (point))
@@ -172,7 +172,7 @@
172 (insert " BEE") 172 (insert " BEE")
173 (undo-boundary) 173 (undo-boundary)
174 (setq buffer-undo-list (cons '(0.0 bogus) buffer-undo-list)) 174 (setq buffer-undo-list (cons '(0.0 bogus) buffer-undo-list))
175 (push-mark) 175 (push-mark nil t)
176 (delete-region (save-excursion 176 (delete-region (save-excursion
177 (forward-word -1) 177 (forward-word -1)
178 (point)) (point)) 178 (point)) (point))