aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiles Bader2006-02-26 07:09:24 +0000
committerMiles Bader2006-02-26 07:09:24 +0000
commita6c05016ac9ce84cdff34608b36d5677e9843068 (patch)
treeb7f6958e7114053de680f16ea840a970c594b085
parent50ca3b1a04f92fed78e7f69ad57479416dc15634 (diff)
parent782ea71aba3761983d71bf8ab9bb77c974abab56 (diff)
downloademacs-a6c05016ac9ce84cdff34608b36d5677e9843068.tar.gz
emacs-a6c05016ac9ce84cdff34608b36d5677e9843068.zip
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-26
Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 119-122) - Update from CVS
-rw-r--r--admin/ChangeLog4
-rw-r--r--admin/FOR-RELEASE4
-rw-r--r--lisp/ChangeLog114
-rw-r--r--lisp/ChangeLog.12
-rw-r--r--lisp/ChangeLog.104
-rw-r--r--lisp/ido.el54
-rw-r--r--lisp/progmodes/cc-align.el4
-rw-r--r--lisp/progmodes/cc-awk.el15
-rw-r--r--lisp/progmodes/cc-bytecomp.el4
-rw-r--r--lisp/progmodes/cc-cmds.el35
-rw-r--r--lisp/progmodes/cc-compat.el4
-rw-r--r--lisp/progmodes/cc-defs.el19
-rw-r--r--lisp/progmodes/cc-engine.el112
-rw-r--r--lisp/progmodes/cc-langs.el34
-rw-r--r--lisp/progmodes/cc-menus.el4
-rw-r--r--lisp/progmodes/cc-mode.el130
-rw-r--r--lisp/progmodes/cc-styles.el4
-rw-r--r--lisp/progmodes/cc-vars.el4
-rw-r--r--lisp/progmodes/etags.el38
-rw-r--r--lisp/progmodes/sh-script.el40
-rw-r--r--man/ChangeLog30
-rw-r--r--man/cc-mode.texi101
-rw-r--r--src/ChangeLog44
-rw-r--r--src/buffer.c5
-rw-r--r--src/eval.c2
-rw-r--r--src/fileio.c2
-rw-r--r--src/gtkutil.c18
-rw-r--r--src/process.c8
-rw-r--r--src/xfns.c16
-rw-r--r--src/xselect.c35
-rw-r--r--src/xterm.c96
-rw-r--r--src/xterm.h8
32 files changed, 628 insertions, 366 deletions
diff --git a/admin/ChangeLog b/admin/ChangeLog
index 1543c17d3a6..8256beefb6c 100644
--- a/admin/ChangeLog
+++ b/admin/ChangeLog
@@ -1,3 +1,7 @@
12006-02-24 Reiner Steib <Reiner.Steib@gmx.de>
2
3 * FOR-RELEASE (BUGS): Add URLs/MIDs.
4
12006-02-20 Kim F. Storm <storm@cua.dk> 52006-02-20 Kim F. Storm <storm@cua.dk>
2 6
3 * FOR-RELEASE (NEW FEATURES): Completed work on this item: 7 * FOR-RELEASE (NEW FEATURES): Completed work on this item:
diff --git a/admin/FOR-RELEASE b/admin/FOR-RELEASE
index ef73ec4436e..24d746e1391 100644
--- a/admin/FOR-RELEASE
+++ b/admin/FOR-RELEASE
@@ -36,10 +36,10 @@ Assigned to Bill Wohler <wohler@newt.com>.
36* BUGS 36* BUGS
37 37
38** Reiner Steib's 23 Jan 2006 bug report that tool bar icons don't update. 38** Reiner Steib's 23 Jan 2006 bug report that tool bar icons don't update.
39URL/MID: http://mid.gmane.org/v9acdmrcse.fsf@marauder.physik.uni-ulm.de
39 40
40** Ralf Angeli's 4 Jul 2005 bug report about scroll-preserve-screen-position. 41** Ralf Angeli's 4 Jul 2005 bug report about scroll-preserve-screen-position.
41 42URL/MID: http://mid.gmane.org/877jg6o7k4.fsf@neutrino.iwi.uni-sb.de
42** Martin Rudalics' 30 Jan 2006 bug report about overlays at end of buffer.
43 43
44** TCP server processes do not work on Windows. 44** TCP server processes do not work on Windows.
45 45
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 8101c48f10b..7725ded39fd 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,109 @@
12006-02-26 Kim F. Storm <storm@cua.dk>
2
3 * ido.el (ido-save-history, ido-load-history): Simplify. Don't
4 use find-file-noselect to avoid interference from other modes.
5
62006-02-25 Thien-Thi Nguyen <ttn@gnu.org>
7
8 * progmodes/sh-script.el (sh-mode): Fix bug: Arrange
9 to use the default shell if filename is not available.
10 Reported by Giorgos Keramidas.
11
122006-02-25 John Williams <jrw@pobox.com> (tiny change)
13
14 * progmodes/etags.el (tags-completion-table): Do completion from
15 all the tables in the current list, as documented in the manual.
16
172006-02-24 Alan Mackenzie <bug-cc-mode@gnu.org>
18
19 * CC Mode Update to 5.31.3.
20
212006-02-24 Alan Mackenzie <bug-cc-mode@gnu.org>
22
23 * progmodes/cc-mode.el (c-postprocess-file-styles): bind
24 inhibit-read-only to t, around the call to
25 c-remove-any-local-eval-or-mode-variables, so that it works on a
26 RO file.
27
282006-02-24 Alan Mackenzie <bug-cc-mode@gnu.org>
29
30 * progmodes/cc-awk.el: Correct a typo.
31
322006-02-24 Alan Mackenzie <bug-cc-mode@gnu.org>
33
34 * progmodes/cc-cmds.el, cc-mode.el: Rename c-hungry-backspace to
35 c-hungry-delete-backwards, at the request of RMS. Leave the old
36 name as an alias.
37
382006-02-24 Alan Mackenzie <bug-cc-mode@gnu.org>
39
40 * progmodes/cc-mode.el: Correct a typo.
41
422006-02-24 Alan Mackenzie <bug-cc-mode@gnu.org>
43
44 * progmodes/cc-defs.el: Update the version number to 5.31.3.
45
462006-02-24 Alan Mackenzie <bug-cc-mode@gnu.org>
47
48 * progmodes/cc-cmds.el (c-electric-brace): Fix clean-up
49 brace-else-brace (error due to mbeg, mend being undefined).
50
512006-02-24 Alan Mackenzie <bug-cc-mode@gnu.org>
52
53 * progmodes/cc-mode.el: File Local variables: Solve the problem
54 where both `mode' and c-file-offsets are specified: `mode' will
55 overwrite c-f-o's settings:
56 (c-remove-any-local-eval-or-mode-variables): new function.
57 (c-postprocess-file-styles): call the above new function, within
58 c-tentative-buffer-change, to splat `mode' and `eval' before the
59 second hack-local-variables.
60
612006-02-24 Alan Mackenzie <bug-cc-mode@gnu.org>
62
63 * progmodes/cc-mode.el:
64 [Supersedes patch to cc-engine.el 2005-12-16T20:07:49Z!monnier@iro.umontreal.ca]
65 (c-after-change): Protect the match data with save-match-data. It
66 was getting corrupted by c-after-change-check-<>-operators.
67
68 * cc-defs.el: [Supersedes patch V1.38]:
69 (top level): Check for a buggy font-lock-compile-keywords ONLY in
70 XEmacs. GNU Emacs 22 now has a check which would throw an error
71 here.
72
73 * progmodes/cc-awk.el (c-awk-after-change): Protect the match data
74 with save-match-data. It was being corrupted when Font Lock was
75 not enabled.
76
772006-02-24 Alan Mackenzie <bug-cc-mode@gnu.org>
78
79 * progmodes/cc-langs.el (c-mode-menu): Add menu items for Electric
80 Mode and Subword Mode.
81
82 * progmodes/cc-engine.el (c-beginning-of-statment-1): Distinguish
83 real labels ("case 1:" or "foo:") from non-labels ("public:").
84 (c-forward-objc-directive): Replace c-forward-token-2 with crude
85 coding; c-f-t-2 doesn't move over a token at EOB.
86
87 * progmodes/cc-defs.el (c-version): Update version number to
88 5.31.2
89
90 * progmodes/cc-cmds.el, cc-mode.el, cc-engine.el
91 (c-update-modeline): Concatenate the minor mode indicators
92 directly onto mode-name, removing c-submode-indicators.
93 Sometimes, c-s-i got separated from the mode name on the mode
94 line.
95
96 * progmodes/cc-cmds.el (c-electric-brace, c-electric-semi&comma,
97 c-electric-colon): Correct doc-strings: "/ln" -> "/la".
98
992006-02-24 Martin Stjernholm <bug-cc-mode@gnu.org>
100
101 * progmodes/cc-langs.el (c-make-init-lang-vars-fun): Improved the
102 error message when there's an evaluation error to show whether
103 it's loaded from source or not.
104 (c-filter-ops): Made it available at runtime too to work when
105 `c-make-init-lang-vars-fun' needs to evaluate from source.
106
12006-02-24 Juanma Barranquero <lekktu@gmail.com> 1072006-02-24 Juanma Barranquero <lekktu@gmail.com>
2 108
3 * help.el (help): Revert last part of 2006-02-23 change (deletion 109 * help.el (help): Revert last part of 2006-02-23 change (deletion
@@ -5064,7 +5170,7 @@
5064 5170
50652005-11-29 Michael Kifer <kifer@cs.stonybrook.edu> 51712005-11-29 Michael Kifer <kifer@cs.stonybrook.edu>
5066 5172
5067 * ediff-wind (ediff-setup-control-frame, ediff-make-wide-display): 5173 * ediff-wind.el (ediff-setup-control-frame, ediff-make-wide-display):
5068 Preserve user position. 5174 Preserve user position.
5069 5175
50702005-11-28 Luc Teirlinck <teirllm@auburn.edu> 51762005-11-28 Luc Teirlinck <teirllm@auburn.edu>
@@ -5837,13 +5943,13 @@
5837 5943
58382005-11-15 Michael Kifer <kifer@cs.stonybrook.edu> 59442005-11-15 Michael Kifer <kifer@cs.stonybrook.edu>
5839 5945
5840 * viper-utils (viper-non-word-characters-reformed-vi): Quote `-' in 5946 * viper-utils.el (viper-non-word-characters-reformed-vi):
5841 string. 5947 Quote `-' in string.
5842 5948
5843 * viper.el (viper-emacs-state-mode-list): Ensure that 5949 * viper.el (viper-emacs-state-mode-list): Ensure that
5844 rcirc-mode buffers come up in Emacs state. 5950 rcirc-mode buffers come up in Emacs state.
5845 5951
5846 * ediff-util (ediff-make-temp-file): Use proper file-name-handler 5952 * ediff-util.el (ediff-make-temp-file): Use proper file-name-handler
5847 operation. 5953 operation.
5848 5954
58492005-11-15 Dan Nicolaescu <dann@ics.uci.edu> 59552005-11-15 Dan Nicolaescu <dann@ics.uci.edu>
diff --git a/lisp/ChangeLog.1 b/lisp/ChangeLog.1
index c903f0a2e97..4dd226b42a3 100644
--- a/lisp/ChangeLog.1
+++ b/lisp/ChangeLog.1
@@ -1565,7 +1565,7 @@
1565 Move rmail-delete-after-output from rmail.el. 1565 Move rmail-delete-after-output from rmail.el.
1566 Flush rmail-mmdf-inbox-list and rmail-make-summary-line-function. 1566 Flush rmail-mmdf-inbox-list and rmail-make-summary-line-function.
1567 1567
1568 * mail-utils (mail-strip-quoted-names): 1568 * mail-utils.el (mail-strip-quoted-names):
1569 Delete leading and trailing whitespace. 1569 Delete leading and trailing whitespace.
1570 1570
15711985-10-19 Richard M. Stallman (rms@mit-prep) 15711985-10-19 Richard M. Stallman (rms@mit-prep)
diff --git a/lisp/ChangeLog.10 b/lisp/ChangeLog.10
index 395ba326ce3..912dfd2761b 100644
--- a/lisp/ChangeLog.10
+++ b/lisp/ChangeLog.10
@@ -2916,7 +2916,7 @@
2916 (comment-valid-prefix-p): Rename from comment-valid-prefix 2916 (comment-valid-prefix-p): Rename from comment-valid-prefix
2917 and fix to actually use its argument. 2917 and fix to actually use its argument.
2918 2918
2919 * tex-mode (tex-mode-syntax-table): ~ is not whitespace. 2919 * tex-mode.el (tex-mode-syntax-table): ~ is not whitespace.
2920 (tex-guess-mode): Add `renewcommand'. 2920 (tex-guess-mode): Add `renewcommand'.
2921 (tex-mode): Move the autoload to get the correct docstring and usage. 2921 (tex-mode): Move the autoload to get the correct docstring and usage.
2922 2922
@@ -6170,7 +6170,7 @@
6170 6170
6171 Changes from 2002-02-28: 6171 Changes from 2002-02-28:
6172 6172
6173 * antlr-mode: Version 2.2 is released. 6173 * antlr-mode.el: Version 2.2 is released.
6174 6174
6175 * antlr-mode.el (antlr): Moved to SourceForge.net 6175 * antlr-mode.el (antlr): Moved to SourceForge.net
6176 6176
diff --git a/lisp/ido.el b/lisp/ido.el
index 77479de04d8..cae5446abcd 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -1181,25 +1181,19 @@ it doesn't interfere with other minibuffer usage.")
1181(defun ido-save-history () 1181(defun ido-save-history ()
1182 "Save ido history and cache information between sessions." 1182 "Save ido history and cache information between sessions."
1183 (interactive) 1183 (interactive)
1184 (if (and ido-last-directory-list ido-save-directory-list-file) 1184 (when (and ido-last-directory-list ido-save-directory-list-file)
1185 (save-excursion 1185 (let ((buf (get-buffer-create " *ido session*"))
1186 (save-window-excursion 1186 (version-control 'never))
1187 (if (find-buffer-visiting ido-save-directory-list-file) 1187 (unwind-protect
1188 (kill-buffer (find-buffer-visiting ido-save-directory-list-file))) 1188 (with-current-buffer buf
1189 (if (file-exists-p ido-save-directory-list-file) 1189 (erase-buffer)
1190 (delete-file ido-save-directory-list-file)) 1190 (ido-pp 'ido-last-directory-list)
1191 (set-buffer (let ((enable-local-variables nil)) 1191 (ido-pp 'ido-work-directory-list)
1192 (find-file-noselect ido-save-directory-list-file t))) 1192 (ido-pp 'ido-work-file-list)
1193 (goto-char (point-min)) 1193 (ido-pp 'ido-dir-file-cache "\n\n ")
1194 (delete-region (point-min) (point-max)) 1194 (insert "\n")
1195 (ido-pp 'ido-last-directory-list)
1196 (ido-pp 'ido-work-directory-list)
1197 (ido-pp 'ido-work-file-list)
1198 (ido-pp 'ido-dir-file-cache "\n\n ")
1199 (insert "\n")
1200 (let ((version-control 'never))
1201 (write-file ido-save-directory-list-file nil)) 1195 (write-file ido-save-directory-list-file nil))
1202 (kill-buffer (current-buffer)))))) 1196 (kill-buffer buf)))))
1203 1197
1204(defun ido-load-history (&optional arg) 1198(defun ido-load-history (&optional arg)
1205 "Load ido history and cache information from previous session. 1199 "Load ido history and cache information from previous session.
@@ -1209,18 +1203,18 @@ With prefix argument, reload history unconditionally."
1209 (let ((file (expand-file-name ido-save-directory-list-file)) 1203 (let ((file (expand-file-name ido-save-directory-list-file))
1210 buf) 1204 buf)
1211 (when (file-readable-p file) 1205 (when (file-readable-p file)
1212 (save-excursion 1206 (setq buf (get-buffer-create " *ido session*"))
1213 (save-window-excursion 1207 (unwind-protect
1214 (setq buf (set-buffer (let ((enable-local-variables nil)) 1208 (with-current-buffer buf
1215 (find-file-noselect file)))) 1209 (erase-buffer)
1216 (goto-char (point-min)) 1210 (insert-file-contents file)
1217 (condition-case nil 1211 (condition-case nil
1218 (setq ido-last-directory-list (read (current-buffer)) 1212 (setq ido-last-directory-list (read (current-buffer))
1219 ido-work-directory-list (read (current-buffer)) 1213 ido-work-directory-list (read (current-buffer))
1220 ido-work-file-list (read (current-buffer)) 1214 ido-work-file-list (read (current-buffer))
1221 ido-dir-file-cache (read (current-buffer))) 1215 ido-dir-file-cache (read (current-buffer)))
1222 (error nil)))) 1216 (error nil)))
1223 (kill-buffer buf)))) 1217 (kill-buffer buf)))))
1224 (ido-wash-history)) 1218 (ido-wash-history))
1225 1219
1226(defun ido-wash-history () 1220(defun ido-wash-history ()
diff --git a/lisp/progmodes/cc-align.el b/lisp/progmodes/cc-align.el
index 8420ec99636..f1d5121bec5 100644
--- a/lisp/progmodes/cc-align.el
+++ b/lisp/progmodes/cc-align.el
@@ -1,7 +1,7 @@
1;;; cc-align.el --- custom indentation functions for CC Mode 1;;; cc-align.el --- custom indentation functions for CC Mode
2 2
3;; Copyright (C) 1985,1987,1992-2003, 2004, 2005, 2006 3;; Copyright (C) 1985,1987,1992-2003, 2004, 2005, 2006 Free Software
4;; Free Software Foundation, Inc. 4;; Foundation, Inc.
5 5
6;; Authors: 1998- Martin Stjernholm 6;; Authors: 1998- Martin Stjernholm
7;; 1992-1999 Barry A. Warsaw 7;; 1992-1999 Barry A. Warsaw
diff --git a/lisp/progmodes/cc-awk.el b/lisp/progmodes/cc-awk.el
index 9f86638696c..284a2edbe94 100644
--- a/lisp/progmodes/cc-awk.el
+++ b/lisp/progmodes/cc-awk.el
@@ -1,7 +1,7 @@
1;;; cc-awk.el --- AWK specific code within cc-mode. 1;;; cc-awk.el --- AWK specific code within cc-mode.
2 2
3;; Copyright (C) 1988,94,96,2000, 2001, 2002, 2003, 2004, 2005, 2006 3;; Copyright (C) 1988,94,96,2000, 2001, 2002, 2003, 2004, 2005, 2006 Free
4;; Free Software Foundation, Inc. 4;; Software Foundation, Inc.
5 5
6;; Author: Alan Mackenzie <acm@muc.de> (originally based on awk-mode.el) 6;; Author: Alan Mackenzie <acm@muc.de> (originally based on awk-mode.el)
7;; Maintainer: FSF 7;; Maintainer: FSF
@@ -804,7 +804,7 @@
804(defun c-awk-end-of-change-region (beg end old-len) 804(defun c-awk-end-of-change-region (beg end old-len)
805 ;; Find the end of the region which needs to be font-locked after a change. 805 ;; Find the end of the region which needs to be font-locked after a change.
806 ;; This is the end of the logical line on which the change happened, either 806 ;; This is the end of the logical line on which the change happened, either
807 ;; as it was before the change, or as it is now, which ever is later. 807 ;; as it was before the change, or as it is now, whichever is later.
808 ;; N.B. point is left undefined. 808 ;; N.B. point is left undefined.
809 ;; 809 ;;
810 ;; This function might do hidden buffer changes. 810 ;; This function might do hidden buffer changes.
@@ -822,11 +822,12 @@
822 (unless (and (boundp 'font-lock-mode) font-lock-mode) 822 (unless (and (boundp 'font-lock-mode) font-lock-mode)
823 (save-restriction 823 (save-restriction
824 (save-excursion 824 (save-excursion
825 (setq end (c-awk-end-of-change-region beg end old-len)) 825 (save-match-data
826 (c-awk-beginning-of-logical-line beg) 826 (setq end (c-awk-end-of-change-region beg end old-len))
827 (c-save-buffer-state nil ; So that read-only status isn't affected. 827 (c-awk-beginning-of-logical-line beg)
828 (c-save-buffer-state nil ; So that read-only status isn't affected.
828 ; (e.g. when first loading the buffer) 829 ; (e.g. when first loading the buffer)
829 (c-awk-set-syntax-table-properties end)))))) 830 (c-awk-set-syntax-table-properties end)))))))
830 831
831;; ACM 2002/5/25. When font-locking is invoked by a buffer change, the region 832;; ACM 2002/5/25. When font-locking is invoked by a buffer change, the region
832;; specified by the font-lock after-change function must be expanded to 833;; specified by the font-lock after-change function must be expanded to
diff --git a/lisp/progmodes/cc-bytecomp.el b/lisp/progmodes/cc-bytecomp.el
index f001fa60b25..4a1e22d0c42 100644
--- a/lisp/progmodes/cc-bytecomp.el
+++ b/lisp/progmodes/cc-bytecomp.el
@@ -1,7 +1,7 @@
1;;; cc-bytecomp.el --- compile time setup for proper compilation 1;;; cc-bytecomp.el --- compile time setup for proper compilation
2 2
3;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 3;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software
4;; Free Software Foundation, Inc. 4;; Foundation, Inc.
5 5
6;; Author: Martin Stjernholm 6;; Author: Martin Stjernholm
7;; Maintainer: bug-cc-mode@gnu.org 7;; Maintainer: bug-cc-mode@gnu.org
diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el
index 4c8aa1518b7..8b2f5e57f83 100644
--- a/lisp/progmodes/cc-cmds.el
+++ b/lisp/progmodes/cc-cmds.el
@@ -1,7 +1,7 @@
1;;; cc-cmds.el --- user level commands for CC Mode 1;;; cc-cmds.el --- user level commands for CC Mode
2 2
3;; Copyright (C) 1985,1987,1992-2003, 2004, 2005, 2006 3;; Copyright (C) 1985, 1987, 1992-2003, 2004, 2005, 2006 Free Software
4;; Free Software Foundation, Inc. 4;; Foundation, Inc.
5 5
6;; Authors: 1998- Martin Stjernholm 6;; Authors: 1998- Martin Stjernholm
7;; 1992-1999 Barry A. Warsaw 7;; 1992-1999 Barry A. Warsaw
@@ -262,10 +262,17 @@ With universal argument, inserts the analysis as a comment on that line."
262 (boundp 'c-subword-mode) 262 (boundp 'c-subword-mode)
263 (symbol-value 'c-subword-mode)) 263 (symbol-value 'c-subword-mode))
264 "w" 264 "w"
265 "")))) 265 "")))
266 (setq c-submode-indicators 266 (bare-mode-name (if (string-match "\\(^[^/]*\\)/" mode-name)
267 (substring mode-name (match-beginning 1) (match-end 1))
268 mode-name)))
269;; (setq c-submode-indicators
270;; (if (> (length fmt) 1)
271;; fmt))
272 (setq mode-name
267 (if (> (length fmt) 1) 273 (if (> (length fmt) 1)
268 fmt)) 274 (concat bare-mode-name fmt)
275 bare-mode-name))
269 (force-mode-line-update))) 276 (force-mode-line-update)))
270 277
271(defun c-toggle-syntactic-indentation (&optional arg) 278(defun c-toggle-syntactic-indentation (&optional arg)
@@ -365,9 +372,9 @@ inside a literal then the function in the variable
365 arg 372 arg
366 (c-in-literal))) 373 (c-in-literal)))
367 (funcall c-backspace-function (prefix-numeric-value arg)) 374 (funcall c-backspace-function (prefix-numeric-value arg))
368 (c-hungry-backspace))) 375 (c-hungry-delete-backwards)))
369 376
370(defun c-hungry-backspace () 377(defun c-hungry-delete-backwards ()
371 "Delete the preceding character or all preceding whitespace 378 "Delete the preceding character or all preceding whitespace
372back to the previous non-whitespace character. 379back to the previous non-whitespace character.
373See also \\[c-hungry-delete-forward]." 380See also \\[c-hungry-delete-forward]."
@@ -378,6 +385,8 @@ See also \\[c-hungry-delete-forward]."
378 (delete-region (point) here) 385 (delete-region (point) here)
379 (funcall c-backspace-function 1)))) 386 (funcall c-backspace-function 1))))
380 387
388(defalias 'c-hungry-backspace 'c-hungry-delete-backwards)
389
381(defun c-electric-delete-forward (arg) 390(defun c-electric-delete-forward (arg)
382 "Delete the following character or whitespace. 391 "Delete the following character or whitespace.
383If `c-hungry-delete-key' is non-nil (indicated by \"/h\" on the mode 392If `c-hungry-delete-key' is non-nil (indicated by \"/h\" on the mode
@@ -396,7 +405,7 @@ is called."
396(defun c-hungry-delete-forward () 405(defun c-hungry-delete-forward ()
397 "Delete the following character or all following whitespace 406 "Delete the following character or all following whitespace
398up to the next non-whitespace character. 407up to the next non-whitespace character.
399See also \\[c-hungry-backspace]." 408See also \\[c-hungry-delete-backwards]."
400 (interactive) 409 (interactive)
401 (let ((here (point))) 410 (let ((here (point)))
402 (c-skip-ws-forward) 411 (c-skip-ws-forward)
@@ -436,7 +445,7 @@ function to control that."
436 (if (and (fboundp 'delete-forward-p) 445 (if (and (fboundp 'delete-forward-p)
437 (delete-forward-p)) 446 (delete-forward-p))
438 (c-hungry-delete-forward) 447 (c-hungry-delete-forward)
439 (c-hungry-backspace))) 448 (c-hungry-delete-backwards)))
440 449
441(defun c-electric-pound (arg) 450(defun c-electric-pound (arg)
442 "Insert a \"#\". 451 "Insert a \"#\".
@@ -648,7 +657,7 @@ If `c-electric-flag' is non-nil, the brace is not inside a literal and a
648numeric ARG hasn't been supplied, the command performs several electric 657numeric ARG hasn't been supplied, the command performs several electric
649actions: 658actions:
650 659
651\(a) If the auto-newline feature is turned on (indicated by \"/ln\" on 660\(a) If the auto-newline feature is turned on (indicated by \"/la\" on
652the mode line) newlines are inserted before and after the brace as 661the mode line) newlines are inserted before and after the brace as
653directed by the settings in `c-hanging-braces-alist'. 662directed by the settings in `c-hanging-braces-alist'.
654 663
@@ -752,7 +761,7 @@ settings of `c-cleanup-list' are done."
752 "{" 761 "{"
753 "\\=") 762 "\\=")
754 nil t)) 763 nil t))
755 (delete-region mbeg mend) 764 (delete-region (match-beginning 0) (match-end 0))
756 (insert-and-inherit "} else {")) 765 (insert-and-inherit "} else {"))
757 ((and (memq 'brace-elseif-brace c-cleanup-list) 766 ((and (memq 'brace-elseif-brace c-cleanup-list)
758 (progn 767 (progn
@@ -886,7 +895,7 @@ If `c-electric-flag' is non-nil, point isn't inside a literal and a
886numeric ARG hasn't been supplied, the command performs several electric 895numeric ARG hasn't been supplied, the command performs several electric
887actions: 896actions:
888 897
889\(a) When the auto-newline feature is turned on (indicated by \"/ln\" on 898\(a) When the auto-newline feature is turned on (indicated by \"/la\" on
890the mode line) a newline might be inserted. See the variable 899the mode line) a newline might be inserted. See the variable
891`c-hanging-semi&comma-criteria' for how newline insertion is determined. 900`c-hanging-semi&comma-criteria' for how newline insertion is determined.
892 901
@@ -958,7 +967,7 @@ If `c-electric-flag' is non-nil, the colon is not inside a literal and a
958numeric ARG hasn't been supplied, the command performs several electric 967numeric ARG hasn't been supplied, the command performs several electric
959actions: 968actions:
960 969
961\(a) If the auto-newline feature is turned on (indicated by \"/ln\" on 970\(a) If the auto-newline feature is turned on (indicated by \"/la\" on
962the mode line) newlines are inserted before and after the colon based on 971the mode line) newlines are inserted before and after the colon based on
963the settings in `c-hanging-colons-alist'. 972the settings in `c-hanging-colons-alist'.
964 973
diff --git a/lisp/progmodes/cc-compat.el b/lisp/progmodes/cc-compat.el
index 0cd7973857c..59cd5232402 100644
--- a/lisp/progmodes/cc-compat.el
+++ b/lisp/progmodes/cc-compat.el
@@ -1,7 +1,7 @@
1;;; cc-compat.el --- cc-mode compatibility with c-mode.el confusion 1;;; cc-compat.el --- cc-mode compatibility with c-mode.el confusion
2 2
3;; Copyright (C) 1985,1987,1992-2003, 2004, 2005, 2006 3;; Copyright (C) 1985,1987,1992-2003, 2004, 2005, 2006 Free Software
4;; Free Software Foundation, Inc. 4;; Foundation, Inc.
5 5
6;; Authors: 1998- Martin Stjernholm 6;; Authors: 1998- Martin Stjernholm
7;; 1994-1999 Barry A. Warsaw 7;; 1994-1999 Barry A. Warsaw
diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el
index 0053cfcf443..d39c4880dcc 100644
--- a/lisp/progmodes/cc-defs.el
+++ b/lisp/progmodes/cc-defs.el
@@ -1,7 +1,7 @@
1;;; cc-defs.el --- compile time definitions for CC Mode 1;;; cc-defs.el --- compile time definitions for CC Mode
2 2
3;; Copyright (C) 1985,1987,1992-2003, 2004, 2005, 2006 3;; Copyright (C) 1985,1987,1992-2003, 2004, 2005, 2006 Free Software
4;; Free Software Foundation, Inc. 4;; Foundation, Inc.
5 5
6;; Authors: 1998- Martin Stjernholm 6;; Authors: 1998- Martin Stjernholm
7;; 1992-1999 Barry A. Warsaw 7;; 1992-1999 Barry A. Warsaw
@@ -71,10 +71,10 @@
71 71
72(eval-after-load "font-lock" 72(eval-after-load "font-lock"
73 '(if (and (not (featurep 'cc-fix)) ; only load the file once. 73 '(if (and (not (featurep 'cc-fix)) ; only load the file once.
74 (featurep 'xemacs) ; There is now (2005/12) code in GNU Emacs CVS
75 ; to make the call to f-l-c-k throw an error.
74 (let (font-lock-keywords) 76 (let (font-lock-keywords)
75 (condition-case nil 77 (font-lock-compile-keywords '("\\<\\>"))
76 (font-lock-compile-keywords '("\\<\\>"))
77 (error nil))
78 font-lock-keywords)) ; did the previous call foul this up? 78 font-lock-keywords)) ; did the previous call foul this up?
79 (load "cc-fix"))) 79 (load "cc-fix")))
80 80
@@ -82,19 +82,18 @@
82;; to ensure correct byte compilation. 82;; to ensure correct byte compilation.
83(eval-when-compile 83(eval-when-compile
84 (if (and (not (featurep 'cc-fix)) 84 (if (and (not (featurep 'cc-fix))
85 (featurep 'xemacs)
85 (progn 86 (progn
86 (require 'font-lock) 87 (require 'font-lock)
87 (let (font-lock-keywords) 88 (let (font-lock-keywords)
88 (condition-case nil 89 (font-lock-compile-keywords '("\\<\\>"))
89 (font-lock-compile-keywords '("\\<\\>"))
90 (error nil))
91 font-lock-keywords))) 90 font-lock-keywords)))
92 (cc-load "cc-fix"))) 91 (cc-load "cc-fix")))
93 92
94 93
95;;; Variables also used at compile time. 94;;; Variables also used at compile time.
96 95
97(defconst c-version "5.31" 96(defconst c-version "5.31.3"
98 "CC Mode version number.") 97 "CC Mode version number.")
99 98
100(defconst c-version-sym (intern c-version)) 99(defconst c-version-sym (intern c-version))
@@ -2041,5 +2040,5 @@ quoted."
2041 2040
2042(cc-provide 'cc-defs) 2041(cc-provide 'cc-defs)
2043 2042
2044;; arch-tag: 3bb2629d-dd84-4ff0-ad39-584be0fe3cda 2043;;; arch-tag: 3bb2629d-dd84-4ff0-ad39-584be0fe3cda
2045;;; cc-defs.el ends here 2044;;; cc-defs.el ends here
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 548fc74d961..32c82eb1c1d 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -1,7 +1,7 @@
1;;; cc-engine.el --- core syntax guessing engine for CC mode 1;;; cc-engine.el --- core syntax guessing engine for CC mode
2 2
3;; Copyright (C) 1985,1987,1992-2003, 2004, 2005, 2006 3;; Copyright (C) 1985,1987,1992-2003, 2004, 2005, 2006 Free Software Foundation,
4;; Free Software Foundation, Inc. 4;; Inc.
5 5
6;; Authors: 1998- Martin Stjernholm 6;; Authors: 1998- Martin Stjernholm
7;; 1992-1999 Barry A. Warsaw 7;; 1992-1999 Barry A. Warsaw
@@ -179,8 +179,8 @@
179(make-variable-buffer-local 'c-auto-newline) 179(make-variable-buffer-local 'c-auto-newline)
180 180
181;; Included in the mode line to indicate the active submodes. 181;; Included in the mode line to indicate the active submodes.
182(defvar c-submode-indicators nil) 182;; (defvar c-submode-indicators nil)
183(make-variable-buffer-local 'c-submode-indicators) 183;; (make-variable-buffer-local 'c-submode-indicators)
184 184
185(defun c-calculate-state (arg prevstate) 185(defun c-calculate-state (arg prevstate)
186 ;; Calculate the new state of PREVSTATE, t or nil, based on arg. If 186 ;; Calculate the new state of PREVSTATE, t or nil, based on arg. If
@@ -525,14 +525,15 @@ also stop at a continuation clause.
525 525
526Labels are treated as part of the following statements if 526Labels are treated as part of the following statements if
527IGNORE-LABELS is non-nil. (FIXME: Doesn't work if we stop at a known 527IGNORE-LABELS is non-nil. (FIXME: Doesn't work if we stop at a known
528statement start keyword.) 528statement start keyword.) Otherwise, each label is treated as a
529separate statement.
529 530
530Macros are ignored unless point is within one, in which case the 531Macros are ignored \(i.e. skipped over) unless point is within one, in
531content of the macro is treated as normal code. Aside from any normal 532which case the content of the macro is treated as normal code. Aside
532statement starts found in it, stop at the first token of the content 533from any normal statement starts found in it, stop at the first token
533in the macro, i.e. the expression of an \"#if\" or the start of the 534of the content in the macro, i.e. the expression of an \"#if\" or the
534definition in a \"#define\". Also stop at start of macros before 535start of the definition in a \"#define\". Also stop at start of
535leaving them. 536macros before leaving them.
536 537
537Return 'label if stopped at a label, 'same if stopped at the beginning 538Return 'label if stopped at a label, 'same if stopped at the beginning
538of the current statement, 'up if stepped to a containing statement, 539of the current statement, 'up if stepped to a containing statement,
@@ -547,8 +548,9 @@ position if that is less ('same is returned in this case).
547 548
548NOERROR turns off error logging to `c-parsing-error'. 549NOERROR turns off error logging to `c-parsing-error'.
549 550
550Normally only ';' is considered to delimit statements, but if 551Normally only ';' and virtual semicolons are considered to delimit
551COMMA-DELIM is non-nil then ',' is treated likewise. 552statements, but if COMMA-DELIM is non-nil then ',' is treated
553as a delimiter too.
552 554
553Note that this function might do hidden buffer changes. See the 555Note that this function might do hidden buffer changes. See the
554comment at the start of cc-engine.el for more info." 556comment at the start of cc-engine.el for more info."
@@ -883,6 +885,7 @@ comment at the start of cc-engine.el for more info."
883 ;; barriers in this round. 885 ;; barriers in this round.
884 (sexp-loop-end-pos pos)) 886 (sexp-loop-end-pos pos))
885 887
888 ;; The following while goes back one sexp per iteration.
886 (while 889 (while
887 (progn 890 (progn
888 (unless (c-safe (c-backward-sexp) t) 891 (unless (c-safe (c-backward-sexp) t)
@@ -954,7 +957,7 @@ comment at the start of cc-engine.el for more info."
954 ;; Like a C "continue". Analyze the next sexp. 957 ;; Like a C "continue". Analyze the next sexp.
955 (throw 'loop t))) 958 (throw 'loop t)))
956 959
957 sexp-loop-continue-pos) 960 sexp-loop-continue-pos) ; End of "go back a sexp" loop.
958 (goto-char sexp-loop-continue-pos) 961 (goto-char sexp-loop-continue-pos)
959 (setq sexp-loop-end-pos sexp-loop-continue-pos 962 (setq sexp-loop-end-pos sexp-loop-continue-pos
960 sexp-loop-continue-pos nil)))) 963 sexp-loop-continue-pos nil))))
@@ -969,17 +972,26 @@ comment at the start of cc-engine.el for more info."
969 ;; Handle labels. 972 ;; Handle labels.
970 (unless (eq ignore-labels t) 973 (unless (eq ignore-labels t)
971 (when (numberp c-maybe-labelp) 974 (when (numberp c-maybe-labelp)
972 ;; `c-crosses-statement-barrier-p' has found a 975 ;; `c-crosses-statement-barrier-p' has found a colon, so we
973 ;; colon, so we might be in a label now. 976 ;; might be in a label now. Have we got a real label
974 (if after-labels-pos 977 ;; (including a case label) or something like C++'s "public:"?
975 (if (not last-label-pos) 978 (if (or (not (looking-at c-nonlabel-token-key)) ; proper label
976 (setq last-label-pos (or tok start))) 979 (save-excursion ; e.g. "case 'a':" ?
977 (setq after-labels-pos (or tok start))) 980 (and (c-safe (c-backward-sexp) t)
978 (setq c-maybe-labelp t 981 (looking-at "\\<case\\>")))) ; FIXME!!! this is
979 label-good-pos nil)) 982 ; wrong for AWK. 2006/1/14.
980 983 (progn
981 (when (and (not label-good-pos) 984 (if after-labels-pos ; Have we already encountered a label?
982 (looking-at c-nonlabel-token-key)) 985 (if (not last-label-pos)
986 (setq last-label-pos (or tok start)))
987 (setq after-labels-pos (or tok start)))
988 (setq c-maybe-labelp t
989 label-good-pos nil))
990 (setq c-maybe-labelp nil))) ; bogus "label"
991
992 (when (and (not label-good-pos) ; i.e. no invalid "label"'s yet
993 ; been found.
994 (looking-at c-nonlabel-token-key)) ; e.g. "while :"
983 ;; We're in a potential label and it's the first 995 ;; We're in a potential label and it's the first
984 ;; time we've found something that isn't allowed in 996 ;; time we've found something that isn't allowed in
985 ;; one. 997 ;; one.
@@ -3993,36 +4005,35 @@ comment at the start of cc-engine.el for more info."
3993 ;; 4005 ;;
3994 ;; This function might do hidden buffer changes. 4006 ;; This function might do hidden buffer changes.
3995 4007
3996 (save-match-data 4008 (save-excursion
3997 (save-excursion 4009 (goto-char beg)
4010 (when (or (looking-at "[<>]")
4011 (< (skip-chars-backward "<>") 0))
4012
3998 (goto-char beg) 4013 (goto-char beg)
4014 (c-beginning-of-current-token)
4015 (when (and (< (point) beg)
4016 (looking-at c-<>-multichar-token-regexp)
4017 (< beg (setq beg (match-end 0))))
4018 (while (progn (skip-chars-forward "^<>" beg)
4019 (< (point) beg))
4020 (c-clear-char-property (point) 'syntax-table)
4021 (forward-char))))
4022
4023 (when (< beg end)
4024 (goto-char end)
3999 (when (or (looking-at "[<>]") 4025 (when (or (looking-at "[<>]")
4000 (< (skip-chars-backward "<>") 0)) 4026 (< (skip-chars-backward "<>") 0))
4001 4027
4002 (goto-char beg) 4028 (goto-char end)
4003 (c-beginning-of-current-token) 4029 (c-beginning-of-current-token)
4004 (when (and (< (point) beg) 4030 (when (and (< (point) end)
4005 (looking-at c-<>-multichar-token-regexp) 4031 (looking-at c-<>-multichar-token-regexp)
4006 (< beg (setq beg (match-end 0)))) 4032 (< end (setq end (match-end 0))))
4007 (while (progn (skip-chars-forward "^<>" beg) 4033 (while (progn (skip-chars-forward "^<>" end)
4008 (< (point) beg)) 4034 (< (point) end))
4009 (c-clear-char-property (point) 'syntax-table) 4035 (c-clear-char-property (point) 'syntax-table)
4010 (forward-char)))) 4036 (forward-char)))))))
4011
4012 (when (< beg end)
4013 (goto-char end)
4014 (when (or (looking-at "[<>]")
4015 (< (skip-chars-backward "<>") 0))
4016
4017 (goto-char end)
4018 (c-beginning-of-current-token)
4019 (when (and (< (point) end)
4020 (looking-at c-<>-multichar-token-regexp)
4021 (< end (setq end (match-end 0))))
4022 (while (progn (skip-chars-forward "^<>" end)
4023 (< (point) end))
4024 (c-clear-char-property (point) 'syntax-table)
4025 (forward-char))))))))
4026 4037
4027;; Dynamically bound variable that instructs `c-forward-type' to also 4038;; Dynamically bound variable that instructs `c-forward-type' to also
4028;; treat possible types (i.e. those that it normally returns 'maybe or 4039;; treat possible types (i.e. those that it normally returns 'maybe or
@@ -5991,7 +6002,10 @@ y ;; True if there's a suffix match outside the outermost
5991 6002
5992 ;; Handle the name of the class itself. 6003 ;; Handle the name of the class itself.
5993 (progn 6004 (progn
5994 (c-forward-token-2) 6005; (c-forward-token-2) ; 2006/1/13 This doesn't move if the token's
6006; at EOB.
6007 (goto-char (match-end 0))
6008 (c-skip-ws-forward)
5995 (c-forward-type)) 6009 (c-forward-type))
5996 6010
5997 (catch 'break 6011 (catch 'break
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index bea3b4f7e8c..b02df16b4f5 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -1,7 +1,7 @@
1;;; cc-langs.el --- language specific settings for CC Mode 1;;; cc-langs.el --- language specific settings for CC Mode
2 2
3;; Copyright (C) 1985,1987,1992-2003, 2004, 2005, 2006 3;; Copyright (C) 1985,1987,1992-2003, 2004, 2005, 2006 Free Software
4;; Free Software Foundation, Inc. 4;; Foundation, Inc.
5 5
6;; Authors: 1998- Martin Stjernholm 6;; Authors: 1998- Martin Stjernholm
7;; 1992-1999 Barry A. Warsaw 7;; 1992-1999 Barry A. Warsaw
@@ -177,7 +177,7 @@ the evaluated constant value at compile time."
177 '(def-edebug-spec c-lang-defvar 177 '(def-edebug-spec c-lang-defvar
178 (&define name def-form &optional stringp))) 178 (&define name def-form &optional stringp)))
179 179
180(eval-when-compile 180(eval-and-compile
181 ;; Some helper functions used when building the language constants. 181 ;; Some helper functions used when building the language constants.
182 182
183 (defun c-filter-ops (ops opgroup-filter op-filter &optional xlate) 183 (defun c-filter-ops (ops opgroup-filter op-filter &optional xlate)
@@ -260,10 +260,14 @@ the evaluated constant value at compile time."
260 ("Toggle..." 260 ("Toggle..."
261 ["Syntactic indentation" c-toggle-syntactic-indentation 261 ["Syntactic indentation" c-toggle-syntactic-indentation
262 :style toggle :selected c-syntactic-indentation] 262 :style toggle :selected c-syntactic-indentation]
263 ["Auto newline" c-toggle-auto-newline 263 ["Electric mode" c-toggle-electric-state
264 :style toggle :selected c-electric-flag]
265 ["Auto newline" c-toggle-auto-newline
264 :style toggle :selected c-auto-newline] 266 :style toggle :selected c-auto-newline]
265 ["Hungry delete" c-toggle-hungry-state 267 ["Hungry delete" c-toggle-hungry-state
266 :style toggle :selected c-hungry-delete-key]))) 268 :style toggle :selected c-hungry-delete-key]
269 ["Subword mode" c-subword-mode
270 :style toggle :selected c-subword-mode])))
267 271
268 272
269;;; Syntax tables. 273;;; Syntax tables.
@@ -2826,7 +2830,7 @@ accomplish that conveniently."
2826 ;; This let sets up the context for `c-mode-var' and similar 2830 ;; This let sets up the context for `c-mode-var' and similar
2827 ;; that could be in the result from `cl-macroexpand-all'. 2831 ;; that could be in the result from `cl-macroexpand-all'.
2828 (let ((c-buffer-is-cc-mode ',mode) 2832 (let ((c-buffer-is-cc-mode ',mode)
2829 current-var) 2833 current-var source-eval)
2830 (condition-case err 2834 (condition-case err
2831 2835
2832 (if (eq c-version-sym ',c-version-sym) 2836 (if (eq c-version-sym ',c-version-sym)
@@ -2852,6 +2856,7 @@ accomplish that conveniently."
2852 ;; (put ',mode 'c-has-warned-lang-consts t)) 2856 ;; (put ',mode 'c-has-warned-lang-consts t))
2853 2857
2854 (require 'cc-langs) 2858 (require 'cc-langs)
2859 (setq source-eval t)
2855 (let ((init (cdr c-lang-variable-inits))) 2860 (let ((init (cdr c-lang-variable-inits)))
2856 (while init 2861 (while init
2857 (setq current-var (caar init)) 2862 (setq current-var (caar init))
@@ -2860,8 +2865,14 @@ accomplish that conveniently."
2860 2865
2861 (error 2866 (error
2862 (if current-var 2867 (if current-var
2863 (message "Eval error in the `c-lang-defvar' for `%s': %S" 2868 (message "Eval error in the `c-lang-defvar' for `%s'%s: %S"
2864 current-var err) 2869 current-var
2870 (if source-eval
2871 (format "\
2872 (fallback source eval - %s compiled with CC Mode %s but loaded with %s)"
2873 ',mode ,c-version c-version)
2874 "")
2875 err)
2865 (signal (car err) (cdr err))))))) 2876 (signal (car err) (cdr err)))))))
2866 2877
2867 ;; Being evaluated from source. Always use the dynamic method to 2878 ;; Being evaluated from source. Always use the dynamic method to
@@ -2881,8 +2892,9 @@ accomplish that conveniently."
2881 2892
2882 (error 2893 (error
2883 (if current-var 2894 (if current-var
2884 (message "Eval error in the `c-lang-defvar' for `%s': %S" 2895 (message
2885 current-var err) 2896 "Eval error in the `c-lang-defvar' for `%s' (source eval): %S"
2897 current-var err)
2886 (signal (car err) (cdr err))))))) 2898 (signal (car err) (cdr err)))))))
2887 )) 2899 ))
2888 2900
diff --git a/lisp/progmodes/cc-menus.el b/lisp/progmodes/cc-menus.el
index 418823b71fa..b925d1e653c 100644
--- a/lisp/progmodes/cc-menus.el
+++ b/lisp/progmodes/cc-menus.el
@@ -1,7 +1,7 @@
1;;; cc-menus.el --- imenu support for CC Mode 1;;; cc-menus.el --- imenu support for CC Mode
2 2
3;; Copyright (C) 1985,1987,1992-2003, 2004, 2005, 2006 3;; Copyright (C) 1985,1987,1992-2003, 2004, 2005, 2006 Free Software
4;; Free Software Foundation, Inc. 4;; Foundation, Inc.
5 5
6;; Authors: 1998- Martin Stjernholm 6;; Authors: 1998- Martin Stjernholm
7;; 1992-1999 Barry A. Warsaw 7;; 1992-1999 Barry A. Warsaw
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 3994fe5cf09..9eebdb2bb7f 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -1,7 +1,7 @@
1;;; cc-mode.el --- major mode for editing C and similar languages 1;;; cc-mode.el --- major mode for editing C and similar languages
2 2
3;; Copyright (C) 1985,1987,1992-2003, 2004, 2005, 2006 3;; Copyright (C) 1985,1987,1992-2003, 2004, 2005, 2006 Free Software
4;; Free Software Foundation, Inc. 4;; Foundation, Inc.
5 5
6;; Authors: 2003- Alan Mackenzie 6;; Authors: 2003- Alan Mackenzie
7;; 1998- Martin Stjernholm 7;; 1998- Martin Stjernholm
@@ -242,9 +242,9 @@ control). See \"cc-mode.el\" for more info."
242 (define-key c-mode-base-map (kbd "C-c C-<delete>") 242 (define-key c-mode-base-map (kbd "C-c C-<delete>")
243 'c-hungry-delete-forward) 243 'c-hungry-delete-forward)
244 (define-key c-mode-base-map (kbd "C-c C-<backspace>") 244 (define-key c-mode-base-map (kbd "C-c C-<backspace>")
245 'c-hungry-backspace)) 245 'c-hungry-delete-backwards))
246 (define-key c-mode-base-map (kbd "C-c C-<delete>") 246 (define-key c-mode-base-map (kbd "C-c C-<delete>")
247 'c-hungry-backspace) 247 'c-hungry-delete-backwards)
248 (define-key c-mode-base-map (kbd "C-c C-<backspace>") 248 (define-key c-mode-base-map (kbd "C-c C-<backspace>")
249 'c-hungry-delete-forward))) 249 'c-hungry-delete-forward)))
250 250
@@ -304,10 +304,11 @@ control). See \"cc-mode.el\" for more info."
304 ;; `c-electric-backspace'. The hungry variants are bound to the 304 ;; `c-electric-backspace'. The hungry variants are bound to the
305 ;; same keys but prefixed with C-c. This implies that C-c C-d is 305 ;; same keys but prefixed with C-c. This implies that C-c C-d is
306 ;; `c-hungry-delete-forward'. For consistency, we bind not only C-c 306 ;; `c-hungry-delete-forward'. For consistency, we bind not only C-c
307 ;; <backspace> to `c-hungry-backspace' but also C-c C-<backspace>, 307 ;; <backspace> to `c-hungry-delete-backwards' but also
308 ;; so that the Ctrl key can be held down during the whole sequence 308 ;; C-c C-<backspace>, so that the Ctrl key can be held down during
309 ;; regardless of the direction. This in turn implies that we bind 309 ;; the whole sequence regardless of the direction. This in turn
310 ;; C-c C-<delete> to `c-hungry-delete-forward', for the same reason. 310 ;; implies that we bind C-c C-<delete> to `c-hungry-delete-forward',
311 ;; for the same reason.
311 312
312 ;; Bind the electric deletion functions to C-d and DEL. Emacs 21 313 ;; Bind the electric deletion functions to C-d and DEL. Emacs 21
313 ;; automatically maps the [delete] and [backspace] keys to these two 314 ;; automatically maps the [delete] and [backspace] keys to these two
@@ -316,8 +317,8 @@ control). See \"cc-mode.el\" for more info."
316 (define-key c-mode-base-map "\C-d" 'c-electric-delete-forward) 317 (define-key c-mode-base-map "\C-d" 'c-electric-delete-forward)
317 (define-key c-mode-base-map "\177" 'c-electric-backspace) 318 (define-key c-mode-base-map "\177" 'c-electric-backspace)
318 (define-key c-mode-base-map "\C-c\C-d" 'c-hungry-delete-forward) 319 (define-key c-mode-base-map "\C-c\C-d" 'c-hungry-delete-forward)
319 (define-key c-mode-base-map [?\C-c ?\d] 'c-hungry-backspace) 320 (define-key c-mode-base-map [?\C-c ?\d] 'c-hungry-delete-backwards)
320 (define-key c-mode-base-map [?\C-c ?\C-\d] 'c-hungry-backspace) 321 (define-key c-mode-base-map [?\C-c ?\C-\d] 'c-hungry-delete-backwards)
321 (define-key c-mode-base-map [?\C-c deletechar] 'c-hungry-delete-forward) ; C-c <delete> on a tty. 322 (define-key c-mode-base-map [?\C-c deletechar] 'c-hungry-delete-forward) ; C-c <delete> on a tty.
322 (define-key c-mode-base-map [?\C-c (control deletechar)] ; C-c C-<delete> on a tty. 323 (define-key c-mode-base-map [?\C-c (control deletechar)] ; C-c C-<delete> on a tty.
323 'c-hungry-delete-forward) 324 'c-hungry-delete-forward)
@@ -339,8 +340,10 @@ control). See \"cc-mode.el\" for more info."
339 (define-key c-mode-base-map [backspace] 'c-electric-backspace) 340 (define-key c-mode-base-map [backspace] 'c-electric-backspace)
340 (define-key c-mode-base-map (kbd "C-c <delete>") 'c-hungry-delete) 341 (define-key c-mode-base-map (kbd "C-c <delete>") 'c-hungry-delete)
341 (define-key c-mode-base-map (kbd "C-c C-<delete>") 'c-hungry-delete) 342 (define-key c-mode-base-map (kbd "C-c C-<delete>") 'c-hungry-delete)
342 (define-key c-mode-base-map (kbd "C-c <backspace>") 'c-hungry-backspace) 343 (define-key c-mode-base-map (kbd "C-c <backspace>")
343 (define-key c-mode-base-map (kbd "C-c C-<backspace>") 'c-hungry-backspace)) 344 'c-hungry-delete-backwards)
345 (define-key c-mode-base-map (kbd "C-c C-<backspace>")
346 'c-hungry-delete-backwards))
344 347
345 (define-key c-mode-base-map "#" 'c-electric-pound) 348 (define-key c-mode-base-map "#" 'c-electric-pound)
346 (define-key c-mode-base-map "{" 'c-electric-brace) 349 (define-key c-mode-base-map "{" 'c-electric-brace)
@@ -414,23 +417,24 @@ preferably use the `c-mode-menu' language constant directly."
414 ;; with regions outside the current narrowing. This has been 417 ;; with regions outside the current narrowing. This has been
415 ;; observed in Emacs 20.7. 418 ;; observed in Emacs 20.7.
416 (save-restriction 419 (save-restriction
417 (widen) 420 (save-match-data ; c-recognize-<>-arglists changes match-data
421 (widen)
418 422
419 (when (> end (point-max)) 423 (when (> end (point-max))
420 ;; Some emacsen might return positions past the end. This has been 424 ;; Some emacsen might return positions past the end. This has been
421 ;; observed in Emacs 20.7 when rereading a buffer changed on disk 425 ;; observed in Emacs 20.7 when rereading a buffer changed on disk
422 ;; (haven't been able to minimize it, but Emacs 21.3 appears to 426 ;; (haven't been able to minimize it, but Emacs 21.3 appears to
423 ;; work). 427 ;; work).
424 (setq end (point-max)) 428 (setq end (point-max))
425 (when (> beg end) 429 (when (> beg end)
426 (setq beg end))) 430 (setq beg end)))
427 431
428 (c-invalidate-sws-region-after beg end) 432 (c-invalidate-sws-region-after beg end)
429 (c-invalidate-state-cache beg) 433 (c-invalidate-state-cache beg)
430 (c-invalidate-find-decl-cache beg) 434 (c-invalidate-find-decl-cache beg)
431 435
432 (when c-recognize-<>-arglists 436 (when c-recognize-<>-arglists
433 (c-after-change-check-<>-operators beg end))))) 437 (c-after-change-check-<>-operators beg end))))))
434 438
435(defun c-basic-common-init (mode default-style) 439(defun c-basic-common-init (mode default-style)
436 "Do the necessary initialization for the syntax handling routines 440 "Do the necessary initialization for the syntax handling routines
@@ -550,11 +554,12 @@ that requires a literal mode spec at compile time."
550 (make-local-variable 'comment-indent-function) 554 (make-local-variable 'comment-indent-function)
551 (setq comment-indent-function 'c-comment-indent) 555 (setq comment-indent-function 'c-comment-indent)
552 556
553 ;; Put submode indicators onto minor-mode-alist, but only once. 557;; ;; Put submode indicators onto minor-mode-alist, but only once.
554 (or (assq 'c-submode-indicators minor-mode-alist) 558;; (or (assq 'c-submode-indicators minor-mode-alist)
555 (setq minor-mode-alist 559;; (setq minor-mode-alist
556 (cons '(c-submode-indicators c-submode-indicators) 560;; (cons '(c-submode-indicators c-submode-indicators)
557 minor-mode-alist))) 561;; minor-mode-alist)))
562 (c-update-modeline)
558 563
559 ;; Install the functions that ensure that various internal caches 564 ;; Install the functions that ensure that various internal caches
560 ;; don't become invalid due to buffer changes. 565 ;; don't become invalid due to buffer changes.
@@ -629,6 +634,51 @@ compatible with old code; callers should always specify it."
629 (and (cdr rfn) 634 (and (cdr rfn)
630 (setq require-final-newline mode-require-final-newline))))) 635 (setq require-final-newline mode-require-final-newline)))))
631 636
637(defun c-remove-any-local-eval-or-mode-variables ()
638 ;; If the buffer specifies `mode' or `eval' in its File Local Variable list
639 ;; or on the first line, remove all occurrences. See
640 ;; `c-postprocess-file-styles' for justification. There is no need to save
641 ;; point here, or even bother too much about the buffer contents.
642 ;;
643 ;; Most of the code here is derived from Emacs 21.3's `hack-local-variables'
644 ;; in files.el.
645 (goto-char (point-max))
646 (search-backward "\n\^L" (max (- (point-max) 3000) (point-min)) 'move)
647 (let (lv-point (prefix "") (suffix ""))
648 (when (let ((case-fold-search t))
649 (search-forward "Local Variables:" nil t))
650 (setq lv-point (point))
651 ;; The prefix is what comes before "local variables:" in its line.
652 ;; The suffix is what comes after "local variables:" in its line.
653 (skip-chars-forward " \t")
654 (or (eolp)
655 (setq suffix (buffer-substring (point)
656 (progn (end-of-line) (point)))))
657 (goto-char (match-beginning 0))
658 (or (bolp)
659 (setq prefix
660 (buffer-substring (point)
661 (progn (beginning-of-line) (point)))))
662
663 (while (search-forward-regexp
664 (concat "^[ \t]*"
665 (regexp-quote prefix)
666 "\\(mode\\|eval\\):.*"
667 (regexp-quote suffix)
668 "$")
669 nil t)
670 (beginning-of-line)
671 (kill-line 1)))
672
673 ;; Delete the first line, if we've got one, in case it contains a mode spec.
674 (unless (and lv-point
675 (progn (goto-char lv-point)
676 (forward-line 0)
677 (bobp)))
678 (goto-char (point-min))
679 (unless (eobp)
680 (kill-line 1)))))
681
632(defun c-postprocess-file-styles () 682(defun c-postprocess-file-styles ()
633 "Function that post processes relevant file local variables in CC Mode. 683 "Function that post processes relevant file local variables in CC Mode.
634Currently, this function simply applies any style and offset settings 684Currently, this function simply applies any style and offset settings
@@ -656,12 +706,20 @@ Note that the style variables are always made local to the buffer."
656 ;; overwritten this. So we run `hack-local-variables' again to remedy 706 ;; overwritten this. So we run `hack-local-variables' again to remedy
657 ;; this. There are no guarantees this will work properly, particularly as 707 ;; this. There are no guarantees this will work properly, particularly as
658 ;; we have no control over what the other hook functions on 708 ;; we have no control over what the other hook functions on
659 ;; `hack-local-variables-hook' would have done, or what any "eval" 709 ;; `hack-local-variables-hook' would have done. We now (2006/2/1) remove
660 ;; expression will do when evaluated again. C'est la vie! ACM, 710 ;; any `eval' or `mode' expressions before we evaluate again (see below).
661 ;; 2005/11/2. 711 ;; ACM, 2005/11/2.
712 ;;
713 ;; Problem (bug reported by Gustav Broberg): if one of the variables is
714 ;; `mode', this will invoke c-mode (etc.) again, setting up the style etc.
715 ;; We prevent this by temporarily removing `mode' from the Local Variables
716 ;; section.
662 (if (or c-file-style c-file-offsets) 717 (if (or c-file-style c-file-offsets)
663 (let ((hack-local-variables-hook nil)) 718 (c-tentative-buffer-changes
664 (hack-local-variables))))) 719 (let ((hack-local-variables-hook nil))
720 (c-remove-any-local-eval-or-mode-variables)
721 (hack-local-variables))
722 nil))))
665 723
666(add-hook 'hack-local-variables-hook 'c-postprocess-file-styles) 724(add-hook 'hack-local-variables-hook 'c-postprocess-file-styles)
667 725
diff --git a/lisp/progmodes/cc-styles.el b/lisp/progmodes/cc-styles.el
index 758720a3fd6..6f623623535 100644
--- a/lisp/progmodes/cc-styles.el
+++ b/lisp/progmodes/cc-styles.el
@@ -1,7 +1,7 @@
1;;; cc-styles.el --- support for styles in CC Mode 1;;; cc-styles.el --- support for styles in CC Mode
2 2
3;; Copyright (C) 1985,1987,1992-2003, 2004, 2005, 2006 3;; Copyright (C) 1985,1987,1992-2003, 2004, 2005, 2006 Free Software
4;; Free Software Foundation, Inc. 4;; Foundation, Inc.
5 5
6;; Authors: 1998- Martin Stjernholm 6;; Authors: 1998- Martin Stjernholm
7;; 1992-1999 Barry A. Warsaw 7;; 1992-1999 Barry A. Warsaw
diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el
index 9bde0c5dbaf..ee187408701 100644
--- a/lisp/progmodes/cc-vars.el
+++ b/lisp/progmodes/cc-vars.el
@@ -1,7 +1,7 @@
1;;; cc-vars.el --- user customization variables for CC Mode 1;;; cc-vars.el --- user customization variables for CC Mode
2 2
3;; Copyright (C) 1985,1987,1992-2003, 2004, 2005, 2006 3;; Copyright (C) 1985,1987,1992-2003, 2004, 2005, 2006 Free Software
4;; Free Software Foundation, Inc. 4;; Foundation, Inc.
5 5
6;; Authors: 1998- Martin Stjernholm 6;; Authors: 1998- Martin Stjernholm
7;; 1992-1999 Barry A. Warsaw 7;; 1992-1999 Barry A. Warsaw
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index 6fe9fec3094..30cfa1b7b21 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -746,27 +746,25 @@ Assumes the tags table is the current buffer."
746;; their tags included in the completion table. 746;; their tags included in the completion table.
747(defun tags-completion-table () 747(defun tags-completion-table ()
748 (or tags-completion-table 748 (or tags-completion-table
749 ;; No cached value for this buffer.
749 (condition-case () 750 (condition-case ()
750 (prog2 751 (let (current-table combined-table)
751 (message "Making tags completion table for %s..." buffer-file-name) 752 (message "Making tags completion table for %s..." buffer-file-name)
752 (let ((included (tags-included-tables)) 753 (save-excursion
753 (table (funcall tags-completion-table-function))) 754 ;; Iterate over the current list of tags tables.
754 (save-excursion 755 (while (visit-tags-table-buffer (and combined-table t))
755 ;; Iterate over the list of included tables, and combine each 756 ;; Find possible completions in this table.
756 ;; included table's completion obarray to the parent obarray. 757 (setq current-table (funcall tags-completion-table-function))
757 (while included 758 ;; Merge this buffer's completions into the combined table.
758 ;; Visit the buffer. 759 (if combined-table
759 (let ((tags-file-name (car included))) 760 (mapatoms
760 (visit-tags-table-buffer 'same)) 761 (lambda (sym) (intern (symbol-name sym) combined-table))
761 ;; Recurse in that buffer to compute its completion table. 762 current-table)
762 (if (tags-completion-table) 763 (setq combined-table current-table))))
763 ;; Combine the tables. 764 (message "Making tags completion table for %s...done"
764 (mapatoms (lambda (sym) (intern (symbol-name sym) table)) 765 buffer-file-name)
765 tags-completion-table)) 766 ;; Cache the result a buffer-local variable.
766 (setq included (cdr included)))) 767 (setq tags-completion-table combined-table))
767 (setq tags-completion-table table))
768 (message "Making tags completion table for %s...done"
769 buffer-file-name))
770 (quit (message "Tags completion table construction aborted.") 768 (quit (message "Tags completion table construction aborted.")
771 (setq tags-completion-table nil))))) 769 (setq tags-completion-table nil)))))
772 770
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 0ea9eef96cb..6fe818facca 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -1430,25 +1430,27 @@ with your script for an edit-interpret-debug cycle."
1430 (set (make-local-variable 'parse-sexp-ignore-comments) t) 1430 (set (make-local-variable 'parse-sexp-ignore-comments) t)
1431 ;; Parse or insert magic number for exec, and set all variables depending 1431 ;; Parse or insert magic number for exec, and set all variables depending
1432 ;; on the shell thus determined. 1432 ;; on the shell thus determined.
1433 (let ((interpreter 1433 (sh-set-shell
1434 (save-excursion 1434 (cond ((save-excursion
1435 (goto-char (point-min)) 1435 (goto-char (point-min))
1436 (cond ((looking-at "#![ \t]?\\([^ \t\n]*/bin/env[ \t]\\)?\\([^ \t\n]+\\)") 1436 (looking-at "#![ \t]?\\([^ \t\n]*/bin/env[ \t]\\)?\\([^ \t\n]+\\)"))
1437 (match-string 2)) 1437 (match-string 2))
1438 ((and buffer-file-name 1438 ((not buffer-file-name)
1439 (string-match "\\.m?spec\\'" buffer-file-name)) 1439 sh-shell-file)
1440 "rpm"))))) 1440 ;; Checks that use `buffer-file-name' follow.
1441 (unless interpreter 1441 ((string-match "\\.m?spec\\'" buffer-file-name)
1442 (setq interpreter 1442 "rpm")
1443 (cond ((string-match "[.]sh\\>" buffer-file-name) 1443 ((string-match "[.]sh\\>" buffer-file-name)
1444 "sh") 1444 "sh")
1445 ((string-match "[.]bash\\>" buffer-file-name) 1445 ((string-match "[.]bash\\>" buffer-file-name)
1446 "bash") 1446 "bash")
1447 ((string-match "[.]ksh\\>" buffer-file-name) 1447 ((string-match "[.]ksh\\>" buffer-file-name)
1448 "ksh") 1448 "ksh")
1449 ((string-match "[.]csh\\>" buffer-file-name) 1449 ((string-match "[.]csh\\>" buffer-file-name)
1450 "csh")))) 1450 "csh")
1451 (sh-set-shell (or interpreter sh-shell-file) nil nil)) 1451 (t
1452 sh-shell-file))
1453 nil nil)
1452 (run-mode-hooks 'sh-mode-hook)) 1454 (run-mode-hooks 'sh-mode-hook))
1453 1455
1454;;;###autoload 1456;;;###autoload
diff --git a/man/ChangeLog b/man/ChangeLog
index e2d948aef35..e7e2f620263 100644
--- a/man/ChangeLog
+++ b/man/ChangeLog
@@ -1,3 +1,26 @@
12006-02-24 Alan Mackenzie <bug-cc-mode@gnu.org>
2
3 * cc-mode.texi: Rename c-hungry-backspace to
4 c-hungry-delete-backwards, at the request of RMS. Leave the old
5 name as an alias.
6
72006-02-24 Alan Mackenzie <bug-cc-mode@gnu.org>
8
9 * cc-mode.texi: Correct the definition of c-beginning-of-defun, to
10 include the function header within the defun.
11
122006-02-24 Alan Mackenzie <bug-cc-mode@gnu.org>
13
14 * cc-mode.texi: Correct two typos.
15
162006-02-24 Alan Mackenzie <bug-cc-mode@gnu.org>
17
18 * cc-mode.texi (Comment Commands): State that C-u M-; kills any
19 existing comment.
20 (Electric Keys): Add a justification for electric indentation.
21 (Hungry WS Deletion): Clear up the names and complications of the
22 BACKSPACE and DELETE keys.
23
12006-02-23 Juri Linkov <juri@jurta.org> 242006-02-23 Juri Linkov <juri@jurta.org>
2 25
3 * faq.texi (Common requests): Move `Turning on auto-fill by 26 * faq.texi (Common requests): Move `Turning on auto-fill by
@@ -810,6 +833,13 @@
810 prefix keys even when mark is active. Decribe that RET moves 833 prefix keys even when mark is active. Decribe that RET moves
811 cursor to next corner in rectangle; clarify insert around rectangle. 834 cursor to next corner in rectangle; clarify insert around rectangle.
812 835
8362005-12-08 Alan Mackenzie <bug-cc-mode@gnu.org>
837
838 * cc-mode.texi: The manual has been extensively revised: the
839 information about using CC Mode has been separated from the larger
840 and more difficult chapters about configuration. It has been
841 updated for CC Mode 5.31.
842
8132005-12-05 Katsumi Yamaoka <yamaoka@jpl.org> 8432005-12-05 Katsumi Yamaoka <yamaoka@jpl.org>
814 844
815 * pgg.texi (User Commands): Fix description of pgg-verify-region. 845 * pgg.texi (User Commands): Fix description of pgg-verify-region.
diff --git a/man/cc-mode.texi b/man/cc-mode.texi
index 00bd427f5dd..d541e306ae4 100644
--- a/man/cc-mode.texi
+++ b/man/cc-mode.texi
@@ -210,7 +210,7 @@ license to the document, as described in section 6 of the license.
210 210
211This manual was generated from $Revision$ of $RCSfile$, which can be 211This manual was generated from $Revision$ of $RCSfile$, which can be
212downloaded from 212downloaded from
213@url{http://cvs.sf.net/viewcvs.py/cc-mode/cc-mode/cc-mode.texi}. 213@url{http://cvs.savannah.gnu.org/viewcvs/emacs/emacs/man/cc-mode.texi}.
214@end titlepage 214@end titlepage
215 215
216@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 216@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -447,7 +447,7 @@ depending on your needs. It describes the @ccmode{} style system and
447lists the standard styles that @ccmode{} supplies. 447lists the standard styles that @ccmode{} supplies.
448 448
449@item 449@item
450The next few chapters, describe in detail how to customize the various 450The next few chapters describe in detail how to customize the various
451features of @ccmode{}. 451features of @ccmode{}.
452 452
453@item 453@item
@@ -525,7 +525,7 @@ Normally, when you type ``punctuation'' characters such as @samp{;} or
525be disconcerting until you get used to it. To disable @dfn{electric 525be disconcerting until you get used to it. To disable @dfn{electric
526indentation} in the current buffer, type @kbd{C-c C-l}. Type the same 526indentation} in the current buffer, type @kbd{C-c C-l}. Type the same
527thing to enable it again. To have electric indentation disabled by 527thing to enable it again. To have electric indentation disabled by
528default, put the following into your @file{.emacs} mode@footnote{There 528default, put the following into your @file{.emacs} file@footnote{There
529is no ``easy customization'' facility for making this change.}: 529is no ``easy customization'' facility for making this change.}:
530 530
531@example 531@example
@@ -836,8 +836,9 @@ already. Then reindent the comment according to @code{comment-column}
836(@pxref{Comments,,, xemacs, XEmacs User's Manual}) 836(@pxref{Comments,,, xemacs, XEmacs User's Manual})
837@end ifset 837@end ifset
838and the variables below. Finally, position the point after the 838and the variables below. Finally, position the point after the
839comment starter. This is a standard Emacs command, but @ccmode{} 839comment starter. @kbd{C-u M-;} kills any comment on the current line,
840enhances it a bit with two variables: 840together with any whitespace before it. This is a standard Emacs
841command, but @ccmode{} enhances it a bit with two variables:
841 842
842@defopt c-indent-comment-alist 843@defopt c-indent-comment-alist
843@vindex indent-comment-alist (c-) 844@vindex indent-comment-alist (c-)
@@ -887,12 +888,14 @@ lines.
887@findex end-of-defun (c-) 888@findex end-of-defun (c-)
888@findex beginning-of-defun 889@findex beginning-of-defun
889@findex end-of-defun 890@findex end-of-defun
890Move to the start or end of the current top-level definition, this 891Move to the start or end of the current top-level definition. This is
891being the outermost brace pair which encloses point. These functions 892the outermost brace pair which encloses point, together with the
892are analogous to the Emacs built-in commands @code{beginning-of-defun} 893function header or similar preamble which precedes the opening brace.
893and @code{end-of-defun}, except they eliminate the constraint that the 894These functions are analogous to the Emacs built-in commands
894top-level opening brace of the defun must be in column zero. See 895@code{beginning-of-defun} and @code{end-of-defun}, except they
895@ref{Defuns,,,@emacsman{}, @emacsmantitle{}}, for more information. 896eliminate the constraint that the top-level opening brace of the defun
897must be in column zero. See @ref{Defuns,,,@emacsman{},
898@emacsmantitle{}}, for more information.
896 899
897Depending on the coding style you're using, you might prefer these two 900Depending on the coding style you're using, you might prefer these two
898commands to the standard Emacs ones. If so, consider binding them to 901commands to the standard Emacs ones. If so, consider binding them to
@@ -1220,15 +1223,16 @@ turn it (or them) off.
1220 1223
1221Most punctuation keys provide @dfn{electric} behavior - as well as 1224Most punctuation keys provide @dfn{electric} behavior - as well as
1222inserting themselves they perform some other action, such as 1225inserting themselves they perform some other action, such as
1223reindenting the line. A few keywords, such as @code{else}, also 1226reindenting the line. This reindentation saves you from having to
1224trigger electric action. 1227reindent a line manually after typing, say, a @samp{@}}. A few
1228keywords, such as @code{else}, also trigger electric action.
1225 1229
1226You can inhibit the electric behaviour described here by disabling 1230You can inhibit the electric behaviour described here by disabling
1227electric minor mode (@pxref{Minor Modes}.) 1231electric minor mode (@pxref{Minor Modes}).
1228 1232
1229Common to all of them is that they only behave electrically when used 1233Common to all these keys is that they only behave electrically when
1230in normal code (as contrasted with getting typed in a string literal 1234used in normal code (as contrasted with getting typed in a string
1231or comment). Those which cause re-indentation do so only when 1235literal or comment). Those which cause re-indentation do so only when
1232@code{c-syntactic-indentation} has a non-@code{nil} value (which it 1236@code{c-syntactic-indentation} has a non-@code{nil} value (which it
1233does by default). 1237does by default).
1234 1238
@@ -1453,8 +1457,6 @@ clean-ups listed by key.
1453@cindex hungry-deletion 1457@cindex hungry-deletion
1454@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1458@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1455 1459
1456@kindex C-d
1457
1458If you want to delete an entire block of whitespace at point, you can 1460If you want to delete an entire block of whitespace at point, you can
1459use @dfn{hungry deletion}. This deletes all the contiguous whitespace 1461use @dfn{hungry deletion}. This deletes all the contiguous whitespace
1460either before point or after point in a single operation. 1462either before point or after point in a single operation.
@@ -1468,6 +1470,10 @@ Hungry deletion is a simple feature that some people find extremely
1468useful. In fact, you might find yourself wanting it in @strong{all} 1470useful. In fact, you might find yourself wanting it in @strong{all}
1469your editing modes! 1471your editing modes!
1470 1472
1473Loosely speaking, in what follows, @dfn{@key{DEL}} means ``the
1474backspace key'' and @dfn{@key{DELETE}} means ``the forward delete
1475key''. This is discussed in more detail below.
1476
1471There are two different ways you can use hungry deletion: 1477There are two different ways you can use hungry deletion:
1472 1478
1473@table @asis 1479@table @asis
@@ -1476,7 +1482,7 @@ Here you toggle Hungry Delete minor mode with @kbd{M-x
1476c-toggle-hungry-state}@footnote{Prior to @ccmode{} 5.31, this command 1482c-toggle-hungry-state}@footnote{Prior to @ccmode{} 5.31, this command
1477was bound to @kbd{C-c C-d}. @kbd{C-c C-d} is now the default binding 1483was bound to @kbd{C-c C-d}. @kbd{C-c C-d} is now the default binding
1478for @code{c-hungry-delete-forward}.} (@pxref{Minor Modes}.) This 1484for @code{c-hungry-delete-forward}.} (@pxref{Minor Modes}.) This
1479makes @kbd{@key{DEL}} and @kbd{C-d} do forward and backwards hungry 1485makes @kbd{@key{DEL}} and @kbd{C-d} do backwards and forward hungry
1480deletion. 1486deletion.
1481 1487
1482@table @asis 1488@table @asis
@@ -1524,61 +1530,62 @@ default value is @code{delete-char}.
1524 1530
1525@item Using Distinct Bindings 1531@item Using Distinct Bindings
1526The other (newer and recommended) way to use hungry deletion is to 1532The other (newer and recommended) way to use hungry deletion is to
1527perform @code{c-hungry-backspace} and @code{c-hungry-delete-forward} 1533perform @code{c-hungry-delete-backwards} and
1528directly through their key sequences rather than using the minor mode 1534@code{c-hungry-delete-forward} directly through their key sequences
1529toggling. 1535rather than using the minor mode toggling.
1530 1536
1531@table @asis 1537@table @asis
1532@item @kbd{C-c C-@key{Backspace}}, @kbd{C-c DEL}, or @kbd{C-c @key{Backspace}} (@code{c-hungry-backspace}) 1538@item @kbd{C-c C-@key{DEL}}, or @kbd{C-c @key{DEL}} (@code{c-hungry-delete-backwards})@footnote{This command was formerly known as @code{c-hungry-backspace}.}
1533@kindex C-c C-<backspace> 1539@kindex C-c C-<backspace>
1534@kindex C-c DEL
1535@kindex C-c <backspace> 1540@kindex C-c <backspace>
1536@findex c-hungry-backspace 1541@kindex C-c C-DEL
1537@findex hungry-backspace (c-) 1542@kindex C-c DEL
1543@findex c-hungry-delete-backwards
1544@findex hungry-delete-backwards (c-)
1538Delete any amount of whitespace in the backwards direction (regardless 1545Delete any amount of whitespace in the backwards direction (regardless
1539whether hungry-delete mode is enabled or not). This command is bound 1546whether hungry-delete mode is enabled or not). This command is bound
1540to both @kbd{C-c C-@key{Backspace}} and @kbd{C-c @key{Backspace}}, 1547to both @kbd{C-c C-@key{DEL}} and @kbd{C-c @key{DEL}}, since the more
1541since the more natural one, @kbd{C-c C-@key{Backspace}}, is sometimes 1548natural one, @kbd{C-c C-@key{DEL}}, is sometimes difficult to type at
1542difficult to type at a character terminal. 1549a character terminal.
1543 1550
1544@item @kbd{C-c C-@key{Delete}}, @kbd{C-c C-d}, or @kbd{C-c @key{Delete}} (@code{c-hungry-delete-forward}) 1551@item @kbd{C-c C-d}, @kbd{C-c C-@key{DELETE}}, or @kbd{C-c @key{DELETE}} (@code{c-hungry-delete-forward})
1545@kindex C-c C-<delete>
1546@kindex C-c C-d 1552@kindex C-c C-d
1547@kindex C-c <delete> 1553@kindex C-c C-<DELETE>
1554@kindex C-c <DELETE>
1548@findex c-hungry-delete-forward 1555@findex c-hungry-delete-forward
1549@findex hungry-delete-forward (c-) 1556@findex hungry-delete-forward (c-)
1550Delete any amount of whitespace in the forward direction (regardless 1557Delete any amount of whitespace in the forward direction (regardless
1551whether hungry-delete mode is enabled or not). This command is bound 1558whether hungry-delete mode is enabled or not). This command is bound
1552to both @kbd{C-c C-@key{Delete}} and @kbd{C-c @key{Delete}} for the 1559to both @kbd{C-c C-@key{DELETE}} and @kbd{C-c @key{DELETE}} for the
1553same reason as for @key{Backspace} above. 1560same reason as for @key{DEL} above.
1554@end table 1561@end table
1555@end table 1562@end table
1556 1563
1557@kindex <delete> 1564@kindex <delete>
1558@kindex <backspace> 1565@kindex <backspace>
1559 1566
1560When we talk about @kbd{DEL}, @kbd{C-d}, @key{Backspace} and 1567When we talk about @kbd{@key{DEL}}, and @kbd{@key{DELETE}} above, we
1561@key{Delete} above, we actually do so without connecting them to the 1568actually do so without connecting them to the physical keys commonly
1562physical keys commonly known as @key{Backspace} and @key{Delete}. The 1569known as @key{Backspace} and @key{Delete}. The default bindings to
1563default bindings to those two keys depends on the flavor of (X)Emacs 1570those two keys depends on the flavor of (X)Emacs you are using.
1564you are using.
1565 1571
1566@findex c-electric-delete 1572@findex c-electric-delete
1567@findex electric-delete (c-) 1573@findex electric-delete (c-)
1568@findex c-hungry-delete 1574@findex c-hungry-delete
1569@findex hungry-delete (c-) 1575@findex hungry-delete (c-)
1570@vindex delete-key-deletes-forward 1576@vindex delete-key-deletes-forward
1571
1572In XEmacs 20.3 and beyond, the @key{Backspace} key is bound to 1577In XEmacs 20.3 and beyond, the @key{Backspace} key is bound to
1573@code{c-electric-backspace} and the @key{Delete} key is bound to 1578@code{c-electric-backspace} and the @key{Delete} key is bound to
1574@code{c-electric-delete}. You control the direction it deletes in by 1579@code{c-electric-delete}. You control the direction it deletes in by
1575setting the variable @code{delete-key-deletes-forward}, a standard 1580setting the variable @code{delete-key-deletes-forward}, a standard
1576XEmacs variable. When this variable is non-@code{nil}, 1581XEmacs variable.
1577@code{c-electric-delete} will do forward deletion with 1582@c This variable is encapsulated by XEmacs's (defsubst delete-forward-p ...).
1578@code{c-electric-delete-forward}, otherwise it does backward deletion 1583When this variable is non-@code{nil}, @code{c-electric-delete} will do
1579with @code{c-electric-backspace}. Similarly, @kbd{C-c @key{Delete}} 1584forward deletion with @code{c-electric-delete-forward}, otherwise it
1580and @kbd{C-c C-@key{Delete}} are bound to @code{c-hungry-delete} which 1585does backward deletion with @code{c-electric-backspace}. Similarly,
1581is controlled in the same way by @code{delete-key-deletes-forward}. 1586@kbd{C-c @key{Delete}} and @kbd{C-c C-@key{Delete}} are bound to
1587@code{c-hungry-delete} which is controlled in the same way by
1588@code{delete-key-deletes-forward}.
1582 1589
1583@findex normal-erase-is-backspace-mode 1590@findex normal-erase-is-backspace-mode
1584 1591
diff --git a/src/ChangeLog b/src/ChangeLog
index 829ca27c585..4176e2f29c8 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,47 @@
12006-02-25 Chong Yidong <cyd@stupidchicken.com>
2
3 * xterm.h (x_catch_errors) Return value changed to void.
4 (x_uncatch_errors): Unused count argument deleted.
5
6 * xterm.c (x_catch_errors): Don't use record_unwind_protect, since
7 it can be called in a signal handler.
8 (x_catch_errors_unwind): Function deleted.
9 (x_uncatch_errors): Deallocate last x_error_message_stack struct.
10 (x_check_errors): Call x_uncatch_errors before signalling error.
11
12 (x_load_font, x_term_init, XTmouse_position, handle_one_xevent)
13 (x_connection_closed, x_list_fonts): Use new versions of
14 x_catch_errors and x_uncatch_errors.
15
16 * xselect.c (x_own_selection, x_decline_selection_request)
17 (x_reply_selection_request, x_get_foreign_selection)
18 (Fx_get_atom_name, Fx_send_client_event): Likewise.
19
20 * xfns.c (x_real_positions, x_set_mouse_color, Fx_focus_frame):
21 Likewise.
22
23 * eval.c (record_unwind_protect): Add an assertion.
24
252006-02-25 Stefan Monnier <monnier@iro.umontreal.ca>
26
27 * process.c (Fmake_network_process): Init the process's mark.
28
292006-02-25 Kim F. Storm <storm@cua.dk>
30
31 * buffer.c (modify_overlay): Force redisplay if we modify an
32 overlay at the end of the buffer.
33
342006-02-24 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
35
36 * gtkutil.c (xg_get_image_for_pixmap): If x_find_image_file returns
37 nil the image file has been removed, in that case use the (cached)
38 pixmap.
39
402006-02-24 Kenichi Handa <handa@m17n.org>
41
42 * fileio.c (Finsert_file_contents): When a text is replaced
43 partially, be sure to set point before the inserted characters.
44
12006-02-23 Zhang Wei <id.brep@gmail.com> (tiny change) 452006-02-23 Zhang Wei <id.brep@gmail.com> (tiny change)
2 46
3 * xfns.c (Fx_file_dialog): Return a decoded file name. 47 * xfns.c (Fx_file_dialog): Return a decoded file name.
diff --git a/src/buffer.c b/src/buffer.c
index e6f93726f5a..e4d846c8093 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -3665,6 +3665,10 @@ modify_overlay (buf, start, end)
3665 /* If multiple windows show this buffer, we must do other windows. */ 3665 /* If multiple windows show this buffer, we must do other windows. */
3666 else if (buffer_shared > 1) 3666 else if (buffer_shared > 1)
3667 windows_or_buffers_changed = 1; 3667 windows_or_buffers_changed = 1;
3668 /* If we modify an overlay at the end of the buffer, we cannot
3669 be sure that window end is still valid. */
3670 else if (end >= ZV && start <= ZV)
3671 windows_or_buffers_changed = 1;
3668 3672
3669 ++BUF_OVERLAY_MODIFF (buf); 3673 ++BUF_OVERLAY_MODIFF (buf);
3670} 3674}
@@ -4106,6 +4110,7 @@ DEFUN ("overlay-put", Foverlay_put, Soverlay_put, 3, 3, 0,
4106 == OVERLAY_POSITION (OVERLAY_END (overlay)))) 4110 == OVERLAY_POSITION (OVERLAY_END (overlay))))
4107 Fdelete_overlay (overlay); 4111 Fdelete_overlay (overlay);
4108 } 4112 }
4113
4109 return value; 4114 return value;
4110} 4115}
4111 4116
diff --git a/src/eval.c b/src/eval.c
index eff284820f0..06d53c907b4 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -3199,6 +3199,8 @@ record_unwind_protect (function, arg)
3199 Lisp_Object (*function) P_ ((Lisp_Object)); 3199 Lisp_Object (*function) P_ ((Lisp_Object));
3200 Lisp_Object arg; 3200 Lisp_Object arg;
3201{ 3201{
3202 eassert (!handling_signal);
3203
3202 if (specpdl_ptr == specpdl + specpdl_size) 3204 if (specpdl_ptr == specpdl + specpdl_size)
3203 grow_specpdl (); 3205 grow_specpdl ();
3204 specpdl_ptr->func = function; 3206 specpdl_ptr->func = function;
diff --git a/src/fileio.c b/src/fileio.c
index ad3d89aa983..b1f9b91654a 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -4397,6 +4397,8 @@ actually used. */)
4397 same_at_start_charpos, inserted_chars, 0); 4397 same_at_start_charpos, inserted_chars, 0);
4398 /* Set `inserted' to the number of inserted characters. */ 4398 /* Set `inserted' to the number of inserted characters. */
4399 inserted = PT - temp; 4399 inserted = PT - temp;
4400 /* Set point before the inserted characters. */
4401 SET_PT_BOTH (temp, same_at_start);
4400 4402
4401 unbind_to (this_count, Qnil); 4403 unbind_to (this_count, Qnil);
4402 4404
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 203eab257f3..b8d37df2214 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -327,6 +327,7 @@ xg_get_image_for_pixmap (f, img, widget, old_widget)
327 look good in all cases. */ 327 look good in all cases. */
328 Lisp_Object specified_file = Qnil; 328 Lisp_Object specified_file = Qnil;
329 Lisp_Object tail; 329 Lisp_Object tail;
330 Lisp_Object file;
330 extern Lisp_Object QCfile; 331 extern Lisp_Object QCfile;
331 332
332 for (tail = XCDR (img->spec); 333 for (tail = XCDR (img->spec);
@@ -335,23 +336,18 @@ xg_get_image_for_pixmap (f, img, widget, old_widget)
335 if (EQ (XCAR (tail), QCfile)) 336 if (EQ (XCAR (tail), QCfile))
336 specified_file = XCAR (XCDR (tail)); 337 specified_file = XCAR (XCDR (tail));
337 338
338 if (STRINGP (specified_file)) 339 /* We already loaded the image once before calling this
339 { 340 function, so this only fails if the image file has been removed.
340 Lisp_Object file = Qnil; 341 In that case, use the pixmap already loaded. */
341 struct gcpro gcpro1;
342 GCPRO1 (file);
343
344 file = x_find_image_file (specified_file);
345 /* We already loaded the image once before calling this
346 function, so this should not fail. */
347 xassert (STRINGP (file) != 0);
348 342
343 if (STRINGP (specified_file)
344 && STRINGP (file = x_find_image_file (specified_file)))
345 {
349 if (! old_widget) 346 if (! old_widget)
350 old_widget = GTK_IMAGE (gtk_image_new_from_file (SSDATA (file))); 347 old_widget = GTK_IMAGE (gtk_image_new_from_file (SSDATA (file)));
351 else 348 else
352 gtk_image_set_from_file (old_widget, SSDATA (file)); 349 gtk_image_set_from_file (old_widget, SSDATA (file));
353 350
354 UNGCPRO;
355 return GTK_WIDGET (old_widget); 351 return GTK_WIDGET (old_widget);
356 } 352 }
357 353
diff --git a/src/process.c b/src/process.c
index 74922b0f57d..eae63553d38 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1583,7 +1583,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1583#endif 1583#endif
1584 1584
1585 /* Make the process marker point into the process buffer (if any). */ 1585 /* Make the process marker point into the process buffer (if any). */
1586 if (!NILP (buffer)) 1586 if (BUFFERP (buffer))
1587 set_marker_both (XPROCESS (proc)->mark, buffer, 1587 set_marker_both (XPROCESS (proc)->mark, buffer,
1588 BUF_ZV (XBUFFER (buffer)), 1588 BUF_ZV (XBUFFER (buffer)),
1589 BUF_ZV_BYTE (XBUFFER (buffer))); 1589 BUF_ZV_BYTE (XBUFFER (buffer)));
@@ -3356,6 +3356,12 @@ usage: (make-network-process &rest ARGS) */)
3356 if (is_server && socktype == SOCK_STREAM) 3356 if (is_server && socktype == SOCK_STREAM)
3357 p->status = Qlisten; 3357 p->status = Qlisten;
3358 3358
3359 /* Make the process marker point into the process buffer (if any). */
3360 if (BUFFERP (buffer))
3361 set_marker_both (p->mark, buffer,
3362 BUF_ZV (XBUFFER (buffer)),
3363 BUF_ZV_BYTE (XBUFFER (buffer)));
3364
3359#ifdef NON_BLOCKING_CONNECT 3365#ifdef NON_BLOCKING_CONNECT
3360 if (is_non_blocking_client) 3366 if (is_non_blocking_client)
3361 { 3367 {
diff --git a/src/xfns.c b/src/xfns.c
index cbdfa56dec4..2ad80fb95fa 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -578,11 +578,9 @@ x_real_positions (f, xptr, yptr)
578 int had_errors = 0; 578 int had_errors = 0;
579 Window win = f->output_data.x->parent_desc; 579 Window win = f->output_data.x->parent_desc;
580 580
581 int count;
582
583 BLOCK_INPUT; 581 BLOCK_INPUT;
584 582
585 count = x_catch_errors (FRAME_X_DISPLAY (f)); 583 x_catch_errors (FRAME_X_DISPLAY (f));
586 584
587 if (win == FRAME_X_DISPLAY_INFO (f)->root_window) 585 if (win == FRAME_X_DISPLAY_INFO (f)->root_window)
588 win = FRAME_OUTER_WINDOW (f); 586 win = FRAME_OUTER_WINDOW (f);
@@ -669,7 +667,7 @@ x_real_positions (f, xptr, yptr)
669 had_errors = x_had_errors_p (FRAME_X_DISPLAY (f)); 667 had_errors = x_had_errors_p (FRAME_X_DISPLAY (f));
670 } 668 }
671 669
672 x_uncatch_errors (FRAME_X_DISPLAY (f), count); 670 x_uncatch_errors (FRAME_X_DISPLAY (f));
673 671
674 UNBLOCK_INPUT; 672 UNBLOCK_INPUT;
675 673
@@ -947,7 +945,6 @@ x_set_mouse_color (f, arg, oldval)
947 Display *dpy = FRAME_X_DISPLAY (f); 945 Display *dpy = FRAME_X_DISPLAY (f);
948 Cursor cursor, nontext_cursor, mode_cursor, hand_cursor; 946 Cursor cursor, nontext_cursor, mode_cursor, hand_cursor;
949 Cursor hourglass_cursor, horizontal_drag_cursor; 947 Cursor hourglass_cursor, horizontal_drag_cursor;
950 int count;
951 unsigned long pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); 948 unsigned long pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
952 unsigned long mask_color = x->background_pixel; 949 unsigned long mask_color = x->background_pixel;
953 950
@@ -964,7 +961,7 @@ x_set_mouse_color (f, arg, oldval)
964 BLOCK_INPUT; 961 BLOCK_INPUT;
965 962
966 /* It's not okay to crash if the user selects a screwy cursor. */ 963 /* It's not okay to crash if the user selects a screwy cursor. */
967 count = x_catch_errors (dpy); 964 x_catch_errors (dpy);
968 965
969 if (!NILP (Vx_pointer_shape)) 966 if (!NILP (Vx_pointer_shape))
970 { 967 {
@@ -1025,7 +1022,7 @@ x_set_mouse_color (f, arg, oldval)
1025 1022
1026 /* Check and report errors with the above calls. */ 1023 /* Check and report errors with the above calls. */
1027 x_check_errors (dpy, "can't set cursor shape: %s"); 1024 x_check_errors (dpy, "can't set cursor shape: %s");
1028 x_uncatch_errors (dpy, count); 1025 x_uncatch_errors (dpy);
1029 1026
1030 { 1027 {
1031 XColor fore_color, back_color; 1028 XColor fore_color, back_color;
@@ -3425,13 +3422,12 @@ FRAME nil means use the selected frame. */)
3425{ 3422{
3426 struct frame *f = check_x_frame (frame); 3423 struct frame *f = check_x_frame (frame);
3427 Display *dpy = FRAME_X_DISPLAY (f); 3424 Display *dpy = FRAME_X_DISPLAY (f);
3428 int count;
3429 3425
3430 BLOCK_INPUT; 3426 BLOCK_INPUT;
3431 count = x_catch_errors (dpy); 3427 x_catch_errors (dpy);
3432 XSetInputFocus (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 3428 XSetInputFocus (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
3433 RevertToParent, CurrentTime); 3429 RevertToParent, CurrentTime);
3434 x_uncatch_errors (dpy, count); 3430 x_uncatch_errors (dpy);
3435 UNBLOCK_INPUT; 3431 UNBLOCK_INPUT;
3436 3432
3437 return Qnil; 3433 return Qnil;
diff --git a/src/xselect.c b/src/xselect.c
index 850cb058e86..6efa625543e 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -402,16 +402,15 @@ x_own_selection (selection_name, selection_value)
402 Time time = last_event_timestamp; 402 Time time = last_event_timestamp;
403 Atom selection_atom; 403 Atom selection_atom;
404 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (sf); 404 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (sf);
405 int count;
406 405
407 CHECK_SYMBOL (selection_name); 406 CHECK_SYMBOL (selection_name);
408 selection_atom = symbol_to_x_atom (dpyinfo, display, selection_name); 407 selection_atom = symbol_to_x_atom (dpyinfo, display, selection_name);
409 408
410 BLOCK_INPUT; 409 BLOCK_INPUT;
411 count = x_catch_errors (display); 410 x_catch_errors (display);
412 XSetSelectionOwner (display, selection_atom, selecting_window, time); 411 XSetSelectionOwner (display, selection_atom, selecting_window, time);
413 x_check_errors (display, "Can't set selection: %s"); 412 x_check_errors (display, "Can't set selection: %s");
414 x_uncatch_errors (display, count); 413 x_uncatch_errors (display);
415 UNBLOCK_INPUT; 414 UNBLOCK_INPUT;
416 415
417 /* Now update the local cache */ 416 /* Now update the local cache */
@@ -572,7 +571,6 @@ x_decline_selection_request (event)
572 struct input_event *event; 571 struct input_event *event;
573{ 572{
574 XSelectionEvent reply; 573 XSelectionEvent reply;
575 int count;
576 574
577 reply.type = SelectionNotify; 575 reply.type = SelectionNotify;
578 reply.display = SELECTION_EVENT_DISPLAY (event); 576 reply.display = SELECTION_EVENT_DISPLAY (event);
@@ -585,10 +583,10 @@ x_decline_selection_request (event)
585 /* The reason for the error may be that the receiver has 583 /* The reason for the error may be that the receiver has
586 died in the meantime. Handle that case. */ 584 died in the meantime. Handle that case. */
587 BLOCK_INPUT; 585 BLOCK_INPUT;
588 count = x_catch_errors (reply.display); 586 x_catch_errors (reply.display);
589 XSendEvent (reply.display, reply.requestor, False, 0L, (XEvent *) &reply); 587 XSendEvent (reply.display, reply.requestor, False, 0L, (XEvent *) &reply);
590 XFlush (reply.display); 588 XFlush (reply.display);
591 x_uncatch_errors (reply.display, count); 589 x_uncatch_errors (reply.display);
592 UNBLOCK_INPUT; 590 UNBLOCK_INPUT;
593} 591}
594 592
@@ -690,7 +688,7 @@ x_reply_selection_request (event, format, data, size, type)
690 int format_bytes = format/8; 688 int format_bytes = format/8;
691 int max_bytes = SELECTION_QUANTUM (display); 689 int max_bytes = SELECTION_QUANTUM (display);
692 struct x_display_info *dpyinfo = x_display_info_for_display (display); 690 struct x_display_info *dpyinfo = x_display_info_for_display (display);
693 int count; 691 int count = SPECPDL_INDEX ();
694 692
695 if (max_bytes > MAX_SELECTION_QUANTUM) 693 if (max_bytes > MAX_SELECTION_QUANTUM)
696 max_bytes = MAX_SELECTION_QUANTUM; 694 max_bytes = MAX_SELECTION_QUANTUM;
@@ -707,7 +705,7 @@ x_reply_selection_request (event, format, data, size, type)
707 705
708 /* #### XChangeProperty can generate BadAlloc, and we must handle it! */ 706 /* #### XChangeProperty can generate BadAlloc, and we must handle it! */
709 BLOCK_INPUT; 707 BLOCK_INPUT;
710 count = x_catch_errors (display); 708 x_catch_errors (display);
711 709
712#ifdef TRACE_SELECTION 710#ifdef TRACE_SELECTION
713 { 711 {
@@ -860,7 +858,9 @@ x_reply_selection_request (event, format, data, size, type)
860 UNBLOCK to enter the event loop and get possible errors delivered, 858 UNBLOCK to enter the event loop and get possible errors delivered,
861 and then BLOCK again because x_uncatch_errors requires it. */ 859 and then BLOCK again because x_uncatch_errors requires it. */
862 BLOCK_INPUT; 860 BLOCK_INPUT;
863 x_uncatch_errors (display, count); 861
862 unbind_to (count, Qnil);
863 x_uncatch_errors (display);
864 UNBLOCK_INPUT; 864 UNBLOCK_INPUT;
865} 865}
866 866
@@ -1392,7 +1392,7 @@ x_get_foreign_selection (selection_symbol, target_type, time_stamp)
1392 1392
1393 BLOCK_INPUT; 1393 BLOCK_INPUT;
1394 1394
1395 count = x_catch_errors (display); 1395 x_catch_errors (display);
1396 1396
1397 TRACE2 ("Get selection %s, type %s", 1397 TRACE2 ("Get selection %s, type %s",
1398 XGetAtomName (display, type_atom), 1398 XGetAtomName (display, type_atom),
@@ -1409,6 +1409,8 @@ x_get_foreign_selection (selection_symbol, target_type, time_stamp)
1409 1409
1410 frame = some_frame_on_display (dpyinfo); 1410 frame = some_frame_on_display (dpyinfo);
1411 1411
1412 count = SPECPDL_INDEX ();
1413
1412 /* If the display no longer has frames, we can't expect 1414 /* If the display no longer has frames, we can't expect
1413 to get many more selection requests from it, so don't 1415 to get many more selection requests from it, so don't
1414 bother trying to queue them. */ 1416 bother trying to queue them. */
@@ -1430,8 +1432,9 @@ x_get_foreign_selection (selection_symbol, target_type, time_stamp)
1430 TRACE1 (" Got event = %d", !NILP (XCAR (reading_selection_reply))); 1432 TRACE1 (" Got event = %d", !NILP (XCAR (reading_selection_reply)));
1431 1433
1432 BLOCK_INPUT; 1434 BLOCK_INPUT;
1435 unbind_to (count, Qnil);
1433 x_check_errors (display, "Cannot get selection: %s"); 1436 x_check_errors (display, "Cannot get selection: %s");
1434 x_uncatch_errors (display, count); 1437 x_uncatch_errors (display);
1435 UNBLOCK_INPUT; 1438 UNBLOCK_INPUT;
1436 1439
1437 if (NILP (XCAR (reading_selection_reply))) 1440 if (NILP (XCAR (reading_selection_reply)))
@@ -2650,7 +2653,6 @@ If the value is 0 or the atom is not known, return the empty string. */)
2650 struct frame *f = check_x_frame (frame); 2653 struct frame *f = check_x_frame (frame);
2651 char *name = 0; 2654 char *name = 0;
2652 Lisp_Object ret = Qnil; 2655 Lisp_Object ret = Qnil;
2653 int count;
2654 Display *dpy = FRAME_X_DISPLAY (f); 2656 Display *dpy = FRAME_X_DISPLAY (f);
2655 Atom atom; 2657 Atom atom;
2656 2658
@@ -2664,14 +2666,14 @@ If the value is 0 or the atom is not known, return the empty string. */)
2664 error ("Wrong type, value must be number or cons"); 2666 error ("Wrong type, value must be number or cons");
2665 2667
2666 BLOCK_INPUT; 2668 BLOCK_INPUT;
2667 count = x_catch_errors (dpy); 2669 x_catch_errors (dpy);
2668 2670
2669 name = atom ? XGetAtomName (dpy, atom) : ""; 2671 name = atom ? XGetAtomName (dpy, atom) : "";
2670 2672
2671 if (! x_had_errors_p (dpy)) 2673 if (! x_had_errors_p (dpy))
2672 ret = make_string (name, strlen (name)); 2674 ret = make_string (name, strlen (name));
2673 2675
2674 x_uncatch_errors (dpy, count); 2676 x_uncatch_errors (dpy);
2675 2677
2676 if (atom && name) XFree (name); 2678 if (atom && name) XFree (name);
2677 if (NILP (ret)) ret = make_string ("", 0); 2679 if (NILP (ret)) ret = make_string ("", 0);
@@ -2771,7 +2773,6 @@ are ignored. */)
2771 Lisp_Object cons; 2773 Lisp_Object cons;
2772 int size; 2774 int size;
2773 struct frame *f = check_x_frame (from); 2775 struct frame *f = check_x_frame (from);
2774 int count;
2775 int to_root; 2776 int to_root;
2776 2777
2777 CHECK_STRING (message_type); 2778 CHECK_STRING (message_type);
@@ -2841,14 +2842,14 @@ are ignored. */)
2841 the destination window. But if we are sending to the root window, 2842 the destination window. But if we are sending to the root window,
2842 there is no such client. Then we set the event mask to 0xffff. The 2843 there is no such client. Then we set the event mask to 0xffff. The
2843 event then goes to clients selecting for events on the root window. */ 2844 event then goes to clients selecting for events on the root window. */
2844 count = x_catch_errors (dpyinfo->display); 2845 x_catch_errors (dpyinfo->display);
2845 { 2846 {
2846 int propagate = to_root ? False : True; 2847 int propagate = to_root ? False : True;
2847 unsigned mask = to_root ? 0xffff : 0; 2848 unsigned mask = to_root ? 0xffff : 0;
2848 XSendEvent (dpyinfo->display, wdest, propagate, mask, &event); 2849 XSendEvent (dpyinfo->display, wdest, propagate, mask, &event);
2849 XFlush (dpyinfo->display); 2850 XFlush (dpyinfo->display);
2850 } 2851 }
2851 x_uncatch_errors (dpyinfo->display, count); 2852 x_uncatch_errors (dpyinfo->display);
2852 UNBLOCK_INPUT; 2853 UNBLOCK_INPUT;
2853 2854
2854 return Qnil; 2855 return Qnil;
diff --git a/src/xterm.c b/src/xterm.c
index 640d7c553da..698ec1b935c 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -325,8 +325,8 @@ static void x_update_window_end P_ ((struct window *, int, int));
325void x_delete_display P_ ((struct x_display_info *)); 325void x_delete_display P_ ((struct x_display_info *));
326 326
327static int x_io_error_quitter P_ ((Display *)); 327static int x_io_error_quitter P_ ((Display *));
328int x_catch_errors P_ ((Display *)); 328void x_catch_errors P_ ((Display *));
329void x_uncatch_errors P_ ((Display *, int)); 329void x_uncatch_errors P_ ((Display *));
330void x_lower_frame P_ ((struct frame *)); 330void x_lower_frame P_ ((struct frame *));
331void x_scroll_bar_clear P_ ((struct frame *)); 331void x_scroll_bar_clear P_ ((struct frame *));
332int x_had_errors_p P_ ((Display *)); 332int x_had_errors_p P_ ((Display *));
@@ -3799,7 +3799,6 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time)
3799 Window win, child; 3799 Window win, child;
3800 int win_x, win_y; 3800 int win_x, win_y;
3801 int parent_x = 0, parent_y = 0; 3801 int parent_x = 0, parent_y = 0;
3802 int count;
3803 3802
3804 win = root; 3803 win = root;
3805 3804
@@ -3807,7 +3806,7 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time)
3807 structure is changing at the same time this function 3806 structure is changing at the same time this function
3808 is running. So at least we must not crash from them. */ 3807 is running. So at least we must not crash from them. */
3809 3808
3810 count = x_catch_errors (FRAME_X_DISPLAY (*fp)); 3809 x_catch_errors (FRAME_X_DISPLAY (*fp));
3811 3810
3812 if (FRAME_X_DISPLAY_INFO (*fp)->grabbed && last_mouse_frame 3811 if (FRAME_X_DISPLAY_INFO (*fp)->grabbed && last_mouse_frame
3813 && FRAME_LIVE_P (last_mouse_frame)) 3812 && FRAME_LIVE_P (last_mouse_frame))
@@ -3876,7 +3875,7 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time)
3876 if (x_had_errors_p (FRAME_X_DISPLAY (*fp))) 3875 if (x_had_errors_p (FRAME_X_DISPLAY (*fp)))
3877 f1 = 0; 3876 f1 = 0;
3878 3877
3879 x_uncatch_errors (FRAME_X_DISPLAY (*fp), count); 3878 x_uncatch_errors (FRAME_X_DISPLAY (*fp));
3880 3879
3881 /* If not, is it one of our scroll bars? */ 3880 /* If not, is it one of our scroll bars? */
3882 if (! f1) 3881 if (! f1)
@@ -5793,7 +5792,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
5793 Display *d = event.xclient.display; 5792 Display *d = event.xclient.display;
5794 /* Catch and ignore errors, in case window has been 5793 /* Catch and ignore errors, in case window has been
5795 iconified by a window manager such as GWM. */ 5794 iconified by a window manager such as GWM. */
5796 int count = x_catch_errors (d); 5795 x_catch_errors (d);
5797 XSetInputFocus (d, event.xclient.window, 5796 XSetInputFocus (d, event.xclient.window,
5798 /* The ICCCM says this is 5797 /* The ICCCM says this is
5799 the only valid choice. */ 5798 the only valid choice. */
@@ -5802,7 +5801,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
5802 /* This is needed to detect the error 5801 /* This is needed to detect the error
5803 if there is an error. */ 5802 if there is an error. */
5804 XSync (d, False); 5803 XSync (d, False);
5805 x_uncatch_errors (d, count); 5804 x_uncatch_errors (d);
5806 } 5805 }
5807 /* Not certain about handling scroll bars here */ 5806 /* Not certain about handling scroll bars here */
5808#endif /* 0 */ 5807#endif /* 0 */
@@ -7523,7 +7522,11 @@ x_text_icon (f, icon_name)
7523#define X_ERROR_MESSAGE_SIZE 200 7522#define X_ERROR_MESSAGE_SIZE 200
7524 7523
7525/* If non-nil, this should be a string. 7524/* If non-nil, this should be a string.
7526 It means catch X errors and store the error message in this string. */ 7525 It means catch X errors and store the error message in this string.
7526
7527 The reason we use a stack is that x_catch_error/x_uncatch_error can
7528 be called from a signal handler.
7529*/
7527 7530
7528struct x_error_message_stack { 7531struct x_error_message_stack {
7529 char string[X_ERROR_MESSAGE_SIZE]; 7532 char string[X_ERROR_MESSAGE_SIZE];
@@ -7560,20 +7563,12 @@ x_error_catcher (display, error)
7560 Calling x_uncatch_errors resumes the normal error handling. */ 7563 Calling x_uncatch_errors resumes the normal error handling. */
7561 7564
7562void x_check_errors (); 7565void x_check_errors ();
7563static Lisp_Object x_catch_errors_unwind ();
7564 7566
7565int 7567void
7566x_catch_errors (dpy) 7568x_catch_errors (dpy)
7567 Display *dpy; 7569 Display *dpy;
7568{ 7570{
7569 int count = SPECPDL_INDEX ();
7570 struct x_error_message_stack *data = xmalloc (sizeof (*data)); 7571 struct x_error_message_stack *data = xmalloc (sizeof (*data));
7571 Lisp_Object dummy;
7572#ifdef ENABLE_CHECKING
7573 dummy = make_number ((EMACS_INT)dpy + (EMACS_INT)x_error_message);
7574#else
7575 dummy = Qnil;
7576#endif
7577 7572
7578 /* Make sure any errors from previous requests have been dealt with. */ 7573 /* Make sure any errors from previous requests have been dealt with. */
7579 XSync (dpy, False); 7574 XSync (dpy, False);
@@ -7582,21 +7577,19 @@ x_catch_errors (dpy)
7582 data->string[0] = 0; 7577 data->string[0] = 0;
7583 data->prev = x_error_message; 7578 data->prev = x_error_message;
7584 x_error_message = data; 7579 x_error_message = data;
7585
7586 record_unwind_protect (x_catch_errors_unwind, dummy);
7587
7588 return count;
7589} 7580}
7590 7581
7591/* Unbind the binding that we made to check for X errors. */ 7582/* Undo the last x_catch_errors call.
7583 DPY should be the display that was passed to x_catch_errors. */
7592 7584
7593static Lisp_Object 7585void
7594x_catch_errors_unwind (dummy) 7586x_uncatch_errors (dpy)
7595 Lisp_Object dummy; 7587 Display *dpy;
7596{ 7588{
7597 Display *dpy = x_error_message->dpy;
7598 struct x_error_message_stack *tmp; 7589 struct x_error_message_stack *tmp;
7599 7590
7591 eassert (x_error_message && dpy == x_error_message->dpy);
7592
7600 /* The display may have been closed before this function is called. 7593 /* The display may have been closed before this function is called.
7601 Check if it is still open before calling XSync. */ 7594 Check if it is still open before calling XSync. */
7602 if (x_display_info_for_display (dpy) != 0) 7595 if (x_display_info_for_display (dpy) != 0)
@@ -7608,12 +7601,7 @@ x_catch_errors_unwind (dummy)
7608 7601
7609 tmp = x_error_message; 7602 tmp = x_error_message;
7610 x_error_message = x_error_message->prev; 7603 x_error_message = x_error_message->prev;
7611 free (tmp); 7604 xfree (tmp);
7612
7613 eassert (EQ (dummy,
7614 make_number ((EMACS_INT)dpy + (EMACS_INT)x_error_message)));
7615
7616 return Qnil;
7617} 7605}
7618 7606
7619/* If any X protocol errors have arrived since the last call to 7607/* If any X protocol errors have arrived since the last call to
@@ -7629,7 +7617,12 @@ x_check_errors (dpy, format)
7629 XSync (dpy, False); 7617 XSync (dpy, False);
7630 7618
7631 if (x_error_message->string[0]) 7619 if (x_error_message->string[0])
7632 error (format, x_error_message->string); 7620 {
7621 char string[X_ERROR_MESSAGE_SIZE];
7622 bcopy (x_error_message->string, string, X_ERROR_MESSAGE_SIZE);
7623 x_uncatch_errors (dpy);
7624 error (format, string);
7625 }
7633} 7626}
7634 7627
7635/* Nonzero if we had any X protocol errors 7628/* Nonzero if we had any X protocol errors
@@ -7654,19 +7647,6 @@ x_clear_errors (dpy)
7654 x_error_message->string[0] = 0; 7647 x_error_message->string[0] = 0;
7655} 7648}
7656 7649
7657/* Stop catching X protocol errors and let them make Emacs die.
7658 DPY should be the display that was passed to x_catch_errors.
7659 COUNT should be the value that was returned by
7660 the corresponding call to x_catch_errors. */
7661
7662void
7663x_uncatch_errors (dpy, count)
7664 Display *dpy;
7665 int count;
7666{
7667 unbind_to (count, Qnil);
7668}
7669
7670#if 0 7650#if 0
7671static unsigned int x_wire_count; 7651static unsigned int x_wire_count;
7672x_trace_wire () 7652x_trace_wire ()
@@ -7723,7 +7703,6 @@ x_connection_closed (dpy, error_message)
7723{ 7703{
7724 struct x_display_info *dpyinfo = x_display_info_for_display (dpy); 7704 struct x_display_info *dpyinfo = x_display_info_for_display (dpy);
7725 Lisp_Object frame, tail; 7705 Lisp_Object frame, tail;
7726 int count;
7727 7706
7728 error_msg = (char *) alloca (strlen (error_message) + 1); 7707 error_msg = (char *) alloca (strlen (error_message) + 1);
7729 strcpy (error_msg, error_message); 7708 strcpy (error_msg, error_message);
@@ -7733,7 +7712,7 @@ x_connection_closed (dpy, error_message)
7733 below. Otherwise, we might end up with printing ``can't find per 7712 below. Otherwise, we might end up with printing ``can't find per
7734 display information'' in the recursive call instead of printing 7713 display information'' in the recursive call instead of printing
7735 the original message here. */ 7714 the original message here. */
7736 count = x_catch_errors (dpy); 7715 x_catch_errors (dpy);
7737 7716
7738 /* We have to close the display to inform Xt that it doesn't 7717 /* We have to close the display to inform Xt that it doesn't
7739 exist anymore. If we don't, Xt will continue to wait for 7718 exist anymore. If we don't, Xt will continue to wait for
@@ -7801,7 +7780,7 @@ x_connection_closed (dpy, error_message)
7801 if (dpyinfo) 7780 if (dpyinfo)
7802 x_delete_display (dpyinfo); 7781 x_delete_display (dpyinfo);
7803 7782
7804 x_uncatch_errors (dpy, count); 7783 x_uncatch_errors (dpy);
7805 7784
7806 if (x_display_list == 0) 7785 if (x_display_list == 0)
7807 { 7786 {
@@ -9424,7 +9403,6 @@ x_list_fonts (f, pattern, size, maxnames)
9424 = f ? FRAME_X_DISPLAY_INFO (f) : x_display_list; 9403 = f ? FRAME_X_DISPLAY_INFO (f) : x_display_list;
9425 Display *dpy = dpyinfo->display; 9404 Display *dpy = dpyinfo->display;
9426 int try_XLoadQueryFont = 0; 9405 int try_XLoadQueryFont = 0;
9427 int count;
9428 int allow_auto_scaled_font = 0; 9406 int allow_auto_scaled_font = 0;
9429 9407
9430 if (size < 0) 9408 if (size < 0)
@@ -9464,7 +9442,7 @@ x_list_fonts (f, pattern, size, maxnames)
9464 /* At first, put PATTERN in the cache. */ 9442 /* At first, put PATTERN in the cache. */
9465 9443
9466 BLOCK_INPUT; 9444 BLOCK_INPUT;
9467 count = x_catch_errors (dpy); 9445 x_catch_errors (dpy);
9468 9446
9469 if (try_XLoadQueryFont) 9447 if (try_XLoadQueryFont)
9470 { 9448 {
@@ -9545,7 +9523,7 @@ x_list_fonts (f, pattern, size, maxnames)
9545 } 9523 }
9546 } 9524 }
9547 9525
9548 x_uncatch_errors (dpy, count); 9526 x_uncatch_errors (dpy);
9549 UNBLOCK_INPUT; 9527 UNBLOCK_INPUT;
9550 9528
9551 if (names) 9529 if (names)
@@ -9636,7 +9614,7 @@ x_list_fonts (f, pattern, size, maxnames)
9636 XFontStruct *thisinfo; 9614 XFontStruct *thisinfo;
9637 9615
9638 BLOCK_INPUT; 9616 BLOCK_INPUT;
9639 count = x_catch_errors (dpy); 9617 x_catch_errors (dpy);
9640 thisinfo = XLoadQueryFont (dpy, 9618 thisinfo = XLoadQueryFont (dpy,
9641 SDATA (XCAR (tem))); 9619 SDATA (XCAR (tem)));
9642 if (x_had_errors_p (dpy)) 9620 if (x_had_errors_p (dpy))
@@ -9646,7 +9624,7 @@ x_list_fonts (f, pattern, size, maxnames)
9646 thisinfo = NULL; 9624 thisinfo = NULL;
9647 x_clear_errors (dpy); 9625 x_clear_errors (dpy);
9648 } 9626 }
9649 x_uncatch_errors (dpy, count); 9627 x_uncatch_errors (dpy);
9650 UNBLOCK_INPUT; 9628 UNBLOCK_INPUT;
9651 9629
9652 if (thisinfo) 9630 if (thisinfo)
@@ -9802,7 +9780,6 @@ x_load_font (f, fontname, size)
9802{ 9780{
9803 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 9781 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
9804 Lisp_Object font_names; 9782 Lisp_Object font_names;
9805 int count;
9806 9783
9807 /* Get a list of all the fonts that match this name. Once we 9784 /* Get a list of all the fonts that match this name. Once we
9808 have a list of matching fonts, we compare them against the fonts 9785 have a list of matching fonts, we compare them against the fonts
@@ -9841,7 +9818,7 @@ x_load_font (f, fontname, size)
9841 fontname = (char *) SDATA (XCAR (font_names)); 9818 fontname = (char *) SDATA (XCAR (font_names));
9842 9819
9843 BLOCK_INPUT; 9820 BLOCK_INPUT;
9844 count = x_catch_errors (FRAME_X_DISPLAY (f)); 9821 x_catch_errors (FRAME_X_DISPLAY (f));
9845 font = (XFontStruct *) XLoadQueryFont (FRAME_X_DISPLAY (f), fontname); 9822 font = (XFontStruct *) XLoadQueryFont (FRAME_X_DISPLAY (f), fontname);
9846 if (x_had_errors_p (FRAME_X_DISPLAY (f))) 9823 if (x_had_errors_p (FRAME_X_DISPLAY (f)))
9847 { 9824 {
@@ -9850,7 +9827,7 @@ x_load_font (f, fontname, size)
9850 font = NULL; 9827 font = NULL;
9851 x_clear_errors (FRAME_X_DISPLAY (f)); 9828 x_clear_errors (FRAME_X_DISPLAY (f));
9852 } 9829 }
9853 x_uncatch_errors (FRAME_X_DISPLAY (f), count); 9830 x_uncatch_errors (FRAME_X_DISPLAY (f));
9854 UNBLOCK_INPUT; 9831 UNBLOCK_INPUT;
9855 if (!font) 9832 if (!font)
9856 return NULL; 9833 return NULL;
@@ -10778,7 +10755,6 @@ x_term_init (display_name, xrm_option, resource_name)
10778 Display *dpy = dpyinfo->display; 10755 Display *dpy = dpyinfo->display;
10779 XrmValue d, fr, to; 10756 XrmValue d, fr, to;
10780 Font font; 10757 Font font;
10781 int count;
10782 10758
10783 d.addr = (XPointer)&dpy; 10759 d.addr = (XPointer)&dpy;
10784 d.size = sizeof (Display *); 10760 d.size = sizeof (Display *);
@@ -10786,12 +10762,12 @@ x_term_init (display_name, xrm_option, resource_name)
10786 fr.size = sizeof (XtDefaultFont); 10762 fr.size = sizeof (XtDefaultFont);
10787 to.size = sizeof (Font *); 10763 to.size = sizeof (Font *);
10788 to.addr = (XPointer)&font; 10764 to.addr = (XPointer)&font;
10789 count = x_catch_errors (dpy); 10765 x_catch_errors (dpy);
10790 if (!XtCallConverter (dpy, XtCvtStringToFont, &d, 1, &fr, &to, NULL)) 10766 if (!XtCallConverter (dpy, XtCvtStringToFont, &d, 1, &fr, &to, NULL))
10791 abort (); 10767 abort ();
10792 if (x_had_errors_p (dpy) || !XQueryFont (dpy, font)) 10768 if (x_had_errors_p (dpy) || !XQueryFont (dpy, font))
10793 XrmPutLineResource (&xrdb, "Emacs.dialog.*.font: 9x15"); 10769 XrmPutLineResource (&xrdb, "Emacs.dialog.*.font: 9x15");
10794 x_uncatch_errors (dpy, count); 10770 x_uncatch_errors (dpy);
10795 } 10771 }
10796#endif 10772#endif
10797#endif 10773#endif
diff --git a/src/xterm.h b/src/xterm.h
index aeb408fd170..b92a27979dd 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -961,9 +961,9 @@ void x_delete_display P_ ((struct x_display_info *));
961void x_make_frame_visible P_ ((struct frame *)); 961void x_make_frame_visible P_ ((struct frame *));
962void x_iconify_frame P_ ((struct frame *)); 962void x_iconify_frame P_ ((struct frame *));
963void x_wm_set_size_hint P_ ((struct frame *, long, int)); 963void x_wm_set_size_hint P_ ((struct frame *, long, int));
964int x_catch_errors P_ ((Display *)); 964void x_catch_errors P_ ((Display *));
965int x_had_errors_p P_ ((Display *)); 965int x_had_errors_p P_ ((Display *));
966void x_uncatch_errors P_ ((Display *, int)); 966void x_uncatch_errors P_ ((Display *));
967void x_check_errors P_ ((Display *, char *)); 967void x_check_errors P_ ((Display *, char *));
968int x_text_icon P_ ((struct frame *, char *)); 968int x_text_icon P_ ((struct frame *, char *));
969int x_bitmap_icon P_ ((struct frame *, Lisp_Object)); 969int x_bitmap_icon P_ ((struct frame *, Lisp_Object));
@@ -977,10 +977,10 @@ extern void cancel_mouse_face P_ ((struct frame *));
977extern void x_scroll_bar_clear P_ ((struct frame *)); 977extern void x_scroll_bar_clear P_ ((struct frame *));
978extern int x_text_icon P_ ((struct frame *, char *)); 978extern int x_text_icon P_ ((struct frame *, char *));
979extern int x_bitmap_icon P_ ((struct frame *, Lisp_Object)); 979extern int x_bitmap_icon P_ ((struct frame *, Lisp_Object));
980extern int x_catch_errors P_ ((Display *)); 980extern void x_catch_errors P_ ((Display *));
981extern void x_check_errors P_ ((Display *, char *)); 981extern void x_check_errors P_ ((Display *, char *));
982extern int x_had_errors_p P_ ((Display *)); 982extern int x_had_errors_p P_ ((Display *));
983extern void x_uncatch_errors P_ ((Display *, int)); 983extern void x_uncatch_errors P_ ((Display *));
984extern void x_set_window_size P_ ((struct frame *, int, int, int)); 984extern void x_set_window_size P_ ((struct frame *, int, int, int));
985extern void x_set_mouse_position P_ ((struct frame *, int, int)); 985extern void x_set_mouse_position P_ ((struct frame *, int, int));
986extern void x_set_mouse_pixel_position P_ ((struct frame *, int, int)); 986extern void x_set_mouse_pixel_position P_ ((struct frame *, int, int));