summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorKaroly Lorentey <lorentey@elte.hu>2007-01-06 15:25:16 +0000
committerKaroly Lorentey <lorentey@elte.hu>2007-01-06 15:25:16 +0000
commit191ae1cf7cd2571277635b3b8e488e773ca5c9b9 (patch)
treee0b26e3040767dae38fb39a03b757da05088c58f /lisp
parent382707ecfb50f8c7794a7ba3d8cd9db9b6cd29d0 (diff)
parentf85c5e3b72855951b071eacb7b6e2d002c5fc4be (diff)
downloademacs-191ae1cf7cd2571277635b3b8e488e773ca5c9b9.tar.gz
Merged from emacs@sv.gnu.org
Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-585 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-586 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-587 Update from erc--emacs--22 * emacs@sv.gnu.org/emacs--devo--0--patch-588 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-589 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-590 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-591 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-592
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog178
-rw-r--r--lisp/cus-edit.el10
-rw-r--r--lisp/emulation/viper.el4
-rw-r--r--lisp/erc/ChangeLog78
-rw-r--r--lisp/erc/erc-backend.el112
-rw-r--r--lisp/erc/erc-networks.el8
-rw-r--r--lisp/erc/erc-services.el67
-rw-r--r--lisp/erc/erc.el40
-rw-r--r--lisp/faces.el5
-rw-r--r--lisp/files.el10
-rw-r--r--lisp/gnus/ChangeLog5
-rw-r--r--lisp/gnus/gnus-soup.el62
-rw-r--r--lisp/image.el4
-rw-r--r--lisp/international/mule.el7
-rw-r--r--lisp/isearch.el16
-rw-r--r--lisp/iswitchb.el17
-rw-r--r--lisp/progmodes/cc-align.el23
-rw-r--r--lisp/progmodes/cc-awk.el2
-rw-r--r--lisp/progmodes/cc-cmds.el623
-rw-r--r--lisp/progmodes/cc-defs.el8
-rw-r--r--lisp/progmodes/cc-engine.el319
-rw-r--r--lisp/progmodes/cc-langs.el25
-rw-r--r--lisp/progmodes/cc-mode.el9
-rw-r--r--lisp/progmodes/cc-styles.el5
-rw-r--r--lisp/progmodes/cc-vars.el11
-rw-r--r--lisp/progmodes/cfengine.el2
-rw-r--r--lisp/progmodes/ebrowse.el6
-rw-r--r--lisp/progmodes/gdb-ui.el22
-rw-r--r--lisp/simple.el2
-rw-r--r--lisp/subr.el42
-rw-r--r--lisp/textmodes/table.el10
-rw-r--r--lisp/tutorial.el2
-rw-r--r--lisp/wid-edit.el5
-rw-r--r--lisp/woman.el2
34 files changed, 1224 insertions, 517 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 1cd2f794e5f..d1825190c1a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,173 @@
+2007-01-05 Takaaki Ota <Takaaki.Ota@am.sony.com>
+
+ * textmodes/table.el (table--warn-incompatibility):
+ Use display-warning instead of momentary-string-display.
+
+2007-01-05 Richard Stallman <rms@gnu.org>
+
+ * image.el (image-type-header-regexps): Recognize xbm more strictly.
+
+ * simple.el (backward-kill-word): Doc fix.
+
+2007-01-05 Romain Francoise <romain@orebokech.com>
+
+ * international/mule.el (sgml-html-meta-auto-coding-function):
+ Ensure that the buffer contains a HTML document.
+
+2007-01-05 Dan Nicolaescu <dann@ics.uci.edu>
+
+ * faces.el (momentary): Move here ...
+ * subr.el (momentary): ... from here.
+
+2007-01-05 Nick Roberts <nickrob@snap.net.nz>
+
+ * progmodes/gdb-ui.el (gdb-max-children): New customizable variable.
+ (gdb-speedbar-expand-node): Ask user for confirmation before expanding
+ large structures/arrays.
+
+2007-01-04 Juanma Barranquero <lekktu@gmail.com>
+
+ * files.el (find-file-noselect-1, set-visited-file-name):
+ Allow backup-enable-predicate to be nil.
+
+2007-01-04 Kevin Rodgers <kevin.d.rodgers@gmail.com>
+
+ * subr.el (momentary): New face.
+ (momentary-string-display): Display the string via a temporary
+ overlay using the new face, instead of inserting it in the buffer.
+
+2007-01-04 Andreas Schwab <schwab@suse.de>
+
+ * progmodes/ebrowse.el (ebrowse-global-prefix-key): Fix typo in
+ last change.
+
+2007-01-03 Richard Stallman <rms@gnu.org>
+
+ * woman.el (woman-decode-buffer): Clarify error message.
+
+2007-01-03 Alan Mackenzie <acm@muc.de>
+
+ * progmode/cc-cmds.el (c-mask-paragraph): Fix yesterday's buggy
+ patch.
+
+2007-01-03 Chris Moore <christopher.ian.moore@gmail.com> (tiny change)
+
+ * tutorial.el (tutorial--describe-nonstandard-key): Fix typo.
+
+2007-01-03 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * iswitchb.el (iswitchb-global-map): Use command-remapping if available.
+
+2007-01-02 Juanma Barranquero <lekktu@gmail.com>
+
+ * emulation/viper.el (viper-custom-file-name, viper-mode):
+ Fix typos in docstrings.
+
+ * subr.el (momentary-string-display): After moving point, set POS
+ variable to it to avoid later errors once the buffer is modified.
+ Doc fix.
+
+2007-01-02 Alan Mackenzie <acm@muc.de>
+
+ * progmodes/cc-cmds.el (c-mask-paragraph): In a block comment,
+ check that the "*/" is present before trying to manipulate it.
+
+2007-01-02 Richard Stallman <rms@gnu.org>
+
+ * wid-edit.el (widget-choose): Avoid ugly error for function keys.
+
+ * progmodes/cfengine.el (cfengine-font-lock-syntactic-keywords):
+ Fix format of value.
+
+ * cus-edit.el (customize-unsaved): Rename from customize-customized.
+ Change messages accordingly.
+ (customize-customized): Now alias.
+
+2007-01-02 Juanma Barranquero <lekktu@gmail.com>
+
+ * files.el (version-control): Doc fix.
+
+2007-01-01 Alan Mackenzie <acm@muc.de>
+
+ * progmodes/cc-engine.el (c-guess-basic-syntax, case 5N):
+ Check the format of c-state-cache is valid for an optimisation before
+ using it.
+
+ * progmodes/cc-engine.el (c-guess-basic-syntax): New case 5Q "we
+ are at a statement within a macro". Other changes so that only
+ the first continuation line in a macro gets the symbol
+ `cpp-define-intro', the others getting `statement', or whatever.
+
+ * progmodes/cc-cmds.el (c-context-line-break): When invoked within
+ a string, preserve whitespace. Add a backslash only when also in
+ a macro.
+
+ * progmodes/cc-defs.el: Correct typos.
+
+ * progmodes/cc-cmds.el (c-context-line-break): Don't indent the
+ new line after an escaped EOL in a string.
+
+ * progmodes/cc-engine.el (c-forward-label): Recognise "foo:" as a
+ label when it directly follows "else", "do", ....
+
+ * progmodes/cc-engine.el (c-backward-<>-arglist): Tolerate empty
+ angle brackets (as seen in "explicit specialisations" of C++
+ templates).
+
+ * progmodes/cc-vars.el (c-indentation-style): Mention c-file-style
+ in the doc-string.
+
+ * progmodes/cc-cmds.el (c-mask-paragraph): Fix for C comments,
+ when the comment ender looks like "=========*/" and is alone on
+ its line.
+
+ * progmodes/cc-langs.el, progmodes/cc-engine.el: Correct the
+ spelling of c-opt-op-identiTier-prefix, t -> f. Leave an alias
+ for the old name.
+
+ * progmodes/cc-mode.el: Bind C-M-a and C-M-e to
+ c-\(beginning\|end\)-of-defun by default.
+
+ * progmodes/cc-align.el (c-lineup-gnu-DEFUN-intro-cont):
+ New line-up function, for the DEFUN macro in the Emacs C sources.
+ Only used in "gnu" style.
+
+ * progmodes/cc-styles.el (c-style-alist): Use this new function in
+ the "gnu" style.
+
+ * progmodes/cc-cmds.el (c-electric-slash): Extend the handling of
+ clean-up comment-close-slash also to work when there's a comment
+ terminator on the line.
+ (c-beginning-of-defun, c-end-of-defun): Refactor and optimise
+ these for large arg - only take account of top level {..}, except
+ for initial and final adjustments. M-- C-M-[ae] now go to the
+ right defuns when the starting point is between defuns. They use
+ the four new functions:
+ (c-in-function-trailer-p, c-where-wrt-brace-construct)
+ (c-backward-to-nth-BOF-{, c-forward-to-nth-EOF-}): New functions to
+ support c-\(beginning\|end\)-of-defun.
+
+ * progmodes/cc-engine.el (c-forward-label): Analyze ":"
+ expressions more rigorously, to exclude bit-field specifiers from
+ being classed as labels.
+ (c-forward-label): When analyzing a ":" within a macro, be careful
+ about using c-forward-syntactic-ws at the macro beginning.
+ (c-beginning-of-decl-1): Whilst searching for "=" as evidence of a
+ stmt boundary, check for "operator=", etc.
+
+ * progmodes/cc-mode.el (c-postprocess-file-styles):
+ Bind inhibit-read-only to t, around the call to
+ c-remove-any-local-eval-or-mode-variables, so that it works on a
+ RO file.
+
+ * progmodes/cc-defs.el (c-version): Update the version number to
+ "5.31.4".
+
+2007-01-01 Richard Stallman <rms@gnu.org>
+
+ * isearch.el (isearch-done): Use FOUND-POINT or FOUND-START
+ only if we restored isearch-window-configuration.
+
2006-12-31 Romain Francoise <romain@orebokech.com>
* net/tramp.el (tramp-default-method): Don't use `symbol-function'.
@@ -165,9 +335,9 @@
2006-12-25 Michael R. Mauger <mmaug@yahoo.com>
- * progmodes/sql.el (sql-mode-abbrev-table): Corrected initialization.
+ * progmodes/sql.el (sql-mode-abbrev-table): Correct initialization.
(sql-mode-syntax-table): Disable double quoted strings.
- (sql-mode-font-lock-object-name): Added TYPE and TYPE BODY.
+ (sql-mode-font-lock-object-name): Add TYPE and TYPE BODY.
2006-12-25 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
@@ -2216,8 +2386,8 @@
2006-10-19 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
- * select.el (ccl-check-utf-8, string-utf-8-p): New functions
- (by Kenichi Handa).
+ * select.el (ccl-check-utf-8, string-utf-8-p): New functions (by
+ Kenichi Handa).
(xselect-convert-to-string): Decline requests for UTF8_STRING if
the selection is not UTF-8.
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index 59026942281..27ce163157b 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -1320,9 +1320,11 @@ suggest to customize that face, if it's customizable."
(format "*Customize Face: %s*"
(custom-unlispify-tag-name face)))))
+(defalias 'customize-customized 'customize-unsaved)
+
;;;###autoload
-(defun customize-customized ()
- "Customize all user options set since the last save in this session."
+(defun customize-unsaved ()
+ "Customize all user options set in this session but not saved."
(interactive)
(let ((found nil))
(mapatoms (lambda (symbol)
@@ -1335,9 +1337,9 @@ suggest to customize that face, if it's customizable."
(boundp symbol)
(push (list symbol 'custom-variable) found))))
(if (not found)
- (error "No customized user options")
+ (error "No user options are set but unsaved")
(custom-buffer-create (custom-sort-items found t nil)
- "*Customize Customized*"))))
+ "*Customize Unsaved*"))))
;;;###autoload
(defun customize-rogue ()
diff --git a/lisp/emulation/viper.el b/lisp/emulation/viper.el
index fd1a8aa92ea..4173856fdd1 100644
--- a/lisp/emulation/viper.el
+++ b/lisp/emulation/viper.el
@@ -325,7 +325,7 @@
;; better be defined before Viper custom group.
(defvar viper-custom-file-name (convert-standard-filename "~/.viper")
- "Viper customisation file.
+ "Viper customization file.
If set by the user, this must be done _before_ Viper is loaded in `~/.emacs'.")
(defgroup viper nil
@@ -360,7 +360,7 @@ user decide when to invoke Viper in a major mode."
(t 'ask))
"To Viperize or not to Viperize.
If t, viperize Emacs. If nil -- don't. If `ask', ask the user.
-This variable is used primatily when Viper is being loaded.
+This variable is used primarily when Viper is being loaded.
Must be set in `~/.emacs' before Viper is loaded.
DO NOT set this variable interactively, unless you are using the customization
diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog
index b356f83b0b2..fa087fb513f 100644
--- a/lisp/erc/ChangeLog
+++ b/lisp/erc/ChangeLog
@@ -1,3 +1,56 @@
+2006-12-28 Michael Olson <mwolson@gnu.org>
+
+ * erc-list.el: Change header to mention that this is part of ERC,
+ rather than GNU Emacs.
+
+ * erc-networks.el (erc-server-alist): Add Ars OpenIRC and
+ LinuxChix networks. Thanks to Angelina Carlton for mentioning
+ them. Properly escape periods in Konfido.Net and Kewl.Org.
+ (erc-networks-alist): Add entries for Ars and LinuxChix, though
+ the latter does not actually provide an announced network name.
+
+ * erc-services.el (erc-nickserv-identify-mode): Add 'both method,
+ which waits for a NickServ message if the network supports it,
+ otherwise sends the password after connecting.
+ (erc-nickserv-identify-mode): Default to 'both.
+ (erc-nickserv-passwords): Add OFTC and Azzurra to custom options.
+ (erc-nickserv-alist): Indentation fix.
+ (erc-nickserv-identify-on-connect)
+ (erc-nickserv-identify-on-nick-change): Handle 'both method.
+
+2006-12-28 Leo <sdl.web@gmail.com> (tiny change)
+
+ * erc.el (erc-iswitchb): Wrap body in unwind-protect so that
+ hitting C-g does not leave iswitchb-mode on.
+
+2006-12-27 Michael Olson <mwolson@gnu.org>
+
+ * erc.el (erc-cmd-RECONNECT): New command that calls
+ erc-server-reconnect.
+
+ * erc-backend.el (erc-server-reconnect-count): New server variable
+ that keeps track of reconnection attempts.
+ (erc-server-reconnect-attempts): New option that determines the
+ number of reconnection attempts that ERC will make per server.
+ (erc-server-reconnect-timeout): New option that determines the
+ amount of time, in seconds, that ERC will wait between successive
+ reconnect attempts.
+ (erc-server-reconnect): New function that reestablishes the
+ current IRC connection. Move some commands from
+ erc-process-sentinel-1 here.
+ (erc-process-sentinel-1): If we have been disconnected, loop until
+ we either reconnect or run out of attempts.
+ (erc-server-reconnect-p): Move higher and make this a defsubst,
+ since I'm worried about the current buffer changing from
+ underneath us. Implement limit of number of reconnect attempts..
+
+ * erc.texi (Getting Started): Update for /RECONNECT command.
+
+2006-12-26 Michael Olson <mwolson@gnu.org>
+
+ * erc.el (erc-open): Restore old point correctly, or at least get
+ closer to doing so than before.
+
2006-12-13 Leo <sdl.web@gmail.com> (tiny change)
* erc.el (erc-iswitchb): Temporarily enable iswitchb mode if it
@@ -38,7 +91,7 @@
(erc-update-current-channel-member, erc-load-script):
(erc-mode-line-away-status-format): Doc fixes.
-2006-11-20 Andrea Russo <rastandy@inventati.org>
+2006-11-20 Andrea Russo <rastandy@inventati.org> (tiny change)
* erc-dcc.el (erc-dcc-chat-setup): Initialize `erc-input-marker'
before calling `erc-display-prompt'.
@@ -111,7 +164,7 @@
`erc-show-my-nick' is non-nil.
(erc-compute-server): Doc fix.
-2006-10-01 John J Foerch <jjfoerch@earthlink.net>
+2006-10-01 John J Foerch <jjfoerch@earthlink.net> (tiny change)
* erc-stamp.el (erc-insert-timestamp-right): Exclude the newline
from the erc-timestamp field.
@@ -121,7 +174,7 @@
* erc-nicklist.el (erc-nicklist-insert-contents): Add missing
parenthesis. Thanks to Stephan Stahl for the report.
-2006-09-10 Eric Hanchrow <offby1@blarg.net>
+2006-09-10 Eric Hanchrow <offby1@blarg.net> (tiny change)
* erc.el (erc-cmd-IGNORE): Prompt user if this might be a regexp
instead of a single user.
@@ -230,6 +283,13 @@
* NEWS: Added note about these changes.
+2006-08-20 Diane Murray <disumu@x3y2z1.net>
+
+ * erc-backend.el (erc-process-sentinel-1): Doc fix. Let
+ `erc-server-reconnect-p' check all condition cases.
+ (erc-server-reconnect-p): Moved rest of checks from
+ `erc-process-sentinel-1' to here. Now takes an argument, EVENT.
+
2006-08-21 Diane Murray <disumu@x3y2z1.net>
* erc-track.el (erc-track-mode-line-mouse-face): New variable.
@@ -242,6 +302,18 @@
(erc-menu-definition): Name the menu "ERC" instead of "IRC" to
avoid confusion with rcirc and other clients.
+ * erc-backend.el (erc-server-banned): New variable.
+ (erc-server-connect): Set `erc-server-banned' to nil.
+ (erc-process-sentinel-1): Use `erc-server-reconnect-p'.
+ (erc-server-reconnect-p): New function. Return non-nil if the
+ user wants automatic reconnects and if the user has not been
+ banned from the server. This should fix a bug where ERC gets into
+ a loop trying to reconnect with no way to stop it when the user is
+ denied access to the server due to a server ban. It might also
+ help when Tor users are blocked from freenode if freenode servers
+ send the 465 message before disconnecting.
+ (465): Handle "banned from server" error notices.
+
2006-08-13 Romain Francoise <romain@orebokech.com>
* erc-match.el (erc-log-matches-make-buffer): End `y-or-n-p'
diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el
index 82934f92218..c589ae282a6 100644
--- a/lisp/erc/erc-backend.el
+++ b/lisp/erc/erc-backend.el
@@ -179,10 +179,18 @@ WALLCHOPS - supports sending messages to all operators in a channel")
This variable is buffer-local.")
(make-variable-buffer-local 'erc-server-connected)
+(defvar erc-server-reconnect-count 0
+ "Number of times we have failed to reconnect to the current server.")
+(make-variable-buffer-local 'erc-server-reconnect-count)
+
(defvar erc-server-quitting nil
"Non-nil if the user requests a quit.")
(make-variable-buffer-local 'erc-server-quitting)
+(defvar erc-server-banned nil
+ "Non-nil if the user is denied access because of a server ban.")
+(make-variable-buffer-local 'erc-server-banned)
+
(defvar erc-server-lines-sent nil
"Line counter.")
(make-variable-buffer-local 'erc-server-lines-sent)
@@ -259,6 +267,23 @@ Reconnection will happen automatically for any unexpected disconnection."
:group 'erc-server
:type 'boolean)
+(defcustom erc-server-reconnect-attempts 2
+ "The number of times that ERC will attempt to reestablish a
+broken connection, or t to always attempt to reconnect.
+
+This only has an effect if `erc-server-auto-reconnect' is non-nil."
+ :group 'erc-server
+ :type '(choice (const :tag "Always reconnect" t)
+ integer))
+
+(defcustom erc-server-reconnect-timeout 1
+ "The amount of time, in seconds, that ERC will wait between
+successive reconnect attempts.
+
+If a key is pressed while ERC is waiting, it will stop waiting."
+ :group 'erc-server
+ :type 'number)
+
(defcustom erc-split-line-length 440
"*The maximum length of a single message.
If a message exceeds this size, it is broken into multiple ones.
@@ -434,6 +459,7 @@ We will store server variables in the current buffer."
(message "%s...done" msg))
;; Misc server variables
(setq erc-server-quitting nil)
+ (setq erc-server-banned nil)
(setq erc-server-last-sent-time (erc-current-time))
(setq erc-server-last-ping-time (erc-current-time))
(setq erc-server-lines-sent 0)
@@ -457,6 +483,21 @@ We will store server variables in the current buffer."
"Opening connection..\n")
(erc-login)))
+(defun erc-server-reconnect ()
+"Reestablish the current IRC connection.
+Make sure you are in an ERC buffer when running this."
+ (let ((server (erc-server-buffer)))
+ (unless (and server
+ (buffer-live-p server))
+ (error "Couldn't switch to server buffer"))
+ (with-current-buffer server
+ (erc-update-mode-line)
+ (erc-set-active-buffer (current-buffer))
+ (setq erc-server-last-sent-time 0)
+ (setq erc-server-lines-sent 0)
+ (erc-open erc-session-server erc-session-port erc-server-current-nick
+ erc-session-user-full-name t erc-session-password))))
+
(defun erc-server-filter-function (process string)
"The process filter for the ERC server."
(with-current-buffer (process-buffer process)
@@ -485,11 +526,24 @@ We will store server variables in the current buffer."
(match-end 0))))
(erc-parse-server-response process line)))))))
+(defsubst erc-server-reconnect-p (event)
+ "Return non-nil if ERC should attempt to reconnect automatically.
+EVENT is the message received from the closed connection process."
+ (and erc-server-auto-reconnect
+ (not erc-server-banned)
+ ;; make sure we don't infinitely try to reconnect, unless the
+ ;; user wants that
+ (or (eq erc-server-reconnect-attempts t)
+ (and (integerp erc-server-reconnect-attempts)
+ (< erc-server-reconnect-count erc-server-reconnect-attempts)))
+ (not (string-match "^deleted" event))
+ ;; open-network-stream-nowait error for connection refused
+ (not (string-match "^failed with code 111" event))))
+
(defun erc-process-sentinel-1 (event)
- "This will be called when erc-process-sentinel has decided that we
-are going to quit. Determine whether user has quit or whether erc has
-been terminated. Conditionally try to reconnect and take appropriate
-action."
+ "Called when `erc-process-sentinel' has decided that we're disconnecting.
+Determine whether user has quit or whether erc has been terminated.
+Conditionally try to reconnect and take appropriate action."
(if erc-server-quitting
;; normal quit
(progn
@@ -498,25 +552,26 @@ action."
(set-buffer-modified-p nil)
(kill-buffer (current-buffer))))
;; unexpected disconnect
- (erc-display-message nil 'error (current-buffer)
- (if erc-server-auto-reconnect
- 'disconnected
- 'disconnected-noreconnect))
- (erc-update-mode-line)
- (erc-set-active-buffer (current-buffer))
- (setq erc-server-last-sent-time 0)
- (setq erc-server-lines-sent 0)
- (if (and erc-server-auto-reconnect
- (not (string-match "^deleted" event))
- ;; open-network-stream-nowait error for connection refused
- (not (string-match "^failed with code 111" event)))
- ;; Yuck, this should perhaps funcall
- ;; erc-server-reconnect-function with no args
- (erc-open erc-session-server erc-session-port erc-server-current-nick
- erc-session-user-full-name t erc-session-password)
- ;; terminate, do not reconnect
- (erc-display-message nil 'error (current-buffer)
- 'terminated ?e event))))
+ (let ((again t))
+ (while again
+ (setq again nil)
+ (erc-display-message nil 'error (current-buffer)
+ (if (erc-server-reconnect-p event)
+ 'disconnected
+ 'disconnected-noreconnect))
+ (if (erc-server-reconnect-p event)
+ (condition-case err
+ (progn
+ (erc-server-reconnect)
+ (setq erc-server-reconnect-count 0))
+ (error (when (integerp erc-server-reconnect-attempts)
+ (setq erc-server-reconnect-count
+ (1+ erc-server-reconnect-count))
+ (sit-for erc-server-reconnect-timeout)
+ (setq again t))))
+ ;; terminate, do not reconnect
+ (erc-display-message nil 'error (current-buffer)
+ 'terminated ?e event))))))
(defun erc-process-sentinel (cproc event)
"Sentinel function for ERC process."
@@ -1708,6 +1763,14 @@ See `erc-display-server-message'." nil
?c (second (erc-response.command-args parsed))
?m (erc-response.contents parsed)))
+(define-erc-response-handler (465)
+ "You are banned from this server." nil
+ (setq erc-server-banned t)
+ ;; show the server's message, as a reason might be provided
+ (erc-display-error-notice
+ parsed
+ (erc-response.contents parsed)))
+
(define-erc-response-handler (474)
"Banned from channel errors" nil
(erc-display-message parsed '(notice error) nil
@@ -1741,7 +1804,7 @@ See `erc-display-server-message'." nil
(erc-display-message parsed '(error notice) 'active 's482
?c channel ?m message)))
-(define-erc-response-handler (431 445 446 451 462 463 464 465 481 483 484 485
+(define-erc-response-handler (431 445 446 451 462 463 464 481 483 484 485
491 501 502)
;; 431 - No nickname given
;; 445 - SUMMON has been disabled
@@ -1750,7 +1813,6 @@ See `erc-display-server-message'." nil
;; 462 - Unauthorized command (already registered)
;; 463 - Your host isn't among the privileged
;; 464 - Password incorrect
- ;; 465 - You are banned from this server
;; 481 - Need IRCop privileges
;; 483 - You can't kill a server!
;; 484 - Your connection is restricted!
diff --git a/lisp/erc/erc-networks.el b/lisp/erc/erc-networks.el
index 99aba31c3d4..034950e665f 100644
--- a/lisp/erc/erc-networks.el
+++ b/lisp/erc/erc-networks.el
@@ -64,6 +64,7 @@
("AngelEyez: Random server" AngelEyez "irc.angeleyez.net" ((6666 7000)))
("AnotherNet: Random server" Anothernet "irc.another.net" (6667 7000 ))
("ArabChat: Random server" ArabChat "irc.arabchat.org" ((6660 6667)))
+ ("Ars-OpenIRC: Random server" Ars "irc.arstechnica.com" 6667)
("AsiaTalk: Random server" AsiaTalk "irc.asiatalk.org" ((6667 6669) 7000 ))
("AstroLink: Random server" AstroLink "irc.astrolink.org" ((6660 6667)))
("Asylumnet: Random server" Asylumnet "irc.asylum-net.org" ((6661 6669) 7000 7777 ))
@@ -280,12 +281,12 @@
("K0wNet: Random server" K0wNet "irc.k0w.net" ((6660 6669)))
("KDFSnet: Random server" KDFSnet "irc.kdfs.net" ((6667 6669)))
("Kemik: Random server" Kemik "irc.kemik.net" 6667)
- ("Kewl.Org: Random server" Kewl.Org "irc.kewl.org" (6667 7000 ))
+ ("Kewl.Org: Random server" Kewl\.Org "irc.kewl.org" (6667 7000 ))
("Kickchat: Random server" Kickchat "irc.kickchat.com" ((6660 6669) 7000 ))
("Kidsworld: Random server" KidsWorld "irc.kidsworld.org" ((6666 6669)))
("Knightnet: AF, ZA, Durban" Knightnet "orc.dbn.za.knightnet.net" (6667 5555 ))
("Knightnet: US, CA, Goldengate" Knightnet "goldengate.ca.us.knightnet.net" (6667 5555 ))
- ("Konfido.Net: Random server" Konfido.Net "irc.konfido.net" 6667)
+ ("Konfido.Net: Random server" Konfido\.Net "irc.konfido.net" 6667)
("KreyNet: Random server" Kreynet "irc.krey.net" 6667)
("Krono: Random server" Krono "irc.krono.net" ((6660 6669) 7000 ))
("Krushnet: Random server" Krushnet "irc.krushnet.org" 6667)
@@ -294,6 +295,7 @@
("LagNet: AF, ZA, Johannesburg" LagNet "mystery.lagnet.org.za" 6667)
("Librenet: Random server" Librenet "irc.librenet.net" 6667)
("LinkNet: Random server" LinkNet "irc.link-net.org" ((6667 6669)))
+ ("LinuxChix: Random server" LinuxChix "irc.linuxchix.org" 6667)
("Liquidized: Random server" Liquidized "irc.liquidized.net" (6667 7000 ))
("M-IRC: Random server" M-IRC "irc.m-sys.org" ((6667 6669)))
("MagicStar: Random server" MagicStar "irc.magicstar.net" 6667)
@@ -457,6 +459,7 @@ PORTS is either a number, a list of numbers, or a list of port ranges."
(AngelEyez "angeleyez.net")
(Anothernet "another.net")
(ArabChat "arabchat.org")
+ (Ars "arstechnica.com")
(AsiaTalk "asiatalk.org")
(AstroLink "astrolink.org")
(Asylumnet "asylumnet.org")
@@ -586,6 +589,7 @@ PORTS is either a number, a list of numbers, or a list of port ranges."
(LagNet "lagnet.org.za")
(Librenet "librenet.net")
(LinkNet "link-net.org")
+ (LinuxChix "cats\.meow\.at\\|linuxchix\.org")
(Liquidized "liquidized.net")
(M-IRC "m-sys.org")
(MagicStar "magicstar.net")
diff --git a/lisp/erc/erc-services.el b/lisp/erc/erc-services.el
index c8bac7fe45c..b93317e6124 100644
--- a/lisp/erc/erc-services.el
+++ b/lisp/erc/erc-services.el
@@ -94,7 +94,7 @@ communication with those Services."
(interactive
(list (intern (completing-read
"Choose Nickserv identify mode (RET to disable): "
- '(("autodetect") ("nick-change")) nil t))))
+ '(("autodetect") ("nick-change") ("both")) nil t))))
(cond ((eq mode 'autodetect)
(setq erc-nickserv-identify-mode 'autodetect)
(add-hook 'erc-server-NOTICE-functions
@@ -111,6 +111,14 @@ communication with those Services."
'erc-nickserv-identify-on-nick-change)
(remove-hook 'erc-server-NOTICE-functions
'erc-nickserv-identify-autodetect))
+ ((eq mode 'both)
+ (setq erc-nickserv-identify-mode 'both)
+ (add-hook 'erc-server-NOTICE-functions
+ 'erc-nickserv-identify-autodetect)
+ (add-hook 'erc-after-connect
+ 'erc-nickserv-identify-on-connect)
+ (add-hook 'erc-nick-changed-functions
+ 'erc-nickserv-identify-on-nick-change))
(t
(setq erc-nickserv-identify-mode nil)
(remove-hook 'erc-server-NOTICE-functions
@@ -120,22 +128,25 @@ communication with those Services."
(remove-hook 'erc-nick-changed-functions
'erc-nickserv-identify-on-nick-change))))
-(defcustom erc-nickserv-identify-mode 'autodetect
+(defcustom erc-nickserv-identify-mode 'both
"The mode which is used when identifying to Nickserv.
Possible settings are:.
'autodetect - Identify when the real Nickserv sends an identify request.
'nick-change - Identify when you change your nickname.
+'both - Do the former if the network supports it, otherwise do the
+ latter.
nil - Disables automatic Nickserv identification.
You can also use M-x erc-nickserv-identify-mode to change modes."
:group 'erc-services
:type '(choice (const autodetect)
(const nick-change)
+ (const both)
(const nil))
:set (lambda (sym val)
- (set-default sym val)
+ (set sym val)
(erc-nickserv-identify-mode val)))
(defcustom erc-prompt-for-nickserv-password t
@@ -156,12 +167,14 @@ Example of use:
(list :tag "Network"
(choice :tag "Network name"
(const freenode)
+ (const OFTC)
(const DALnet)
(const GalaxyNet)
(const SlashNET)
(const BRASnet)
(const iip)
(const Austnet)
+ (const Azzurra)
(symbol :tag "Network name"))
(repeat :tag "Nickname and password"
(cons :tag "Identity"
@@ -209,24 +222,24 @@ Example of use:
"IDENTIFY"
nil
"")
- (Austnet
- "NickOP!service@austnet.org"
- "/msg\\s-NickOP@austnet.org\\s-identify\\s-<password>"
- "nickop@austnet.org"
- "identify"
- nil)
- (Azzurra
- "NickServ!service@azzurra.org"
- "/ns\\s-IDENTIFY\\s-password"
- "NickServ"
- "IDENTIFY"
- nil)
- (OFTC
- "NickServ!services@services.oftc.net"
- "/msg\\s-NickServ\\s-IDENTIFY\\s-\^_password"
- "NickServ"
- "IDENTIFY"
- nil))
+ (Austnet
+ "NickOP!service@austnet.org"
+ "/msg\\s-NickOP@austnet.org\\s-identify\\s-<password>"
+ "nickop@austnet.org"
+ "identify"
+ nil)
+ (Azzurra
+ "NickServ!service@azzurra.org"
+ "/ns\\s-IDENTIFY\\s-password"
+ "NickServ"
+ "IDENTIFY"
+ nil)
+ (OFTC
+ "NickServ!services@services.oftc.net"
+ "/msg\\s-NickServ\\s-IDENTIFY\\s-\^_password"
+ "NickServ"
+ "IDENTIFY"
+ nil))
"Alist of NickServer details, sorted by network.
Every element in the list has the form
\(SYMBOL NICKSERV REGEXP NICK KEYWORD USE-CURRENT ANSWER)
@@ -279,14 +292,18 @@ password for this nickname, otherwise try to send it automatically."
(defun erc-nickserv-identify-on-connect (server nick)
"Identify to Nickserv after the connection to the server is established."
- (unless (and (null erc-nickserv-passwords)
- (null erc-prompt-for-nickserv-password))
+ (unless (or (and (null erc-nickserv-passwords)
+ (null erc-prompt-for-nickserv-password))
+ (and (eq erc-nickserv-identify-mode 'both)
+ (nth 2 (assoc (erc-network) erc-nickserv-alist))))
(erc-nickserv-call-identify-function nick)))
(defun erc-nickserv-identify-on-nick-change (nick old-nick)
"Identify to Nickserv whenever your nick changes."
- (unless (and (null erc-nickserv-passwords)
- (null erc-prompt-for-nickserv-password))
+ (unless (or (and (null erc-nickserv-passwords)
+ (null erc-prompt-for-nickserv-password))
+ (and (eq erc-nickserv-identify-mode 'both)
+ (nth 2 (assoc (erc-network) erc-nickserv-alist))))
(erc-nickserv-call-identify-function nick)))
(defun erc-nickserv-call-identify-function (nickname)
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index 7de2828b86d..427dd178383 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -1672,21 +1672,22 @@ needs to be active for this function to work."
(require 'iswitchb))
(let ((enabled iswitchb-mode))
(or enabled (iswitchb-mode 1))
- (let ((iswitchb-make-buflist-hook
- (lambda ()
- (setq iswitchb-temp-buflist
- (mapcar 'buffer-name
- (erc-buffer-list
- nil
- (when arg erc-server-process)))))))
- (switch-to-buffer
- (iswitchb-read-buffer
- "Switch-to: "
- (if (boundp 'erc-modified-channels-alist)
- (buffer-name (caar (last erc-modified-channels-alist)))
- nil)
- t)))
- (or enabled (iswitchb-mode -1))))
+ (unwind-protect
+ (let ((iswitchb-make-buflist-hook
+ (lambda ()
+ (setq iswitchb-temp-buflist
+ (mapcar 'buffer-name
+ (erc-buffer-list
+ nil
+ (when arg erc-server-process)))))))
+ (switch-to-buffer
+ (iswitchb-read-buffer
+ "Switch-to: "
+ (if (boundp 'erc-modified-channels-alist)
+ (buffer-name (caar (last erc-modified-channels-alist)))
+ nil)
+ t)))
+ (or enabled (iswitchb-mode -1)))))
(defun erc-channel-list (proc)
"Return a list of channel buffers.
@@ -1888,10 +1889,11 @@ Returns the buffer for the given server or channel."
(connected-p (unless connect erc-server-connected))
(buffer (erc-get-buffer-create server port channel))
(old-buffer (current-buffer))
- (old-point (point))
+ old-point
continued-session)
(erc-update-modules)
(set-buffer buffer)
+ (setq old-point (point))
(erc-mode)
(setq erc-server-announced-name server-announced-name)
(setq erc-server-connected connected-p)
@@ -3165,6 +3167,12 @@ the message given by REASON."
(defalias 'erc-cmd-GQ 'erc-cmd-GQUIT)
(put 'erc-cmd-GQUIT 'do-not-parse-args t)
+(defun erc-cmd-RECONNECT ()
+ "Try to reconnect to the current IRC server."
+ (setq erc-server-reconnect-count 0)
+ (erc-server-reconnect)
+ t)
+
(defun erc-cmd-SERVER (server)
"Connect to SERVER, leaving existing connection intact."
(erc-log (format "cmd: SERVER: %s" server))
diff --git a/lisp/faces.el b/lisp/faces.el
index a681c893f26..a3d0e8b6de6 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -2179,6 +2179,11 @@ terminal type to a different value."
:version "21.1"
:group 'basic-faces)
+(defface momentary
+ '((t (:inherit mode-line)))
+ "Face for momentarily displaying text in the current buffer."
+ :group 'display)
+
(defface vertical-border
'((((type tty)) :inherit mode-line-inactive))
"Face used for vertical window dividers on ttys."
diff --git a/lisp/files.el b/lisp/files.el
index 0ce07562505..3834424ed4e 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -242,9 +242,9 @@ breaks any hard links between it and other files."
(defcustom version-control nil
"Control use of version numbers for backup files.
-t means make numeric backup versions unconditionally.
-nil means make them for files that have some already.
-`never' means do not make them."
+When t, make numeric backup versions unconditionally.
+When nil, make them for files that have some already.
+The value `never' means do not make them."
:type '(choice (const :tag "Never" never)
(const :tag "If existing" nil)
(other :tag "Always" t))
@@ -1650,7 +1650,8 @@ Do you want to revisit the file normally now? ")
(setq default-directory (file-name-directory buffer-file-name))
;; Turn off backup files for certain file names. Since
;; this is a permanent local, the major mode won't eliminate it.
- (and (not (funcall backup-enable-predicate buffer-file-name))
+ (and backup-enable-predicate
+ (not (funcall backup-enable-predicate buffer-file-name))
(progn
(make-local-variable 'backup-inhibited)
(setq backup-inhibited t)))
@@ -2905,6 +2906,7 @@ the old visited file has been renamed to the new name FILENAME."
;; Turn off backup files for certain file names.
;; Since this is a permanent local, the major mode won't eliminate it.
(and buffer-file-name
+ backup-enable-predicate
(not (funcall backup-enable-predicate buffer-file-name))
(progn
(make-local-variable 'backup-inhibited)
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index b6b8b1b9bac..ec7476b8758 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,8 @@
+2007-01-05 Reiner Steib <Reiner.Steib@gmx.de>
+
+ * gnus-soup.el (gnus-soup): New custom group. Make user variables
+ customizable.
+
2006-12-30 Andreas Seltenreich <uwi7@rz.uni-karlsruhe.de>
* gnus-sum.el (gnus-summary-insert-dormant-articles): Fix typo in
diff --git a/lisp/gnus/gnus-soup.el b/lisp/gnus/gnus-soup.el
index 31c721d9f1f..31074cb8c77 100644
--- a/lisp/gnus/gnus-soup.el
+++ b/lisp/gnus/gnus-soup.el
@@ -36,36 +36,56 @@
(require 'gnus-start)
(require 'gnus-range)
+(defgroup gnus-soup nil
+ "SOUP packet writing support for Gnus."
+ :group 'gnus)
+
;;; User Variables:
-(defvar gnus-soup-directory (nnheader-concat gnus-home-directory "SoupBrew/")
- "*Directory containing an unpacked SOUP packet.")
+(defcustom gnus-soup-directory (nnheader-concat gnus-home-directory "SoupBrew/")
+ "Directory containing an unpacked SOUP packet."
+ :version "22.1" ;; Gnus 5.10.9
+ :type 'directory)
-(defvar gnus-soup-replies-directory
+(defcustom gnus-soup-replies-directory
(nnheader-concat gnus-soup-directory "SoupReplies/")
- "*Directory where Gnus will do processing of replies.")
+ "Directory where Gnus will do processing of replies."
+ :version "22.1" ;; Gnus 5.10.9
+ :type 'directory)
-(defvar gnus-soup-prefix-file "gnus-prefix"
- "*Name of the file where Gnus stores the last used prefix.")
+(defcustom gnus-soup-prefix-file "gnus-prefix"
+ "Name of the file where Gnus stores the last used prefix."
+ :version "22.1" ;; Gnus 5.10.9
+ :type 'file)
-(defvar gnus-soup-packer "tar cf - %s | gzip > $HOME/Soupout%d.tgz"
+(defcustom gnus-soup-packer "tar cf - %s | gzip > $HOME/Soupout%d.tgz"
"Format string command for packing a SOUP packet.
The SOUP files will be inserted where the %s is in the string.
This string MUST contain both %s and %d. The file number will be
-inserted where %d appears.")
-
-(defvar gnus-soup-unpacker "gunzip -c %s | tar xvf -"
- "*Format string command for unpacking a SOUP packet.
-The SOUP packet file name will be inserted at the %s.")
-
-(defvar gnus-soup-packet-directory gnus-home-directory
- "*Where gnus-soup will look for REPLIES packets.")
-
-(defvar gnus-soup-packet-regexp "Soupin"
- "*Regular expression matching SOUP REPLIES packets in `gnus-soup-packet-directory'.")
-
-(defvar gnus-soup-ignored-headers "^Xref:"
- "*Regexp to match headers to be removed when brewing SOUP packets.")
+inserted where %d appears."
+ :version "22.1" ;; Gnus 5.10.9
+ :type 'string)
+
+(defcustom gnus-soup-unpacker "gunzip -c %s | tar xvf -"
+ "Format string command for unpacking a SOUP packet.
+The SOUP packet file name will be inserted at the %s."
+ :version "22.1" ;; Gnus 5.10.9
+ :type 'string)
+
+(defcustom gnus-soup-packet-directory gnus-home-directory
+ "Where gnus-soup will look for REPLIES packets."
+ :version "22.1" ;; Gnus 5.10.9
+ :type 'directory)
+
+(defcustom gnus-soup-packet-regexp "Soupin"
+ "Regular expression matching SOUP REPLIES packets in `gnus-soup-packet-directory'."
+ :version "22.1" ;; Gnus 5.10.9
+ :type 'regexp)
+
+(defcustom gnus-soup-ignored-headers "^Xref:"
+ "Regexp to match headers to be removed when brewing SOUP packets."
+ :version "22.1" ;; Gnus 5.10.9
+ :type 'regexp)
;;; Internal Variables:
diff --git a/lisp/image.el b/lisp/image.el
index e70b9ec539e..a98ca87f728 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -38,7 +38,9 @@
("\\`P[1-6][[:space:]]+\\(?:#.*[[:space:]]+\\)*[0-9]+[[:space:]]+[0-9]+" . pbm)
("\\`GIF8" . gif)
("\\`\x89PNG\r\n\x1a\n" . png)
- ("\\`[\t\n\r ]*#define" . xbm)
+ ("\\`[\t\n\r ]*#define \\([a-z0-9]+\\)_width [0-9]+\n\
+#define \\1_height [0-9]+\n\
+static char \\1_bits" . xbm)
("\\`\\(?:MM\0\\*\\|II\\*\0\\)" . tiff)
("\\`[\t\n\r ]*%!PS" . postscript)
("\\`\xff\xd8" . (image-jpeg-p . jpeg)))
diff --git a/lisp/international/mule.el b/lisp/international/mule.el
index f9de9ecdf91..0a2c7cbe9ad 100644
--- a/lisp/international/mule.el
+++ b/lisp/international/mule.el
@@ -2299,7 +2299,12 @@ This function is intended to be added to `auto-coding-functions'."
;; In case of no header, search only 10 lines.
(forward-line 10))
(point))))
- (when (re-search-forward "<meta\\s-+http-equiv=[\"']?content-type[\"']?\\s-+content=[\"']text/\\sw+;\\s-*charset=\\(.+?\\)[\"']" size t)
+ ;; Make sure that the buffer really contains an HTML document, by
+ ;; checking that it starts with a doctype or a <HTML> start tag
+ ;; (allowing for whitespace at bob). Note: 'DOCTYPE NETSCAPE' is
+ ;; useful for Mozilla bookmark files.
+ (when (and (re-search-forward "\\`[[:space:]\n]*\\(<!doctype[[:space:]\n]+\\(html\\|netscape\\)\\|<html\\)" size t)
+ (re-search-forward "<meta\\s-+http-equiv=[\"']?content-type[\"']?\\s-+content=[\"']text/\\sw+;\\s-*charset=\\(.+?\\)[\"']" size t))
(let* ((match (match-string 1))
(sym (intern (downcase match))))
(if (coding-system-p sym)
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 85e0bb6763f..6ef83c68fd8 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -784,13 +784,15 @@ NOPUSH is t and EDIT is t."
(lazy-highlight-cleanup lazy-highlight-cleanup)
(let ((found-start (window-start (selected-window)))
(found-point (point)))
- (if isearch-window-configuration
- (set-window-configuration isearch-window-configuration))
-
- (if isearch-small-window
- (goto-char found-point)
- ;; Exiting the save-window-excursion clobbers window-start; restore it.
- (set-window-start (selected-window) found-start t)))
+ (when isearch-window-configuration
+ (set-window-configuration isearch-window-configuration)
+ (if isearch-small-window
+ (goto-char found-point)
+ ;; set-window-configuration clobbers window-start; restore it.
+ ;; This has an annoying side effect of clearing the last_modiff
+ ;; field of the window, which can cause unwanted scrolling,
+ ;; so don't do it unless truly necessary.
+ (set-window-start (selected-window) found-start t))))
(setq isearch-mode nil)
(if isearch-input-method-local-p
diff --git a/lisp/iswitchb.el b/lisp/iswitchb.el
index 93d4755cf3a..98fad7bf824 100644
--- a/lisp/iswitchb.el
+++ b/lisp/iswitchb.el
@@ -1,7 +1,7 @@
;;; iswitchb.el --- switch between buffers using substrings
;; Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004,
-;; 2005, 2006 Free Software Foundation, Inc.
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: Stephen Eglen <stephen@gnu.org>
;; Maintainer: Stephen Eglen <stephen@gnu.org>
@@ -495,14 +495,13 @@ interfere with other minibuffer usage.")
(defvar iswitchb-global-map
(let ((map (make-sparse-keymap)))
- (substitute-key-definition 'switch-to-buffer ; normally C-x b
- 'iswitchb-buffer map global-map)
- (substitute-key-definition 'switch-to-buffer-other-window ; C-x 4 b
- 'iswitchb-buffer-other-window map global-map)
- (substitute-key-definition 'switch-to-buffer-other-frame ; C-x 5 b
- 'iswitchb-buffer-other-frame map global-map)
- (substitute-key-definition 'display-buffer ; C-x 4 C-o
- 'iswitchb-display-buffer map global-map)
+ (dolist (b '((switch-to-buffer . iswitchb-buffer)
+ (switch-to-buffer-other-window . iswitchb-buffer-other-window)
+ (switch-to-buffer-other-frame . iswitchb-buffer-other-frame)
+ (display-buffer . iswitchb-display-buffer)))
+ (if (fboundp 'command-remapping)
+ (define-key map (vector 'remap (car b)) (cdr b))
+ (substitute-key-definition (car b) (cdr b) map global-map)))
map)
"Global keymap for `iswitchb-mode'.")
diff --git a/lisp/progmodes/cc-align.el b/lisp/progmodes/cc-align.el
index 9c2427a71af..847e43a46b7 100644
--- a/lisp/progmodes/cc-align.el
+++ b/lisp/progmodes/cc-align.el
@@ -90,6 +90,29 @@ Works with: topmost-intro-cont."
(c-after-special-operator-id))))
c-basic-offset)))
+(defun c-lineup-gnu-DEFUN-intro-cont (langelem)
+ "Line up the continuation lines of a DEFUN macro in the Emacs C source.
+These lines are indented as though they were `knr-argdecl-intro' lines.
+Return nil when we're not in such a construct.
+
+This function is for historical compatibility with how previous CC Modes (5.28
+and earlier) indented such lines.
+
+Here is an example:
+
+DEFUN (\"forward-char\", Fforward_char, Sforward_char, 0, 1, \"p\",
+ doc: /* Move point right N characters (left if N is negative).
+On reaching end of buffer, stop and signal error. */)
+ (n) <- c-lineup-gnu-DEFUN-into-cont
+ Lisp_Object n; <- c-lineup-gnu-DEFUN-into-cont
+
+Works with: topmost-intro-cont."
+ (save-excursion
+ (let (case-fold-search)
+ (goto-char (c-langelem-pos langelem))
+ (if (looking-at "\\<DEFUN\\>")
+ (c-calc-offset '(knr-argdecl-intro))))))
+
(defun c-block-in-arglist-dwim (arglist-start)
;; This function implements the DWIM to avoid far indentation of
;; brace block constructs in arguments in `c-lineup-arglist' etc.
diff --git a/lisp/progmodes/cc-awk.el b/lisp/progmodes/cc-awk.el
index e2fcbd8d06b..bc745873638 100644
--- a/lisp/progmodes/cc-awk.el
+++ b/lisp/progmodes/cc-awk.el
@@ -720,7 +720,7 @@
(not (search-forward-regexp c-awk-regexp-sign-re (1+ /point) t))
(search-forward-regexp c-awk-div-sign-re (1+ /point) t))
;; A division sign.
- (progn (goto-char (1+ /point)) nil)
+ (progn (goto-char (1+ /point)) nil)
;; A regexp opener
;; Jump over the regexp innards, setting the match data.
(goto-char /point)
diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el
index 1c266e8a5de..e7bea0e0b29 100644
--- a/lisp/progmodes/cc-cmds.el
+++ b/lisp/progmodes/cc-cmds.el
@@ -53,6 +53,7 @@
(cc-bytecomp-defun c-forward-subword)
(cc-bytecomp-defun c-backward-subword)
+;; Indentation / Display syntax functions
(defvar c-fix-backslashes t)
(defun c-indent-line (&optional syntax quiet ignore-point-pos)
@@ -252,6 +253,7 @@ With universal argument, inserts the analysis as a comment on that line."
(forward-line)))))
+;; Minor mode functions.
(defun c-update-modeline ()
(let ((fmt (format "/%s%s%s%s"
(if c-electric-flag "l" "")
@@ -843,13 +845,17 @@ is inhibited."
(eq literal 'c)
(memq 'comment-close-slash c-cleanup-list)
(eq last-command-char ?/)
+ (looking-at (concat "[ \t]*\\("
+ (regexp-quote comment-end) "\\)?$"))
; (eq c-block-comment-ender "*/") ; C-style comments ALWAYS end in */
(save-excursion
- (back-to-indentation)
- (looking-at (concat c-current-comment-prefix "[ \t]*$"))))
- (end-of-line)
- (delete-horizontal-space)
- (or (eq (char-before) ?*) (insert-char ?* 1))) ; Do I need a t (retain sticky properties) here?
+ (save-restriction
+ (narrow-to-region (point-min) (point))
+ (back-to-indentation)
+ (looking-at (concat c-current-comment-prefix "[ \t]*$")))))
+ (kill-region (progn (forward-line 0) (point))
+ (progn (end-of-line) (point)))
+ (insert-char ?* 1)) ; the / comes later. ; Do I need a t (retain sticky properties) here?
(setq indentp (and (not arg)
c-syntactic-indentation
@@ -1253,7 +1259,11 @@ newline cleanups are done if appropriate; see the variable `c-cleanup-list'."
(backward-char)
(skip-chars-backward " \t")
(setq beg (point))
- (c-save-buffer-state () (c-on-identifier))))
+ (c-save-buffer-state () (c-on-identifier))
+ ;; Don't add a space into #define FOO()....
+ (not (and (c-beginning-of-macro)
+ (c-forward-over-cpp-define-id)
+ (eq (point) beg)))))
(save-excursion
(delete-region beg end)
(goto-char beg)
@@ -1308,6 +1318,7 @@ keyword on the line, the keyword is not inserted inside a literal, and
(delete-char -2)))))
+;; "nomenclature" functions + c-scope-operator.
(defun c-forward-into-nomenclature (&optional arg)
"Compatibility alias for `c-forward-subword'."
(interactive "p")
@@ -1328,6 +1339,160 @@ No indentation or other \"electric\" behavior is performed."
(interactive "*")
(insert-and-inherit "::"))
+
+;; Movement (etc.) by defuns.
+(defun c-in-function-trailer-p (&optional lim)
+ ;; Return non-nil if point is between the closing brace and the semicolon of
+ ;; a brace construct which needs a semicolon, e.g. within the "variables"
+ ;; portion of a declaration like "struct foo {...} bar ;".
+ ;;
+ ;; Return the position of the main declaration. Otherwise, return nil.
+ ;; Point is assumed to be at the top level and outside of any macro or
+ ;; literal.
+ ;;
+ ;; If LIM is non-nil, it is the bound on a the backward search for the
+ ;; beginning of the declaration.
+ ;;
+ ;; This function might do hidden buffer changes.
+ (and c-opt-block-decls-with-vars-key
+ (save-excursion
+ (c-syntactic-skip-backward "^;}" lim)
+ (and (eq (char-before) ?\})
+ (eq (car (c-beginning-of-decl-1 lim)) 'previous)
+ (looking-at c-opt-block-decls-with-vars-key)
+ (point)))))
+
+(defun c-where-wrt-brace-construct ()
+ ;; Determine where we are with respect to functions (or other brace
+ ;; constructs, included in the term "function" in the rest of this comment).
+ ;; Point is assumed to be outside any macro or literal.
+ ;; This is used by c-\(begining\|end\)-of-defun.
+ ;;
+ ;; Return one of these symbols:
+ ;; at-header : we're at the start of a function's header.
+ ;; in-header : we're inside a function's header, this extending right
+ ;; up to the brace. This bit includes any k&r declarations.
+ ;; in-block : we're inside a function's brace block.
+ ;; in-trailer : we're in the area between the "}" and ";" of something
+ ;; like "struct foo {...} bar, baz;".
+ ;; at-function-end : we're just after the closing brace (or semicolon) that
+ ;; terminates the function.
+ ;; outwith-function: we're not at or in any function. Being inside a
+ ;; non-brace construct also counts as 'outwith-function'.
+ ;;
+ ;; This function might do hidden buffer changes.
+ (save-excursion
+ (let* (pos
+ kluge-start
+ decl-result brace-decl-p
+ (start (point))
+ (paren-state (c-parse-state))
+ (least-enclosing (c-least-enclosing-brace paren-state)))
+
+ (cond
+ ((and least-enclosing
+ (eq (char-after least-enclosing) ?\{))
+ 'in-block)
+ ((c-in-function-trailer-p)
+ 'in-trailer)
+ ((and (not least-enclosing)
+ (consp paren-state)
+ (consp (car paren-state))
+ (eq start (cdar paren-state)))
+ 'at-function-end)
+ (t
+ ;; Find the start of the current declaration. NOTE: If we're in the
+ ;; variables after a "struct/eval" type block, we don't get to the
+ ;; real declaration here - we detect and correct for this later.
+
+ ;;If we're in the parameters' parens, move back out of them.
+ (if least-enclosing (goto-char least-enclosing))
+ ;; Kluge so that c-beginning-of-decl-1 won't go back if we're already
+ ;; at a declaration.
+ (if (or (and (eolp) (not (eobp))) ; EOL is matched by "\\s>"
+ (not (looking-at
+"\\([;#]\\|\\'\\|\\s(\\|\\s)\\|\\s\"\\|\\s\\\\|\\s$\\|\\s<\\|\\s>\\|\\s!\\)")))
+ (forward-char))
+ (setq kluge-start (point))
+ (setq decl-result
+ (car (c-beginning-of-decl-1
+ (and least-enclosing ; LIMIT for c-b-of-decl-1
+ (c-safe-position least-enclosing paren-state)))))
+
+ ;; Has the declaration we've gone back to got braces?
+ (setq pos (point)) ; the search limit for c-recognize-knr-p
+ (setq brace-decl-p
+ (save-excursion
+ (and (c-syntactic-re-search-forward "[;{]" nil t t)
+ (or (eq (char-before) ?\{)
+ (and c-recognize-knr-p
+ ;; Might have stopped on the
+ ;; ';' in a K&R argdecl. In
+ ;; that case the declaration
+ ;; should contain a block.
+ (c-in-knr-argdecl pos))))))
+
+ (cond
+ ((= (point) kluge-start) ; might be BOB or unbalanced parens.
+ 'outwith-function)
+ ((eq decl-result 'same)
+ (if brace-decl-p
+ (if (eq (point) start)
+ 'at-header
+ 'in-header)
+ 'outwith-function))
+ ((eq decl-result 'previous)
+ (if (and (not brace-decl-p)
+ (c-in-function-trailer-p))
+ 'at-function-end
+ 'outwith-function))
+ (t (error
+ "c-where-wrt-brace-construct: c-beginning-of-decl-1 returned %s"
+ decl-result))))))))
+
+(defun c-backward-to-nth-BOF-{ (n where)
+ ;; Skip to the opening brace of the Nth function before point. If
+ ;; point is inside a function, this counts as the first. Point must be
+ ;; outside any comment/string or macro.
+ ;;
+ ;; N must be strictly positive.
+ ;; WHERE describes the position of point, one of the symbols `at-header',
+ ;; `in-header', `in-block', `in-trailer', `at-function-end',
+ ;; `outwith-function' as returned by c-where-wrt-brace-construct.
+ ;;
+ ;; If we run out of functions, leave point at BOB. Return zero on success,
+ ;; otherwise the number of {s still to go.
+ ;;
+ ;; This function may do hidden buffer changes
+ (cond
+ ;; What we do to go back the first defun depends on where we start.
+ ((bobp))
+ ((eq where 'in-block)
+ (goto-char (c-least-enclosing-brace (c-parse-state)))
+ (setq n (1- n)))
+ ((eq where 'in-header)
+ (c-syntactic-re-search-forward "{")
+ (backward-char)
+ (setq n (1- n)))
+ (;; (or (eq where 'at-header) (eq where 'outwith-function)
+;; (eq where 'at-function-end) (eq where 'in-trailer))
+ (memq where '(at-header outwith-function at-function-end in-trailer))
+ (c-syntactic-skip-backward "^}")
+ (when (eq (char-before) ?\})
+ (backward-sexp)
+ (setq n (1- n))))
+ (t (error "Unknown `where' %s in c-backward-to-nth-EOF-{" where)))
+
+ ;; Each time round the loop, go back to a "{" at the outermost level.
+ (while (and (> n 0) (not (bobp)))
+ (c-parse-state) ; This call speeds up the following one
+ ; by a factor of ~6. Hmmm. 2006/4/5.
+ (c-syntactic-skip-backward "^}")
+ (when (eq (char-before) ?\})
+ (backward-sexp)
+ (setq n (1- n))))
+ n)
+
(defun c-beginning-of-defun (&optional arg)
"Move backward to the beginning of a defun.
Every top level declaration that contains a brace paren block is
@@ -1344,88 +1509,99 @@ defun."
(interactive "p")
(or arg (setq arg 1))
- (if (< arg 0)
- (when (c-end-of-defun (- arg))
- (c-save-buffer-state nil (c-forward-syntactic-ws))
- t)
-
- (c-save-buffer-state (paren-state lim pos)
- (catch 'exit
- (while (> arg 0)
- ;; Note: Partial code duplication in `c-end-of-defun' and
- ;; `c-declaration-limits'.
-
- (setq paren-state (c-parse-state))
- (unless (c-safe
- (goto-char (c-least-enclosing-brace paren-state))
- ;; If we moved to the outermost enclosing paren
- ;; then we can use c-safe-position to set the
- ;; limit. Can't do that otherwise since the
- ;; earlier paren pair on paren-state might very
- ;; well be part of the declaration we should go
- ;; to.
- (setq lim (c-safe-position (point) paren-state))
- t)
- ;; At top level. Make sure we aren't inside a literal.
- (setq pos (c-literal-limits
- (c-safe-position (point) paren-state)))
- (if pos (goto-char (car pos))))
-
- (while (let ((start (point)))
- (c-beginning-of-decl-1 lim)
- (if (= (point) start)
- ;; Didn't move. Might be due to bob or unbalanced
- ;; parens. Try to continue if it's the latter.
- (unless (c-safe (goto-char
- (c-down-list-backward (point))))
- ;; Didn't work, so it's bob then.
- (goto-char (point-min))
- (throw 'exit nil)))
+ (c-save-buffer-state
+ ((start (point))
+ where paren-state pos)
- (save-excursion
- ;; Check if the declaration contains a brace
- ;; block. If not, we try another one.
- (setq pos (point))
- (not (and (c-syntactic-re-search-forward "[;{]" nil t t)
- (or (eq (char-before) ?{)
- (and c-recognize-knr-p
- ;; Might have stopped on the
- ;; ';' in a K&R argdecl. In
- ;; that case the declaration
- ;; should contain a block.
- (c-in-knr-argdecl pos)))))))
- (setq lim nil))
-
- ;; Check if `c-beginning-of-decl-1' put us after the block
- ;; in a declaration that doesn't end there. We're searching
- ;; back and forth over the block here, which can be
- ;; expensive.
- (setq pos (point))
- (if (and c-opt-block-decls-with-vars-key
- (progn
- (c-backward-syntactic-ws)
- (eq (char-before) ?}))
- (eq (car (c-beginning-of-decl-1))
- 'previous)
- (save-excursion
- (c-end-of-decl-1)
- (> (point) pos)))
- nil
- (goto-char pos))
-
- (setq pos (point))
- ;; Try to be line oriented; position point at the closest
- ;; preceding boi that isn't inside a comment, but if we hit
- ;; the previous declaration then we use the current point
- ;; instead.
- (while (and (/= (point) (c-point 'boi))
- (c-backward-single-comment)))
- (if (/= (point) (c-point 'boi))
- (goto-char pos))
-
- (setq arg (1- arg)))))
- (c-keep-region-active)
- (= arg 0)))
+ ;; Move back out of any macro/comment/string we happen to be in.
+ (c-beginning-of-macro)
+ (setq pos (c-literal-limits))
+ (if pos (goto-char (car pos)))
+
+ (setq where (c-where-wrt-brace-construct))
+
+ (if (< arg 0)
+ ;; Move forward to the closing brace of a function.
+ (progn
+ (if ;; (or (eq where 'at-function-end) (eq where 'outwith-function))
+ (memq where '(at-function-end outwith-function))
+ (setq arg (1+ arg)))
+ (if (< arg 0)
+ (setq arg (c-forward-to-nth-EOF-} (- arg) where)))
+ ;; Move forward to the next opening brace....
+ (when (and (= arg 0)
+ (c-syntactic-re-search-forward "{" nil t))
+ (backward-char)
+ ;; ... and backward to the function header.
+ (c-beginning-of-decl-1)
+ t))
+
+ ;; Move backward to the opening brace of a function.
+ (when (and (> arg 0)
+ (eq (setq arg (c-backward-to-nth-BOF-{ arg where)) 0))
+
+ ;; Go backward to this function's header.
+ (c-beginning-of-decl-1)
+
+ (setq pos (point))
+ ;; We're now there, modulo comments and whitespace.
+ ;; Try to be line oriented; position point at the closest
+ ;; preceding boi that isn't inside a comment, but if we hit
+ ;; the previous declaration then we use the current point
+ ;; instead.
+ (while (and (/= (point) (c-point 'boi))
+ (c-backward-single-comment)))
+ (if (/= (point) (c-point 'boi))
+ (goto-char pos)))
+
+ (c-keep-region-active)
+ (= arg 0))))
+
+(defun c-forward-to-nth-EOF-} (n where)
+ ;; Skip to the closing brace of the Nth function after point. If
+ ;; point is inside a function, this counts as the first. Point must be
+ ;; outside any comment/string or macro.
+ ;;
+ ;; N must be strictly positive.
+ ;; WHERE describes the position of point, one of the symbols `at-header',
+ ;; `in-header', `in-block', `in-trailer', `at-function-end',
+ ;; `outwith-function' as returned by c-where-wrt-brace-construct.
+ ;;
+ ;; If we run out of functions, leave point at EOB. Return zero on success,
+ ;; otherwise the number of }s still to go.
+ ;;
+ ;; This function may do hidden buffer changes.
+
+ (cond
+ ;; What we do to go forward over the first defun depends on where we
+ ;; start. We go to the closing brace of that defun, even when we go
+ ;; backwards to it (in a "struct foo {...} bar ;").
+ ((eobp))
+ ((eq where 'in-block)
+ (goto-char (c-least-enclosing-brace (c-parse-state)))
+ (forward-sexp)
+ (setq n (1- n)))
+ ((eq where 'in-trailer)
+ (c-syntactic-skip-backward "^}")
+ (setq n (1- n)))
+ (;; (or (eq where 'at-function-end) (eq where 'outwith-function)
+;; (eq where 'at-header) (eq where 'in-header))
+ (memq where '(at-function-end outwith-function at-header in-header))
+ (c-syntactic-re-search-forward "{")
+ (backward-char)
+ (forward-sexp)
+ (setq n (1- n)))
+ (t (error "c-forward-to-nth-EOF-}: `where' is %s" where)))
+
+ ;; Each time round the loop, go forward to a "}" at the outermost level.
+ (while (and (> n 0) (not (eobp)))
+ ;(c-parse-state) ; This call speeds up the following one by a factor
+ ; of ~6. Hmmm. 2006/4/5.
+ (when (c-syntactic-re-search-forward "{" nil 'eob)
+ (backward-char)
+ (forward-sexp))
+ (setq n (1- n)))
+ n)
(defun c-end-of-defun (&optional arg)
"Move forward to the end of a top level declaration.
@@ -1435,82 +1611,56 @@ beginning or end of buffer.
An end of a defun occurs right after the close-parenthesis that matches
the open-parenthesis that starts a defun; see `beginning-of-defun'."
-
(interactive "p")
(or arg (setq arg 1))
- (if (< arg 0)
- (when (c-beginning-of-defun (- arg))
- (c-save-buffer-state nil (c-backward-syntactic-ws))
- t)
-
- (c-save-buffer-state (paren-state lim pos)
- (catch 'exit
- (while (> arg 0)
- ;; Note: Partial code duplication in `c-beginning-of-defun'
- ;; and `c-declaration-limits'.
-
- (setq paren-state (c-parse-state))
- (unless (c-safe
- (goto-char (c-least-enclosing-brace paren-state))
- ;; If we moved to the outermost enclosing paren
- ;; then we can use c-safe-position to set the
- ;; limit. Can't do that otherwise since the
- ;; earlier paren pair on paren-state might very
- ;; well be part of the declaration we should go
- ;; to.
- (setq lim (c-safe-position (point) paren-state))
- t)
- ;; At top level. Make sure we aren't inside a literal.
- (setq pos (car-safe (c-literal-limits
- (c-safe-position (point) paren-state))))
- (if pos (goto-char pos)))
-
- ;; Have to move to the start first so that `c-end-of-decl-1'
- ;; has the correct start position.
- (setq pos (point))
- (when (memq (car (c-beginning-of-decl-1 lim))
- '(previous macro))
- ;; We moved back over the previous defun or a macro. Move
- ;; to the next token; it's the start of the next
- ;; declaration. We can also be directly after the block
- ;; in a `c-opt-block-decls-with-vars-key' declaration, but
- ;; then we won't move significantly far here.
- (goto-char pos)
- (c-forward-token-2 0))
-
- (while (let ((start (point)))
- (c-end-of-decl-1)
- (if (= (point) start)
- ;; Didn't move. Might be due to eob or unbalanced
- ;; parens. Try to continue if it's the latter.
- (if (c-safe (goto-char (c-up-list-forward (point))))
- t
- ;; Didn't work, so it's eob then.
- (goto-char (point-max))
- (throw 'exit nil))
-
- (save-excursion
- ;; Check if the declaration contains a brace
- ;; block. If not, we try another one.
- (setq pos (point))
- (goto-char start)
- (not (c-syntactic-re-search-forward "{" pos t t))))))
-
- (setq pos (point))
- ;; Try to be line oriented; position point after the next
- ;; newline that isn't inside a comment, but if we hit the
- ;; next declaration then we use the current point instead.
- (while (and (not (bolp))
- (not (looking-at "\\s *$"))
- (c-forward-single-comment)))
- (cond ((bolp))
- ((looking-at "\\s *$")
- (forward-line 1))
- (t
- (goto-char pos)))
+ (c-save-buffer-state
+ ((start (point))
+ where paren-state pos)
+
+ ;; Move back out of any macro/comment/string we happen to be in.
+ (c-beginning-of-macro)
+ (setq pos (c-literal-limits))
+ (if pos (goto-char (car pos)))
+
+ (setq where (c-where-wrt-brace-construct))
+
+ (if (< arg 0)
+ ;; Move backwards to the } of a function
+ (progn
+ (if ;; (or (eq where 'at-header) (eq where 'outwith-function))
+ (memq where '(at-header outwith-function))
+ (setq arg (1+ arg)))
+ (if (< arg 0)
+ (setq arg (c-backward-to-nth-BOF-{ (- arg) where)))
+ (when (and (= arg 0)
+ (c-syntactic-skip-backward "^}")
+ (eq (char-before) ?\}))
+ t))
+
+ ;; Move forward to the } of a function
+ (if (> arg 0)
+ (setq arg (c-forward-to-nth-EOF-} arg where))))
+
+ ;; Do we need to move forward from the brace to the semicolon?
+ (when (eq arg 0)
+ (if (c-in-function-trailer-p) ; after "}" of struct/enum, etc.
+ (c-syntactic-re-search-forward ";"))
+
+ (setq pos (point))
+ ;; We're there now, modulo comments and whitespace.
+ ;; Try to be line oriented; position point after the next
+ ;; newline that isn't inside a comment, but if we hit the
+ ;; next declaration then we use the current point instead.
+ (while (and (not (bolp))
+ (not (looking-at "\\s *$"))
+ (c-forward-single-comment)))
+ (cond ((bolp))
+ ((looking-at "\\s *$")
+ (forward-line 1))
+ (t
+ (goto-char pos))))
- (setq arg (1- arg)))))
(c-keep-region-active)
(= arg 0)))
@@ -1646,6 +1796,7 @@ function does not require the declaration to contain a brace block."
(push-mark (cdr decl-limits) nil t))))
+;; Movement by statements.
(defun c-in-comment-line-prefix-p ()
;; Point is within a comment. Is it also within a comment-prefix?
;; Space at BOL which precedes a comment-prefix counts as part of it.
@@ -2429,7 +2580,6 @@ sentence motion in or near comments and multiline strings."
(if (/= count 0) (setq count (1- count))))
(c-keep-region-active))))
-
;; set up electric character functions to work with pending-del,
;; (a.k.a. delsel) mode. All symbols get the t value except
@@ -2455,6 +2605,7 @@ sentence motion in or near comments and multiline strings."
(put 'c-electric-delete-forward 'pending-delete 'supersede) ; pending-del
+;; Inserting/indenting comments
(defun c-calc-comment-indent (entry)
;; This function might do hidden buffer changes.
(if (symbolp entry)
@@ -2550,6 +2701,7 @@ See `c-indent-comment-alist' for a description."
(current-column))))
+;; Movement by CPP conditionals.
(defun c-up-conditional (count)
"Move back to the containing preprocessor conditional, leaving mark behind.
A prefix argument acts as a repeat count. With a negative argument,
@@ -3598,7 +3750,7 @@ command to conveniently insert and align the necessary backslashes."
;; Note that this function does not do any hidden buffer changes.
(let (fill
- ;; beg and end limits the region to narrow. end is a marker.
+ ;; beg and end limit the region to narrow. end is a marker.
beg end
;; tmp-pre and tmp-post mark strings that are temporarily
;; inserted at the start and end of the region. tmp-pre is a
@@ -3621,9 +3773,12 @@ command to conveniently insert and align the necessary backslashes."
;; Restore point on undo. It's necessary since we do a lot of
;; hidden inserts and deletes below that should be as transparent
;; as possible.
- (if (and buffer-undo-list (not (eq buffer-undo-list t)))
+ (if (and buffer-undo-list (not (eq buffer-undo-list t)))
(setq buffer-undo-list (cons (point) buffer-undo-list)))
+ ;; Determine the limits and type of the containing literal (if any):
+ ;; C-LIT-LIMITS, C-LIT-TYPE; and the limits of the current paragraph:
+ ;; BEG and END.
(c-save-buffer-state ()
(save-restriction
;; Widen to catch comment limits correctly.
@@ -3651,6 +3806,13 @@ command to conveniently insert and align the necessary backslashes."
(unwind-protect
(progn
+ ;; For each of the possible types of text (string, C comment ...)
+ ;; determine BEG and END, the region we will narrow to. If we're in
+ ;; a literal, constrain BEG and END to the limits of this literal.
+ ;;
+ ;; For some of these text types, particularly a block comment, we
+ ;; may need to massage whitespace near literal delimiters, so that
+ ;; these don't get filled inappropriately.
(cond
((eq c-lit-type 'c++) ; Line comment.
@@ -3674,22 +3836,34 @@ command to conveniently insert and align the necessary backslashes."
(setq apply-outside-literal t))
((eq c-lit-type 'c) ; Block comment.
- (when (>= end (cdr c-lit-limits))
- ;; The region includes the comment ender which we might
- ;; want to keep together with the last word.
- (unless (save-excursion
- (goto-char (cdr c-lit-limits))
- (beginning-of-line)
- (and (looking-at (concat "[ \t]*\\("
- c-current-comment-prefix
- "\\)\\*/"))
- (eq (cdr c-lit-limits) (match-end 0))
- ;; The comment ender is on a line of its
- ;; own. Keep it that way.
- (set-marker end (point))))
-
- ;; The comment ender should hang. Replace all space between
- ;; it and the last word either by one or two 'x's (when
+ (when
+ (or (> end (cdr c-lit-limits))
+ (and (= end (cdr c-lit-limits))
+ (eq (char-before end) ?/)
+ (eq (char-before (1- end)) ?*)
+ ;; disallow "/*/"
+ (> (- (cdr c-lit-limits) (car c-lit-limits)) 3)))
+ ;; There is a comment ender, and the region includes it. If
+ ;; it's on its own line, it stays on its own line. If it's got
+ ;; company on the line, it keeps (at least one word of) it.
+ ;; "=====*/" counts as a comment ender here, but "===== */"
+ ;; doesn't and "foo*/" doesn't.
+ (unless
+ (save-excursion
+ (goto-char (cdr c-lit-limits))
+ (beginning-of-line)
+ (and (search-forward-regexp
+ (concat "\\=[ \t]*\\(" c-current-comment-prefix "\\)")
+ (- (cdr c-lit-limits) 2) t)
+ (not (search-forward-regexp
+ "\\(\\s \\|\\sw\\)"
+ (- (cdr c-lit-limits) 2) 'limit))
+ ;; The comment ender IS on its own line. Exclude
+ ;; this line from the filling.
+ (set-marker end (c-point 'bol))))
+
+ ;; The comment ender is hanging. Replace all space between it
+ ;; and the last word either by one or two 'x's (when
;; FILL-PARAGRAPH is non-nil), or a row of x's the same width
;; as the whitespace (when auto filling), and include it in
;; the region. We'll change them back to whitespace
@@ -3706,23 +3880,26 @@ command to conveniently insert and align the necessary backslashes."
spaces)
(save-excursion
+ ;; Insert a CR after the "*/", adjust END
(goto-char (cdr c-lit-limits))
(setq tmp-post (point-marker))
(insert ?\n)
(set-marker end (point))
+
(forward-line -1) ; last line of the comment
(if (and (looking-at (concat "[ \t]*\\(\\("
c-current-comment-prefix
"\\)[ \t]*\\)"))
(eq ender-start (match-end 0)))
- ;; The comment ender is prefixed by nothing
- ;; but a comment line prefix. Remove it
- ;; along with surrounding ws.
+ ;; The comment ender is prefixed by nothing but a
+ ;; comment line prefix. IS THIS POSSIBLE? (ACM,
+ ;; 2006/4/28). Remove it along with surrounding ws.
(setq spaces (- (match-end 1) (match-end 2)))
(goto-char ender-start))
(skip-chars-backward " \t\r\n") ; Surely this can be
; " \t"? "*/" is NOT alone on the line (ACM, 2005/8/18)
+ ;; What's being tested here? 2006/4/20. FIXME!!!
(if (/= (point) ender-start)
(progn
(if (<= here (point))
@@ -4172,49 +4349,63 @@ it.
When point is inside a comment, continue it with the appropriate
comment prefix (see the `c-comment-prefix-regexp' and
`c-block-comment-prefix' variables for details). The end of a
-C++-style line comment doesn't count as inside it."
+C++-style line comment doesn't count as inside it.
+
+When point is inside a string, only insert a backslash when it is also
+inside a preprocessor directive."
(interactive "*")
(let* (c-lit-limits c-lit-type
(c-macro-start c-macro-start))
- (if (c-save-buffer-state ()
- (setq c-lit-limits (c-literal-limits nil nil t)
- c-lit-type (c-literal-type c-lit-limits))
- (or (eq c-lit-type 'c)
- (and (eq c-lit-type 'c++)
- (< (save-excursion
- (skip-chars-forward " \t")
- (point))
- (1- (cdr (setq c-lit-limits (c-collect-line-comments
- c-lit-limits))))))
- (and (or (not (looking-at "\\s *$"))
- (eq (char-before) ?\\))
- (c-query-and-set-macro-start)
- (<= (save-excursion
- (goto-char c-macro-start)
- (if (looking-at c-opt-cpp-start)
- (goto-char (match-end 0)))
- (point))
- (point)))))
-
- (let ((comment-multi-line t)
- (fill-prefix nil))
- (c-indent-new-comment-line nil t))
-
- (delete-horizontal-space)
- (newline)
+ (c-save-buffer-state ()
+ (setq c-lit-limits (c-literal-limits nil nil t)
+ c-lit-type (c-literal-type c-lit-limits))
+ (when (eq c-lit-type 'c++)
+ (setq c-lit-limits (c-collect-line-comments c-lit-limits)))
+ (c-query-and-set-macro-start))
+ (cond
+ ((or (eq c-lit-type 'c)
+ (and (eq c-lit-type 'c++) ; C++ comment, but not at the very end of it.
+ (< (save-excursion
+ (skip-chars-forward " \t")
+ (point))
+ (1- (cdr c-lit-limits))))
+ (and (numberp c-macro-start) ; Macro, but not at the very end of
+ ; it, not in a string, and not in the
+ ; cpp keyword.
+ (not (eq c-lit-type 'string))
+ (or (not (looking-at "\\s *$"))
+ (eq (char-before) ?\\))
+ (<= (save-excursion
+ (goto-char c-macro-start)
+ (if (looking-at c-opt-cpp-start)
+ (goto-char (match-end 0)))
+ (point))
+ (point))))
+ (let ((comment-multi-line t)
+ (fill-prefix nil))
+ (c-indent-new-comment-line nil t)))
+
+ ((eq c-lit-type 'string)
+ (if (and (numberp c-macro-start)
+ (not (eq (char-before) ?\\)))
+ (insert ?\\))
+ (newline))
+
+ (t (delete-horizontal-space)
+ (newline)
;; c-indent-line may look at the current indentation, so let's
;; start out with the same indentation as the previous line.
- (let ((col (save-excursion
- (forward-line -1)
- (while (and (looking-at "[ \t]*\\\\?$")
- (= (forward-line -1) 0)))
- (current-indentation))))
- (indent-to col))
-
- (indent-according-to-mode))))
+ (let ((col (save-excursion
+ (backward-char)
+ (forward-line 0)
+ (while (and (looking-at "[ \t]*\\\\?$")
+ (= (forward-line -1) 0)))
+ (current-indentation))))
+ (indent-to col))
+ (indent-according-to-mode)))))
(defun c-context-open-line ()
"Insert a line break suitable to the context and leave point before it.
diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el
index df2f247f048..b4063554384 100644
--- a/lisp/progmodes/cc-defs.el
+++ b/lisp/progmodes/cc-defs.el
@@ -95,7 +95,7 @@
;;; Variables also used at compile time.
-(defconst c-version "5.31.3"
+(defconst c-version "5.31.4"
"CC Mode version number.")
(defconst c-version-sym (intern c-version))
@@ -764,7 +764,7 @@ be after it."
;; call `c-beginning-of-statement-1'.
;;
;; The macro `c-vsemi-status-unknown-p' will typically check the cacheing
-;; scheme used by the `c-at-vsemp-p-fn', hence the name - the status is
+;; scheme used by the `c-at-vsemi-p-fn', hence the name - the status is
;; "unknown" if there is no cache entry current for the line.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -1620,7 +1620,7 @@ itself is evaluated."
(defmacro c-lang-defconst (name &rest args)
"Set the language specific values of the language constant NAME.
-The second argument can be an optional docstring. The rest of the
+The second argument can optionally be a docstring. The rest of the
arguments are one or more repetitions of LANG VAL where LANG specifies
the language(s) that VAL applies to. LANG is the name of the
language, i.e. the mode name without the \"-mode\" suffix, or a list
@@ -1717,7 +1717,7 @@ constant. A file is identified by its base name."
;; Emacs has a weird bug where it seems to fail to read
;; backquote lists from byte compiled files correctly (,@
;; forms, to be specific), so make sure the bindings in the
- ;; expansion below doesn't contain any backquote stuff.
+ ;; expansion below don't contain any backquote stuff.
;; (XEmacs handles it correctly and doesn't need this for that
;; reason, but we also use this expansion handle
;; `c-lang-defconst-eval-immediately' and to register
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 5cb00929007..bacb4670ea0 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -255,6 +255,18 @@ comment at the start of cc-engine.el for more info."
(forward-char)
t))))
+(defun c-forward-over-cpp-define-id ()
+ ;; Assuming point is at the "#" that introduces a preprocessor
+ ;; directive, it's moved forward to the end of the identifier which is
+ ;; "#define"d (or whatever c-opt-cpp-macro-define specifies). Non-nil
+ ;; is returned in this case, in all other cases nil is returned and
+ ;; point isn't moved.
+ ;;
+ ;; This function might do hidden buffer changes.
+ (when (and c-opt-cpp-macro-define-id
+ (looking-at c-opt-cpp-macro-define-id))
+ (goto-char (match-end 0))))
+
(defun c-forward-to-cpp-define-body ()
;; Assuming point is at the "#" that introduces a preprocessor
;; directive, it's moved forward to the start of the definition body
@@ -2442,14 +2454,14 @@ comment at the start of cc-engine.el for more info."
(= (c-backward-token-2 0) 0))
(cond ((and (looking-at c-overloadable-operators-regexp)
- (or (not c-opt-op-identitier-prefix)
+ (or (not c-opt-op-identifier-prefix)
(and (= (c-backward-token-2 1) 0)
- (looking-at c-opt-op-identitier-prefix))))
+ (looking-at c-opt-op-identifier-prefix))))
(point))
((save-excursion
- (and c-opt-op-identitier-prefix
- (looking-at c-opt-op-identitier-prefix)
+ (and c-opt-op-identifier-prefix
+ (looking-at c-opt-op-identifier-prefix)
(= (c-forward-token-2 1) 0)
(looking-at c-overloadable-operators-regexp)))
(point))))
@@ -3843,7 +3855,7 @@ comment at the start of cc-engine.el for more info."
;; good start position for the search, so do it.
(c-find-decl-prefix-search)))
- ;; Now loop. We already got the first match.
+ ;; Now loop. Round what? (ACM, 2006/7/5). We already got the first match.
(while (progn
(while (and
@@ -4534,41 +4546,42 @@ comment at the start of cc-engine.el for more info."
(goto-char start)
nil)
- (while (and
+ (while (progn
(c-syntactic-skip-backward "^<;{}" limit t)
- (if (eq (char-before) ?<)
- t
- ;; Stopped at bob or a char that isn't allowed in an
- ;; arglist, so we've failed.
- (goto-char start)
- nil)
+ (and
+ (if (eq (char-before) ?<)
+ t
+ ;; Stopped at bob or a char that isn't allowed in an
+ ;; arglist, so we've failed.
+ (goto-char start)
+ nil)
- (if (> (point)
- (progn (c-beginning-of-current-token)
- (point)))
- ;; If we moved then the "<" was part of some
- ;; multicharacter token.
- t
+ (if (> (point)
+ (progn (c-beginning-of-current-token)
+ (point)))
+ ;; If we moved then the "<" was part of some
+ ;; multicharacter token.
+ t
- (backward-char)
- (let ((beg-pos (point)))
- (if (c-forward-<>-arglist all-types)
- (cond ((= (point) start)
- ;; Matched the arglist. Break the while.
- (goto-char beg-pos)
- nil)
- ((> (point) start)
- ;; We started from a non-paren ">" inside an
- ;; arglist.
- (goto-char start)
- nil)
- (t
- ;; Matched a shorter arglist. Can be a nested
- ;; one so continue looking.
- (goto-char beg-pos)
- t))
- t)))))
+ (backward-char)
+ (let ((beg-pos (point)))
+ (if (c-forward-<>-arglist all-types)
+ (cond ((= (point) start)
+ ;; Matched the arglist. Break the while.
+ (goto-char beg-pos)
+ nil)
+ ((> (point) start)
+ ;; We started from a non-paren ">" inside an
+ ;; arglist.
+ (goto-char start)
+ nil)
+ (t
+ ;; Matched a shorter arglist. Can be a nested
+ ;; one so continue looking.
+ (goto-char beg-pos)
+ t))
+ t))))))
(/= (point) start))))
@@ -5793,17 +5806,32 @@ y ;; True if there's a suffix match outside the outermost
nil))))
(defun c-forward-label (&optional assume-markup preceding-token-end limit)
- ;; Assuming the point is at the beginning of a token, check if it
- ;; starts a label and if so move over it and return t, otherwise
- ;; don't move and return nil. The end of the label is taken to be
- ;; the end of the first submatch in `c-opt-extra-label-key' if it
- ;; matched, otherwise it's the colon. The point is directly after
- ;; the end on return. The terminating char is marked with
- ;; `c-decl-end' to improve recognition of the following declaration
- ;; or statement.
+ ;; Assuming that point is at the beginning of a token, check if it starts a
+ ;; label and if so move over it and return t, otherwise don't move and
+ ;; return nil. "Label" here means "most things with a colon".
+ ;;
+ ;; More precisely, a "label" is regarded as one of:
+ ;; (i) a goto target like "foo:";
+ ;; (ii) A case label - either the entire construct "case FOO:" or just the
+ ;; bare "case", should the colon be missing;
+ ;; (iii) a keyword which needs a colon, like "default:" or "private:";
+ ;; (iv) One of QT's "extended" C++ variants of
+ ;; "private:"/"protected:"/"public:"/"more:" looking like "public slots:".
+ ;; (v) One of the keywords matched by `c-opt-extra-label-key' (without any
+ ;; colon). Currently (2006-03), this applies only to Objective C's
+ ;; keywords "@private", "@protected", and "@public".
+ ;;
+ ;; One of the things which will NOT be recognised as a label is a bit-field
+ ;; element of a struct, something like "int foo:5".
+ ;;
+ ;; The end of the label is taken to be just after the colon, or the end of
+ ;; the first submatch in `c-opt-extra-label-key'. The point is directly
+ ;; after the end on return. The terminating char gets marked with
+ ;; `c-decl-end' to improve recognition of the following declaration or
+ ;; statement.
;;
;; If ASSUME-MARKUP is non-nil, it's assumed that the preceding
- ;; label, if any, has been marked up like that.
+ ;; label, if any, has already been marked up like that.
;;
;; If PRECEDING-TOKEN-END is given, it should be the first position
;; after the preceding token, i.e. on the other side of the
@@ -5819,8 +5847,11 @@ y ;; True if there's a suffix match outside the outermost
;;
;; This function might do hidden buffer changes.
- (let ((start (point)))
+ (let ((start (point))
+ qt-symbol-idx
+ macro-start) ; if we're in one.
(cond
+ ;; "case" or "default" (Doesn't apply to AWK).
((looking-at c-label-kwds-regexp)
(let ((kwd-end (match-end 1)))
;; Record only the keyword itself for fontification, since in
@@ -5840,7 +5871,7 @@ y ;; True if there's a suffix match outside the outermost
(match-beginning 2))
(progn
- (goto-char (match-beginning 2))
+ (goto-char (match-beginning 2)) ; just after the :
(c-put-c-type-property (1- (point)) 'c-decl-end)
t)
@@ -5851,6 +5882,7 @@ y ;; True if there's a suffix match outside the outermost
(goto-char kwd-end)
t)))
+ ;; @private, @protected, @public, in Objective C, or similar.
((and c-opt-extra-label-key
(looking-at c-opt-extra-label-key))
;; For a `c-opt-extra-label-key' match, we record the whole
@@ -5862,7 +5894,8 @@ y ;; True if there's a suffix match outside the outermost
(c-put-c-type-property (1- (point)) 'c-decl-end)
t)
- ((and c-recognize-colon-labels
+ ;; All other cases of labels.
+ ((and c-recognize-colon-labels ; nil for AWK and IDL, otherwise t.
;; A colon label must have something before the colon.
(not (eq (char-after) ?:))
@@ -5890,7 +5923,8 @@ y ;; True if there's a suffix match outside the outermost
(save-excursion
(goto-char (1- preceding-token-end))
(c-beginning-of-current-token)
- (looking-at c-label-prefix-re))
+ (or (looking-at c-label-prefix-re)
+ (looking-at c-block-stmt-1-key)))
(and (eq (char-before preceding-token-end) ?\))
(c-after-conditional)))
@@ -5899,7 +5933,8 @@ y ;; True if there's a suffix match outside the outermost
(save-excursion
(goto-char (1- preceding-token-end))
(c-beginning-of-current-token)
- (looking-at c-label-prefix-re))
+ (or (looking-at c-label-prefix-re)
+ (looking-at c-block-stmt-1-key)))
(cond
((eq (char-before preceding-token-end) ?\))
@@ -5907,26 +5942,52 @@ y ;; True if there's a suffix match outside the outermost
((eq (char-before preceding-token-end) ?:)
;; Might be after another label, so check it recursively.
- (save-excursion
- (goto-char (1- preceding-token-end))
- ;; Essentially the same as the
- ;; `c-syntactic-re-search-forward' regexp below.
- (c-syntactic-skip-backward "^-]:?;}=*/%&|,<>!@+" nil t)
- (let ((pte (point))
- ;; If the caller turned on recording for us,
- ;; it shouldn't apply when we check the
- ;; preceding label.
- c-record-type-identifiers)
- (c-forward-syntactic-ws)
- (c-forward-label nil pte start))))))))
-
- ;; Check that the next nonsymbol token is ":". Allow '('
- ;; for the sake of macro arguments. FIXME: Should build
- ;; this regexp from the language constants.
- (c-syntactic-re-search-forward
- "[[:?;{=*/%&|,<>!@+-]" limit t t)
- (eq (char-before) ?:)
- (not (eq (char-after) ?:)))
+ (save-restriction
+ (save-excursion
+ (goto-char (1- preceding-token-end))
+ ;; Essentially the same as the
+ ;; `c-syntactic-re-search-forward' regexp below.
+ (setq macro-start
+ (save-excursion (and (c-beginning-of-macro)
+ (point))))
+ (if macro-start (narrow-to-region macro-start (point-max)))
+ (c-syntactic-skip-backward "^-]:?;}=*/%&|,<>!@+" nil t)
+ ;; Note: the following should work instead of the
+ ;; narrow-to-region above. Investigate why not,
+ ;; sometime. ACM, 2006-03-31.
+ ;; (c-syntactic-skip-backward "^-]:?;}=*/%&|,<>!@+"
+ ;; macro-start t)
+ (let ((pte (point))
+ ;; If the caller turned on recording for us,
+ ;; it shouldn't apply when we check the
+ ;; preceding label.
+ c-record-type-identifiers)
+ ;; A label can't start at a cpp directive. Check for
+ ;; this, since c-forward-syntactic-ws would foul up on it.
+ (unless (and c-opt-cpp-prefix (looking-at c-opt-cpp-prefix))
+ (c-forward-syntactic-ws)
+ (c-forward-label nil pte start))))))))))
+
+ ;; Check that the next nonsymbol token is ":", or that we're in one
+ ;; of QT's "slots" declarations. Allow '(' for the sake of macro
+ ;; arguments. FIXME: Should build this regexp from the language
+ ;; constants.
+ (when (c-syntactic-re-search-forward
+ "[ \t[:?;{=*/%&|,<>!@+-]" limit t t) ; not at EOB
+ (backward-char)
+ (setq qt-symbol-idx
+ (and (c-major-mode-is 'c++-mode)
+ (string-match
+ "\\(p\\(r\\(ivate\\|otected\\)\\|ublic\\)\\|more\\)\\>"
+ (buffer-substring start (point)))))
+ (c-forward-syntactic-ws limit)
+ (when (or (looking-at ":\\([^:]\\|\\'\\)") ; A single colon.
+ (and qt-symbol-idx
+ (search-forward-regexp "\\=slots\\>" limit t)
+ (progn (c-forward-syntactic-ws limit)
+ (looking-at ":\\([^:]\\|\\'\\)")))) ; A single colon
+ (forward-char) ; to after the colon.
+ t)))
(save-restriction
(narrow-to-region start (point))
@@ -6145,8 +6206,8 @@ comment at the start of cc-engine.el for more info."
;; so that we don't get stuck on that instead of the
;; function arglist.
(c-forward-sexp))
- ((and c-opt-op-identitier-prefix
- (looking-at c-opt-op-identitier-prefix))
+ ((and c-opt-op-identifier-prefix
+ (looking-at c-opt-op-identifier-prefix))
;; Don't trip up on "operator ()".
(c-forward-token-2 2 t)))
(and (< (point) beg)
@@ -6263,10 +6324,10 @@ comment at the start of cc-engine.el for more info."
(and c-overloadable-operators-regexp
(zerop (c-backward-token-2 1 nil lim))
(looking-at c-overloadable-operators-regexp)
- (or (not c-opt-op-identitier-prefix)
+ (or (not c-opt-op-identifier-prefix)
(and
(zerop (c-backward-token-2 1 nil lim))
- (looking-at c-opt-op-identitier-prefix)))
+ (looking-at c-opt-op-identifier-prefix)))
(point))))
(defsubst c-backward-to-block-anchor (&optional lim)
@@ -6314,7 +6375,7 @@ comment at the start of cc-engine.el for more info."
;; operator token preceded by "operator".
(save-excursion
(and (c-safe (c-backward-sexp) t)
- (looking-at c-opt-op-identitier-prefix)))
+ (looking-at c-opt-op-identifier-prefix)))
(and (eq (char-before) ?<)
(c-with-syntax-table c++-template-syntax-table
(if (c-safe (goto-char (c-up-list-forward (point))))
@@ -6354,6 +6415,10 @@ comment at the start of cc-engine.el for more info."
;; construct, i.e. if it isn't preceded by ';', '}', ':', bob,
;; or an open paren.
(let ((beg (point)) tentative-move)
+ ;; Go back one "statement" each time round the loop until we're just
+ ;; after a ;, }, or :, or at BOB or the start of a macro or start of
+ ;; an ObjC method. This will move over a multiple declaration whose
+ ;; components are comma separated.
(while (and
;; Must check with c-opt-method-key in ObjC mode.
(not (and c-opt-method-key
@@ -6397,25 +6462,39 @@ comment at the start of cc-engine.el for more info."
knr-argdecl-start))
(goto-char fallback-pos))))
- ;; `c-beginning-of-statement-1' counts each brace block as a
- ;; separate statement, so the result will be 'previous if we've
- ;; moved over any. If they were brace list initializers we might
- ;; not have moved over a declaration boundary though, so change it
- ;; to 'same if we've moved past a '=' before '{', but not ';'.
- ;; (This ought to be integrated into `c-beginning-of-statement-1',
- ;; so we avoid this extra pass which potentially can search over a
- ;; large amount of text.)
+ ;; `c-beginning-of-statement-1' counts each brace block as a separate
+ ;; statement, so the result will be 'previous if we've moved over any.
+ ;; So change our result back to 'same if necessary.
+ ;;
+ ;; If they were brace list initializers we might not have moved over a
+ ;; declaration boundary though, so change it to 'same if we've moved
+ ;; past a '=' before '{', but not ';'. (This ought to be integrated
+ ;; into `c-beginning-of-statement-1', so we avoid this extra pass which
+ ;; potentially can search over a large amount of text.). Take special
+ ;; pains not to get mislead by C++'s "operator=", and the like.
(if (and (eq move 'previous)
(c-with-syntax-table (if (c-major-mode-is 'c++-mode)
c++-template-syntax-table
(syntax-table))
(save-excursion
- (and (c-syntactic-re-search-forward "[;={]" start t t t)
- (eq (char-before) ?=)
- (c-syntactic-re-search-forward "[;{]" start t t)
- (eq (char-before) ?{)
- (c-safe (goto-char (c-up-list-forward (point))) t)
- (not (c-syntactic-re-search-forward ";" start t t))))))
+ (and
+ (progn
+ (while ; keep going back to "[;={"s until we either find
+ ; no more, or get to one which isn't an "operator ="
+ (and (c-syntactic-re-search-forward "[;={]" start t t t)
+ (eq (char-before) ?=)
+ c-overloadable-operators-regexp
+ c-opt-op-identifier-prefix
+ (save-excursion
+ (eq (c-backward-token-2) 0)
+ (looking-at c-overloadable-operators-regexp)
+ (eq (c-backward-token-2) 0)
+ (looking-at c-opt-op-identifier-prefix))))
+ (eq (char-before) ?=))
+ (c-syntactic-re-search-forward "[;{]" start t t)
+ (eq (char-before) ?{)
+ (c-safe (goto-char (c-up-list-forward (point))) t)
+ (not (c-syntactic-re-search-forward ";" start t t))))))
(cons 'same nil)
(cons move nil)))))
@@ -6725,8 +6804,8 @@ comment at the start of cc-engine.el for more info."
(setq braceassignp
(cond
;; Check for operator =
- ((and c-opt-op-identitier-prefix
- (looking-at c-opt-op-identitier-prefix))
+ ((and c-opt-op-identifier-prefix
+ (looking-at c-opt-op-identifier-prefix))
nil)
;; Check for `<opchar>= in Pike.
((and (c-major-mode-is 'pike-mode)
@@ -7000,6 +7079,11 @@ comment at the start of cc-engine.el for more info."
stop-at-boi-only
containing-sexp
paren-state)
+ ;; Add the indicated SYNTAX-SYMBOL to `c-syntactic-context', extending it as
+ ;; needed with further syntax elements of the types `substatement',
+ ;; `inexpr-statement', `arglist-cont-nonempty', `statement-block-intro', and
+ ;; `defun-block-intro'.
+ ;;
;; Do the generic processing to anchor the given syntax symbol on
;; the preceding statement: Skip over any labels and containing
;; statements on the same line, and then search backward until we
@@ -8085,7 +8169,9 @@ comment at the start of cc-engine.el for more info."
(and (eq (char-before) ?})
(save-excursion
(let ((start (point)))
- (if c-state-cache
+ (if (and c-state-cache
+ (consp (car c-state-cache))
+ (eq (cdar c-state-cache) (point)))
;; Speed up the backward search a bit.
(goto-char (caar c-state-cache)))
(c-beginning-of-decl-1 containing-sexp)
@@ -8103,26 +8189,30 @@ comment at the start of cc-engine.el for more info."
;; CASE 5J: we are at the topmost level, make
;; sure we skip back past any access specifiers
- ((save-excursion
- (setq placeholder (point))
- (or (memq char-before-ip '(?\; ?{ ?} nil))
- (c-at-vsemi-p before-ws-ip)
- (when (and (eq char-before-ip ?:)
- (eq (c-beginning-of-statement-1 lim)
- 'label))
- (c-backward-syntactic-ws lim)
- (setq placeholder (point)))
- (and (c-major-mode-is 'objc-mode)
- (catch 'not-in-directive
- (c-beginning-of-statement-1 lim)
- (setq placeholder (point))
- (while (and (c-forward-objc-directive)
- (< (point) indent-point))
- (c-forward-syntactic-ws)
- (if (>= (point) indent-point)
- (throw 'not-in-directive t))
- (setq placeholder (point)))
- nil))))
+ ((and
+ ;; A macro continuation line is never at top level.
+ (not (and macro-start
+ (> indent-point macro-start)))
+ (save-excursion
+ (setq placeholder (point))
+ (or (memq char-before-ip '(?\; ?{ ?} nil))
+ (c-at-vsemi-p before-ws-ip)
+ (when (and (eq char-before-ip ?:)
+ (eq (c-beginning-of-statement-1 lim)
+ 'label))
+ (c-backward-syntactic-ws lim)
+ (setq placeholder (point)))
+ (and (c-major-mode-is 'objc-mode)
+ (catch 'not-in-directive
+ (c-beginning-of-statement-1 lim)
+ (setq placeholder (point))
+ (while (and (c-forward-objc-directive)
+ (< (point) indent-point))
+ (c-forward-syntactic-ws)
+ (if (>= (point) indent-point)
+ (throw 'not-in-directive t))
+ (setq placeholder (point)))
+ nil)))))
;; For historic reasons we anchor at bol of the last
;; line of the previous declaration. That's clearly
;; highly bogus and useless, and it makes our lives hard
@@ -8177,6 +8267,11 @@ comment at the start of cc-engine.el for more info."
(c-beginning-of-statement-1 (c-safe-position (point) paren-state))
(c-add-syntax 'template-args-cont (c-point 'boi)))
+ ;; CASE 5Q: we are at a statement within a macro.
+ (macro-start
+ (c-beginning-of-statement-1 containing-sexp)
+ (c-add-stmt-syntax 'statement nil t containing-sexp paren-state))
+
;; CASE 5M: we are at a topmost continuation line
(t
(c-beginning-of-statement-1 (c-safe-position (point) paren-state))
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index bd9af00d9c6..b3c0a578649 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -685,6 +685,16 @@ definition, or nil if the language doesn't have any."
(c-lang-defvar c-opt-cpp-macro-define-start
(c-lang-const c-opt-cpp-macro-define-start))
+(c-lang-defconst c-opt-cpp-macro-define-id
+ ;; Regexp matching everything up to the end of the identifier defined
+ ;; by a cpp define.
+ t (if (c-lang-const c-opt-cpp-macro-define)
+ (concat (c-lang-const c-opt-cpp-prefix) ; #
+ (c-lang-const c-opt-cpp-macro-define) ; define
+ "[ \t]+\\(\\sw\\|_\\)+")))
+(c-lang-defvar c-opt-cpp-macro-define-id
+ (c-lang-const c-opt-cpp-macro-define-id))
+
(c-lang-defconst c-cpp-expr-directives
"List if cpp directives (without the prefix) that are followed by an
expression."
@@ -882,7 +892,7 @@ since CC Mode treats every identifier as an expression."
(c-lang-defconst c-overloadable-operators
"List of the operators that are overloadable, in their \"identifier
-form\". See also `c-op-identitier-prefix'."
+form\". See also `c-op-identifier-prefix'."
t nil
c++ '("new" "delete" ;; Can be followed by "[]" but we ignore that.
"+" "-" "*" "/" "%"
@@ -905,7 +915,7 @@ form\". See also `c-op-identitier-prefix'."
(c-lang-defvar c-overloadable-operators-regexp
(c-lang-const c-overloadable-operators-regexp))
-(c-lang-defconst c-opt-op-identitier-prefix
+(c-lang-defconst c-opt-op-identifier-prefix
"Regexp matching the token before the ones in
`c-overloadable-operators' when operators are specified in their
\"identifier form\". This typically matches \"operator\" in C++ where
@@ -916,8 +926,15 @@ identifier is listed in `c-overloadable-operators'.
This regexp is assumed to not match any non-operator identifier."
t nil
c++ (c-make-keywords-re t '("operator")))
-(c-lang-defvar c-opt-op-identitier-prefix
- (c-lang-const c-opt-op-identitier-prefix))
+(c-lang-defvar c-opt-op-identifier-prefix
+ (c-lang-const c-opt-op-identifier-prefix))
+
+;; Note: the following alias is an old name which was a mis-spelling. It has
+;; been corrected above and throughout cc-engine.el. It will be removed at
+;; some release very shortly in the future. ACM, 2006-04-14.
+(defalias 'c-opt-op-identitier-prefix 'c-opt-op-identifier-prefix)
+(make-obsolete-variable 'c-opt-op-identitier-prefix 'c-opt-op-identifier-prefix
+ "CC Mode 5.31.4, 2006-04-14")
(c-lang-defconst c-other-op-syntax-tokens
"List of the tokens made up of characters in the punctuation or
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 40407f3819a..993fd102951 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -288,8 +288,9 @@ control). See \"cc-mode.el\" for more info."
c-mode-base-map global-map))
;; RMS says don't make these the default.
-;; (define-key c-mode-base-map "\e\C-a" 'c-beginning-of-defun)
-;; (define-key c-mode-base-map "\e\C-e" 'c-end-of-defun)
+ ;; (April 2006): RMS has now approved these commands as defaults.
+ (define-key c-mode-base-map "\e\C-a" 'c-beginning-of-defun)
+ (define-key c-mode-base-map "\e\C-e" 'c-end-of-defun)
(define-key c-mode-base-map "\C-c\C-n" 'c-forward-conditional)
(define-key c-mode-base-map "\C-c\C-p" 'c-backward-conditional)
@@ -728,8 +729,8 @@ Note that the style variables are always made local to the buffer."
;; We prevent this by temporarily removing `mode' from the Local Variables
;; section.
(if (or c-file-style c-file-offsets)
- (c-tentative-buffer-changes
- (let ((hack-local-variables-hook nil))
+ (let ((hack-local-variables-hook nil) (inhibit-read-only t))
+ (c-tentative-buffer-changes
(c-remove-any-local-eval-or-mode-variables)
(hack-local-variables))
nil))))
diff --git a/lisp/progmodes/cc-styles.el b/lisp/progmodes/cc-styles.el
index 81048d52072..98bc4e1f801 100644
--- a/lisp/progmodes/cc-styles.el
+++ b/lisp/progmodes/cc-styles.el
@@ -68,7 +68,10 @@
(arglist-intro . c-lineup-arglist-intro-after-paren)
(arglist-close . c-lineup-arglist)
(inline-open . 0)
- (brace-list-open . +)))
+ (brace-list-open . +)
+ (topmost-intro-cont
+ . (first c-lineup-topmost-intro-cont
+ c-lineup-gnu-DEFUN-intro-cont))))
(c-special-indent-hook . c-gnu-impose-minimum)
(c-block-comment-prefix . ""))
diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el
index 0f0da939230..2f3e83886d2 100644
--- a/lisp/progmodes/cc-vars.el
+++ b/lisp/progmodes/cc-vars.el
@@ -622,10 +622,10 @@ name:
empty-defun-braces -- Clean up empty defun braces by placing the
braces on the same line. Clean up occurs when
the defun closing brace is typed.
- one-liner-defun -- If the code inside a function body is a single
- line then remove any newlines between that
- line and the defun braces so that the whole
- body becomes a single line.
+ one-liner-defun -- If the code inside a function body can fit in
+ a single line, then remove any newlines
+ between that line and the defun braces so that
+ the whole body becomes a single line.
`c-max-one-liner-length' gives the maximum
length allowed for the resulting line. Clean
up occurs when the closing brace is typed.
@@ -1604,7 +1604,8 @@ statically (e.g. with `setq').")
(defvar c-indentation-style nil
"Name of the currently installed style.
-Don't change this directly; call `c-set-style' instead.")
+Don't change this directly; call `c-set-style' instead, or set the variable
+`c-file-style' in the file's Local Variable list.")
(defvar c-current-comment-prefix nil
"The current comment prefix regexp.
diff --git a/lisp/progmodes/cfengine.el b/lisp/progmodes/cfengine.el
index b70fe58b543..fd10bf3a9c2 100644
--- a/lisp/progmodes/cfengine.el
+++ b/lisp/progmodes/cfengine.el
@@ -89,7 +89,7 @@ This includes those for cfservd as well as cfagent."))
;; In the main syntax-table, backslash is marked as a punctuation, because
;; of its use in DOS-style directory separators. Here we try to recognize
;; the cases where backslash is used as an escape inside strings.
- '(("\\(\\(?:\\\\\\)+\\)\"" . "\\")))
+ '(("\\(\\(?:\\\\\\)+\\)\"" 1 "\\")))
(defvar cfengine-imenu-expression
`((nil ,(concat "^[ \t]*" (eval-when-compile
diff --git a/lisp/progmodes/ebrowse.el b/lisp/progmodes/ebrowse.el
index f624ac5cf28..cc808adda39 100644
--- a/lisp/progmodes/ebrowse.el
+++ b/lisp/progmodes/ebrowse.el
@@ -1,7 +1,7 @@
;;; ebrowse.el --- Emacs C++ class browser & tags facility
;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
-;; 2002, 2003, 2004, 2005, 2006
+;; 2002, 2003, 2004, 2005, 2006, 2007
;; Free Software Foundation Inc.
;; Author: Gerd Moellmann <gerd@gnu.org>
@@ -4230,13 +4230,13 @@ NUMBER-OF-STATIC-VARIABLES:"
;;; Global key bindings
;;; The following can be used to bind key sequences starting with
-;;; prefix `\C-cb' to browse commands.
+;;; prefix `\C-c\C-m' to browse commands.
(defvar ebrowse-global-map nil
"*Keymap for Ebrowse commands.")
-(defvar ebrowse-global-prefix-key "\C-cC-m"
+(defvar ebrowse-global-prefix-key "\C-c\C-m"
"Prefix key for Ebrowse commands.")
diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el
index 3a253796f28..980c6b3f07b 100644
--- a/lisp/progmodes/gdb-ui.el
+++ b/lisp/progmodes/gdb-ui.el
@@ -896,6 +896,12 @@ Changed values are highlighted with the face `font-lock-warning-face'."
:group 'gud
:version "22.1")
+(defcustom gdb-max-children 40
+ "Maximum number of children allowed before Emacs asks"
+ :type 'integer
+ :group 'gud
+ :version "22.1")
+
(defun gdb-speedbar-expand-node (text token indent)
"Expand the node the user clicked on.
TEXT is the text of the button we clicked on, a + or - item.
@@ -904,11 +910,17 @@ INDENT is the current indentation depth."
(if (and gud-comint-buffer (buffer-name gud-comint-buffer))
(progn
(cond ((string-match "+" text) ;expand this node
- (if (and (eq (buffer-local-value
- 'gud-minor-mode gud-comint-buffer) 'gdba)
- (string-equal gdb-version "pre-6.4"))
- (gdb-var-list-children token)
- (gdb-var-list-children-1 token)))
+ (let* ((var (assoc token gdb-var-list))
+ (expr (nth 1 var)) (children (nth 2 var)))
+ (if (or (<= (string-to-number children) gdb-max-children)
+ (y-or-n-p
+ (format
+ "%s has %s children. Continue? " expr children)))
+ (if (and (eq (buffer-local-value
+ 'gud-minor-mode gud-comint-buffer) 'gdba)
+ (string-equal gdb-version "pre-6.4"))
+ (gdb-var-list-children token)
+ (gdb-var-list-children-1 token)))))
((string-match "-" text) ;contract this node
(dolist (var gdb-var-list)
(if (string-match (concat token "\\.") (car var))
diff --git a/lisp/simple.el b/lisp/simple.el
index a78f152cbcd..38302f32233 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -4088,7 +4088,7 @@ With argument, do this that many times."
(kill-region (point) (progn (forward-word arg) (point))))
(defun backward-kill-word (arg)
- "Kill characters backward until encountering the end of a word.
+ "Kill characters backward until encountering the beginning of a word.
With argument, do this that many times."
(interactive "p")
(kill-word (- arg)))
diff --git a/lisp/subr.el b/lisp/subr.el
index 6f9042f50b3..b48fa1a9f35 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1887,6 +1887,7 @@ menu bar menus and the frame title."
(defun momentary-string-display (string pos &optional exit-char message)
"Momentarily display STRING in the buffer at POS.
Display remains until next event is input.
+If POS is a marker, only its position is used; its buffer is ignored.
Optional third arg EXIT-CHAR can be a character, event or event
description list. EXIT-CHAR defaults to SPC. If the input is
EXIT-CHAR it is swallowed; otherwise it is then available as
@@ -1894,30 +1895,21 @@ input (as a command if nothing else).
Display MESSAGE (optional fourth arg) in the echo area.
If MESSAGE is nil, instructions to type EXIT-CHAR are displayed there."
(or exit-char (setq exit-char ?\s))
- (let ((inhibit-read-only t)
- ;; Don't modify the undo list at all.
- (buffer-undo-list t)
- (modified (buffer-modified-p))
- (name buffer-file-name)
- insert-end)
+ (let ((momentary-overlay (make-overlay pos pos nil t)))
+ (overlay-put momentary-overlay 'before-string
+ (propertize string 'face 'momentary))
(unwind-protect
(progn
- (save-excursion
- (goto-char pos)
- ;; defeat file locking... don't try this at home, kids!
- (setq buffer-file-name nil)
- (insert-before-markers string)
- (setq insert-end (point))
- ;; If the message end is off screen, recenter now.
- (if (< (window-end nil t) insert-end)
- (recenter (/ (window-height) 2)))
- ;; If that pushed message start off the screen,
- ;; scroll to start it at the top of the screen.
- (move-to-window-line 0)
- (if (> (point) pos)
- (progn
- (goto-char pos)
- (recenter 0))))
+ ;; If the message end is off screen, recenter now.
+ (if (< (window-end nil t) (+ pos (length string)))
+ (recenter (/ (window-height) 2)))
+ ;; If that pushed message start off the screen,
+ ;; scroll to start it at the top of the screen.
+ (move-to-window-line 0)
+ (if (> (point) pos)
+ (progn
+ (goto-char pos)
+ (recenter 0)))
(message (or message "Type %s to continue editing.")
(single-key-description exit-char))
(let (char)
@@ -1937,11 +1929,7 @@ If MESSAGE is nil, instructions to type EXIT-CHAR are displayed there."
(or (eq char exit-char)
(eq char (event-convert-list exit-char))
(setq unread-command-events (list char))))))
- (if insert-end
- (save-excursion
- (delete-region pos insert-end)))
- (setq buffer-file-name name)
- (set-buffer-modified-p modified))))
+ (delete-overlay momentary-overlay))))
;;;; Overlay operations
diff --git a/lisp/textmodes/table.el b/lisp/textmodes/table.el
index 70bd3a07a9f..c712524396f 100644
--- a/lisp/textmodes/table.el
+++ b/lisp/textmodes/table.el
@@ -6,7 +6,7 @@
;; Keywords: wp, convenience
;; Author: Takaaki Ota <Takaaki.Ota@am.sony.com>
;; Created: Sat Jul 08 2000 13:28:45 (PST)
-;; Revised: Thu Jul 20 2006 17:30:09 (PDT)
+;; Revised: Wed Jan 03 2007 13:23:46 (PST)
;; This file is part of GNU Emacs.
@@ -5358,7 +5358,7 @@ is non-nil. The warning is done only once per session for each item."
(cond ((and (featurep 'xemacs)
(not (get 'table-disable-incompatibility-warning 'xemacs)))
(put 'table-disable-incompatibility-warning 'xemacs t)
- (momentary-string-display
+ (display-warning 'table
"
*** Warning ***
@@ -5369,12 +5369,12 @@ such that a border characters dissolve into adjacent cells. Please be
aware of this.
"
- (save-excursion (forward-line 1) (point))))
+ :warning))
((and (boundp 'flyspell-mode)
flyspell-mode
(not (get 'table-disable-incompatibility-warning 'flyspell)))
(put 'table-disable-incompatibility-warning 'flyspell t)
- (momentary-string-display
+ (display-warning 'table
"
*** Warning ***
@@ -5383,7 +5383,7 @@ package. The flyspell version 1.5d at http://kaolin.unice.fr/~serrano
works better than the previous versions however not fully compatible.
"
- (save-excursion (forward-line 1) (point))))
+ :warning))
)))
(defun table--cell-blank-str (&optional n)
diff --git a/lisp/tutorial.el b/lisp/tutorial.el
index be50d793f0f..cf9a391e5a6 100644
--- a/lisp/tutorial.el
+++ b/lisp/tutorial.el
@@ -153,7 +153,7 @@ options:
(insert "\n\nYou can use M-x "
(format "%s" db)
" RET instead."))
- (insert "\n\nWith you current key bindings"
+ (insert "\n\nWith your current key bindings"
" you can use the key "
where
" to get the function `"
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index 7d572363e0f..935d2b7719d 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -275,14 +275,15 @@ minibuffer."
keys
(char 0)
(arg 1))
- (while (not (or (and (>= char ?0) (< char next-digit))
+ (while (not (or (and (integerp char)
+ (>= char ?0) (< char next-digit))
(eq value 'keyboard-quit)))
;; Unread a SPC to lead to our new menu.
(setq unread-command-events (cons ?\s unread-command-events))
(setq keys (read-key-sequence title))
(setq value
(lookup-key overriding-terminal-local-map keys t)
- char (string-to-char (substring keys 1)))
+ char (aref keys 1))
(cond ((eq value 'scroll-other-window)
(let ((minibuffer-scroll-window
(get-buffer-window buf)))
diff --git a/lisp/woman.el b/lisp/woman.el
index 2d3513f0097..f880c6810f9 100644
--- a/lisp/woman.el
+++ b/lisp/woman.el
@@ -2112,7 +2112,7 @@ No external programs are used."
(progn (goto-char (point-min))
(not (re-search-forward "^\\.\\([pnil]p\\|sh\\)[ \n]"
(point-max) t))))
- (error "WoMan can only format manpages written in the an format")))
+ (error "WoMan can only format man pages written with the usual `-man' macros")))
(and (boundp 'font-lock-mode) font-lock-mode (font-lock-mode -1))
;; (fundamental-mode)