aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa2010-12-02 09:44:25 +0900
committerKenichi Handa2010-12-02 09:44:25 +0900
commit423a637bdbb746e112c5584e259bf28c5402901d (patch)
tree4ad9b32418e59697854bab91ce85e3e276403f69
parent7e116860bbae843e00c29b08919e10fc37f7aaa2 (diff)
parent769741e3d1ba0f22dd4619058185f294b3c189ea (diff)
downloademacs-423a637bdbb746e112c5584e259bf28c5402901d.tar.gz
emacs-423a637bdbb746e112c5584e259bf28c5402901d.zip
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 @@
12010-12-01 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * backups.texi (Making Backups):
4 * modes.texi (Example Major Modes): Use recommended coding style.
5 (Major Mode Basics, Derived Modes): Encourge more strongly use of
6 define-derived-mode. Mention completion-at-point-functions.
7
12010-11-21 Chong Yidong <cyd@stupidchicken.com> 82010-11-21 Chong Yidong <cyd@stupidchicken.com>
2 9
3 * nonascii.texi (Converting Representations): Document 10 * 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.)
88@smallexample 88@smallexample
89@group 89@group
90(add-hook 'rmail-mode-hook 90(add-hook 'rmail-mode-hook
91 (function (lambda () 91 (lambda ()
92 (make-local-variable 92 (set (make-local-variable 'make-backup-files) nil)))
93 'make-backup-files)
94 (setq make-backup-files nil))))
95@end group 93@end group
96@end smallexample 94@end smallexample
97@end defopt 95@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
20@ref{Keymaps}, and @ref{Syntax Tables}. 20@ref{Keymaps}, and @ref{Syntax Tables}.
21 21
22@menu 22@menu
23* Hooks:: How to use hooks; how to write code that provides hooks. 23* Hooks:: How to use hooks; how to write code that provides hooks.
24* Major Modes:: Defining major modes. 24* Major Modes:: Defining major modes.
25* Minor Modes:: Defining minor modes. 25* Minor Modes:: Defining minor modes.
26* Mode Line Format:: Customizing the text that appears in the mode line. 26* Mode Line Format:: Customizing the text that appears in the mode line.
27* Imenu:: How a mode can provide a menu 27* Imenu:: How a mode can provide a menu
28 of definitions in the buffer. 28 of definitions in the buffer.
29* Font Lock Mode:: How modes can highlight text according to syntax. 29* Font Lock Mode:: How modes can highlight text according to syntax.
@@ -78,8 +78,8 @@ convention.
78its value is just a single function, not a list of functions. 78its value is just a single function, not a list of functions.
79 79
80@menu 80@menu
81* Running Hooks:: How to run a hook. 81* Running Hooks:: How to run a hook.
82* Setting Hooks:: How to put functions on a hook, or remove them. 82* Setting Hooks:: How to put functions on a hook, or remove them.
83@end menu 83@end menu
84 84
85@node Running Hooks 85@node Running Hooks
@@ -199,16 +199,16 @@ buffer, such as a local keymap. The effect lasts until you switch
199to another major mode in the same buffer. 199to another major mode in the same buffer.
200 200
201@menu 201@menu
202* Major Mode Basics:: 202* Major Mode Basics::
203* Major Mode Conventions:: Coding conventions for keymaps, etc. 203* Major Mode Conventions:: Coding conventions for keymaps, etc.
204* Auto Major Mode:: How Emacs chooses the major mode automatically. 204* Auto Major Mode:: How Emacs chooses the major mode automatically.
205* Mode Help:: Finding out how to use a mode. 205* Mode Help:: Finding out how to use a mode.
206* Derived Modes:: Defining a new major mode based on another major 206* Derived Modes:: Defining a new major mode based on another major
207 mode. 207 mode.
208* Generic Modes:: Defining a simple major mode that supports 208* Generic Modes:: Defining a simple major mode that supports
209 comment syntax and Font Lock mode. 209 comment syntax and Font Lock mode.
210* Mode Hooks:: Hooks run at the end of major mode functions. 210* Mode Hooks:: Hooks run at the end of major mode functions.
211* Example Major Modes:: Text mode and Lisp modes. 211* Example Major Modes:: Text mode and Lisp modes.
212@end menu 212@end menu
213 213
214@node Major Mode Basics 214@node Major Mode Basics
@@ -238,9 +238,8 @@ mode except that it provides two additional commands. Its definition
238is distinct from that of Text mode, but uses that of Text mode. 238is distinct from that of Text mode, but uses that of Text mode.
239 239
240 Even if the new mode is not an obvious derivative of any other mode, 240 Even if the new mode is not an obvious derivative of any other mode,
241it is convenient to use @code{define-derived-mode} with a @code{nil} 241we recommend to use @code{define-derived-mode}, since it automatically
242parent argument, since it automatically enforces the most important 242enforces the most important coding conventions for you.
243coding conventions for you.
244 243
245 For a very simple programming language major mode that handles 244 For a very simple programming language major mode that handles
246comments and fontification, you can use @code{define-generic-mode}. 245comments and fontification, you can use @code{define-generic-mode}.
@@ -429,6 +428,10 @@ The mode can specify a local value for
429this mode. 428this mode.
430 429
431@item 430@item
431The mode can specify how to complete various keywords by adding
432to the special hook @code{completion-at-point-functions}.
433
434@item
432Use @code{defvar} or @code{defcustom} to set mode-related variables, so 435Use @code{defvar} or @code{defcustom} to set mode-related variables, so
433that they are not reinitialized if they already have a value. (Such 436that they are not reinitialized if they already have a value. (Such
434reinitialization could discard customizations made by the user.) 437reinitialization could discard customizations made by the user.)
@@ -492,7 +495,7 @@ The @code{define-derived-mode} macro automatically marks the derived
492mode as special if the parent mode is special. The special mode 495mode as special if the parent mode is special. The special mode
493@code{special-mode} provides a convenient parent for other special 496@code{special-mode} provides a convenient parent for other special
494modes to inherit from; it sets @code{buffer-read-only} to @code{t}, 497modes to inherit from; it sets @code{buffer-read-only} to @code{t},
495and does nothing else. 498and does little else.
496 499
497@item 500@item
498If you want to make the new mode the default for files with certain 501If you want to make the new mode the default for files with certain
@@ -737,8 +740,10 @@ documentation of the major mode.
737@subsection Defining Derived Modes 740@subsection Defining Derived Modes
738@cindex derived mode 741@cindex derived mode
739 742
740 It's often useful to define a new major mode in terms of an existing 743 The recommended way to define a new major mode is to derive it
741one. An easy way to do this is to use @code{define-derived-mode}. 744from an existing one using @code{define-derived-mode}. If there is no
745closely related mode, you can inherit from @code{text-mode},
746@code{special-mode}, or in the worst case @code{fundamental-mode}.
742 747
743@defmac define-derived-mode variant parent name docstring keyword-args@dots{} body@dots{} 748@defmac define-derived-mode variant parent name docstring keyword-args@dots{} body@dots{}
744This macro defines @var{variant} as a major mode command, using 749This macro defines @var{variant} as a major mode command, using
@@ -979,8 +984,7 @@ You can thus get the full benefit of adaptive filling
979Turning on Text mode runs the normal hook `text-mode-hook'." 984Turning on Text mode runs the normal hook `text-mode-hook'."
980@end group 985@end group
981@group 986@group
982 (make-local-variable 'text-mode-variant) 987 (set (make-local-variable 'text-mode-variant) t)
983 (setq text-mode-variant t)
984 ;; @r{These two lines are a feature added recently.} 988 ;; @r{These two lines are a feature added recently.}
985 (set (make-local-variable 'require-final-newline) 989 (set (make-local-variable 'require-final-newline)
986 mode-require-final-newline) 990 mode-require-final-newline)
@@ -998,9 +1002,8 @@ the default value, and we'll delete it in a future version.)
998@smallexample 1002@smallexample
999@group 1003@group
1000;; @r{This isn't needed nowadays, since @code{define-derived-mode} does it.} 1004;; @r{This isn't needed nowadays, since @code{define-derived-mode} does it.}
1001(defvar text-mode-abbrev-table nil 1005(define-abbrev-table 'text-mode-abbrev-table ()
1002 "Abbrev table used while in text mode.") 1006 "Abbrev table used while in text mode.")
1003(define-abbrev-table 'text-mode-abbrev-table ())
1004@end group 1007@end group
1005 1008
1006@group 1009@group
@@ -1022,12 +1025,10 @@ Turning on text-mode runs the hook `text-mode-hook'."
1022 ;; @r{These four lines are absent from the current version} 1025 ;; @r{These four lines are absent from the current version}
1023 ;; @r{not because this is done some other way, but rather} 1026 ;; @r{not because this is done some other way, but rather}
1024 ;; @r{because nowadays Text mode uses the normal definition of paragraphs.} 1027 ;; @r{because nowadays Text mode uses the normal definition of paragraphs.}
1025 (make-local-variable 'paragraph-start) 1028 (set (make-local-variable 'paragraph-start)
1026 (setq paragraph-start (concat "[ \t]*$\\|" page-delimiter)) 1029 (concat "[ \t]*$\\|" page-delimiter))
1027 (make-local-variable 'paragraph-separate) 1030 (set (make-local-variable 'paragraph-separate) paragraph-start)
1028 (setq paragraph-separate paragraph-start) 1031 (set (make-local-variable 'indent-line-function) 'indent-relative-maybe)
1029 (make-local-variable 'indent-line-function)
1030 (setq indent-line-function 'indent-relative-maybe)
1031@end group 1032@end group
1032@group 1033@group
1033 (setq mode-name "Text") 1034 (setq mode-name "Text")
@@ -1115,15 +1116,12 @@ modes should understand the Lisp conventions for comments. The rest of
1115 1116
1116@smallexample 1117@smallexample
1117@group 1118@group
1118 (make-local-variable 'paragraph-start) 1119 (set (make-local-variable 'paragraph-start) (concat page-delimiter "\\|$" ))
1119 (setq paragraph-start (concat page-delimiter "\\|$" )) 1120 (set (make-local-variable 'paragraph-separate) paragraph-start)
1120 (make-local-variable 'paragraph-separate)
1121 (setq paragraph-separate paragraph-start)
1122 @dots{} 1121 @dots{}
1123@end group 1122@end group
1124@group 1123@group
1125 (make-local-variable 'comment-indent-function) 1124 (set (make-local-variable 'comment-indent-function) 'lisp-comment-indent))
1126 (setq comment-indent-function 'lisp-comment-indent))
1127 @dots{} 1125 @dots{}
1128@end group 1126@end group
1129@end smallexample 1127@end smallexample
@@ -1135,16 +1133,13 @@ common. The following code sets up the common commands:
1135 1133
1136@smallexample 1134@smallexample
1137@group 1135@group
1138(defvar shared-lisp-mode-map () 1136(defvar shared-lisp-mode-map
1137 (let ((map (make-sparse-keymap)))
1138 (define-key shared-lisp-mode-map "\e\C-q" 'indent-sexp)
1139 (define-key shared-lisp-mode-map "\177"
1140 'backward-delete-char-untabify)
1141 map)
1139 "Keymap for commands shared by all sorts of Lisp modes.") 1142 "Keymap for commands shared by all sorts of Lisp modes.")
1140
1141;; @r{Putting this @code{if} after the @code{defvar} is an older style.}
1142(if shared-lisp-mode-map
1143 ()
1144 (setq shared-lisp-mode-map (make-sparse-keymap))
1145 (define-key shared-lisp-mode-map "\e\C-q" 'indent-sexp)
1146 (define-key shared-lisp-mode-map "\177"
1147 'backward-delete-char-untabify))
1148@end group 1143@end group
1149@end smallexample 1144@end smallexample
1150 1145
@@ -1153,15 +1148,13 @@ And here is the code to set up the keymap for Lisp mode:
1153 1148
1154@smallexample 1149@smallexample
1155@group 1150@group
1156(defvar lisp-mode-map () 1151(defvar lisp-mode-map
1152 (let ((map (make-sparse-keymap)))
1153 (set-keymap-parent map shared-lisp-mode-map)
1154 (define-key map "\e\C-x" 'lisp-eval-defun)
1155 (define-key map "\C-c\C-z" 'run-lisp)
1156 map)
1157 "Keymap for ordinary Lisp mode...") 1157 "Keymap for ordinary Lisp mode...")
1158
1159(if lisp-mode-map
1160 ()
1161 (setq lisp-mode-map (make-sparse-keymap))
1162 (set-keymap-parent lisp-mode-map shared-lisp-mode-map)
1163 (define-key lisp-mode-map "\e\C-x" 'lisp-eval-defun)
1164 (define-key lisp-mode-map "\C-c\C-z" 'run-lisp))
1165@end group 1158@end group
1166@end smallexample 1159@end smallexample
1167 1160
@@ -1192,11 +1185,9 @@ if that value is non-nil."
1192 ; @r{finds out what to describe.} 1185 ; @r{finds out what to describe.}
1193 (setq mode-name "Lisp") ; @r{This goes into the mode line.} 1186 (setq mode-name "Lisp") ; @r{This goes into the mode line.}
1194 (lisp-mode-variables t) ; @r{This defines various variables.} 1187 (lisp-mode-variables t) ; @r{This defines various variables.}
1195 (make-local-variable 'comment-start-skip) 1188 (set (make-local-variable 'comment-start-skip)
1196 (setq comment-start-skip 1189 "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *")
1197 "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *") 1190 (set (make-local-variable 'font-lock-keywords-case-fold-search) t)
1198 (make-local-variable 'font-lock-keywords-case-fold-search)
1199 (setq font-lock-keywords-case-fold-search t)
1200@end group 1191@end group
1201@group 1192@group
1202 (setq imenu-case-fold-search t) 1193 (setq imenu-case-fold-search t)
@@ -1580,14 +1571,14 @@ information displayed in the mode line relates to the enabled major and
1580minor modes. 1571minor modes.
1581 1572
1582@menu 1573@menu
1583* Base: Mode Line Basics. Basic ideas of mode line control. 1574* Base: Mode Line Basics. Basic ideas of mode line control.
1584* Data: Mode Line Data. The data structure that controls the mode line. 1575* Data: Mode Line Data. The data structure that controls the mode line.
1585* Top: Mode Line Top. The top level variable, mode-line-format. 1576* Top: Mode Line Top. The top level variable, mode-line-format.
1586* Mode Line Variables:: Variables used in that data structure. 1577* Mode Line Variables:: Variables used in that data structure.
1587* %-Constructs:: Putting information into a mode line. 1578* %-Constructs:: Putting information into a mode line.
1588* Properties in Mode:: Using text properties in the mode line. 1579* Properties in Mode:: Using text properties in the mode line.
1589* Header Lines:: Like a mode line, but at the top. 1580* Header Lines:: Like a mode line, but at the top.
1590* Emulating Mode Line:: Formatting text as the mode line would. 1581* Emulating Mode Line:: Formatting text as the mode line would.
1591@end menu 1582@end menu
1592 1583
1593@node Mode Line Basics 1584@node Mode Line Basics
@@ -2361,7 +2352,7 @@ Search-based fontification happens second.
2361* Other Font Lock Variables:: Additional customization facilities. 2352* Other Font Lock Variables:: Additional customization facilities.
2362* Levels of Font Lock:: Each mode can define alternative levels 2353* Levels of Font Lock:: Each mode can define alternative levels
2363 so that the user can select more or less. 2354 so that the user can select more or less.
2364* Precalculated Fontification:: How Lisp programs that produce the buffer 2355* Precalculated Fontification:: How Lisp programs that produce the buffer
2365 contents can also specify how to fontify it. 2356 contents can also specify how to fontify it.
2366* Faces for Font Lock:: Special faces specifically for Font Lock. 2357* Faces for Font Lock:: Special faces specifically for Font Lock.
2367* Syntactic Font Lock:: Fontification based on syntax tables. 2358* Syntactic Font Lock:: Fontification based on syntax tables.
@@ -3276,5 +3267,7 @@ optionally bound to @code{desktop-save-buffer}.
3276@end defvar 3267@end defvar
3277 3268
3278@ignore 3269@ignore
3279 arch-tag: 4c7bff41-36e6-4da6-9e7f-9b9289e27c8e 3270 Local Variables:
3271 fill-column: 72
3272 End:
3280@end ignore 3273@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.
2205@defvar indent-line-function 2205@defvar indent-line-function
2206This variable's value is the function to be used by @key{TAB} (and 2206This variable's value is the function to be used by @key{TAB} (and
2207various commands) to indent the current line. The command 2207various commands) to indent the current line. The command
2208@code{indent-according-to-mode} does no more than call this function. 2208@code{indent-according-to-mode} does little more than call this function.
2209 2209
2210In Lisp mode, the value is the symbol @code{lisp-indent-line}; in C 2210In Lisp mode, the value is the symbol @code{lisp-indent-line}; in C
2211mode, @code{c-indent-line}; in Fortran mode, @code{fortran-indent-line}. 2211mode, @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 @@
12010-11-27 Joe Matarazzo <joe.matarazzo@gmail.com> (tiny change)
2
3 * ebrowse.c (yylex): If end of input buffer encountered while
4 searching for a newline after "//", return YYEOF. (Bug#7446)
5
12010-11-10 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> 62010-11-10 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
2 7
3 * emacsclient.c (set_local_socket) [DARWIN_OS]: Add fall-back 8 * 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 ()
1784 case '/': 1784 case '/':
1785 while (GET (c) && c != '\n') 1785 while (GET (c) && c != '\n')
1786 ; 1786 ;
1787 /* Don't try to read past the end of the input buffer if
1788 the file ends in a C++ comment without a newline. */
1789 if (c == 0)
1790 return YYEOF;
1791
1787 INCREMENT_LINENO; 1792 INCREMENT_LINENO;
1788 break; 1793 break;
1789 1794
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c09e7a7a441..4588f02dbb9 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,4 +1,4 @@
12010-11-29 Kenichi Handa <handa@m17n.org> 12010-12-01 Kenichi Handa <handa@m17n.org>
2 2
3 * mail/rmailmm.el (rmail-mime-parse): Call rmail-mime-process 3 * mail/rmailmm.el (rmail-mime-parse): Call rmail-mime-process
4 within condition-case. 4 within condition-case.
@@ -7,6 +7,36 @@
7 (rmail-search-mime-message-function): Set to 7 (rmail-search-mime-message-function): Set to
8 rmail-search-mime-message. 8 rmail-search-mime-message.
9 9
102010-12-01 Leo <sdl.web@gmail.com>
11
12 * ido.el (ido-common-initilization): New function. (bug#3274)
13 (ido-mode): Use it.
14 (ido-completing-read): Call it.
15
162010-11-27 Chong Yidong <cyd@stupidchicken.com>
17
18 * log-edit.el (log-edit-font-lock-keywords): Don't try matching
19 stand-alone lines, since that is handled by log-edit-match-to-eoh
20 (Bug#6465).
21
222010-11-27 Eduard Wiebe <usenet@pusto.de>
23
24 * dired.el (dired-get-filename): Replace backslashes with slashes
25 in file names on MS-Windows, needed by `locate'. (Bug#7308)
26 * locate.el (locate-default-make-command-line): Don't consider
27 drive letter and root directory part of
28 `directory-listing-before-filename-regexp'. (Bug#7308)
29 (locate-post-command-hook, locate-post-command-hook): New defcustoms.
30
312010-11-26 Stefan Monnier <monnier@iro.umontreal.ca>
32
33 * emacs-lisp/smie.el (smie-prec2->grammar): Simplify handling
34 of :smie-open/close-alist.
35 (smie-next-sexp): Make it accept a "start token" as argument.
36 (smie-indent-keyword): Be careful not to misidentify tokens that span
37 more than one line, as empty lines. Add argument `token'.
38>>>>>>> MERGE-SOURCE
39
102010-11-26 Kenichi Handa <handa@m17n.org> 402010-11-26 Kenichi Handa <handa@m17n.org>
11 41
12 * mail/rmailmm.el (rmail-mime-insert-multipart): For unsupported 42 * 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."
2012 ;; with quotation marks in their names. 2012 ;; with quotation marks in their names.
2013 (while (string-match "\\(?:[^\\]\\|\\`\\)\\(\"\\)" file) 2013 (while (string-match "\\(?:[^\\]\\|\\`\\)\\(\"\\)" file)
2014 (setq file (replace-match "\\\"" nil t file 1))) 2014 (setq file (replace-match "\\\"" nil t file 1)))
2015
2016 (when (eq system-type 'windows-nt)
2017 (save-match-data
2018 (let ((start 0))
2019 (while (string-match "\\\\" file start)
2020 (aset file (match-beginning 0) ?/)
2021 (setq start (match-end 0))))))
2022
2015 (setq file (read (concat "\"" file "\""))) 2023 (setq file (read (concat "\"" file "\"")))
2016 ;; The above `read' will return a unibyte string if FILE 2024 ;; The above `read' will return a unibyte string if FILE
2017 ;; contains eight-bit-control/graphic characters. 2025 ;; 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 @@
76 76
77;; TODO & BUGS: 77;; TODO & BUGS:
78;; 78;;
79;; - FIXME: I think the behavior on empty lines is wrong. It shouldn't
80;; look at the next token on subsequent lines.
81;; - Using the structural information SMIE gives us, it should be possible to 79;; - Using the structural information SMIE gives us, it should be possible to
82;; implement a `smie-align' command that would automatically figure out what 80;; implement a `smie-align' command that would automatically figure out what
83;; there is to align and how to do it (something like: align the token of 81;; 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
470 (to (cdar eqs))) 468 (to (cdar eqs)))
471 (setq eqs (cdr eqs)) 469 (setq eqs (cdr eqs))
472 (if (eq to from) 470 (if (eq to from)
473 nil ;Nothing to do. 471 nil ;Nothing to do.
474 (dolist (other-eq eqs) 472 (dolist (other-eq eqs)
475 (if (eq from (cdr other-eq)) (setcdr other-eq to)) 473 (if (eq from (cdr other-eq)) (setcdr other-eq to))
476 (when (eq from (car other-eq)) 474 (when (eq from (car other-eq))
@@ -523,24 +521,23 @@ PREC2 is a table as returned by `smie-precs->prec2' or
523 (setcar (car eq) (cadr eq)) 521 (setcar (car eq) (cadr eq))
524 ;; (smie-check-grammar table prec2 'step2) 522 ;; (smie-check-grammar table prec2 'step2)
525 ) 523 )
526 ;; Finally, fill in the remaining vars (which only appeared on the 524 ;; Finally, fill in the remaining vars (which did not appear on the
527 ;; right side of the < constraints). 525 ;; left side of any < constraint).
528 (let ((classification-table (gethash :smie-open/close-alist prec2))) 526 (dolist (x table)
529 (dolist (x table) 527 (unless (nth 1 x)
530 ;; When both sides are nil, it means this operator binds very 528 (setf (nth 1 x) i)
531 ;; very tight, but it's still just an operator, so we give it 529 (incf i)) ;See other (incf i) above.
532 ;; the highest precedence. 530 (unless (nth 2 x)
533 ;; OTOH if only one side is nil, it usually means it's like an 531 (setf (nth 2 x) i)
534 ;; open-paren, which is very important for indentation purposes, 532 (incf i)))) ;See other (incf i) above.
535 ;; so we keep it nil if so, to make it easier to recognize. 533 ;; Mark closers and openers.
536 (unless (or (nth 1 x) 534 (dolist (x (gethash :smie-open/close-alist prec2))
537 (eq 'opener (cdr (assoc (car x) classification-table)))) 535 (let* ((token (car x))
538 (setf (nth 1 x) i) 536 (cons (case (cdr x)
539 (incf i)) ;See other (incf i) above. 537 (closer (cddr (assoc token table)))
540 (unless (or (nth 2 x) 538 (opener (cdr (assoc token table))))))
541 (eq 'closer (cdr (assoc (car x) classification-table)))) 539 (assert (numberp (car cons)))
542 (setf (nth 2 x) i) 540 (setf (car cons) (list (car cons)))))
543 (incf i))))) ;See other (incf i) above.
544 (let ((ca (gethash :smie-closer-alist prec2))) 541 (let ((ca (gethash :smie-closer-alist prec2)))
545 (when ca (push (cons :smie-closer-alist ca) table))) 542 (when ca (push (cons :smie-closer-alist ca) table)))
546 ;; (smie-check-grammar table prec2 'step3) 543 ;; (smie-check-grammar table prec2 'step3)
@@ -611,6 +608,8 @@ OP-FORW is the accessor to the forward level of the level data.
611OP-BACK is the accessor to the backward level of the level data. 608OP-BACK is the accessor to the backward level of the level data.
612HALFSEXP if non-nil, means skip over a partial sexp if needed. I.e. if the 609HALFSEXP if non-nil, means skip over a partial sexp if needed. I.e. if the
613first token we see is an operator, skip over its left-hand-side argument. 610first token we see is an operator, skip over its left-hand-side argument.
611HALFSEXP can also be a token, in which case it means to parse as if
612we had just successfully passed this token.
614Possible return values: 613Possible return values:
615 (FORW-LEVEL POS TOKEN): we couldn't skip TOKEN because its back-level 614 (FORW-LEVEL POS TOKEN): we couldn't skip TOKEN because its back-level
616 is too high. FORW-LEVEL is the forw-level of TOKEN, 615 is too high. FORW-LEVEL is the forw-level of TOKEN,
@@ -619,7 +618,10 @@ Possible return values:
619 (nil POS TOKEN): we skipped over a paren-like pair. 618 (nil POS TOKEN): we skipped over a paren-like pair.
620 nil: we skipped over an identifier, matched parentheses, ..." 619 nil: we skipped over an identifier, matched parentheses, ..."
621 (catch 'return 620 (catch 'return
622 (let ((levels ())) 621 (let ((levels
622 (if (stringp halfsexp)
623 (prog1 (list (cdr (assoc halfsexp smie-grammar)))
624 (setq halfsexp nil)))))
623 (while 625 (while
624 (let* ((pos (point)) 626 (let* ((pos (point))
625 (token (funcall next-token)) 627 (token (funcall next-token))
@@ -697,6 +699,8 @@ Possible return values:
697 "Skip over one sexp. 699 "Skip over one sexp.
698HALFSEXP if non-nil, means skip over a partial sexp if needed. I.e. if the 700HALFSEXP if non-nil, means skip over a partial sexp if needed. I.e. if the
699first token we see is an operator, skip over its left-hand-side argument. 701first token we see is an operator, skip over its left-hand-side argument.
702HALFSEXP can also be a token, in which case we should skip the text
703assuming it is the left-hand-side argument of that token.
700Possible return values: 704Possible return values:
701 (LEFT-LEVEL POS TOKEN): we couldn't skip TOKEN because its right-level 705 (LEFT-LEVEL POS TOKEN): we couldn't skip TOKEN because its right-level
702 is too high. LEFT-LEVEL is the left-level of TOKEN, 706 is too high. LEFT-LEVEL is the left-level of TOKEN,
@@ -714,7 +718,9 @@ Possible return values:
714(defun smie-forward-sexp (&optional halfsexp) 718(defun smie-forward-sexp (&optional halfsexp)
715 "Skip over one sexp. 719 "Skip over one sexp.
716HALFSEXP if non-nil, means skip over a partial sexp if needed. I.e. if the 720HALFSEXP if non-nil, means skip over a partial sexp if needed. I.e. if the
717first token we see is an operator, skip over its left-hand-side argument. 721first token we see is an operator, skip over its right-hand-side argument.
722HALFSEXP can also be a token, in which case we should skip the text
723assuming it is the right-hand-side argument of that token.
718Possible return values: 724Possible return values:
719 (RIGHT-LEVEL POS TOKEN): we couldn't skip TOKEN because its left-level 725 (RIGHT-LEVEL POS TOKEN): we couldn't skip TOKEN because its left-level
720 is too high. RIGHT-LEVEL is the right-level of TOKEN, 726 is too high. RIGHT-LEVEL is the right-level of TOKEN,
@@ -791,7 +797,7 @@ Possible return values:
791 (push (car other) found)))))) 797 (push (car other) found))))))
792 (cond 798 (cond
793 ((null found) (error "No known closer for opener %s" open)) 799 ((null found) (error "No known closer for opener %s" open))
794 ;; FIXME: what should we do if there are various closers? 800 ;; What should we do if there are various closers?
795 (t (car found)))))))))) 801 (t (car found))))))))))
796 (unless (save-excursion (skip-chars-backward " \t") (bolp)) 802 (unless (save-excursion (skip-chars-backward " \t") (bolp))
797 (newline)) 803 (newline))
@@ -1094,9 +1100,6 @@ Only meaningful when called from within `smie-rules-function'."
1094 ;; line, in which case we want to align it with its enclosing parent. 1100 ;; line, in which case we want to align it with its enclosing parent.
1095 (cond 1101 (cond
1096 ((and (eq method :before) (smie-rule-bolp) (not (smie-rule-sibling-p))) 1102 ((and (eq method :before) (smie-rule-bolp) (not (smie-rule-sibling-p)))
1097 ;; FIXME: Rather than consult the number of spaces, we could *set* the
1098 ;; number of spaces so as to align the separator with the close-paren
1099 ;; while aligning the content with the rest.
1100 (let ((parent-col (cdr (smie-rule-parent))) 1103 (let ((parent-col (cdr (smie-rule-parent)))
1101 (parent-pos-col ;FIXME: we knew this when computing smie--parent. 1104 (parent-pos-col ;FIXME: we knew this when computing smie--parent.
1102 (save-excursion 1105 (save-excursion
@@ -1225,39 +1228,48 @@ in order to figure out the indentation of some other (further down) point."
1225 (smie-indent-virtual)) ;:not-hanging 1228 (smie-indent-virtual)) ;:not-hanging
1226 (scan-error nil))))) 1229 (scan-error nil)))))
1227 1230
1228(defun smie-indent-keyword () 1231(defun smie-indent-keyword (&optional token)
1229 ;; Align closing token with the corresponding opening one. 1232 "Indent point based on the token that follows it immediately.
1230 ;; (e.g. "of" with "case", or "in" with "let"). 1233If TOKEN is non-nil, assume that that is the token that follows point.
1234Returns either a column number or nil if it considers that indentation
1235should not be computed on the basis of the following token."
1231 (save-excursion 1236 (save-excursion
1232 (let* ((pos (point)) 1237 (let* ((pos (point))
1233 (toklevels (smie-indent-forward-token)) 1238 (toklevels
1234 (token (pop toklevels))) 1239 (if token
1240 (assoc token smie-grammar)
1241 (let* ((res (smie-indent-forward-token)))
1242 ;; Ignore tokens on subsequent lines.
1243 (if (and (< pos (line-beginning-position))
1244 ;; Make sure `token' also *starts* on another line.
1245 (save-excursion
1246 (smie-indent-backward-token)
1247 (< pos (line-beginning-position))))
1248 nil
1249 (goto-char pos)
1250 res)))))
1251 (setq token (pop toklevels))
1235 (cond 1252 (cond
1236 ((< pos (line-beginning-position)) 1253 ((null (cdr toklevels)) nil) ;Not a keyword.
1237 ;; The token we just read is actually not on the line where we started.
1238 nil)
1239 ((not (numberp (car toklevels))) 1254 ((not (numberp (car toklevels)))
1240 (save-excursion 1255 ;; Different cases:
1241 (goto-char pos) 1256 ;; - smie-indent--bolp: "indent according to others".
1242 ;; Different cases: 1257 ;; - common hanging: "indent according to others".
1243 ;; - smie-indent--bolp: "indent according to others". 1258 ;; - SML-let hanging: "indent like parent".
1244 ;; - common hanging: "indent according to others". 1259 ;; - if-after-else: "indent-like parent".
1245 ;; - SML-let hanging: "indent like parent". 1260 ;; - middle-of-line: "trust current position".
1246 ;; - if-after-else: "indent-like parent". 1261 (cond
1247 ;; - middle-of-line: "trust current position". 1262 ((smie-indent--rule :before token))
1248 (cond 1263 ((smie-indent--bolp) ;I.e. non-virtual indent.
1249 ((null (cdr toklevels)) nil) ;Not a keyword. 1264 ;; For an open-paren-like thingy at BOL, always indent only
1250 ((smie-indent--rule :before token)) 1265 ;; based on other rules (typically smie-indent-after-keyword).
1251 ((smie-indent--bolp) ;I.e. non-virtual indent. 1266 nil)
1252 ;; For an open-paren-like thingy at BOL, always indent only 1267 (t
1253 ;; based on other rules (typically smie-indent-after-keyword). 1268 ;; By default use point unless we're hanging.
1254 nil) 1269 (unless (smie-indent--hanging-p) (current-column)))))
1255 (t
1256 ;; By default use point unless we're hanging.
1257 (unless (smie-indent--hanging-p) (current-column))))))
1258 (t 1270 (t
1259 ;; FIXME: This still looks too much like black magic!! 1271 ;; FIXME: This still looks too much like black magic!!
1260 (let* ((parent (smie-backward-sexp 'halfsexp))) 1272 (let* ((parent (smie-backward-sexp token)))
1261 ;; Different behaviors: 1273 ;; Different behaviors:
1262 ;; - align with parent. 1274 ;; - align with parent.
1263 ;; - parent + offset. 1275 ;; - 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."
1439 ;; ido kill emacs hook 1439 ;; ido kill emacs hook
1440 (ido-save-history)) 1440 (ido-save-history))
1441 1441
1442(defun ido-common-initilization ()
1443 (ido-init-completion-maps)
1444 (add-hook 'minibuffer-setup-hook 'ido-minibuffer-setup)
1445 (add-hook 'choose-completion-string-functions 'ido-choose-completion-string))
1446
1442(define-minor-mode ido-everywhere 1447(define-minor-mode ido-everywhere
1443 "Toggle using ido speed-ups everywhere file and directory names are read. 1448 "Toggle using ido speed-ups everywhere file and directory names are read.
1444With ARG, turn ido speed-up on if arg is positive, off otherwise." 1449With 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."
1482 (t nil))) 1487 (t nil)))
1483 1488
1484 (ido-everywhere (if ido-everywhere 1 -1)) 1489 (ido-everywhere (if ido-everywhere 1 -1))
1485 (when ido-mode
1486 (ido-init-completion-maps))
1487 1490
1488 (when ido-mode 1491 (when ido-mode
1489 (add-hook 'minibuffer-setup-hook 'ido-minibuffer-setup) 1492 (ido-common-initilization)
1490 (add-hook 'choose-completion-string-functions 'ido-choose-completion-string)
1491 (ido-load-history) 1493 (ido-load-history)
1492 1494
1493 (add-hook 'kill-emacs-hook 'ido-kill-emacs-hook) 1495 (add-hook 'kill-emacs-hook 'ido-kill-emacs-hook)
@@ -4679,6 +4681,8 @@ DEF, if non-nil, is the default value."
4679 (ido-directory-too-big nil) 4681 (ido-directory-too-big nil)
4680 (ido-context-switch-command 'ignore) 4682 (ido-context-switch-command 'ignore)
4681 (ido-choice-list choices)) 4683 (ido-choice-list choices))
4684 ;; Initialize ido before invoking ido-read-internal
4685 (ido-common-initilization)
4682 (ido-read-internal 'list prompt hist def require-match initial-input))) 4686 (ido-read-internal 'list prompt hist def require-match initial-input)))
4683 4687
4684(defun ido-unload-function () 4688(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.)"
145 :type 'string 145 :type 'string
146 :group 'locate) 146 :group 'locate)
147 147
148(defcustom locate-post-command-hook nil
149 "List of hook functions run after `locate' (see `run-hooks')."
150 :type 'hook
151 :group 'locate)
152
148(defvar locate-history-list nil 153(defvar locate-history-list nil
149 "The history list used by the \\[locate] command.") 154 "The history list used by the \\[locate] command.")
150 155
@@ -226,6 +231,11 @@ that is, with a prefix arg, you get the default behavior."
226 :group 'locate 231 :group 'locate
227 :type 'boolean) 232 :type 'boolean)
228 233
234(defcustom locate-mode-hook nil
235 "List of hook functions run by `locate-mode' (see `run-mode-hooks')."
236 :type 'hook
237 :group 'locate)
238
229;; Functions 239;; Functions
230 240
231(defun locate-default-make-command-line (search-string) 241(defun locate-default-make-command-line (search-string)
@@ -471,9 +481,9 @@ do not work in subdirectories.
471 (make-local-variable 'directory-listing-before-filename-regexp) 481 (make-local-variable 'directory-listing-before-filename-regexp)
472 ;; This should support both Unix and Windoze style names 482 ;; This should support both Unix and Windoze style names
473 (setq directory-listing-before-filename-regexp 483 (setq directory-listing-before-filename-regexp
474 (concat "^." 484 (concat "^.\\("
475 (make-string (1- locate-filename-indentation) ?\s) 485 (make-string (1- locate-filename-indentation) ?\s)
476 "\\(/\\|[A-Za-z]:\\)\\|" 486 "\\)\\|"
477 (default-value 'directory-listing-before-filename-regexp))) 487 (default-value 'directory-listing-before-filename-regexp)))
478 (make-local-variable 'dired-actual-switches) 488 (make-local-variable 'dired-actual-switches)
479 (setq dired-actual-switches "") 489 (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."
350(defvar log-edit-font-lock-keywords 350(defvar log-edit-font-lock-keywords
351 ;; Copied/inspired by message-font-lock-keywords. 351 ;; Copied/inspired by message-font-lock-keywords.
352 `((log-edit-match-to-eoh 352 `((log-edit-match-to-eoh
353 (,(concat "^\\(\\([a-z]+\\):\\)" log-edit-header-contents-regexp 353 (,(concat "^\\(\\([a-z]+\\):\\)" log-edit-header-contents-regexp)
354 "\\|\\(.*\\)")
355 (progn (goto-char (match-beginning 0)) (match-end 0)) nil 354 (progn (goto-char (match-beginning 0)) (match-end 0)) nil
356 (1 (if (assoc (match-string 2) log-edit-headers-alist) 355 (1 (if (assoc (match-string 2) log-edit-headers-alist)
357 'log-edit-header 356 'log-edit-header
358 'log-edit-unknown-header) 357 'log-edit-unknown-header)
359 nil lax) 358 nil lax)
359 ;; From `log-edit-header-contents-regexp':
360 (3 (or (cdr (assoc (match-string 2) log-edit-headers-alist)) 360 (3 (or (cdr (assoc (match-string 2) log-edit-headers-alist))
361 'log-edit-header) 361 'log-edit-header)
362 nil lax) 362 nil lax)))))
363 (4 font-lock-warning-face)))))
364 363
365;;;###autoload 364;;;###autoload
366(defun log-edit (callback &optional setup params buffer mode &rest ignore) 365(defun log-edit (callback &optional setup params buffer mode &rest ignore)