summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenichi Handa <handa@m17n.org>2010-12-02 09:44:25 +0900
committerKenichi Handa <handa@m17n.org>2010-12-02 09:44:25 +0900
commit423a637bdbb746e112c5584e259bf28c5402901d (patch)
tree4ad9b32418e59697854bab91ce85e3e276403f69
parent7e116860bbae843e00c29b08919e10fc37f7aaa2 (diff)
parent769741e3d1ba0f22dd4619058185f294b3c189ea (diff)
downloademacs-423a637bdbb746e112c5584e259bf28c5402901d.tar.gz
merge emacs-23
-rw-r--r--doc/lispref/ChangeLog7
-rw-r--r--doc/lispref/backups.texi6
-rw-r--r--doc/lispref/modes.texi129
-rw-r--r--doc/lispref/text.texi2
-rw-r--r--lib-src/ChangeLog5
-rw-r--r--lib-src/ebrowse.c5
-rw-r--r--lisp/ChangeLog32
-rw-r--r--lisp/dired.el8
-rw-r--r--lisp/emacs-lisp/smie.el120
-rw-r--r--lisp/ido.el12
-rw-r--r--lisp/locate.el14
-rw-r--r--lisp/log-edit.el7
12 files changed, 209 insertions, 138 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 959f4844c1c..95973479225 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,10 @@
+2010-12-01 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * backups.texi (Making Backups):
+ * modes.texi (Example Major Modes): Use recommended coding style.
+ (Major Mode Basics, Derived Modes): Encourge more strongly use of
+ define-derived-mode. Mention completion-at-point-functions.
+
2010-11-21 Chong Yidong <cyd@stupidchicken.com>
* nonascii.texi (Converting Representations): Document
diff --git a/doc/lispref/backups.texi b/doc/lispref/backups.texi
index 7d6ae233f2b..349d0beb9c7 100644
--- a/doc/lispref/backups.texi
+++ b/doc/lispref/backups.texi
@@ -88,10 +88,8 @@ save disk space. (You would put this code in your init file.)
@smallexample
@group
(add-hook 'rmail-mode-hook
- (function (lambda ()
- (make-local-variable
- 'make-backup-files)
- (setq make-backup-files nil))))
+ (lambda ()
+ (set (make-local-variable 'make-backup-files) nil)))
@end group
@end smallexample
@end defopt
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
index 12f16b67663..0ccb4ae04ed 100644
--- a/doc/lispref/modes.texi
+++ b/doc/lispref/modes.texi
@@ -20,10 +20,10 @@ user. For related topics such as keymaps and syntax tables, see
@ref{Keymaps}, and @ref{Syntax Tables}.
@menu
-* Hooks:: How to use hooks; how to write code that provides hooks.
-* Major Modes:: Defining major modes.
-* Minor Modes:: Defining minor modes.
-* Mode Line Format:: Customizing the text that appears in the mode line.
+* Hooks:: How to use hooks; how to write code that provides hooks.
+* Major Modes:: Defining major modes.
+* Minor Modes:: Defining minor modes.
+* Mode Line Format:: Customizing the text that appears in the mode line.
* Imenu:: How a mode can provide a menu
of definitions in the buffer.
* Font Lock Mode:: How modes can highlight text according to syntax.
@@ -78,8 +78,8 @@ convention.
its value is just a single function, not a list of functions.
@menu
-* Running Hooks:: How to run a hook.
-* Setting Hooks:: How to put functions on a hook, or remove them.
+* Running Hooks:: How to run a hook.
+* Setting Hooks:: How to put functions on a hook, or remove them.
@end menu
@node Running Hooks
@@ -199,16 +199,16 @@ buffer, such as a local keymap. The effect lasts until you switch
to another major mode in the same buffer.
@menu
-* Major Mode Basics::
-* Major Mode Conventions:: Coding conventions for keymaps, etc.
-* Auto Major Mode:: How Emacs chooses the major mode automatically.
-* Mode Help:: Finding out how to use a mode.
-* Derived Modes:: Defining a new major mode based on another major
+* Major Mode Basics::
+* Major Mode Conventions:: Coding conventions for keymaps, etc.
+* Auto Major Mode:: How Emacs chooses the major mode automatically.
+* Mode Help:: Finding out how to use a mode.
+* Derived Modes:: Defining a new major mode based on another major
mode.
-* Generic Modes:: Defining a simple major mode that supports
+* Generic Modes:: Defining a simple major mode that supports
comment syntax and Font Lock mode.
-* Mode Hooks:: Hooks run at the end of major mode functions.
-* Example Major Modes:: Text mode and Lisp modes.
+* Mode Hooks:: Hooks run at the end of major mode functions.
+* Example Major Modes:: Text mode and Lisp modes.
@end menu
@node Major Mode Basics
@@ -238,9 +238,8 @@ mode except that it provides two additional commands. Its definition
is distinct from that of Text mode, but uses that of Text mode.
Even if the new mode is not an obvious derivative of any other mode,
-it is convenient to use @code{define-derived-mode} with a @code{nil}
-parent argument, since it automatically enforces the most important
-coding conventions for you.
+we recommend to use @code{define-derived-mode}, since it automatically
+enforces the most important coding conventions for you.
For a very simple programming language major mode that handles
comments and fontification, you can use @code{define-generic-mode}.
@@ -429,6 +428,10 @@ The mode can specify a local value for
this mode.
@item
+The mode can specify how to complete various keywords by adding
+to the special hook @code{completion-at-point-functions}.
+
+@item
Use @code{defvar} or @code{defcustom} to set mode-related variables, so
that they are not reinitialized if they already have a value. (Such
reinitialization could discard customizations made by the user.)
@@ -492,7 +495,7 @@ The @code{define-derived-mode} macro automatically marks the derived
mode as special if the parent mode is special. The special mode
@code{special-mode} provides a convenient parent for other special
modes to inherit from; it sets @code{buffer-read-only} to @code{t},
-and does nothing else.
+and does little else.
@item
If you want to make the new mode the default for files with certain
@@ -737,8 +740,10 @@ documentation of the major mode.
@subsection Defining Derived Modes
@cindex derived mode
- It's often useful to define a new major mode in terms of an existing
-one. An easy way to do this is to use @code{define-derived-mode}.
+ The recommended way to define a new major mode is to derive it
+from an existing one using @code{define-derived-mode}. If there is no
+closely related mode, you can inherit from @code{text-mode},
+@code{special-mode}, or in the worst case @code{fundamental-mode}.
@defmac define-derived-mode variant parent name docstring keyword-args@dots{} body@dots{}
This macro defines @var{variant} as a major mode command, using
@@ -979,8 +984,7 @@ You can thus get the full benefit of adaptive filling
Turning on Text mode runs the normal hook `text-mode-hook'."
@end group
@group
- (make-local-variable 'text-mode-variant)
- (setq text-mode-variant t)
+ (set (make-local-variable 'text-mode-variant) t)
;; @r{These two lines are a feature added recently.}
(set (make-local-variable 'require-final-newline)
mode-require-final-newline)
@@ -998,9 +1002,8 @@ the default value, and we'll delete it in a future version.)
@smallexample
@group
;; @r{This isn't needed nowadays, since @code{define-derived-mode} does it.}
-(defvar text-mode-abbrev-table nil
+(define-abbrev-table 'text-mode-abbrev-table ()
"Abbrev table used while in text mode.")
-(define-abbrev-table 'text-mode-abbrev-table ())
@end group
@group
@@ -1022,12 +1025,10 @@ Turning on text-mode runs the hook `text-mode-hook'."
;; @r{These four lines are absent from the current version}
;; @r{not because this is done some other way, but rather}
;; @r{because nowadays Text mode uses the normal definition of paragraphs.}
- (make-local-variable 'paragraph-start)
- (setq paragraph-start (concat "[ \t]*$\\|" page-delimiter))
- (make-local-variable 'paragraph-separate)
- (setq paragraph-separate paragraph-start)
- (make-local-variable 'indent-line-function)
- (setq indent-line-function 'indent-relative-maybe)
+ (set (make-local-variable 'paragraph-start)
+ (concat "[ \t]*$\\|" page-delimiter))
+ (set (make-local-variable 'paragraph-separate) paragraph-start)
+ (set (make-local-variable 'indent-line-function) 'indent-relative-maybe)
@end group
@group
(setq mode-name "Text")
@@ -1115,15 +1116,12 @@ modes should understand the Lisp conventions for comments. The rest of
@smallexample
@group
- (make-local-variable 'paragraph-start)
- (setq paragraph-start (concat page-delimiter "\\|$" ))
- (make-local-variable 'paragraph-separate)
- (setq paragraph-separate paragraph-start)
+ (set (make-local-variable 'paragraph-start) (concat page-delimiter "\\|$" ))
+ (set (make-local-variable 'paragraph-separate) paragraph-start)
@dots{}
@end group
@group
- (make-local-variable 'comment-indent-function)
- (setq comment-indent-function 'lisp-comment-indent))
+ (set (make-local-variable 'comment-indent-function) 'lisp-comment-indent))
@dots{}
@end group
@end smallexample
@@ -1135,16 +1133,13 @@ common. The following code sets up the common commands:
@smallexample
@group
-(defvar shared-lisp-mode-map ()
+(defvar shared-lisp-mode-map
+ (let ((map (make-sparse-keymap)))
+ (define-key shared-lisp-mode-map "\e\C-q" 'indent-sexp)
+ (define-key shared-lisp-mode-map "\177"
+ 'backward-delete-char-untabify)
+ map)
"Keymap for commands shared by all sorts of Lisp modes.")
-
-;; @r{Putting this @code{if} after the @code{defvar} is an older style.}
-(if shared-lisp-mode-map
- ()
- (setq shared-lisp-mode-map (make-sparse-keymap))
- (define-key shared-lisp-mode-map "\e\C-q" 'indent-sexp)
- (define-key shared-lisp-mode-map "\177"
- 'backward-delete-char-untabify))
@end group
@end smallexample
@@ -1153,15 +1148,13 @@ And here is the code to set up the keymap for Lisp mode:
@smallexample
@group
-(defvar lisp-mode-map ()
+(defvar lisp-mode-map
+ (let ((map (make-sparse-keymap)))
+ (set-keymap-parent map shared-lisp-mode-map)
+ (define-key map "\e\C-x" 'lisp-eval-defun)
+ (define-key map "\C-c\C-z" 'run-lisp)
+ map)
"Keymap for ordinary Lisp mode...")
-
-(if lisp-mode-map
- ()
- (setq lisp-mode-map (make-sparse-keymap))
- (set-keymap-parent lisp-mode-map shared-lisp-mode-map)
- (define-key lisp-mode-map "\e\C-x" 'lisp-eval-defun)
- (define-key lisp-mode-map "\C-c\C-z" 'run-lisp))
@end group
@end smallexample
@@ -1192,11 +1185,9 @@ if that value is non-nil."
; @r{finds out what to describe.}
(setq mode-name "Lisp") ; @r{This goes into the mode line.}
(lisp-mode-variables t) ; @r{This defines various variables.}
- (make-local-variable 'comment-start-skip)
- (setq comment-start-skip
- "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *")
- (make-local-variable 'font-lock-keywords-case-fold-search)
- (setq font-lock-keywords-case-fold-search t)
+ (set (make-local-variable 'comment-start-skip)
+ "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *")
+ (set (make-local-variable 'font-lock-keywords-case-fold-search) t)
@end group
@group
(setq imenu-case-fold-search t)
@@ -1580,14 +1571,14 @@ information displayed in the mode line relates to the enabled major and
minor modes.
@menu
-* Base: Mode Line Basics. Basic ideas of mode line control.
-* Data: Mode Line Data. The data structure that controls the mode line.
-* Top: Mode Line Top. The top level variable, mode-line-format.
-* Mode Line Variables:: Variables used in that data structure.
-* %-Constructs:: Putting information into a mode line.
-* Properties in Mode:: Using text properties in the mode line.
-* Header Lines:: Like a mode line, but at the top.
-* Emulating Mode Line:: Formatting text as the mode line would.
+* Base: Mode Line Basics. Basic ideas of mode line control.
+* Data: Mode Line Data. The data structure that controls the mode line.
+* Top: Mode Line Top. The top level variable, mode-line-format.
+* Mode Line Variables:: Variables used in that data structure.
+* %-Constructs:: Putting information into a mode line.
+* Properties in Mode:: Using text properties in the mode line.
+* Header Lines:: Like a mode line, but at the top.
+* Emulating Mode Line:: Formatting text as the mode line would.
@end menu
@node Mode Line Basics
@@ -2361,7 +2352,7 @@ Search-based fontification happens second.
* Other Font Lock Variables:: Additional customization facilities.
* Levels of Font Lock:: Each mode can define alternative levels
so that the user can select more or less.
-* Precalculated Fontification:: How Lisp programs that produce the buffer
+* Precalculated Fontification:: How Lisp programs that produce the buffer
contents can also specify how to fontify it.
* Faces for Font Lock:: Special faces specifically for Font Lock.
* Syntactic Font Lock:: Fontification based on syntax tables.
@@ -3276,5 +3267,7 @@ optionally bound to @code{desktop-save-buffer}.
@end defvar
@ignore
- arch-tag: 4c7bff41-36e6-4da6-9e7f-9b9289e27c8e
+ Local Variables:
+ fill-column: 72
+ End:
@end ignore
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi
index 57bf4825887..4da94dacd71 100644
--- a/doc/lispref/text.texi
+++ b/doc/lispref/text.texi
@@ -2205,7 +2205,7 @@ The functions in this section return unpredictable values.
@defvar indent-line-function
This variable's value is the function to be used by @key{TAB} (and
various commands) to indent the current line. The command
-@code{indent-according-to-mode} does no more than call this function.
+@code{indent-according-to-mode} does little more than call this function.
In Lisp mode, the value is the symbol @code{lisp-indent-line}; in C
mode, @code{c-indent-line}; in Fortran mode, @code{fortran-indent-line}.
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index ba98132521d..0f518445a45 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,8 @@
+2010-11-27 Joe Matarazzo <joe.matarazzo@gmail.com> (tiny change)
+
+ * ebrowse.c (yylex): If end of input buffer encountered while
+ searching for a newline after "//", return YYEOF. (Bug#7446)
+
2010-11-10 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
* emacsclient.c (set_local_socket) [DARWIN_OS]: Add fall-back
diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c
index b51b4aa6965..67c9637daba 100644
--- a/lib-src/ebrowse.c
+++ b/lib-src/ebrowse.c
@@ -1784,6 +1784,11 @@ yylex ()
case '/':
while (GET (c) && c != '\n')
;
+ /* Don't try to read past the end of the input buffer if
+ the file ends in a C++ comment without a newline. */
+ if (c == 0)
+ return YYEOF;
+
INCREMENT_LINENO;
break;
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c09e7a7a441..4588f02dbb9 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,4 +1,4 @@
-2010-11-29 Kenichi Handa <handa@m17n.org>
+2010-12-01 Kenichi Handa <handa@m17n.org>
* mail/rmailmm.el (rmail-mime-parse): Call rmail-mime-process
within condition-case.
@@ -7,6 +7,36 @@
(rmail-search-mime-message-function): Set to
rmail-search-mime-message.
+2010-12-01 Leo <sdl.web@gmail.com>
+
+ * ido.el (ido-common-initilization): New function. (bug#3274)
+ (ido-mode): Use it.
+ (ido-completing-read): Call it.
+
+2010-11-27 Chong Yidong <cyd@stupidchicken.com>
+
+ * log-edit.el (log-edit-font-lock-keywords): Don't try matching
+ stand-alone lines, since that is handled by log-edit-match-to-eoh
+ (Bug#6465).
+
+2010-11-27 Eduard Wiebe <usenet@pusto.de>
+
+ * dired.el (dired-get-filename): Replace backslashes with slashes
+ in file names on MS-Windows, needed by `locate'. (Bug#7308)
+ * locate.el (locate-default-make-command-line): Don't consider
+ drive letter and root directory part of
+ `directory-listing-before-filename-regexp'. (Bug#7308)
+ (locate-post-command-hook, locate-post-command-hook): New defcustoms.
+
+2010-11-26 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * emacs-lisp/smie.el (smie-prec2->grammar): Simplify handling
+ of :smie-open/close-alist.
+ (smie-next-sexp): Make it accept a "start token" as argument.
+ (smie-indent-keyword): Be careful not to misidentify tokens that span
+ more than one line, as empty lines. Add argument `token'.
+>>>>>>> MERGE-SOURCE
+
2010-11-26 Kenichi Handa <handa@m17n.org>
* mail/rmailmm.el (rmail-mime-insert-multipart): For unsupported
diff --git a/lisp/dired.el b/lisp/dired.el
index bb0cc223281..b2bd082b1a6 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -2012,6 +2012,14 @@ Otherwise, an error occurs in these cases."
;; with quotation marks in their names.
(while (string-match "\\(?:[^\\]\\|\\`\\)\\(\"\\)" file)
(setq file (replace-match "\\\"" nil t file 1)))
+
+ (when (eq system-type 'windows-nt)
+ (save-match-data
+ (let ((start 0))
+ (while (string-match "\\\\" file start)
+ (aset file (match-beginning 0) ?/)
+ (setq start (match-end 0))))))
+
(setq file (read (concat "\"" file "\"")))
;; The above `read' will return a unibyte string if FILE
;; contains eight-bit-control/graphic characters.
diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el
index 179e0a9f094..a7021b3cf7b 100644
--- a/lisp/emacs-lisp/smie.el
+++ b/lisp/emacs-lisp/smie.el
@@ -76,8 +76,6 @@
;; TODO & BUGS:
;;
-;; - FIXME: I think the behavior on empty lines is wrong. It shouldn't
-;; look at the next token on subsequent lines.
;; - Using the structural information SMIE gives us, it should be possible to
;; implement a `smie-align' command that would automatically figure out what
;; there is to align and how to do it (something like: align the token of
@@ -470,7 +468,7 @@ PREC2 is a table as returned by `smie-precs->prec2' or
(to (cdar eqs)))
(setq eqs (cdr eqs))
(if (eq to from)
- nil ;Nothing to do.
+ nil ;Nothing to do.
(dolist (other-eq eqs)
(if (eq from (cdr other-eq)) (setcdr other-eq to))
(when (eq from (car other-eq))
@@ -523,24 +521,23 @@ PREC2 is a table as returned by `smie-precs->prec2' or
(setcar (car eq) (cadr eq))
;; (smie-check-grammar table prec2 'step2)
)
- ;; Finally, fill in the remaining vars (which only appeared on the
- ;; right side of the < constraints).
- (let ((classification-table (gethash :smie-open/close-alist prec2)))
- (dolist (x table)
- ;; When both sides are nil, it means this operator binds very
- ;; very tight, but it's still just an operator, so we give it
- ;; the highest precedence.
- ;; OTOH if only one side is nil, it usually means it's like an
- ;; open-paren, which is very important for indentation purposes,
- ;; so we keep it nil if so, to make it easier to recognize.
- (unless (or (nth 1 x)
- (eq 'opener (cdr (assoc (car x) classification-table))))
- (setf (nth 1 x) i)
- (incf i)) ;See other (incf i) above.
- (unless (or (nth 2 x)
- (eq 'closer (cdr (assoc (car x) classification-table))))
- (setf (nth 2 x) i)
- (incf i))))) ;See other (incf i) above.
+ ;; Finally, fill in the remaining vars (which did not appear on the
+ ;; left side of any < constraint).
+ (dolist (x table)
+ (unless (nth 1 x)
+ (setf (nth 1 x) i)
+ (incf i)) ;See other (incf i) above.
+ (unless (nth 2 x)
+ (setf (nth 2 x) i)
+ (incf i)))) ;See other (incf i) above.
+ ;; Mark closers and openers.
+ (dolist (x (gethash :smie-open/close-alist prec2))
+ (let* ((token (car x))
+ (cons (case (cdr x)
+ (closer (cddr (assoc token table)))
+ (opener (cdr (assoc token table))))))
+ (assert (numberp (car cons)))
+ (setf (car cons) (list (car cons)))))
(let ((ca (gethash :smie-closer-alist prec2)))
(when ca (push (cons :smie-closer-alist ca) table)))
;; (smie-check-grammar table prec2 'step3)
@@ -611,6 +608,8 @@ OP-FORW is the accessor to the forward level of the level data.
OP-BACK is the accessor to the backward level of the level data.
HALFSEXP if non-nil, means skip over a partial sexp if needed. I.e. if the
first token we see is an operator, skip over its left-hand-side argument.
+HALFSEXP can also be a token, in which case it means to parse as if
+we had just successfully passed this token.
Possible return values:
(FORW-LEVEL POS TOKEN): we couldn't skip TOKEN because its back-level
is too high. FORW-LEVEL is the forw-level of TOKEN,
@@ -619,7 +618,10 @@ Possible return values:
(nil POS TOKEN): we skipped over a paren-like pair.
nil: we skipped over an identifier, matched parentheses, ..."
(catch 'return
- (let ((levels ()))
+ (let ((levels
+ (if (stringp halfsexp)
+ (prog1 (list (cdr (assoc halfsexp smie-grammar)))
+ (setq halfsexp nil)))))
(while
(let* ((pos (point))
(token (funcall next-token))
@@ -697,6 +699,8 @@ Possible return values:
"Skip over one sexp.
HALFSEXP if non-nil, means skip over a partial sexp if needed. I.e. if the
first token we see is an operator, skip over its left-hand-side argument.
+HALFSEXP can also be a token, in which case we should skip the text
+assuming it is the left-hand-side argument of that token.
Possible return values:
(LEFT-LEVEL POS TOKEN): we couldn't skip TOKEN because its right-level
is too high. LEFT-LEVEL is the left-level of TOKEN,
@@ -714,7 +718,9 @@ Possible return values:
(defun smie-forward-sexp (&optional halfsexp)
"Skip over one sexp.
HALFSEXP if non-nil, means skip over a partial sexp if needed. I.e. if the
-first token we see is an operator, skip over its left-hand-side argument.
+first token we see is an operator, skip over its right-hand-side argument.
+HALFSEXP can also be a token, in which case we should skip the text
+assuming it is the right-hand-side argument of that token.
Possible return values:
(RIGHT-LEVEL POS TOKEN): we couldn't skip TOKEN because its left-level
is too high. RIGHT-LEVEL is the right-level of TOKEN,
@@ -791,7 +797,7 @@ Possible return values:
(push (car other) found))))))
(cond
((null found) (error "No known closer for opener %s" open))
- ;; FIXME: what should we do if there are various closers?
+ ;; What should we do if there are various closers?
(t (car found))))))))))
(unless (save-excursion (skip-chars-backward " \t") (bolp))
(newline))
@@ -1094,9 +1100,6 @@ Only meaningful when called from within `smie-rules-function'."
;; line, in which case we want to align it with its enclosing parent.
(cond
((and (eq method :before) (smie-rule-bolp) (not (smie-rule-sibling-p)))
- ;; FIXME: Rather than consult the number of spaces, we could *set* the
- ;; number of spaces so as to align the separator with the close-paren
- ;; while aligning the content with the rest.
(let ((parent-col (cdr (smie-rule-parent)))
(parent-pos-col ;FIXME: we knew this when computing smie--parent.
(save-excursion
@@ -1225,39 +1228,48 @@ in order to figure out the indentation of some other (further down) point."
(smie-indent-virtual)) ;:not-hanging
(scan-error nil)))))
-(defun smie-indent-keyword ()
- ;; Align closing token with the corresponding opening one.
- ;; (e.g. "of" with "case", or "in" with "let").
+(defun smie-indent-keyword (&optional token)
+ "Indent point based on the token that follows it immediately.
+If TOKEN is non-nil, assume that that is the token that follows point.
+Returns either a column number or nil if it considers that indentation
+should not be computed on the basis of the following token."
(save-excursion
(let* ((pos (point))
- (toklevels (smie-indent-forward-token))
- (token (pop toklevels)))
+ (toklevels
+ (if token
+ (assoc token smie-grammar)
+ (let* ((res (smie-indent-forward-token)))
+ ;; Ignore tokens on subsequent lines.
+ (if (and (< pos (line-beginning-position))
+ ;; Make sure `token' also *starts* on another line.
+ (save-excursion
+ (smie-indent-backward-token)
+ (< pos (line-beginning-position))))
+ nil
+ (goto-char pos)
+ res)))))
+ (setq token (pop toklevels))
(cond
- ((< pos (line-beginning-position))
- ;; The token we just read is actually not on the line where we started.
- nil)
+ ((null (cdr toklevels)) nil) ;Not a keyword.
((not (numberp (car toklevels)))
- (save-excursion
- (goto-char pos)
- ;; Different cases:
- ;; - smie-indent--bolp: "indent according to others".
- ;; - common hanging: "indent according to others".
- ;; - SML-let hanging: "indent like parent".
- ;; - if-after-else: "indent-like parent".
- ;; - middle-of-line: "trust current position".
- (cond
- ((null (cdr toklevels)) nil) ;Not a keyword.
- ((smie-indent--rule :before token))
- ((smie-indent--bolp) ;I.e. non-virtual indent.
- ;; For an open-paren-like thingy at BOL, always indent only
- ;; based on other rules (typically smie-indent-after-keyword).
- nil)
- (t
- ;; By default use point unless we're hanging.
- (unless (smie-indent--hanging-p) (current-column))))))
+ ;; Different cases:
+ ;; - smie-indent--bolp: "indent according to others".
+ ;; - common hanging: "indent according to others".
+ ;; - SML-let hanging: "indent like parent".
+ ;; - if-after-else: "indent-like parent".
+ ;; - middle-of-line: "trust current position".
+ (cond
+ ((smie-indent--rule :before token))
+ ((smie-indent--bolp) ;I.e. non-virtual indent.
+ ;; For an open-paren-like thingy at BOL, always indent only
+ ;; based on other rules (typically smie-indent-after-keyword).
+ nil)
+ (t
+ ;; By default use point unless we're hanging.
+ (unless (smie-indent--hanging-p) (current-column)))))
(t
;; FIXME: This still looks too much like black magic!!
- (let* ((parent (smie-backward-sexp 'halfsexp)))
+ (let* ((parent (smie-backward-sexp token)))
;; Different behaviors:
;; - align with parent.
;; - parent + offset.
diff --git a/lisp/ido.el b/lisp/ido.el
index a4409775a86..ee8bd4961db 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -1439,6 +1439,11 @@ Removes badly formatted data and ignored directories."
;; ido kill emacs hook
(ido-save-history))
+(defun ido-common-initilization ()
+ (ido-init-completion-maps)
+ (add-hook 'minibuffer-setup-hook 'ido-minibuffer-setup)
+ (add-hook 'choose-completion-string-functions 'ido-choose-completion-string))
+
(define-minor-mode ido-everywhere
"Toggle using ido speed-ups everywhere file and directory names are read.
With ARG, turn ido speed-up on if arg is positive, off otherwise."
@@ -1482,12 +1487,9 @@ This function also adds a hook to the minibuffer."
(t nil)))
(ido-everywhere (if ido-everywhere 1 -1))
- (when ido-mode
- (ido-init-completion-maps))
(when ido-mode
- (add-hook 'minibuffer-setup-hook 'ido-minibuffer-setup)
- (add-hook 'choose-completion-string-functions 'ido-choose-completion-string)
+ (ido-common-initilization)
(ido-load-history)
(add-hook 'kill-emacs-hook 'ido-kill-emacs-hook)
@@ -4679,6 +4681,8 @@ DEF, if non-nil, is the default value."
(ido-directory-too-big nil)
(ido-context-switch-command 'ignore)
(ido-choice-list choices))
+ ;; Initialize ido before invoking ido-read-internal
+ (ido-common-initilization)
(ido-read-internal 'list prompt hist def require-match initial-input)))
(defun ido-unload-function ()
diff --git a/lisp/locate.el b/lisp/locate.el
index ce1154c9739..d5caf8615cd 100644
--- a/lisp/locate.el
+++ b/lisp/locate.el
@@ -145,6 +145,11 @@ the version.)"
:type 'string
:group 'locate)
+(defcustom locate-post-command-hook nil
+ "List of hook functions run after `locate' (see `run-hooks')."
+ :type 'hook
+ :group 'locate)
+
(defvar locate-history-list nil
"The history list used by the \\[locate] command.")
@@ -226,6 +231,11 @@ that is, with a prefix arg, you get the default behavior."
:group 'locate
:type 'boolean)
+(defcustom locate-mode-hook nil
+ "List of hook functions run by `locate-mode' (see `run-mode-hooks')."
+ :type 'hook
+ :group 'locate)
+
;; Functions
(defun locate-default-make-command-line (search-string)
@@ -471,9 +481,9 @@ do not work in subdirectories.
(make-local-variable 'directory-listing-before-filename-regexp)
;; This should support both Unix and Windoze style names
(setq directory-listing-before-filename-regexp
- (concat "^."
+ (concat "^.\\("
(make-string (1- locate-filename-indentation) ?\s)
- "\\(/\\|[A-Za-z]:\\)\\|"
+ "\\)\\|"
(default-value 'directory-listing-before-filename-regexp)))
(make-local-variable 'dired-actual-switches)
(setq dired-actual-switches "")
diff --git a/lisp/log-edit.el b/lisp/log-edit.el
index 0d3061ad2df..ddc0f601701 100644
--- a/lisp/log-edit.el
+++ b/lisp/log-edit.el
@@ -350,17 +350,16 @@ automatically."
(defvar log-edit-font-lock-keywords
;; Copied/inspired by message-font-lock-keywords.
`((log-edit-match-to-eoh
- (,(concat "^\\(\\([a-z]+\\):\\)" log-edit-header-contents-regexp
- "\\|\\(.*\\)")
+ (,(concat "^\\(\\([a-z]+\\):\\)" log-edit-header-contents-regexp)
(progn (goto-char (match-beginning 0)) (match-end 0)) nil
(1 (if (assoc (match-string 2) log-edit-headers-alist)
'log-edit-header
'log-edit-unknown-header)
nil lax)
+ ;; From `log-edit-header-contents-regexp':
(3 (or (cdr (assoc (match-string 2) log-edit-headers-alist))
'log-edit-header)
- nil lax)
- (4 font-lock-warning-face)))))
+ nil lax)))))
;;;###autoload
(defun log-edit (callback &optional setup params buffer mode &rest ignore)