diff options
| author | Joakim Verona | 2010-09-13 13:51:21 +0200 |
|---|---|---|
| committer | Joakim Verona | 2010-09-13 13:51:21 +0200 |
| commit | 99ed13f812ee29868bd6aff6a96233d423e66cf4 (patch) | |
| tree | 50f1811c5beaa7ff8269ec928ff0320a221d1ab5 /lisp | |
| parent | 8a698bc14a1d2867da4369bec571f6c2efb93c85 (diff) | |
| parent | c5fe4acb5fb456d6e8e147d8bc7981ce56c5c03d (diff) | |
| download | emacs-99ed13f812ee29868bd6aff6a96233d423e66cf4.tar.gz emacs-99ed13f812ee29868bd6aff6a96233d423e66cf4.zip | |
merge from upstream, fix 1 conflict
Diffstat (limited to 'lisp')
76 files changed, 3238 insertions, 2472 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 740d40309a9..f0e59a6c6a6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,6 +1,408 @@ | |||
| 1 | 2010-09-13 Daiki Ueno <ueno@unixuser.org> | ||
| 2 | |||
| 3 | * epa-file.el (epa-file-insert-file-contents): If visiting, bind | ||
| 4 | buffer-file-name to avoid file-locking. (Bug#7026) | ||
| 5 | |||
| 6 | 2010-09-13 Julien Danjou <julien@danjou.info> | ||
| 7 | |||
| 8 | * notifications.el (notifications-notify): Add support for | ||
| 9 | image-path and sound-name. | ||
| 10 | (notifications-specification-version): Add this variable. | ||
| 11 | |||
| 12 | 2010-09-12 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 13 | |||
| 14 | * subr.el (y-or-n-p): New function, moved from src/fns.c. Use read-key. | ||
| 15 | |||
| 16 | 2010-09-12 Leo <sdl.web@gmail.com> | ||
| 17 | |||
| 18 | * net/rcirc.el (rcirc-server-commands, rcirc-client-commands) | ||
| 19 | (rcirc-completion-start): New variables. | ||
| 20 | (rcirc-nick-completions): Rename to rcirc-completions. | ||
| 21 | (rcirc-nick-completion-start-offset): Delete. | ||
| 22 | (rcirc-completion-at-point): New function for constructing | ||
| 23 | completion data for both nicks and irc commands. Add to | ||
| 24 | completion-at-point-functions in rcirc mode. | ||
| 25 | (rcirc-complete): Rename from rcirc-nick-complete; use | ||
| 26 | rcirc-completion-at-point. | ||
| 27 | (defun-rcirc-command): Update rcirc-client-commands. | ||
| 28 | |||
| 29 | 2010-09-11 Glenn Morris <rgm@gnu.org> | ||
| 30 | |||
| 31 | * emacs-lisp/bytecomp.el (byte-compile-file): Create .elc files | ||
| 32 | atomically, to avoid parallel build errors. (Bug#4196) | ||
| 33 | |||
| 34 | 2010-09-11 Michael R. Mauger <mmaug@yahoo.com> | ||
| 35 | |||
| 36 | * progmodes/sql.el: Version 2.6 | ||
| 37 | (sql-dialect): Synonym for "sql-product". | ||
| 38 | (sql-find-sqli-buffer, sql-set-sqli-buffer-generally) | ||
| 39 | (sql-set-sqli-buffer, sql-show-sqli-buffer, sql-interactive-mode): | ||
| 40 | Set "sql-buffer" to buffer name not buffer object so multiple sql | ||
| 41 | interactive buffers work properly. Reverts misguided changes in | ||
| 42 | earlier work. | ||
| 43 | (sql-comint): Make sure different buffer name is used if "*SQL*" | ||
| 44 | buffer is for a different product. | ||
| 45 | (sql-make-alternate-buffer-name): Fix bug with "sql-database" | ||
| 46 | login param. | ||
| 47 | (sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql) | ||
| 48 | (sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase) | ||
| 49 | (sql-db2, sql-linter, sql-product-interactive, sql-rename-buffer): | ||
| 50 | Accept new buffer name or prompt for one. | ||
| 51 | (sql-port): Default to zero. | ||
| 52 | (sql-comint-mysql): Handle "sql-port" as a numeric. | ||
| 53 | (sql-port-history): Delete unused variable. | ||
| 54 | (sql-get-login): Default "sql-port" to a number. | ||
| 55 | (sql-product-alist): Correct Postgres prompt and terminator | ||
| 56 | regexp. | ||
| 57 | (sql-sqlite-program): Dynamically detect presence of "sqlite" or | ||
| 58 | "sqlite3" executables. | ||
| 59 | (sql-sqlite-login-params): Add "*.sqlite[23]?" database name | ||
| 60 | pattern. | ||
| 61 | (sql-buffer-live-p): New function. | ||
| 62 | (sql-mode-menu, sql-send-string): Use it. | ||
| 63 | (sql-mode-oracle-font-lock-keywords): Improve SQL*Plus REMARK | ||
| 64 | syntax pattern. | ||
| 65 | (sql-mode-postgres-font-lock-keywords): Support Postgres V9. | ||
| 66 | (sql-mode-sqlite-font-lock-keywords): Hilight sqlite commands. | ||
| 67 | |||
| 68 | 2010-09-10 Lars Magne Ingebrigtsen <larsi@gnus.org> | ||
| 69 | |||
| 70 | * net/netrc.el (netrc-credentials): New conveniency function. | ||
| 71 | |||
| 72 | 2010-09-10 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 73 | |||
| 74 | * textmodes/texinfo.el (texinfo-syntax-propertize-function): New fun | ||
| 75 | to replace texinfo-font-lock-syntactic-keywords. | ||
| 76 | (texinfo-mode): Use it. | ||
| 77 | |||
| 78 | * textmodes/tex-mode.el (tex-common-initialization, doctex-mode): | ||
| 79 | Use syntax-propertize-function. | ||
| 80 | |||
| 81 | * textmodes/sgml-mode.el (sgml-syntax-propertize-function): New var to | ||
| 82 | replace sgml-font-lock-syntactic-keywords. | ||
| 83 | (sgml-mode): Use it. | ||
| 84 | |||
| 85 | * textmodes/reftex.el (font-lock-syntactic-keywords): Don't declare | ||
| 86 | since we don't use it. | ||
| 87 | |||
| 88 | * textmodes/bibtex.el (bibtex-mode): Use syntax-propertize-function. | ||
| 89 | |||
| 90 | * progmodes/vhdl-mode.el (vhdl-mode): Use syntax-propertize-function | ||
| 91 | if available. | ||
| 92 | (vhdl-fontify-buffer): Adjust. | ||
| 93 | |||
| 94 | * progmodes/tcl.el (tcl-syntax-propertize-function): New var to | ||
| 95 | replace tcl-font-lock-syntactic-keywords. | ||
| 96 | (tcl-mode): Use it. | ||
| 97 | |||
| 98 | * progmodes/simula.el (simula-syntax-propertize-function): New var to | ||
| 99 | replace simula-font-lock-syntactic-keywords. | ||
| 100 | (simula-mode): Use it. | ||
| 101 | |||
| 102 | * progmodes/sh-script.el (sh-st-symbol): Remove. | ||
| 103 | (sh-font-lock-close-heredoc, sh-font-lock-open-heredoc): Add eol arg. | ||
| 104 | (sh-font-lock-flush-syntax-ppss-cache, sh-font-lock-here-doc): Remove. | ||
| 105 | (sh-font-lock-quoted-subshell): Assume we've already matched $(. | ||
| 106 | (sh-font-lock-paren): Set syntax-multiline. | ||
| 107 | (sh-font-lock-syntactic-keywords): Remove. | ||
| 108 | (sh-syntax-propertize-function): New function to replace it. | ||
| 109 | (sh-mode): Use it. | ||
| 110 | |||
| 111 | * progmodes/ruby-mode.el (ruby-here-doc-beg-re): | ||
| 112 | Define while compiling. | ||
| 113 | (ruby-here-doc-end-re, ruby-here-doc-beg-match) | ||
| 114 | (ruby-font-lock-syntactic-keywords, ruby-comment-beg-syntax) | ||
| 115 | (syntax-ppss, ruby-in-ppss-context-p, ruby-in-here-doc-p) | ||
| 116 | (ruby-here-doc-find-end, ruby-here-doc-beg-syntax) | ||
| 117 | (ruby-here-doc-end-syntax): Only define when | ||
| 118 | syntax-propertize is not available. | ||
| 119 | (ruby-syntax-propertize-function, ruby-syntax-propertize-heredoc): | ||
| 120 | New functions. | ||
| 121 | (ruby-in-ppss-context-p): Update to new syntax of heredocs. | ||
| 122 | (electric-indent-chars): Silence bytecompiler. | ||
| 123 | (ruby-mode): Use prog-mode, syntax-propertize-function, and | ||
| 124 | electric-indent-chars. | ||
| 125 | |||
| 126 | * progmodes/python.el (python-syntax-propertize-function): New var to | ||
| 127 | replace python-font-lock-syntactic-keywords. | ||
| 128 | (python-mode): Use it. | ||
| 129 | (python-quote-syntax): Simplify and adjust to new use. | ||
| 130 | |||
| 131 | * progmodes/perl-mode.el (perl-syntax-propertize-function): New fun to | ||
| 132 | replace perl-font-lock-syntactic-keywords. | ||
| 133 | (perl-syntax-propertize-special-constructs): New fun to replace | ||
| 134 | perl-font-lock-special-syntactic-constructs. | ||
| 135 | (perl-font-lock-syntactic-face-function): New fun. | ||
| 136 | (perl-mode): Use it. | ||
| 137 | |||
| 138 | * progmodes/octave-mod.el (octave-syntax-propertize-sqs): New function | ||
| 139 | to replace octave-font-lock-close-quotes. | ||
| 140 | (octave-syntax-propertize-function): New function to replace | ||
| 141 | octave-font-lock-syntactic-keywords. | ||
| 142 | (octave-mode): Use it. | ||
| 143 | |||
| 144 | * progmodes/mixal-mode.el (mixal-syntax-propertize-function): New var; | ||
| 145 | replaces mixal-font-lock-syntactic-keywords. | ||
| 146 | (mixal-mode): Use it. | ||
| 147 | |||
| 148 | * progmodes/make-mode.el (makefile-syntax-propertize-function): | ||
| 149 | New var; replaces makefile-font-lock-syntactic-keywords. | ||
| 150 | (makefile-mode): Use it. | ||
| 151 | (makefile-imake-mode): Adjust. | ||
| 152 | |||
| 153 | * progmodes/js.el (js--regexp-literal): Define while compiling. | ||
| 154 | (js-syntax-propertize-function): New var; replaces | ||
| 155 | js-font-lock-syntactic-keywords. | ||
| 156 | (js-mode): Use it. | ||
| 157 | |||
| 158 | * progmodes/gud.el (gdb-script-syntax-propertize-function): New var; | ||
| 159 | replaces gdb-script-font-lock-syntactic-keywords. | ||
| 160 | (gdb-script-mode): Use it. | ||
| 161 | |||
| 162 | * progmodes/fortran.el (fortran-mode): Use syntax-propertize-function. | ||
| 163 | (fortran--font-lock-syntactic-keywords): New var. | ||
| 164 | (fortran-line-length): Update syntax-propertize-function and | ||
| 165 | fortran--font-lock-syntactic-keywords. | ||
| 166 | |||
| 167 | * progmodes/cperl-mode.el (cperl-mode): Use syntax-propertize-function. | ||
| 168 | |||
| 169 | * progmodes/cfengine.el (cfengine-mode): | ||
| 170 | Use syntax-propertize-function. | ||
| 171 | (cfengine-font-lock-syntactic-keywords): Remove. | ||
| 172 | |||
| 173 | * progmodes/autoconf.el (autoconf-mode): | ||
| 174 | Use syntax-propertize-function. | ||
| 175 | (autoconf-font-lock-syntactic-keywords): Remove. | ||
| 176 | |||
| 177 | * progmodes/ada-mode.el (ada-set-syntax-table-properties) | ||
| 178 | (ada-after-change-function, ada-initialize-syntax-table-properties) | ||
| 179 | (ada-handle-syntax-table-properties): Only define when | ||
| 180 | syntax-propertize is not available. | ||
| 181 | (ada-mode): Use syntax-propertize-function. | ||
| 182 | |||
| 183 | * font-lock.el (font-lock-syntactic-keywords): Make obsolete. | ||
| 184 | (font-lock-fontify-syntactic-keywords-region): Move handling of | ||
| 185 | font-lock-syntactically-fontified to... | ||
| 186 | (font-lock-default-fontify-region): ...here. | ||
| 187 | Let syntax-propertize-function take precedence. | ||
| 188 | (font-lock-fontify-syntactically-region): Cal syntax-propertize. | ||
| 189 | |||
| 190 | * emacs-lisp/syntax.el (syntax-propertize-function) | ||
| 191 | (syntax-propertize-chunk-size, syntax-propertize--done) | ||
| 192 | (syntax-propertize-extend-region-functions): New vars. | ||
| 193 | (syntax-propertize-wholelines, syntax-propertize-multiline) | ||
| 194 | (syntax-propertize--shift-groups, syntax-propertize-via-font-lock) | ||
| 195 | (syntax-propertize): New functions. | ||
| 196 | (syntax-propertize-rules): New macro. | ||
| 197 | (syntax-ppss-flush-cache): Set syntax-propertize--done. | ||
| 198 | (syntax-ppss): Call syntax-propertize. | ||
| 199 | |||
| 200 | * emacs-lisp/regexp-opt.el (regexp-opt-depth): Skip named groups. | ||
| 201 | |||
| 202 | 2010-09-10 AgustÃn MartÃn <agustin.martin@hispalinux.es> | ||
| 203 | |||
| 204 | * textmodes/ispell.el (ispell-init-process): Improve comments. | ||
| 205 | XEmacs compatibility changes regarding (add-hook) 'local option | ||
| 206 | and (set-process-query-on-exit-flag). | ||
| 207 | |||
| 208 | 2010-09-09 Michael Albinus <michael.albinus@gmx.de> | ||
| 209 | |||
| 210 | * net/tramp-cache.el (tramp-parse-connection-properties): | ||
| 211 | Set tramp-autoload cookie. | ||
| 212 | |||
| 213 | 2010-09-09 Glenn Morris <rgm@gnu.org> | ||
| 214 | |||
| 215 | * image.el (imagemagick-types-inhibit): Add :type, :version, :group. | ||
| 216 | (imagemagick-register-types): Doc fix. | ||
| 217 | |||
| 218 | 2010-09-08 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 219 | |||
| 220 | * progmodes/octave-mod.el (electric-indent-chars): Silence bytecomp. | ||
| 221 | |||
| 222 | * progmodes/js.el (require): Require is already "eval-and-compile". | ||
| 223 | (js--re-search-forward): Avoid `eval'. Preserve the error data. | ||
| 224 | (js--re-search-backward): Use js--re-search-forward. | ||
| 225 | |||
| 226 | * progmodes/fortran.el (fortran-line-length): Don't recompute | ||
| 227 | syntactic keywords redundantly a second time. | ||
| 228 | |||
| 229 | * progmodes/ada-mode.el: Replace "(set '" with setq. | ||
| 230 | (ada-mode): Simplify. | ||
| 231 | (ada-create-case-exception, ada-adjust-case-interactive) | ||
| 232 | (ada-adjust-case-region, ada-format-paramlist, ada-indent-current) | ||
| 233 | (ada-search-ignore-string-comment, ada-move-to-start) | ||
| 234 | (ada-move-to-end): Use with-syntax-table. | ||
| 235 | |||
| 236 | * font-lock.el (save-buffer-state): Remove `varlist' arg. | ||
| 237 | (font-lock-unfontify-region, font-lock-default-fontify-region): | ||
| 238 | Update usage correspondingly. | ||
| 239 | (font-lock-fontify-syntactic-keywords-region): | ||
| 240 | Set parse-sexp-lookup-properties buffer-locally here. | ||
| 241 | (font-lock-fontify-syntactically-region): Remove unused `ppss' arg. | ||
| 242 | |||
| 243 | * simple.el (blink-matching-open): Don't burp if we can't find a match. | ||
| 244 | |||
| 245 | 2010-09-08 Glenn Morris <rgm@gnu.org> | ||
| 246 | |||
| 247 | * emacs-lisp/bytecomp.el (byte-compile-report-ops): | ||
| 248 | Error if not compiled with -DBYTE_CODE_METER. | ||
| 249 | |||
| 250 | * emacs-lisp/bytecomp.el (byte-recompile-directory): | ||
| 251 | Ignore dir-locals-file. | ||
| 252 | |||
| 253 | 2010-09-08 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 254 | |||
| 255 | * progmodes/compile.el (compilation-error-regexp-alist-alist): | ||
| 256 | Not a const. | ||
| 257 | (compilation-error-regexp-alist-alist): Rule out ": " in file names | ||
| 258 | for the `gnu' messages. | ||
| 259 | (compilation-set-skip-threshold): New command. | ||
| 260 | (compilation-start): Use \' rather than $. | ||
| 261 | (compilation-forget-errors): Use clrhash. | ||
| 262 | |||
| 263 | 2010-09-08 AgustÃn MartÃn <agustin.martin@hispalinux.es> | ||
| 264 | |||
| 265 | * textmodes/ispell.el (ispell-valid-dictionary-list): | ||
| 266 | Simplify logic. | ||
| 267 | |||
| 268 | 2010-09-08 Michael Albinus <michael.albinus@gmx.de> | ||
| 269 | |||
| 270 | Migrate to Tramp 2.2. Rearrange load dependencies. | ||
| 271 | (Bug#1529, Bug#5448, Bug#5705) | ||
| 272 | |||
| 273 | * Makefile.in (TRAMP_DIR, TRAMP_SRC): New variables. | ||
| 274 | ($(TRAMP_DIR)/tramp-loaddefs.el): New target. | ||
| 275 | (LOADDEFS): Add $(lisp)/net/tramp-loaddefs.el. | ||
| 276 | |||
| 277 | * net/tramp.el (top): Remove all other tramp-* loads except | ||
| 278 | tramp-compat.el. Remove all changes to tramp-unload-hook for | ||
| 279 | other tramp-* packages. Rearrange defun order. Change calls of | ||
| 280 | `tramp-compat-call-process', `tramp-compat-decimal-to-octal', | ||
| 281 | `tramp-compat-octal-to-decimal' to new function names. | ||
| 282 | (tramp-terminal-type, tramp-initial-end-of-output) | ||
| 283 | (tramp-methods, tramp-foreign-file-name-handler-alist) | ||
| 284 | (tramp-tramp-file-p, tramp-completion-mode-p) | ||
| 285 | (tramp-send-command-and-check, tramp-get-remote-path) | ||
| 286 | (tramp-get-remote-tmpdir, tramp-get-remote-ln) | ||
| 287 | (tramp-shell-quote-argument): Set tramp-autoload cookie. | ||
| 288 | (with-file-property, with-connection-property): Move to | ||
| 289 | tramp-cache.el. | ||
| 290 | (tramp-local-call-process, tramp-decimal-to-octal) | ||
| 291 | (tramp-octal-to-decimal): Move to tramp-compat.el. | ||
| 292 | (tramp-handle-shell-command): Do not require 'shell. | ||
| 293 | (tramp-compute-multi-hops): No special handling for tramp-gw-* | ||
| 294 | symbols. | ||
| 295 | (tramp-unload-tramp): Do not call `tramp-unload-file-name-handlers'. | ||
| 296 | |||
| 297 | * net/tramp-cache.el (top): Require 'tramp. Add to | ||
| 298 | `tramp-unload-hook'. | ||
| 299 | (tramp-cache-data, tramp-get-file-property) | ||
| 300 | (tramp-set-file-property, tramp-flush-file-property) | ||
| 301 | (tramp-flush-directory-property, tramp-get-connection-property) | ||
| 302 | (tramp-set-connection-property, tramp-flush-connection-property) | ||
| 303 | (tramp-cache-print, tramp-list-connections): Set tramp-autoload | ||
| 304 | cookie. | ||
| 305 | (with-file-property, with-connection-property): New defuns, moved | ||
| 306 | from tramp.el. | ||
| 307 | (tramp-flush-file-function): Use `with-parsed-tramp-file-name' | ||
| 308 | macro. | ||
| 309 | |||
| 310 | * net/tramp-cmds.el (top): Add to `tramp-unload-hook'. | ||
| 311 | (tramp-version): Set tramp-autoload cookie. | ||
| 312 | |||
| 313 | * net/tramp-compat.el (top): Require 'tramp-loaddefs. Remove all | ||
| 314 | changes to tramp-unload-hook for other tramp-* packages. Add to | ||
| 315 | `tramp-unload-hook'. | ||
| 316 | (tramp-compat-decimal-to-octal, tramp-compat-octal-to-decimal) | ||
| 317 | (tramp-compat-call-process): New defuns, moved from tramp.el. | ||
| 318 | |||
| 319 | * net/tramp-fish.el (top) Require just 'tramp. Add objects to | ||
| 320 | `tramp-methods' and `tramp-foreign-file-name-handler-alist'. Add | ||
| 321 | to `tramp-unload-hook'. Change call of | ||
| 322 | `tramp-compat-decimal-to-octal' to new function name. | ||
| 323 | (tramp-fish-method): Make it a defconst. | ||
| 324 | (tramp-fish-file-name-p): Make it a defsubst. | ||
| 325 | (tramp-fish-method, tramp-fish-file-name-handler) | ||
| 326 | (tramp-fish-file-name-p): Set tramp-autoload cookie. | ||
| 327 | |||
| 328 | * net/tramp-ftp.el (top) Add objects to `tramp-methods' and | ||
| 329 | `tramp-foreign-file-name-handler-alist'. Add to | ||
| 330 | `tramp-unload-hook'. | ||
| 331 | (tramp-ftp-method): Make it a defconst. | ||
| 332 | (tramp-ftp-file-name-p): Make it a defsubst. | ||
| 333 | (tramp-ftp-method, tramp-ftp-file-name-handler) | ||
| 334 | (tramp-ftp-file-name-p): Set tramp-autoload cookie. | ||
| 335 | |||
| 336 | * net/tramp-gvfs.el (top) Add objects to `tramp-methods' and | ||
| 337 | `tramp-foreign-file-name-handler-alist'. Add to | ||
| 338 | `tramp-unload-hook'. Change checks, whether package can be | ||
| 339 | loaded. | ||
| 340 | (tramp-gvfs-file-name-p): Make it a defsubst. | ||
| 341 | (tramp-gvfs-methods, tramp-gvfs-file-name-handler) | ||
| 342 | (tramp-gvfs-file-name-p): Set tramp-autoload cookie. | ||
| 343 | (tramp-gvfs-handle-file-directory-p): New defun. | ||
| 344 | (tramp-gvfs-file-name-handler-alist): Use it. | ||
| 345 | |||
| 346 | * net/tramp-gw.el (top) Add objects to `tramp-methods' and | ||
| 347 | `tramp-foreign-file-name-handler-alist'. Add to | ||
| 348 | `tramp-unload-hook'. | ||
| 349 | (tramp-gw-tunnel-method, tramp-gw-default-tunnel-port) | ||
| 350 | (tramp-gw-socks-method, tramp-gw-default-socks-port): Make it a | ||
| 351 | defconst. | ||
| 352 | (tramp-gw-tunnel-method, tramp-gw-socks-method) | ||
| 353 | (tramp-gw-open-connection): Set tramp-autoload cookie. | ||
| 354 | |||
| 355 | * net/tramp-imap.el (top) Require just 'tramp. Add objects to | ||
| 356 | `tramp-methods' and `tramp-foreign-file-name-handler-alist'. Add | ||
| 357 | to `tramp-unload-hook'. Change checks, whether package can be | ||
| 358 | loaded. | ||
| 359 | (tramp-imap-file-name-p): Make it a defsubst. | ||
| 360 | (tramp-imap-method, tramp-imaps-method) | ||
| 361 | (tramp-imap-file-name-handler) | ||
| 362 | (tramp-imap-file-name-p): Set tramp-autoload cookie. | ||
| 363 | |||
| 364 | * net/tramp-smb.el (top) Require just 'tramp. Add objects to | ||
| 365 | `tramp-methods' and `tramp-foreign-file-name-handler-alist'. Add | ||
| 366 | to `tramp-unload-hook'. Change checks, whether package can be | ||
| 367 | loaded. Change call of `tramp-compat-decimal-to-octal' to new | ||
| 368 | function name. | ||
| 369 | (tramp-smb-tunnel-method): Make it a defconst. | ||
| 370 | (tramp-smb-file-name-p): Make it a defsubst. | ||
| 371 | (tramp-smb-method, tramp-smb-file-name-handler) | ||
| 372 | (tramp-smb-file-name-p): Set tramp-autoload cookie. | ||
| 373 | |||
| 374 | * net/tramp-uu.el (top) Add to `tramp-unload-hook'. | ||
| 375 | (tramp-uuencode-region): Set tramp-autoload cookie. | ||
| 376 | |||
| 377 | * net/trampver.el (top) Add to `tramp-unload-hook'. | ||
| 378 | (tramp-version, tramp-bug-report-address): Set tramp-autoload | ||
| 379 | cookie. Update release number. | ||
| 380 | |||
| 381 | 2010-09-07 AgustÃn MartÃn <agustin.martin@hispalinux.es> | ||
| 382 | |||
| 383 | * textmodes/ispell.el (ispell-start-process): Make sure original | ||
| 384 | arg list is properly initialized (Bug#6993, Bug#6994). | ||
| 385 | |||
| 386 | 2010-09-06 Alexander Klimov <alserkli@inbox.ru> (tiny change) | ||
| 387 | |||
| 388 | * files.el (directory-abbrev-alist): Use \` as default regexp. | ||
| 389 | |||
| 390 | * emacs-lisp/rx.el (rx-any): Don't explode ranges that end in special | ||
| 391 | chars like - or ] (bug#6984). | ||
| 392 | (rx-any-condense-range): Explode 2-char ranges. | ||
| 393 | |||
| 394 | 2010-09-06 Glenn Morris <rgm@gnu.org> | ||
| 395 | |||
| 396 | * desktop.el (desktop-path): Bump :version after 2009-09-15 change. | ||
| 397 | |||
| 398 | 2010-09-06 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 399 | |||
| 400 | * textmodes/bibtex.el: | ||
| 401 | * proced.el: Update to new email for Roland Winkler <winkler@gnu.org>. | ||
| 402 | |||
| 1 | 2010-09-05 Lars Magne Ingebrigtsen <larsi@gnus.org> | 403 | 2010-09-05 Lars Magne Ingebrigtsen <larsi@gnus.org> |
| 2 | 404 | ||
| 3 | * net/imap.el (imap-message-map): Removed optional buffer parameter, | 405 | * net/imap.el (imap-message-map): Remove optional buffer parameter, |
| 4 | since no callers use it. | 406 | since no callers use it. |
| 5 | (imap-message-get): Ditto. | 407 | (imap-message-get): Ditto. |
| 6 | (imap-message-put): Ditto. | 408 | (imap-message-put): Ditto. |
| @@ -11,11 +413,11 @@ | |||
| 11 | 413 | ||
| 12 | 2010-09-05 Lars Magne Ingebrigtsen <larsi@gnus.org> | 414 | 2010-09-05 Lars Magne Ingebrigtsen <larsi@gnus.org> |
| 13 | 415 | ||
| 14 | * net/imap.el (imap-fetch-safe): Removed function, and altered all | 416 | * net/imap.el (imap-fetch-safe): Remove function, and alter all |
| 15 | callers to use `imap-fetch' instead. According to the comments, this | 417 | callers to use `imap-fetch' instead. According to the comments, this |
| 16 | should be safe, since all other IMAP clients use the 1:* syntax. | 418 | should be safe, since all other IMAP clients use the 1:* syntax. |
| 17 | (imap-enable-exchange-bug-workaround): Removed. | 419 | (imap-enable-exchange-bug-workaround): Remove. |
| 18 | (imap-debug): Removed -- doesn't seem very useful. | 420 | (imap-debug): Remove -- doesn't seem very useful. |
| 19 | 421 | ||
| 20 | 2010-09-05 Lars Magne Ingebrigtsen <larsi@gnus.org> | 422 | 2010-09-05 Lars Magne Ingebrigtsen <larsi@gnus.org> |
| 21 | 423 | ||
diff --git a/lisp/Makefile.in b/lisp/Makefile.in index 8d681b4f673..918ce0ecc64 100644 --- a/lisp/Makefile.in +++ b/lisp/Makefile.in | |||
| @@ -56,7 +56,8 @@ ETAGS = ../lib-src/etags | |||
| 56 | LOADDEFS = $(lisp)/calendar/cal-loaddefs.el \ | 56 | LOADDEFS = $(lisp)/calendar/cal-loaddefs.el \ |
| 57 | $(lisp)/calendar/diary-loaddefs.el \ | 57 | $(lisp)/calendar/diary-loaddefs.el \ |
| 58 | $(lisp)/calendar/hol-loaddefs.el \ | 58 | $(lisp)/calendar/hol-loaddefs.el \ |
| 59 | $(lisp)/mh-e/mh-loaddefs.el | 59 | $(lisp)/mh-e/mh-loaddefs.el \ |
| 60 | $(lisp)/net/tramp-loaddefs.el | ||
| 60 | 61 | ||
| 61 | # Elisp files auto-generated. | 62 | # Elisp files auto-generated. |
| 62 | AUTOGENEL = loaddefs.el \ | 63 | AUTOGENEL = loaddefs.el \ |
| @@ -329,6 +330,24 @@ $(MH_E_DIR)/mh-loaddefs.el: $(MH_E_SRC) | |||
| 329 | --eval "(setq make-backup-files nil)" \ | 330 | --eval "(setq make-backup-files nil)" \ |
| 330 | -f batch-update-autoloads $(MH_E_DIR) | 331 | -f batch-update-autoloads $(MH_E_DIR) |
| 331 | 332 | ||
| 333 | # Update TRAMP internal autoloads. Maybe we could move trmp*.el into | ||
| 334 | # an own subdirectory. OTOH, it does not hurt to keep them in | ||
| 335 | # lisp/net. | ||
| 336 | TRAMP_DIR = $(lisp)/net | ||
| 337 | TRAMP_SRC = $(TRAMP_DIR)/tramp.el $(TRAMP_DIR)/tramp-cache.el \ | ||
| 338 | $(TRAMP_DIR)/tramp-cmds.el $(TRAMP_DIR)/tramp-compat.el \ | ||
| 339 | $(TRAMP_DIR)/tramp-fish.el $(TRAMP_DIR)/tramp-ftp.el \ | ||
| 340 | $(TRAMP_DIR)/tramp-gvfs.el $(TRAMP_DIR)/tramp-gw.el \ | ||
| 341 | $(TRAMP_DIR)/tramp-imap.el $(TRAMP_DIR)/tramp-smb.el \ | ||
| 342 | $(TRAMP_DIR)/tramp-uu.el $(TRAMP_DIR)/trampver.el | ||
| 343 | |||
| 344 | $(TRAMP_DIR)/tramp-loaddefs.el: $(TRAMP_SRC) | ||
| 345 | $(emacs) -l autoload \ | ||
| 346 | --eval "(setq generate-autoload-cookie \";;;###tramp-autoload\")" \ | ||
| 347 | --eval "(setq generated-autoload-file \"$@\")" \ | ||
| 348 | --eval "(setq make-backup-files nil)" \ | ||
| 349 | -f batch-update-autoloads $(TRAMP_DIR) | ||
| 350 | |||
| 332 | CAL_DIR = $(lisp)/calendar | 351 | CAL_DIR = $(lisp)/calendar |
| 333 | ## Those files that may contain internal calendar autoload cookies. | 352 | ## Those files that may contain internal calendar autoload cookies. |
| 334 | ## Avoids circular dependency warning for *-loaddefs.el. | 353 | ## Avoids circular dependency warning for *-loaddefs.el. |
diff --git a/lisp/ansi-color.el b/lisp/ansi-color.el index 00162c99219..6bc95fa8d94 100644 --- a/lisp/ansi-color.el +++ b/lisp/ansi-color.el | |||
| @@ -244,9 +244,9 @@ A possible way to install this would be: | |||
| 244 | (when (boundp 'font-lock-syntactic-keywords) | 244 | (when (boundp 'font-lock-syntactic-keywords) |
| 245 | (remove-text-properties beg end '(syntax-table nil))) | 245 | (remove-text-properties beg end '(syntax-table nil))) |
| 246 | ;; instead of just using (remove-text-properties beg end '(face | 246 | ;; instead of just using (remove-text-properties beg end '(face |
| 247 | ;; nil)), we find regions with a non-nil face test-property, skip | 247 | ;; nil)), we find regions with a non-nil face text-property, skip |
| 248 | ;; positions with the ansi-color property set, and remove the | 248 | ;; positions with the ansi-color property set, and remove the |
| 249 | ;; remaining face test-properties. | 249 | ;; remaining face text-properties. |
| 250 | (while (setq beg (text-property-not-all beg end 'face nil)) | 250 | (while (setq beg (text-property-not-all beg end 'face nil)) |
| 251 | (setq beg (or (text-property-not-all beg end 'ansi-color t) end)) | 251 | (setq beg (or (text-property-not-all beg end 'ansi-color t) end)) |
| 252 | (when (get-text-property beg 'face) | 252 | (when (get-text-property beg 'face) |
diff --git a/lisp/desktop.el b/lisp/desktop.el index 8f0b8075cdf..b4d3dfd55c8 100644 --- a/lisp/desktop.el +++ b/lisp/desktop.el | |||
| @@ -226,7 +226,7 @@ the normal hook `desktop-not-loaded-hook' is run." | |||
| 226 | The base name of the file is specified in `desktop-base-file-name'." | 226 | The base name of the file is specified in `desktop-base-file-name'." |
| 227 | :type '(repeat directory) | 227 | :type '(repeat directory) |
| 228 | :group 'desktop | 228 | :group 'desktop |
| 229 | :version "22.1") | 229 | :version "23.2") ; user-emacs-directory added |
| 230 | 230 | ||
| 231 | (defcustom desktop-missing-file-warning nil | 231 | (defcustom desktop-missing-file-warning nil |
| 232 | "If non-nil, offer to recreate the buffer of a deleted file. | 232 | "If non-nil, offer to recreate the buffer of a deleted file. |
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index c42292a2787..8b47e0421e0 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el | |||
| @@ -1,7 +1,8 @@ | |||
| 1 | ;;; bytecomp.el --- compilation of Lisp code into byte code | 1 | ;;; bytecomp.el --- compilation of Lisp code into byte code |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1985, 1986, 1987, 1992, 1994, 1998, 2000, 2001, 2002, | 3 | ;; Copyright (C) 1985, 1986, 1987, 1992, 1994, 1998, 2000, 2001, 2002, |
| 4 | ;; 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. | 4 | ;; 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 |
| 5 | ;; Free Software Foundation, Inc. | ||
| 5 | 6 | ||
| 6 | ;; Author: Jamie Zawinski <jwz@lucid.com> | 7 | ;; Author: Jamie Zawinski <jwz@lucid.com> |
| 7 | ;; Hallvard Furuseth <hbf@ulrik.uio.no> | 8 | ;; Hallvard Furuseth <hbf@ulrik.uio.no> |
| @@ -1548,6 +1549,9 @@ that already has a `.elc' file." | |||
| 1548 | (if (and (string-match emacs-lisp-file-regexp bytecomp-source) | 1549 | (if (and (string-match emacs-lisp-file-regexp bytecomp-source) |
| 1549 | (file-readable-p bytecomp-source) | 1550 | (file-readable-p bytecomp-source) |
| 1550 | (not (auto-save-file-name-p bytecomp-source)) | 1551 | (not (auto-save-file-name-p bytecomp-source)) |
| 1552 | (not (string-equal dir-locals-file | ||
| 1553 | (file-name-nondirectory | ||
| 1554 | bytecomp-source))) | ||
| 1551 | (setq bytecomp-dest | 1555 | (setq bytecomp-dest |
| 1552 | (byte-compile-dest-file bytecomp-source)) | 1556 | (byte-compile-dest-file bytecomp-source)) |
| 1553 | (if (file-exists-p bytecomp-dest) | 1557 | (if (file-exists-p bytecomp-dest) |
| @@ -1694,17 +1698,25 @@ The value is non-nil if there were no errors, nil if errors." | |||
| 1694 | (insert "\n") ; aaah, unix. | 1698 | (insert "\n") ; aaah, unix. |
| 1695 | (if (file-writable-p target-file) | 1699 | (if (file-writable-p target-file) |
| 1696 | ;; We must disable any code conversion here. | 1700 | ;; We must disable any code conversion here. |
| 1697 | (let ((coding-system-for-write 'no-conversion)) | 1701 | (let ((coding-system-for-write 'no-conversion) |
| 1702 | ;; Write to a tempfile so that if another Emacs | ||
| 1703 | ;; process is trying to load target-file (eg in a | ||
| 1704 | ;; parallel bootstrap), it does not risk getting a | ||
| 1705 | ;; half-finished file. (Bug#4196) | ||
| 1706 | (tempfile (make-temp-name target-file))) | ||
| 1698 | (if (memq system-type '(ms-dos 'windows-nt)) | 1707 | (if (memq system-type '(ms-dos 'windows-nt)) |
| 1699 | (setq buffer-file-type t)) | 1708 | (setq buffer-file-type t)) |
| 1700 | (when (file-exists-p target-file) | 1709 | (write-region (point-min) (point-max) tempfile nil 1) |
| 1701 | ;; Remove the target before writing it, so that any | 1710 | ;; This has the intentional side effect that any |
| 1702 | ;; hard-links continue to point to the old file (this makes | 1711 | ;; hard-links to target-file continue to |
| 1703 | ;; it possible for installed files to share disk space with | 1712 | ;; point to the old file (this makes it possible |
| 1704 | ;; the build tree, without causing problems when emacs-lisp | 1713 | ;; for installed files to share disk space with |
| 1705 | ;; files in the build tree are recompiled). | 1714 | ;; the build tree, without causing problems when |
| 1706 | (delete-file target-file)) | 1715 | ;; emacs-lisp files in the build tree are |
| 1707 | (write-region (point-min) (point-max) target-file)) | 1716 | ;; recompiled). Previously this was accomplished by |
| 1717 | ;; deleting target-file before writing it. | ||
| 1718 | (rename-file tempfile target-file t) | ||
| 1719 | (message "Wrote %s" target-file)) | ||
| 1708 | ;; This is just to give a better error message than write-region | 1720 | ;; This is just to give a better error message than write-region |
| 1709 | (signal 'file-error | 1721 | (signal 'file-error |
| 1710 | (list "Opening output file" | 1722 | (list "Opening output file" |
| @@ -4240,6 +4252,8 @@ and corresponding effects." | |||
| 4240 | 4252 | ||
| 4241 | (defvar byte-code-meter) | 4253 | (defvar byte-code-meter) |
| 4242 | (defun byte-compile-report-ops () | 4254 | (defun byte-compile-report-ops () |
| 4255 | (or (boundp 'byte-metering-on) | ||
| 4256 | (error "You must build Emacs with -DBYTE_CODE_METER to use this")) | ||
| 4243 | (with-output-to-temp-buffer "*Meter*" | 4257 | (with-output-to-temp-buffer "*Meter*" |
| 4244 | (set-buffer "*Meter*") | 4258 | (set-buffer "*Meter*") |
| 4245 | (let ((i 0) n op off) | 4259 | (let ((i 0) n op off) |
diff --git a/lisp/emacs-lisp/regexp-opt.el b/lisp/emacs-lisp/regexp-opt.el index 78eba19a253..a1494741572 100644 --- a/lisp/emacs-lisp/regexp-opt.el +++ b/lisp/emacs-lisp/regexp-opt.el | |||
| @@ -120,7 +120,7 @@ This means the number of non-shy regexp grouping constructs | |||
| 120 | (string-match regexp "") | 120 | (string-match regexp "") |
| 121 | ;; Count the number of open parentheses in REGEXP. | 121 | ;; Count the number of open parentheses in REGEXP. |
| 122 | (let ((count 0) start last) | 122 | (let ((count 0) start last) |
| 123 | (while (string-match "\\\\(\\(\\?:\\)?" regexp start) | 123 | (while (string-match "\\\\(\\(\\?[0-9]*:\\)?" regexp start) |
| 124 | (setq start (match-end 0)) ; Start of next search. | 124 | (setq start (match-end 0)) ; Start of next search. |
| 125 | (when (and (not (match-beginning 1)) | 125 | (when (and (not (match-beginning 1)) |
| 126 | (subregexp-context-p regexp (match-beginning 0) last)) | 126 | (subregexp-context-p regexp (match-beginning 0) last)) |
diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el index 85fe3514b01..522d452c2dc 100644 --- a/lisp/emacs-lisp/rx.el +++ b/lisp/emacs-lisp/rx.el | |||
| @@ -427,7 +427,7 @@ Only both edges of each range is checked." | |||
| 427 | (mapcar (lambda (e) | 427 | (mapcar (lambda (e) |
| 428 | (cond | 428 | (cond |
| 429 | ((= (car e) (cdr e)) (list (car e))) | 429 | ((= (car e) (cdr e)) (list (car e))) |
| 430 | ;; ((= (1+ (car e)) (cdr e)) (list (car e) (cdr e))) | 430 | ((= (1+ (car e)) (cdr e)) (list (car e) (cdr e))) |
| 431 | ((list e)))) | 431 | ((list e)))) |
| 432 | l)) | 432 | l)) |
| 433 | (delete-dups str)))) | 433 | (delete-dups str)))) |
| @@ -545,7 +545,10 @@ ARG is optional." | |||
| 545 | ((numberp e) (string e)) | 545 | ((numberp e) (string e)) |
| 546 | ((consp e) | 546 | ((consp e) |
| 547 | (if (and (= (1+ (car e)) (cdr e)) | 547 | (if (and (= (1+ (car e)) (cdr e)) |
| 548 | (null (memq (car e) '(?\] ?-)))) | 548 | ;; rx-any-condense-range should |
| 549 | ;; prevent this case from happening. | ||
| 550 | (null (memq (car e) '(?\] ?-))) | ||
| 551 | (null (memq (cdr e) '(?\] ?-)))) | ||
| 549 | (string (car e) (cdr e)) | 552 | (string (car e) (cdr e)) |
| 550 | (string (car e) ?- (cdr e)))) | 553 | (string (car e) ?- (cdr e)))) |
| 551 | (e))) | 554 | (e))) |
diff --git a/lisp/emacs-lisp/syntax.el b/lisp/emacs-lisp/syntax.el index 1ac6e266f0f..ad0166e7af0 100644 --- a/lisp/emacs-lisp/syntax.el +++ b/lisp/emacs-lisp/syntax.el | |||
| @@ -34,7 +34,6 @@ | |||
| 34 | 34 | ||
| 35 | ;; - do something about the case where the syntax-table is changed. | 35 | ;; - do something about the case where the syntax-table is changed. |
| 36 | ;; This typically happens with tex-mode and its `$' operator. | 36 | ;; This typically happens with tex-mode and its `$' operator. |
| 37 | ;; - move font-lock-syntactic-keywords in here. Then again, maybe not. | ||
| 38 | ;; - new functions `syntax-state', ... to replace uses of parse-partial-state | 37 | ;; - new functions `syntax-state', ... to replace uses of parse-partial-state |
| 39 | ;; with something higher-level (similar to syntax-ppss-context). | 38 | ;; with something higher-level (similar to syntax-ppss-context). |
| 40 | ;; - interaction with mmm-mode. | 39 | ;; - interaction with mmm-mode. |
| @@ -47,6 +46,249 @@ | |||
| 47 | 46 | ||
| 48 | (defvar font-lock-beginning-of-syntax-function) | 47 | (defvar font-lock-beginning-of-syntax-function) |
| 49 | 48 | ||
| 49 | ;;; Applying syntax-table properties where needed. | ||
| 50 | |||
| 51 | (defvar syntax-propertize-function nil | ||
| 52 | ;; Rather than a -functions hook, this is a -function because it's easier | ||
| 53 | ;; to do a single scan than several scans: with multiple scans, one cannot | ||
| 54 | ;; assume that the text before point has been propertized, so syntax-ppss | ||
| 55 | ;; gives unreliable results (and stores them in its cache to boot, so we'd | ||
| 56 | ;; have to flush that cache between each function, and we couldn't use | ||
| 57 | ;; syntax-ppss-flush-cache since that would not only flush the cache but also | ||
| 58 | ;; reset syntax-propertize--done which should not be done in this case). | ||
| 59 | "Mode-specific function to apply the syntax-table properties. | ||
| 60 | Called with 2 arguments: START and END.") | ||
| 61 | |||
| 62 | (defvar syntax-propertize-chunk-size 500) | ||
| 63 | |||
| 64 | (defvar syntax-propertize-extend-region-functions | ||
| 65 | '(syntax-propertize-wholelines) | ||
| 66 | "Special hook run just before proceeding to propertize a region. | ||
| 67 | This is used to allow major modes to help `syntax-propertize' find safe buffer | ||
| 68 | positions as beginning and end of the propertized region. Its most common use | ||
| 69 | is to solve the problem of /identification/ of multiline elements by providing | ||
| 70 | a function that tries to find such elements and move the boundaries such that | ||
| 71 | they do not fall in the middle of one. | ||
| 72 | Each function is called with two arguments (START and END) and it should return | ||
| 73 | either a cons (NEW-START . NEW-END) or nil if no adjustment should be made. | ||
| 74 | These functions are run in turn repeatedly until they all return nil. | ||
| 75 | Put first the functions more likely to cause a change and cheaper to compute.") | ||
| 76 | ;; Mark it as a special hook which doesn't use any global setting | ||
| 77 | ;; (i.e. doesn't obey the element t in the buffer-local value). | ||
| 78 | (make-variable-buffer-local 'syntax-propertize-extend-region-functions) | ||
| 79 | |||
| 80 | (defun syntax-propertize-wholelines (start end) | ||
| 81 | (goto-char start) | ||
| 82 | (cons (line-beginning-position) | ||
| 83 | (progn (goto-char end) | ||
| 84 | (if (bolp) (point) (line-beginning-position 2))))) | ||
| 85 | |||
| 86 | (defun syntax-propertize-multiline (beg end) | ||
| 87 | "Let `syntax-propertize' pay attention to the syntax-multiline property." | ||
| 88 | (when (and (> beg (point-min)) | ||
| 89 | (get-text-property (1- beg) 'syntax-multiline)) | ||
| 90 | (setq beg (or (previous-single-property-change beg 'syntax-multiline) | ||
| 91 | (point-min)))) | ||
| 92 | ;; | ||
| 93 | (when (get-text-property end 'font-lock-multiline) | ||
| 94 | (setq end (or (text-property-any end (point-max) | ||
| 95 | 'syntax-multiline nil) | ||
| 96 | (point-max)))) | ||
| 97 | (cons beg end)) | ||
| 98 | |||
| 99 | (defvar syntax-propertize--done -1 | ||
| 100 | "Position upto which syntax-table properties have been set.") | ||
| 101 | (make-variable-buffer-local 'syntax-propertize--done) | ||
| 102 | |||
| 103 | (defun syntax-propertize--shift-groups (re n) | ||
| 104 | (replace-regexp-in-string | ||
| 105 | "\\\\(\\?\\([0-9]+\\):" | ||
| 106 | (lambda (s) | ||
| 107 | (replace-match | ||
| 108 | (number-to-string (+ n (string-to-number (match-string 1 s)))) | ||
| 109 | t t s 1)) | ||
| 110 | re t t)) | ||
| 111 | |||
| 112 | (defmacro syntax-propertize-rules (&rest rules) | ||
| 113 | "Make a function that applies RULES for use in `syntax-propertize-function'. | ||
| 114 | The function will scan the buffer, applying the rules where they match. | ||
| 115 | The buffer is scanned a single time, like \"lex\" would, rather than once | ||
| 116 | per rule. | ||
| 117 | |||
| 118 | Each rule has the form (REGEXP HIGHLIGHT1 ... HIGHLIGHTn), where REGEXP | ||
| 119 | is an expression (evaluated at time of macro-expansion) that returns a regexp, | ||
| 120 | and where HIGHLIGHTs have the form (NUMBER SYNTAX) which means to | ||
| 121 | apply the property SYNTAX to the chars matched by the subgroup NUMBER | ||
| 122 | of the regular expression, if NUMBER did match. | ||
| 123 | SYNTAX is an expression that returns a value to apply as `syntax-table' | ||
| 124 | property. Some expressions are handled specially: | ||
| 125 | - if SYNTAX is a string, then it is converted with `string-to-syntax'; | ||
| 126 | - if SYNTAX has the form (prog1 EXP . EXPS) then the value returned by EXP | ||
| 127 | will be applied to the buffer before running EXPS and if EXP is a string it | ||
| 128 | is also converted with `string-to-syntax'. | ||
| 129 | The SYNTAX expression is responsible to save the `match-data' if needed | ||
| 130 | for subsequent HIGHLIGHTs. | ||
| 131 | Also SYNTAX is free to move point, in which case RULES may not be applied to | ||
| 132 | some parts of the text or may be applied several times to other parts. | ||
| 133 | |||
| 134 | Note: back-references in REGEXPs do not work." | ||
| 135 | (declare (debug (&rest (form &rest | ||
| 136 | (numberp | ||
| 137 | [&or stringp | ||
| 138 | ("prog1" [&or stringp def-form] def-body) | ||
| 139 | def-form]))))) | ||
| 140 | (let* ((offset 0) | ||
| 141 | (branches '()) | ||
| 142 | ;; We'd like to use a real DFA-based lexer, usually, but since Emacs | ||
| 143 | ;; doesn't have one yet, we fallback on building one large regexp | ||
| 144 | ;; and use groups to determine which branch of the regexp matched. | ||
| 145 | (re | ||
| 146 | (mapconcat | ||
| 147 | (lambda (rule) | ||
| 148 | (let ((re (eval (car rule)))) | ||
| 149 | (when (and (assq 0 rule) (cdr rules)) | ||
| 150 | ;; If there's more than 1 rule, and the rule want to apply | ||
| 151 | ;; highlight to match 0, create an extra group to be able to | ||
| 152 | ;; tell when *this* match 0 has succeeded. | ||
| 153 | (incf offset) | ||
| 154 | (setq re (concat "\\(" re "\\)"))) | ||
| 155 | (setq re (syntax-propertize--shift-groups re offset)) | ||
| 156 | (let ((code '()) | ||
| 157 | (condition | ||
| 158 | (cond | ||
| 159 | ((assq 0 rule) (if (zerop offset) t | ||
| 160 | `(match-beginning ,offset))) | ||
| 161 | ((null (cddr rule)) | ||
| 162 | `(match-beginning ,(+ offset (car (cadr rule))))) | ||
| 163 | (t | ||
| 164 | `(or ,@(mapcar | ||
| 165 | (lambda (case) | ||
| 166 | `(match-beginning ,(+ offset (car case)))) | ||
| 167 | (cdr rule)))))) | ||
| 168 | (nocode t) | ||
| 169 | (offset offset)) | ||
| 170 | ;; If some of the subgroup rules include Elisp code, then we | ||
| 171 | ;; need to set the match-data so it's consistent with what the | ||
| 172 | ;; code expects. If not, then we can simply use shifted | ||
| 173 | ;; offset in our own code. | ||
| 174 | (unless (zerop offset) | ||
| 175 | (dolist (case (cdr rule)) | ||
| 176 | (unless (stringp (cadr case)) | ||
| 177 | (setq nocode nil))) | ||
| 178 | (unless nocode | ||
| 179 | (push `(let ((md (match-data 'ints))) | ||
| 180 | ;; Keep match 0 as is, but shift everything else. | ||
| 181 | (setcdr (cdr md) (nthcdr ,(* (1+ offset) 2) md)) | ||
| 182 | (set-match-data md)) | ||
| 183 | code) | ||
| 184 | (setq offset 0))) | ||
| 185 | ;; Now construct the code for each subgroup rules. | ||
| 186 | (dolist (case (cdr rule)) | ||
| 187 | (assert (null (cddr case))) | ||
| 188 | (let* ((gn (+ offset (car case))) | ||
| 189 | (action (nth 1 case)) | ||
| 190 | (thiscode | ||
| 191 | (cond | ||
| 192 | ((stringp action) | ||
| 193 | `((put-text-property | ||
| 194 | (match-beginning ,gn) (match-end ,gn) | ||
| 195 | 'syntax-table | ||
| 196 | ',(string-to-syntax action)))) | ||
| 197 | ((eq (car-safe action) 'ignore) | ||
| 198 | (cdr action)) | ||
| 199 | ((eq (car-safe action) 'prog1) | ||
| 200 | (if (stringp (nth 1 action)) | ||
| 201 | `((put-text-property | ||
| 202 | (match-beginning ,gn) (match-end ,gn) | ||
| 203 | 'syntax-table | ||
| 204 | ',(string-to-syntax (nth 1 action))) | ||
| 205 | ,@(nthcdr 2 action)) | ||
| 206 | `((let ((mb (match-beginning ,gn)) | ||
| 207 | (me (match-end ,gn)) | ||
| 208 | (syntax ,(nth 1 action))) | ||
| 209 | (if syntax | ||
| 210 | (put-text-property | ||
| 211 | mb me 'syntax-table syntax)) | ||
| 212 | ,@(nthcdr 2 action))))) | ||
| 213 | (t | ||
| 214 | `((let ((mb (match-beginning ,gn)) | ||
| 215 | (me (match-end ,gn)) | ||
| 216 | (syntax ,action)) | ||
| 217 | (if syntax | ||
| 218 | (put-text-property | ||
| 219 | mb me 'syntax-table syntax)))))))) | ||
| 220 | |||
| 221 | (if (or (not (cddr rule)) (zerop gn)) | ||
| 222 | (setq code (nconc (nreverse thiscode) code)) | ||
| 223 | (push `(if (match-beginning ,gn) | ||
| 224 | ;; Try and generate clean code with no | ||
| 225 | ;; extraneous progn. | ||
| 226 | ,(if (null (cdr thiscode)) | ||
| 227 | (car thiscode) | ||
| 228 | `(progn ,@thiscode))) | ||
| 229 | code)))) | ||
| 230 | (push (cons condition (nreverse code)) | ||
| 231 | branches)) | ||
| 232 | (incf offset (regexp-opt-depth re)) | ||
| 233 | re)) | ||
| 234 | rules | ||
| 235 | "\\|"))) | ||
| 236 | `(lambda (start end) | ||
| 237 | (goto-char start) | ||
| 238 | (while (and (< (point) end) | ||
| 239 | (re-search-forward ,re end t)) | ||
| 240 | (cond ,@(nreverse branches)))))) | ||
| 241 | |||
| 242 | (defun syntax-propertize-via-font-lock (keywords) | ||
| 243 | "Propertize for syntax in START..END using font-lock syntax. | ||
| 244 | KEYWORDS obeys the format used in `font-lock-syntactic-keywords'. | ||
| 245 | The return value is a function suitable for `syntax-propertize-function'." | ||
| 246 | (lexical-let ((keywords keywords)) | ||
| 247 | (lambda (start end) | ||
| 248 | (with-no-warnings | ||
| 249 | (let ((font-lock-syntactic-keywords keywords)) | ||
| 250 | (font-lock-fontify-syntactic-keywords-region start end) | ||
| 251 | ;; In case it was eval'd/compiled. | ||
| 252 | (setq keywords font-lock-syntactic-keywords)))))) | ||
| 253 | |||
| 254 | (defun syntax-propertize (pos) | ||
| 255 | "Ensure that syntax-table properties are set upto POS." | ||
| 256 | (when (and syntax-propertize-function | ||
| 257 | (< syntax-propertize--done pos)) | ||
| 258 | ;; (message "Needs to syntax-propertize from %s to %s" | ||
| 259 | ;; syntax-propertize--done pos) | ||
| 260 | (set (make-local-variable 'parse-sexp-lookup-properties) t) | ||
| 261 | (save-excursion | ||
| 262 | (with-silent-modifications | ||
| 263 | (let* ((start (max syntax-propertize--done (point-min))) | ||
| 264 | (end (max pos | ||
| 265 | (min (point-max) | ||
| 266 | (+ start syntax-propertize-chunk-size)))) | ||
| 267 | (funs syntax-propertize-extend-region-functions)) | ||
| 268 | (while funs | ||
| 269 | (let ((new (funcall (pop funs) start end))) | ||
| 270 | (if (or (null new) | ||
| 271 | (and (>= (car new) start) (<= (cdr new) end))) | ||
| 272 | nil | ||
| 273 | (setq start (car new)) | ||
| 274 | (setq end (cdr new)) | ||
| 275 | ;; If there's been a change, we should go through the | ||
| 276 | ;; list again since this new position may | ||
| 277 | ;; warrant a different answer from one of the funs we've | ||
| 278 | ;; already seen. | ||
| 279 | (unless (eq funs | ||
| 280 | (cdr syntax-propertize-extend-region-functions)) | ||
| 281 | (setq funs syntax-propertize-extend-region-functions))))) | ||
| 282 | ;; Move the limit before calling the function, so the function | ||
| 283 | ;; can use syntax-ppss. | ||
| 284 | (setq syntax-propertize--done end) | ||
| 285 | ;; (message "syntax-propertizing from %s to %s" start end) | ||
| 286 | (remove-text-properties start end | ||
| 287 | '(syntax-table nil syntax-multiline nil)) | ||
| 288 | (funcall syntax-propertize-function start end)))))) | ||
| 289 | |||
| 290 | ;;; Incrementally compute and memoize parser state. | ||
| 291 | |||
| 50 | (defsubst syntax-ppss-depth (ppss) | 292 | (defsubst syntax-ppss-depth (ppss) |
| 51 | (nth 0 ppss)) | 293 | (nth 0 ppss)) |
| 52 | 294 | ||
| @@ -92,6 +334,8 @@ point (where the PPSS is equivalent to nil).") | |||
| 92 | (defalias 'syntax-ppss-after-change-function 'syntax-ppss-flush-cache) | 334 | (defalias 'syntax-ppss-after-change-function 'syntax-ppss-flush-cache) |
| 93 | (defun syntax-ppss-flush-cache (beg &rest ignored) | 335 | (defun syntax-ppss-flush-cache (beg &rest ignored) |
| 94 | "Flush the cache of `syntax-ppss' starting at position BEG." | 336 | "Flush the cache of `syntax-ppss' starting at position BEG." |
| 337 | ;; Set syntax-propertize to refontify anything past beg. | ||
| 338 | (setq syntax-propertize--done (min beg syntax-propertize--done)) | ||
| 95 | ;; Flush invalid cache entries. | 339 | ;; Flush invalid cache entries. |
| 96 | (while (and syntax-ppss-cache (> (caar syntax-ppss-cache) beg)) | 340 | (while (and syntax-ppss-cache (> (caar syntax-ppss-cache) beg)) |
| 97 | (setq syntax-ppss-cache (cdr syntax-ppss-cache))) | 341 | (setq syntax-ppss-cache (cdr syntax-ppss-cache))) |
| @@ -128,6 +372,7 @@ the 2nd and 6th values of the returned state cannot be relied upon. | |||
| 128 | Point is at POS when this function returns." | 372 | Point is at POS when this function returns." |
| 129 | ;; Default values. | 373 | ;; Default values. |
| 130 | (unless pos (setq pos (point))) | 374 | (unless pos (setq pos (point))) |
| 375 | (syntax-propertize pos) | ||
| 131 | ;; | 376 | ;; |
| 132 | (let ((old-ppss (cdr syntax-ppss-last)) | 377 | (let ((old-ppss (cdr syntax-ppss-last)) |
| 133 | (old-pos (car syntax-ppss-last)) | 378 | (old-pos (car syntax-ppss-last)) |
diff --git a/lisp/epa-file.el b/lisp/epa-file.el index 24480ce3c76..3c6cf07ea1b 100644 --- a/lisp/epa-file.el +++ b/lisp/epa-file.el | |||
| @@ -158,12 +158,17 @@ way." | |||
| 158 | (if (or beg end) | 158 | (if (or beg end) |
| 159 | (setq string (substring string (or beg 0) end))) | 159 | (setq string (substring string (or beg 0) end))) |
| 160 | (save-excursion | 160 | (save-excursion |
| 161 | (save-restriction | 161 | ;; If visiting, bind off buffer-file-name so that |
| 162 | (narrow-to-region (point) (point)) | 162 | ;; file-locking will not ask whether we should |
| 163 | (epa-file-decode-and-insert string file visit beg end replace) | 163 | ;; really edit the buffer. |
| 164 | (setq length (- (point-max) (point-min)))) | 164 | (let ((buffer-file-name |
| 165 | (if replace | 165 | (if visit nil buffer-file-name))) |
| 166 | (delete-region (point) (point-max))) | 166 | (save-restriction |
| 167 | (narrow-to-region (point) (point)) | ||
| 168 | (epa-file-decode-and-insert string file visit beg end replace) | ||
| 169 | (setq length (- (point-max) (point-min)))) | ||
| 170 | (if replace | ||
| 171 | (delete-region (point) (point-max)))) | ||
| 167 | (if visit | 172 | (if visit |
| 168 | (set-visited-file-modtime)))) | 173 | (set-visited-file-modtime)))) |
| 169 | (if (and local-copy | 174 | (if (and local-copy |
diff --git a/lisp/files.el b/lisp/files.el index 41bd9bd9c25..ef74b54ca60 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -1,3 +1,18 @@ | |||
| 1 | ;; (defun auto-save-mode (arg) | ||
| 2 | ;; "Toggle auto-saving of contents of current buffer. | ||
| 3 | ;; With prefix argument ARG, turn auto-saving on if positive, else off." | ||
| 4 | ;; (interactive) | ||
| 5 | ;; (if (> arg 0) auto-save (null auto-save))) | ||
| 6 | |||
| 7 | |||
| 8 | ;; (defun auto-fill-mode (arg) | ||
| 9 | ;; "Toggle Auto Fill mode. | ||
| 10 | ;; With ARG, turn Auto Fill mode on if and only if ARG is positive. | ||
| 11 | ;; In Auto Fill mode, inserting a space at a column beyond `current-fill-column' | ||
| 12 | ;; automatically breaks the line at a previous space." | ||
| 13 | ;; (interactive) | ||
| 14 | ;; (if (> arg 0) auto-fill (null auto-fill))) | ||
| 15 | |||
| 1 | ;;; files.el --- file input and output commands for Emacs | 16 | ;;; files.el --- file input and output commands for Emacs |
| 2 | 17 | ||
| 3 | ;; Copyright (C) 1985, 1986, 1987, 1992, 1993, 1994, 1995, 1996, | 18 | ;; Copyright (C) 1985, 1986, 1987, 1992, 1993, 1994, 1995, 1996, |
| @@ -67,9 +82,9 @@ Use this feature when you have directories which you normally refer to | |||
| 67 | via absolute symbolic links. Make TO the name of the link, and FROM | 82 | via absolute symbolic links. Make TO the name of the link, and FROM |
| 68 | the name it is linked to." | 83 | the name it is linked to." |
| 69 | :type '(repeat (cons :format "%v" | 84 | :type '(repeat (cons :format "%v" |
| 70 | :value ("" . "") | 85 | :value ("\\`" . "") |
| 71 | (regexp :tag "From") | 86 | (regexp :tag "From") |
| 72 | (regexp :tag "To"))) | 87 | (string :tag "To"))) |
| 73 | :group 'abbrev | 88 | :group 'abbrev |
| 74 | :group 'find-file) | 89 | :group 'find-file) |
| 75 | 90 | ||
diff --git a/lisp/font-lock.el b/lisp/font-lock.el index bfea0dabfe2..92c62010848 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el | |||
| @@ -544,6 +544,8 @@ and what they do: | |||
| 544 | contexts will not be affected. | 544 | contexts will not be affected. |
| 545 | 545 | ||
| 546 | This is normally set via `font-lock-defaults'.") | 546 | This is normally set via `font-lock-defaults'.") |
| 547 | (make-obsolete-variable 'font-lock-syntactic-keywords | ||
| 548 | 'syntax-propertize-function "24.1") | ||
| 547 | 549 | ||
| 548 | (defvar font-lock-syntax-table nil | 550 | (defvar font-lock-syntax-table nil |
| 549 | "Non-nil means use this syntax table for fontifying. | 551 | "Non-nil means use this syntax table for fontifying. |
| @@ -612,11 +614,10 @@ Major/minor modes can set this variable if they know which option applies.") | |||
| 612 | ;; | 614 | ;; |
| 613 | ;; Borrowed from lazy-lock.el. | 615 | ;; Borrowed from lazy-lock.el. |
| 614 | ;; We use this to preserve or protect things when modifying text properties. | 616 | ;; We use this to preserve or protect things when modifying text properties. |
| 615 | (defmacro save-buffer-state (varlist &rest body) | 617 | (defmacro save-buffer-state (&rest body) |
| 616 | "Bind variables according to VARLIST and eval BODY restoring buffer state." | 618 | "Bind variables according to VARLIST and eval BODY restoring buffer state." |
| 617 | (declare (indent 1) (debug let)) | 619 | (declare (indent 0) (debug t)) |
| 618 | `(let* ,(append varlist | 620 | `(let ((inhibit-point-motion-hooks t)) |
| 619 | `((inhibit-point-motion-hooks t))) | ||
| 620 | (with-silent-modifications | 621 | (with-silent-modifications |
| 621 | ,@body))) | 622 | ,@body))) |
| 622 | ;; | 623 | ;; |
| @@ -1020,7 +1021,7 @@ The region it returns may start or end in the middle of a line.") | |||
| 1020 | (funcall font-lock-fontify-region-function beg end loudly)) | 1021 | (funcall font-lock-fontify-region-function beg end loudly)) |
| 1021 | 1022 | ||
| 1022 | (defun font-lock-unfontify-region (beg end) | 1023 | (defun font-lock-unfontify-region (beg end) |
| 1023 | (save-buffer-state nil | 1024 | (save-buffer-state |
| 1024 | (funcall font-lock-unfontify-region-function beg end))) | 1025 | (funcall font-lock-unfontify-region-function beg end))) |
| 1025 | 1026 | ||
| 1026 | (defun font-lock-default-fontify-buffer () | 1027 | (defun font-lock-default-fontify-buffer () |
| @@ -1113,8 +1114,6 @@ Put first the functions more likely to cause a change and cheaper to compute.") | |||
| 1113 | 1114 | ||
| 1114 | (defun font-lock-default-fontify-region (beg end loudly) | 1115 | (defun font-lock-default-fontify-region (beg end loudly) |
| 1115 | (save-buffer-state | 1116 | (save-buffer-state |
| 1116 | ((parse-sexp-lookup-properties | ||
| 1117 | (or parse-sexp-lookup-properties font-lock-syntactic-keywords))) | ||
| 1118 | ;; Use the fontification syntax table, if any. | 1117 | ;; Use the fontification syntax table, if any. |
| 1119 | (with-syntax-table (or font-lock-syntax-table (syntax-table)) | 1118 | (with-syntax-table (or font-lock-syntax-table (syntax-table)) |
| 1120 | (save-restriction | 1119 | (save-restriction |
| @@ -1136,8 +1135,14 @@ Put first the functions more likely to cause a change and cheaper to compute.") | |||
| 1136 | (setq beg font-lock-beg end font-lock-end)) | 1135 | (setq beg font-lock-beg end font-lock-end)) |
| 1137 | ;; Now do the fontification. | 1136 | ;; Now do the fontification. |
| 1138 | (font-lock-unfontify-region beg end) | 1137 | (font-lock-unfontify-region beg end) |
| 1139 | (when font-lock-syntactic-keywords | 1138 | (when (and font-lock-syntactic-keywords |
| 1140 | (font-lock-fontify-syntactic-keywords-region beg end)) | 1139 | (null syntax-propertize-function)) |
| 1140 | ;; Ensure the beginning of the file is properly syntactic-fontified. | ||
| 1141 | (let ((start beg)) | ||
| 1142 | (when (< font-lock-syntactically-fontified start) | ||
| 1143 | (setq start (max font-lock-syntactically-fontified (point-min))) | ||
| 1144 | (setq font-lock-syntactically-fontified end)) | ||
| 1145 | (font-lock-fontify-syntactic-keywords-region start end))) | ||
| 1141 | (unless font-lock-keywords-only | 1146 | (unless font-lock-keywords-only |
| 1142 | (font-lock-fontify-syntactically-region beg end loudly)) | 1147 | (font-lock-fontify-syntactically-region beg end loudly)) |
| 1143 | (font-lock-fontify-keywords-region beg end loudly))))) | 1148 | (font-lock-fontify-keywords-region beg end loudly))))) |
| @@ -1436,11 +1441,10 @@ LIMIT can be modified by the value of its PRE-MATCH-FORM." | |||
| 1436 | (defun font-lock-fontify-syntactic-keywords-region (start end) | 1441 | (defun font-lock-fontify-syntactic-keywords-region (start end) |
| 1437 | "Fontify according to `font-lock-syntactic-keywords' between START and END. | 1442 | "Fontify according to `font-lock-syntactic-keywords' between START and END. |
| 1438 | START should be at the beginning of a line." | 1443 | START should be at the beginning of a line." |
| 1439 | ;; Ensure the beginning of the file is properly syntactic-fontified. | 1444 | (unless parse-sexp-lookup-properties |
| 1440 | (when (and font-lock-syntactically-fontified | 1445 | ;; We wouldn't go through so much trouble if we didn't intend to use those |
| 1441 | (< font-lock-syntactically-fontified start)) | 1446 | ;; properties, would we? |
| 1442 | (setq start (max font-lock-syntactically-fontified (point-min))) | 1447 | (set (make-local-variable 'parse-sexp-lookup-properties) t)) |
| 1443 | (setq font-lock-syntactically-fontified end)) | ||
| 1444 | ;; If `font-lock-syntactic-keywords' is a symbol, get the real keywords. | 1448 | ;; If `font-lock-syntactic-keywords' is a symbol, get the real keywords. |
| 1445 | (when (symbolp font-lock-syntactic-keywords) | 1449 | (when (symbolp font-lock-syntactic-keywords) |
| 1446 | (setq font-lock-syntactic-keywords (font-lock-eval-keywords | 1450 | (setq font-lock-syntactic-keywords (font-lock-eval-keywords |
| @@ -1483,19 +1487,18 @@ START should be at the beginning of a line." | |||
| 1483 | (defvar font-lock-comment-end-skip nil | 1487 | (defvar font-lock-comment-end-skip nil |
| 1484 | "If non-nil, Font Lock mode uses this instead of `comment-end'.") | 1488 | "If non-nil, Font Lock mode uses this instead of `comment-end'.") |
| 1485 | 1489 | ||
| 1486 | (defun font-lock-fontify-syntactically-region (start end &optional loudly ppss) | 1490 | (defun font-lock-fontify-syntactically-region (start end &optional loudly) |
| 1487 | "Put proper face on each string and comment between START and END. | 1491 | "Put proper face on each string and comment between START and END. |
| 1488 | START should be at the beginning of a line." | 1492 | START should be at the beginning of a line." |
| 1493 | (syntax-propertize end) ; Apply any needed syntax-table properties. | ||
| 1489 | (let ((comment-end-regexp | 1494 | (let ((comment-end-regexp |
| 1490 | (or font-lock-comment-end-skip | 1495 | (or font-lock-comment-end-skip |
| 1491 | (regexp-quote | 1496 | (regexp-quote |
| 1492 | (replace-regexp-in-string "^ *" "" comment-end)))) | 1497 | (replace-regexp-in-string "^ *" "" comment-end)))) |
| 1493 | state face beg) | 1498 | ;; Find the `start' state. |
| 1499 | (state (syntax-ppss start)) | ||
| 1500 | face beg) | ||
| 1494 | (if loudly (message "Fontifying %s... (syntactically...)" (buffer-name))) | 1501 | (if loudly (message "Fontifying %s... (syntactically...)" (buffer-name))) |
| 1495 | (goto-char start) | ||
| 1496 | ;; | ||
| 1497 | ;; Find the `start' state. | ||
| 1498 | (setq state (or ppss (syntax-ppss start))) | ||
| 1499 | ;; | 1502 | ;; |
| 1500 | ;; Find each interesting place between here and `end'. | 1503 | ;; Find each interesting place between here and `end'. |
| 1501 | (while | 1504 | (while |
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 5f9e1347787..7dca7730828 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,84 @@ | |||
| 1 | 2010-09-10 Lars Magne Ingebrigtsen <larsi@gnus.org> | ||
| 2 | |||
| 3 | * gnus-start.el (gnus-read-active-file-1): If gnus-agent isn't set, | ||
| 4 | then do request scans from the backends. | ||
| 5 | |||
| 6 | * gnus-sum.el (gnus-summary-update-hook): Change default to nil, to | ||
| 7 | avoid running a hook per line, since this takes a lot of time, | ||
| 8 | profiling shows. | ||
| 9 | (gnus-summary-prepare-threads): Call `gnus-summary-highlight-line' | ||
| 10 | directly if gnus-visual-p is true. | ||
| 11 | |||
| 12 | 2010-09-10 Katsumi Yamaoka <yamaoka@jpl.org> | ||
| 13 | |||
| 14 | * gnus-start.el (gnus-read-active-for-groups): Check only subscribed | ||
| 15 | groups; replace mapcar with dolist which is a bit faster; pass groups | ||
| 16 | info to gnus-read-active-file-1. | ||
| 17 | (gnus-read-active-file-1): Scan only specified groups if the new | ||
| 18 | optional arg `infos' is given. | ||
| 19 | |||
| 20 | 2010-09-09 Lars Magne Ingebrigtsen <larsi@gnus.org> | ||
| 21 | |||
| 22 | * mail-source.el (mail-source-fetch-pop): Use pop3-movemail again. | ||
| 23 | |||
| 24 | * pop3.el (pop3-movemail): Removed. | ||
| 25 | (pop3-streaming-movemail): Renamed to pop3-movemail. | ||
| 26 | |||
| 27 | * gnus-html.el (gnus-html-wash-tags): Refactor out the image bit, and | ||
| 28 | don't restrict end-tag searches to the end of the line. | ||
| 29 | |||
| 30 | 2010-09-09 Katsumi Yamaoka <yamaoka@jpl.org> | ||
| 31 | |||
| 32 | * gnus-start.el (gnus-get-unread-articles): Set the number of unread | ||
| 33 | articles of every unchecked group to t, which means unknown since the | ||
| 34 | server has never been opened. | ||
| 35 | |||
| 36 | 2010-09-08 Lars Magne Ingebrigtsen <larsi@gnus.org> | ||
| 37 | |||
| 38 | * gnus-html.el (gnus-html-show-alt-text): New command. | ||
| 39 | (gnus-html-browse-image): Ditto. | ||
| 40 | (gnus-html-wash-tags): Add the data to allow showing the ALT text and | ||
| 41 | to browse the image directly. | ||
| 42 | (gnus-html-wash-tags): Search for images first, so that <a><img> works | ||
| 43 | better. | ||
| 44 | |||
| 45 | * gnus-async.el (gnus-async-article-callback): Call | ||
| 46 | `gnus-html-prefetch-images' unconditionally. | ||
| 47 | |||
| 48 | * gnus-html.el (gnus-html-schedule-image-fetching): Decode entities | ||
| 49 | before feeding URLs to curl. | ||
| 50 | |||
| 51 | 2010-09-07 Katsumi Yamaoka <yamaoka@jpl.org> | ||
| 52 | |||
| 53 | * gnus-html.el (gnus-html-wash-tags, gnus-html-put-image): Mark cid and | ||
| 54 | internal images as deletable by `W D D'. | ||
| 55 | |||
| 56 | * gnus-async.el (gnus-html-prefetch-images): Autoload it when compiling. | ||
| 57 | (gnus-async-article-callback): Fix typo. | ||
| 58 | |||
| 59 | 2010-09-06 Lars Magne Ingebrigtsen <larsi@gnus.org> | ||
| 60 | |||
| 61 | * gnus-html.el (gnus-html-wash-tags): Limit end-tag matching to the | ||
| 62 | current line to work around bugs in the output from w3m. | ||
| 63 | |||
| 64 | * gnus-async.el (gnus-async-article-callback): Always prefetch images | ||
| 65 | for groups that want that. | ||
| 66 | |||
| 67 | * nntp.el (nntp-wait-for-string): Supply a timeout for | ||
| 68 | accept-process-output to ensure progress. | ||
| 69 | |||
| 70 | * gnus-start.el (gnus-get-unread-articles): If being given an explicit | ||
| 71 | level to get unread articles from, then use that for foreign groups, | ||
| 72 | too. | ||
| 73 | |||
| 74 | * gnus-html.el (gnus-html-wash-tags): Remove <a name...> tags, which | ||
| 75 | confuses the rest of the function. | ||
| 76 | |||
| 77 | * gnus-start.el (gnus-read-active-for-groups): Do a `gnus-request-scan' | ||
| 78 | for the methods that support -retrieve-groups, too. | ||
| 79 | |||
| 80 | * nnml.el (nnml-save-nov): Remove some debugging-related messages. | ||
| 81 | |||
| 1 | 2010-09-06 Katsumi Yamaoka <yamaoka@jpl.org> | 82 | 2010-09-06 Katsumi Yamaoka <yamaoka@jpl.org> |
| 2 | 83 | ||
| 3 | * pop3.el: Require cl when compiling. | 84 | * pop3.el: Require cl when compiling. |
diff --git a/lisp/gnus/gnus-async.el b/lisp/gnus/gnus-async.el index 1e9c1dff77f..979e67120d1 100644 --- a/lisp/gnus/gnus-async.el +++ b/lisp/gnus/gnus-async.el | |||
| @@ -228,16 +228,22 @@ that was fetched." | |||
| 228 | `(lambda (arg) | 228 | `(lambda (arg) |
| 229 | (gnus-async-article-callback arg ,group ,article ,mark ,summary ,next))) | 229 | (gnus-async-article-callback arg ,group ,article ,mark ,summary ,next))) |
| 230 | 230 | ||
| 231 | (eval-when-compile | ||
| 232 | (autoload 'gnus-html-prefetch-images "gnus-html")) | ||
| 233 | |||
| 231 | (defun gnus-async-article-callback (arg group article mark summary next) | 234 | (defun gnus-async-article-callback (arg group article mark summary next) |
| 232 | "Function called when an async article is done being fetched." | 235 | "Function called when an async article is done being fetched." |
| 233 | (save-excursion | 236 | (save-excursion |
| 234 | (setq gnus-async-current-prefetch-article nil) | 237 | (setq gnus-async-current-prefetch-article nil) |
| 235 | (when arg | 238 | (when arg |
| 236 | (gnus-async-set-buffer) | 239 | (gnus-async-set-buffer) |
| 237 | (when gnus-async-post-fetch-function | 240 | (save-excursion |
| 238 | (save-excursion | 241 | (save-restriction |
| 239 | (save-restriction | 242 | (narrow-to-region mark (point-max)) |
| 240 | (narrow-to-region mark (point-max)) | 243 | ;; Prefetch images for the groups that want that. |
| 244 | (when (fboundp 'gnus-html-prefetch-images) | ||
| 245 | (gnus-html-prefetch-images summary)) | ||
| 246 | (when gnus-async-post-fetch-function | ||
| 241 | (funcall gnus-async-post-fetch-function summary)))) | 247 | (funcall gnus-async-post-fetch-function summary)))) |
| 242 | (gnus-async-with-semaphore | 248 | (gnus-async-with-semaphore |
| 243 | (setq | 249 | (setq |
diff --git a/lisp/gnus/gnus-html.el b/lisp/gnus/gnus-html.el index 3b7d2527c99..8bfbaaa5279 100644 --- a/lisp/gnus/gnus-html.el +++ b/lisp/gnus/gnus-html.el | |||
| @@ -72,6 +72,15 @@ fit these criteria." | |||
| 72 | (define-key map "i" 'gnus-html-insert-image) | 72 | (define-key map "i" 'gnus-html-insert-image) |
| 73 | map)) | 73 | map)) |
| 74 | 74 | ||
| 75 | (defvar gnus-html-displayed-image-map | ||
| 76 | (let ((map (make-sparse-keymap))) | ||
| 77 | (define-key map "a" 'gnus-html-show-alt-text) | ||
| 78 | (define-key map "i" 'gnus-html-browse-image) | ||
| 79 | (define-key map "\r" 'gnus-html-browse-url) | ||
| 80 | (define-key map "u" 'gnus-article-copy-string) | ||
| 81 | (define-key map [tab] 'widget-forward) | ||
| 82 | map)) | ||
| 83 | |||
| 75 | ;;;###autoload | 84 | ;;;###autoload |
| 76 | (defun gnus-article-html (&optional handle) | 85 | (defun gnus-article-html (&optional handle) |
| 77 | (let ((article-buffer (current-buffer))) | 86 | (let ((article-buffer (current-buffer))) |
| @@ -111,12 +120,104 @@ fit these criteria." | |||
| 111 | 120 | ||
| 112 | (defvar gnus-article-mouse-face) | 121 | (defvar gnus-article-mouse-face) |
| 113 | 122 | ||
| 114 | (defun gnus-html-wash-tags () | 123 | (defun gnus-html-pre-wash () |
| 124 | (goto-char (point-min)) | ||
| 125 | (while (re-search-forward " *<pre_int> *</pre_int> *\n" nil t) | ||
| 126 | (replace-match "" t t)) | ||
| 127 | (goto-char (point-min)) | ||
| 128 | (while (re-search-forward "<a name[^\n>]+>" nil t) | ||
| 129 | (replace-match "" t t))) | ||
| 130 | |||
| 131 | (defun gnus-html-wash-images () | ||
| 115 | (let (tag parameters string start end images url) | 132 | (let (tag parameters string start end images url) |
| 116 | (goto-char (point-min)) | 133 | (goto-char (point-min)) |
| 117 | (while (re-search-forward " *<pre_int> *</pre_int> *\n" nil t) | 134 | ;; Search for all the images first. |
| 118 | (replace-match "" t t)) | 135 | (while (re-search-forward "<img_alt \\([^>]*\\)>" nil t) |
| 136 | (setq parameters (match-string 1) | ||
| 137 | start (match-beginning 0)) | ||
| 138 | (delete-region start (point)) | ||
| 139 | (when (search-forward "</img_alt>" (line-end-position) t) | ||
| 140 | (delete-region (match-beginning 0) (match-end 0))) | ||
| 141 | (setq end (point)) | ||
| 142 | (when (string-match "src=\"\\([^\"]+\\)" parameters) | ||
| 143 | (setq url (match-string 1 parameters)) | ||
| 144 | (gnus-message 8 "gnus-html-wash-tags: fetching image URL %s" url) | ||
| 145 | (if (string-match "^cid:\\(.*\\)" url) | ||
| 146 | ;; URLs with cid: have their content stashed in other | ||
| 147 | ;; parts of the MIME structure, so just insert them | ||
| 148 | ;; immediately. | ||
| 149 | (let ((handle (mm-get-content-id | ||
| 150 | (setq url (match-string 1 url)))) | ||
| 151 | image) | ||
| 152 | (when handle | ||
| 153 | (mm-with-part handle | ||
| 154 | (setq image (gnus-create-image (buffer-string) | ||
| 155 | nil t)))) | ||
| 156 | (when image | ||
| 157 | (let ((string (buffer-substring start end))) | ||
| 158 | (delete-region start end) | ||
| 159 | (gnus-put-image image (gnus-string-or string "*") 'cid) | ||
| 160 | (gnus-add-image 'cid image)))) | ||
| 161 | ;; Normal, external URL. | ||
| 162 | (if (gnus-html-image-url-blocked-p | ||
| 163 | url | ||
| 164 | (if (buffer-live-p gnus-summary-buffer) | ||
| 165 | (with-current-buffer gnus-summary-buffer | ||
| 166 | gnus-blocked-images) | ||
| 167 | gnus-blocked-images)) | ||
| 168 | (progn | ||
| 169 | (widget-convert-button | ||
| 170 | 'link start end | ||
| 171 | :action 'gnus-html-insert-image | ||
| 172 | :help-echo url | ||
| 173 | :keymap gnus-html-image-map | ||
| 174 | :button-keymap gnus-html-image-map) | ||
| 175 | (let ((overlay (gnus-make-overlay start end)) | ||
| 176 | (spec (list url | ||
| 177 | (set-marker (make-marker) start) | ||
| 178 | (set-marker (make-marker) end)))) | ||
| 179 | (gnus-overlay-put overlay 'local-map gnus-html-image-map) | ||
| 180 | (gnus-overlay-put overlay 'gnus-image spec) | ||
| 181 | (gnus-put-text-property | ||
| 182 | start end | ||
| 183 | 'gnus-image spec))) | ||
| 184 | (let ((file (gnus-html-image-id url)) | ||
| 185 | width height alt-text) | ||
| 186 | (when (string-match "height=\"?\\([0-9]+\\)" parameters) | ||
| 187 | (setq height (string-to-number (match-string 1 parameters)))) | ||
| 188 | (when (string-match "width=\"?\\([0-9]+\\)" parameters) | ||
| 189 | (setq width (string-to-number (match-string 1 parameters)))) | ||
| 190 | (when (string-match "\\(alt\\|title\\)=\"\\([^\"]+\\)" | ||
| 191 | parameters) | ||
| 192 | (setq alt-text (match-string 2 parameters))) | ||
| 193 | ;; Don't fetch images that are really small. They're | ||
| 194 | ;; probably tracking pictures. | ||
| 195 | (when (and (or (null height) | ||
| 196 | (> height 4)) | ||
| 197 | (or (null width) | ||
| 198 | (> width 4))) | ||
| 199 | (if (file-exists-p file) | ||
| 200 | ;; It's already cached, so just insert it. | ||
| 201 | (let ((string (buffer-substring start end))) | ||
| 202 | ;; Delete the IMG text. | ||
| 203 | (delete-region start end) | ||
| 204 | (gnus-html-put-image file (point) string url alt-text)) | ||
| 205 | ;; We don't have it, so schedule it for fetching | ||
| 206 | ;; asynchronously. | ||
| 207 | (push (list url | ||
| 208 | (set-marker (make-marker) start) | ||
| 209 | (point-marker)) | ||
| 210 | images)))))))) | ||
| 211 | (when images | ||
| 212 | (gnus-html-schedule-image-fetching (current-buffer) (nreverse images))))) | ||
| 213 | |||
| 214 | (defun gnus-html-wash-tags () | ||
| 215 | (let (tag parameters string start end images url) | ||
| 216 | (gnus-html-pre-wash) | ||
| 217 | (gnus-html-wash-images) | ||
| 218 | |||
| 119 | (goto-char (point-min)) | 219 | (goto-char (point-min)) |
| 220 | ;; Then do the other tags. | ||
| 120 | (while (re-search-forward "<\\([^ />]+\\)\\([^>]*\\)>" nil t) | 221 | (while (re-search-forward "<\\([^ />]+\\)\\([^>]*\\)>" nil t) |
| 121 | (setq tag (match-string 1) | 222 | (setq tag (match-string 1) |
| 122 | parameters (match-string 2) | 223 | parameters (match-string 2) |
| @@ -129,72 +230,7 @@ fit these criteria." | |||
| 129 | (setq end (point)) | 230 | (setq end (point)) |
| 130 | (cond | 231 | (cond |
| 131 | ;; Fetch and insert a picture. | 232 | ;; Fetch and insert a picture. |
| 132 | ((equal tag "img_alt") | 233 | ((equal tag "img_alt")) |
| 133 | (when (string-match "src=\"\\([^\"]+\\)" parameters) | ||
| 134 | (setq url (match-string 1 parameters)) | ||
| 135 | (gnus-message 8 "gnus-html-wash-tags: fetching image URL %s" url) | ||
| 136 | (if (string-match "^cid:\\(.*\\)" url) | ||
| 137 | ;; URLs with cid: have their content stashed in other | ||
| 138 | ;; parts of the MIME structure, so just insert them | ||
| 139 | ;; immediately. | ||
| 140 | (let ((handle (mm-get-content-id | ||
| 141 | (setq url (match-string 1 url)))) | ||
| 142 | image) | ||
| 143 | (when handle | ||
| 144 | (mm-with-part handle | ||
| 145 | (setq image (gnus-create-image (buffer-string) | ||
| 146 | nil t)))) | ||
| 147 | (when image | ||
| 148 | (let ((string (buffer-substring start end))) | ||
| 149 | (delete-region start end) | ||
| 150 | (gnus-put-image image (gnus-string-or string "*"))))) | ||
| 151 | ;; Normal, external URL. | ||
| 152 | (if (gnus-html-image-url-blocked-p | ||
| 153 | url | ||
| 154 | (if (buffer-live-p gnus-summary-buffer) | ||
| 155 | (with-current-buffer gnus-summary-buffer | ||
| 156 | gnus-blocked-images) | ||
| 157 | gnus-blocked-images)) | ||
| 158 | (progn | ||
| 159 | (widget-convert-button | ||
| 160 | 'link start end | ||
| 161 | :action 'gnus-html-insert-image | ||
| 162 | :help-echo url | ||
| 163 | :keymap gnus-html-image-map | ||
| 164 | :button-keymap gnus-html-image-map) | ||
| 165 | (let ((overlay (gnus-make-overlay start end)) | ||
| 166 | (spec (list url | ||
| 167 | (set-marker (make-marker) start) | ||
| 168 | (set-marker (make-marker) end)))) | ||
| 169 | (gnus-overlay-put overlay 'local-map gnus-html-image-map) | ||
| 170 | (gnus-overlay-put overlay 'gnus-image spec) | ||
| 171 | (gnus-put-text-property | ||
| 172 | start end | ||
| 173 | 'gnus-image spec))) | ||
| 174 | (let ((file (gnus-html-image-id url)) | ||
| 175 | width height) | ||
| 176 | (when (string-match "height=\"?\\([0-9]+\\)" parameters) | ||
| 177 | (setq height (string-to-number (match-string 1 parameters)))) | ||
| 178 | (when (string-match "width=\"?\\([0-9]+\\)" parameters) | ||
| 179 | (setq width (string-to-number (match-string 1 parameters)))) | ||
| 180 | ;; Don't fetch images that are really small. They're | ||
| 181 | ;; probably tracking pictures. | ||
| 182 | (when (and (or (null height) | ||
| 183 | (> height 4)) | ||
| 184 | (or (null width) | ||
| 185 | (> width 4))) | ||
| 186 | (if (file-exists-p file) | ||
| 187 | ;; It's already cached, so just insert it. | ||
| 188 | (let ((string (buffer-substring start end))) | ||
| 189 | ;; Delete the ALT text. | ||
| 190 | (delete-region start end) | ||
| 191 | (gnus-html-put-image file (point) string)) | ||
| 192 | ;; We don't have it, so schedule it for fetching | ||
| 193 | ;; asynchronously. | ||
| 194 | (push (list url | ||
| 195 | (set-marker (make-marker) start) | ||
| 196 | (point-marker)) | ||
| 197 | images)))))))) | ||
| 198 | ;; Add a link. | 234 | ;; Add a link. |
| 199 | ((or (equal tag "a") | 235 | ((or (equal tag "a") |
| 200 | (equal tag "A")) | 236 | (equal tag "A")) |
| @@ -221,10 +257,8 @@ fit these criteria." | |||
| 221 | (goto-char (point-min)) | 257 | (goto-char (point-min)) |
| 222 | ;; The output from -halfdump isn't totally regular, so strip | 258 | ;; The output from -halfdump isn't totally regular, so strip |
| 223 | ;; off any </pre_int>s that were left over. | 259 | ;; off any </pre_int>s that were left over. |
| 224 | (while (re-search-forward "</pre_int>" nil t) | 260 | (while (re-search-forward "</pre_int>\\|</internal>" nil t) |
| 225 | (replace-match "" t t)) | 261 | (replace-match "" t t)) |
| 226 | (when images | ||
| 227 | (gnus-html-schedule-image-fetching (current-buffer) (nreverse images))) | ||
| 228 | (mm-url-decode-entities))) | 262 | (mm-url-decode-entities))) |
| 229 | 263 | ||
| 230 | (defun gnus-html-insert-image () | 264 | (defun gnus-html-insert-image () |
| @@ -233,6 +267,24 @@ fit these criteria." | |||
| 233 | (gnus-html-schedule-image-fetching | 267 | (gnus-html-schedule-image-fetching |
| 234 | (current-buffer) (list (get-text-property (point) 'gnus-image)))) | 268 | (current-buffer) (list (get-text-property (point) 'gnus-image)))) |
| 235 | 269 | ||
| 270 | (defun gnus-html-show-alt-text () | ||
| 271 | "Show the ALT text of the image under point." | ||
| 272 | (interactive) | ||
| 273 | (message "%s" (get-text-property (point) 'gnus-alt-text))) | ||
| 274 | |||
| 275 | (defun gnus-html-browse-image () | ||
| 276 | "Browse the image under point." | ||
| 277 | (interactive) | ||
| 278 | (browse-url (get-text-property (point) 'gnus-image))) | ||
| 279 | |||
| 280 | (defun gnus-html-browse-url () | ||
| 281 | "Browse the image under point." | ||
| 282 | (interactive) | ||
| 283 | (let ((url (get-text-property (point) 'gnus-string))) | ||
| 284 | (if (not url) | ||
| 285 | (message "No URL at point") | ||
| 286 | (browse-url url)))) | ||
| 287 | |||
| 236 | (defun gnus-html-schedule-image-fetching (buffer images) | 288 | (defun gnus-html-schedule-image-fetching (buffer images) |
| 237 | (gnus-message 8 "gnus-html-schedule-image-fetching: buffer %s, images %s" | 289 | (gnus-message 8 "gnus-html-schedule-image-fetching: buffer %s, images %s" |
| 238 | buffer images) | 290 | buffer images) |
| @@ -243,7 +295,7 @@ fit these criteria." | |||
| 243 | "--location" | 295 | "--location" |
| 244 | "--max-time" "60" | 296 | "--max-time" "60" |
| 245 | "-o" (gnus-html-image-id url) | 297 | "-o" (gnus-html-image-id url) |
| 246 | url))) | 298 | (mm-url-decode-entities-string url)))) |
| 247 | (process-kill-without-query process) | 299 | (process-kill-without-query process) |
| 248 | (set-process-sentinel process 'gnus-html-curl-sentinel) | 300 | (set-process-sentinel process 'gnus-html-curl-sentinel) |
| 249 | (gnus-set-process-plist process (list 'images images | 301 | (gnus-set-process-plist process (list 'images images |
| @@ -272,7 +324,7 @@ fit these criteria." | |||
| 272 | (when images | 324 | (when images |
| 273 | (gnus-html-schedule-image-fetching buffer images))))) | 325 | (gnus-html-schedule-image-fetching buffer images))))) |
| 274 | 326 | ||
| 275 | (defun gnus-html-put-image (file point string) | 327 | (defun gnus-html-put-image (file point string &optional url alt-text) |
| 276 | (when (gnus-graphic-display-p) | 328 | (when (gnus-graphic-display-p) |
| 277 | (let* ((image (ignore-errors | 329 | (let* ((image (ignore-errors |
| 278 | (gnus-create-image file))) | 330 | (gnus-create-image file))) |
| @@ -297,18 +349,26 @@ fit these criteria." | |||
| 297 | 'gif) | 349 | 'gif) |
| 298 | (= (car size) 30) | 350 | (= (car size) 30) |
| 299 | (= (cdr size) 30)))) | 351 | (= (cdr size) 30)))) |
| 300 | (progn | 352 | (let ((start (point))) |
| 301 | (setq image (gnus-html-rescale-image image file size)) | 353 | (setq image (gnus-html-rescale-image image file size)) |
| 302 | (gnus-put-image image | 354 | (gnus-put-image image |
| 303 | (gnus-string-or string "*") | 355 | (gnus-string-or string "*") |
| 304 | 'external) | 356 | 'external) |
| 357 | (let ((overlay (gnus-make-overlay start (point)))) | ||
| 358 | (gnus-overlay-put overlay 'local-map | ||
| 359 | gnus-html-displayed-image-map) | ||
| 360 | (gnus-put-text-property start (point) 'gnus-alt-text alt-text) | ||
| 361 | (when url | ||
| 362 | (gnus-put-text-property start (point) 'gnus-image url))) | ||
| 305 | (gnus-add-image 'external image) | 363 | (gnus-add-image 'external image) |
| 306 | t) | 364 | t) |
| 307 | (insert string) | 365 | (insert string) |
| 308 | (when (fboundp 'find-image) | 366 | (when (fboundp 'find-image) |
| 309 | (gnus-put-image (find-image | 367 | (setq image (find-image '((:type xpm :file "lock-broken.xpm")))) |
| 310 | '((:type xpm :file "lock-broken.xpm"))) | 368 | (gnus-put-image image |
| 311 | (gnus-string-or string "*"))) | 369 | (gnus-string-or string "*") |
| 370 | 'internal) | ||
| 371 | (gnus-add-image 'internal image)) | ||
| 312 | nil))))) | 372 | nil))))) |
| 313 | 373 | ||
| 314 | (defun gnus-html-rescale-image (image file size) | 374 | (defun gnus-html-rescale-image (image file size) |
| @@ -354,7 +414,7 @@ fit these criteria." | |||
| 354 | (delete-file (nth 2 file))))))) | 414 | (delete-file (nth 2 file))))))) |
| 355 | 415 | ||
| 356 | (defun gnus-html-image-url-blocked-p (url blocked-images) | 416 | (defun gnus-html-image-url-blocked-p (url blocked-images) |
| 357 | "Find out if URL is blocked by BLOCKED-IMAGES." | 417 | "Find out if URL is blocked by BLOCKED-IMAGES." |
| 358 | (let ((ret (and blocked-images | 418 | (let ((ret (and blocked-images |
| 359 | (string-match blocked-images url)))) | 419 | (string-match blocked-images url)))) |
| 360 | (if ret | 420 | (if ret |
| @@ -389,7 +449,7 @@ This only works if the article in question is HTML." | |||
| 389 | (let ((url (match-string 1))) | 449 | (let ((url (match-string 1))) |
| 390 | (unless (gnus-html-image-url-blocked-p url blocked-images) | 450 | (unless (gnus-html-image-url-blocked-p url blocked-images) |
| 391 | (unless (file-exists-p (gnus-html-image-id url)) | 451 | (unless (file-exists-p (gnus-html-image-id url)) |
| 392 | (push url urls) | 452 | (push (mm-url-decode-entities-string url) urls) |
| 393 | (push (gnus-html-image-id url) urls) | 453 | (push (gnus-html-image-id url) urls) |
| 394 | (push "-o" urls))))) | 454 | (push "-o" urls))))) |
| 395 | (let ((process | 455 | (let ((process |
diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el index 3bdcb05dbe5..1c06a774203 100644 --- a/lisp/gnus/gnus-start.el +++ b/lisp/gnus/gnus-start.el | |||
| @@ -1677,20 +1677,22 @@ If SCAN, request a scan of that group as well." | |||
| 1677 | (let* ((newsrc (cdr gnus-newsrc-alist)) | 1677 | (let* ((newsrc (cdr gnus-newsrc-alist)) |
| 1678 | (alevel (or level gnus-activate-level (1+ gnus-level-subscribed))) | 1678 | (alevel (or level gnus-activate-level (1+ gnus-level-subscribed))) |
| 1679 | (foreign-level | 1679 | (foreign-level |
| 1680 | (min | 1680 | (or |
| 1681 | (cond ((and gnus-activate-foreign-newsgroups | 1681 | level |
| 1682 | (not (numberp gnus-activate-foreign-newsgroups))) | 1682 | (min |
| 1683 | (1+ gnus-level-subscribed)) | 1683 | (cond ((and gnus-activate-foreign-newsgroups |
| 1684 | ((numberp gnus-activate-foreign-newsgroups) | 1684 | (not (numberp gnus-activate-foreign-newsgroups))) |
| 1685 | gnus-activate-foreign-newsgroups) | 1685 | (1+ gnus-level-subscribed)) |
| 1686 | (t 0)) | 1686 | ((numberp gnus-activate-foreign-newsgroups) |
| 1687 | alevel)) | 1687 | gnus-activate-foreign-newsgroups) |
| 1688 | (t 0)) | ||
| 1689 | alevel))) | ||
| 1688 | (methods-cache nil) | 1690 | (methods-cache nil) |
| 1689 | (type-cache nil) | 1691 | (type-cache nil) |
| 1690 | (gnus-agent-article-local-times 0) | 1692 | (gnus-agent-article-local-times 0) |
| 1691 | (archive-method (gnus-server-to-method "archive")) | 1693 | (archive-method (gnus-server-to-method "archive")) |
| 1692 | infos info group active method cmethod | 1694 | infos info group active method cmethod |
| 1693 | method-type method-group-list) | 1695 | method-type method-group-list entry) |
| 1694 | (gnus-message 6 "Checking new news...") | 1696 | (gnus-message 6 "Checking new news...") |
| 1695 | 1697 | ||
| 1696 | (while newsrc | 1698 | (while newsrc |
| @@ -1735,12 +1737,18 @@ If SCAN, request a scan of that group as well." | |||
| 1735 | (push (setq method-group-list (list method method-type nil)) | 1737 | (push (setq method-group-list (list method method-type nil)) |
| 1736 | type-cache)) | 1738 | type-cache)) |
| 1737 | ;; Only add groups that need updating. | 1739 | ;; Only add groups that need updating. |
| 1738 | (when (<= (gnus-info-level info) | 1740 | (if (<= (gnus-info-level info) |
| 1739 | (if (eq (cadr method-group-list) 'foreign) | 1741 | (if (eq (cadr method-group-list) 'foreign) |
| 1740 | foreign-level | 1742 | foreign-level |
| 1741 | alevel)) | 1743 | alevel)) |
| 1742 | (setcar (nthcdr 2 method-group-list) | 1744 | (setcar (nthcdr 2 method-group-list) |
| 1743 | (cons info (nth 2 method-group-list))))) | 1745 | (cons info (nth 2 method-group-list))) |
| 1746 | ;; The group is inactive, so we nix out the number of unread articles. | ||
| 1747 | ;; It leads `(gnus-group-unread group)' to return t. See also | ||
| 1748 | ;; `gnus-group-prepare-flat'. | ||
| 1749 | (unless active | ||
| 1750 | (when (setq entry (gnus-group-entry group)) | ||
| 1751 | (setcar entry t))))) | ||
| 1744 | 1752 | ||
| 1745 | ;; Sort the methods based so that the primary and secondary | 1753 | ;; Sort the methods based so that the primary and secondary |
| 1746 | ;; methods come first. This is done for legacy reasons to try to | 1754 | ;; methods come first. This is done for legacy reasons to try to |
| @@ -1792,13 +1800,16 @@ If SCAN, request a scan of that group as well." | |||
| 1792 | (with-current-buffer nntp-server-buffer | 1800 | (with-current-buffer nntp-server-buffer |
| 1793 | (cond | 1801 | (cond |
| 1794 | ((gnus-check-backend-function 'retrieve-groups (car method)) | 1802 | ((gnus-check-backend-function 'retrieve-groups (car method)) |
| 1795 | (gnus-read-active-file-2 | 1803 | (when (gnus-check-backend-function 'request-scan (car method)) |
| 1796 | (mapcar (lambda (info) | 1804 | (dolist (info infos) |
| 1797 | (gnus-group-real-name (gnus-info-group info))) | 1805 | (gnus-request-scan (gnus-info-group info) method))) |
| 1798 | infos) | 1806 | (let (groups) |
| 1799 | method)) | 1807 | (gnus-read-active-file-2 |
| 1808 | (dolist (info infos (nreverse groups)) | ||
| 1809 | (push (gnus-group-real-name (gnus-info-group info)) groups)) | ||
| 1810 | method))) | ||
| 1800 | ((gnus-check-backend-function 'request-list (car method)) | 1811 | ((gnus-check-backend-function 'request-list (car method)) |
| 1801 | (gnus-read-active-file-1 method nil)) | 1812 | (gnus-read-active-file-1 method nil infos)) |
| 1802 | (t | 1813 | (t |
| 1803 | (dolist (info infos) | 1814 | (dolist (info infos) |
| 1804 | (gnus-activate-group (gnus-info-group info) nil nil method t)))))) | 1815 | (gnus-activate-group (gnus-info-group info) nil nil method t)))))) |
| @@ -2027,7 +2038,7 @@ If SCAN, request a scan of that group as well." | |||
| 2027 | (message "Quit reading the active file") | 2038 | (message "Quit reading the active file") |
| 2028 | nil)))))))) | 2039 | nil)))))))) |
| 2029 | 2040 | ||
| 2030 | (defun gnus-read-active-file-1 (method force) | 2041 | (defun gnus-read-active-file-1 (method force &optional infos) |
| 2031 | (let (where mesg) | 2042 | (let (where mesg) |
| 2032 | (setq where (nth 1 method) | 2043 | (setq where (nth 1 method) |
| 2033 | mesg (format "Reading active file%s via %s..." | 2044 | mesg (format "Reading active file%s via %s..." |
| @@ -2037,10 +2048,14 @@ If SCAN, request a scan of that group as well." | |||
| 2037 | (gnus-message 5 mesg) | 2048 | (gnus-message 5 mesg) |
| 2038 | (when (gnus-check-server method) | 2049 | (when (gnus-check-server method) |
| 2039 | ;; Request that the backend scan its incoming messages. | 2050 | ;; Request that the backend scan its incoming messages. |
| 2040 | (when (and gnus-agent | 2051 | (when (and (or (and gnus-agent |
| 2041 | (gnus-online method) | 2052 | (gnus-online method)) |
| 2053 | (not gnus-agent)) | ||
| 2042 | (gnus-check-backend-function 'request-scan (car method))) | 2054 | (gnus-check-backend-function 'request-scan (car method))) |
| 2043 | (gnus-request-scan nil method)) | 2055 | (if infos |
| 2056 | (dolist (info infos) | ||
| 2057 | (gnus-request-scan (gnus-info-group info) method)) | ||
| 2058 | (gnus-request-scan nil method))) | ||
| 2044 | (cond | 2059 | (cond |
| 2045 | ((and (eq gnus-read-active-file 'some) | 2060 | ((and (eq gnus-read-active-file 'some) |
| 2046 | (gnus-check-backend-function 'retrieve-groups (car method)) | 2061 | (gnus-check-backend-function 'retrieve-groups (car method)) |
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index a99426ad83f..df20456b278 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el | |||
| @@ -985,8 +985,7 @@ This hook is not called from the non-updating exit commands like `Q'." | |||
| 985 | :group 'gnus-various | 985 | :group 'gnus-various |
| 986 | :type 'hook) | 986 | :type 'hook) |
| 987 | 987 | ||
| 988 | (defcustom gnus-summary-update-hook | 988 | (defcustom gnus-summary-update-hook nil |
| 989 | (list 'gnus-summary-highlight-line) | ||
| 990 | "*A hook called when a summary line is changed. | 989 | "*A hook called when a summary line is changed. |
| 991 | The hook will not be called if `gnus-visual' is nil. | 990 | The hook will not be called if `gnus-visual' is nil. |
| 992 | 991 | ||
| @@ -3753,6 +3752,7 @@ buffer that was in action when the last article was fetched." | |||
| 3753 | (error (gnus-message 5 "Error updating the summary line"))) | 3752 | (error (gnus-message 5 "Error updating the summary line"))) |
| 3754 | (when (gnus-visual-p 'summary-highlight 'highlight) | 3753 | (when (gnus-visual-p 'summary-highlight 'highlight) |
| 3755 | (forward-line -1) | 3754 | (forward-line -1) |
| 3755 | (gnus-summary-highlight-line) | ||
| 3756 | (gnus-run-hooks 'gnus-summary-update-hook) | 3756 | (gnus-run-hooks 'gnus-summary-update-hook) |
| 3757 | (forward-line 1)))) | 3757 | (forward-line 1)))) |
| 3758 | 3758 | ||
| @@ -3785,6 +3785,7 @@ buffer that was in action when the last article was fetched." | |||
| 3785 | 'score)) | 3785 | 'score)) |
| 3786 | ;; Do visual highlighting. | 3786 | ;; Do visual highlighting. |
| 3787 | (when (gnus-visual-p 'summary-highlight 'highlight) | 3787 | (when (gnus-visual-p 'summary-highlight 'highlight) |
| 3788 | (gnus-summary-highlight-line) | ||
| 3788 | (gnus-run-hooks 'gnus-summary-update-hook))))) | 3789 | (gnus-run-hooks 'gnus-summary-update-hook))))) |
| 3789 | 3790 | ||
| 3790 | (defvar gnus-tmp-new-adopts nil) | 3791 | (defvar gnus-tmp-new-adopts nil) |
| @@ -5363,7 +5364,9 @@ or a straight list of headers." | |||
| 5363 | 'gnus-number number) | 5364 | 'gnus-number number) |
| 5364 | (when gnus-visual-p | 5365 | (when gnus-visual-p |
| 5365 | (forward-line -1) | 5366 | (forward-line -1) |
| 5366 | (gnus-run-hooks 'gnus-summary-update-hook) | 5367 | (gnus-summary-highlight-line) |
| 5368 | (when gnus-summary-update-hook | ||
| 5369 | (gnus-run-hooks 'gnus-summary-update-hook)) | ||
| 5367 | (forward-line 1)) | 5370 | (forward-line 1)) |
| 5368 | 5371 | ||
| 5369 | (setq gnus-tmp-prev-subject simp-subject))) | 5372 | (setq gnus-tmp-prev-subject simp-subject))) |
| @@ -10734,6 +10737,7 @@ If NO-EXPIRE, auto-expiry will be inhibited." | |||
| 10734 | (t gnus-no-mark)) | 10737 | (t gnus-no-mark)) |
| 10735 | 'replied) | 10738 | 'replied) |
| 10736 | (when (gnus-visual-p 'summary-highlight 'highlight) | 10739 | (when (gnus-visual-p 'summary-highlight 'highlight) |
| 10740 | (gnus-summary-highlight-line) | ||
| 10737 | (gnus-run-hooks 'gnus-summary-update-hook)) | 10741 | (gnus-run-hooks 'gnus-summary-update-hook)) |
| 10738 | t) | 10742 | t) |
| 10739 | 10743 | ||
diff --git a/lisp/gnus/mail-source.el b/lisp/gnus/mail-source.el index d3ceb6dfd07..662b999c288 100644 --- a/lisp/gnus/mail-source.el +++ b/lisp/gnus/mail-source.el | |||
| @@ -34,7 +34,7 @@ | |||
| 34 | (require 'cl) | 34 | (require 'cl) |
| 35 | (require 'imap)) | 35 | (require 'imap)) |
| 36 | (autoload 'auth-source-user-or-password "auth-source") | 36 | (autoload 'auth-source-user-or-password "auth-source") |
| 37 | (autoload 'pop3-streaming-movemail "pop3") | 37 | (autoload 'pop3-movemail "pop3") |
| 38 | (autoload 'pop3-get-message-count "pop3") | 38 | (autoload 'pop3-get-message-count "pop3") |
| 39 | (autoload 'nnheader-cancel-timer "nnheader") | 39 | (autoload 'nnheader-cancel-timer "nnheader") |
| 40 | (require 'mm-util) | 40 | (require 'mm-util) |
| @@ -839,11 +839,9 @@ Deleting old (> %s day(s)) incoming mail file `%s'." diff bfile) | |||
| 839 | (if (eq authentication 'apop) 'apop 'pass)) | 839 | (if (eq authentication 'apop) 'apop 'pass)) |
| 840 | (pop3-stream-type stream)) | 840 | (pop3-stream-type stream)) |
| 841 | (if (or debug-on-quit debug-on-error) | 841 | (if (or debug-on-quit debug-on-error) |
| 842 | (save-excursion (pop3-streaming-movemail | 842 | (save-excursion (pop3-movemail mail-source-crash-box)) |
| 843 | mail-source-crash-box)) | ||
| 844 | (condition-case err | 843 | (condition-case err |
| 845 | (save-excursion (pop3-streaming-movemail | 844 | (save-excursion (pop3-movemail mail-source-crash-box)) |
| 846 | mail-source-crash-box)) | ||
| 847 | (error | 845 | (error |
| 848 | ;; We nix out the password in case the error | 846 | ;; We nix out the password in case the error |
| 849 | ;; was because of a wrong password being given. | 847 | ;; was because of a wrong password being given. |
diff --git a/lisp/gnus/nnml.el b/lisp/gnus/nnml.el index 1c9513d2191..6d676bb8514 100644 --- a/lisp/gnus/nnml.el +++ b/lisp/gnus/nnml.el | |||
| @@ -784,7 +784,6 @@ article number. This function is called narrowed to an article." | |||
| 784 | (defvar nnml-incremental-nov-buffer-alist nil) | 784 | (defvar nnml-incremental-nov-buffer-alist nil) |
| 785 | 785 | ||
| 786 | (defun nnml-save-incremental-nov () | 786 | (defun nnml-save-incremental-nov () |
| 787 | (message "nnml saving incremental nov...") | ||
| 788 | (save-excursion | 787 | (save-excursion |
| 789 | (while nnml-incremental-nov-buffer-alist | 788 | (while nnml-incremental-nov-buffer-alist |
| 790 | (when (buffer-name (cdar nnml-incremental-nov-buffer-alist)) | 789 | (when (buffer-name (cdar nnml-incremental-nov-buffer-alist)) |
| @@ -795,8 +794,7 @@ article number. This function is called narrowed to an article." | |||
| 795 | (set-buffer-modified-p nil) | 794 | (set-buffer-modified-p nil) |
| 796 | (kill-buffer (current-buffer))) | 795 | (kill-buffer (current-buffer))) |
| 797 | (setq nnml-incremental-nov-buffer-alist | 796 | (setq nnml-incremental-nov-buffer-alist |
| 798 | (cdr nnml-incremental-nov-buffer-alist)))) | 797 | (cdr nnml-incremental-nov-buffer-alist))))) |
| 799 | (message "nnml saving incremental nov...done")) | ||
| 800 | 798 | ||
| 801 | (defun nnml-open-incremental-nov (group) | 799 | (defun nnml-open-incremental-nov (group) |
| 802 | (or (cdr (assoc group nnml-incremental-nov-buffer-alist)) | 800 | (or (cdr (assoc group nnml-incremental-nov-buffer-alist)) |
| @@ -863,7 +861,6 @@ article number. This function is called narrowed to an article." | |||
| 863 | buffer))) | 861 | buffer))) |
| 864 | 862 | ||
| 865 | (defun nnml-save-nov () | 863 | (defun nnml-save-nov () |
| 866 | (message "nnml saving nov...") | ||
| 867 | (save-excursion | 864 | (save-excursion |
| 868 | (while nnml-nov-buffer-alist | 865 | (while nnml-nov-buffer-alist |
| 869 | (when (buffer-name (cdar nnml-nov-buffer-alist)) | 866 | (when (buffer-name (cdar nnml-nov-buffer-alist)) |
| @@ -873,8 +870,7 @@ article number. This function is called narrowed to an article." | |||
| 873 | nnml-nov-buffer-file-name nil 'nomesg)) | 870 | nnml-nov-buffer-file-name nil 'nomesg)) |
| 874 | (set-buffer-modified-p nil) | 871 | (set-buffer-modified-p nil) |
| 875 | (kill-buffer (current-buffer))) | 872 | (kill-buffer (current-buffer))) |
| 876 | (setq nnml-nov-buffer-alist (cdr nnml-nov-buffer-alist)))) | 873 | (setq nnml-nov-buffer-alist (cdr nnml-nov-buffer-alist))))) |
| 877 | (message "nnml saving nov...done")) | ||
| 878 | 874 | ||
| 879 | ;;;###autoload | 875 | ;;;###autoload |
| 880 | (defun nnml-generate-nov-databases (&optional server) | 876 | (defun nnml-generate-nov-databases (&optional server) |
diff --git a/lisp/gnus/nntp.el b/lisp/gnus/nntp.el index 5373230fd8e..3cdd63084ef 100644 --- a/lisp/gnus/nntp.el +++ b/lisp/gnus/nntp.el | |||
| @@ -1768,7 +1768,7 @@ password contained in '~/.nntp-authinfo'." | |||
| 1768 | (while (and (setq proc (get-buffer-process buf)) | 1768 | (while (and (setq proc (get-buffer-process buf)) |
| 1769 | (memq (process-status proc) '(open run)) | 1769 | (memq (process-status proc) '(open run)) |
| 1770 | (not (re-search-forward regexp nil t))) | 1770 | (not (re-search-forward regexp nil t))) |
| 1771 | (accept-process-output proc) | 1771 | (accept-process-output proc 0.1) |
| 1772 | (set-buffer buf) | 1772 | (set-buffer buf) |
| 1773 | (goto-char (point-min))))) | 1773 | (goto-char (point-min))))) |
| 1774 | 1774 | ||
diff --git a/lisp/gnus/pop3.el b/lisp/gnus/pop3.el index a5470d7d818..4f28dcdca46 100644 --- a/lisp/gnus/pop3.el +++ b/lisp/gnus/pop3.el | |||
| @@ -129,7 +129,8 @@ Shorter values mean quicker response, but are more CPU intensive.") | |||
| 129 | (truncate pop3-read-timeout)) | 129 | (truncate pop3-read-timeout)) |
| 130 | 1000)))))) | 130 | 1000)))))) |
| 131 | 131 | ||
| 132 | (defun pop3-streaming-movemail (file) | 132 | ;;;###autoload |
| 133 | (defun pop3-movemail (file) | ||
| 133 | "Transfer contents of a maildrop to the specified FILE. | 134 | "Transfer contents of a maildrop to the specified FILE. |
| 134 | Use streaming commands." | 135 | Use streaming commands." |
| 135 | (let* ((process (pop3-open-server pop3-mailhost pop3-port)) | 136 | (let* ((process (pop3-open-server pop3-mailhost pop3-port)) |
| @@ -227,44 +228,6 @@ Use streaming commands." | |||
| 227 | (pop3-pass process)) | 228 | (pop3-pass process)) |
| 228 | (t (error "Invalid POP3 authentication scheme"))))) | 229 | (t (error "Invalid POP3 authentication scheme"))))) |
| 229 | 230 | ||
| 230 | (defun pop3-movemail (&optional crashbox) | ||
| 231 | "Transfer contents of a maildrop to the specified CRASHBOX." | ||
| 232 | (or crashbox (setq crashbox (expand-file-name "~/.crashbox"))) | ||
| 233 | (let* ((process (pop3-open-server pop3-mailhost pop3-port)) | ||
| 234 | (crashbuf (get-buffer-create " *pop3-retr*")) | ||
| 235 | (n 1) | ||
| 236 | message-count | ||
| 237 | message-sizes) | ||
| 238 | (pop3-logon process) | ||
| 239 | (setq message-count (car (pop3-stat process))) | ||
| 240 | (when (> message-count 0) | ||
| 241 | (setq message-sizes (pop3-list process))) | ||
| 242 | (unwind-protect | ||
| 243 | (while (<= n message-count) | ||
| 244 | (message "Retrieving message %d of %d from %s... (%.1fk)" | ||
| 245 | n message-count pop3-mailhost | ||
| 246 | (/ (cdr (assoc n message-sizes)) | ||
| 247 | 1024.0)) | ||
| 248 | (pop3-retr process n crashbuf) | ||
| 249 | (save-excursion | ||
| 250 | (set-buffer crashbuf) | ||
| 251 | (let ((coding-system-for-write 'binary)) | ||
| 252 | (write-region (point-min) (point-max) crashbox t 'nomesg)) | ||
| 253 | (set-buffer (process-buffer process)) | ||
| 254 | (erase-buffer)) | ||
| 255 | (unless pop3-leave-mail-on-server | ||
| 256 | (pop3-dele process n)) | ||
| 257 | (setq n (+ 1 n)) | ||
| 258 | (pop3-accept-process-output process)) | ||
| 259 | (when (and pop3-leave-mail-on-server | ||
| 260 | (> n 1)) | ||
| 261 | (message "pop3.el doesn't support UIDL. Setting `pop3-leave-mail-on-server' | ||
| 262 | to %s might not give the result you'd expect." pop3-leave-mail-on-server) | ||
| 263 | (sit-for 1)) | ||
| 264 | (pop3-quit process)) | ||
| 265 | (kill-buffer crashbuf)) | ||
| 266 | t) | ||
| 267 | |||
| 268 | (defun pop3-get-message-count () | 231 | (defun pop3-get-message-count () |
| 269 | "Return the number of messages in the maildrop." | 232 | "Return the number of messages in the maildrop." |
| 270 | (let* ((process (pop3-open-server pop3-mailhost pop3-port)) | 233 | (let* ((process (pop3-open-server pop3-mailhost pop3-port)) |
diff --git a/lisp/gnus/spam-report.el b/lisp/gnus/spam-report.el index 0e4576ae3f5..0e32e934040 100644 --- a/lisp/gnus/spam-report.el +++ b/lisp/gnus/spam-report.el | |||
| @@ -267,7 +267,7 @@ This is initialized based on `user-mail-address'." | |||
| 267 | (gnus-message 7 "Waiting for response from %s..." host) | 267 | (gnus-message 7 "Waiting for response from %s..." host) |
| 268 | (while (and (memq (process-status tcp-connection) '(open run)) | 268 | (while (and (memq (process-status tcp-connection) '(open run)) |
| 269 | (zerop (buffer-size))) | 269 | (zerop (buffer-size))) |
| 270 | (accept-process-output tcp-connection)) | 270 | (accept-process-output tcp-connection 1)) |
| 271 | (gnus-message 7 "Waiting for response from %s... done" host))))) | 271 | (gnus-message 7 "Waiting for response from %s... done" host))))) |
| 272 | 272 | ||
| 273 | ;;;###autoload | 273 | ;;;###autoload |
diff --git a/lisp/image.el b/lisp/image.el index 20e3d5f85aa..2ca2971b4aa 100644 --- a/lisp/image.el +++ b/lisp/image.el | |||
| @@ -697,21 +697,28 @@ shall be displayed." | |||
| 697 | 697 | ||
| 698 | (defcustom imagemagick-types-inhibit | 698 | (defcustom imagemagick-types-inhibit |
| 699 | '(C HTML HTM TXT PDF) | 699 | '(C HTML HTM TXT PDF) |
| 700 | "Types the imagemagick loader should not try to handle.") | 700 | ;; FIXME what are the possible options? |
| 701 | ;; Are these actually file-name extensions? | ||
| 702 | ;; Why are these upper-case when eg image-types is lower-case? | ||
| 703 | "Types the ImageMagick loader should not try to handle." | ||
| 704 | :type '(choice (const :tag "Let ImageMagick handle all the types it can" nil) | ||
| 705 | (repeat symbol)) | ||
| 706 | :version "24.1" | ||
| 707 | :group 'image) | ||
| 701 | 708 | ||
| 702 | ;;;###autoload | 709 | ;;;###autoload |
| 703 | (defun imagemagick-register-types () | 710 | (defun imagemagick-register-types () |
| 704 | "Register file types that imagemagick is able to handle." | 711 | "Register the file types that ImageMagick is able to handle." |
| 705 | (let ((im-types (imagemagick-types))) | 712 | (let ((im-types (imagemagick-types))) |
| 706 | (dolist (im-inhibit imagemagick-types-inhibit) | 713 | (dolist (im-inhibit imagemagick-types-inhibit) |
| 707 | (setq im-types (remove im-inhibit im-types))) | 714 | (setq im-types (remove im-inhibit im-types))) |
| 708 | (dolist (im-type im-types) | 715 | (dolist (im-type im-types) |
| 709 | (let ((extension (downcase (symbol-name im-type)))) | 716 | (let ((extension (downcase (symbol-name im-type)))) |
| 710 | (push | 717 | (push |
| 711 | (cons (concat "\\." extension "\\'") 'image-mode) | 718 | (cons (concat "\\." extension "\\'") 'image-mode) |
| 712 | auto-mode-alist) | 719 | auto-mode-alist) |
| 713 | (push | 720 | (push |
| 714 | (cons (concat "\\." extension "\\'") 'imagemagick) | 721 | (cons (concat "\\." extension "\\'") 'imagemagick) |
| 715 | image-type-file-name-regexps))))) | 722 | image-type-file-name-regexps))))) |
| 716 | 723 | ||
| 717 | 724 | ||
diff --git a/lisp/ldefs-boot.el b/lisp/ldefs-boot.el index ec2a7c3b52c..f7493109d7c 100644 --- a/lisp/ldefs-boot.el +++ b/lisp/ldefs-boot.el | |||
| @@ -10464,7 +10464,6 @@ Turn flymake mode off. | |||
| 10464 | 10464 | ||
| 10465 | ;;;### (autoloads (flyspell-buffer flyspell-region flyspell-mode-off | 10465 | ;;;### (autoloads (flyspell-buffer flyspell-region flyspell-mode-off |
| 10466 | ;;;;;; turn-off-flyspell turn-on-flyspell flyspell-mode flyspell-prog-mode) | 10466 | ;;;;;; turn-off-flyspell turn-on-flyspell flyspell-mode flyspell-prog-mode) |
| 10467 | ;;;;;; "flyspell" "textmodes/flyspell.el" (19370 36541)) | ||
| 10468 | ;;; Generated autoloads from textmodes/flyspell.el | 10467 | ;;; Generated autoloads from textmodes/flyspell.el |
| 10469 | 10468 | ||
| 10470 | (autoload 'flyspell-prog-mode "flyspell" "\ | 10469 | (autoload 'flyspell-prog-mode "flyspell" "\ |
diff --git a/lisp/mail/hashcash.el b/lisp/mail/hashcash.el index a10db0194fc..cc3af11a47d 100644 --- a/lisp/mail/hashcash.el +++ b/lisp/mail/hashcash.el | |||
| @@ -276,7 +276,7 @@ BUFFER defaults to the current buffer." | |||
| 276 | (unless buffer (setq buffer (current-buffer))) | 276 | (unless buffer (setq buffer (current-buffer))) |
| 277 | (let (entry) | 277 | (let (entry) |
| 278 | (while (setq entry (rassq buffer hashcash-process-alist)) | 278 | (while (setq entry (rassq buffer hashcash-process-alist)) |
| 279 | (accept-process-output (car entry))))) | 279 | (accept-process-output (car entry) 1)))) |
| 280 | 280 | ||
| 281 | (defun hashcash-processes-running-p (buffer) | 281 | (defun hashcash-processes-running-p (buffer) |
| 282 | "Return non-nil if hashcash processes in BUFFER are still running." | 282 | "Return non-nil if hashcash processes in BUFFER are still running." |
diff --git a/lisp/net/netrc.el b/lisp/net/netrc.el index 2306927f080..408eca9bac7 100644 --- a/lisp/net/netrc.el +++ b/lisp/net/netrc.el | |||
| @@ -54,12 +54,19 @@ | |||
| 54 | "Netrc configuration." | 54 | "Netrc configuration." |
| 55 | :group 'comm) | 55 | :group 'comm) |
| 56 | 56 | ||
| 57 | (defcustom netrc-file "~/.authinfo" | ||
| 58 | "File where user credentials are stored." | ||
| 59 | :type 'file | ||
| 60 | :group 'netrc) | ||
| 61 | |||
| 57 | (defvar netrc-services-file "/etc/services" | 62 | (defvar netrc-services-file "/etc/services" |
| 58 | "The name of the services file.") | 63 | "The name of the services file.") |
| 59 | 64 | ||
| 60 | (defun netrc-parse (file) | 65 | (defun netrc-parse (&optional file) |
| 61 | (interactive "fFile to Parse: ") | 66 | (interactive "fFile to Parse: ") |
| 62 | "Parse FILE and return a list of all entries in the file." | 67 | "Parse FILE and return a list of all entries in the file." |
| 68 | (unless file | ||
| 69 | (setq file netrc-file)) | ||
| 63 | (if (listp file) | 70 | (if (listp file) |
| 64 | file | 71 | file |
| 65 | (when (file-exists-p file) | 72 | (when (file-exists-p file) |
| @@ -221,6 +228,19 @@ MODE can be \"login\" or \"password\", suitable for passing to | |||
| 221 | (eq type (car (cddr service))))))) | 228 | (eq type (car (cddr service))))))) |
| 222 | (cadr service))) | 229 | (cadr service))) |
| 223 | 230 | ||
| 231 | (defun netrc-credentials (machine &rest ports) | ||
| 232 | "Return a user name/password pair. | ||
| 233 | Port specifications will be prioritised in the order they are | ||
| 234 | listed in the PORTS list." | ||
| 235 | (let ((list (netrc-parse)) | ||
| 236 | found) | ||
| 237 | (while (and ports | ||
| 238 | (not found)) | ||
| 239 | (setq found (netrc-machine list machine (pop ports)))) | ||
| 240 | (when found | ||
| 241 | (list (cdr (assoc "login" found)) | ||
| 242 | (cdr (assoc "password" found)))))) | ||
| 243 | |||
| 224 | (provide 'netrc) | 244 | (provide 'netrc) |
| 225 | 245 | ||
| 226 | ;;; netrc.el ends here | 246 | ;;; netrc.el ends here |
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 9af6057c20c..093892a1100 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el | |||
| @@ -774,42 +774,64 @@ If SILENT is non-nil, do not print the message in any irc buffer." | |||
| 774 | (setq rcirc-input-ring-index (1- rcirc-input-ring-index)) | 774 | (setq rcirc-input-ring-index (1- rcirc-input-ring-index)) |
| 775 | (insert (rcirc-prev-input-string -1)))) | 775 | (insert (rcirc-prev-input-string -1)))) |
| 776 | 776 | ||
| 777 | (defvar rcirc-nick-completions nil) | 777 | (defvar rcirc-server-commands |
| 778 | (defvar rcirc-nick-completion-start-offset nil) | 778 | '("/admin" "/away" "/connect" "/die" "/error" "/info" |
| 779 | 779 | "/invite" "/ison" "/join" "/kick" "/kill" "/links" | |
| 780 | (defun rcirc-complete-nick () | 780 | "/list" "/lusers" "/mode" "/motd" "/names" "/nick" |
| 781 | "Cycle through nick completions from list of nicks in channel." | 781 | "/notice" "/oper" "/part" "/pass" "/ping" "/pong" |
| 782 | "/privmsg" "/quit" "/rehash" "/restart" "/service" "/servlist" | ||
| 783 | "/server" "/squery" "/squit" "/stats" "/summon" "/time" | ||
| 784 | "/topic" "/trace" "/user" "/userhost" "/users" "/version" | ||
| 785 | "/wallops" "/who" "/whois" "/whowas") | ||
| 786 | "A list of user commands by IRC server. | ||
| 787 | The value defaults to RFCs 1459 and 2812.") | ||
| 788 | |||
| 789 | ;; /me and /ctcp are not defined by `defun-rcirc-command'. | ||
| 790 | (defvar rcirc-client-commands '("/me" "/ctcp") | ||
| 791 | "A list of user commands defined by IRC client rcirc. | ||
| 792 | The list is updated automatically by `defun-rcirc-command'.") | ||
| 793 | |||
| 794 | (defun rcirc-completion-at-point () | ||
| 795 | "Function used for `completion-at-point-functions' in `rcirc-mode'." | ||
| 796 | (let* ((beg (save-excursion | ||
| 797 | (if (re-search-backward " " rcirc-prompt-end-marker t) | ||
| 798 | (1+ (point)) | ||
| 799 | rcirc-prompt-end-marker))) | ||
| 800 | (table (if (and (= beg rcirc-prompt-end-marker) | ||
| 801 | (eq (char-after beg) ?/)) | ||
| 802 | (delete-dups | ||
| 803 | (nconc | ||
| 804 | (sort (copy-sequence rcirc-client-commands) 'string-lessp) | ||
| 805 | (sort (copy-sequence rcirc-server-commands) 'string-lessp))) | ||
| 806 | (rcirc-channel-nicks (rcirc-buffer-process) rcirc-target)))) | ||
| 807 | (list beg (point) table))) | ||
| 808 | |||
| 809 | (defvar rcirc-completions nil) | ||
| 810 | (defvar rcirc-completion-start nil) | ||
| 811 | |||
| 812 | (defun rcirc-complete () | ||
| 813 | "Cycle through completions from list of nicks in channel or IRC commands. | ||
| 814 | IRC command completion is performed only if '/' is the first input char." | ||
| 782 | (interactive) | 815 | (interactive) |
| 783 | (if (eq last-command this-command) | 816 | (if (eq last-command this-command) |
| 784 | (setq rcirc-nick-completions | 817 | (setq rcirc-completions |
| 785 | (append (cdr rcirc-nick-completions) | 818 | (append (cdr rcirc-completions) (list (car rcirc-completions)))) |
| 786 | (list (car rcirc-nick-completions)))) | 819 | (let ((completion-ignore-case t) |
| 787 | (setq rcirc-nick-completion-start-offset | 820 | (table (rcirc-completion-at-point))) |
| 788 | (- (save-excursion | 821 | (setq rcirc-completion-start (car table)) |
| 789 | (if (re-search-backward " " rcirc-prompt-end-marker t) | 822 | (setq rcirc-completions |
| 790 | (1+ (point)) | 823 | (all-completions (buffer-substring rcirc-completion-start |
| 791 | rcirc-prompt-end-marker)) | 824 | (cadr table)) |
| 792 | rcirc-prompt-end-marker)) | 825 | (nth 2 table))))) |
| 793 | (setq rcirc-nick-completions | 826 | (let ((completion (car rcirc-completions))) |
| 794 | (let ((completion-ignore-case t)) | ||
| 795 | (all-completions | ||
| 796 | (buffer-substring | ||
| 797 | (+ rcirc-prompt-end-marker | ||
| 798 | rcirc-nick-completion-start-offset) | ||
| 799 | (point)) | ||
| 800 | (mapcar (lambda (x) (cons x nil)) | ||
| 801 | (rcirc-channel-nicks (rcirc-buffer-process) | ||
| 802 | rcirc-target)))))) | ||
| 803 | (let ((completion (car rcirc-nick-completions))) | ||
| 804 | (when completion | 827 | (when completion |
| 805 | (delete-region (+ rcirc-prompt-end-marker | 828 | (delete-region rcirc-completion-start (point)) |
| 806 | rcirc-nick-completion-start-offset) | 829 | (insert |
| 807 | (point)) | 830 | (concat completion |
| 808 | (insert (concat completion | 831 | (cond |
| 809 | (if (= (+ rcirc-prompt-end-marker | 832 | ((= (aref completion 0) ?/) " ") |
| 810 | rcirc-nick-completion-start-offset) | 833 | ((= rcirc-completion-start rcirc-prompt-end-marker) ": ") |
| 811 | rcirc-prompt-end-marker) | 834 | (t ""))))))) |
| 812 | ": ")))))) | ||
| 813 | 835 | ||
| 814 | (defun set-rcirc-decode-coding-system (coding-system) | 836 | (defun set-rcirc-decode-coding-system (coding-system) |
| 815 | "Set the decode coding system used in this channel." | 837 | "Set the decode coding system used in this channel." |
| @@ -827,7 +849,7 @@ If SILENT is non-nil, do not print the message in any irc buffer." | |||
| 827 | (define-key rcirc-mode-map (kbd "RET") 'rcirc-send-input) | 849 | (define-key rcirc-mode-map (kbd "RET") 'rcirc-send-input) |
| 828 | (define-key rcirc-mode-map (kbd "M-p") 'rcirc-insert-prev-input) | 850 | (define-key rcirc-mode-map (kbd "M-p") 'rcirc-insert-prev-input) |
| 829 | (define-key rcirc-mode-map (kbd "M-n") 'rcirc-insert-next-input) | 851 | (define-key rcirc-mode-map (kbd "M-n") 'rcirc-insert-next-input) |
| 830 | (define-key rcirc-mode-map (kbd "TAB") 'rcirc-complete-nick) | 852 | (define-key rcirc-mode-map (kbd "TAB") 'rcirc-complete) |
| 831 | (define-key rcirc-mode-map (kbd "C-c C-b") 'rcirc-browse-url) | 853 | (define-key rcirc-mode-map (kbd "C-c C-b") 'rcirc-browse-url) |
| 832 | (define-key rcirc-mode-map (kbd "C-c C-c") 'rcirc-edit-multiline) | 854 | (define-key rcirc-mode-map (kbd "C-c C-c") 'rcirc-edit-multiline) |
| 833 | (define-key rcirc-mode-map (kbd "C-c C-j") 'rcirc-cmd-join) | 855 | (define-key rcirc-mode-map (kbd "C-c C-j") 'rcirc-cmd-join) |
| @@ -948,6 +970,9 @@ This number is independent of the number of lines in the buffer.") | |||
| 948 | rcirc-buffer-alist)))) | 970 | rcirc-buffer-alist)))) |
| 949 | (rcirc-update-short-buffer-names)) | 971 | (rcirc-update-short-buffer-names)) |
| 950 | 972 | ||
| 973 | (add-hook 'completion-at-point-functions | ||
| 974 | 'rcirc-completion-at-point nil 'local) | ||
| 975 | |||
| 951 | (run-hooks 'rcirc-mode-hook)) | 976 | (run-hooks 'rcirc-mode-hook)) |
| 952 | 977 | ||
| 953 | (defun rcirc-update-prompt (&optional all) | 978 | (defun rcirc-update-prompt (&optional all) |
| @@ -2004,16 +2029,18 @@ activity. Only run if the buffer is not visible and | |||
| 2004 | ;; containing the text following the /cmd. | 2029 | ;; containing the text following the /cmd. |
| 2005 | 2030 | ||
| 2006 | (defmacro defun-rcirc-command (command argument docstring interactive-form | 2031 | (defmacro defun-rcirc-command (command argument docstring interactive-form |
| 2007 | &rest body) | 2032 | &rest body) |
| 2008 | "Define a command." | 2033 | "Define a command." |
| 2009 | `(defun ,(intern (concat "rcirc-cmd-" (symbol-name command))) | 2034 | `(progn |
| 2010 | (,@argument &optional process target) | 2035 | (add-to-list 'rcirc-client-commands ,(concat "/" (symbol-name command))) |
| 2011 | ,(concat docstring "\n\nNote: If PROCESS or TARGET are nil, the values given" | 2036 | (defun ,(intern (concat "rcirc-cmd-" (symbol-name command))) |
| 2012 | "\nby `rcirc-buffer-process' and `rcirc-target' will be used.") | 2037 | (,@argument &optional process target) |
| 2013 | ,interactive-form | 2038 | ,(concat docstring "\n\nNote: If PROCESS or TARGET are nil, the values given" |
| 2014 | (let ((process (or process (rcirc-buffer-process))) | 2039 | "\nby `rcirc-buffer-process' and `rcirc-target' will be used.") |
| 2015 | (target (or target rcirc-target))) | 2040 | ,interactive-form |
| 2016 | ,@body))) | 2041 | (let ((process (or process (rcirc-buffer-process))) |
| 2042 | (target (or target rcirc-target))) | ||
| 2043 | ,@body)))) | ||
| 2017 | 2044 | ||
| 2018 | (defun-rcirc-command msg (message) | 2045 | (defun-rcirc-command msg (message) |
| 2019 | "Send private MESSAGE to TARGET." | 2046 | "Send private MESSAGE to TARGET." |
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el index 9c8ab4cb017..8241c048827 100644 --- a/lisp/net/tramp-cache.el +++ b/lisp/net/tramp-cache.el | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | (setq tramp-version 24) | ||
| 2 | |||
| 1 | ;;; tramp-cache.el --- file information caching for Tramp | 3 | ;;; tramp-cache.el --- file information caching for Tramp |
| 2 | 4 | ||
| 3 | ;; Copyright (C) 2000, 2005, 2006, 2007, 2008, 2009, | 5 | ;; Copyright (C) 2000, 2005, 2006, 2007, 2008, 2009, |
| @@ -50,24 +52,14 @@ | |||
| 50 | 52 | ||
| 51 | ;;; Code: | 53 | ;;; Code: |
| 52 | 54 | ||
| 53 | ;; Pacify byte-compiler. | 55 | (require 'tramp) |
| 54 | (eval-when-compile | 56 | ; bob, 2010 Sep 11 |
| 55 | (require 'cl) | 57 | ; (require 'trampver.el) |
| 56 | (autoload 'tramp-message "tramp") | 58 | (autoload 'time-stamp-string "time-stamp") |
| 57 | (autoload 'tramp-tramp-file-p "tramp") | ||
| 58 | ;; We cannot autoload macro `with-parsed-tramp-file-name', it | ||
| 59 | ;; results in problems of byte-compiled code. | ||
| 60 | (autoload 'tramp-dissect-file-name "tramp") | ||
| 61 | (autoload 'tramp-file-name-method "tramp") | ||
| 62 | (autoload 'tramp-file-name-user "tramp") | ||
| 63 | (autoload 'tramp-file-name-host "tramp") | ||
| 64 | (autoload 'tramp-file-name-localname "tramp") | ||
| 65 | (autoload 'tramp-run-real-handler "tramp") | ||
| 66 | (autoload 'tramp-time-less-p "tramp") | ||
| 67 | (autoload 'time-stamp-string "time-stamp")) | ||
| 68 | 59 | ||
| 69 | ;;; -- Cache -- | 60 | ;;; -- Cache -- |
| 70 | 61 | ||
| 62 | ;;;###tramp-autoload | ||
| 71 | (defvar tramp-cache-data (make-hash-table :test 'equal) | 63 | (defvar tramp-cache-data (make-hash-table :test 'equal) |
| 72 | "Hash table for remote files properties.") | 64 | "Hash table for remote files properties.") |
| 73 | 65 | ||
| @@ -103,6 +95,7 @@ time.") | |||
| 103 | (defvar tramp-cache-data-changed nil | 95 | (defvar tramp-cache-data-changed nil |
| 104 | "Whether persistent cache data have been changed.") | 96 | "Whether persistent cache data have been changed.") |
| 105 | 97 | ||
| 98 | ;;;###tramp-autoload | ||
| 106 | (defun tramp-get-file-property (vec file property default) | 99 | (defun tramp-get-file-property (vec file property default) |
| 107 | "Get the PROPERTY of FILE from the cache context of VEC. | 100 | "Get the PROPERTY of FILE from the cache context of VEC. |
| 108 | Returns DEFAULT if not set." | 101 | Returns DEFAULT if not set." |
| @@ -130,6 +123,7 @@ Returns DEFAULT if not set." | |||
| 130 | (tramp-message vec 8 "%s %s %s" file property value) | 123 | (tramp-message vec 8 "%s %s %s" file property value) |
| 131 | value)) | 124 | value)) |
| 132 | 125 | ||
| 126 | ;;;###tramp-autoload | ||
| 133 | (defun tramp-set-file-property (vec file property value) | 127 | (defun tramp-set-file-property (vec file property value) |
| 134 | "Set the PROPERTY of FILE to VALUE, in the cache context of VEC. | 128 | "Set the PROPERTY of FILE to VALUE, in the cache context of VEC. |
| 135 | Returns VALUE." | 129 | Returns VALUE." |
| @@ -144,6 +138,26 @@ Returns VALUE." | |||
| 144 | (tramp-message vec 8 "%s %s %s" file property value) | 138 | (tramp-message vec 8 "%s %s %s" file property value) |
| 145 | value)) | 139 | value)) |
| 146 | 140 | ||
| 141 | ;;;###tramp-autoload | ||
| 142 | (defmacro with-file-property (vec file property &rest body) | ||
| 143 | "Check in Tramp cache for PROPERTY, otherwise execute BODY and set cache. | ||
| 144 | FILE must be a local file name on a connection identified via VEC." | ||
| 145 | `(if (file-name-absolute-p ,file) | ||
| 146 | (let ((value (tramp-get-file-property ,vec ,file ,property 'undef))) | ||
| 147 | (when (eq value 'undef) | ||
| 148 | ;; We cannot pass @body as parameter to | ||
| 149 | ;; `tramp-set-file-property' because it mangles our | ||
| 150 | ;; debug messages. | ||
| 151 | (setq value (progn ,@body)) | ||
| 152 | (tramp-set-file-property ,vec ,file ,property value)) | ||
| 153 | value) | ||
| 154 | ,@body)) | ||
| 155 | |||
| 156 | (put 'with-file-property 'lisp-indent-function 3) | ||
| 157 | (put 'with-file-property 'edebug-form-spec t) | ||
| 158 | (font-lock-add-keywords 'emacs-lisp-mode '("\\<with-file-property\\>")) | ||
| 159 | |||
| 160 | ;;;###tramp-autoload | ||
| 147 | (defun tramp-flush-file-property (vec file) | 161 | (defun tramp-flush-file-property (vec file) |
| 148 | "Remove all properties of FILE in the cache context of VEC." | 162 | "Remove all properties of FILE in the cache context of VEC." |
| 149 | ;; Unify localname. | 163 | ;; Unify localname. |
| @@ -152,6 +166,7 @@ Returns VALUE." | |||
| 152 | (tramp-message vec 8 "%s" file) | 166 | (tramp-message vec 8 "%s" file) |
| 153 | (remhash vec tramp-cache-data)) | 167 | (remhash vec tramp-cache-data)) |
| 154 | 168 | ||
| 169 | ;;;###tramp-autoload | ||
| 155 | (defun tramp-flush-directory-property (vec directory) | 170 | (defun tramp-flush-directory-property (vec directory) |
| 156 | "Remove all properties of DIRECTORY in the cache context of VEC. | 171 | "Remove all properties of DIRECTORY in the cache context of VEC. |
| 157 | Remove also properties of all files in subdirectories." | 172 | Remove also properties of all files in subdirectories." |
| @@ -175,8 +190,7 @@ Remove also properties of all files in subdirectories." | |||
| 175 | (buffer-file-name) | 190 | (buffer-file-name) |
| 176 | default-directory))) | 191 | default-directory))) |
| 177 | (when (tramp-tramp-file-p bfn) | 192 | (when (tramp-tramp-file-p bfn) |
| 178 | (let* ((v (tramp-dissect-file-name bfn)) | 193 | (with-parsed-tramp-file-name bfn nil |
| 179 | (localname (tramp-file-name-localname v))) | ||
| 180 | (tramp-flush-file-property v localname))))) | 194 | (tramp-flush-file-property v localname))))) |
| 181 | 195 | ||
| 182 | (add-hook 'before-revert-hook 'tramp-flush-file-function) | 196 | (add-hook 'before-revert-hook 'tramp-flush-file-function) |
| @@ -193,6 +207,7 @@ Remove also properties of all files in subdirectories." | |||
| 193 | 207 | ||
| 194 | ;;; -- Properties -- | 208 | ;;; -- Properties -- |
| 195 | 209 | ||
| 210 | ;;;###tramp-autoload | ||
| 196 | (defun tramp-get-connection-property (key property default) | 211 | (defun tramp-get-connection-property (key property default) |
| 197 | "Get the named PROPERTY for the connection. | 212 | "Get the named PROPERTY for the connection. |
| 198 | KEY identifies the connection, it is either a process or a vector. | 213 | KEY identifies the connection, it is either a process or a vector. |
| @@ -209,6 +224,7 @@ If the value is not set for the connection, returns DEFAULT." | |||
| 209 | (tramp-message key 7 "%s %s" property value) | 224 | (tramp-message key 7 "%s %s" property value) |
| 210 | value)) | 225 | value)) |
| 211 | 226 | ||
| 227 | ;;;###tramp-autoload | ||
| 212 | (defun tramp-set-connection-property (key property value) | 228 | (defun tramp-set-connection-property (key property value) |
| 213 | "Set the named PROPERTY of a connection to VALUE. | 229 | "Set the named PROPERTY of a connection to VALUE. |
| 214 | KEY identifies the connection, it is either a process or a vector. | 230 | KEY identifies the connection, it is either a process or a vector. |
| @@ -231,6 +247,23 @@ PROPERTY is set persistent when KEY is a vector." | |||
| 231 | (error nil)) | 247 | (error nil)) |
| 232 | value)) | 248 | value)) |
| 233 | 249 | ||
| 250 | ;;;###tramp-autoload | ||
| 251 | (defmacro with-connection-property (key property &rest body) | ||
| 252 | "Check in Tramp for property PROPERTY, otherwise executes BODY and set." | ||
| 253 | `(let ((value (tramp-get-connection-property ,key ,property 'undef))) | ||
| 254 | (when (eq value 'undef) | ||
| 255 | ;; We cannot pass ,@body as parameter to | ||
| 256 | ;; `tramp-set-connection-property' because it mangles our debug | ||
| 257 | ;; messages. | ||
| 258 | (setq value (progn ,@body)) | ||
| 259 | (tramp-set-connection-property ,key ,property value)) | ||
| 260 | value)) | ||
| 261 | |||
| 262 | (put 'with-connection-property 'lisp-indent-function 2) | ||
| 263 | (put 'with-connection-property 'edebug-form-spec t) | ||
| 264 | (font-lock-add-keywords 'emacs-lisp-mode '("\\<with-connection-property\\>")) | ||
| 265 | |||
| 266 | ;;;###tramp-autoload | ||
| 234 | (defun tramp-flush-connection-property (key) | 267 | (defun tramp-flush-connection-property (key) |
| 235 | "Remove all properties identified by KEY. | 268 | "Remove all properties identified by KEY. |
| 236 | KEY identifies the connection, it is either a process or a vector." | 269 | KEY identifies the connection, it is either a process or a vector." |
| @@ -251,6 +284,7 @@ KEY identifies the connection, it is either a process or a vector." | |||
| 251 | (setq tramp-cache-data-changed t) | 284 | (setq tramp-cache-data-changed t) |
| 252 | (remhash key tramp-cache-data)) | 285 | (remhash key tramp-cache-data)) |
| 253 | 286 | ||
| 287 | ;;;###tramp-autoload | ||
| 254 | (defun tramp-cache-print (table) | 288 | (defun tramp-cache-print (table) |
| 255 | "Print hash table TABLE." | 289 | "Print hash table TABLE." |
| 256 | (when (hash-table-p table) | 290 | (when (hash-table-p table) |
| @@ -271,6 +305,7 @@ KEY identifies the connection, it is either a process or a vector." | |||
| 271 | table) | 305 | table) |
| 272 | result))) | 306 | result))) |
| 273 | 307 | ||
| 308 | ;;;###tramp-autoload | ||
| 274 | (defun tramp-list-connections () | 309 | (defun tramp-list-connections () |
| 275 | "Return a list of all known connection vectors according to `tramp-cache'." | 310 | "Return a list of all known connection vectors according to `tramp-cache'." |
| 276 | (let (result) | 311 | (let (result) |
| @@ -326,6 +361,7 @@ KEY identifies the connection, it is either a process or a vector." | |||
| 326 | (remove-hook 'kill-emacs-hook | 361 | (remove-hook 'kill-emacs-hook |
| 327 | 'tramp-dump-connection-properties))) | 362 | 'tramp-dump-connection-properties))) |
| 328 | 363 | ||
| 364 | ;;;###tramp-autoload | ||
| 329 | (defun tramp-parse-connection-properties (method) | 365 | (defun tramp-parse-connection-properties (method) |
| 330 | "Return a list of (user host) tuples allowed to access for METHOD. | 366 | "Return a list of (user host) tuples allowed to access for METHOD. |
| 331 | This function is added always in `tramp-get-completion-function' | 367 | This function is added always in `tramp-get-completion-function' |
| @@ -364,6 +400,10 @@ for all methods. Resulting data are derived from connection history." | |||
| 364 | tramp-persistency-file-name (error-message-string err)) | 400 | tramp-persistency-file-name (error-message-string err)) |
| 365 | (clrhash tramp-cache-data)))) | 401 | (clrhash tramp-cache-data)))) |
| 366 | 402 | ||
| 403 | (add-hook 'tramp-unload-hook | ||
| 404 | (lambda () | ||
| 405 | (unload-feature 'tramp-cache 'force))) | ||
| 406 | |||
| 367 | (provide 'tramp-cache) | 407 | (provide 'tramp-cache) |
| 368 | 408 | ||
| 369 | ;; arch-tag: ee1739b7-7628-408c-9b96-d11a74b05d26 | 409 | ;; arch-tag: ee1739b7-7628-408c-9b96-d11a74b05d26 |
diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el index c3243083695..32cbb16b9e8 100644 --- a/lisp/net/tramp-cmds.el +++ b/lisp/net/tramp-cmds.el | |||
| @@ -129,6 +129,7 @@ This includes password cache, file cache, connection cache, buffers." | |||
| 129 | 129 | ||
| 130 | ;; Tramp version is useful in a number of situations. | 130 | ;; Tramp version is useful in a number of situations. |
| 131 | 131 | ||
| 132 | ;;;###tramp-autoload | ||
| 132 | (defun tramp-version (arg) | 133 | (defun tramp-version (arg) |
| 133 | "Print version number of tramp.el in minibuffer or current buffer." | 134 | "Print version number of tramp.el in minibuffer or current buffer." |
| 134 | (interactive "P") | 135 | (interactive "P") |
| @@ -387,6 +388,9 @@ please ensure that the buffers are attached to your email.\n\n") | |||
| 387 | 388 | ||
| 388 | (defalias 'tramp-submit-bug 'tramp-bug) | 389 | (defalias 'tramp-submit-bug 'tramp-bug) |
| 389 | 390 | ||
| 391 | (add-hook 'tramp-unload-hook | ||
| 392 | (lambda () (unload-feature 'tramp-cmds 'force))) | ||
| 393 | |||
| 390 | (provide 'tramp-cmds) | 394 | (provide 'tramp-cmds) |
| 391 | 395 | ||
| 392 | ;;; TODO: | 396 | ;;; TODO: |
| @@ -395,7 +399,7 @@ please ensure that the buffers are attached to your email.\n\n") | |||
| 395 | ;; * WIBNI there was an interactive command prompting for Tramp | 399 | ;; * WIBNI there was an interactive command prompting for Tramp |
| 396 | ;; method, hostname, username and filename and translates the user | 400 | ;; method, hostname, username and filename and translates the user |
| 397 | ;; input into the correct filename syntax (depending on the Emacs | 401 | ;; input into the correct filename syntax (depending on the Emacs |
| 398 | ;; flavor) (Reiner Steib) | 402 | ;; flavor) (Reiner Steib) |
| 399 | ;; * Let the user edit the connection properties interactively. | 403 | ;; * Let the user edit the connection properties interactively. |
| 400 | ;; Something like `gnus-server-edit-server' in Gnus' *Server* buffer. | 404 | ;; Something like `gnus-server-edit-server' in Gnus' *Server* buffer. |
| 401 | ;; * It's just that when I come to Customize `tramp-default-user-alist' | 405 | ;; * It's just that when I come to Customize `tramp-default-user-alist' |
| @@ -404,7 +408,7 @@ please ensure that the buffers are attached to your email.\n\n") | |||
| 404 | ;; Option and should not be modified by the code. add-to-list is | 408 | ;; Option and should not be modified by the code. add-to-list is |
| 405 | ;; called in several places. One way to handle that is to have a new | 409 | ;; called in several places. One way to handle that is to have a new |
| 406 | ;; ordinary variable that gets its initial value from | 410 | ;; ordinary variable that gets its initial value from |
| 407 | ;; tramp-default-user-alist and then is added to. (Pete Forman) | 411 | ;; tramp-default-user-alist and then is added to. (Pete Forman) |
| 408 | 412 | ||
| 409 | ;; arch-tag: 190d4c33-76bb-4e99-8b6f-71741f23d98c | 413 | ;; arch-tag: 190d4c33-76bb-4e99-8b6f-71741f23d98c |
| 410 | ;;; tramp-cmds.el ends here | 414 | ;;; tramp-cmds.el ends here |
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index 92ad7811189..d5884574cb0 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el | |||
| @@ -31,6 +31,10 @@ | |||
| 31 | 31 | ||
| 32 | (eval-when-compile | 32 | (eval-when-compile |
| 33 | 33 | ||
| 34 | (require 'tramp-loaddefs)) | ||
| 35 | |||
| 36 | (eval-when-compile | ||
| 37 | |||
| 34 | ;; Pacify byte-compiler. | 38 | ;; Pacify byte-compiler. |
| 35 | (require 'cl)) | 39 | (require 'cl)) |
| 36 | 40 | ||
| @@ -43,33 +47,20 @@ | |||
| 43 | (require 'timer-funcs) | 47 | (require 'timer-funcs) |
| 44 | (require 'timer)) | 48 | (require 'timer)) |
| 45 | 49 | ||
| 46 | (autoload 'tramp-tramp-file-p "tramp") | ||
| 47 | (autoload 'tramp-file-name-handler "tramp") | ||
| 48 | |||
| 49 | ;; We check whether `start-file-process' is bound. | 50 | ;; We check whether `start-file-process' is bound. |
| 50 | (unless (fboundp 'start-file-process) | 51 | (unless (fboundp 'start-file-process) |
| 51 | 52 | ||
| 52 | ;; tramp-util offers integration into other (X)Emacs packages like | 53 | ;; tramp-util offers integration into other (X)Emacs packages like |
| 53 | ;; compile.el, gud.el etc. Not necessary in Emacs 23. | 54 | ;; compile.el, gud.el etc. Not necessary in Emacs 23. |
| 54 | (eval-after-load "tramp" | 55 | (eval-after-load "tramp" |
| 55 | '(progn | 56 | '(require 'tramp-util)) |
| 56 | (require 'tramp-util) | ||
| 57 | (add-hook 'tramp-unload-hook | ||
| 58 | '(lambda () | ||
| 59 | (when (featurep 'tramp-util) | ||
| 60 | (unload-feature 'tramp-util 'force)))))) | ||
| 61 | 57 | ||
| 62 | ;; Make sure that we get integration with the VC package. When it | 58 | ;; Make sure that we get integration with the VC package. When it |
| 63 | ;; is loaded, we need to pull in the integration module. Not | 59 | ;; is loaded, we need to pull in the integration module. Not |
| 64 | ;; necessary in Emacs 23. | 60 | ;; necessary in Emacs 23. |
| 65 | (eval-after-load "vc" | 61 | (eval-after-load "vc" |
| 66 | (eval-after-load "tramp" | 62 | (eval-after-load "tramp" |
| 67 | '(progn | 63 | '(require 'tramp-vc)))) |
| 68 | (require 'tramp-vc) | ||
| 69 | (add-hook 'tramp-unload-hook | ||
| 70 | '(lambda () | ||
| 71 | (when (featurep 'tramp-vc) | ||
| 72 | (unload-feature 'tramp-vc 'force)))))))) | ||
| 73 | 64 | ||
| 74 | ;; Avoid byte-compiler warnings if the byte-compiler supports this. | 65 | ;; Avoid byte-compiler warnings if the byte-compiler supports this. |
| 75 | ;; Currently, XEmacs supports this. | 66 | ;; Currently, XEmacs supports this. |
| @@ -263,6 +254,24 @@ Add the extension of FILENAME, if existing." | |||
| 263 | ;; Default value in XEmacs. | 254 | ;; Default value in XEmacs. |
| 264 | (t 134217727))) | 255 | (t 134217727))) |
| 265 | 256 | ||
| 257 | (defun tramp-compat-decimal-to-octal (i) | ||
| 258 | "Return a string consisting of the octal digits of I. | ||
| 259 | Not actually used. Use `(format \"%o\" i)' instead?" | ||
| 260 | (cond ((< i 0) (error "Cannot convert negative number to octal")) | ||
| 261 | ((not (integerp i)) (error "Cannot convert non-integer to octal")) | ||
| 262 | ((zerop i) "0") | ||
| 263 | (t (concat (tramp-compat-decimal-to-octal (/ i 8)) | ||
| 264 | (number-to-string (% i 8)))))) | ||
| 265 | |||
| 266 | ;; Kudos to Gerd Moellmann for this suggestion. | ||
| 267 | (defun tramp-compat-octal-to-decimal (ostr) | ||
| 268 | "Given a string of octal digits, return a decimal number." | ||
| 269 | (let ((x (or ostr ""))) | ||
| 270 | ;; `save-match' is in `tramp-mode-string-to-int' which calls this. | ||
| 271 | (unless (string-match "\\`[0-7]*\\'" x) | ||
| 272 | (error "Non-octal junk in string `%s'" x)) | ||
| 273 | (string-to-number ostr 8))) | ||
| 274 | |||
| 266 | ;; ID-FORMAT does not exists in XEmacs. | 275 | ;; ID-FORMAT does not exists in XEmacs. |
| 267 | (defun tramp-compat-file-attributes (filename &optional id-format) | 276 | (defun tramp-compat-file-attributes (filename &optional id-format) |
| 268 | "Like `file-attributes' for Tramp files (compat function)." | 277 | "Like `file-attributes' for Tramp files (compat function)." |
| @@ -397,6 +406,20 @@ This is, the first, empty, element is omitted. In XEmacs, the first | |||
| 397 | element is not omitted." | 406 | element is not omitted." |
| 398 | (delete "" (split-string string pattern))) | 407 | (delete "" (split-string string pattern))) |
| 399 | 408 | ||
| 409 | (defun tramp-compat-call-process | ||
| 410 | (program &optional infile destination display &rest args) | ||
| 411 | "Calls `call-process' on the local host. | ||
| 412 | This is needed because for some Emacs flavors Tramp has | ||
| 413 | defadviced `call-process' to behave like `process-file'. The | ||
| 414 | Lisp error raised when PROGRAM is nil is trapped also, returning 1." | ||
| 415 | (let ((default-directory | ||
| 416 | (if (file-remote-p default-directory) | ||
| 417 | (tramp-compat-temporary-file-directory) | ||
| 418 | default-directory))) | ||
| 419 | (if (executable-find program) | ||
| 420 | (apply 'call-process program infile destination display args) | ||
| 421 | 1))) | ||
| 422 | |||
| 400 | (defun tramp-compat-process-running-p (process-name) | 423 | (defun tramp-compat-process-running-p (process-name) |
| 401 | "Returns `t' if system process PROCESS-NAME is running for `user-login-name'." | 424 | "Returns `t' if system process PROCESS-NAME is running for `user-login-name'." |
| 402 | (when (stringp process-name) | 425 | (when (stringp process-name) |
| @@ -439,6 +462,10 @@ element is not omitted." | |||
| 439 | (setenv "UNIX95" unix95) | 462 | (setenv "UNIX95" unix95) |
| 440 | result))))) | 463 | result))))) |
| 441 | 464 | ||
| 465 | (add-hook 'tramp-unload-hook | ||
| 466 | (lambda () | ||
| 467 | (unload-feature 'tramp-compat 'force))) | ||
| 468 | |||
| 442 | (provide 'tramp-compat) | 469 | (provide 'tramp-compat) |
| 443 | 470 | ||
| 444 | ;;; TODO: | 471 | ;;; TODO: |
diff --git a/lisp/net/tramp-fish.el b/lisp/net/tramp-fish.el index 81dea724dd6..e5d0ffd3366 100644 --- a/lisp/net/tramp-fish.el +++ b/lisp/net/tramp-fish.el | |||
| @@ -157,16 +157,14 @@ | |||
| 157 | (require 'cl)) | 157 | (require 'cl)) |
| 158 | 158 | ||
| 159 | (require 'tramp) | 159 | (require 'tramp) |
| 160 | (require 'tramp-cache) | ||
| 161 | (require 'tramp-compat) | ||
| 162 | 160 | ||
| 163 | ;; Define FISH method ... | 161 | ;; Define FISH method ... |
| 164 | (defcustom tramp-fish-method "fish" | 162 | ;;;###tramp-autoload |
| 165 | "*Method to connect via FISH protocol." | 163 | (defconst tramp-fish-method "fish" |
| 166 | :group 'tramp | 164 | "*Method to connect via FISH protocol.") |
| 167 | :type 'string) | ||
| 168 | 165 | ||
| 169 | ;; ... and add it to the method list. | 166 | ;; ... and add it to the method list. |
| 167 | ;;;###tramp-autoload | ||
| 170 | (add-to-list 'tramp-methods (cons tramp-fish-method nil)) | 168 | (add-to-list 'tramp-methods (cons tramp-fish-method nil)) |
| 171 | 169 | ||
| 172 | ;; Add a default for `tramp-default-user-alist'. Default is the local user. | 170 | ;; Add a default for `tramp-default-user-alist'. Default is the local user. |
| @@ -264,11 +262,13 @@ Used instead of analyzing error codes of commands.") | |||
| 264 | "Alist of handler functions for Tramp FISH method. | 262 | "Alist of handler functions for Tramp FISH method. |
| 265 | Operations not mentioned here will be handled by the default Emacs primitives.") | 263 | Operations not mentioned here will be handled by the default Emacs primitives.") |
| 266 | 264 | ||
| 267 | (defun tramp-fish-file-name-p (filename) | 265 | ;;;###tramp-autoload |
| 266 | (defsubst tramp-fish-file-name-p (filename) | ||
| 268 | "Check if it's a filename for FISH protocol." | 267 | "Check if it's a filename for FISH protocol." |
| 269 | (let ((v (tramp-dissect-file-name filename))) | 268 | (let ((v (tramp-dissect-file-name filename))) |
| 270 | (string= (tramp-file-name-method v) tramp-fish-method))) | 269 | (string= (tramp-file-name-method v) tramp-fish-method))) |
| 271 | 270 | ||
| 271 | ;;;###tramp-autoload | ||
| 272 | (defun tramp-fish-file-name-handler (operation &rest args) | 272 | (defun tramp-fish-file-name-handler (operation &rest args) |
| 273 | "Invoke the FISH related OPERATION. | 273 | "Invoke the FISH related OPERATION. |
| 274 | First arg specifies the OPERATION, second arg is a list of arguments to | 274 | First arg specifies the OPERATION, second arg is a list of arguments to |
| @@ -278,6 +278,7 @@ pass to the OPERATION." | |||
| 278 | (save-match-data (apply (cdr fn) args)) | 278 | (save-match-data (apply (cdr fn) args)) |
| 279 | (tramp-run-real-handler operation args)))) | 279 | (tramp-run-real-handler operation args)))) |
| 280 | 280 | ||
| 281 | ;;;###tramp-autoload | ||
| 281 | (add-to-list 'tramp-foreign-file-name-handler-alist | 282 | (add-to-list 'tramp-foreign-file-name-handler-alist |
| 282 | (cons 'tramp-fish-file-name-p 'tramp-fish-file-name-handler)) | 283 | (cons 'tramp-fish-file-name-p 'tramp-fish-file-name-handler)) |
| 283 | 284 | ||
| @@ -688,7 +689,7 @@ target of the symlink differ." | |||
| 688 | (tramp-flush-file-property v localname) | 689 | (tramp-flush-file-property v localname) |
| 689 | (unless (tramp-fish-send-command-and-check | 690 | (unless (tramp-fish-send-command-and-check |
| 690 | v (format "#CHMOD %s %s" | 691 | v (format "#CHMOD %s %s" |
| 691 | (tramp-decimal-to-octal mode) | 692 | (tramp-compat-decimal-to-octal mode) |
| 692 | (tramp-shell-quote-argument localname))) | 693 | (tramp-shell-quote-argument localname))) |
| 693 | (tramp-error | 694 | (tramp-error |
| 694 | v 'file-error "Error while changing file's mode %s" filename)))) | 695 | v 'file-error "Error while changing file's mode %s" filename)))) |
| @@ -1170,6 +1171,10 @@ Returns nil if there has been an error message." | |||
| 1170 | (goto-char (point-min)) | 1171 | (goto-char (point-min)) |
| 1171 | (looking-at tramp-fish-ok-prompt-regexp))) | 1172 | (looking-at tramp-fish-ok-prompt-regexp))) |
| 1172 | 1173 | ||
| 1174 | (add-hook 'tramp-unload-hook | ||
| 1175 | (lambda () | ||
| 1176 | (unload-feature 'tramp-fish 'force))) | ||
| 1177 | |||
| 1173 | (provide 'tramp-fish) | 1178 | (provide 'tramp-fish) |
| 1174 | ; | 1179 | ; |
| 1175 | ;;;; TODO: | 1180 | ;;;; TODO: |
diff --git a/lisp/net/tramp-ftp.el b/lisp/net/tramp-ftp.el index 14cf2e0adbf..799b974bd04 100644 --- a/lisp/net/tramp-ftp.el +++ b/lisp/net/tramp-ftp.el | |||
| @@ -30,7 +30,6 @@ | |||
| 30 | ;;; Code: | 30 | ;;; Code: |
| 31 | 31 | ||
| 32 | (require 'tramp) | 32 | (require 'tramp) |
| 33 | (autoload 'tramp-set-connection-property "tramp-cache") | ||
| 34 | 33 | ||
| 35 | (eval-when-compile | 34 | (eval-when-compile |
| 36 | 35 | ||
| @@ -99,13 +98,14 @@ present for backward compatibility." | |||
| 99 | (add-hook 'tramp-ftp-unload-hook 'tramp-ftp-enable-ange-ftp) | 98 | (add-hook 'tramp-ftp-unload-hook 'tramp-ftp-enable-ange-ftp) |
| 100 | 99 | ||
| 101 | ;; Define FTP method ... | 100 | ;; Define FTP method ... |
| 102 | (defcustom tramp-ftp-method "ftp" | 101 | ;;;###tramp-autoload |
| 103 | "*When this method name is used, forward all calls to Ange-FTP." | 102 | (defconst tramp-ftp-method "ftp" |
| 104 | :group 'tramp | 103 | "*When this method name is used, forward all calls to Ange-FTP.") |
| 105 | :type 'string) | ||
| 106 | 104 | ||
| 107 | ;; ... and add it to the method list. | 105 | ;; ... and add it to the method list. |
| 108 | (add-to-list 'tramp-methods (cons tramp-ftp-method nil)) | 106 | ;;;###tramp-autoload |
| 107 | (unless (featurep 'xemacs) | ||
| 108 | (add-to-list 'tramp-methods (cons tramp-ftp-method nil))) | ||
| 109 | 109 | ||
| 110 | ;; Add some defaults for `tramp-default-method-alist' | 110 | ;; Add some defaults for `tramp-default-method-alist' |
| 111 | (add-to-list 'tramp-default-method-alist | 111 | (add-to-list 'tramp-default-method-alist |
| @@ -129,6 +129,7 @@ present for backward compatibility." | |||
| 129 | (symbol-plist | 129 | (symbol-plist |
| 130 | 'substitute-in-file-name)))))) | 130 | 'substitute-in-file-name)))))) |
| 131 | 131 | ||
| 132 | ;;;###tramp-autoload | ||
| 132 | (defun tramp-ftp-file-name-handler (operation &rest args) | 133 | (defun tramp-ftp-file-name-handler (operation &rest args) |
| 133 | "Invoke the Ange-FTP handler for OPERATION. | 134 | "Invoke the Ange-FTP handler for OPERATION. |
| 134 | First arg specifies the OPERATION, second arg is a list of arguments to | 135 | First arg specifies the OPERATION, second arg is a list of arguments to |
| @@ -199,13 +200,20 @@ pass to the OPERATION." | |||
| 199 | (inhibit-file-name-operation operation)) | 200 | (inhibit-file-name-operation operation)) |
| 200 | (apply 'ange-ftp-hook-function operation args))))))) | 201 | (apply 'ange-ftp-hook-function operation args))))))) |
| 201 | 202 | ||
| 202 | (defun tramp-ftp-file-name-p (filename) | 203 | ;;;###tramp-autoload |
| 204 | (defsubst tramp-ftp-file-name-p (filename) | ||
| 203 | "Check if it's a filename that should be forwarded to Ange-FTP." | 205 | "Check if it's a filename that should be forwarded to Ange-FTP." |
| 204 | (let ((v (tramp-dissect-file-name filename))) | 206 | (let ((v (tramp-dissect-file-name filename))) |
| 205 | (string= (tramp-file-name-method v) tramp-ftp-method))) | 207 | (string= (tramp-file-name-method v) tramp-ftp-method))) |
| 206 | 208 | ||
| 207 | (add-to-list 'tramp-foreign-file-name-handler-alist | 209 | ;;;###tramp-autoload |
| 208 | (cons 'tramp-ftp-file-name-p 'tramp-ftp-file-name-handler)) | 210 | (unless (featurep 'xemacs) |
| 211 | (add-to-list 'tramp-foreign-file-name-handler-alist | ||
| 212 | (cons 'tramp-ftp-file-name-p 'tramp-ftp-file-name-handler))) | ||
| 213 | |||
| 214 | (add-hook 'tramp-unload-hook | ||
| 215 | (lambda () | ||
| 216 | (unload-feature 'tramp-ftp 'force))) | ||
| 209 | 217 | ||
| 210 | (provide 'tramp-ftp) | 218 | (provide 'tramp-ftp) |
| 211 | 219 | ||
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index d0814545e6e..6e07ec19021 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el | |||
| @@ -108,6 +108,7 @@ | |||
| 108 | (require 'url-util) | 108 | (require 'url-util) |
| 109 | (require 'zeroconf) | 109 | (require 'zeroconf) |
| 110 | 110 | ||
| 111 | ;;;###tramp-autoload | ||
| 111 | (defcustom tramp-gvfs-methods '("dav" "davs" "obex" "synce") | 112 | (defcustom tramp-gvfs-methods '("dav" "davs" "obex" "synce") |
| 112 | "*List of methods for remote files, accessed with GVFS." | 113 | "*List of methods for remote files, accessed with GVFS." |
| 113 | :group 'tramp | 114 | :group 'tramp |
| @@ -133,11 +134,11 @@ | |||
| 133 | 134 | ||
| 134 | ;; Add the methods to `tramp-methods', in order to allow minibuffer | 135 | ;; Add the methods to `tramp-methods', in order to allow minibuffer |
| 135 | ;; completion. | 136 | ;; completion. |
| 136 | (eval-after-load "tramp-gvfs" | 137 | ;;;###tramp-autoload |
| 137 | '(when (featurep 'tramp-gvfs) | 138 | (when (featurep 'dbusbind) |
| 138 | (dolist (elt tramp-gvfs-methods) | 139 | (dolist (elt tramp-gvfs-methods) |
| 139 | (unless (assoc elt tramp-methods) | 140 | (unless (assoc elt tramp-methods) |
| 140 | (add-to-list 'tramp-methods (cons elt nil)))))) | 141 | (add-to-list 'tramp-methods (cons elt nil))))) |
| 141 | 142 | ||
| 142 | (defconst tramp-gvfs-path-tramp (concat dbus-path-emacs "/Tramp") | 143 | (defconst tramp-gvfs-path-tramp (concat dbus-path-emacs "/Tramp") |
| 143 | "The preceeding object path for own objects.") | 144 | "The preceeding object path for own objects.") |
| @@ -145,9 +146,12 @@ | |||
| 145 | (defconst tramp-gvfs-service-daemon "org.gtk.vfs.Daemon" | 146 | (defconst tramp-gvfs-service-daemon "org.gtk.vfs.Daemon" |
| 146 | "The well known name of the GVFS daemon.") | 147 | "The well known name of the GVFS daemon.") |
| 147 | 148 | ||
| 148 | ;; Check that GVFS is available. | 149 | ;; Check that GVFS is available. D-Bus integration is available since |
| 149 | (unless (dbus-ping :session tramp-gvfs-service-daemon 100) | 150 | ;; Emacs 23 on some system types. We don't call `dbus-ping', because |
| 150 | (throw 'tramp-loading nil)) | 151 | ;; this would load dbus.el. |
| 152 | (unless (and (tramp-compat-funcall 'dbus-get-unique-name :session) | ||
| 153 | (tramp-compat-process-running-p "gvfs-fuse-daemon")) | ||
| 154 | (error "Package `tramp-gvfs' not supported")) | ||
| 151 | 155 | ||
| 152 | (defconst tramp-gvfs-path-mounttracker "/org/gtk/vfs/mounttracker" | 156 | (defconst tramp-gvfs-path-mounttracker "/org/gtk/vfs/mounttracker" |
| 153 | "The object path of the GVFS daemon.") | 157 | "The object path of the GVFS daemon.") |
| @@ -385,7 +389,7 @@ Every entry is a list (NAME ADDRESS).") | |||
| 385 | (expand-file-name . tramp-gvfs-handle-expand-file-name) | 389 | (expand-file-name . tramp-gvfs-handle-expand-file-name) |
| 386 | ;; `file-accessible-directory-p' performed by default handler. | 390 | ;; `file-accessible-directory-p' performed by default handler. |
| 387 | (file-attributes . tramp-gvfs-handle-file-attributes) | 391 | (file-attributes . tramp-gvfs-handle-file-attributes) |
| 388 | (file-directory-p . tramp-smb-handle-file-directory-p) | 392 | (file-directory-p . tramp-gvfs-handle-file-directory-p) |
| 389 | (file-executable-p . tramp-gvfs-handle-file-executable-p) | 393 | (file-executable-p . tramp-gvfs-handle-file-executable-p) |
| 390 | (file-exists-p . tramp-gvfs-handle-file-exists-p) | 394 | (file-exists-p . tramp-gvfs-handle-file-exists-p) |
| 391 | (file-local-copy . tramp-gvfs-handle-file-local-copy) | 395 | (file-local-copy . tramp-gvfs-handle-file-local-copy) |
| @@ -431,13 +435,15 @@ Every entry is a list (NAME ADDRESS).") | |||
| 431 | "Alist of handler functions for Tramp GVFS method. | 435 | "Alist of handler functions for Tramp GVFS method. |
| 432 | Operations not mentioned here will be handled by the default Emacs primitives.") | 436 | Operations not mentioned here will be handled by the default Emacs primitives.") |
| 433 | 437 | ||
| 434 | (defun tramp-gvfs-file-name-p (filename) | 438 | ;;;###tramp-autoload |
| 439 | (defsubst tramp-gvfs-file-name-p (filename) | ||
| 435 | "Check if it's a filename handled by the GVFS daemon." | 440 | "Check if it's a filename handled by the GVFS daemon." |
| 436 | (and (tramp-tramp-file-p filename) | 441 | (and (tramp-tramp-file-p filename) |
| 437 | (let ((method | 442 | (let ((method |
| 438 | (tramp-file-name-method (tramp-dissect-file-name filename)))) | 443 | (tramp-file-name-method (tramp-dissect-file-name filename)))) |
| 439 | (and (stringp method) (member method tramp-gvfs-methods))))) | 444 | (and (stringp method) (member method tramp-gvfs-methods))))) |
| 440 | 445 | ||
| 446 | ;;;###tramp-autoload | ||
| 441 | (defun tramp-gvfs-file-name-handler (operation &rest args) | 447 | (defun tramp-gvfs-file-name-handler (operation &rest args) |
| 442 | "Invoke the GVFS related OPERATION. | 448 | "Invoke the GVFS related OPERATION. |
| 443 | First arg specifies the OPERATION, second arg is a list of arguments to | 449 | First arg specifies the OPERATION, second arg is a list of arguments to |
| @@ -449,8 +455,10 @@ pass to the OPERATION." | |||
| 449 | 455 | ||
| 450 | ;; This might be moved to tramp.el. It shall be the first file name | 456 | ;; This might be moved to tramp.el. It shall be the first file name |
| 451 | ;; handler. | 457 | ;; handler. |
| 452 | (add-to-list 'tramp-foreign-file-name-handler-alist | 458 | ;;;###tramp-autoload |
| 453 | (cons 'tramp-gvfs-file-name-p 'tramp-gvfs-file-name-handler)) | 459 | (when (featurep 'dbusbind) |
| 460 | (add-to-list 'tramp-foreign-file-name-handler-alist | ||
| 461 | (cons 'tramp-gvfs-file-name-p 'tramp-gvfs-file-name-handler))) | ||
| 454 | 462 | ||
| 455 | (defun tramp-gvfs-stringify-dbus-message (message) | 463 | (defun tramp-gvfs-stringify-dbus-message (message) |
| 456 | "Convert a D-Bus message into readable UTF8 strings, used for traces." | 464 | "Convert a D-Bus message into readable UTF8 strings, used for traces." |
| @@ -494,7 +502,7 @@ In case of an error, modify the error message by replacing | |||
| 494 | `(let ((fuse-file-name (regexp-quote (tramp-gvfs-fuse-file-name ,filename))) | 502 | `(let ((fuse-file-name (regexp-quote (tramp-gvfs-fuse-file-name ,filename))) |
| 495 | elt) | 503 | elt) |
| 496 | (condition-case err | 504 | (condition-case err |
| 497 | (funcall ,handler ,@args) | 505 | (tramp-compat-funcall ,handler ,@args) |
| 498 | (error | 506 | (error |
| 499 | (setq elt (cdr err)) | 507 | (setq elt (cdr err)) |
| 500 | (while elt | 508 | (while elt |
| @@ -647,6 +655,10 @@ is no information where to trace the message.") | |||
| 647 | "Like `file-attributes' for Tramp files." | 655 | "Like `file-attributes' for Tramp files." |
| 648 | (file-attributes (tramp-gvfs-fuse-file-name filename) id-format)) | 656 | (file-attributes (tramp-gvfs-fuse-file-name filename) id-format)) |
| 649 | 657 | ||
| 658 | (defun tramp-gvfs-handle-file-directory-p (filename) | ||
| 659 | "Like `file-directory-p' for Tramp files." | ||
| 660 | (file-directory-p (tramp-gvfs-fuse-file-name filename))) | ||
| 661 | |||
| 650 | (defun tramp-gvfs-handle-file-executable-p (filename) | 662 | (defun tramp-gvfs-handle-file-executable-p (filename) |
| 651 | "Like `file-executable-p' for Tramp files." | 663 | "Like `file-executable-p' for Tramp files." |
| 652 | (file-executable-p (tramp-gvfs-fuse-file-name filename))) | 664 | (file-executable-p (tramp-gvfs-fuse-file-name filename))) |
| @@ -1403,6 +1415,10 @@ They are retrieved from the hal daemon." | |||
| 1403 | (tramp-set-completion-function | 1415 | (tramp-set-completion-function |
| 1404 | "synce" '((tramp-synce-parse-device-names ""))) | 1416 | "synce" '((tramp-synce-parse-device-names ""))) |
| 1405 | 1417 | ||
| 1418 | (add-hook 'tramp-unload-hook | ||
| 1419 | (lambda () | ||
| 1420 | (unload-feature 'tramp-gvfs 'force))) | ||
| 1421 | |||
| 1406 | (provide 'tramp-gvfs) | 1422 | (provide 'tramp-gvfs) |
| 1407 | 1423 | ||
| 1408 | ;;; TODO: | 1424 | ;;; TODO: |
diff --git a/lisp/net/tramp-gw.el b/lisp/net/tramp-gw.el index 76f9b30f90c..63dfd105f1c 100644 --- a/lisp/net/tramp-gw.el +++ b/lisp/net/tramp-gw.el | |||
| @@ -38,11 +38,6 @@ | |||
| 38 | (require 'cl) | 38 | (require 'cl) |
| 39 | (require 'custom)) | 39 | (require 'custom)) |
| 40 | 40 | ||
| 41 | ;; Autoload the socks library. It is used only when we access a SOCKS server. | ||
| 42 | (autoload 'socks-open-network-stream "socks") | ||
| 43 | (defvar socks-username (user-login-name)) | ||
| 44 | (defvar socks-server (list "Default server" "socks" 1080 5)) | ||
| 45 | |||
| 46 | ;; Avoid byte-compiler warnings if the byte-compiler supports this. | 41 | ;; Avoid byte-compiler warnings if the byte-compiler supports this. |
| 47 | ;; Currently, XEmacs supports this. | 42 | ;; Currently, XEmacs supports this. |
| 48 | (eval-when-compile | 43 | (eval-when-compile |
| @@ -50,21 +45,29 @@ | |||
| 50 | (byte-compiler-options (warnings (- unused-vars))))) | 45 | (byte-compiler-options (warnings (- unused-vars))))) |
| 51 | 46 | ||
| 52 | ;; Define HTTP tunnel method ... | 47 | ;; Define HTTP tunnel method ... |
| 53 | (defvar tramp-gw-tunnel-method "tunnel" | 48 | ;;;###tramp-autoload |
| 49 | (defconst tramp-gw-tunnel-method "tunnel" | ||
| 54 | "*Method to connect HTTP gateways.") | 50 | "*Method to connect HTTP gateways.") |
| 55 | 51 | ||
| 56 | ;; ... and port. | 52 | ;; ... and port. |
| 57 | (defvar tramp-gw-default-tunnel-port 8080 | 53 | (defconst tramp-gw-default-tunnel-port 8080 |
| 58 | "*Default port for HTTP gateways.") | 54 | "*Default port for HTTP gateways.") |
| 59 | 55 | ||
| 60 | ;; Define SOCKS method ... | 56 | ;; Define SOCKS method ... |
| 61 | (defvar tramp-gw-socks-method "socks" | 57 | ;;;###tramp-autoload |
| 58 | (defconst tramp-gw-socks-method "socks" | ||
| 62 | "*Method to connect SOCKS servers.") | 59 | "*Method to connect SOCKS servers.") |
| 63 | 60 | ||
| 64 | ;; ... and port. | 61 | ;; ... and port. |
| 65 | (defvar tramp-gw-default-socks-port 1080 | 62 | (defconst tramp-gw-default-socks-port 1080 |
| 66 | "*Default port for SOCKS servers.") | 63 | "*Default port for SOCKS servers.") |
| 67 | 64 | ||
| 65 | ;; Autoload the socks library. It is used only when we access a SOCKS server. | ||
| 66 | (autoload 'socks-open-network-stream "socks") | ||
| 67 | (defvar socks-username (user-login-name)) | ||
| 68 | (defvar socks-server | ||
| 69 | (list "Default server" "socks" tramp-gw-default-socks-port 5)) | ||
| 70 | |||
| 68 | ;; Add a default for `tramp-default-user-alist'. Default is the local user. | 71 | ;; Add a default for `tramp-default-user-alist'. Default is the local user. |
| 69 | (add-to-list 'tramp-default-user-alist | 72 | (add-to-list 'tramp-default-user-alist |
| 70 | `(,tramp-gw-tunnel-method nil ,(user-login-name))) | 73 | `(,tramp-gw-tunnel-method nil ,(user-login-name))) |
| @@ -125,6 +128,7 @@ | |||
| 125 | (process-send-string | 128 | (process-send-string |
| 126 | (tramp-get-connection-property proc "process" nil) string))) | 129 | (tramp-get-connection-property proc "process" nil) string))) |
| 127 | 130 | ||
| 131 | ;;;###tramp-autoload | ||
| 128 | (defun tramp-gw-open-connection (vec gw-vec target-vec) | 132 | (defun tramp-gw-open-connection (vec gw-vec target-vec) |
| 129 | "Open a remote connection to VEC (see `tramp-file-name' structure). | 133 | "Open a remote connection to VEC (see `tramp-file-name' structure). |
| 130 | Take GW-VEC as SOCKS or HTTP gateway, i.e. its method must be a | 134 | Take GW-VEC as SOCKS or HTTP gateway, i.e. its method must be a |
| @@ -310,6 +314,9 @@ password in password cache. This is done for the first try only." | |||
| 310 | (format | 314 | (format |
| 311 | "Password for %s@[%s]: " socks-username (read (current-buffer))))))))) | 315 | "Password for %s@[%s]: " socks-username (read (current-buffer))))))))) |
| 312 | 316 | ||
| 317 | (add-hook 'tramp-unload-hook | ||
| 318 | (lambda () | ||
| 319 | (unload-feature 'tramp-gw 'force))) | ||
| 313 | 320 | ||
| 314 | (provide 'tramp-gw) | 321 | (provide 'tramp-gw) |
| 315 | 322 | ||
diff --git a/lisp/net/tramp-imap.el b/lisp/net/tramp-imap.el index 55addf588a7..4a5e2418cfb 100644 --- a/lisp/net/tramp-imap.el +++ b/lisp/net/tramp-imap.el | |||
| @@ -55,7 +55,6 @@ | |||
| 55 | 55 | ||
| 56 | (require 'assoc) | 56 | (require 'assoc) |
| 57 | (require 'tramp) | 57 | (require 'tramp) |
| 58 | (require 'tramp-compat) | ||
| 59 | 58 | ||
| 60 | (autoload 'auth-source-user-or-password "auth-source") | 59 | (autoload 'auth-source-user-or-password "auth-source") |
| 61 | (autoload 'epg-context-operation "epg") | 60 | (autoload 'epg-context-operation "epg") |
| @@ -76,21 +75,29 @@ | |||
| 76 | '(add-to-list 'imap-hash-headers 'X-Size 'append)) | 75 | '(add-to-list 'imap-hash-headers 'X-Size 'append)) |
| 77 | 76 | ||
| 78 | ;; Define Tramp IMAP method ... | 77 | ;; Define Tramp IMAP method ... |
| 78 | ;;;###tramp-autoload | ||
| 79 | (defconst tramp-imap-method "imap" | 79 | (defconst tramp-imap-method "imap" |
| 80 | "*Method to connect via IMAP protocol.") | 80 | "*Method to connect via IMAP protocol.") |
| 81 | 81 | ||
| 82 | (add-to-list 'tramp-methods (list tramp-imap-method '(tramp-default-port 143))) | 82 | ;;;###tramp-autoload |
| 83 | (when (and (locate-library "epa") (locate-library "imap-hash")) | ||
| 84 | (add-to-list 'tramp-methods | ||
| 85 | (list tramp-imap-method '(tramp-default-port 143)))) | ||
| 83 | 86 | ||
| 84 | ;; Add a default for `tramp-default-user-alist'. Default is the local user. | 87 | ;; Add a default for `tramp-default-user-alist'. Default is the local user. |
| 85 | (add-to-list 'tramp-default-user-alist | 88 | (add-to-list 'tramp-default-user-alist |
| 86 | `(,tramp-imap-method nil ,(user-login-name))) | 89 | `(,tramp-imap-method nil ,(user-login-name))) |
| 87 | 90 | ||
| 88 | ;; Define Tramp IMAPS method ... | 91 | ;; Define Tramp IMAPS method ... |
| 92 | ;;;###tramp-autoload | ||
| 89 | (defconst tramp-imaps-method "imaps" | 93 | (defconst tramp-imaps-method "imaps" |
| 90 | "*Method to connect via secure IMAP protocol.") | 94 | "*Method to connect via secure IMAP protocol.") |
| 91 | 95 | ||
| 92 | ;; ... and add it to the method list. | 96 | ;; ... and add it to the method list. |
| 93 | (add-to-list 'tramp-methods (list tramp-imaps-method '(tramp-default-port 993))) | 97 | ;;;###tramp-autoload |
| 98 | (when (and (locate-library "epa") (locate-library "imap-hash")) | ||
| 99 | (add-to-list 'tramp-methods | ||
| 100 | (list tramp-imaps-method '(tramp-default-port 993)))) | ||
| 94 | 101 | ||
| 95 | ;; Add a default for `tramp-default-user-alist'. Default is the local user. | 102 | ;; Add a default for `tramp-default-user-alist'. Default is the local user. |
| 96 | (add-to-list 'tramp-default-user-alist | 103 | (add-to-list 'tramp-default-user-alist |
| @@ -184,13 +191,15 @@ Operations not mentioned here will be handled by the default Emacs primitives.") | |||
| 184 | (defvar tramp-imap-passphrase-cache nil) ;; can be t or 'never | 191 | (defvar tramp-imap-passphrase-cache nil) ;; can be t or 'never |
| 185 | (defvar tramp-imap-passphrase nil) | 192 | (defvar tramp-imap-passphrase nil) |
| 186 | 193 | ||
| 187 | (defun tramp-imap-file-name-p (filename) | 194 | ;;;###tramp-autoload |
| 195 | (defsubst tramp-imap-file-name-p (filename) | ||
| 188 | "Check if it's a filename for IMAP protocol." | 196 | "Check if it's a filename for IMAP protocol." |
| 189 | (let ((v (tramp-dissect-file-name filename))) | 197 | (let ((v (tramp-dissect-file-name filename))) |
| 190 | (or | 198 | (or |
| 191 | (string= (tramp-file-name-method v) tramp-imap-method) | 199 | (string= (tramp-file-name-method v) tramp-imap-method) |
| 192 | (string= (tramp-file-name-method v) tramp-imaps-method)))) | 200 | (string= (tramp-file-name-method v) tramp-imaps-method)))) |
| 193 | 201 | ||
| 202 | ;;;###tramp-autoload | ||
| 194 | (defun tramp-imap-file-name-handler (operation &rest args) | 203 | (defun tramp-imap-file-name-handler (operation &rest args) |
| 195 | "Invoke the IMAP related OPERATION. | 204 | "Invoke the IMAP related OPERATION. |
| 196 | First arg specifies the OPERATION, second arg is a list of arguments to | 205 | First arg specifies the OPERATION, second arg is a list of arguments to |
| @@ -200,8 +209,10 @@ pass to the OPERATION." | |||
| 200 | (save-match-data (apply (cdr fn) args)) | 209 | (save-match-data (apply (cdr fn) args)) |
| 201 | (tramp-run-real-handler operation args)))) | 210 | (tramp-run-real-handler operation args)))) |
| 202 | 211 | ||
| 203 | (add-to-list 'tramp-foreign-file-name-handler-alist | 212 | ;;;###tramp-autoload |
| 204 | (cons 'tramp-imap-file-name-p 'tramp-imap-file-name-handler)) | 213 | (when (and (locate-library "epa") (locate-library "imap-hash")) |
| 214 | (add-to-list 'tramp-foreign-file-name-handler-alist | ||
| 215 | (cons 'tramp-imap-file-name-p 'tramp-imap-file-name-handler))) | ||
| 205 | 216 | ||
| 206 | (defun tramp-imap-handle-copy-file | 217 | (defun tramp-imap-handle-copy-file |
| 207 | (filename newname &optional ok-if-already-exists keep-date | 218 | (filename newname &optional ok-if-already-exists keep-date |
| @@ -776,6 +787,10 @@ With NEEDED-SUBJECT, alters the imap-hash test accordingly." | |||
| 776 | tramp-imap-subject-marker | 787 | tramp-imap-subject-marker |
| 777 | (if needed-subject needed-subject ""))))) | 788 | (if needed-subject needed-subject ""))))) |
| 778 | 789 | ||
| 790 | (add-hook 'tramp-unload-hook | ||
| 791 | (lambda () | ||
| 792 | (unload-feature 'tramp-imap 'force))) | ||
| 793 | |||
| 779 | ;;; TODO: | 794 | ;;; TODO: |
| 780 | 795 | ||
| 781 | ;; * Implement `tramp-imap-handle-delete-directory', | 796 | ;; * Implement `tramp-imap-handle-delete-directory', |
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index 48af7d8120a..84d11972115 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el | |||
| @@ -30,17 +30,16 @@ | |||
| 30 | 30 | ||
| 31 | (eval-when-compile (require 'cl)) ; block, return | 31 | (eval-when-compile (require 'cl)) ; block, return |
| 32 | (require 'tramp) | 32 | (require 'tramp) |
| 33 | (require 'tramp-cache) | ||
| 34 | (require 'tramp-compat) | ||
| 35 | 33 | ||
| 36 | ;; Define SMB method ... | 34 | ;; Define SMB method ... |
| 37 | (defcustom tramp-smb-method "smb" | 35 | ;;;###tramp-autoload |
| 38 | "*Method to connect SAMBA and M$ SMB servers." | 36 | (defconst tramp-smb-method "smb" |
| 39 | :group 'tramp | 37 | "*Method to connect SAMBA and M$ SMB servers.") |
| 40 | :type 'string) | ||
| 41 | 38 | ||
| 42 | ;; ... and add it to the method list. | 39 | ;; ... and add it to the method list. |
| 43 | (add-to-list 'tramp-methods (cons tramp-smb-method nil)) | 40 | ;;;###tramp-autoload |
| 41 | (unless (memq system-type '(cygwin windows-nt)) | ||
| 42 | (add-to-list 'tramp-methods (cons tramp-smb-method nil))) | ||
| 44 | 43 | ||
| 45 | ;; Add a default for `tramp-default-method-alist'. Rule: If there is | 44 | ;; Add a default for `tramp-default-method-alist'. Rule: If there is |
| 46 | ;; a domain in USER, it must be the SMB method. | 45 | ;; a domain in USER, it must be the SMB method. |
| @@ -205,11 +204,13 @@ See `tramp-actions-before-shell' for more info.") | |||
| 205 | "Alist of handler functions for Tramp SMB method. | 204 | "Alist of handler functions for Tramp SMB method. |
| 206 | Operations not mentioned here will be handled by the default Emacs primitives.") | 205 | Operations not mentioned here will be handled by the default Emacs primitives.") |
| 207 | 206 | ||
| 208 | (defun tramp-smb-file-name-p (filename) | 207 | ;;;###tramp-autoload |
| 208 | (defsubst tramp-smb-file-name-p (filename) | ||
| 209 | "Check if it's a filename for SMB servers." | 209 | "Check if it's a filename for SMB servers." |
| 210 | (let ((v (tramp-dissect-file-name filename))) | 210 | (let ((v (tramp-dissect-file-name filename))) |
| 211 | (string= (tramp-file-name-method v) tramp-smb-method))) | 211 | (string= (tramp-file-name-method v) tramp-smb-method))) |
| 212 | 212 | ||
| 213 | ;;;###tramp-autoload | ||
| 213 | (defun tramp-smb-file-name-handler (operation &rest args) | 214 | (defun tramp-smb-file-name-handler (operation &rest args) |
| 214 | "Invoke the SMB related OPERATION. | 215 | "Invoke the SMB related OPERATION. |
| 215 | First arg specifies the OPERATION, second arg is a list of arguments to | 216 | First arg specifies the OPERATION, second arg is a list of arguments to |
| @@ -219,8 +220,10 @@ pass to the OPERATION." | |||
| 219 | (save-match-data (apply (cdr fn) args)) | 220 | (save-match-data (apply (cdr fn) args)) |
| 220 | (tramp-run-real-handler operation args)))) | 221 | (tramp-run-real-handler operation args)))) |
| 221 | 222 | ||
| 222 | (add-to-list 'tramp-foreign-file-name-handler-alist | 223 | ;;;###tramp-autoload |
| 223 | (cons 'tramp-smb-file-name-p 'tramp-smb-file-name-handler)) | 224 | (unless (memq system-type '(cygwin windows-nt)) |
| 225 | (add-to-list 'tramp-foreign-file-name-handler-alist | ||
| 226 | (cons 'tramp-smb-file-name-p 'tramp-smb-file-name-handler))) | ||
| 224 | 227 | ||
| 225 | 228 | ||
| 226 | ;; File name primitives. | 229 | ;; File name primitives. |
| @@ -784,7 +787,7 @@ PRESERVE-UID-GID is completely ignored." | |||
| 784 | (if (tramp-smb-get-cifs-capabilities v) | 787 | (if (tramp-smb-get-cifs-capabilities v) |
| 785 | (format | 788 | (format |
| 786 | "posix_mkdir \"%s\" %s" | 789 | "posix_mkdir \"%s\" %s" |
| 787 | file (tramp-decimal-to-octal (default-file-modes))) | 790 | file (tramp-compat-decimal-to-octal (default-file-modes))) |
| 788 | (format "mkdir \"%s\"" file))) | 791 | (format "mkdir \"%s\"" file))) |
| 789 | ;; We must also flush the cache of the directory, because | 792 | ;; We must also flush the cache of the directory, because |
| 790 | ;; `file-attributes' reads the values from there. | 793 | ;; `file-attributes' reads the values from there. |
| @@ -893,7 +896,7 @@ target of the symlink differ." | |||
| 893 | (unless (tramp-smb-send-command | 896 | (unless (tramp-smb-send-command |
| 894 | v (format "chmod \"%s\" %s" | 897 | v (format "chmod \"%s\" %s" |
| 895 | (tramp-smb-get-localname v) | 898 | (tramp-smb-get-localname v) |
| 896 | (tramp-decimal-to-octal mode))) | 899 | (tramp-compat-decimal-to-octal mode))) |
| 897 | (tramp-error | 900 | (tramp-error |
| 898 | v 'file-error "Error while changing file's mode %s" filename))))) | 901 | v 'file-error "Error while changing file's mode %s" filename))))) |
| 899 | 902 | ||
| @@ -1397,6 +1400,9 @@ Returns nil if an error message has appeared." | |||
| 1397 | (tramp-message vec 6 "\n%s" (buffer-string)) | 1400 | (tramp-message vec 6 "\n%s" (buffer-string)) |
| 1398 | (not err)))) | 1401 | (not err)))) |
| 1399 | 1402 | ||
| 1403 | (add-hook 'tramp-unload-hook | ||
| 1404 | (lambda () | ||
| 1405 | (unload-feature 'tramp-smb 'force))) | ||
| 1400 | 1406 | ||
| 1401 | (provide 'tramp-smb) | 1407 | (provide 'tramp-smb) |
| 1402 | 1408 | ||
diff --git a/lisp/net/tramp-uu.el b/lisp/net/tramp-uu.el index a9f816be815..fe6862c9240 100644 --- a/lisp/net/tramp-uu.el +++ b/lisp/net/tramp-uu.el | |||
| @@ -50,6 +50,7 @@ | |||
| 50 | "Return the byte that is encoded as CHAR." | 50 | "Return the byte that is encoded as CHAR." |
| 51 | (cdr (assq char tramp-uu-b64-char-to-byte))) | 51 | (cdr (assq char tramp-uu-b64-char-to-byte))) |
| 52 | 52 | ||
| 53 | ;;;###tramp-autoload | ||
| 53 | (defun tramp-uuencode-region (beg end) | 54 | (defun tramp-uuencode-region (beg end) |
| 54 | "UU-encode the region between BEG and END." | 55 | "UU-encode the region between BEG and END." |
| 55 | ;; First we base64 encode the region, then we transmogrify that into | 56 | ;; First we base64 encode the region, then we transmogrify that into |
| @@ -87,6 +88,10 @@ | |||
| 87 | (goto-char beg) | 88 | (goto-char beg) |
| 88 | (insert "begin 600 xxx\n")))) | 89 | (insert "begin 600 xxx\n")))) |
| 89 | 90 | ||
| 91 | (add-hook 'tramp-unload-hook | ||
| 92 | (lambda () | ||
| 93 | (unload-feature 'tramp-uu 'force))) | ||
| 94 | |||
| 90 | (provide 'tramp-uu) | 95 | (provide 'tramp-uu) |
| 91 | 96 | ||
| 92 | ;; arch-tag: 7153f2c6-8be5-4cd2-8c06-0fbcf5190ef6 | 97 | ;; arch-tag: 7153f2c6-8be5-4cd2-8c06-0fbcf5190ef6 |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index d5d1606c617..86ece233fa6 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | (setq tramp-version 24) | ||
| 1 | ;;; tramp.el --- Transparent Remote Access, Multiple Protocol | 2 | ;;; tramp.el --- Transparent Remote Access, Multiple Protocol |
| 2 | 3 | ||
| 3 | ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, | 4 | ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, |
| @@ -8,6 +9,7 @@ | |||
| 8 | ;; Author: Kai Großjohann <kai.grossjohann@gmx.net> | 9 | ;; Author: Kai Großjohann <kai.grossjohann@gmx.net> |
| 9 | ;; Michael Albinus <michael.albinus@gmx.de> | 10 | ;; Michael Albinus <michael.albinus@gmx.de> |
| 10 | ;; Keywords: comm, processes | 11 | ;; Keywords: comm, processes |
| 12 | ;; Package: tramp | ||
| 11 | 13 | ||
| 12 | ;; This file is part of GNU Emacs. | 14 | ;; This file is part of GNU Emacs. |
| 13 | 15 | ||
| @@ -66,18 +68,7 @@ | |||
| 66 | (when (and load-in-progress (null (current-message))) | 68 | (when (and load-in-progress (null (current-message))) |
| 67 | (message "Loading tramp...")) | 69 | (message "Loading tramp...")) |
| 68 | 70 | ||
| 69 | ;; The Tramp version number and bug report address, as prepared by configure. | ||
| 70 | (require 'trampver) | ||
| 71 | (add-hook 'tramp-unload-hook | ||
| 72 | (lambda () | ||
| 73 | (when (featurep 'trampver) | ||
| 74 | (unload-feature 'trampver 'force)))) | ||
| 75 | |||
| 76 | (require 'tramp-compat) | 71 | (require 'tramp-compat) |
| 77 | (add-hook 'tramp-unload-hook | ||
| 78 | (lambda () | ||
| 79 | (when (featurep 'tramp-compat) | ||
| 80 | (unload-feature 'tramp-compat 'force)))) | ||
| 81 | 72 | ||
| 82 | (require 'format-spec) | 73 | (require 'format-spec) |
| 83 | ;; As long as password.el is not part of (X)Emacs, it shouldn't | 74 | ;; As long as password.el is not part of (X)Emacs, it shouldn't |
| @@ -95,82 +86,8 @@ | |||
| 95 | (load "auth-source" 'noerror) | 86 | (load "auth-source" 'noerror) |
| 96 | (require 'auth-source nil 'noerror))) | 87 | (require 'auth-source nil 'noerror))) |
| 97 | 88 | ||
| 98 | ;; Requiring 'tramp-cache results in an endless loop. | ||
| 99 | (autoload 'tramp-get-file-property "tramp-cache") | ||
| 100 | (autoload 'tramp-set-file-property "tramp-cache") | ||
| 101 | (autoload 'tramp-flush-file-property "tramp-cache") | ||
| 102 | (autoload 'tramp-flush-directory-property "tramp-cache") | ||
| 103 | (autoload 'tramp-get-connection-property "tramp-cache") | ||
| 104 | (autoload 'tramp-set-connection-property "tramp-cache") | ||
| 105 | (autoload 'tramp-flush-connection-property "tramp-cache") | ||
| 106 | (autoload 'tramp-parse-connection-properties "tramp-cache") | ||
| 107 | (add-hook 'tramp-unload-hook | ||
| 108 | (lambda () | ||
| 109 | (when (featurep 'tramp-cache) | ||
| 110 | (unload-feature 'tramp-cache 'force)))) | ||
| 111 | |||
| 112 | (autoload 'tramp-uuencode-region "tramp-uu" | ||
| 113 | "Implementation of `uuencode' in Lisp.") | ||
| 114 | (add-hook 'tramp-unload-hook | ||
| 115 | (lambda () | ||
| 116 | (when (featurep 'tramp-uu) | ||
| 117 | (unload-feature 'tramp-uu 'force)))) | ||
| 118 | |||
| 119 | (autoload 'uudecode-decode-region "uudecode") | 89 | (autoload 'uudecode-decode-region "uudecode") |
| 120 | 90 | ||
| 121 | ;; The following Tramp packages must be loaded after tramp.el, because | ||
| 122 | ;; they require it as well. | ||
| 123 | (eval-after-load "tramp" | ||
| 124 | '(dolist | ||
| 125 | (feature | ||
| 126 | (list | ||
| 127 | |||
| 128 | ;; Tramp interactive commands. | ||
| 129 | 'tramp-cmds | ||
| 130 | |||
| 131 | ;; Load foreign FTP method. | ||
| 132 | (if (featurep 'xemacs) 'tramp-efs 'tramp-ftp) | ||
| 133 | |||
| 134 | ;; tramp-smb uses "smbclient" from Samba. Not available | ||
| 135 | ;; under Cygwin and Windows, because they don't offer | ||
| 136 | ;; "smbclient". And even not necessary there, because Emacs | ||
| 137 | ;; supports UNC file names like "//host/share/localname". | ||
| 138 | (unless (memq system-type '(cygwin windows-nt)) 'tramp-smb) | ||
| 139 | |||
| 140 | ;; Load foreign FISH method. | ||
| 141 | 'tramp-fish | ||
| 142 | |||
| 143 | ;; tramp-gvfs needs D-Bus messages. Available since Emacs 23 | ||
| 144 | ;; on some system types. We don't call `dbus-ping', because | ||
| 145 | ;; this would load dbus.el. | ||
| 146 | (when (and (featurep 'dbusbind) | ||
| 147 | (condition-case nil | ||
| 148 | (tramp-compat-funcall 'dbus-get-unique-name :session) | ||
| 149 | (error nil)) | ||
| 150 | (tramp-compat-process-running-p "gvfs-fuse-daemon")) | ||
| 151 | 'tramp-gvfs) | ||
| 152 | |||
| 153 | ;; Load gateways. It needs `make-network-process' from Emacs 22. | ||
| 154 | (when (functionp 'make-network-process) 'tramp-gw) | ||
| 155 | |||
| 156 | ;; tramp-imap needs both epa (from Emacs 23.1) and imap-hash | ||
| 157 | ;; (from Emacs 23.2). | ||
| 158 | (when (and (locate-library "epa") (locate-library "imap-hash")) | ||
| 159 | 'tramp-imap))) | ||
| 160 | |||
| 161 | (when feature | ||
| 162 | ;; We have used just some basic tests, whether a package shall | ||
| 163 | ;; be added. There might still be other errors during loading, | ||
| 164 | ;; which we will catch here. | ||
| 165 | (catch 'tramp-loading | ||
| 166 | (require feature) | ||
| 167 | (add-hook 'tramp-unload-hook | ||
| 168 | `(lambda () | ||
| 169 | (when (featurep (quote ,feature)) | ||
| 170 | (unload-feature (quote ,feature) 'force))))) | ||
| 171 | (unless (featurep feature) | ||
| 172 | (message "Loading %s failed, ignoring this package" feature))))) | ||
| 173 | |||
| 174 | ;;; User Customizable Internal Variables: | 91 | ;;; User Customizable Internal Variables: |
| 175 | 92 | ||
| 176 | (defgroup tramp nil | 93 | (defgroup tramp nil |
| @@ -300,6 +217,7 @@ If it is nil, inline out-of-the-band copy will be used without a check." | |||
| 300 | :group 'tramp | 217 | :group 'tramp |
| 301 | :type '(choice (const nil) integer)) | 218 | :type '(choice (const nil) integer)) |
| 302 | 219 | ||
| 220 | ;;;###tramp-autoload | ||
| 303 | (defcustom tramp-terminal-type "dumb" | 221 | (defcustom tramp-terminal-type "dumb" |
| 304 | "*Value of TERM environment variable for logging in to remote host. | 222 | "*Value of TERM environment variable for logging in to remote host. |
| 305 | Because Tramp wants to parse the output of the remote shell, it is easily | 223 | Because Tramp wants to parse the output of the remote shell, it is easily |
| @@ -320,9 +238,11 @@ files conditionalize this setup based on the TERM environment variable." | |||
| 320 | The '$' character at the end is quoted; the string cannot be | 238 | The '$' character at the end is quoted; the string cannot be |
| 321 | detected as prompt when being sent on echoing hosts, therefore.") | 239 | detected as prompt when being sent on echoing hosts, therefore.") |
| 322 | 240 | ||
| 241 | ;;;###tramp-autoload | ||
| 323 | (defconst tramp-initial-end-of-output "#$ " | 242 | (defconst tramp-initial-end-of-output "#$ " |
| 324 | "Prompt when establishing a connection.") | 243 | "Prompt when establishing a connection.") |
| 325 | 244 | ||
| 245 | ;;;###tramp-autoload | ||
| 326 | (defvar tramp-methods | 246 | (defvar tramp-methods |
| 327 | `(("rcp" (tramp-login-program "rsh") | 247 | `(("rcp" (tramp-login-program "rsh") |
| 328 | (tramp-login-args (("%h") ("-l" "%u"))) | 248 | (tramp-login-args (("%h") ("-l" "%u"))) |
| @@ -2097,6 +2017,7 @@ mentioned here will be handled by `tramp-file-name-handler-alist' or the | |||
| 2097 | normal Emacs functions.") | 2017 | normal Emacs functions.") |
| 2098 | 2018 | ||
| 2099 | ;; Handlers for foreign methods, like FTP or SMB, shall be plugged here. | 2019 | ;; Handlers for foreign methods, like FTP or SMB, shall be plugged here. |
| 2020 | ;;;###tramp-autoload | ||
| 2100 | (defvar tramp-foreign-file-name-handler-alist | 2021 | (defvar tramp-foreign-file-name-handler-alist |
| 2101 | ;; (identity . tramp-sh-file-name-handler) should always be the last | 2022 | ;; (identity . tramp-sh-file-name-handler) should always be the last |
| 2102 | ;; entry, because `identity' always matches. | 2023 | ;; entry, because `identity' always matches. |
| @@ -2107,6 +2028,257 @@ calling HANDLER.") | |||
| 2107 | 2028 | ||
| 2108 | ;;; Internal functions which must come first: | 2029 | ;;; Internal functions which must come first: |
| 2109 | 2030 | ||
| 2031 | |||
| 2032 | ;; ------------------------------------------------------------ | ||
| 2033 | ;; -- Tramp file names -- | ||
| 2034 | ;; ------------------------------------------------------------ | ||
| 2035 | ;; Conversion functions between external representation and | ||
| 2036 | ;; internal data structure. Convenience functions for internal | ||
| 2037 | ;; data structure. | ||
| 2038 | |||
| 2039 | (defun tramp-file-name-p (vec) | ||
| 2040 | "Check, whether VEC is a Tramp object." | ||
| 2041 | (and (vectorp vec) (= 4 (length vec)))) | ||
| 2042 | |||
| 2043 | (defun tramp-file-name-method (vec) | ||
| 2044 | "Return method component of VEC." | ||
| 2045 | (and (tramp-file-name-p vec) (aref vec 0))) | ||
| 2046 | |||
| 2047 | (defun tramp-file-name-user (vec) | ||
| 2048 | "Return user component of VEC." | ||
| 2049 | (and (tramp-file-name-p vec) (aref vec 1))) | ||
| 2050 | |||
| 2051 | (defun tramp-file-name-host (vec) | ||
| 2052 | "Return host component of VEC." | ||
| 2053 | (and (tramp-file-name-p vec) (aref vec 2))) | ||
| 2054 | |||
| 2055 | (defun tramp-file-name-localname (vec) | ||
| 2056 | "Return localname component of VEC." | ||
| 2057 | (and (tramp-file-name-p vec) (aref vec 3))) | ||
| 2058 | |||
| 2059 | ;; The user part of a Tramp file name vector can be of kind | ||
| 2060 | ;; "user%domain". Sometimes, we must extract these parts. | ||
| 2061 | (defun tramp-file-name-real-user (vec) | ||
| 2062 | "Return the user name of VEC without domain." | ||
| 2063 | (save-match-data | ||
| 2064 | (let ((user (tramp-file-name-user vec))) | ||
| 2065 | (if (and (stringp user) | ||
| 2066 | (string-match tramp-user-with-domain-regexp user)) | ||
| 2067 | (match-string 1 user) | ||
| 2068 | user)))) | ||
| 2069 | |||
| 2070 | (defun tramp-file-name-domain (vec) | ||
| 2071 | "Return the domain name of VEC." | ||
| 2072 | (save-match-data | ||
| 2073 | (let ((user (tramp-file-name-user vec))) | ||
| 2074 | (and (stringp user) | ||
| 2075 | (string-match tramp-user-with-domain-regexp user) | ||
| 2076 | (match-string 2 user))))) | ||
| 2077 | |||
| 2078 | ;; The host part of a Tramp file name vector can be of kind | ||
| 2079 | ;; "host#port". Sometimes, we must extract these parts. | ||
| 2080 | (defun tramp-file-name-real-host (vec) | ||
| 2081 | "Return the host name of VEC without port." | ||
| 2082 | (save-match-data | ||
| 2083 | (let ((host (tramp-file-name-host vec))) | ||
| 2084 | (if (and (stringp host) | ||
| 2085 | (string-match tramp-host-with-port-regexp host)) | ||
| 2086 | (match-string 1 host) | ||
| 2087 | host)))) | ||
| 2088 | |||
| 2089 | (defun tramp-file-name-port (vec) | ||
| 2090 | "Return the port number of VEC." | ||
| 2091 | (save-match-data | ||
| 2092 | (let ((host (tramp-file-name-host vec))) | ||
| 2093 | (and (stringp host) | ||
| 2094 | (string-match tramp-host-with-port-regexp host) | ||
| 2095 | (string-to-number (match-string 2 host)))))) | ||
| 2096 | |||
| 2097 | ;;;###tramp-autoload | ||
| 2098 | (defun tramp-tramp-file-p (name) | ||
| 2099 | "Return t if NAME is a string with Tramp file name syntax." | ||
| 2100 | (save-match-data | ||
| 2101 | (and (stringp name) (string-match tramp-file-name-regexp name)))) | ||
| 2102 | |||
| 2103 | (defun tramp-find-method (method user host) | ||
| 2104 | "Return the right method string to use. | ||
| 2105 | This is METHOD, if non-nil. Otherwise, do a lookup in | ||
| 2106 | `tramp-default-method-alist'." | ||
| 2107 | (or method | ||
| 2108 | (let ((choices tramp-default-method-alist) | ||
| 2109 | lmethod item) | ||
| 2110 | (while choices | ||
| 2111 | (setq item (pop choices)) | ||
| 2112 | (when (and (string-match (or (nth 0 item) "") (or host "")) | ||
| 2113 | (string-match (or (nth 1 item) "") (or user ""))) | ||
| 2114 | (setq lmethod (nth 2 item)) | ||
| 2115 | (setq choices nil))) | ||
| 2116 | lmethod) | ||
| 2117 | tramp-default-method)) | ||
| 2118 | |||
| 2119 | (defun tramp-find-user (method user host) | ||
| 2120 | "Return the right user string to use. | ||
| 2121 | This is USER, if non-nil. Otherwise, do a lookup in | ||
| 2122 | `tramp-default-user-alist'." | ||
| 2123 | (or user | ||
| 2124 | (let ((choices tramp-default-user-alist) | ||
| 2125 | luser item) | ||
| 2126 | (while choices | ||
| 2127 | (setq item (pop choices)) | ||
| 2128 | (when (and (string-match (or (nth 0 item) "") (or method "")) | ||
| 2129 | (string-match (or (nth 1 item) "") (or host ""))) | ||
| 2130 | (setq luser (nth 2 item)) | ||
| 2131 | (setq choices nil))) | ||
| 2132 | luser) | ||
| 2133 | tramp-default-user)) | ||
| 2134 | |||
| 2135 | (defun tramp-find-host (method user host) | ||
| 2136 | "Return the right host string to use. | ||
| 2137 | This is HOST, if non-nil. Otherwise, it is `tramp-default-host'." | ||
| 2138 | (or (and (> (length host) 0) host) | ||
| 2139 | tramp-default-host)) | ||
| 2140 | |||
| 2141 | (defun tramp-dissect-file-name (name &optional nodefault) | ||
| 2142 | "Return a `tramp-file-name' structure. | ||
| 2143 | The structure consists of remote method, remote user, remote host | ||
| 2144 | and localname (file name on remote host). If NODEFAULT is | ||
| 2145 | non-nil, the file name parts are not expanded to their default | ||
| 2146 | values." | ||
| 2147 | (save-match-data | ||
| 2148 | (let ((match (string-match (nth 0 tramp-file-name-structure) name))) | ||
| 2149 | (unless match (error "Not a Tramp file name: %s" name)) | ||
| 2150 | (let ((method (match-string (nth 1 tramp-file-name-structure) name)) | ||
| 2151 | (user (match-string (nth 2 tramp-file-name-structure) name)) | ||
| 2152 | (host (match-string (nth 3 tramp-file-name-structure) name)) | ||
| 2153 | (localname (match-string (nth 4 tramp-file-name-structure) name))) | ||
| 2154 | (when (member method '("multi" "multiu")) | ||
| 2155 | (error | ||
| 2156 | "`%s' method is no longer supported, see (info \"(tramp)Multi-hops\")" | ||
| 2157 | method)) | ||
| 2158 | (when host | ||
| 2159 | (when (string-match tramp-prefix-ipv6-regexp host) | ||
| 2160 | (setq host (replace-match "" nil t host))) | ||
| 2161 | (when (string-match tramp-postfix-ipv6-regexp host) | ||
| 2162 | (setq host (replace-match "" nil t host)))) | ||
| 2163 | (if nodefault | ||
| 2164 | (vector method user host localname) | ||
| 2165 | (vector | ||
| 2166 | (tramp-find-method method user host) | ||
| 2167 | (tramp-find-user method user host) | ||
| 2168 | (tramp-find-host method user host) | ||
| 2169 | localname)))))) | ||
| 2170 | |||
| 2171 | (defun tramp-buffer-name (vec) | ||
| 2172 | "A name for the connection buffer VEC." | ||
| 2173 | ;; We must use `tramp-file-name-real-host', because for gateway | ||
| 2174 | ;; methods the default port will be expanded later on, which would | ||
| 2175 | ;; tamper the name. | ||
| 2176 | (let ((method (tramp-file-name-method vec)) | ||
| 2177 | (user (tramp-file-name-user vec)) | ||
| 2178 | (host (tramp-file-name-real-host vec))) | ||
| 2179 | (if (not (zerop (length user))) | ||
| 2180 | (format "*tramp/%s %s@%s*" method user host) | ||
| 2181 | (format "*tramp/%s %s*" method host)))) | ||
| 2182 | |||
| 2183 | (defun tramp-make-tramp-file-name (method user host localname) | ||
| 2184 | "Constructs a Tramp file name from METHOD, USER, HOST and LOCALNAME." | ||
| 2185 | (concat tramp-prefix-format | ||
| 2186 | (when (not (zerop (length method))) | ||
| 2187 | (concat method tramp-postfix-method-format)) | ||
| 2188 | (when (not (zerop (length user))) | ||
| 2189 | (concat user tramp-postfix-user-format)) | ||
| 2190 | (when host | ||
| 2191 | (if (string-match tramp-ipv6-regexp host) | ||
| 2192 | (concat tramp-prefix-ipv6-format host tramp-postfix-ipv6-format) | ||
| 2193 | host)) | ||
| 2194 | tramp-postfix-host-format | ||
| 2195 | (when localname localname))) | ||
| 2196 | |||
| 2197 | (defun tramp-completion-make-tramp-file-name (method user host localname) | ||
| 2198 | "Constructs a Tramp file name from METHOD, USER, HOST and LOCALNAME. | ||
| 2199 | It must not be a complete Tramp file name, but as long as there are | ||
| 2200 | necessary only. This function will be used in file name completion." | ||
| 2201 | (concat tramp-prefix-format | ||
| 2202 | (when (not (zerop (length method))) | ||
| 2203 | (concat method tramp-postfix-method-format)) | ||
| 2204 | (when (not (zerop (length user))) | ||
| 2205 | (concat user tramp-postfix-user-format)) | ||
| 2206 | (when (not (zerop (length host))) | ||
| 2207 | (concat | ||
| 2208 | (if (string-match tramp-ipv6-regexp host) | ||
| 2209 | (concat tramp-prefix-ipv6-format host tramp-postfix-ipv6-format) | ||
| 2210 | host) | ||
| 2211 | tramp-postfix-host-format)) | ||
| 2212 | (when localname localname))) | ||
| 2213 | |||
| 2214 | (defun tramp-get-buffer (vec) | ||
| 2215 | "Get the connection buffer to be used for VEC." | ||
| 2216 | (or (get-buffer (tramp-buffer-name vec)) | ||
| 2217 | (with-current-buffer (get-buffer-create (tramp-buffer-name vec)) | ||
| 2218 | (setq buffer-undo-list t) | ||
| 2219 | (setq default-directory | ||
| 2220 | (tramp-make-tramp-file-name | ||
| 2221 | (tramp-file-name-method vec) | ||
| 2222 | (tramp-file-name-user vec) | ||
| 2223 | (tramp-file-name-host vec) | ||
| 2224 | "/")) | ||
| 2225 | (current-buffer)))) | ||
| 2226 | |||
| 2227 | (defun tramp-get-connection-buffer (vec) | ||
| 2228 | "Get the connection buffer to be used for VEC. | ||
| 2229 | In case a second asynchronous communication has been started, it is different | ||
| 2230 | from `tramp-get-buffer'." | ||
| 2231 | (or (tramp-get-connection-property vec "process-buffer" nil) | ||
| 2232 | (tramp-get-buffer vec))) | ||
| 2233 | |||
| 2234 | (defun tramp-get-connection-process (vec) | ||
| 2235 | "Get the connection process to be used for VEC. | ||
| 2236 | In case a second asynchronous communication has been started, it is different | ||
| 2237 | from the default one." | ||
| 2238 | (get-process | ||
| 2239 | (or (tramp-get-connection-property vec "process-name" nil) | ||
| 2240 | (tramp-buffer-name vec)))) | ||
| 2241 | |||
| 2242 | (defun tramp-debug-buffer-name (vec) | ||
| 2243 | "A name for the debug buffer for VEC." | ||
| 2244 | ;; We must use `tramp-file-name-real-host', because for gateway | ||
| 2245 | ;; methods the default port will be expanded later on, which would | ||
| 2246 | ;; tamper the name. | ||
| 2247 | (let ((method (tramp-file-name-method vec)) | ||
| 2248 | (user (tramp-file-name-user vec)) | ||
| 2249 | (host (tramp-file-name-real-host vec))) | ||
| 2250 | (if (not (zerop (length user))) | ||
| 2251 | (format "*debug tramp/%s %s@%s*" method user host) | ||
| 2252 | (format "*debug tramp/%s %s*" method host)))) | ||
| 2253 | |||
| 2254 | (defconst tramp-debug-outline-regexp | ||
| 2255 | "[0-9]+:[0-9]+:[0-9]+\\.[0-9]+ [a-z0-9-]+ (\\([0-9]+\\)) #") | ||
| 2256 | |||
| 2257 | (defun tramp-get-debug-buffer (vec) | ||
| 2258 | "Get the debug buffer for VEC." | ||
| 2259 | (with-current-buffer | ||
| 2260 | (get-buffer-create (tramp-debug-buffer-name vec)) | ||
| 2261 | (when (bobp) | ||
| 2262 | (setq buffer-undo-list t) | ||
| 2263 | ;; Activate `outline-mode'. This runs `text-mode-hook' and | ||
| 2264 | ;; `outline-mode-hook'. We must prevent that local processes | ||
| 2265 | ;; die. Yes: I've seen `flyspell-mode', which starts "ispell". | ||
| 2266 | ;; Furthermore, `outline-regexp' must have the correct value | ||
| 2267 | ;; already, because it is used by `font-lock-compile-keywords'. | ||
| 2268 | (let ((default-directory (tramp-compat-temporary-file-directory)) | ||
| 2269 | (outline-regexp tramp-debug-outline-regexp)) | ||
| 2270 | (outline-mode)) | ||
| 2271 | (set (make-local-variable 'outline-regexp) tramp-debug-outline-regexp) | ||
| 2272 | (set (make-local-variable 'outline-level) 'tramp-outline-level)) | ||
| 2273 | (current-buffer))) | ||
| 2274 | |||
| 2275 | (defun tramp-outline-level () | ||
| 2276 | "Return the depth to which a statement is nested in the outline. | ||
| 2277 | Point must be at the beginning of a header line. | ||
| 2278 | |||
| 2279 | The outline level is equal to the verbosity of the Tramp message." | ||
| 2280 | (1+ (string-to-number (match-string 1)))) | ||
| 2281 | |||
| 2110 | (defsubst tramp-debug-message (vec fmt-string &rest args) | 2282 | (defsubst tramp-debug-message (vec fmt-string &rest args) |
| 2111 | "Append message to debug buffer. | 2283 | "Append message to debug buffer. |
| 2112 | Message is formatted with FMT-STRING as control string and the remaining | 2284 | Message is formatted with FMT-STRING as control string and the remaining |
| @@ -2266,39 +2438,6 @@ If VAR is nil, then we bind `v' to the structure and `method', `user', | |||
| 2266 | (put 'with-parsed-tramp-file-name 'edebug-form-spec '(form symbolp body)) | 2438 | (put 'with-parsed-tramp-file-name 'edebug-form-spec '(form symbolp body)) |
| 2267 | (font-lock-add-keywords 'emacs-lisp-mode '("\\<with-parsed-tramp-file-name\\>")) | 2439 | (font-lock-add-keywords 'emacs-lisp-mode '("\\<with-parsed-tramp-file-name\\>")) |
| 2268 | 2440 | ||
| 2269 | (defmacro with-file-property (vec file property &rest body) | ||
| 2270 | "Check in Tramp cache for PROPERTY, otherwise execute BODY and set cache. | ||
| 2271 | FILE must be a local file name on a connection identified via VEC." | ||
| 2272 | `(if (file-name-absolute-p ,file) | ||
| 2273 | (let ((value (tramp-get-file-property ,vec ,file ,property 'undef))) | ||
| 2274 | (when (eq value 'undef) | ||
| 2275 | ;; We cannot pass @body as parameter to | ||
| 2276 | ;; `tramp-set-file-property' because it mangles our | ||
| 2277 | ;; debug messages. | ||
| 2278 | (setq value (progn ,@body)) | ||
| 2279 | (tramp-set-file-property ,vec ,file ,property value)) | ||
| 2280 | value) | ||
| 2281 | ,@body)) | ||
| 2282 | |||
| 2283 | (put 'with-file-property 'lisp-indent-function 3) | ||
| 2284 | (put 'with-file-property 'edebug-form-spec t) | ||
| 2285 | (font-lock-add-keywords 'emacs-lisp-mode '("\\<with-file-property\\>")) | ||
| 2286 | |||
| 2287 | (defmacro with-connection-property (key property &rest body) | ||
| 2288 | "Check in Tramp for property PROPERTY, otherwise executes BODY and set." | ||
| 2289 | `(let ((value (tramp-get-connection-property ,key ,property 'undef))) | ||
| 2290 | (when (eq value 'undef) | ||
| 2291 | ;; We cannot pass ,@body as parameter to | ||
| 2292 | ;; `tramp-set-connection-property' because it mangles our debug | ||
| 2293 | ;; messages. | ||
| 2294 | (setq value (progn ,@body)) | ||
| 2295 | (tramp-set-connection-property ,key ,property value)) | ||
| 2296 | value)) | ||
| 2297 | |||
| 2298 | (put 'with-connection-property 'lisp-indent-function 2) | ||
| 2299 | (put 'with-connection-property 'edebug-form-spec t) | ||
| 2300 | (font-lock-add-keywords 'emacs-lisp-mode '("\\<with-connection-property\\>")) | ||
| 2301 | |||
| 2302 | (defun tramp-progress-reporter-update (reporter &optional value) | 2441 | (defun tramp-progress-reporter-update (reporter &optional value) |
| 2303 | (let* ((parameters (cdr reporter)) | 2442 | (let* ((parameters (cdr reporter)) |
| 2304 | (message (aref parameters 3))) | 2443 | (message (aref parameters 3))) |
| @@ -2374,7 +2513,7 @@ Return the local name of the temporary file." | |||
| 2374 | (setq result nil) | 2513 | (setq result nil) |
| 2375 | ;; This creates the file by side effect. | 2514 | ;; This creates the file by side effect. |
| 2376 | (set-file-times result) | 2515 | (set-file-times result) |
| 2377 | (set-file-modes result (tramp-octal-to-decimal "0700")))) | 2516 | (set-file-modes result (tramp-compat-octal-to-decimal "0700")))) |
| 2378 | 2517 | ||
| 2379 | ;; Return the local part. | 2518 | ;; Return the local part. |
| 2380 | (with-parsed-tramp-file-name result nil localname))) | 2519 | (with-parsed-tramp-file-name result nil localname))) |
| @@ -2414,7 +2553,7 @@ Example: | |||
| 2414 | ;; Windows registry. | 2553 | ;; Windows registry. |
| 2415 | (and (memq system-type '(cygwin windows-nt)) | 2554 | (and (memq system-type '(cygwin windows-nt)) |
| 2416 | (zerop | 2555 | (zerop |
| 2417 | (tramp-local-call-process | 2556 | (tramp-compat-call-process |
| 2418 | "reg" nil nil nil "query" (nth 1 (car v))))) | 2557 | "reg" nil nil nil "query" (nth 1 (car v))))) |
| 2419 | ;; Configuration file. | 2558 | ;; Configuration file. |
| 2420 | (file-exists-p (nth 1 (car v))))) | 2559 | (file-exists-p (nth 1 (car v))))) |
| @@ -3026,7 +3165,7 @@ of." | |||
| 3026 | (unless (zerop (tramp-send-command-and-check | 3165 | (unless (zerop (tramp-send-command-and-check |
| 3027 | v | 3166 | v |
| 3028 | (format "chmod %s %s" | 3167 | (format "chmod %s %s" |
| 3029 | (tramp-decimal-to-octal mode) | 3168 | (tramp-compat-decimal-to-octal mode) |
| 3030 | (tramp-shell-quote-argument localname)))) | 3169 | (tramp-shell-quote-argument localname)))) |
| 3031 | ;; FIXME: extract the proper text from chmod's stderr. | 3170 | ;; FIXME: extract the proper text from chmod's stderr. |
| 3032 | (tramp-error | 3171 | (tramp-error |
| @@ -3057,7 +3196,7 @@ of." | |||
| 3057 | ;; We handle also the local part, because in older Emacsen, | 3196 | ;; We handle also the local part, because in older Emacsen, |
| 3058 | ;; without `set-file-times', this function is an alias for this. | 3197 | ;; without `set-file-times', this function is an alias for this. |
| 3059 | ;; We are local, so we don't need the UTC settings. | 3198 | ;; We are local, so we don't need the UTC settings. |
| 3060 | (tramp-local-call-process | 3199 | (tramp-compat-call-process |
| 3061 | "touch" nil nil nil "-t" | 3200 | "touch" nil nil nil "-t" |
| 3062 | (format-time-string "%Y%m%d%H%M.%S" time) | 3201 | (format-time-string "%Y%m%d%H%M.%S" time) |
| 3063 | (tramp-shell-quote-argument filename))))) | 3202 | (tramp-shell-quote-argument filename))))) |
| @@ -3090,7 +3229,7 @@ and gid of the corresponding user is taken. Both parameters must be integers." | |||
| 3090 | ;; `set-file-uid-gid'. On W32 "chown" might not work. | 3229 | ;; `set-file-uid-gid'. On W32 "chown" might not work. |
| 3091 | (let ((uid (or (and (integerp uid) uid) (tramp-get-local-uid 'integer))) | 3230 | (let ((uid (or (and (integerp uid) uid) (tramp-get-local-uid 'integer))) |
| 3092 | (gid (or (and (integerp gid) gid) (tramp-get-local-gid 'integer)))) | 3231 | (gid (or (and (integerp gid) gid) (tramp-get-local-gid 'integer)))) |
| 3093 | (tramp-local-call-process | 3232 | (tramp-compat-call-process |
| 3094 | "chown" nil nil nil | 3233 | "chown" nil nil nil |
| 3095 | (format "%d:%d" uid gid) (tramp-shell-quote-argument filename)))))) | 3234 | (format "%d:%d" uid gid) (tramp-shell-quote-argument filename)))))) |
| 3096 | 3235 | ||
| @@ -3218,7 +3357,7 @@ and gid of the corresponding user is taken. Both parameters must be integers." | |||
| 3218 | If the file modes of FILENAME cannot be determined, return the | 3357 | If the file modes of FILENAME cannot be determined, return the |
| 3219 | value of `default-file-modes', without execute permissions." | 3358 | value of `default-file-modes', without execute permissions." |
| 3220 | (or (file-modes filename) | 3359 | (or (file-modes filename) |
| 3221 | (logand (default-file-modes) (tramp-octal-to-decimal "0666")))) | 3360 | (logand (default-file-modes) (tramp-compat-octal-to-decimal "0666")))) |
| 3222 | 3361 | ||
| 3223 | (defun tramp-handle-file-directory-p (filename) | 3362 | (defun tramp-handle-file-directory-p (filename) |
| 3224 | "Like `file-directory-p' for Tramp files." | 3363 | "Like `file-directory-p' for Tramp files." |
| @@ -3905,7 +4044,8 @@ the uid and gid from FILENAME." | |||
| 3905 | ;; Since this does not work reliable, we also | 4044 | ;; Since this does not work reliable, we also |
| 3906 | ;; give read permissions. | 4045 | ;; give read permissions. |
| 3907 | (set-file-modes | 4046 | (set-file-modes |
| 3908 | (concat prefix tmpfile) (tramp-octal-to-decimal "0777")) | 4047 | (concat prefix tmpfile) |
| 4048 | (tramp-compat-octal-to-decimal "0777")) | ||
| 3909 | (tramp-set-file-uid-gid | 4049 | (tramp-set-file-uid-gid |
| 3910 | (concat prefix tmpfile) | 4050 | (concat prefix tmpfile) |
| 3911 | (tramp-get-local-uid 'integer) | 4051 | (tramp-get-local-uid 'integer) |
| @@ -3921,7 +4061,8 @@ the uid and gid from FILENAME." | |||
| 3921 | ;; We must change the ownership as local user. | 4061 | ;; We must change the ownership as local user. |
| 3922 | ;; Since this does not work reliable, we also | 4062 | ;; Since this does not work reliable, we also |
| 3923 | ;; give read permissions. | 4063 | ;; give read permissions. |
| 3924 | (set-file-modes tmpfile (tramp-octal-to-decimal "0777")) | 4064 | (set-file-modes |
| 4065 | tmpfile (tramp-compat-octal-to-decimal "0777")) | ||
| 3925 | (tramp-set-file-uid-gid | 4066 | (tramp-set-file-uid-gid |
| 3926 | tmpfile | 4067 | tmpfile |
| 3927 | (tramp-get-remote-uid v 'integer) | 4068 | (tramp-get-remote-uid v 'integer) |
| @@ -4689,20 +4830,6 @@ beginning of local filename are not substituted." | |||
| 4689 | (keyboard-quit) | 4830 | (keyboard-quit) |
| 4690 | ret)))) | 4831 | ret)))) |
| 4691 | 4832 | ||
| 4692 | (defun tramp-local-call-process | ||
| 4693 | (program &optional infile destination display &rest args) | ||
| 4694 | "Calls `call-process' on the local host. | ||
| 4695 | This is needed because for some Emacs flavors Tramp has | ||
| 4696 | defadviced `call-process' to behave like `process-file'. The | ||
| 4697 | Lisp error raised when PROGRAM is nil is trapped also, returning 1." | ||
| 4698 | (let ((default-directory | ||
| 4699 | (if (file-remote-p default-directory) | ||
| 4700 | (tramp-compat-temporary-file-directory) | ||
| 4701 | default-directory))) | ||
| 4702 | (if (executable-find program) | ||
| 4703 | (apply 'call-process program infile destination display args) | ||
| 4704 | 1))) | ||
| 4705 | |||
| 4706 | (defun tramp-handle-call-process-region | 4833 | (defun tramp-handle-call-process-region |
| 4707 | (start end program &optional delete buffer display &rest args) | 4834 | (start end program &optional delete buffer display &rest args) |
| 4708 | "Like `call-process-region' for Tramp files." | 4835 | "Like `call-process-region' for Tramp files." |
| @@ -4772,7 +4899,7 @@ Lisp error raised when PROGRAM is nil is trapped also, returning 1." | |||
| 4772 | ;; Display output. | 4899 | ;; Display output. |
| 4773 | (pop-to-buffer output-buffer) | 4900 | (pop-to-buffer output-buffer) |
| 4774 | (setq mode-line-process '(":%s")) | 4901 | (setq mode-line-process '(":%s")) |
| 4775 | (require 'shell) (shell-mode)) | 4902 | (shell-mode)) |
| 4776 | 4903 | ||
| 4777 | (prog1 | 4904 | (prog1 |
| 4778 | ;; Run the process. | 4905 | ;; Run the process. |
| @@ -4981,7 +5108,7 @@ coding system might not be determined. This function repairs it." | |||
| 4981 | ;; When the file is not readable for the owner, it | 5108 | ;; When the file is not readable for the owner, it |
| 4982 | ;; cannot be inserted, even it is redable for the group | 5109 | ;; cannot be inserted, even it is redable for the group |
| 4983 | ;; or for everybody. | 5110 | ;; or for everybody. |
| 4984 | (set-file-modes local-copy (tramp-octal-to-decimal "0600")) | 5111 | (set-file-modes local-copy (tramp-compat-octal-to-decimal "0600")) |
| 4985 | 5112 | ||
| 4986 | (when (and (null remote-copy) | 5113 | (when (and (null remote-copy) |
| 4987 | (tramp-get-method-parameter | 5114 | (tramp-get-method-parameter |
| @@ -5219,7 +5346,8 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file." | |||
| 5219 | ;; Ensure, that it is still readable. | 5346 | ;; Ensure, that it is still readable. |
| 5220 | (when modes | 5347 | (when modes |
| 5221 | (set-file-modes | 5348 | (set-file-modes |
| 5222 | tmpfile (logior (or modes 0) (tramp-octal-to-decimal "0400")))) | 5349 | tmpfile |
| 5350 | (logior (or modes 0) (tramp-compat-octal-to-decimal "0400")))) | ||
| 5223 | 5351 | ||
| 5224 | ;; This is a bit lengthy due to the different methods | 5352 | ;; This is a bit lengthy due to the different methods |
| 5225 | ;; possible for file transfer. First, we check whether the | 5353 | ;; possible for file transfer. First, we check whether the |
| @@ -5318,7 +5446,7 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file." | |||
| 5318 | (erase-buffer) | 5446 | (erase-buffer) |
| 5319 | (and | 5447 | (and |
| 5320 | ;; cksum runs locally, if possible. | 5448 | ;; cksum runs locally, if possible. |
| 5321 | (zerop (tramp-local-call-process "cksum" tmpfile t)) | 5449 | (zerop (tramp-compat-call-process "cksum" tmpfile t)) |
| 5322 | ;; cksum runs remotely. | 5450 | ;; cksum runs remotely. |
| 5323 | (zerop | 5451 | (zerop |
| 5324 | (tramp-send-command-and-check | 5452 | (tramp-send-command-and-check |
| @@ -5795,6 +5923,7 @@ should never be set globally, the intention is to let-bind it.") | |||
| 5795 | ;; Tramp file name syntax. Maybe another variable should be introduced | 5923 | ;; Tramp file name syntax. Maybe another variable should be introduced |
| 5796 | ;; overwriting this check in such cases. Or we change Tramp file name | 5924 | ;; overwriting this check in such cases. Or we change Tramp file name |
| 5797 | ;; syntax in order to avoid ambiguities, like in XEmacs ... | 5925 | ;; syntax in order to avoid ambiguities, like in XEmacs ... |
| 5926 | ;;;###tramp-autoload | ||
| 5798 | (defun tramp-completion-mode-p () | 5927 | (defun tramp-completion-mode-p () |
| 5799 | "Check, whether method / user name / host name completion is active." | 5928 | "Check, whether method / user name / host name completion is active." |
| 5800 | (or | 5929 | (or |
| @@ -6344,7 +6473,7 @@ User is always nil." | |||
| 6344 | (let ((default-directory (tramp-compat-temporary-file-directory)) | 6473 | (let ((default-directory (tramp-compat-temporary-file-directory)) |
| 6345 | res) | 6474 | res) |
| 6346 | (with-temp-buffer | 6475 | (with-temp-buffer |
| 6347 | (when (zerop (tramp-local-call-process "reg" nil t nil "query" registry)) | 6476 | (when (zerop (tramp-compat-call-process "reg" nil t nil "query" registry)) |
| 6348 | (goto-char (point-min)) | 6477 | (goto-char (point-min)) |
| 6349 | (while (not (eobp)) | 6478 | (while (not (eobp)) |
| 6350 | (push (tramp-parse-putty-group registry) res)))) | 6479 | (push (tramp-parse-putty-group registry) res)))) |
| @@ -6419,18 +6548,6 @@ hosts, or files, disagree." | |||
| 6419 | (tramp-shell-quote-argument v1-localname) | 6548 | (tramp-shell-quote-argument v1-localname) |
| 6420 | (tramp-shell-quote-argument v2-localname)))))) | 6549 | (tramp-shell-quote-argument v2-localname)))))) |
| 6421 | 6550 | ||
| 6422 | (defun tramp-buffer-name (vec) | ||
| 6423 | "A name for the connection buffer VEC." | ||
| 6424 | ;; We must use `tramp-file-name-real-host', because for gateway | ||
| 6425 | ;; methods the default port will be expanded later on, which would | ||
| 6426 | ;; tamper the name. | ||
| 6427 | (let ((method (tramp-file-name-method vec)) | ||
| 6428 | (user (tramp-file-name-user vec)) | ||
| 6429 | (host (tramp-file-name-real-host vec))) | ||
| 6430 | (if (not (zerop (length user))) | ||
| 6431 | (format "*tramp/%s %s@%s*" method user host) | ||
| 6432 | (format "*tramp/%s %s*" method host)))) | ||
| 6433 | |||
| 6434 | (defun tramp-delete-temp-file-function () | 6551 | (defun tramp-delete-temp-file-function () |
| 6435 | "Remove temporary files related to current buffer." | 6552 | "Remove temporary files related to current buffer." |
| 6436 | (when (stringp tramp-temp-buffer-file-name) | 6553 | (when (stringp tramp-temp-buffer-file-name) |
| @@ -6444,74 +6561,6 @@ hosts, or files, disagree." | |||
| 6444 | (remove-hook 'kill-buffer-hook | 6561 | (remove-hook 'kill-buffer-hook |
| 6445 | 'tramp-delete-temp-file-function))) | 6562 | 'tramp-delete-temp-file-function))) |
| 6446 | 6563 | ||
| 6447 | (defun tramp-get-buffer (vec) | ||
| 6448 | "Get the connection buffer to be used for VEC." | ||
| 6449 | (or (get-buffer (tramp-buffer-name vec)) | ||
| 6450 | (with-current-buffer (get-buffer-create (tramp-buffer-name vec)) | ||
| 6451 | (setq buffer-undo-list t) | ||
| 6452 | (setq default-directory | ||
| 6453 | (tramp-make-tramp-file-name | ||
| 6454 | (tramp-file-name-method vec) | ||
| 6455 | (tramp-file-name-user vec) | ||
| 6456 | (tramp-file-name-host vec) | ||
| 6457 | "/")) | ||
| 6458 | (current-buffer)))) | ||
| 6459 | |||
| 6460 | (defun tramp-get-connection-buffer (vec) | ||
| 6461 | "Get the connection buffer to be used for VEC. | ||
| 6462 | In case a second asynchronous communication has been started, it is different | ||
| 6463 | from `tramp-get-buffer'." | ||
| 6464 | (or (tramp-get-connection-property vec "process-buffer" nil) | ||
| 6465 | (tramp-get-buffer vec))) | ||
| 6466 | |||
| 6467 | (defun tramp-get-connection-process (vec) | ||
| 6468 | "Get the connection process to be used for VEC. | ||
| 6469 | In case a second asynchronous communication has been started, it is different | ||
| 6470 | from the default one." | ||
| 6471 | (get-process | ||
| 6472 | (or (tramp-get-connection-property vec "process-name" nil) | ||
| 6473 | (tramp-buffer-name vec)))) | ||
| 6474 | |||
| 6475 | (defun tramp-debug-buffer-name (vec) | ||
| 6476 | "A name for the debug buffer for VEC." | ||
| 6477 | ;; We must use `tramp-file-name-real-host', because for gateway | ||
| 6478 | ;; methods the default port will be expanded later on, which would | ||
| 6479 | ;; tamper the name. | ||
| 6480 | (let ((method (tramp-file-name-method vec)) | ||
| 6481 | (user (tramp-file-name-user vec)) | ||
| 6482 | (host (tramp-file-name-real-host vec))) | ||
| 6483 | (if (not (zerop (length user))) | ||
| 6484 | (format "*debug tramp/%s %s@%s*" method user host) | ||
| 6485 | (format "*debug tramp/%s %s*" method host)))) | ||
| 6486 | |||
| 6487 | (defconst tramp-debug-outline-regexp | ||
| 6488 | "[0-9]+:[0-9]+:[0-9]+\\.[0-9]+ [a-z0-9-]+ (\\([0-9]+\\)) #") | ||
| 6489 | |||
| 6490 | (defun tramp-get-debug-buffer (vec) | ||
| 6491 | "Get the debug buffer for VEC." | ||
| 6492 | (with-current-buffer | ||
| 6493 | (get-buffer-create (tramp-debug-buffer-name vec)) | ||
| 6494 | (when (bobp) | ||
| 6495 | (setq buffer-undo-list t) | ||
| 6496 | ;; Activate `outline-mode'. This runs `text-mode-hook' and | ||
| 6497 | ;; `outline-mode-hook'. We must prevent that local processes | ||
| 6498 | ;; die. Yes: I've seen `flyspell-mode', which starts "ispell". | ||
| 6499 | ;; Furthermore, `outline-regexp' must have the correct value | ||
| 6500 | ;; already, because it is used by `font-lock-compile-keywords'. | ||
| 6501 | (let ((default-directory (tramp-compat-temporary-file-directory)) | ||
| 6502 | (outline-regexp tramp-debug-outline-regexp)) | ||
| 6503 | (outline-mode)) | ||
| 6504 | (set (make-local-variable 'outline-regexp) tramp-debug-outline-regexp) | ||
| 6505 | (set (make-local-variable 'outline-level) 'tramp-outline-level)) | ||
| 6506 | (current-buffer))) | ||
| 6507 | |||
| 6508 | (defun tramp-outline-level () | ||
| 6509 | "Return the depth to which a statement is nested in the outline. | ||
| 6510 | Point must be at the beginning of a header line. | ||
| 6511 | |||
| 6512 | The outline level is equal to the verbosity of the Tramp message." | ||
| 6513 | (1+ (string-to-number (match-string 1)))) | ||
| 6514 | |||
| 6515 | (defun tramp-find-executable | 6564 | (defun tramp-find-executable |
| 6516 | (vec progname dirlist &optional ignore-tilde ignore-path) | 6565 | (vec progname dirlist &optional ignore-tilde ignore-path) |
| 6517 | "Searches for PROGNAME in $PATH and all directories mentioned in DIRLIST. | 6566 | "Searches for PROGNAME in $PATH and all directories mentioned in DIRLIST. |
| @@ -7294,7 +7343,7 @@ INPUT can also be nil which means `/dev/null'. | |||
| 7294 | OUTPUT can be a string (which specifies a filename), or t (which | 7343 | OUTPUT can be a string (which specifies a filename), or t (which |
| 7295 | means standard output and thus the current buffer), or nil (which | 7344 | means standard output and thus the current buffer), or nil (which |
| 7296 | means discard it)." | 7345 | means discard it)." |
| 7297 | (tramp-local-call-process | 7346 | (tramp-compat-call-process |
| 7298 | tramp-encoding-shell | 7347 | tramp-encoding-shell |
| 7299 | (when (and input (not (string-match "%s" cmd))) input) | 7348 | (when (and input (not (string-match "%s" cmd))) input) |
| 7300 | (if (eq output t) t nil) | 7349 | (if (eq output t) t nil) |
| @@ -7397,12 +7446,10 @@ Gateway hops are already opened." | |||
| 7397 | (setq choices tramp-default-proxies-alist))))) | 7446 | (setq choices tramp-default-proxies-alist))))) |
| 7398 | 7447 | ||
| 7399 | ;; Handle gateways. | 7448 | ;; Handle gateways. |
| 7400 | (when (and (boundp 'tramp-gw-tunnel-method) | 7449 | (when (string-match |
| 7401 | (string-match (format | 7450 | (format |
| 7402 | "^\\(%s\\|%s\\)$" | 7451 | "^\\(%s\\|%s\\)$" tramp-gw-tunnel-method tramp-gw-socks-method) |
| 7403 | (symbol-value 'tramp-gw-tunnel-method) | 7452 | (tramp-file-name-method (car target-alist))) |
| 7404 | (symbol-value 'tramp-gw-socks-method)) | ||
| 7405 | (tramp-file-name-method (car target-alist)))) | ||
| 7406 | (let ((gw (pop target-alist)) | 7453 | (let ((gw (pop target-alist)) |
| 7407 | (hop (pop target-alist))) | 7454 | (hop (pop target-alist))) |
| 7408 | ;; Is the method prepared for gateways? | 7455 | ;; Is the method prepared for gateways? |
| @@ -7699,6 +7746,7 @@ function waits for output unless NOOUTPUT is set." | |||
| 7699 | ;; Return value is whether end-of-output sentinel was found. | 7746 | ;; Return value is whether end-of-output sentinel was found. |
| 7700 | found))) | 7747 | found))) |
| 7701 | 7748 | ||
| 7749 | ;;;###tramp-autoload | ||
| 7702 | (defun tramp-send-command-and-check | 7750 | (defun tramp-send-command-and-check |
| 7703 | (vec command &optional subshell dont-suppress-err) | 7751 | (vec command &optional subshell dont-suppress-err) |
| 7704 | "Run COMMAND and check its exit status. | 7752 | "Run COMMAND and check its exit status. |
| @@ -7807,57 +7855,57 @@ the remote host use line-endings as defined in the variable | |||
| 7807 | (save-match-data | 7855 | (save-match-data |
| 7808 | (logior | 7856 | (logior |
| 7809 | (cond | 7857 | (cond |
| 7810 | ((char-equal owner-read ?r) (tramp-octal-to-decimal "00400")) | 7858 | ((char-equal owner-read ?r) (tramp-compat-octal-to-decimal "00400")) |
| 7811 | ((char-equal owner-read ?-) 0) | 7859 | ((char-equal owner-read ?-) 0) |
| 7812 | (t (error "Second char `%c' must be one of `r-'" owner-read))) | 7860 | (t (error "Second char `%c' must be one of `r-'" owner-read))) |
| 7813 | (cond | 7861 | (cond |
| 7814 | ((char-equal owner-write ?w) (tramp-octal-to-decimal "00200")) | 7862 | ((char-equal owner-write ?w) (tramp-compat-octal-to-decimal "00200")) |
| 7815 | ((char-equal owner-write ?-) 0) | 7863 | ((char-equal owner-write ?-) 0) |
| 7816 | (t (error "Third char `%c' must be one of `w-'" owner-write))) | 7864 | (t (error "Third char `%c' must be one of `w-'" owner-write))) |
| 7817 | (cond | 7865 | (cond |
| 7818 | ((char-equal owner-execute-or-setid ?x) | 7866 | ((char-equal owner-execute-or-setid ?x) |
| 7819 | (tramp-octal-to-decimal "00100")) | 7867 | (tramp-compat-octal-to-decimal "00100")) |
| 7820 | ((char-equal owner-execute-or-setid ?S) | 7868 | ((char-equal owner-execute-or-setid ?S) |
| 7821 | (tramp-octal-to-decimal "04000")) | 7869 | (tramp-compat-octal-to-decimal "04000")) |
| 7822 | ((char-equal owner-execute-or-setid ?s) | 7870 | ((char-equal owner-execute-or-setid ?s) |
| 7823 | (tramp-octal-to-decimal "04100")) | 7871 | (tramp-compat-octal-to-decimal "04100")) |
| 7824 | ((char-equal owner-execute-or-setid ?-) 0) | 7872 | ((char-equal owner-execute-or-setid ?-) 0) |
| 7825 | (t (error "Fourth char `%c' must be one of `xsS-'" | 7873 | (t (error "Fourth char `%c' must be one of `xsS-'" |
| 7826 | owner-execute-or-setid))) | 7874 | owner-execute-or-setid))) |
| 7827 | (cond | 7875 | (cond |
| 7828 | ((char-equal group-read ?r) (tramp-octal-to-decimal "00040")) | 7876 | ((char-equal group-read ?r) (tramp-compat-octal-to-decimal "00040")) |
| 7829 | ((char-equal group-read ?-) 0) | 7877 | ((char-equal group-read ?-) 0) |
| 7830 | (t (error "Fifth char `%c' must be one of `r-'" group-read))) | 7878 | (t (error "Fifth char `%c' must be one of `r-'" group-read))) |
| 7831 | (cond | 7879 | (cond |
| 7832 | ((char-equal group-write ?w) (tramp-octal-to-decimal "00020")) | 7880 | ((char-equal group-write ?w) (tramp-compat-octal-to-decimal "00020")) |
| 7833 | ((char-equal group-write ?-) 0) | 7881 | ((char-equal group-write ?-) 0) |
| 7834 | (t (error "Sixth char `%c' must be one of `w-'" group-write))) | 7882 | (t (error "Sixth char `%c' must be one of `w-'" group-write))) |
| 7835 | (cond | 7883 | (cond |
| 7836 | ((char-equal group-execute-or-setid ?x) | 7884 | ((char-equal group-execute-or-setid ?x) |
| 7837 | (tramp-octal-to-decimal "00010")) | 7885 | (tramp-compat-octal-to-decimal "00010")) |
| 7838 | ((char-equal group-execute-or-setid ?S) | 7886 | ((char-equal group-execute-or-setid ?S) |
| 7839 | (tramp-octal-to-decimal "02000")) | 7887 | (tramp-compat-octal-to-decimal "02000")) |
| 7840 | ((char-equal group-execute-or-setid ?s) | 7888 | ((char-equal group-execute-or-setid ?s) |
| 7841 | (tramp-octal-to-decimal "02010")) | 7889 | (tramp-compat-octal-to-decimal "02010")) |
| 7842 | ((char-equal group-execute-or-setid ?-) 0) | 7890 | ((char-equal group-execute-or-setid ?-) 0) |
| 7843 | (t (error "Seventh char `%c' must be one of `xsS-'" | 7891 | (t (error "Seventh char `%c' must be one of `xsS-'" |
| 7844 | group-execute-or-setid))) | 7892 | group-execute-or-setid))) |
| 7845 | (cond | 7893 | (cond |
| 7846 | ((char-equal other-read ?r) | 7894 | ((char-equal other-read ?r) |
| 7847 | (tramp-octal-to-decimal "00004")) | 7895 | (tramp-compat-octal-to-decimal "00004")) |
| 7848 | ((char-equal other-read ?-) 0) | 7896 | ((char-equal other-read ?-) 0) |
| 7849 | (t (error "Eighth char `%c' must be one of `r-'" other-read))) | 7897 | (t (error "Eighth char `%c' must be one of `r-'" other-read))) |
| 7850 | (cond | 7898 | (cond |
| 7851 | ((char-equal other-write ?w) (tramp-octal-to-decimal "00002")) | 7899 | ((char-equal other-write ?w) (tramp-compat-octal-to-decimal "00002")) |
| 7852 | ((char-equal other-write ?-) 0) | 7900 | ((char-equal other-write ?-) 0) |
| 7853 | (t (error "Nineth char `%c' must be one of `w-'" other-write))) | 7901 | (t (error "Nineth char `%c' must be one of `w-'" other-write))) |
| 7854 | (cond | 7902 | (cond |
| 7855 | ((char-equal other-execute-or-sticky ?x) | 7903 | ((char-equal other-execute-or-sticky ?x) |
| 7856 | (tramp-octal-to-decimal "00001")) | 7904 | (tramp-compat-octal-to-decimal "00001")) |
| 7857 | ((char-equal other-execute-or-sticky ?T) | 7905 | ((char-equal other-execute-or-sticky ?T) |
| 7858 | (tramp-octal-to-decimal "01000")) | 7906 | (tramp-compat-octal-to-decimal "01000")) |
| 7859 | ((char-equal other-execute-or-sticky ?t) | 7907 | ((char-equal other-execute-or-sticky ?t) |
| 7860 | (tramp-octal-to-decimal "01001")) | 7908 | (tramp-compat-octal-to-decimal "01001")) |
| 7861 | ((char-equal other-execute-or-sticky ?-) 0) | 7909 | ((char-equal other-execute-or-sticky ?-) 0) |
| 7862 | (t (error "Tenth char `%c' must be one of `xtT-'" | 7910 | (t (error "Tenth char `%c' must be one of `xtT-'" |
| 7863 | other-execute-or-sticky))))))) | 7911 | other-execute-or-sticky))))))) |
| @@ -8018,24 +8066,6 @@ This is used internally by `tramp-file-mode-from-int'." | |||
| 8018 | (and suid (upcase suid-text)) ; suid, !execute | 8066 | (and suid (upcase suid-text)) ; suid, !execute |
| 8019 | (and x "x") "-")))) ; !suid | 8067 | (and x "x") "-")))) ; !suid |
| 8020 | 8068 | ||
| 8021 | (defun tramp-decimal-to-octal (i) | ||
| 8022 | "Return a string consisting of the octal digits of I. | ||
| 8023 | Not actually used. Use `(format \"%o\" i)' instead?" | ||
| 8024 | (cond ((< i 0) (error "Cannot convert negative number to octal")) | ||
| 8025 | ((not (integerp i)) (error "Cannot convert non-integer to octal")) | ||
| 8026 | ((zerop i) "0") | ||
| 8027 | (t (concat (tramp-decimal-to-octal (/ i 8)) | ||
| 8028 | (number-to-string (% i 8)))))) | ||
| 8029 | |||
| 8030 | ;; Kudos to Gerd Moellmann for this suggestion. | ||
| 8031 | (defun tramp-octal-to-decimal (ostr) | ||
| 8032 | "Given a string of octal digits, return a decimal number." | ||
| 8033 | (let ((x (or ostr ""))) | ||
| 8034 | ;; `save-match' is in `tramp-mode-string-to-int' which calls this. | ||
| 8035 | (unless (string-match "\\`[0-7]*\\'" x) | ||
| 8036 | (error "Non-octal junk in string `%s'" x)) | ||
| 8037 | (string-to-number ostr 8))) | ||
| 8038 | |||
| 8039 | (defun tramp-shell-case-fold (string) | 8069 | (defun tramp-shell-case-fold (string) |
| 8040 | "Converts STRING to shell glob pattern which ignores case." | 8070 | "Converts STRING to shell glob pattern which ignores case." |
| 8041 | (mapconcat | 8071 | (mapconcat |
| @@ -8046,145 +8076,6 @@ Not actually used. Use `(format \"%o\" i)' instead?" | |||
| 8046 | string | 8076 | string |
| 8047 | "")) | 8077 | "")) |
| 8048 | 8078 | ||
| 8049 | |||
| 8050 | ;; ------------------------------------------------------------ | ||
| 8051 | ;; -- Tramp file names -- | ||
| 8052 | ;; ------------------------------------------------------------ | ||
| 8053 | ;; Conversion functions between external representation and | ||
| 8054 | ;; internal data structure. Convenience functions for internal | ||
| 8055 | ;; data structure. | ||
| 8056 | |||
| 8057 | (defun tramp-file-name-p (vec) | ||
| 8058 | "Check, whether VEC is a Tramp object." | ||
| 8059 | (and (vectorp vec) (= 4 (length vec)))) | ||
| 8060 | |||
| 8061 | (defun tramp-file-name-method (vec) | ||
| 8062 | "Return method component of VEC." | ||
| 8063 | (and (tramp-file-name-p vec) (aref vec 0))) | ||
| 8064 | |||
| 8065 | (defun tramp-file-name-user (vec) | ||
| 8066 | "Return user component of VEC." | ||
| 8067 | (and (tramp-file-name-p vec) (aref vec 1))) | ||
| 8068 | |||
| 8069 | (defun tramp-file-name-host (vec) | ||
| 8070 | "Return host component of VEC." | ||
| 8071 | (and (tramp-file-name-p vec) (aref vec 2))) | ||
| 8072 | |||
| 8073 | (defun tramp-file-name-localname (vec) | ||
| 8074 | "Return localname component of VEC." | ||
| 8075 | (and (tramp-file-name-p vec) (aref vec 3))) | ||
| 8076 | |||
| 8077 | ;; The user part of a Tramp file name vector can be of kind | ||
| 8078 | ;; "user%domain". Sometimes, we must extract these parts. | ||
| 8079 | (defun tramp-file-name-real-user (vec) | ||
| 8080 | "Return the user name of VEC without domain." | ||
| 8081 | (save-match-data | ||
| 8082 | (let ((user (tramp-file-name-user vec))) | ||
| 8083 | (if (and (stringp user) | ||
| 8084 | (string-match tramp-user-with-domain-regexp user)) | ||
| 8085 | (match-string 1 user) | ||
| 8086 | user)))) | ||
| 8087 | |||
| 8088 | (defun tramp-file-name-domain (vec) | ||
| 8089 | "Return the domain name of VEC." | ||
| 8090 | (save-match-data | ||
| 8091 | (let ((user (tramp-file-name-user vec))) | ||
| 8092 | (and (stringp user) | ||
| 8093 | (string-match tramp-user-with-domain-regexp user) | ||
| 8094 | (match-string 2 user))))) | ||
| 8095 | |||
| 8096 | ;; The host part of a Tramp file name vector can be of kind | ||
| 8097 | ;; "host#port". Sometimes, we must extract these parts. | ||
| 8098 | (defun tramp-file-name-real-host (vec) | ||
| 8099 | "Return the host name of VEC without port." | ||
| 8100 | (save-match-data | ||
| 8101 | (let ((host (tramp-file-name-host vec))) | ||
| 8102 | (if (and (stringp host) | ||
| 8103 | (string-match tramp-host-with-port-regexp host)) | ||
| 8104 | (match-string 1 host) | ||
| 8105 | host)))) | ||
| 8106 | |||
| 8107 | (defun tramp-file-name-port (vec) | ||
| 8108 | "Return the port number of VEC." | ||
| 8109 | (save-match-data | ||
| 8110 | (let ((host (tramp-file-name-host vec))) | ||
| 8111 | (and (stringp host) | ||
| 8112 | (string-match tramp-host-with-port-regexp host) | ||
| 8113 | (string-to-number (match-string 2 host)))))) | ||
| 8114 | |||
| 8115 | (defun tramp-tramp-file-p (name) | ||
| 8116 | "Return t if NAME is a string with Tramp file name syntax." | ||
| 8117 | (save-match-data | ||
| 8118 | (and (stringp name) (string-match tramp-file-name-regexp name)))) | ||
| 8119 | |||
| 8120 | (defun tramp-find-method (method user host) | ||
| 8121 | "Return the right method string to use. | ||
| 8122 | This is METHOD, if non-nil. Otherwise, do a lookup in | ||
| 8123 | `tramp-default-method-alist'." | ||
| 8124 | (or method | ||
| 8125 | (let ((choices tramp-default-method-alist) | ||
| 8126 | lmethod item) | ||
| 8127 | (while choices | ||
| 8128 | (setq item (pop choices)) | ||
| 8129 | (when (and (string-match (or (nth 0 item) "") (or host "")) | ||
| 8130 | (string-match (or (nth 1 item) "") (or user ""))) | ||
| 8131 | (setq lmethod (nth 2 item)) | ||
| 8132 | (setq choices nil))) | ||
| 8133 | lmethod) | ||
| 8134 | tramp-default-method)) | ||
| 8135 | |||
| 8136 | (defun tramp-find-user (method user host) | ||
| 8137 | "Return the right user string to use. | ||
| 8138 | This is USER, if non-nil. Otherwise, do a lookup in | ||
| 8139 | `tramp-default-user-alist'." | ||
| 8140 | (or user | ||
| 8141 | (let ((choices tramp-default-user-alist) | ||
| 8142 | luser item) | ||
| 8143 | (while choices | ||
| 8144 | (setq item (pop choices)) | ||
| 8145 | (when (and (string-match (or (nth 0 item) "") (or method "")) | ||
| 8146 | (string-match (or (nth 1 item) "") (or host ""))) | ||
| 8147 | (setq luser (nth 2 item)) | ||
| 8148 | (setq choices nil))) | ||
| 8149 | luser) | ||
| 8150 | tramp-default-user)) | ||
| 8151 | |||
| 8152 | (defun tramp-find-host (method user host) | ||
| 8153 | "Return the right host string to use. | ||
| 8154 | This is HOST, if non-nil. Otherwise, it is `tramp-default-host'." | ||
| 8155 | (or (and (> (length host) 0) host) | ||
| 8156 | tramp-default-host)) | ||
| 8157 | |||
| 8158 | (defun tramp-dissect-file-name (name &optional nodefault) | ||
| 8159 | "Return a `tramp-file-name' structure. | ||
| 8160 | The structure consists of remote method, remote user, remote host | ||
| 8161 | and localname (file name on remote host). If NODEFAULT is | ||
| 8162 | non-nil, the file name parts are not expanded to their default | ||
| 8163 | values." | ||
| 8164 | (save-match-data | ||
| 8165 | (let ((match (string-match (nth 0 tramp-file-name-structure) name))) | ||
| 8166 | (unless match (error "Not a Tramp file name: %s" name)) | ||
| 8167 | (let ((method (match-string (nth 1 tramp-file-name-structure) name)) | ||
| 8168 | (user (match-string (nth 2 tramp-file-name-structure) name)) | ||
| 8169 | (host (match-string (nth 3 tramp-file-name-structure) name)) | ||
| 8170 | (localname (match-string (nth 4 tramp-file-name-structure) name))) | ||
| 8171 | (when (member method '("multi" "multiu")) | ||
| 8172 | (error | ||
| 8173 | "`%s' method is no longer supported, see (info \"(tramp)Multi-hops\")" | ||
| 8174 | method)) | ||
| 8175 | (when host | ||
| 8176 | (when (string-match tramp-prefix-ipv6-regexp host) | ||
| 8177 | (setq host (replace-match "" nil t host))) | ||
| 8178 | (when (string-match tramp-postfix-ipv6-regexp host) | ||
| 8179 | (setq host (replace-match "" nil t host)))) | ||
| 8180 | (if nodefault | ||
| 8181 | (vector method user host localname) | ||
| 8182 | (vector | ||
| 8183 | (tramp-find-method method user host) | ||
| 8184 | (tramp-find-user method user host) | ||
| 8185 | (tramp-find-host method user host) | ||
| 8186 | localname)))))) | ||
| 8187 | |||
| 8188 | (defun tramp-equal-remote (file1 file2) | 8079 | (defun tramp-equal-remote (file1 file2) |
| 8189 | "Check, whether the remote parts of FILE1 and FILE2 are identical. | 8080 | "Check, whether the remote parts of FILE1 and FILE2 are identical. |
| 8190 | The check depends on method, user and host name of the files. If | 8081 | The check depends on method, user and host name of the files. If |
| @@ -8203,37 +8094,6 @@ would yield `t'. On the other hand, the following check results in nil: | |||
| 8203 | (stringp (file-remote-p file2)) | 8094 | (stringp (file-remote-p file2)) |
| 8204 | (string-equal (file-remote-p file1) (file-remote-p file2)))) | 8095 | (string-equal (file-remote-p file1) (file-remote-p file2)))) |
| 8205 | 8096 | ||
| 8206 | (defun tramp-make-tramp-file-name (method user host localname) | ||
| 8207 | "Constructs a Tramp file name from METHOD, USER, HOST and LOCALNAME." | ||
| 8208 | (concat tramp-prefix-format | ||
| 8209 | (when (not (zerop (length method))) | ||
| 8210 | (concat method tramp-postfix-method-format)) | ||
| 8211 | (when (not (zerop (length user))) | ||
| 8212 | (concat user tramp-postfix-user-format)) | ||
| 8213 | (when host | ||
| 8214 | (if (string-match tramp-ipv6-regexp host) | ||
| 8215 | (concat tramp-prefix-ipv6-format host tramp-postfix-ipv6-format) | ||
| 8216 | host)) | ||
| 8217 | tramp-postfix-host-format | ||
| 8218 | (when localname localname))) | ||
| 8219 | |||
| 8220 | (defun tramp-completion-make-tramp-file-name (method user host localname) | ||
| 8221 | "Constructs a Tramp file name from METHOD, USER, HOST and LOCALNAME. | ||
| 8222 | It must not be a complete Tramp file name, but as long as there are | ||
| 8223 | necessary only. This function will be used in file name completion." | ||
| 8224 | (concat tramp-prefix-format | ||
| 8225 | (when (not (zerop (length method))) | ||
| 8226 | (concat method tramp-postfix-method-format)) | ||
| 8227 | (when (not (zerop (length user))) | ||
| 8228 | (concat user tramp-postfix-user-format)) | ||
| 8229 | (when (not (zerop (length host))) | ||
| 8230 | (concat | ||
| 8231 | (if (string-match tramp-ipv6-regexp host) | ||
| 8232 | (concat tramp-prefix-ipv6-format host tramp-postfix-ipv6-format) | ||
| 8233 | host) | ||
| 8234 | tramp-postfix-host-format)) | ||
| 8235 | (when localname localname))) | ||
| 8236 | |||
| 8237 | (defun tramp-make-copy-program-file-name (vec) | 8097 | (defun tramp-make-copy-program-file-name (vec) |
| 8238 | "Create a file name suitable to be passed to `rcp' and workalikes." | 8098 | "Create a file name suitable to be passed to `rcp' and workalikes." |
| 8239 | (let ((user (tramp-file-name-user vec)) | 8099 | (let ((user (tramp-file-name-user vec)) |
| @@ -8281,6 +8141,7 @@ necessary only. This function will be used in file name completion." | |||
| 8281 | 8141 | ||
| 8282 | ;; Variables local to connection. | 8142 | ;; Variables local to connection. |
| 8283 | 8143 | ||
| 8144 | ;;;###tramp-autoload | ||
| 8284 | (defun tramp-get-remote-path (vec) | 8145 | (defun tramp-get-remote-path (vec) |
| 8285 | (with-connection-property | 8146 | (with-connection-property |
| 8286 | ;; When `tramp-own-remote-path' is in `tramp-remote-path', we | 8147 | ;; When `tramp-own-remote-path' is in `tramp-remote-path', we |
| @@ -8354,6 +8215,7 @@ necessary only. This function will be used in file name completion." | |||
| 8354 | x)) | 8215 | x)) |
| 8355 | remote-path))))) | 8216 | remote-path))))) |
| 8356 | 8217 | ||
| 8218 | ;;;###tramp-autoload | ||
| 8357 | (defun tramp-get-remote-tmpdir (vec) | 8219 | (defun tramp-get-remote-tmpdir (vec) |
| 8358 | (with-connection-property vec "tmp-directory" | 8220 | (with-connection-property vec "tmp-directory" |
| 8359 | (let ((dir (tramp-shell-quote-argument "/tmp"))) | 8221 | (let ((dir (tramp-shell-quote-argument "/tmp"))) |
| @@ -8435,6 +8297,7 @@ necessary only. This function will be used in file name completion." | |||
| 8435 | (tramp-message vec 5 "Finding command to check if file exists") | 8297 | (tramp-message vec 5 "Finding command to check if file exists") |
| 8436 | (tramp-find-file-exists-command vec))) | 8298 | (tramp-find-file-exists-command vec))) |
| 8437 | 8299 | ||
| 8300 | ;;;###tramp-autoload | ||
| 8438 | (defun tramp-get-remote-ln (vec) | 8301 | (defun tramp-get-remote-ln (vec) |
| 8439 | (with-connection-property vec "ln" | 8302 | (with-connection-property vec "ln" |
| 8440 | (tramp-message vec 5 "Finding a suitable `ln' command") | 8303 | (tramp-message vec 5 "Finding a suitable `ln' command") |
| @@ -8682,8 +8545,9 @@ If the `tramp-methods' entry does not exist, return nil." | |||
| 8682 | ;; Permissions should be set always, because there might be an old | 8545 | ;; Permissions should be set always, because there might be an old |
| 8683 | ;; auto-saved file belonging to another original file. This could | 8546 | ;; auto-saved file belonging to another original file. This could |
| 8684 | ;; be a security threat. | 8547 | ;; be a security threat. |
| 8685 | (set-file-modes buffer-auto-save-file-name | 8548 | (set-file-modes |
| 8686 | (or (file-modes bfn) (tramp-octal-to-decimal "0600")))))) | 8549 | buffer-auto-save-file-name |
| 8550 | (or (file-modes bfn) (tramp-compat-octal-to-decimal "0600")))))) | ||
| 8687 | 8551 | ||
| 8688 | (unless (and (featurep 'xemacs) | 8552 | (unless (and (featurep 'xemacs) |
| 8689 | (= emacs-major-version 21) | 8553 | (= emacs-major-version 21) |
| @@ -8787,7 +8651,6 @@ Return the difference in the format of a time value." | |||
| 8787 | (defun tramp-time-diff (t1 t2) | 8651 | (defun tramp-time-diff (t1 t2) |
| 8788 | "Return the difference between the two times, in seconds. | 8652 | "Return the difference between the two times, in seconds. |
| 8789 | T1 and T2 are time values (as returned by `current-time' for example)." | 8653 | T1 and T2 are time values (as returned by `current-time' for example)." |
| 8790 | ;; Pacify byte-compiler with `symbol-function'. | ||
| 8791 | (cond ((and (fboundp 'subtract-time) | 8654 | (cond ((and (fboundp 'subtract-time) |
| 8792 | (fboundp 'float-time)) | 8655 | (fboundp 'float-time)) |
| 8793 | (tramp-compat-funcall | 8656 | (tramp-compat-funcall |
| @@ -8863,6 +8726,7 @@ exiting if process is running." | |||
| 8863 | ;; CCC: This function should be rewritten so that | 8726 | ;; CCC: This function should be rewritten so that |
| 8864 | ;; `shell-quote-argument' is not used. This way, we are safe from | 8727 | ;; `shell-quote-argument' is not used. This way, we are safe from |
| 8865 | ;; changes in `shell-quote-argument'. | 8728 | ;; changes in `shell-quote-argument'. |
| 8729 | ;;;###tramp-autoload | ||
| 8866 | (defun tramp-shell-quote-argument (s) | 8730 | (defun tramp-shell-quote-argument (s) |
| 8867 | "Similar to `shell-quote-argument', but groks newlines. | 8731 | "Similar to `shell-quote-argument', but groks newlines. |
| 8868 | Only works for Bourne-like shells." | 8732 | Only works for Bourne-like shells." |
| @@ -8888,11 +8752,9 @@ Only works for Bourne-like shells." | |||
| 8888 | (defun tramp-unload-tramp () | 8752 | (defun tramp-unload-tramp () |
| 8889 | "Discard Tramp from loading remote files." | 8753 | "Discard Tramp from loading remote files." |
| 8890 | (interactive) | 8754 | (interactive) |
| 8891 | ;; When Tramp is not loaded yet, its autoloads are still active. | ||
| 8892 | (tramp-unload-file-name-handlers) | ||
| 8893 | ;; ange-ftp settings must be enabled. | 8755 | ;; ange-ftp settings must be enabled. |
| 8894 | (tramp-compat-funcall 'tramp-ftp-enable-ange-ftp) | 8756 | (tramp-compat-funcall 'tramp-ftp-enable-ange-ftp) |
| 8895 | ;; Maybe its not loaded yet. | 8757 | ;; Maybe it's not loaded yet. |
| 8896 | (condition-case nil | 8758 | (condition-case nil |
| 8897 | (unload-feature 'tramp 'force) | 8759 | (unload-feature 'tramp 'force) |
| 8898 | (error nil))) | 8760 | (error nil))) |
| @@ -8991,7 +8853,6 @@ Only works for Bourne-like shells." | |||
| 8991 | ;; expects English? Or just to set LC_MESSAGES to "C" if Tramp | 8853 | ;; expects English? Or just to set LC_MESSAGES to "C" if Tramp |
| 8992 | ;; expects only English messages? (Juri Linkov) | 8854 | ;; expects only English messages? (Juri Linkov) |
| 8993 | ;; * Make shadowfile.el grok Tramp filenames. (Bug#4526, Bug#4846) | 8855 | ;; * Make shadowfile.el grok Tramp filenames. (Bug#4526, Bug#4846) |
| 8994 | ;; * Load Tramp subpackages only when needed. (Bug#1529, Bug#5448, Bug#5705) | ||
| 8995 | ;; * Try telnet+curl as new method. It might be useful for busybox, | 8856 | ;; * Try telnet+curl as new method. It might be useful for busybox, |
| 8996 | ;; without built-in uuencode/uudecode. | 8857 | ;; without built-in uuencode/uudecode. |
| 8997 | ;; * Load ~/.emacs_SHELLNAME on the remote host for `shell'. | 8858 | ;; * Load ~/.emacs_SHELLNAME on the remote host for `shell'. |
diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el index 8725721869d..7690e859310 100644 --- a/lisp/net/trampver.el +++ b/lisp/net/trampver.el | |||
| @@ -31,16 +31,29 @@ | |||
| 31 | ;; version check is defined in macro AC_EMACS_INFO of aclocal.m4; | 31 | ;; version check is defined in macro AC_EMACS_INFO of aclocal.m4; |
| 32 | ;; should be changed only there. | 32 | ;; should be changed only there. |
| 33 | 33 | ||
| 34 | (defconst tramp-version "2.1.19" | 34 | ;;;###tramp-autoload |
| 35 | (defconst tramp-version "2.2.0-pre" | ||
| 35 | "This version of Tramp.") | 36 | "This version of Tramp.") |
| 36 | 37 | ||
| 38 | ;;;###tramp-autoload | ||
| 37 | (defconst tramp-bug-report-address "tramp-devel@gnu.org" | 39 | (defconst tramp-bug-report-address "tramp-devel@gnu.org" |
| 38 | "Email address to send bug reports to.") | 40 | "Email address to send bug reports to.") |
| 39 | 41 | ||
| 40 | ;; Check for (X)Emacs version. | 42 | ;; Check for (X)Emacs version. |
| 41 | (let ((x (if (or (>= emacs-major-version 22) (and (featurep 'xemacs) (= emacs-major-version 21) (>= emacs-minor-version 4))) "ok" (format "Tramp 2.1.19 is not fit for %s" (when (string-match "^.*$" (emacs-version)) (match-string 0 (emacs-version))))))) | 43 | (let ((x (if (or (>= emacs-major-version 22) |
| 44 | (and (featurep 'xemacs) | ||
| 45 | (= emacs-major-version 21) | ||
| 46 | (>= emacs-minor-version 4))) | ||
| 47 | "ok" | ||
| 48 | (format "Tramp 2.2.0-pre is not fit for %s" | ||
| 49 | (when (string-match "^.*$" (emacs-version)) | ||
| 50 | (match-string 0 (emacs-version))))))) | ||
| 42 | (unless (string-match "\\`ok\\'" x) (error "%s" x))) | 51 | (unless (string-match "\\`ok\\'" x) (error "%s" x))) |
| 43 | 52 | ||
| 53 | (add-hook 'tramp-unload-hook | ||
| 54 | (lambda () | ||
| 55 | (unload-feature 'trampver 'force))) | ||
| 56 | |||
| 44 | (provide 'trampver) | 57 | (provide 'trampver) |
| 45 | 58 | ||
| 46 | ;; arch-tag: 443576ca-f8f1-4bb1-addc-5c70861e93b1 | 59 | ;; arch-tag: 443576ca-f8f1-4bb1-addc-5c70861e93b1 |
diff --git a/lisp/notifications.el b/lisp/notifications.el index beb63a6311b..68db58e54fa 100644 --- a/lisp/notifications.el +++ b/lisp/notifications.el | |||
| @@ -42,6 +42,9 @@ | |||
| 42 | 42 | ||
| 43 | (require 'dbus) | 43 | (require 'dbus) |
| 44 | 44 | ||
| 45 | (defconst notifications-specification-version "1.1" | ||
| 46 | "The version of the Desktop Notifications Specification implemented.") | ||
| 47 | |||
| 45 | (defconst notifications-application-name "Emacs" | 48 | (defconst notifications-application-name "Emacs" |
| 46 | "Default application name.") | 49 | "Default application name.") |
| 47 | 50 | ||
| @@ -151,7 +154,14 @@ Various PARAMS can be set: | |||
| 151 | :image-data This is a raw data image format which describes the width, | 154 | :image-data This is a raw data image format which describes the width, |
| 152 | height, rowstride, has alpha, bits per sample, channels and | 155 | height, rowstride, has alpha, bits per sample, channels and |
| 153 | image data respectively. | 156 | image data respectively. |
| 157 | :image-path This is represented either as a URI (file:// is the | ||
| 158 | only URI schema supported right now) or a name | ||
| 159 | in a freedesktop.org-compliant icon theme. | ||
| 154 | :sound-file The path to a sound file to play when the notification pops up. | 160 | :sound-file The path to a sound file to play when the notification pops up. |
| 161 | :sound-name A themeable named sound from the freedesktop.org sound naming | ||
| 162 | specification to play when the notification pops up. | ||
| 163 | Similar to icon-name,only for sounds. An example would | ||
| 164 | be \"message-new-instant\". | ||
| 155 | :suppress-sound Causes the server to suppress playing any sounds, if it has | 165 | :suppress-sound Causes the server to suppress playing any sounds, if it has |
| 156 | that ability. | 166 | that ability. |
| 157 | :x Specifies the X location on the screen that the notification | 167 | :x Specifies the X location on the screen that the notification |
| @@ -186,7 +196,9 @@ used to manipulate the notification item with | |||
| 186 | (category (plist-get params :category)) | 196 | (category (plist-get params :category)) |
| 187 | (desktop-entry (plist-get params :desktop-entry)) | 197 | (desktop-entry (plist-get params :desktop-entry)) |
| 188 | (image-data (plist-get params :image-data)) | 198 | (image-data (plist-get params :image-data)) |
| 199 | (image-path (plist-get params :image-path)) | ||
| 189 | (sound-file (plist-get params :sound-file)) | 200 | (sound-file (plist-get params :sound-file)) |
| 201 | (sound-name (plist-get params :sound-name)) | ||
| 190 | (suppress-sound (plist-get params :suppress-sound)) | 202 | (suppress-sound (plist-get params :suppress-sound)) |
| 191 | (x (plist-get params :x)) | 203 | (x (plist-get params :x)) |
| 192 | (y (plist-get params :y)) | 204 | (y (plist-get params :y)) |
| @@ -211,10 +223,18 @@ used to manipulate the notification item with | |||
| 211 | (add-to-list 'hints `(:dict-entry | 223 | (add-to-list 'hints `(:dict-entry |
| 212 | "image_data" | 224 | "image_data" |
| 213 | (:variant :struct ,image-data)) t)) | 225 | (:variant :struct ,image-data)) t)) |
| 226 | (when image-path | ||
| 227 | (add-to-list 'hints `(:dict-entry | ||
| 228 | "image_path" | ||
| 229 | (:variant :string ,image-path)) t)) | ||
| 214 | (when sound-file | 230 | (when sound-file |
| 215 | (add-to-list 'hints `(:dict-entry | 231 | (add-to-list 'hints `(:dict-entry |
| 216 | "sound-file" | 232 | "sound-file" |
| 217 | (:variant :string ,sound-file)) t)) | 233 | (:variant :string ,sound-file)) t)) |
| 234 | (when sound-name | ||
| 235 | (add-to-list 'hints `(:dict-entry | ||
| 236 | "sound-name" | ||
| 237 | (:variant :string ,sound-name)) t)) | ||
| 218 | (when suppress-sound | 238 | (when suppress-sound |
| 219 | (add-to-list 'hints `(:dict-entry | 239 | (add-to-list 'hints `(:dict-entry |
| 220 | "suppress-sound" | 240 | "suppress-sound" |
diff --git a/lisp/nxml/TODO b/lisp/nxml/TODO deleted file mode 100644 index a5ac542f942..00000000000 --- a/lisp/nxml/TODO +++ /dev/null | |||
| @@ -1,468 +0,0 @@ | |||
| 1 | * High priority | ||
| 2 | |||
| 3 | ** Command to insert an element template, including all required | ||
| 4 | attributes and child elements. When there's a choice of elements | ||
| 5 | possible, we could insert a comment, and put an overlay on that | ||
| 6 | comment that makes it behave like a button with a pop-up menu to | ||
| 7 | select the appropriate choice. | ||
| 8 | |||
| 9 | ** Command to tag a region. With a schema should complete using legal | ||
| 10 | tags, but should work without a schema as well. | ||
| 11 | |||
| 12 | ** Provide a way to conveniently rename an element. With a schema should | ||
| 13 | complete using legal tags, but should work without a schema as well. | ||
| 14 | |||
| 15 | * Outlining | ||
| 16 | |||
| 17 | ** Implement C-c C-o C-q. | ||
| 18 | |||
| 19 | ** Install pre/post command hook for moving out of invisible section. | ||
| 20 | |||
| 21 | ** Put a modify hook on invisible sections that expands them. | ||
| 22 | |||
| 23 | ** Integrate dumb folding somehow. | ||
| 24 | |||
| 25 | ** An element should be able to be its own heading. | ||
| 26 | |||
| 27 | ** Optimize to avoid complete buffer scan on each command. | ||
| 28 | |||
| 29 | ** Make it work with HTML-style headings (i.e. level indicated by | ||
| 30 | name of heading element rather than depth of section nesting). | ||
| 31 | |||
| 32 | ** Recognize root element as a section provided it has a title, even | ||
| 33 | if it doesn't match section-element-name-regex. | ||
| 34 | |||
| 35 | ** Support for incremental search automatically making hidden text | ||
| 36 | visible. | ||
| 37 | |||
| 38 | ** Allow title to be an attribute. | ||
| 39 | |||
| 40 | ** Command that says to recognize the tag at point as a section/heading. | ||
| 41 | |||
| 42 | ** Explore better ways to determine when an element is a section | ||
| 43 | or a heading. | ||
| 44 | |||
| 45 | ** rng-next-error needs to either ignore invisible portion or reveal it | ||
| 46 | (maybe use isearch oriented text properties). | ||
| 47 | |||
| 48 | ** Errors within hidden section should be highlighted by underlining the | ||
| 49 | ellipsis. | ||
| 50 | |||
| 51 | ** Make indirect buffers work. | ||
| 52 | |||
| 53 | ** How should nxml-refresh outline recover from non well-formed tags? | ||
| 54 | |||
| 55 | ** Hide tags in title elements? | ||
| 56 | |||
| 57 | ** Use overlays instead of text properties for holding outline state? | ||
| 58 | Necessary for indirect buffers to work? | ||
| 59 | |||
| 60 | ** Allow an outline to go in the speedbar. | ||
| 61 | |||
| 62 | ** Split up outlining manual section into subsections. | ||
| 63 | |||
| 64 | ** More detail in the manual about each outlining command. | ||
| 65 | |||
| 66 | ** More menu entries for hiding/showing? | ||
| 67 | |||
| 68 | ** Indication of many lines have been hidden? | ||
| 69 | |||
| 70 | * Locating schemas | ||
| 71 | |||
| 72 | ** Should rng-validate-mode give the user an opportunity to specify a | ||
| 73 | schema if there is currently none? Or should it at least give a hint | ||
| 74 | to the user how to specify a non-vacuous schema? | ||
| 75 | |||
| 76 | ** Support for adding new schemas to schema-locating files. Add | ||
| 77 | documentElement and namespace elements. | ||
| 78 | |||
| 79 | ** C-c C-w should be able to report current type id. | ||
| 80 | |||
| 81 | ** Implement doctypePublicId. | ||
| 82 | |||
| 83 | ** Implement typeIdBase. | ||
| 84 | |||
| 85 | ** Implement typeIdProcessingInstruction. | ||
| 86 | |||
| 87 | ** Support xml:base. | ||
| 88 | |||
| 89 | ** Implement group. | ||
| 90 | |||
| 91 | ** Find preferred prefix from schema-locating files. Get rid of | ||
| 92 | rng-preferred-prefix-alist. | ||
| 93 | |||
| 94 | ** Inserting document element with vacuous schema should complete using | ||
| 95 | document elements declared in schema locating files, and set schema | ||
| 96 | appropriately. | ||
| 97 | |||
| 98 | ** Add a ruleType attribute to the <include> element? | ||
| 99 | |||
| 100 | ** Allow processing instruction in prolog to contain the compact syntax | ||
| 101 | schema directly. | ||
| 102 | |||
| 103 | ** Use RDDL to locate a schema based on the namespace URI. | ||
| 104 | |||
| 105 | ** Should not prompt to add redundant association to schema locating | ||
| 106 | file. | ||
| 107 | |||
| 108 | ** Command to reload current schema. | ||
| 109 | |||
| 110 | * Schema-sensitive features | ||
| 111 | |||
| 112 | ** Should filter dynamic markup possibilities using schema validity, by | ||
| 113 | adding hook to nxml-mode. | ||
| 114 | |||
| 115 | ** Dynamic markup word should (at least optionally) be able to look in | ||
| 116 | other buffers that are using nxml-mode. | ||
| 117 | |||
| 118 | ** Should clicking on Invalid move to next error if already on an error? | ||
| 119 | |||
| 120 | ** Take advantage of a:documentation. Needs change to schema format. | ||
| 121 | |||
| 122 | ** Provide feasible validation (as in Jing) toggle. | ||
| 123 | |||
| 124 | ** Save the validation state as a property on the error overlay to enable | ||
| 125 | more detailed diagnosis. | ||
| 126 | |||
| 127 | ** Provide an Error Summary buffer showing all the validation errors. | ||
| 128 | |||
| 129 | ** Pop-up menu. What is useful? Tag a region (should be greyed out if | ||
| 130 | the region is not balanced). Suggestions based on error messages. | ||
| 131 | |||
| 132 | ** Have configurable list of namespace URIs so that we can provide | ||
| 133 | namespace URI completion on extension elements or with schema-less | ||
| 134 | documents. | ||
| 135 | |||
| 136 | ** Allow validation to handle XInclude. | ||
| 137 | |||
| 138 | ** ID/IDREF support. | ||
| 139 | |||
| 140 | * Completion | ||
| 141 | |||
| 142 | ** Make it work with icomplete. Only use a function to complete when | ||
| 143 | some of the possible names have undeclared namespaces. | ||
| 144 | |||
| 145 | ** How should C-return in mixed text work? | ||
| 146 | |||
| 147 | ** When there's a vacuous schema, C-return after < will insert the | ||
| 148 | end-tag. Is this a bug or a feature? | ||
| 149 | |||
| 150 | ** After completing start-tag, ensure we don't get unhelpful message | ||
| 151 | from validation | ||
| 152 | |||
| 153 | ** Syntax table for completion. | ||
| 154 | |||
| 155 | ** Should complete start-tag name with a space if namespace attributes | ||
| 156 | are required. | ||
| 157 | |||
| 158 | ** When completing start-tag name with no prefix and it doesn't match | ||
| 159 | should try to infer namespace from local name. | ||
| 160 | |||
| 161 | ** Should completion pay attention to characters after point? If so, | ||
| 162 | how? | ||
| 163 | |||
| 164 | ** When completing start-tag name, add required atts if only one required | ||
| 165 | attribute. | ||
| 166 | |||
| 167 | ** When completing attribute name, add attribute value if only one value | ||
| 168 | is possible. | ||
| 169 | |||
| 170 | ** After attribute-value completion, insert space after close delimiter | ||
| 171 | if more attributes are required. | ||
| 172 | |||
| 173 | ** Complete on enumerated data values in elements. | ||
| 174 | |||
| 175 | ** When in context that allows only elements, should get tag | ||
| 176 | completion without having to type < first. | ||
| 177 | |||
| 178 | ** When immediately after start-tag name, and name is valid and not | ||
| 179 | prefix of any other name, should C-return complete on attribute names? | ||
| 180 | |||
| 181 | ** When completing attributes, more consistent to ignore all attributes | ||
| 182 | after point. | ||
| 183 | |||
| 184 | ** Inserting attribute value completions needs to be sensitive to what | ||
| 185 | delimiter is used so that it quotes the correct character. | ||
| 186 | |||
| 187 | ** Complete on encoding-names in XML decl. | ||
| 188 | |||
| 189 | ** Complete namespace declarations by searching for all namespaces | ||
| 190 | mentioned in the schema. | ||
| 191 | |||
| 192 | * Well-formed XML support | ||
| 193 | |||
| 194 | ** Deal better with Mule-UCS | ||
| 195 | |||
| 196 | ** Deal with UTF-8 BOM when reading. | ||
| 197 | |||
| 198 | ** Complete entity names. | ||
| 199 | |||
| 200 | ** Provide some support for entity names for MathML. | ||
| 201 | |||
| 202 | ** Command to repeat the last tag. | ||
| 203 | |||
| 204 | ** Support for changing between character references and characters. | ||
| 205 | Need to check that context is one in which character references are | ||
| 206 | allowed. xmltok prolog parsing will need to distinguish parameter | ||
| 207 | literals from other kinds of literal. | ||
| 208 | |||
| 209 | ** Provide a comment command to bind to M-; that works better than the | ||
| 210 | normal one. | ||
| 211 | |||
| 212 | ** Make indenting in a multi-line comment work. | ||
| 213 | |||
| 214 | ** Structure view. Separate buffer displaying element tree. Be able to | ||
| 215 | navigate from structure view to document and vice-versa. | ||
| 216 | |||
| 217 | ** Flash matching >. | ||
| 218 | |||
| 219 | ** Smart selection command that selects increasingly large syntactically | ||
| 220 | coherent chunks of XML. If point is in an attribute value, first | ||
| 221 | select complete value; then if command is repeated, select value plus | ||
| 222 | delimiters, then select attribute name as well, then complete | ||
| 223 | start-tag, then complete element, then enclosing element, etc. | ||
| 224 | |||
| 225 | ** ispell integration. | ||
| 226 | |||
| 227 | ** Block-level items in mixed content should be indented, e.g: | ||
| 228 | <para>This is list: | ||
| 229 | <ul> | ||
| 230 | <li>item</li> | ||
| 231 | |||
| 232 | ** Provide option to indent like this: | ||
| 233 | |||
| 234 | ** <para>This is a paragraph | ||
| 235 | occupying multiple lines.</para> | ||
| 236 | |||
| 237 | ** Option to add make a / that closes a start-tag electrically insert a | ||
| 238 | space for the XHTML guys. | ||
| 239 | |||
| 240 | ** C-M-q should work. | ||
| 241 | |||
| 242 | * Datatypes | ||
| 243 | |||
| 244 | ** Figure out workaround for CJK characters with regexps. | ||
| 245 | |||
| 246 | ** Does category C contain Cn? | ||
| 247 | |||
| 248 | ** Do ENTITY datatype properly. | ||
| 249 | |||
| 250 | * XML Parsing Library | ||
| 251 | |||
| 252 | ** Parameter entity parsing option, nil (never), t (always), | ||
| 253 | unless-standalone (unless standalone="yes" in XML declaration). | ||
| 254 | |||
| 255 | ** When a file is currently being edited, there should be an option to | ||
| 256 | use its buffer instead of the on-disk copy. | ||
| 257 | |||
| 258 | * Handling all XML features | ||
| 259 | |||
| 260 | ** Provide better support for editing external general parsed entities. | ||
| 261 | Perhaps provide a way to force ignoring undefined entities; maybe turn | ||
| 262 | this on automatically with <?xml encoding=""?> (with no version | ||
| 263 | pseudo-att). | ||
| 264 | |||
| 265 | ** Handle internal general entity declarations containing elements. | ||
| 266 | |||
| 267 | ** Handle external general entity declarations. | ||
| 268 | |||
| 269 | ** Handle default attribute declarations in internal subset. | ||
| 270 | |||
| 271 | ** Handle parameter entities (including DTD). | ||
| 272 | |||
| 273 | * RELAX NG | ||
| 274 | |||
| 275 | ** Do complete schema checking, at least optionally. | ||
| 276 | |||
| 277 | ** Detect include/external loops during schema parse. | ||
| 278 | |||
| 279 | ** Coding system detection for schemas. Should use utf-8/utf-16 per the | ||
| 280 | spec. But also need to allow encodings other than UTF-8/16 to support | ||
| 281 | CJK charsets that Emacs cannot represent in Unicode. | ||
| 282 | |||
| 283 | * Catching XML errors | ||
| 284 | |||
| 285 | ** Check public identifiers. | ||
| 286 | |||
| 287 | ** Check default attribute values. | ||
| 288 | |||
| 289 | * Performance | ||
| 290 | |||
| 291 | ** Explore whether overlay-recenter can cure overlays performance | ||
| 292 | problems. | ||
| 293 | |||
| 294 | ** Cache schemas. Need to have list of files and mtimes. | ||
| 295 | |||
| 296 | ** Make it possible to reduce rng-validate-chunk-size significantly, | ||
| 297 | perhaps to 500 bytes, without bad performance impact: don't do | ||
| 298 | redisplay on every chunk; pass continue functions on other uses of | ||
| 299 | rng-do-some-validation. | ||
| 300 | |||
| 301 | ** Cache after first tag. | ||
| 302 | |||
| 303 | ** Introduce a new name class that is a choice between names (so that | ||
| 304 | we can use member) | ||
| 305 | |||
| 306 | ** intern-choice should simplify after patterns with same 1st/2nd args | ||
| 307 | |||
| 308 | ** Large numbers of overlays slow things down dramatically. Represent | ||
| 309 | errors using text properties. This implies we cannot incrementally | ||
| 310 | keep track of the number of errors, in order to determine validity. | ||
| 311 | Instead, when validation completes, scan for any characters with an | ||
| 312 | error text property; this seems to be fast enough even with large | ||
| 313 | buffers. Problem with error at end of buffer, where there's no | ||
| 314 | character; need special variable for this. Need to merge face from | ||
| 315 | font-lock with the error face: use :inherit attribute with list of two | ||
| 316 | faces. How do we avoid making rng-valid depend on nxml-mode? | ||
| 317 | |||
| 318 | * Error recovery | ||
| 319 | |||
| 320 | ** Don't stop at newline in looking for close of start-tag. | ||
| 321 | |||
| 322 | ** Use indentation to guide recovery from mismatched end-tags | ||
| 323 | |||
| 324 | ** Don't keep parsing when currently not well-formed but previously | ||
| 325 | well-formed | ||
| 326 | |||
| 327 | ** Try to recover from a bad start-tag by popping an open element if | ||
| 328 | there was a mismatched end-tag unaccounted for. | ||
| 329 | |||
| 330 | ** Try to recover from a bad start-tag open on the hypothesis that there | ||
| 331 | was an error in the namespace URI. | ||
| 332 | |||
| 333 | ** Better recovery from ill-formed XML declarations. | ||
| 334 | |||
| 335 | * Useability improvements | ||
| 336 | |||
| 337 | ** Should print a "Parsing..." message during long movements. | ||
| 338 | |||
| 339 | ** Provide better position for reference to undefined pattern error. | ||
| 340 | |||
| 341 | ** Put Well-formed in the mode-line when validating against any-content. | ||
| 342 | |||
| 343 | ** Trim marking of illegal data for leading and trailing whitespace. | ||
| 344 | |||
| 345 | ** Show Invalid status as soon as we are sure it's invalid, rather than | ||
| 346 | waiting for everything to be completely up to date. | ||
| 347 | |||
| 348 | ** When narrowed, Valid or Invalid status should probably consider only | ||
| 349 | validity of narrowed region. | ||
| 350 | |||
| 351 | * Bug fixes | ||
| 352 | |||
| 353 | ** Need to give an error for a document like: <foo/><![CDATA[ ]]> | ||
| 354 | |||
| 355 | ** Make nxml-forward-balanced-item work better for the prolog. | ||
| 356 | |||
| 357 | ** Make filling and indenting comments work in the prolog. | ||
| 358 | |||
| 359 | ** Should delete RNC Input buffers. | ||
| 360 | |||
| 361 | ** Figure out what regex use for NCName and use it consistently, | ||
| 362 | |||
| 363 | ** Should have not-well-formed tokens in ref. | ||
| 364 | |||
| 365 | ** Require version in XML declaration? Probably not because prevents | ||
| 366 | use for external parsed entities. At least forbid standalone | ||
| 367 | without version. | ||
| 368 | |||
| 369 | ** Reject schema that compiles to rng-not-allowed-ipattern. | ||
| 370 | |||
| 371 | ** Move point backwards on schema parse error so that it's on the right token. | ||
| 372 | |||
| 373 | * Internal | ||
| 374 | |||
| 375 | ** Use rng-quote-string consistently. | ||
| 376 | |||
| 377 | ** Use parsing library for XML to texinfo conversion. | ||
| 378 | |||
| 379 | ** Rename xmltok.el to nxml-token.el. Use nxml-t- prefix instead of | ||
| 380 | xmltok-. Change nxml-t-type to nxml-t-token-type, nxml-t-start to | ||
| 381 | nxml-t-token-start. | ||
| 382 | |||
| 383 | ** Can we set fill-prefix to nil and rely on indenting? | ||
| 384 | |||
| 385 | ** xmltok should make available replacement text of entities containing | ||
| 386 | elements | ||
| 387 | |||
| 388 | ** In rng-valid, instead of using modification-hooks and | ||
| 389 | insert-behind-hooks on dependent overlays, use same technique as | ||
| 390 | nxml-mode. | ||
| 391 | |||
| 392 | ** Port to XEmacs. Issues include: Unicode (XEmacs seems to be based on | ||
| 393 | Mule-UCS); overlays/text properties vs extents; absence of | ||
| 394 | fontification-functions hook. | ||
| 395 | |||
| 396 | * Fontification | ||
| 397 | |||
| 398 | ** Allow face to depend on element qname, attribute qname, attribute | ||
| 399 | value. Use list with pairs of (R . F), where R specifies regexps and | ||
| 400 | F specifies faces. How can this list be made to depend on the | ||
| 401 | document type? | ||
| 402 | |||
| 403 | * Other | ||
| 404 | |||
| 405 | ** Support RELAX NG XML syntax (use XML parsing library). | ||
| 406 | |||
| 407 | ** Support W3C XML Schema (use XML parsing library). | ||
| 408 | |||
| 409 | ** Command to infer schema from current document (like trang). | ||
| 410 | |||
| 411 | * Schemas | ||
| 412 | |||
| 413 | ** XSLT schema should take advantage of RELAX NG to express cooccurrence | ||
| 414 | constraints on attributes (e.g. xsl:template). | ||
| 415 | |||
| 416 | * Documentation | ||
| 417 | |||
| 418 | ** Move material from README to manual. | ||
| 419 | |||
| 420 | ** Document encodings. | ||
| 421 | |||
| 422 | * Notes | ||
| 423 | |||
| 424 | ** How can we allow an error to be displayed on a different token from | ||
| 425 | where it is detected? In particular, for a missing closing ">" we | ||
| 426 | will need to display it at the beginning of the following token. At | ||
| 427 | the moment, when we parse the following token the error overlay will | ||
| 428 | get cleared. | ||
| 429 | |||
| 430 | ** How should rng-goto-next-error deal with narrowing? | ||
| 431 | |||
| 432 | ** Perhaps should merge errors having same start position even if they | ||
| 433 | have different ends. | ||
| 434 | |||
| 435 | ** How to handle surrogates? One possibility is to be compatible with | ||
| 436 | utf8.e: represent as sequence of 4 chars. But utf-16 is incompatible | ||
| 437 | with this. | ||
| 438 | |||
| 439 | ** Should we distinguish well-formedness errors from invalidity errors? | ||
| 440 | (I think not: we may want to recover from a bad start-tag by implying | ||
| 441 | an end-tag.) | ||
| 442 | |||
| 443 | ** Seems to be a bug with Emacs, where a mouse movement that causes | ||
| 444 | help-echo text to appear counts as pending input but does not cause | ||
| 445 | idle timer to be restarted. | ||
| 446 | |||
| 447 | ** Use XML to represent this file. | ||
| 448 | |||
| 449 | ** I had a TODO which said simply "split-string". What did I mean? | ||
| 450 | |||
| 451 | ** Investigate performance on large files all on one line. | ||
| 452 | |||
| 453 | * Issues for Emacs versions >= 22 | ||
| 454 | |||
| 455 | ** Take advantage of UTF-8 CJK support. | ||
| 456 | |||
| 457 | ** Supply a next-error-function. | ||
| 458 | |||
| 459 | ** Investigate this NEWS item "Emacs now tries to set up buffer coding | ||
| 460 | systems for HTML/XML files automatically." | ||
| 461 | |||
| 462 | ** Take advantage of the pointer text property. | ||
| 463 | |||
| 464 | ** Leverage char-displayable-p. | ||
| 465 | |||
| 466 | Local variables: | ||
| 467 | mode: outline | ||
| 468 | end: | ||
diff --git a/lisp/proced.el b/lisp/proced.el index 06056ed2683..ee4e7b26ca1 100644 --- a/lisp/proced.el +++ b/lisp/proced.el | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Roland Winkler <Roland.Winkler@physik.uni-erlangen.de> | 5 | ;; Author: Roland Winkler <winkler@gnu.org> |
| 6 | ;; Keywords: Processes, Unix | 6 | ;; Keywords: Processes, Unix |
| 7 | 7 | ||
| 8 | ;; This file is part of GNU Emacs. | 8 | ;; This file is part of GNU Emacs. |
diff --git a/lisp/progmodes/ada-mode.el b/lisp/progmodes/ada-mode.el index 227f202fef0..4bbe1e43f85 100644 --- a/lisp/progmodes/ada-mode.el +++ b/lisp/progmodes/ada-mode.el | |||
| @@ -834,10 +834,7 @@ the 4 file locations can be clicked on and jumped to." | |||
| 834 | ;; | 834 | ;; |
| 835 | ;; On Emacs, this is done through the `syntax-table' text property. The | 835 | ;; On Emacs, this is done through the `syntax-table' text property. The |
| 836 | ;; corresponding action is applied automatically each time the buffer | 836 | ;; corresponding action is applied automatically each time the buffer |
| 837 | ;; changes. If `font-lock-mode' is enabled (the default) the action is | 837 | ;; changes via syntax-propertize-function. |
| 838 | ;; set up by `font-lock-syntactic-keywords'. Otherwise, we do it | ||
| 839 | ;; manually in `ada-after-change-function'. The proper method is | ||
| 840 | ;; installed by `ada-handle-syntax-table-properties'. | ||
| 841 | ;; | 838 | ;; |
| 842 | ;; on XEmacs, the `syntax-table' property does not exist and we have to use a | 839 | ;; on XEmacs, the `syntax-table' property does not exist and we have to use a |
| 843 | ;; slow advice to `parse-partial-sexp' to do the same thing. | 840 | ;; slow advice to `parse-partial-sexp' to do the same thing. |
| @@ -937,6 +934,12 @@ declares it as a word constituent." | |||
| 937 | (insert (caddar change)) | 934 | (insert (caddar change)) |
| 938 | (setq change (cdr change))))))) | 935 | (setq change (cdr change))))))) |
| 939 | 936 | ||
| 937 | (unless (eval-when-compile (fboundp 'syntax-propertize-via-font-lock)) | ||
| 938 | ;; Before `syntax-propertize', we had to use font-lock to apply syntax-table | ||
| 939 | ;; properties, and in some cases we even had to do it manually (in | ||
| 940 | ;; `ada-after-change-function'). `ada-handle-syntax-table-properties' | ||
| 941 | ;; decides which method to use. | ||
| 942 | |||
| 940 | (defun ada-set-syntax-table-properties () | 943 | (defun ada-set-syntax-table-properties () |
| 941 | "Assign `syntax-table' properties in accessible part of buffer. | 944 | "Assign `syntax-table' properties in accessible part of buffer. |
| 942 | In particular, character constants are said to be strings, #...# | 945 | In particular, character constants are said to be strings, #...# |
| @@ -991,6 +994,8 @@ OLD-LEN indicates what the length of the replaced text was." | |||
| 991 | ;; Take care of `syntax-table' properties manually. | 994 | ;; Take care of `syntax-table' properties manually. |
| 992 | (ada-initialize-syntax-table-properties))) | 995 | (ada-initialize-syntax-table-properties))) |
| 993 | 996 | ||
| 997 | ) ;;(not (fboundp 'syntax-propertize)) | ||
| 998 | |||
| 994 | ;;------------------------------------------------------------------ | 999 | ;;------------------------------------------------------------------ |
| 995 | ;; Testing the grammatical context | 1000 | ;; Testing the grammatical context |
| 996 | ;;------------------------------------------------------------------ | 1001 | ;;------------------------------------------------------------------ |
| @@ -1118,7 +1123,8 @@ the file name." | |||
| 1118 | 1123 | ||
| 1119 | ;;;###autoload | 1124 | ;;;###autoload |
| 1120 | (defun ada-mode () | 1125 | (defun ada-mode () |
| 1121 | "Ada mode is the major mode for editing Ada code." | 1126 | "Ada mode is the major mode for editing Ada code. |
| 1127 | \\{ada-mode-map}" | ||
| 1122 | 1128 | ||
| 1123 | (interactive) | 1129 | (interactive) |
| 1124 | (kill-all-local-variables) | 1130 | (kill-all-local-variables) |
| @@ -1161,9 +1167,9 @@ the file name." | |||
| 1161 | (set (make-local-variable 'comment-padding) 0) | 1167 | (set (make-local-variable 'comment-padding) 0) |
| 1162 | (set (make-local-variable 'parse-sexp-lookup-properties) t)) | 1168 | (set (make-local-variable 'parse-sexp-lookup-properties) t)) |
| 1163 | 1169 | ||
| 1164 | (set 'case-fold-search t) | 1170 | (setq case-fold-search t) |
| 1165 | (if (boundp 'imenu-case-fold-search) | 1171 | (if (boundp 'imenu-case-fold-search) |
| 1166 | (set 'imenu-case-fold-search t)) | 1172 | (setq imenu-case-fold-search t)) |
| 1167 | 1173 | ||
| 1168 | (set (make-local-variable 'fill-paragraph-function) | 1174 | (set (make-local-variable 'fill-paragraph-function) |
| 1169 | 'ada-fill-comment-paragraph) | 1175 | 'ada-fill-comment-paragraph) |
| @@ -1186,8 +1192,13 @@ the file name." | |||
| 1186 | '(ada-font-lock-keywords | 1192 | '(ada-font-lock-keywords |
| 1187 | nil t | 1193 | nil t |
| 1188 | ((?\_ . "w") (?# . ".")) | 1194 | ((?\_ . "w") (?# . ".")) |
| 1189 | beginning-of-line | 1195 | beginning-of-line)) |
| 1190 | (font-lock-syntactic-keywords . ada-font-lock-syntactic-keywords))) | 1196 | |
| 1197 | (if (eval-when-compile (fboundp 'syntax-propertize-via-font-lock)) | ||
| 1198 | (set (make-local-variable 'syntax-propertize-function) | ||
| 1199 | (syntax-propertize-via-font-lock ada-font-lock-syntactic-keywords)) | ||
| 1200 | (set (make-local-variable 'font-lock-syntactic-keywords) | ||
| 1201 | ada-font-lock-syntactic-keywords)) | ||
| 1191 | 1202 | ||
| 1192 | ;; Set up support for find-file.el. | 1203 | ;; Set up support for find-file.el. |
| 1193 | (set (make-local-variable 'ff-other-file-alist) | 1204 | (set (make-local-variable 'ff-other-file-alist) |
| @@ -1322,22 +1333,24 @@ the file name." | |||
| 1322 | 1333 | ||
| 1323 | ;; To be run after the hook, in case the user modified | 1334 | ;; To be run after the hook, in case the user modified |
| 1324 | ;; ada-fill-comment-prefix | 1335 | ;; ada-fill-comment-prefix |
| 1325 | (make-local-variable 'comment-start) | 1336 | ;; FIXME: if the user modified ada-fill-comment-prefix in his .emacs |
| 1326 | (if ada-fill-comment-prefix | 1337 | ;; then it was already available before running the hook, and if he |
| 1327 | (set 'comment-start ada-fill-comment-prefix) | 1338 | ;; modifies it in the hook, he might as well modify comment-start instead. |
| 1328 | (set 'comment-start "-- ")) | 1339 | (set (make-local-variable 'comment-start) (or ada-fill-comment-prefix "-- ")) |
| 1329 | 1340 | ||
| 1330 | ;; Run this after the hook to give the users a chance to activate | 1341 | ;; Run this after the hook to give the users a chance to activate |
| 1331 | ;; font-lock-mode | 1342 | ;; font-lock-mode |
| 1332 | 1343 | ||
| 1333 | (unless (featurep 'xemacs) | 1344 | (unless (or (eval-when-compile (fboundp 'syntax-propertize-via-font-lock)) |
| 1345 | (featurep 'xemacs)) | ||
| 1334 | (ada-initialize-syntax-table-properties) | 1346 | (ada-initialize-syntax-table-properties) |
| 1335 | (add-hook 'font-lock-mode-hook 'ada-handle-syntax-table-properties nil t)) | 1347 | (add-hook 'font-lock-mode-hook 'ada-handle-syntax-table-properties nil t)) |
| 1336 | 1348 | ||
| 1337 | ;; the following has to be done after running the ada-mode-hook | 1349 | ;; the following has to be done after running the ada-mode-hook |
| 1338 | ;; because users might want to set the values of these variable | 1350 | ;; because users might want to set the values of these variable |
| 1339 | ;; inside the hook | 1351 | ;; inside the hook |
| 1340 | 1352 | ;; FIXME: it might even be set later on via file-local vars, no? | |
| 1353 | ;; so maybe ada-keywords should be set lazily. | ||
| 1341 | (cond ((eq ada-language-version 'ada83) | 1354 | (cond ((eq ada-language-version 'ada83) |
| 1342 | (setq ada-keywords ada-83-keywords)) | 1355 | (setq ada-keywords ada-83-keywords)) |
| 1343 | ((eq ada-language-version 'ada95) | 1356 | ((eq ada-language-version 'ada95) |
| @@ -1397,25 +1410,21 @@ If WORD is not given, then the current word in the buffer is used instead. | |||
| 1397 | The new word is added to the first file in `ada-case-exception-file'. | 1410 | The new word is added to the first file in `ada-case-exception-file'. |
| 1398 | The standard casing rules will no longer apply to this word." | 1411 | The standard casing rules will no longer apply to this word." |
| 1399 | (interactive) | 1412 | (interactive) |
| 1400 | (let ((previous-syntax-table (syntax-table)) | 1413 | (let ((file-name |
| 1401 | file-name | 1414 | (cond ((stringp ada-case-exception-file) |
| 1402 | ) | 1415 | ada-case-exception-file) |
| 1403 | 1416 | ((listp ada-case-exception-file) | |
| 1404 | (cond ((stringp ada-case-exception-file) | 1417 | (car ada-case-exception-file)) |
| 1405 | (setq file-name ada-case-exception-file)) | 1418 | (t |
| 1406 | ((listp ada-case-exception-file) | 1419 | (error (concat "No exception file specified. " |
| 1407 | (setq file-name (car ada-case-exception-file))) | 1420 | "See variable ada-case-exception-file")))))) |
| 1408 | (t | ||
| 1409 | (error (concat "No exception file specified. " | ||
| 1410 | "See variable ada-case-exception-file")))) | ||
| 1411 | 1421 | ||
| 1412 | (set-syntax-table ada-mode-symbol-syntax-table) | ||
| 1413 | (unless word | 1422 | (unless word |
| 1414 | (save-excursion | 1423 | (with-syntax-table ada-mode-symbol-syntax-table |
| 1415 | (skip-syntax-backward "w") | 1424 | (save-excursion |
| 1416 | (setq word (buffer-substring-no-properties | 1425 | (skip-syntax-backward "w") |
| 1417 | (point) (save-excursion (forward-word 1) (point)))))) | 1426 | (setq word (buffer-substring-no-properties |
| 1418 | (set-syntax-table previous-syntax-table) | 1427 | (point) (save-excursion (forward-word 1) (point))))))) |
| 1419 | 1428 | ||
| 1420 | ;; Reread the exceptions file, in case it was modified by some other, | 1429 | ;; Reread the exceptions file, in case it was modified by some other, |
| 1421 | (ada-case-read-exceptions-from-file file-name) | 1430 | (ada-case-read-exceptions-from-file file-name) |
| @@ -1425,11 +1434,9 @@ The standard casing rules will no longer apply to this word." | |||
| 1425 | (if (and (not (equal ada-case-exception '())) | 1434 | (if (and (not (equal ada-case-exception '())) |
| 1426 | (assoc-string word ada-case-exception t)) | 1435 | (assoc-string word ada-case-exception t)) |
| 1427 | (setcar (assoc-string word ada-case-exception t) word) | 1436 | (setcar (assoc-string word ada-case-exception t) word) |
| 1428 | (add-to-list 'ada-case-exception (cons word t)) | 1437 | (add-to-list 'ada-case-exception (cons word t))) |
| 1429 | ) | ||
| 1430 | 1438 | ||
| 1431 | (ada-save-exceptions-to-file file-name) | 1439 | (ada-save-exceptions-to-file file-name))) |
| 1432 | )) | ||
| 1433 | 1440 | ||
| 1434 | (defun ada-create-case-exception-substring (&optional word) | 1441 | (defun ada-create-case-exception-substring (&optional word) |
| 1435 | "Define the substring WORD as an exception for the casing system. | 1442 | "Define the substring WORD as an exception for the casing system. |
| @@ -1464,7 +1471,7 @@ word itself has a special casing." | |||
| 1464 | (modify-syntax-entry ?_ "." (syntax-table)) | 1471 | (modify-syntax-entry ?_ "." (syntax-table)) |
| 1465 | (save-excursion | 1472 | (save-excursion |
| 1466 | (skip-syntax-backward "w") | 1473 | (skip-syntax-backward "w") |
| 1467 | (set 'word (buffer-substring-no-properties | 1474 | (setq word (buffer-substring-no-properties |
| 1468 | (point) | 1475 | (point) |
| 1469 | (save-excursion (forward-word 1) (point)))))) | 1476 | (save-excursion (forward-word 1) (point)))))) |
| 1470 | (modify-syntax-entry ?_ (make-string 1 underscore-syntax) | 1477 | (modify-syntax-entry ?_ (make-string 1 underscore-syntax) |
| @@ -1633,37 +1640,30 @@ ARG is the prefix the user entered with \\[universal-argument]." | |||
| 1633 | (interactive "P") | 1640 | (interactive "P") |
| 1634 | 1641 | ||
| 1635 | (if ada-auto-case | 1642 | (if ada-auto-case |
| 1636 | (let ((lastk last-command-event) | 1643 | (let ((lastk last-command-event)) |
| 1637 | (previous-syntax-table (syntax-table))) | 1644 | |
| 1638 | 1645 | (with-syntax-table ada-mode-symbol-syntax-table | |
| 1639 | (unwind-protect | 1646 | (cond ((or (eq lastk ?\n) |
| 1640 | (progn | 1647 | (eq lastk ?\r)) |
| 1641 | (set-syntax-table ada-mode-symbol-syntax-table) | 1648 | ;; horrible kludge |
| 1642 | (cond ((or (eq lastk ?\n) | 1649 | (insert " ") |
| 1643 | (eq lastk ?\r)) | 1650 | (ada-adjust-case) |
| 1644 | ;; horrible kludge | 1651 | ;; horrible dekludge |
| 1645 | (insert " ") | 1652 | (delete-char -1) |
| 1646 | (ada-adjust-case) | 1653 | ;; some special keys and their bindings |
| 1647 | ;; horrible dekludge | 1654 | (cond |
| 1648 | (delete-char -1) | 1655 | ((eq lastk ?\n) |
| 1649 | ;; some special keys and their bindings | 1656 | (funcall ada-lfd-binding)) |
| 1650 | (cond | 1657 | ((eq lastk ?\r) |
| 1651 | ((eq lastk ?\n) | 1658 | (funcall ada-ret-binding)))) |
| 1652 | (funcall ada-lfd-binding)) | 1659 | ((eq lastk ?\C-i) (ada-tab)) |
| 1653 | ((eq lastk ?\r) | 1660 | ;; Else just insert the character |
| 1654 | (funcall ada-ret-binding)))) | 1661 | ((self-insert-command (prefix-numeric-value arg)))) |
| 1655 | ((eq lastk ?\C-i) (ada-tab)) | 1662 | ;; if there is a keyword in front of the underscore |
| 1656 | ;; Else just insert the character | 1663 | ;; then it should be part of an identifier (MH) |
| 1657 | ((self-insert-command (prefix-numeric-value arg)))) | 1664 | (if (eq lastk ?_) |
| 1658 | ;; if there is a keyword in front of the underscore | 1665 | (ada-adjust-case t) |
| 1659 | ;; then it should be part of an identifier (MH) | 1666 | (ada-adjust-case)))) |
| 1660 | (if (eq lastk ?_) | ||
| 1661 | (ada-adjust-case t) | ||
| 1662 | (ada-adjust-case)) | ||
| 1663 | ) | ||
| 1664 | ;; Restore the syntax table | ||
| 1665 | (set-syntax-table previous-syntax-table)) | ||
| 1666 | ) | ||
| 1667 | 1667 | ||
| 1668 | ;; Else, no auto-casing | 1668 | ;; Else, no auto-casing |
| 1669 | (cond | 1669 | (cond |
| @@ -1672,10 +1672,10 @@ ARG is the prefix the user entered with \\[universal-argument]." | |||
| 1672 | ((eq last-command-event ?\r) | 1672 | ((eq last-command-event ?\r) |
| 1673 | (funcall ada-ret-binding)) | 1673 | (funcall ada-ret-binding)) |
| 1674 | (t | 1674 | (t |
| 1675 | (self-insert-command (prefix-numeric-value arg)))) | 1675 | (self-insert-command (prefix-numeric-value arg)))))) |
| 1676 | )) | ||
| 1677 | 1676 | ||
| 1678 | (defun ada-activate-keys-for-case () | 1677 | (defun ada-activate-keys-for-case () |
| 1678 | ;; FIXME: Use post-self-insert-hook instead of changing key bindings. | ||
| 1679 | "Modify the key bindings for all the keys that should readjust the casing." | 1679 | "Modify the key bindings for all the keys that should readjust the casing." |
| 1680 | (interactive) | 1680 | (interactive) |
| 1681 | ;; Save original key-bindings to allow swapping ret/lfd | 1681 | ;; Save original key-bindings to allow swapping ret/lfd |
| @@ -1735,44 +1735,41 @@ Attention: This function might take very long for big regions!" | |||
| 1735 | (let ((begin nil) | 1735 | (let ((begin nil) |
| 1736 | (end nil) | 1736 | (end nil) |
| 1737 | (keywordp nil) | 1737 | (keywordp nil) |
| 1738 | (attribp nil) | 1738 | (attribp nil)) |
| 1739 | (previous-syntax-table (syntax-table))) | ||
| 1740 | (message "Adjusting case ...") | 1739 | (message "Adjusting case ...") |
| 1741 | (unwind-protect | 1740 | (with-syntax-table ada-mode-symbol-syntax-table |
| 1742 | (save-excursion | 1741 | (save-excursion |
| 1743 | (set-syntax-table ada-mode-symbol-syntax-table) | 1742 | (goto-char to) |
| 1744 | (goto-char to) | 1743 | ;; |
| 1745 | ;; | 1744 | ;; loop: look for all identifiers, keywords, and attributes |
| 1746 | ;; loop: look for all identifiers, keywords, and attributes | 1745 | ;; |
| 1747 | ;; | 1746 | (while (re-search-backward "\\<\\(\\sw+\\)\\>" from t) |
| 1748 | (while (re-search-backward "\\<\\(\\sw+\\)\\>" from t) | 1747 | (setq end (match-end 1)) |
| 1749 | (setq end (match-end 1)) | 1748 | (setq attribp |
| 1750 | (setq attribp | 1749 | (and (> (point) from) |
| 1751 | (and (> (point) from) | 1750 | (save-excursion |
| 1752 | (save-excursion | 1751 | (forward-char -1) |
| 1753 | (forward-char -1) | 1752 | (setq attribp (looking-at "'.[^']"))))) |
| 1754 | (setq attribp (looking-at "'.[^']"))))) | 1753 | (or |
| 1755 | (or | 1754 | ;; do nothing if it is a string or comment |
| 1756 | ;; do nothing if it is a string or comment | 1755 | (ada-in-string-or-comment-p) |
| 1757 | (ada-in-string-or-comment-p) | 1756 | (progn |
| 1758 | (progn | 1757 | ;; |
| 1759 | ;; | 1758 | ;; get the identifier or keyword or attribute |
| 1760 | ;; get the identifier or keyword or attribute | 1759 | ;; |
| 1761 | ;; | 1760 | (setq begin (point)) |
| 1762 | (setq begin (point)) | 1761 | (setq keywordp (looking-at ada-keywords)) |
| 1763 | (setq keywordp (looking-at ada-keywords)) | 1762 | (goto-char end) |
| 1764 | (goto-char end) | 1763 | ;; |
| 1765 | ;; | 1764 | ;; casing according to user-option |
| 1766 | ;; casing according to user-option | 1765 | ;; |
| 1767 | ;; | 1766 | (if attribp |
| 1768 | (if attribp | 1767 | (funcall ada-case-attribute -1) |
| 1769 | (funcall ada-case-attribute -1) | 1768 | (if keywordp |
| 1770 | (if keywordp | 1769 | (funcall ada-case-keyword -1) |
| 1771 | (funcall ada-case-keyword -1) | 1770 | (ada-adjust-case-identifier))) |
| 1772 | (ada-adjust-case-identifier))) | 1771 | (goto-char begin)))) |
| 1773 | (goto-char begin)))) | 1772 | (message "Adjusting case ... Done"))))) |
| 1774 | (message "Adjusting case ... Done")) | ||
| 1775 | (set-syntax-table previous-syntax-table)))) | ||
| 1776 | 1773 | ||
| 1777 | (defun ada-adjust-case-buffer () | 1774 | (defun ada-adjust-case-buffer () |
| 1778 | "Adjust the case of all words in the whole buffer. | 1775 | "Adjust the case of all words in the whole buffer. |
| @@ -1803,46 +1800,39 @@ ATTENTION: This function might take very long for big buffers!" | |||
| 1803 | (let ((begin nil) | 1800 | (let ((begin nil) |
| 1804 | (end nil) | 1801 | (end nil) |
| 1805 | (delend nil) | 1802 | (delend nil) |
| 1806 | (paramlist nil) | 1803 | (paramlist nil)) |
| 1807 | (previous-syntax-table (syntax-table))) | 1804 | (with-syntax-table ada-mode-symbol-syntax-table |
| 1808 | (unwind-protect | ||
| 1809 | (progn | ||
| 1810 | (set-syntax-table ada-mode-symbol-syntax-table) | ||
| 1811 | 1805 | ||
| 1812 | ;; check if really inside parameter list | 1806 | ;; check if really inside parameter list |
| 1813 | (or (ada-in-paramlist-p) | 1807 | (or (ada-in-paramlist-p) |
| 1814 | (error "Not in parameter list")) | 1808 | (error "Not in parameter list")) |
| 1815 | 1809 | ||
| 1816 | ;; find start of current parameter-list | 1810 | ;; find start of current parameter-list |
| 1817 | (ada-search-ignore-string-comment | 1811 | (ada-search-ignore-string-comment |
| 1818 | (concat ada-subprog-start-re "\\|\\<body\\>" ) t nil) | 1812 | (concat ada-subprog-start-re "\\|\\<body\\>" ) t nil) |
| 1819 | (down-list 1) | 1813 | (down-list 1) |
| 1820 | (backward-char 1) | 1814 | (backward-char 1) |
| 1821 | (setq begin (point)) | 1815 | (setq begin (point)) |
| 1822 | 1816 | ||
| 1823 | ;; find end of parameter-list | 1817 | ;; find end of parameter-list |
| 1824 | (forward-sexp 1) | 1818 | (forward-sexp 1) |
| 1825 | (setq delend (point)) | 1819 | (setq delend (point)) |
| 1826 | (delete-char -1) | 1820 | (delete-char -1) |
| 1827 | (insert "\n") | 1821 | (insert "\n") |
| 1828 | |||
| 1829 | ;; find end of last parameter-declaration | ||
| 1830 | (forward-comment -1000) | ||
| 1831 | (setq end (point)) | ||
| 1832 | 1822 | ||
| 1833 | ;; build a list of all elements of the parameter-list | 1823 | ;; find end of last parameter-declaration |
| 1834 | (setq paramlist (ada-scan-paramlist (1+ begin) end)) | 1824 | (forward-comment -1000) |
| 1825 | (setq end (point)) | ||
| 1835 | 1826 | ||
| 1836 | ;; delete the original parameter-list | 1827 | ;; build a list of all elements of the parameter-list |
| 1837 | (delete-region begin delend) | 1828 | (setq paramlist (ada-scan-paramlist (1+ begin) end)) |
| 1838 | 1829 | ||
| 1839 | ;; insert the new parameter-list | 1830 | ;; delete the original parameter-list |
| 1840 | (goto-char begin) | 1831 | (delete-region begin delend) |
| 1841 | (ada-insert-paramlist paramlist)) | ||
| 1842 | 1832 | ||
| 1843 | ;; restore syntax-table | 1833 | ;; insert the new parameter-list |
| 1844 | (set-syntax-table previous-syntax-table) | 1834 | (goto-char begin) |
| 1845 | ))) | 1835 | (ada-insert-paramlist paramlist)))) |
| 1846 | 1836 | ||
| 1847 | (defun ada-scan-paramlist (begin end) | 1837 | (defun ada-scan-paramlist (begin end) |
| 1848 | "Scan the parameter list found in between BEGIN and END. | 1838 | "Scan the parameter list found in between BEGIN and END. |
| @@ -2186,14 +2176,12 @@ Return the new position of point or nil if not found." | |||
| 2186 | Return the calculation that was done, including the reference point | 2176 | Return the calculation that was done, including the reference point |
| 2187 | and the offset." | 2177 | and the offset." |
| 2188 | (interactive) | 2178 | (interactive) |
| 2189 | (let ((previous-syntax-table (syntax-table)) | 2179 | (let ((orgpoint (point-marker)) |
| 2190 | (orgpoint (point-marker)) | ||
| 2191 | cur-indent tmp-indent | 2180 | cur-indent tmp-indent |
| 2192 | prev-indent) | 2181 | prev-indent) |
| 2193 | 2182 | ||
| 2194 | (unwind-protect | 2183 | (unwind-protect |
| 2195 | (progn | 2184 | (with-syntax-table ada-mode-symbol-syntax-table |
| 2196 | (set-syntax-table ada-mode-symbol-syntax-table) | ||
| 2197 | 2185 | ||
| 2198 | ;; This need to be done here so that the advice is not always | 2186 | ;; This need to be done here so that the advice is not always |
| 2199 | ;; activated (this might interact badly with other modes) | 2187 | ;; activated (this might interact badly with other modes) |
| @@ -2203,14 +2191,14 @@ and the offset." | |||
| 2203 | (save-excursion | 2191 | (save-excursion |
| 2204 | (setq cur-indent | 2192 | (setq cur-indent |
| 2205 | 2193 | ||
| 2206 | ;; Not First line in the buffer ? | 2194 | ;; Not First line in the buffer ? |
| 2207 | (if (save-excursion (zerop (forward-line -1))) | 2195 | (if (save-excursion (zerop (forward-line -1))) |
| 2208 | (progn | 2196 | (progn |
| 2209 | (back-to-indentation) | 2197 | (back-to-indentation) |
| 2210 | (ada-get-current-indent)) | 2198 | (ada-get-current-indent)) |
| 2211 | 2199 | ||
| 2212 | ;; first line in the buffer | 2200 | ;; first line in the buffer |
| 2213 | (list (point-min) 0)))) | 2201 | (list (point-min) 0)))) |
| 2214 | 2202 | ||
| 2215 | ;; Evaluate the list to get the column to indent to | 2203 | ;; Evaluate the list to get the column to indent to |
| 2216 | ;; prev-indent contains the column to indent to | 2204 | ;; prev-indent contains the column to indent to |
| @@ -2242,14 +2230,10 @@ and the offset." | |||
| 2242 | (if (< (current-column) (current-indentation)) | 2230 | (if (< (current-column) (current-indentation)) |
| 2243 | (back-to-indentation))) | 2231 | (back-to-indentation))) |
| 2244 | 2232 | ||
| 2245 | ;; restore syntax-table | ||
| 2246 | (set-syntax-table previous-syntax-table) | ||
| 2247 | (if (featurep 'xemacs) | 2233 | (if (featurep 'xemacs) |
| 2248 | (ad-deactivate 'parse-partial-sexp)) | 2234 | (ad-deactivate 'parse-partial-sexp))) |
| 2249 | ) | ||
| 2250 | 2235 | ||
| 2251 | cur-indent | 2236 | cur-indent)) |
| 2252 | )) | ||
| 2253 | 2237 | ||
| 2254 | (defun ada-get-current-indent () | 2238 | (defun ada-get-current-indent () |
| 2255 | "Return the indentation to use for the current line." | 2239 | "Return the indentation to use for the current line." |
| @@ -2512,11 +2496,11 @@ and the offset." | |||
| 2512 | (if (looking-at "renames") | 2496 | (if (looking-at "renames") |
| 2513 | (let (pos) | 2497 | (let (pos) |
| 2514 | (save-excursion | 2498 | (save-excursion |
| 2515 | (set 'pos (ada-search-ignore-string-comment ";\\|return\\>" t))) | 2499 | (setq pos (ada-search-ignore-string-comment ";\\|return\\>" t))) |
| 2516 | (if (and pos | 2500 | (if (and pos |
| 2517 | (= (downcase (char-after (car pos))) ?r)) | 2501 | (= (downcase (char-after (car pos))) ?r)) |
| 2518 | (goto-char (car pos))) | 2502 | (goto-char (car pos))) |
| 2519 | (set 'var 'ada-indent-renames))) | 2503 | (setq var 'ada-indent-renames))) |
| 2520 | 2504 | ||
| 2521 | (forward-comment -1000) | 2505 | (forward-comment -1000) |
| 2522 | (if (= (char-before) ?\)) | 2506 | (if (= (char-before) ?\)) |
| @@ -2533,7 +2517,7 @@ and the offset." | |||
| 2533 | (looking-at "\\(function\\|procedure\\)\\>")) | 2517 | (looking-at "\\(function\\|procedure\\)\\>")) |
| 2534 | (progn | 2518 | (progn |
| 2535 | (backward-word 1) | 2519 | (backward-word 1) |
| 2536 | (set 'num-back 2) | 2520 | (setq num-back 2) |
| 2537 | (looking-at "\\(function\\|procedure\\)\\>"))))) | 2521 | (looking-at "\\(function\\|procedure\\)\\>"))))) |
| 2538 | 2522 | ||
| 2539 | ;; The indentation depends of the value of ada-indent-return | 2523 | ;; The indentation depends of the value of ada-indent-return |
| @@ -4046,8 +4030,7 @@ Point is moved at the beginning of the SEARCH-RE." | |||
| 4046 | (let (found | 4030 | (let (found |
| 4047 | begin | 4031 | begin |
| 4048 | end | 4032 | end |
| 4049 | parse-result | 4033 | parse-result) |
| 4050 | (previous-syntax-table (syntax-table))) | ||
| 4051 | 4034 | ||
| 4052 | ;; FIXME: need to pass BACKWARD to search-func! | 4035 | ;; FIXME: need to pass BACKWARD to search-func! |
| 4053 | (unless search-func | 4036 | (unless search-func |
| @@ -4057,67 +4040,65 @@ Point is moved at the beginning of the SEARCH-RE." | |||
| 4057 | ;; search until found or end-of-buffer | 4040 | ;; search until found or end-of-buffer |
| 4058 | ;; We have to test that we do not look further than limit | 4041 | ;; We have to test that we do not look further than limit |
| 4059 | ;; | 4042 | ;; |
| 4060 | (set-syntax-table ada-mode-symbol-syntax-table) | 4043 | (with-syntax-table ada-mode-symbol-syntax-table |
| 4061 | (while (and (not found) | 4044 | (while (and (not found) |
| 4062 | (or (not limit) | 4045 | (or (not limit) |
| 4063 | (or (and backward (<= limit (point))) | 4046 | (or (and backward (<= limit (point))) |
| 4064 | (>= limit (point)))) | 4047 | (>= limit (point)))) |
| 4065 | (funcall search-func search-re limit 1)) | 4048 | (funcall search-func search-re limit 1)) |
| 4066 | (setq begin (match-beginning 0)) | 4049 | (setq begin (match-beginning 0)) |
| 4067 | (setq end (match-end 0)) | 4050 | (setq end (match-end 0)) |
| 4068 | 4051 | ||
| 4069 | (setq parse-result (parse-partial-sexp | 4052 | (setq parse-result (parse-partial-sexp |
| 4070 | (save-excursion (beginning-of-line) (point)) | 4053 | (save-excursion (beginning-of-line) (point)) |
| 4071 | (point))) | 4054 | (point))) |
| 4072 | 4055 | ||
| 4073 | (cond | 4056 | (cond |
| 4074 | ;; | 4057 | ;; |
| 4075 | ;; If inside a string, skip it (and the following comments) | 4058 | ;; If inside a string, skip it (and the following comments) |
| 4076 | ;; | 4059 | ;; |
| 4077 | ((ada-in-string-p parse-result) | 4060 | ((ada-in-string-p parse-result) |
| 4078 | (if (featurep 'xemacs) | 4061 | (if (featurep 'xemacs) |
| 4079 | (search-backward "\"" nil t) | 4062 | (search-backward "\"" nil t) |
| 4080 | (goto-char (nth 8 parse-result))) | 4063 | (goto-char (nth 8 parse-result))) |
| 4081 | (unless backward (forward-sexp 1))) | 4064 | (unless backward (forward-sexp 1))) |
| 4082 | ;; | 4065 | ;; |
| 4083 | ;; If inside a comment, skip it (and the following comments) | 4066 | ;; If inside a comment, skip it (and the following comments) |
| 4084 | ;; There is a special code for comments at the end of the file | 4067 | ;; There is a special code for comments at the end of the file |
| 4085 | ;; | 4068 | ;; |
| 4086 | ((ada-in-comment-p parse-result) | 4069 | ((ada-in-comment-p parse-result) |
| 4087 | (if (featurep 'xemacs) | 4070 | (if (featurep 'xemacs) |
| 4088 | (progn | 4071 | (progn |
| 4089 | (forward-line 1) | 4072 | (forward-line 1) |
| 4090 | (beginning-of-line) | 4073 | (beginning-of-line) |
| 4091 | (forward-comment -1)) | 4074 | (forward-comment -1)) |
| 4092 | (goto-char (nth 8 parse-result))) | 4075 | (goto-char (nth 8 parse-result))) |
| 4093 | (unless backward | 4076 | (unless backward |
| 4094 | ;; at the end of the file, it is not possible to skip a comment | 4077 | ;; at the end of the file, it is not possible to skip a comment |
| 4095 | ;; so we just go at the end of the line | 4078 | ;; so we just go at the end of the line |
| 4096 | (if (forward-comment 1) | 4079 | (if (forward-comment 1) |
| 4097 | (progn | 4080 | (progn |
| 4098 | (forward-comment 1000) | 4081 | (forward-comment 1000) |
| 4099 | (beginning-of-line)) | 4082 | (beginning-of-line)) |
| 4100 | (end-of-line)))) | 4083 | (end-of-line)))) |
| 4101 | ;; | 4084 | ;; |
| 4102 | ;; directly in front of a comment => skip it, if searching forward | 4085 | ;; directly in front of a comment => skip it, if searching forward |
| 4103 | ;; | 4086 | ;; |
| 4104 | ((and (= (char-after begin) ?-) (= (char-after (1+ begin)) ?-)) | 4087 | ((and (= (char-after begin) ?-) (= (char-after (1+ begin)) ?-)) |
| 4105 | (unless backward (progn (forward-char -1) (forward-comment 1000)))) | 4088 | (unless backward (progn (forward-char -1) (forward-comment 1000)))) |
| 4106 | 4089 | ||
| 4107 | ;; | 4090 | ;; |
| 4108 | ;; found a parameter-list but should ignore it => skip it | 4091 | ;; found a parameter-list but should ignore it => skip it |
| 4109 | ;; | 4092 | ;; |
| 4110 | ((and (not paramlists) (ada-in-paramlist-p)) | 4093 | ((and (not paramlists) (ada-in-paramlist-p)) |
| 4111 | (if backward | 4094 | (if backward |
| 4112 | (search-backward "(" nil t) | 4095 | (search-backward "(" nil t) |
| 4113 | (search-forward ")" nil t))) | 4096 | (search-forward ")" nil t))) |
| 4114 | ;; | 4097 | ;; |
| 4115 | ;; found what we were looking for | 4098 | ;; found what we were looking for |
| 4116 | ;; | 4099 | ;; |
| 4117 | (t | 4100 | (t |
| 4118 | (setq found t)))) ; end of loop | 4101 | (setq found t))))) ; end of loop |
| 4119 | |||
| 4120 | (set-syntax-table previous-syntax-table) | ||
| 4121 | 4102 | ||
| 4122 | (if found | 4103 | (if found |
| 4123 | (cons begin end) | 4104 | (cons begin end) |
| @@ -4398,122 +4379,109 @@ of the region. Otherwise, operate only on the current line." | |||
| 4398 | (defun ada-move-to-start () | 4379 | (defun ada-move-to-start () |
| 4399 | "Move point to the matching start of the current Ada structure." | 4380 | "Move point to the matching start of the current Ada structure." |
| 4400 | (interactive) | 4381 | (interactive) |
| 4401 | (let ((pos (point)) | 4382 | (let ((pos (point))) |
| 4402 | (previous-syntax-table (syntax-table))) | 4383 | (with-syntax-table ada-mode-symbol-syntax-table |
| 4403 | (unwind-protect | ||
| 4404 | (progn | ||
| 4405 | (set-syntax-table ada-mode-symbol-syntax-table) | ||
| 4406 | 4384 | ||
| 4407 | (save-excursion | 4385 | (save-excursion |
| 4408 | ;; | 4386 | ;; |
| 4409 | ;; do nothing if in string or comment or not on 'end ...;' | 4387 | ;; do nothing if in string or comment or not on 'end ...;' |
| 4410 | ;; or if an error occurs during processing | 4388 | ;; or if an error occurs during processing |
| 4411 | ;; | 4389 | ;; |
| 4412 | (or | 4390 | (or |
| 4413 | (ada-in-string-or-comment-p) | 4391 | (ada-in-string-or-comment-p) |
| 4414 | (and (progn | 4392 | (and (progn |
| 4415 | (or (looking-at "[ \t]*\\<end\\>") | 4393 | (or (looking-at "[ \t]*\\<end\\>") |
| 4416 | (backward-word 1)) | 4394 | (backward-word 1)) |
| 4417 | (or (looking-at "[ \t]*\\<end\\>") | 4395 | (or (looking-at "[ \t]*\\<end\\>") |
| 4418 | (backward-word 1)) | 4396 | (backward-word 1)) |
| 4419 | (or (looking-at "[ \t]*\\<end\\>") | 4397 | (or (looking-at "[ \t]*\\<end\\>") |
| 4420 | (error "Not on end ...;"))) | 4398 | (error "Not on end ...;"))) |
| 4421 | (ada-goto-matching-start 1) | 4399 | (ada-goto-matching-start 1) |
| 4422 | (setq pos (point)) | 4400 | (setq pos (point)) |
| 4423 | 4401 | ||
| 4424 | ;; | 4402 | ;; |
| 4425 | ;; on 'begin' => go on, according to user option | 4403 | ;; on 'begin' => go on, according to user option |
| 4426 | ;; | 4404 | ;; |
| 4427 | ada-move-to-declaration | 4405 | ada-move-to-declaration |
| 4428 | (looking-at "\\<begin\\>") | 4406 | (looking-at "\\<begin\\>") |
| 4429 | (ada-goto-decl-start) | 4407 | (ada-goto-decl-start) |
| 4430 | (setq pos (point)))) | 4408 | (setq pos (point)))) |
| 4431 | 4409 | ||
| 4432 | ) ; end of save-excursion | 4410 | ) ; end of save-excursion |
| 4433 | 4411 | ||
| 4434 | ;; now really move to the found position | 4412 | ;; now really move to the found position |
| 4435 | (goto-char pos)) | 4413 | (goto-char pos)))) |
| 4436 | |||
| 4437 | ;; restore syntax-table | ||
| 4438 | (set-syntax-table previous-syntax-table)))) | ||
| 4439 | 4414 | ||
| 4440 | (defun ada-move-to-end () | 4415 | (defun ada-move-to-end () |
| 4441 | "Move point to the end of the block around point. | 4416 | "Move point to the end of the block around point. |
| 4442 | Moves to 'begin' if in a declarative part." | 4417 | Moves to 'begin' if in a declarative part." |
| 4443 | (interactive) | 4418 | (interactive) |
| 4444 | (let ((pos (point)) | 4419 | (let ((pos (point)) |
| 4445 | decl-start | 4420 | decl-start) |
| 4446 | (previous-syntax-table (syntax-table))) | 4421 | (with-syntax-table ada-mode-symbol-syntax-table |
| 4447 | (unwind-protect | ||
| 4448 | (progn | ||
| 4449 | (set-syntax-table ada-mode-symbol-syntax-table) | ||
| 4450 | |||
| 4451 | (save-excursion | ||
| 4452 | |||
| 4453 | (cond | ||
| 4454 | ;; Go to the beginning of the current word, and check if we are | ||
| 4455 | ;; directly on 'begin' | ||
| 4456 | ((save-excursion | ||
| 4457 | (skip-syntax-backward "w") | ||
| 4458 | (looking-at "\\<begin\\>")) | ||
| 4459 | (ada-goto-matching-end 1) | ||
| 4460 | ) | ||
| 4461 | |||
| 4462 | ;; on first line of subprogram body | ||
| 4463 | ;; Do nothing for specs or generic instantion, since these are | ||
| 4464 | ;; handled as the general case (find the enclosing block) | ||
| 4465 | ;; We also need to make sure that we ignore nested subprograms | ||
| 4466 | ((save-excursion | ||
| 4467 | (and (skip-syntax-backward "w") | ||
| 4468 | (looking-at "\\<function\\>\\|\\<procedure\\>" ) | ||
| 4469 | (ada-search-ignore-string-comment "is\\|;") | ||
| 4470 | (not (= (char-before) ?\;)) | ||
| 4471 | )) | ||
| 4472 | (skip-syntax-backward "w") | ||
| 4473 | (ada-goto-matching-end 0 t)) | ||
| 4474 | |||
| 4475 | ;; on first line of task declaration | ||
| 4476 | ((save-excursion | ||
| 4477 | (and (ada-goto-stmt-start) | ||
| 4478 | (looking-at "\\<task\\>" ) | ||
| 4479 | (forward-word 1) | ||
| 4480 | (ada-goto-next-non-ws) | ||
| 4481 | (looking-at "\\<body\\>"))) | ||
| 4482 | (ada-search-ignore-string-comment "begin" nil nil nil | ||
| 4483 | 'word-search-forward)) | ||
| 4484 | ;; accept block start | ||
| 4485 | ((save-excursion | ||
| 4486 | (and (ada-goto-stmt-start) | ||
| 4487 | (looking-at "\\<accept\\>" ))) | ||
| 4488 | (ada-goto-matching-end 0)) | ||
| 4489 | ;; package start | ||
| 4490 | ((save-excursion | ||
| 4491 | (setq decl-start (and (ada-goto-decl-start t) (point))) | ||
| 4492 | (and decl-start (looking-at "\\<package\\>"))) | ||
| 4493 | (ada-goto-matching-end 1)) | ||
| 4494 | |||
| 4495 | ;; On a "declare" keyword | ||
| 4496 | ((save-excursion | ||
| 4497 | (skip-syntax-backward "w") | ||
| 4498 | (looking-at "\\<declare\\>")) | ||
| 4499 | (ada-goto-matching-end 0 t)) | ||
| 4500 | |||
| 4501 | ;; inside a 'begin' ... 'end' block | ||
| 4502 | (decl-start | ||
| 4503 | (goto-char decl-start) | ||
| 4504 | (ada-goto-matching-end 0 t)) | ||
| 4505 | |||
| 4506 | ;; (hopefully ;-) everything else | ||
| 4507 | (t | ||
| 4508 | (ada-goto-matching-end 1))) | ||
| 4509 | (setq pos (point)) | ||
| 4510 | ) | ||
| 4511 | 4422 | ||
| 4512 | ;; now really move to the position found | 4423 | (save-excursion |
| 4513 | (goto-char pos)) | ||
| 4514 | 4424 | ||
| 4515 | ;; restore syntax-table | 4425 | (cond |
| 4516 | (set-syntax-table previous-syntax-table)))) | 4426 | ;; Go to the beginning of the current word, and check if we are |
| 4427 | ;; directly on 'begin' | ||
| 4428 | ((save-excursion | ||
| 4429 | (skip-syntax-backward "w") | ||
| 4430 | (looking-at "\\<begin\\>")) | ||
| 4431 | (ada-goto-matching-end 1)) | ||
| 4432 | |||
| 4433 | ;; on first line of subprogram body | ||
| 4434 | ;; Do nothing for specs or generic instantion, since these are | ||
| 4435 | ;; handled as the general case (find the enclosing block) | ||
| 4436 | ;; We also need to make sure that we ignore nested subprograms | ||
| 4437 | ((save-excursion | ||
| 4438 | (and (skip-syntax-backward "w") | ||
| 4439 | (looking-at "\\<function\\>\\|\\<procedure\\>" ) | ||
| 4440 | (ada-search-ignore-string-comment "is\\|;") | ||
| 4441 | (not (= (char-before) ?\;)) | ||
| 4442 | )) | ||
| 4443 | (skip-syntax-backward "w") | ||
| 4444 | (ada-goto-matching-end 0 t)) | ||
| 4445 | |||
| 4446 | ;; on first line of task declaration | ||
| 4447 | ((save-excursion | ||
| 4448 | (and (ada-goto-stmt-start) | ||
| 4449 | (looking-at "\\<task\\>" ) | ||
| 4450 | (forward-word 1) | ||
| 4451 | (ada-goto-next-non-ws) | ||
| 4452 | (looking-at "\\<body\\>"))) | ||
| 4453 | (ada-search-ignore-string-comment "begin" nil nil nil | ||
| 4454 | 'word-search-forward)) | ||
| 4455 | ;; accept block start | ||
| 4456 | ((save-excursion | ||
| 4457 | (and (ada-goto-stmt-start) | ||
| 4458 | (looking-at "\\<accept\\>" ))) | ||
| 4459 | (ada-goto-matching-end 0)) | ||
| 4460 | ;; package start | ||
| 4461 | ((save-excursion | ||
| 4462 | (setq decl-start (and (ada-goto-decl-start t) (point))) | ||
| 4463 | (and decl-start (looking-at "\\<package\\>"))) | ||
| 4464 | (ada-goto-matching-end 1)) | ||
| 4465 | |||
| 4466 | ;; On a "declare" keyword | ||
| 4467 | ((save-excursion | ||
| 4468 | (skip-syntax-backward "w") | ||
| 4469 | (looking-at "\\<declare\\>")) | ||
| 4470 | (ada-goto-matching-end 0 t)) | ||
| 4471 | |||
| 4472 | ;; inside a 'begin' ... 'end' block | ||
| 4473 | (decl-start | ||
| 4474 | (goto-char decl-start) | ||
| 4475 | (ada-goto-matching-end 0 t)) | ||
| 4476 | |||
| 4477 | ;; (hopefully ;-) everything else | ||
| 4478 | (t | ||
| 4479 | (ada-goto-matching-end 1))) | ||
| 4480 | (setq pos (point)) | ||
| 4481 | ) | ||
| 4482 | |||
| 4483 | ;; now really move to the position found | ||
| 4484 | (goto-char pos)))) | ||
| 4517 | 4485 | ||
| 4518 | (defun ada-next-procedure () | 4486 | (defun ada-next-procedure () |
| 4519 | "Move point to next procedure." | 4487 | "Move point to next procedure." |
| @@ -4818,7 +4786,7 @@ Moves to 'begin' if in a declarative part." | |||
| 4818 | (if (featurep 'xemacs) | 4786 | (if (featurep 'xemacs) |
| 4819 | (progn | 4787 | (progn |
| 4820 | (define-key ada-mode-map [menu-bar] ada-mode-menu) | 4788 | (define-key ada-mode-map [menu-bar] ada-mode-menu) |
| 4821 | (set 'mode-popup-menu (cons "Ada mode" ada-mode-menu)))))) | 4789 | (setq mode-popup-menu (cons "Ada mode" ada-mode-menu)))))) |
| 4822 | 4790 | ||
| 4823 | 4791 | ||
| 4824 | ;; ------------------------------------------------------- | 4792 | ;; ------------------------------------------------------- |
| @@ -5040,7 +5008,7 @@ or the spec otherwise." | |||
| 5040 | (ada-find-src-file-in-dir | 5008 | (ada-find-src-file-in-dir |
| 5041 | (file-name-nondirectory (concat name (car suffixes)))))) | 5009 | (file-name-nondirectory (concat name (car suffixes)))))) |
| 5042 | (if other | 5010 | (if other |
| 5043 | (set 'is-spec other))) | 5011 | (setq is-spec other))) |
| 5044 | 5012 | ||
| 5045 | ;; Else search in the current directory | 5013 | ;; Else search in the current directory |
| 5046 | (if (file-exists-p (concat name (car suffixes))) | 5014 | (if (file-exists-p (concat name (car suffixes))) |
diff --git a/lisp/progmodes/autoconf.el b/lisp/progmodes/autoconf.el index a56623f22da..004bb3de78d 100644 --- a/lisp/progmodes/autoconf.el +++ b/lisp/progmodes/autoconf.el | |||
| @@ -43,9 +43,6 @@ | |||
| 43 | (defvar autoconf-mode-hook nil | 43 | (defvar autoconf-mode-hook nil |
| 44 | "Hook run by `autoconf-mode'.") | 44 | "Hook run by `autoconf-mode'.") |
| 45 | 45 | ||
| 46 | (defconst autoconf-font-lock-syntactic-keywords | ||
| 47 | '(("\\<dnl\\>" 0 '(11)))) | ||
| 48 | |||
| 49 | (defconst autoconf-definition-regexp | 46 | (defconst autoconf-definition-regexp |
| 50 | "AC_\\(SUBST\\|DEFINE\\(_UNQUOTED\\)?\\)(\\[*\\(\\sw+\\)\\]*") | 47 | "AC_\\(SUBST\\|DEFINE\\(_UNQUOTED\\)?\\)(\\[*\\(\\sw+\\)\\]*") |
| 51 | 48 | ||
| @@ -94,8 +91,8 @@ searching backwards at another AC_... command." | |||
| 94 | "^[ \t]*A[CM]_\\(\\sw\\|\\s_\\)+") | 91 | "^[ \t]*A[CM]_\\(\\sw\\|\\s_\\)+") |
| 95 | (set (make-local-variable 'comment-start) "dnl ") | 92 | (set (make-local-variable 'comment-start) "dnl ") |
| 96 | (set (make-local-variable 'comment-start-skip) "\\(?:\\<dnl\\|#\\) +") | 93 | (set (make-local-variable 'comment-start-skip) "\\(?:\\<dnl\\|#\\) +") |
| 97 | (set (make-local-variable 'font-lock-syntactic-keywords) | 94 | (set (make-local-variable 'syntax-propertize-function) |
| 98 | autoconf-font-lock-syntactic-keywords) | 95 | (syntax-propertize-rules ("\\<dnl\\>" (0 "<")))) |
| 99 | (set (make-local-variable 'font-lock-defaults) | 96 | (set (make-local-variable 'font-lock-defaults) |
| 100 | `(autoconf-font-lock-keywords nil nil (("_" . "w")))) | 97 | `(autoconf-font-lock-keywords nil nil (("_" . "w")))) |
| 101 | (set (make-local-variable 'imenu-generic-expression) | 98 | (set (make-local-variable 'imenu-generic-expression) |
diff --git a/lisp/progmodes/cfengine.el b/lisp/progmodes/cfengine.el index 86a6be40cc5..e074e92fbe5 100644 --- a/lisp/progmodes/cfengine.el +++ b/lisp/progmodes/cfengine.el | |||
| @@ -83,12 +83,6 @@ This includes those for cfservd as well as cfagent.")) | |||
| 83 | ;; File, acl &c in group: { token ... } | 83 | ;; File, acl &c in group: { token ... } |
| 84 | ("{[ \t]*\\([^ \t\n]+\\)" 1 font-lock-constant-face))) | 84 | ("{[ \t]*\\([^ \t\n]+\\)" 1 font-lock-constant-face))) |
| 85 | 85 | ||
| 86 | (defconst cfengine-font-lock-syntactic-keywords | ||
| 87 | ;; In the main syntax-table, backslash is marked as a punctuation, because | ||
| 88 | ;; of its use in DOS-style directory separators. Here we try to recognize | ||
| 89 | ;; the cases where backslash is used as an escape inside strings. | ||
| 90 | '(("\\(\\(?:\\\\\\)+\\)\"" 1 "\\"))) | ||
| 91 | |||
| 92 | (defvar cfengine-imenu-expression | 86 | (defvar cfengine-imenu-expression |
| 93 | `((nil ,(concat "^[ \t]*" (eval-when-compile | 87 | `((nil ,(concat "^[ \t]*" (eval-when-compile |
| 94 | (regexp-opt cfengine-actions t)) | 88 | (regexp-opt cfengine-actions t)) |
| @@ -237,13 +231,15 @@ to the action header." | |||
| 237 | (set (make-local-variable 'fill-paragraph-function) | 231 | (set (make-local-variable 'fill-paragraph-function) |
| 238 | #'cfengine-fill-paragraph) | 232 | #'cfengine-fill-paragraph) |
| 239 | (define-abbrev-table 'cfengine-mode-abbrev-table cfengine-mode-abbrevs) | 233 | (define-abbrev-table 'cfengine-mode-abbrev-table cfengine-mode-abbrevs) |
| 240 | ;; Fixme: Use `font-lock-syntactic-keywords' to set the args of | ||
| 241 | ;; functions in evaluated classes to string syntax, and then obey | ||
| 242 | ;; syntax properties. | ||
| 243 | (setq font-lock-defaults | 234 | (setq font-lock-defaults |
| 244 | '(cfengine-font-lock-keywords nil nil nil beginning-of-line | 235 | '(cfengine-font-lock-keywords nil nil nil beginning-of-line)) |
| 245 | (font-lock-syntactic-keywords | 236 | ;; Fixme: set the args of functions in evaluated classes to string |
| 246 | . cfengine-font-lock-syntactic-keywords))) | 237 | ;; syntax, and then obey syntax properties. |
| 238 | (set (make-local-variable 'syntax-propertize-function) | ||
| 239 | ;; In the main syntax-table, \ is marked as a punctuation, because | ||
| 240 | ;; of its use in DOS-style directory separators. Here we try to | ||
| 241 | ;; recognize the cases where \ is used as an escape inside strings. | ||
| 242 | (syntax-propertize-rules ("\\(\\(?:\\\\\\)+\\)\"" (1 "\\")))) | ||
| 247 | (setq imenu-generic-expression cfengine-imenu-expression) | 243 | (setq imenu-generic-expression cfengine-imenu-expression) |
| 248 | (set (make-local-variable 'beginning-of-defun-function) | 244 | (set (make-local-variable 'beginning-of-defun-function) |
| 249 | #'cfengine-beginning-of-defun) | 245 | #'cfengine-beginning-of-defun) |
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 598733cb5d7..7f0732ecffc 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el | |||
| @@ -164,7 +164,7 @@ and a string describing how the process finished.") | |||
| 164 | 164 | ||
| 165 | (defvar compilation-num-errors-found) | 165 | (defvar compilation-num-errors-found) |
| 166 | 166 | ||
| 167 | (defconst compilation-error-regexp-alist-alist | 167 | (defvar compilation-error-regexp-alist-alist |
| 168 | '((absoft | 168 | '((absoft |
| 169 | "^\\(?:[Ee]rror on \\|[Ww]arning on\\( \\)\\)?[Ll]ine[ \t]+\\([0-9]+\\)[ \t]+\ | 169 | "^\\(?:[Ee]rror on \\|[Ww]arning on\\( \\)\\)?[Ll]ine[ \t]+\\([0-9]+\\)[ \t]+\ |
| 170 | of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1)) | 170 | of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1)) |
| @@ -263,9 +263,11 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1)) | |||
| 263 | ;; The core of the regexp is the one with *?. It says that a file name | 263 | ;; The core of the regexp is the one with *?. It says that a file name |
| 264 | ;; can be composed of any non-newline char, but it also rules out some | 264 | ;; can be composed of any non-newline char, but it also rules out some |
| 265 | ;; valid but unlikely cases, such as a trailing space or a space | 265 | ;; valid but unlikely cases, such as a trailing space or a space |
| 266 | ;; followed by a -. | 266 | ;; followed by a -, or a colon followed by a space. |
| 267 | |||
| 268 | ;; The "in \\|from " exception was added to handle messages from Ruby. | ||
| 267 | "^\\(?:[[:alpha:]][-[:alnum:].]+: ?\\|[ \t]+\\(?:in \\|from \\)\\)?\ | 269 | "^\\(?:[[:alpha:]][-[:alnum:].]+: ?\\|[ \t]+\\(?:in \\|from \\)\\)?\ |
| 268 | \\([0-9]*[^0-9\n]\\(?:[^\n ]\\| [^-/\n]\\)*?\\): ?\ | 270 | \\([0-9]*[^0-9\n]\\(?:[^\n :]\\| [^-/\n]\\|:[^ \n]\\)*?\\): ?\ |
| 269 | \\([0-9]+\\)\\(?:\\([.:]\\)\\([0-9]+\\)\\)?\ | 271 | \\([0-9]+\\)\\(?:\\([.:]\\)\\([0-9]+\\)\\)?\ |
| 270 | \\(?:-\\([0-9]+\\)?\\(?:\\.\\([0-9]+\\)\\)?\\)?:\ | 272 | \\(?:-\\([0-9]+\\)?\\(?:\\.\\([0-9]+\\)\\)?\\)?:\ |
| 271 | \\(?: *\\(\\(?:Future\\|Runtime\\)?[Ww]arning\\|W:\\)\\|\ | 273 | \\(?: *\\(\\(?:Future\\|Runtime\\)?[Ww]arning\\|W:\\)\\|\ |
| @@ -766,12 +768,27 @@ The value can be either 2 -- skip anything less than error, 1 -- | |||
| 766 | skip anything less than warning or 0 -- don't skip any messages. | 768 | skip anything less than warning or 0 -- don't skip any messages. |
| 767 | Note that all messages not positively identified as warning or | 769 | Note that all messages not positively identified as warning or |
| 768 | info, are considered errors." | 770 | info, are considered errors." |
| 769 | :type '(choice (const :tag "Warnings and info" 2) | 771 | :type '(choice (const :tag "Skip warnings and info" 2) |
| 770 | (const :tag "Info" 1) | 772 | (const :tag "Skip info" 1) |
| 771 | (const :tag "None" 0)) | 773 | (const :tag "No skip" 0)) |
| 772 | :group 'compilation | 774 | :group 'compilation |
| 773 | :version "22.1") | 775 | :version "22.1") |
| 774 | 776 | ||
| 777 | (defun compilation-set-skip-threshold (level) | ||
| 778 | "Switch the `compilation-skip-threshold' level." | ||
| 779 | (interactive | ||
| 780 | (list | ||
| 781 | (mod (if current-prefix-arg | ||
| 782 | (prefix-numeric-value current-prefix-arg) | ||
| 783 | (1+ compilation-skip-threshold)) | ||
| 784 | 3))) | ||
| 785 | (setq compilation-skip-threshold level) | ||
| 786 | (message "Skipping %s" | ||
| 787 | (case compilation-skip-threshold | ||
| 788 | (0 "Nothing") | ||
| 789 | (1 "Info messages") | ||
| 790 | (2 "Warnings and info")))) | ||
| 791 | |||
| 775 | (defcustom compilation-skip-visited nil | 792 | (defcustom compilation-skip-visited nil |
| 776 | "Compilation motion commands skip visited messages if this is t. | 793 | "Compilation motion commands skip visited messages if this is t. |
| 777 | Visited messages are ones for which the file, line and column have been jumped | 794 | Visited messages are ones for which the file, line and column have been jumped |
| @@ -1212,7 +1229,7 @@ Returns the compilation buffer created." | |||
| 1212 | (let* ((name-of-mode | 1229 | (let* ((name-of-mode |
| 1213 | (if (eq mode t) | 1230 | (if (eq mode t) |
| 1214 | "compilation" | 1231 | "compilation" |
| 1215 | (replace-regexp-in-string "-mode$" "" (symbol-name mode)))) | 1232 | (replace-regexp-in-string "-mode\\'" "" (symbol-name mode)))) |
| 1216 | (thisdir default-directory) | 1233 | (thisdir default-directory) |
| 1217 | outwin outbuf) | 1234 | outwin outbuf) |
| 1218 | (with-current-buffer | 1235 | (with-current-buffer |
| @@ -2377,7 +2394,7 @@ The file-structure looks like this: | |||
| 2377 | (defun compilation-forget-errors () | 2394 | (defun compilation-forget-errors () |
| 2378 | ;; In case we hit the same file/line specs, we want to recompute a new | 2395 | ;; In case we hit the same file/line specs, we want to recompute a new |
| 2379 | ;; marker for them, so flush our cache. | 2396 | ;; marker for them, so flush our cache. |
| 2380 | (setq compilation-locs (make-hash-table :test 'equal :weakness 'value)) | 2397 | (clrhash compilation-locs) |
| 2381 | (setq compilation-gcpro nil) | 2398 | (setq compilation-gcpro nil) |
| 2382 | ;; FIXME: the old code reset the directory-stack, so maybe we should | 2399 | ;; FIXME: the old code reset the directory-stack, so maybe we should |
| 2383 | ;; put a `directory change' marker of some sort, but where? -stef | 2400 | ;; put a `directory change' marker of some sort, but where? -stef |
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index d69cce76faa..d89e41b38fb 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el | |||
| @@ -1840,7 +1840,13 @@ or as help on variables `cperl-tips', `cperl-problems', | |||
| 1840 | (make-local-variable 'cperl-syntax-state) | 1840 | (make-local-variable 'cperl-syntax-state) |
| 1841 | (setq cperl-syntax-state nil) ; reset syntaxification cache | 1841 | (setq cperl-syntax-state nil) ; reset syntaxification cache |
| 1842 | (if cperl-use-syntax-table-text-property | 1842 | (if cperl-use-syntax-table-text-property |
| 1843 | (progn | 1843 | (if (boundp 'syntax-propertize-function) |
| 1844 | (progn | ||
| 1845 | ;; Reset syntaxification cache. | ||
| 1846 | (set (make-local-variable 'cperl-syntax-done-to) nil) | ||
| 1847 | (set (make-local-variable 'syntax-propertize-function) | ||
| 1848 | (lambda (start end) | ||
| 1849 | (goto-char start) (cperl-fontify-syntaxically end)))) | ||
| 1844 | (make-local-variable 'parse-sexp-lookup-properties) | 1850 | (make-local-variable 'parse-sexp-lookup-properties) |
| 1845 | ;; Do not introduce variable if not needed, we check it! | 1851 | ;; Do not introduce variable if not needed, we check it! |
| 1846 | (set 'parse-sexp-lookup-properties t) | 1852 | (set 'parse-sexp-lookup-properties t) |
diff --git a/lisp/progmodes/fortran.el b/lisp/progmodes/fortran.el index c37744bfe45..daa0fd07364 100644 --- a/lisp/progmodes/fortran.el +++ b/lisp/progmodes/fortran.el | |||
| @@ -483,6 +483,7 @@ The only difference is, it returns t in a case when the default returns nil." | |||
| 483 | "Maximum highlighting for Fortran mode. | 483 | "Maximum highlighting for Fortran mode. |
| 484 | Consists of level 3 plus all other intrinsics not already highlighted.") | 484 | Consists of level 3 plus all other intrinsics not already highlighted.") |
| 485 | 485 | ||
| 486 | (defvar fortran--font-lock-syntactic-keywords) | ||
| 486 | ;; Comments are real pain in Fortran because there is no way to | 487 | ;; Comments are real pain in Fortran because there is no way to |
| 487 | ;; represent the standard comment syntax in an Emacs syntax table. | 488 | ;; represent the standard comment syntax in an Emacs syntax table. |
| 488 | ;; (We can do so for F90-style). Therefore an unmatched quote in a | 489 | ;; (We can do so for F90-style). Therefore an unmatched quote in a |
| @@ -887,9 +888,11 @@ with no args, if that value is non-nil." | |||
| 887 | fortran-font-lock-keywords-3 | 888 | fortran-font-lock-keywords-3 |
| 888 | fortran-font-lock-keywords-4) | 889 | fortran-font-lock-keywords-4) |
| 889 | nil t ((?/ . "$/") ("_$" . "w")) | 890 | nil t ((?/ . "$/") ("_$" . "w")) |
| 890 | fortran-beginning-of-subprogram | 891 | fortran-beginning-of-subprogram)) |
| 891 | (font-lock-syntactic-keywords | 892 | (set (make-local-variable 'fortran--font-lock-syntactic-keywords) |
| 892 | . fortran-font-lock-syntactic-keywords))) | 893 | (fortran-make-syntax-propertize-function)) |
| 894 | (set (make-local-variable 'syntax-propertize-function) | ||
| 895 | (syntax-propertize-via-font-lock fortran--font-lock-syntactic-keywords)) | ||
| 893 | (set (make-local-variable 'imenu-case-fold-search) t) | 896 | (set (make-local-variable 'imenu-case-fold-search) t) |
| 894 | (set (make-local-variable 'imenu-generic-expression) | 897 | (set (make-local-variable 'imenu-generic-expression) |
| 895 | fortran-imenu-generic-expression) | 898 | fortran-imenu-generic-expression) |
| @@ -917,11 +920,13 @@ affects all Fortran buffers, and also the default." | |||
| 917 | (when (eq major-mode 'fortran-mode) | 920 | (when (eq major-mode 'fortran-mode) |
| 918 | (setq fortran-line-length nchars | 921 | (setq fortran-line-length nchars |
| 919 | fill-column fortran-line-length | 922 | fill-column fortran-line-length |
| 920 | new (fortran-font-lock-syntactic-keywords)) | 923 | new (fortran-make-syntax-propertize-function)) |
| 921 | ;; Refontify only if necessary. | 924 | ;; Refontify only if necessary. |
| 922 | (unless (equal new font-lock-syntactic-keywords) | 925 | (unless (equal new fortran--font-lock-syntactic-keywords) |
| 923 | (setq font-lock-syntactic-keywords | 926 | (setq fortran--font-lock-syntactic-keywords new) |
| 924 | (fortran-font-lock-syntactic-keywords)) | 927 | (setq syntax-propertize-function |
| 928 | (syntax-propertize-via-font-lock new)) | ||
| 929 | (syntax-ppss-flush-cache (point-min)) | ||
| 925 | (if font-lock-mode (font-lock-mode 1)))))) | 930 | (if font-lock-mode (font-lock-mode 1)))))) |
| 926 | (if global | 931 | (if global |
| 927 | (buffer-list) | 932 | (buffer-list) |
diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el index d20a14682c7..4c1471e39ec 100644 --- a/lisp/progmodes/gud.el +++ b/lisp/progmodes/gud.el | |||
| @@ -3123,10 +3123,12 @@ class of the file (using s to separate nested class ids)." | |||
| 3123 | ("\\$\\(\\w+\\)" (1 font-lock-variable-name-face)) | 3123 | ("\\$\\(\\w+\\)" (1 font-lock-variable-name-face)) |
| 3124 | ("^\\s-*\\(\\w\\(\\w\\|\\s_\\)*\\)" (1 font-lock-keyword-face)))) | 3124 | ("^\\s-*\\(\\w\\(\\w\\|\\s_\\)*\\)" (1 font-lock-keyword-face)))) |
| 3125 | 3125 | ||
| 3126 | (defvar gdb-script-font-lock-syntactic-keywords | 3126 | (defconst gdb-script-syntax-propertize-function |
| 3127 | '(("^document\\s-.*\\(\n\\)" (1 "< b")) | 3127 | (syntax-propertize-rules |
| 3128 | ("^end\\>" | 3128 | ("^document\\s-.*\\(\n\\)" (1 "< b")) |
| 3129 | (0 (unless (eq (match-beginning 0) (point-min)) | 3129 | ("^end\\(\\>\\)" |
| 3130 | (1 (ignore | ||
| 3131 | (unless (eq (match-beginning 0) (point-min)) | ||
| 3130 | ;; We change the \n in front, which is more difficult, but results | 3132 | ;; We change the \n in front, which is more difficult, but results |
| 3131 | ;; in better highlighting. If the doc is empty, the single \n is | 3133 | ;; in better highlighting. If the doc is empty, the single \n is |
| 3132 | ;; both the beginning and the end of the docstring, which can't be | 3134 | ;; both the beginning and the end of the docstring, which can't be |
| @@ -3138,10 +3140,9 @@ class of the file (using s to separate nested class ids)." | |||
| 3138 | 'syntax-table (eval-when-compile | 3140 | 'syntax-table (eval-when-compile |
| 3139 | (string-to-syntax "> b"))) | 3141 | (string-to-syntax "> b"))) |
| 3140 | ;; Make sure that rehighlighting the previous line won't erase our | 3142 | ;; Make sure that rehighlighting the previous line won't erase our |
| 3141 | ;; syntax-table property. | 3143 | ;; syntax-table property and that modifying `end' will. |
| 3142 | (put-text-property (1- (match-beginning 0)) (match-end 0) | 3144 | (put-text-property (1- (match-beginning 0)) (match-end 0) |
| 3143 | 'font-lock-multiline t) | 3145 | 'syntax-multiline t))))))) |
| 3144 | nil))))) | ||
| 3145 | 3146 | ||
| 3146 | (defun gdb-script-font-lock-syntactic-face (state) | 3147 | (defun gdb-script-font-lock-syntactic-face (state) |
| 3147 | (cond | 3148 | (cond |
| @@ -3239,10 +3240,13 @@ Treats actions as defuns." | |||
| 3239 | #'gdb-script-end-of-defun) | 3240 | #'gdb-script-end-of-defun) |
| 3240 | (set (make-local-variable 'font-lock-defaults) | 3241 | (set (make-local-variable 'font-lock-defaults) |
| 3241 | '(gdb-script-font-lock-keywords nil nil ((?_ . "w")) nil | 3242 | '(gdb-script-font-lock-keywords nil nil ((?_ . "w")) nil |
| 3242 | (font-lock-syntactic-keywords | ||
| 3243 | . gdb-script-font-lock-syntactic-keywords) | ||
| 3244 | (font-lock-syntactic-face-function | 3243 | (font-lock-syntactic-face-function |
| 3245 | . gdb-script-font-lock-syntactic-face)))) | 3244 | . gdb-script-font-lock-syntactic-face))) |
| 3245 | ;; Recognize docstrings. | ||
| 3246 | (set (make-local-variable 'syntax-propertize-function) | ||
| 3247 | gdb-script-syntax-propertize-function) | ||
| 3248 | (add-hook 'syntax-propertize-extend-region-functions | ||
| 3249 | #'syntax-propertize-multiline 'append 'local)) | ||
| 3246 | 3250 | ||
| 3247 | 3251 | ||
| 3248 | ;;; tooltips for GUD | 3252 | ;;; tooltips for GUD |
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 5e854f852e1..ba70bb8ecce 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el | |||
| @@ -45,16 +45,16 @@ | |||
| 45 | 45 | ||
| 46 | ;;; Code: | 46 | ;;; Code: |
| 47 | 47 | ||
| 48 | (eval-and-compile | 48 | |
| 49 | (require 'cc-mode) | 49 | (require 'cc-mode) |
| 50 | (require 'font-lock) | 50 | (require 'font-lock) |
| 51 | (require 'newcomment) | 51 | (require 'newcomment) |
| 52 | (require 'imenu) | 52 | (require 'imenu) |
| 53 | (require 'etags) | 53 | (require 'etags) |
| 54 | (require 'thingatpt) | 54 | (require 'thingatpt) |
| 55 | (require 'easymenu) | 55 | (require 'easymenu) |
| 56 | (require 'moz nil t) | 56 | (require 'moz nil t) |
| 57 | (require 'json nil t)) | 57 | (require 'json nil t) |
| 58 | 58 | ||
| 59 | (eval-when-compile | 59 | (eval-when-compile |
| 60 | (require 'cl) | 60 | (require 'cl) |
| @@ -725,20 +725,19 @@ as if strings, cpp macros, and comments have been removed. | |||
| 725 | 725 | ||
| 726 | If invoked while inside a macro, it treats the contents of the | 726 | If invoked while inside a macro, it treats the contents of the |
| 727 | macro as normal text." | 727 | macro as normal text." |
| 728 | (unless count (setq count 1)) | ||
| 728 | (let ((saved-point (point)) | 729 | (let ((saved-point (point)) |
| 729 | (search-expr | 730 | (search-fun |
| 730 | (cond ((null count) | 731 | (cond ((< count 0) (setq count (- count)) |
| 731 | '(js--re-search-forward-inner regexp bound 1)) | 732 | #'js--re-search-backward-inner) |
| 732 | ((< count 0) | 733 | ((> count 0) #'js--re-search-forward-inner) |
| 733 | '(js--re-search-backward-inner regexp bound (- count))) | 734 | (t #'ignore)))) |
| 734 | ((> count 0) | ||
| 735 | '(js--re-search-forward-inner regexp bound count))))) | ||
| 736 | (condition-case err | 735 | (condition-case err |
| 737 | (eval search-expr) | 736 | (funcall search-fun regexp bound count) |
| 738 | (search-failed | 737 | (search-failed |
| 739 | (goto-char saved-point) | 738 | (goto-char saved-point) |
| 740 | (unless noerror | 739 | (unless noerror |
| 741 | (error (error-message-string err))))))) | 740 | (signal (car err) (cdr err))))))) |
| 742 | 741 | ||
| 743 | 742 | ||
| 744 | (defun js--re-search-backward-inner (regexp &optional bound count) | 743 | (defun js--re-search-backward-inner (regexp &optional bound count) |
| @@ -782,20 +781,7 @@ as if strings, preprocessor macros, and comments have been | |||
| 782 | removed. | 781 | removed. |
| 783 | 782 | ||
| 784 | If invoked while inside a macro, treat the macro as normal text." | 783 | If invoked while inside a macro, treat the macro as normal text." |
| 785 | (let ((saved-point (point)) | 784 | (js--re-search-forward regexp bound noerror (if count (- count) -1))) |
| 786 | (search-expr | ||
| 787 | (cond ((null count) | ||
| 788 | '(js--re-search-backward-inner regexp bound 1)) | ||
| 789 | ((< count 0) | ||
| 790 | '(js--re-search-forward-inner regexp bound (- count))) | ||
| 791 | ((> count 0) | ||
| 792 | '(js--re-search-backward-inner regexp bound count))))) | ||
| 793 | (condition-case err | ||
| 794 | (eval search-expr) | ||
| 795 | (search-failed | ||
| 796 | (goto-char saved-point) | ||
| 797 | (unless noerror | ||
| 798 | (error (error-message-string err))))))) | ||
| 799 | 785 | ||
| 800 | (defun js--forward-expression () | 786 | (defun js--forward-expression () |
| 801 | "Move forward over a whole JavaScript expression. | 787 | "Move forward over a whole JavaScript expression. |
| @@ -1674,18 +1660,19 @@ This performs fontification according to `js--class-styles'." | |||
| 1674 | ;; XXX: Javascript can continue a regexp literal across lines so long | 1660 | ;; XXX: Javascript can continue a regexp literal across lines so long |
| 1675 | ;; as the newline is escaped with \. Account for that in the regexp | 1661 | ;; as the newline is escaped with \. Account for that in the regexp |
| 1676 | ;; below. | 1662 | ;; below. |
| 1677 | (defconst js--regexp-literal | 1663 | (eval-and-compile |
| 1664 | (defconst js--regexp-literal | ||
| 1678 | "[=(,:]\\(?:\\s-\\|\n\\)*\\(/\\)\\(?:\\\\/\\|[^/*]\\)\\(?:\\\\/\\|[^/]\\)*\\(/\\)" | 1665 | "[=(,:]\\(?:\\s-\\|\n\\)*\\(/\\)\\(?:\\\\/\\|[^/*]\\)\\(?:\\\\/\\|[^/]\\)*\\(/\\)" |
| 1679 | "Regexp matching a JavaScript regular expression literal. | 1666 | "Regexp matching a JavaScript regular expression literal. |
| 1680 | Match groups 1 and 2 are the characters forming the beginning and | 1667 | Match groups 1 and 2 are the characters forming the beginning and |
| 1681 | end of the literal.") | 1668 | end of the literal.")) |
| 1669 | |||
| 1682 | 1670 | ||
| 1683 | ;; we want to match regular expressions only at the beginning of | 1671 | (defconst js-syntax-propertize-function |
| 1684 | ;; expressions | 1672 | (syntax-propertize-rules |
| 1685 | (defconst js-font-lock-syntactic-keywords | 1673 | ;; We want to match regular expressions only at the beginning of |
| 1686 | `((,js--regexp-literal (1 "|") (2 "|"))) | 1674 | ;; expressions. |
| 1687 | "Syntactic font lock keywords matching regexps in JavaScript. | 1675 | (js--regexp-literal (1 "\"") (2 "\"")))) |
| 1688 | See `font-lock-keywords'.") | ||
| 1689 | 1676 | ||
| 1690 | ;;; Indentation | 1677 | ;;; Indentation |
| 1691 | 1678 | ||
| @@ -3317,10 +3304,9 @@ Key bindings: | |||
| 3317 | 3304 | ||
| 3318 | (set (make-local-variable 'open-paren-in-column-0-is-defun-start) nil) | 3305 | (set (make-local-variable 'open-paren-in-column-0-is-defun-start) nil) |
| 3319 | (set (make-local-variable 'font-lock-defaults) | 3306 | (set (make-local-variable 'font-lock-defaults) |
| 3320 | (list js--font-lock-keywords | 3307 | '(js--font-lock-keywords)) |
| 3321 | nil nil nil nil | 3308 | (set (make-local-variable 'syntax-propertize-function) |
| 3322 | '(font-lock-syntactic-keywords | 3309 | js-syntax-propertize-function) |
| 3323 | . js-font-lock-syntactic-keywords))) | ||
| 3324 | 3310 | ||
| 3325 | (set (make-local-variable 'parse-sexp-ignore-comments) t) | 3311 | (set (make-local-variable 'parse-sexp-ignore-comments) t) |
| 3326 | (set (make-local-variable 'parse-sexp-lookup-properties) t) | 3312 | (set (make-local-variable 'parse-sexp-lookup-properties) t) |
diff --git a/lisp/progmodes/make-mode.el b/lisp/progmodes/make-mode.el index 362a1db6c10..187c838382b 100644 --- a/lisp/progmodes/make-mode.el +++ b/lisp/progmodes/make-mode.el | |||
| @@ -505,15 +505,16 @@ not be enclosed in { } or ( )." | |||
| 505 | cpp-font-lock-keywords)) | 505 | cpp-font-lock-keywords)) |
| 506 | 506 | ||
| 507 | 507 | ||
| 508 | (defconst makefile-font-lock-syntactic-keywords | 508 | (defconst makefile-syntax-propertize-function |
| 509 | ;; From sh-script.el. | 509 | (syntax-propertize-rules |
| 510 | ;; A `#' begins a comment in sh when it is unquoted and at the beginning | 510 | ;; From sh-script.el. |
| 511 | ;; of a word. In the shell, words are separated by metacharacters. | 511 | ;; A `#' begins a comment in sh when it is unquoted and at the beginning |
| 512 | ;; The list of special chars is taken from the single-unix spec of the | 512 | ;; of a word. In the shell, words are separated by metacharacters. |
| 513 | ;; shell command language (under `quoting') but with `$' removed. | 513 | ;; The list of special chars is taken from the single-unix spec of the |
| 514 | '(("[^|&;<>()`\\\"' \t\n]\\(#+\\)" 1 "_") | 514 | ;; shell command language (under `quoting') but with `$' removed. |
| 515 | ;; Change the syntax of a quoted newline so that it does not end a comment. | 515 | ("[^|&;<>()`\\\"' \t\n]\\(#+\\)" (1 "_")) |
| 516 | ("\\\\\n" 0 "."))) | 516 | ;; Change the syntax of a quoted newline so that it does not end a comment. |
| 517 | ("\\\\\n" (0 ".")))) | ||
| 517 | 518 | ||
| 518 | (defvar makefile-imenu-generic-expression | 519 | (defvar makefile-imenu-generic-expression |
| 519 | `(("Dependencies" makefile-previous-dependency 1) | 520 | `(("Dependencies" makefile-previous-dependency 1) |
| @@ -872,9 +873,9 @@ Makefile mode can be configured by modifying the following variables: | |||
| 872 | '(makefile-font-lock-keywords | 873 | '(makefile-font-lock-keywords |
| 873 | nil nil | 874 | nil nil |
| 874 | ((?$ . ".")) | 875 | ((?$ . ".")) |
| 875 | backward-paragraph | 876 | backward-paragraph)) |
| 876 | (font-lock-syntactic-keywords | 877 | (set (make-local-variable 'syntax-propertize-function) |
| 877 | . makefile-font-lock-syntactic-keywords))) | 878 | makefile-syntax-propertize-function) |
| 878 | 879 | ||
| 879 | ;; Add-log. | 880 | ;; Add-log. |
| 880 | (set (make-local-variable 'add-log-current-defun-function) | 881 | (set (make-local-variable 'add-log-current-defun-function) |
| @@ -943,15 +944,9 @@ Makefile mode can be configured by modifying the following variables: | |||
| 943 | (define-derived-mode makefile-imake-mode makefile-mode "Imakefile" | 944 | (define-derived-mode makefile-imake-mode makefile-mode "Imakefile" |
| 944 | "An adapted `makefile-mode' that knows about imake." | 945 | "An adapted `makefile-mode' that knows about imake." |
| 945 | :syntax-table makefile-imake-mode-syntax-table | 946 | :syntax-table makefile-imake-mode-syntax-table |
| 946 | (let ((base `(makefile-imake-font-lock-keywords ,@(cdr font-lock-defaults))) | 947 | (set (make-local-variable 'syntax-propertize-function) nil) |
| 947 | new) | 948 | (setq font-lock-defaults |
| 948 | ;; Remove `font-lock-syntactic-keywords' entry from font-lock-defaults. | 949 | `(makefile-imake-font-lock-keywords ,@(cdr font-lock-defaults)))) |
| 949 | (mapc (lambda (elt) | ||
| 950 | (unless (and (consp elt) | ||
| 951 | (eq (car elt) 'font-lock-syntactic-keywords)) | ||
| 952 | (setq new (cons elt new)))) | ||
| 953 | base) | ||
| 954 | (setq font-lock-defaults (nreverse new)))) | ||
| 955 | 950 | ||
| 956 | 951 | ||
| 957 | 952 | ||
diff --git a/lisp/progmodes/mixal-mode.el b/lisp/progmodes/mixal-mode.el index ecb8461a9f2..94af563d88f 100644 --- a/lisp/progmodes/mixal-mode.el +++ b/lisp/progmodes/mixal-mode.el | |||
| @@ -89,7 +89,7 @@ | |||
| 89 | (defvar mixal-mode-syntax-table | 89 | (defvar mixal-mode-syntax-table |
| 90 | (let ((st (make-syntax-table))) | 90 | (let ((st (make-syntax-table))) |
| 91 | ;; We need to do a bit more to make fontlocking for comments work. | 91 | ;; We need to do a bit more to make fontlocking for comments work. |
| 92 | ;; See mixal-font-lock-syntactic-keywords. | 92 | ;; See use of syntax-propertize-function. |
| 93 | ;; (modify-syntax-entry ?* "<" st) | 93 | ;; (modify-syntax-entry ?* "<" st) |
| 94 | (modify-syntax-entry ?\n ">" st) | 94 | (modify-syntax-entry ?\n ">" st) |
| 95 | st) | 95 | st) |
| @@ -1028,13 +1028,14 @@ EXECUTION-TIME holds info about the time it takes, number or string.") | |||
| 1028 | 1028 | ||
| 1029 | 1029 | ||
| 1030 | ;;; Font-locking: | 1030 | ;;; Font-locking: |
| 1031 | (defvar mixal-font-lock-syntactic-keywords | 1031 | (defconst mixal-syntax-propertize-function |
| 1032 | ;; Normal comments start with a * in column 0 and end at end of line. | 1032 | (syntax-propertize-rules |
| 1033 | '(("^\\*" (0 '(11))) ;(string-to-syntax "<") == '(11) | 1033 | ;; Normal comments start with a * in column 0 and end at end of line. |
| 1034 | ;; Every line can end with a comment which is placed after the operand. | 1034 | ("^\\*" (0 "<")) |
| 1035 | ;; I assume here that mnemonics without operands can not have a comment. | 1035 | ;; Every line can end with a comment which is placed after the operand. |
| 1036 | ("^[[:alnum:]]*[ \t]+[[:alnum:]]+[ \t]+[^ \n\t]+[ \t]*\\([ \t]\\)[^\n \t]" | 1036 | ;; I assume here that mnemonics without operands can not have a comment. |
| 1037 | (1 '(11))))) | 1037 | ("^[[:alnum:]]*[ \t]+[[:alnum:]]+[ \t]+[^ \n\t]+[ \t]*\\([ \t]\\)[^\n \t]" |
| 1038 | (1 "<")))) | ||
| 1038 | 1039 | ||
| 1039 | (defvar mixal-font-lock-keywords | 1040 | (defvar mixal-font-lock-keywords |
| 1040 | `(("^\\([A-Z0-9a-z]+\\)" | 1041 | `(("^\\([A-Z0-9a-z]+\\)" |
| @@ -1110,9 +1111,9 @@ Assumes that file has been compiled with debugging support." | |||
| 1110 | (set (make-local-variable 'comment-start) "*") | 1111 | (set (make-local-variable 'comment-start) "*") |
| 1111 | (set (make-local-variable 'comment-start-skip) "^\\*[ \t]*") | 1112 | (set (make-local-variable 'comment-start-skip) "^\\*[ \t]*") |
| 1112 | (set (make-local-variable 'font-lock-defaults) | 1113 | (set (make-local-variable 'font-lock-defaults) |
| 1113 | `(mixal-font-lock-keywords nil nil nil nil | 1114 | `(mixal-font-lock-keywords)) |
| 1114 | (font-lock-syntactic-keywords . ,mixal-font-lock-syntactic-keywords) | 1115 | (set (make-local-variable 'syntax-propertize-function) |
| 1115 | (parse-sexp-lookup-properties . t))) | 1116 | mixal-syntax-propertize-function) |
| 1116 | ;; might add an indent function in the future | 1117 | ;; might add an indent function in the future |
| 1117 | ;; (set (make-local-variable 'indent-line-function) 'mixal-indent-line) | 1118 | ;; (set (make-local-variable 'indent-line-function) 'mixal-indent-line) |
| 1118 | (set (make-local-variable 'compile-command) (concat "mixasm " | 1119 | (set (make-local-variable 'compile-command) (concat "mixasm " |
diff --git a/lisp/progmodes/octave-mod.el b/lisp/progmodes/octave-mod.el index ede850f87ab..bbefdaa2ccf 100644 --- a/lisp/progmodes/octave-mod.el +++ b/lisp/progmodes/octave-mod.el | |||
| @@ -179,38 +179,28 @@ parenthetical grouping.") | |||
| 179 | '(3 font-lock-function-name-face nil t))) | 179 | '(3 font-lock-function-name-face nil t))) |
| 180 | "Additional Octave expressions to highlight.") | 180 | "Additional Octave expressions to highlight.") |
| 181 | 181 | ||
| 182 | (defvar octave-font-lock-syntactic-keywords | 182 | (defun octave-syntax-propertize-function (start end) |
| 183 | (goto-char start) | ||
| 184 | (octave-syntax-propertize-sqs end) | ||
| 185 | (funcall (syntax-propertize-rules | ||
| 183 | ;; Try to distinguish the string-quotes from the transpose-quotes. | 186 | ;; Try to distinguish the string-quotes from the transpose-quotes. |
| 184 | '(("[[({,; ]\\('\\)" (1 "\"'")) | 187 | ("[[({,; ]\\('\\)" |
| 185 | (octave-font-lock-close-quotes))) | 188 | (1 (prog1 "\"'" (octave-syntax-propertize-sqs end))))) |
| 186 | 189 | (point) end)) | |
| 187 | (defun octave-font-lock-close-quotes (limit) | 190 | |
| 188 | "Fix the syntax-table of the closing quotes of single-quote strings." | 191 | (defun octave-syntax-propertize-sqs (end) |
| 189 | ;; Freely inspired from perl-font-lock-special-syntactic-constructs. | 192 | "Propertize the content/end of single-quote strings." |
| 190 | (let ((state (syntax-ppss))) | 193 | (when (eq (nth 3 (syntax-ppss)) ?\') |
| 191 | (while (< (point) limit) | ||
| 192 | (cond | ||
| 193 | ((eq (nth 3 state) ?\') | ||
| 194 | ;; A '..' string. | 194 | ;; A '..' string. |
| 195 | (save-excursion | 195 | (when (re-search-forward |
| 196 | (when (re-search-forward "\\(?:\\=\\|[^']\\)\\(?:''\\)*\\('\\)[^']" | 196 | "\\(?:\\=\\|[^']\\)\\(?:''\\)*\\('\\)\\($\\|[^']\\)" end 'move) |
| 197 | nil t) | 197 | (goto-char (match-beginning 2)) |
| 198 | (goto-char (1- (point))) | ||
| 199 | ;; Remove any syntax-table property we may have applied to | ||
| 200 | ;; some of the (doubled) single quotes within the string. | ||
| 201 | ;; Since these are the only chars on which we place properties, | ||
| 202 | ;; we take a shortcut and just remove all properties. | ||
| 203 | (remove-text-properties (1+ (nth 8 state)) (match-beginning 1) | ||
| 204 | '(syntax-table nil)) | ||
| 205 | (when (eq (char-before (match-beginning 1)) ?\\) | 198 | (when (eq (char-before (match-beginning 1)) ?\\) |
| 206 | ;; Backslash cannot escape a single quote. | 199 | ;; Backslash cannot escape a single quote. |
| 207 | (put-text-property (1- (match-beginning 1)) (match-beginning 1) | 200 | (put-text-property (1- (match-beginning 1)) (match-beginning 1) |
| 208 | 'syntax-table (string-to-syntax "."))) | 201 | 'syntax-table (string-to-syntax "."))) |
| 209 | (put-text-property (match-beginning 1) (match-end 1) | 202 | (put-text-property (match-beginning 1) (match-end 1) |
| 210 | 'syntax-table (string-to-syntax "\"'")))))) | 203 | 'syntax-table (string-to-syntax "\"'"))))) |
| 211 | |||
| 212 | (setq state (parse-partial-sexp (point) limit nil nil state | ||
| 213 | 'syntax-table))))) | ||
| 214 | 204 | ||
| 215 | (defcustom inferior-octave-buffer "*Inferior Octave*" | 205 | (defcustom inferior-octave-buffer "*Inferior Octave*" |
| 216 | "Name of buffer for running an inferior Octave process." | 206 | "Name of buffer for running an inferior Octave process." |
| @@ -544,6 +534,8 @@ Non-nil means always go to the next Octave code line after sending." | |||
| 544 | 0) | 534 | 0) |
| 545 | ((:before . "case") octave-block-offset))) | 535 | ((:before . "case") octave-block-offset))) |
| 546 | 536 | ||
| 537 | (defvar electric-indent-chars) | ||
| 538 | |||
| 547 | ;;;###autoload | 539 | ;;;###autoload |
| 548 | (define-derived-mode octave-mode prog-mode "Octave" | 540 | (define-derived-mode octave-mode prog-mode "Octave" |
| 549 | "Major mode for editing Octave code. | 541 | "Major mode for editing Octave code. |
| @@ -682,9 +674,10 @@ including a reproducible test case and send the message." | |||
| 682 | (set (make-local-variable 'normal-auto-fill-function) 'octave-auto-fill) | 674 | (set (make-local-variable 'normal-auto-fill-function) 'octave-auto-fill) |
| 683 | 675 | ||
| 684 | (set (make-local-variable 'font-lock-defaults) | 676 | (set (make-local-variable 'font-lock-defaults) |
| 685 | '(octave-font-lock-keywords nil nil nil nil | 677 | '(octave-font-lock-keywords)) |
| 686 | (font-lock-syntactic-keywords . octave-font-lock-syntactic-keywords) | 678 | |
| 687 | (parse-sexp-lookup-properties . t))) | 679 | (set (make-local-variable 'syntax-propertize-function) |
| 680 | #'octave-syntax-propertize-function) | ||
| 688 | 681 | ||
| 689 | (set (make-local-variable 'imenu-generic-expression) | 682 | (set (make-local-variable 'imenu-generic-expression) |
| 690 | octave-mode-imenu-generic-expression) | 683 | octave-mode-imenu-generic-expression) |
diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el index f8eba5accdb..ae3acc3cda3 100644 --- a/lisp/progmodes/perl-mode.el +++ b/lisp/progmodes/perl-mode.el | |||
| @@ -250,59 +250,76 @@ The expansion is entirely correct because it uses the C preprocessor." | |||
| 250 | ;; y /.../.../ | 250 | ;; y /.../.../ |
| 251 | ;; | 251 | ;; |
| 252 | ;; <file*glob> | 252 | ;; <file*glob> |
| 253 | (defvar perl-font-lock-syntactic-keywords | 253 | (defun perl-syntax-propertize-function (start end) |
| 254 | ;; TODO: here-documents ("<<\\(\\sw\\|['\"]\\)") | 254 | (let ((case-fold-search nil)) |
| 255 | `(;; Turn POD into b-style comments | 255 | (goto-char start) |
| 256 | ("^\\(=\\)\\sw" (1 "< b")) | 256 | (perl-syntax-propertize-special-constructs end) |
| 257 | ("^=cut[ \t]*\\(\n\\)" (1 "> b")) | 257 | ;; TODO: here-documents ("<<\\(\\sw\\|['\"]\\)") |
| 258 | ;; Catch ${ so that ${var} doesn't screw up indentation. | 258 | (funcall |
| 259 | ;; This also catches $' to handle 'foo$', although it should really | 259 | (syntax-propertize-rules |
| 260 | ;; check that it occurs inside a '..' string. | 260 | ;; Turn POD into b-style comments. Place the cut rule first since it's |
| 261 | ("\\(\\$\\)[{']" (1 ". p")) | 261 | ;; more specific. |
| 262 | ;; Handle funny names like $DB'stop. | 262 | ("^=cut\\>.*\\(\n\\)" (1 "> b")) |
| 263 | ("\\$ ?{?^?[_a-zA-Z][_a-zA-Z0-9]*\\('\\)[_a-zA-Z]" (1 "_")) | 263 | ("^\\(=\\)\\sw" (1 "< b")) |
| 264 | ;; format statements | 264 | ;; Catch ${ so that ${var} doesn't screw up indentation. |
| 265 | ("^[ \t]*format.*=[ \t]*\\(\n\\)" (1 '(7))) | 265 | ;; This also catches $' to handle 'foo$', although it should really |
| 266 | ;; Funny things in `sub' arg-specs like `sub myfun ($)' or `sub ($)'. | 266 | ;; check that it occurs inside a '..' string. |
| 267 | ;; Be careful not to match "sub { (...) ... }". | 267 | ("\\(\\$\\)[{']" (1 ". p")) |
| 268 | ("\\<sub\\(?:[[:space:]]+[^{}[:punct:][:space:]]+\\)?[[:space:]]*(\\([^)]+\\))" | 268 | ;; Handle funny names like $DB'stop. |
| 269 | 1 '(1)) | 269 | ("\\$ ?{?^?[_a-zA-Z][_a-zA-Z0-9]*\\('\\)[_a-zA-Z]" (1 "_")) |
| 270 | ;; Regexp and funny quotes. Distinguishing a / that starts a regexp | 270 | ;; format statements |
| 271 | ;; match from the division operator is ...interesting. | 271 | ("^[ \t]*format.*=[ \t]*\\(\n\\)" |
| 272 | ;; Basically, / is a regexp match if it's preceded by an infix operator | 272 | (1 (prog1 "\"" (perl-syntax-propertize-special-constructs end)))) |
| 273 | ;; (or some similar separator), or by one of the special keywords | 273 | ;; Funny things in `sub' arg-specs like `sub myfun ($)' or `sub ($)'. |
| 274 | ;; corresponding to builtin functions that can take their first arg | 274 | ;; Be careful not to match "sub { (...) ... }". |
| 275 | ;; without parentheses. Of course, that presume we're looking at the | 275 | ("\\<sub\\(?:[[:space:]]+[^{}[:punct:][:space:]]+\\)?[[:space:]]*(\\([^)]+\\))" |
| 276 | ;; *opening* slash. We can afford to mis-match the closing ones | 276 | (1 ".")) |
| 277 | ;; here, because they will be re-treated separately later in | 277 | ;; Regexp and funny quotes. Distinguishing a / that starts a regexp |
| 278 | ;; perl-font-lock-special-syntactic-constructs. | 278 | ;; match from the division operator is ...interesting. |
| 279 | (,(concat "\\(?:\\(?:\\(?:^\\|[^$@&%[:word:]]\\)" | 279 | ;; Basically, / is a regexp match if it's preceded by an infix operator |
| 280 | (regexp-opt '("split" "if" "unless" "until" "while" "split" | 280 | ;; (or some similar separator), or by one of the special keywords |
| 281 | "grep" "map" "not" "or" "and")) | 281 | ;; corresponding to builtin functions that can take their first arg |
| 282 | "\\)\\|[?:.,;=!~({[]\\|\\(^\\)\\)[ \t\n]*\\(/\\)") | 282 | ;; without parentheses. Of course, that presume we're looking at the |
| 283 | (2 (if (and (match-end 1) | 283 | ;; *opening* slash. We can afford to mis-match the closing ones |
| 284 | (save-excursion | 284 | ;; here, because they will be re-treated separately later in |
| 285 | (goto-char (match-end 1)) | 285 | ;; perl-font-lock-special-syntactic-constructs. |
| 286 | ;; Not 100% correct since we haven't finished setting up | 286 | ((concat "\\(?:\\(?:^\\|[^$@&%[:word:]]\\)" |
| 287 | ;; the syntax-table before point, but better than nothing. | 287 | (regexp-opt '("split" "if" "unless" "until" "while" "split" |
| 288 | (forward-comment (- (point-max))) | 288 | "grep" "map" "not" "or" "and")) |
| 289 | (put-text-property (point) (match-end 2) | 289 | "\\|[?:.,;=!~({[]\\|\\(^\\)\\)[ \t\n]*\\(/\\)") |
| 290 | 'jit-lock-defer-multiline t) | 290 | (2 (ignore |
| 291 | (not (memq (char-before) | 291 | (if (and (match-end 1) ; / at BOL. |
| 292 | '(?? ?: ?. ?, ?\; ?= ?! ?~ ?\( ?\[))))) | 292 | (save-excursion |
| 293 | nil ;; A division sign instead of a regexp-match. | 293 | (goto-char (match-end 1)) |
| 294 | '(7)))) | 294 | (forward-comment (- (point-max))) |
| 295 | ("\\(^\\|[?:.,;=!~({[ \t]\\)\\([msy]\\|q[qxrw]?\\|tr\\)\\>\\s-*\\([^])}> \n\t]\\)" | 295 | (put-text-property (point) (match-end 2) |
| 296 | ;; Nasty cases: | 296 | 'syntax-multiline t) |
| 297 | ;; /foo/m $a->m $#m $m @m %m | 297 | (not (memq (char-before) |
| 298 | ;; \s (appears often in regexps). | 298 | '(?? ?: ?. ?, ?\; ?= ?! ?~ ?\( ?\[))))) |
| 299 | ;; -s file | 299 | nil ;; A division sign instead of a regexp-match. |
| 300 | (3 (if (assoc (char-after (match-beginning 3)) | 300 | (put-text-property (match-beginning 2) (match-end 2) |
| 301 | perl-quote-like-pairs) | 301 | 'syntax-table (string-to-syntax "\"")) |
| 302 | '(15) '(7)))) | 302 | (perl-syntax-propertize-special-constructs end))))) |
| 303 | ;; Find and mark the end of funny quotes and format statements. | 303 | ("\\(^\\|[?:.,;=!~({[ \t]\\)\\([msy]\\|q[qxrw]?\\|tr\\)\\>\\s-*\\([^])}> \n\t]\\)" |
| 304 | (perl-font-lock-special-syntactic-constructs) | 304 | ;; Nasty cases: |
| 305 | )) | 305 | ;; /foo/m $a->m $#m $m @m %m |
| 306 | ;; \s (appears often in regexps). | ||
| 307 | ;; -s file | ||
| 308 | ;; sub tr {...} | ||
| 309 | (3 (ignore | ||
| 310 | (if (save-excursion (goto-char (match-beginning 0)) | ||
| 311 | (forward-word -1) | ||
| 312 | (looking-at-p "sub[ \t\n]")) | ||
| 313 | ;; This is defining a function. | ||
| 314 | nil | ||
| 315 | (put-text-property (match-beginning 3) (match-end 3) | ||
| 316 | 'syntax-table | ||
| 317 | (if (assoc (char-after (match-beginning 3)) | ||
| 318 | perl-quote-like-pairs) | ||
| 319 | (string-to-syntax "|") | ||
| 320 | (string-to-syntax "\""))) | ||
| 321 | (perl-syntax-propertize-special-constructs end)))))) | ||
| 322 | (point) end))) | ||
| 306 | 323 | ||
| 307 | (defvar perl-empty-syntax-table | 324 | (defvar perl-empty-syntax-table |
| 308 | (let ((st (copy-syntax-table))) | 325 | (let ((st (copy-syntax-table))) |
| @@ -321,95 +338,123 @@ The expansion is entirely correct because it uses the C preprocessor." | |||
| 321 | (modify-syntax-entry close ")" st)) | 338 | (modify-syntax-entry close ")" st)) |
| 322 | st)) | 339 | st)) |
| 323 | 340 | ||
| 324 | (defun perl-font-lock-special-syntactic-constructs (limit) | 341 | (defun perl-syntax-propertize-special-constructs (limit) |
| 325 | ;; We used to do all this in a font-lock-syntactic-face-function, which | 342 | "Propertize special constructs like regexps and formats." |
| 326 | ;; did not work correctly because sometimes some parts of the buffer are | ||
| 327 | ;; treated with font-lock-syntactic-keywords but not with | ||
| 328 | ;; font-lock-syntactic-face-function (mostly because of | ||
| 329 | ;; font-lock-syntactically-fontified). That meant that some syntax-table | ||
| 330 | ;; properties were missing. So now we do the parse-partial-sexp loop | ||
| 331 | ;; ourselves directly from font-lock-syntactic-keywords, so we're sure | ||
| 332 | ;; it's done when necessary. | ||
| 333 | (let ((state (syntax-ppss)) | 343 | (let ((state (syntax-ppss)) |
| 334 | char) | 344 | char) |
| 335 | (while (< (point) limit) | 345 | (cond |
| 336 | (cond | 346 | ((or (null (setq char (nth 3 state))) |
| 337 | ((or (null (setq char (nth 3 state))) | 347 | (and (characterp char) (eq (char-syntax (nth 3 state)) ?\"))) |
| 338 | (and (characterp char) (eq (char-syntax (nth 3 state)) ?\"))) | 348 | ;; Normal text, or comment, or docstring, or normal string. |
| 339 | ;; Normal text, or comment, or docstring, or normal string. | 349 | nil) |
| 340 | nil) | 350 | ((eq (nth 3 state) ?\n) |
| 341 | ((eq (nth 3 state) ?\n) | 351 | ;; A `format' command. |
| 342 | ;; A `format' command. | 352 | (when (re-search-forward "^\\s *\\.\\s *\n" limit 'move) |
| 343 | (save-excursion | 353 | (put-text-property (1- (point)) (point) |
| 344 | (when (and (re-search-forward "^\\s *\\.\\s *$" nil t) | 354 | 'syntax-table (string-to-syntax "\"")))) |
| 345 | (not (eobp))) | 355 | (t |
| 346 | (put-text-property (point) (1+ (point)) 'syntax-table '(7))))) | 356 | ;; This is regexp like quote thingy. |
| 347 | (t | 357 | (setq char (char-after (nth 8 state))) |
| 348 | ;; This is regexp like quote thingy. | 358 | (let ((twoargs (save-excursion |
| 349 | (setq char (char-after (nth 8 state))) | 359 | (goto-char (nth 8 state)) |
| 350 | (save-excursion | 360 | (skip-syntax-backward " ") |
| 351 | (let ((twoargs (save-excursion | 361 | (skip-syntax-backward "w") |
| 352 | (goto-char (nth 8 state)) | 362 | (member (buffer-substring |
| 353 | (skip-syntax-backward " ") | 363 | (point) (progn (forward-word 1) (point))) |
| 354 | (skip-syntax-backward "w") | 364 | '("tr" "s" "y")))) |
| 355 | (member (buffer-substring | 365 | (close (cdr (assq char perl-quote-like-pairs))) |
| 356 | (point) (progn (forward-word 1) (point))) | 366 | (st (perl-quote-syntax-table char))) |
| 357 | '("tr" "s" "y")))) | 367 | (when (with-syntax-table st |
| 358 | (close (cdr (assq char perl-quote-like-pairs))) | 368 | (if close |
| 359 | (pos (point)) | 369 | ;; For paired delimiters, Perl allows nesting them, but |
| 360 | (st (perl-quote-syntax-table char))) | 370 | ;; since we treat them as strings, Emacs does not count |
| 361 | (if (not close) | 371 | ;; those delimiters in `state', so we don't know how deep |
| 362 | ;; The closing char is the same as the opening char. | 372 | ;; we are: we have to go back to the beginning of this |
| 363 | (with-syntax-table st | 373 | ;; "string" and count from there. |
| 364 | (parse-partial-sexp (point) (point-max) | 374 | (condition-case nil |
| 365 | nil nil state 'syntax-table) | 375 | (progn |
| 366 | (when twoargs | 376 | ;; Start after the first char since it doesn't have |
| 367 | (parse-partial-sexp (point) (point-max) | 377 | ;; paren-syntax (an alternative would be to let-bind |
| 368 | nil nil state 'syntax-table))) | 378 | ;; parse-sexp-lookup-properties). |
| 369 | ;; The open/close chars are matched like () [] {} and <>. | 379 | (goto-char (1+ (nth 8 state))) |
| 370 | (let ((parse-sexp-lookup-properties nil)) | 380 | (up-list 1) |
| 371 | (condition-case err | 381 | t) |
| 372 | (progn | 382 | (scan-error nil)) |
| 373 | (with-syntax-table st | 383 | (not (or (nth 8 (parse-partial-sexp |
| 374 | (goto-char (nth 8 state)) (forward-sexp 1)) | 384 | (point) limit nil nil state 'syntax-table)) |
| 375 | (when twoargs | 385 | ;; If we have a self-paired opener and a twoargs |
| 376 | (save-excursion | 386 | ;; command, the form is s/../../ so we have to skip |
| 377 | ;; Skip whitespace and make sure that font-lock will | 387 | ;; a second time. |
| 378 | ;; refontify the second part in the proper context. | 388 | ;; In the case of s{...}{...}, we only handle the |
| 379 | (put-text-property | 389 | ;; first part here and the next below. |
| 380 | (point) (progn (forward-comment (point-max)) (point)) | 390 | (when (and twoargs (not close)) |
| 381 | 'font-lock-multiline t) | 391 | (nth 8 (parse-partial-sexp |
| 382 | ;; | 392 | (point) limit |
| 383 | (unless | 393 | nil nil state 'syntax-table))))))) |
| 384 | (or (eobp) | 394 | ;; Point is now right after the arg(s). |
| 385 | (save-excursion | 395 | (when (eq (char-before (1- (point))) ?$) |
| 386 | (with-syntax-table | 396 | (put-text-property (- (point) 2) (1- (point)) |
| 387 | (perl-quote-syntax-table (char-after)) | 397 | 'syntax-table '(1))) |
| 388 | (forward-sexp 1)) | 398 | (put-text-property (1- (point)) (point) |
| 389 | (put-text-property pos (line-end-position) | 399 | 'syntax-table |
| 390 | 'jit-lock-defer-multiline t) | 400 | (if close |
| 391 | (looking-at "\\s-*\\sw*e"))) | 401 | (string-to-syntax "|") |
| 392 | (put-text-property (point) (1+ (point)) | 402 | (string-to-syntax "\""))) |
| 393 | 'syntax-table | 403 | ;; If we have two args with a non-self-paired starter (e.g. |
| 394 | (if (assoc (char-after) | 404 | ;; s{...}{...}) we're right after the first arg, so we still have to |
| 395 | perl-quote-like-pairs) | 405 | ;; handle the second part. |
| 396 | '(15) '(7))))))) | 406 | (when (and twoargs close) |
| 397 | ;; The arg(s) is not terminated, so it extends until EOB. | 407 | ;; Skip whitespace and make sure that font-lock will |
| 398 | (scan-error (goto-char (point-max)))))) | 408 | ;; refontify the second part in the proper context. |
| 399 | ;; Point is now right after the arg(s). | 409 | (put-text-property |
| 400 | ;; Erase any syntactic marks within the quoted text. | 410 | (point) (progn (forward-comment (point-max)) (point)) |
| 401 | (put-text-property pos (1- (point)) 'syntax-table nil) | 411 | 'syntax-multiline t) |
| 402 | (when (eq (char-before (1- (point))) ?$) | 412 | ;; |
| 403 | (put-text-property (- (point) 2) (1- (point)) | 413 | (when (< (point) limit) |
| 404 | 'syntax-table '(1))) | 414 | (put-text-property (point) (1+ (point)) |
| 405 | (put-text-property (1- (point)) (point) | 415 | 'syntax-table |
| 406 | 'syntax-table (if close '(15) '(7))))))) | 416 | (if (assoc (char-after) |
| 407 | 417 | perl-quote-like-pairs) | |
| 408 | (setq state (parse-partial-sexp (point) limit nil nil state | 418 | ;; Put an `e' in the cdr to mark this |
| 409 | 'syntax-table)))) | 419 | ;; char as "second arg starter". |
| 410 | ;; Tell font-lock that this needs not further processing. | 420 | (string-to-syntax "|e") |
| 411 | nil) | 421 | (string-to-syntax "\"e"))) |
| 412 | 422 | (forward-char 1) | |
| 423 | ;; Re-use perl-syntax-propertize-special-constructs to handle the | ||
| 424 | ;; second part (the first delimiter of second part can't be | ||
| 425 | ;; preceded by "s" or "tr" or "y", so it will not be considered | ||
| 426 | ;; as twoarg). | ||
| 427 | (perl-syntax-propertize-special-constructs limit))))))))) | ||
| 428 | |||
| 429 | (defun perl-font-lock-syntactic-face-function (state) | ||
| 430 | (cond | ||
| 431 | ((and (nth 3 state) | ||
| 432 | (eq ?e (cdr-safe (get-text-property (nth 8 state) 'syntax-table))) | ||
| 433 | ;; This is a second-arg of s{..}{...} form; let's check if this second | ||
| 434 | ;; arg is executable code rather than a string. For that, we need to | ||
| 435 | ;; look for an "e" after this second arg, so we have to hunt for the | ||
| 436 | ;; end of the arg. Depending on whether the whole arg has already | ||
| 437 | ;; been syntax-propertized or not, the end-char will have different | ||
| 438 | ;; syntaxes, so let's ignore syntax-properties temporarily so we can | ||
| 439 | ;; pretend it has not been syntax-propertized yet. | ||
| 440 | (let* ((parse-sexp-lookup-properties nil) | ||
| 441 | (char (char-after (nth 8 state))) | ||
| 442 | (paired (assq char perl-quote-like-pairs))) | ||
| 443 | (with-syntax-table (perl-quote-syntax-table char) | ||
| 444 | (save-excursion | ||
| 445 | (if (not paired) | ||
| 446 | (parse-partial-sexp (point) (point-max) | ||
| 447 | nil nil state 'syntax-table) | ||
| 448 | (condition-case nil | ||
| 449 | (progn | ||
| 450 | (goto-char (1+ (nth 8 state))) | ||
| 451 | (up-list 1)) | ||
| 452 | (scan-error (goto-char (point-max))))) | ||
| 453 | (put-text-property (nth 8 state) (point) | ||
| 454 | 'jit-lock-defer-multiline t) | ||
| 455 | (looking-at "[ \t]*\\sw*e"))))) | ||
| 456 | nil) | ||
| 457 | (t (funcall (default-value 'font-lock-syntactic-face-function) state)))) | ||
| 413 | 458 | ||
| 414 | (defcustom perl-indent-level 4 | 459 | (defcustom perl-indent-level 4 |
| 415 | "*Indentation of Perl statements with respect to containing block." | 460 | "*Indentation of Perl statements with respect to containing block." |
| @@ -574,9 +619,12 @@ Turning on Perl mode runs the normal hook `perl-mode-hook'." | |||
| 574 | perl-font-lock-keywords-1 | 619 | perl-font-lock-keywords-1 |
| 575 | perl-font-lock-keywords-2) | 620 | perl-font-lock-keywords-2) |
| 576 | nil nil ((?\_ . "w")) nil | 621 | nil nil ((?\_ . "w")) nil |
| 577 | (font-lock-syntactic-keywords | 622 | (font-lock-syntactic-face-function |
| 578 | . perl-font-lock-syntactic-keywords) | 623 | . perl-font-lock-syntactic-face-function))) |
| 579 | (parse-sexp-lookup-properties . t))) | 624 | (set (make-local-variable 'syntax-propertize-function) |
| 625 | #'perl-syntax-propertize-function) | ||
| 626 | (add-hook 'syntax-propertize-extend-region-functions | ||
| 627 | #'syntax-propertize-multiline 'append 'local) | ||
| 580 | ;; Tell imenu how to handle Perl. | 628 | ;; Tell imenu how to handle Perl. |
| 581 | (set (make-local-variable 'imenu-generic-expression) | 629 | (set (make-local-variable 'imenu-generic-expression) |
| 582 | perl-imenu-generic-expression) | 630 | perl-imenu-generic-expression) |
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 2f65ffa1e17..10e852223ce 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -166,29 +166,32 @@ | |||
| 166 | symbol-end) | 166 | symbol-end) |
| 167 | . font-lock-builtin-face))) | 167 | . font-lock-builtin-face))) |
| 168 | 168 | ||
| 169 | (defconst python-font-lock-syntactic-keywords | 169 | (defconst python-syntax-propertize-function |
| 170 | ;; Make outer chars of matching triple-quote sequences into generic | 170 | ;; Make outer chars of matching triple-quote sequences into generic |
| 171 | ;; string delimiters. Fixme: Is there a better way? | 171 | ;; string delimiters. Fixme: Is there a better way? |
| 172 | ;; First avoid a sequence preceded by an odd number of backslashes. | 172 | ;; First avoid a sequence preceded by an odd number of backslashes. |
| 173 | `((,(rx (not (any ?\\)) | 173 | (syntax-propertize-rules |
| 174 | ?\\ (* (and ?\\ ?\\)) | 174 | (;; (rx (not (any ?\\)) |
| 175 | (group (syntax string-quote)) | 175 | ;; ?\\ (* (and ?\\ ?\\)) |
| 176 | (backref 1) | 176 | ;; (group (syntax string-quote)) |
| 177 | (group (backref 1))) | 177 | ;; (backref 1) |
| 178 | (2 ,(string-to-syntax "\""))) ; dummy | 178 | ;; (group (backref 1))) |
| 179 | (,(rx (group (optional (any "uUrR"))) ; prefix gets syntax property | 179 | ;; ¡Backrefs don't work in syntax-propertize-rules! |
| 180 | (optional (any "rR")) ; possible second prefix | 180 | "[^\\]\\\\\\(\\\\\\\\\\)*\\(?:''\\('\\)\\|\"\"\\(?2:\"\\)\\)" |
| 181 | (group (syntax string-quote)) ; maybe gets property | 181 | (2 "\"")) ; dummy |
| 182 | (backref 2) ; per first quote | 182 | (;; (rx (optional (group (any "uUrR"))) ; prefix gets syntax property |
| 183 | (group (backref 2))) ; maybe gets property | 183 | ;; (optional (any "rR")) ; possible second prefix |
| 184 | (1 (python-quote-syntax 1)) | 184 | ;; (group (syntax string-quote)) ; maybe gets property |
| 185 | (2 (python-quote-syntax 2)) | 185 | ;; (backref 2) ; per first quote |
| 186 | (3 (python-quote-syntax 3))) | 186 | ;; (group (backref 2))) ; maybe gets property |
| 187 | ;; This doesn't really help. | 187 | ;; ¡Backrefs don't work in syntax-propertize-rules! |
| 188 | ;;; (,(rx (and ?\\ (group ?\n))) (1 " ")) | 188 | "\\([RUru]\\)?[Rr]?\\(?:\\('\\)'\\('\\)\\|\\(?2:\"\\)\"\\(?3:\"\\)\\)" |
| 189 | )) | 189 | (3 (ignore (python-quote-syntax)))) |
| 190 | 190 | ;; This doesn't really help. | |
| 191 | (defun python-quote-syntax (n) | 191 | ;;((rx (and ?\\ (group ?\n))) (1 " ")) |
| 192 | )) | ||
| 193 | |||
| 194 | (defun python-quote-syntax () | ||
| 192 | "Put `syntax-table' property correctly on triple quote. | 195 | "Put `syntax-table' property correctly on triple quote. |
| 193 | Used for syntactic keywords. N is the match number (1, 2 or 3)." | 196 | Used for syntactic keywords. N is the match number (1, 2 or 3)." |
| 194 | ;; Given a triple quote, we have to check the context to know | 197 | ;; Given a triple quote, we have to check the context to know |
| @@ -206,28 +209,25 @@ Used for syntactic keywords. N is the match number (1, 2 or 3)." | |||
| 206 | ;; x '"""' x """ \"""" x | 209 | ;; x '"""' x """ \"""" x |
| 207 | (save-excursion | 210 | (save-excursion |
| 208 | (goto-char (match-beginning 0)) | 211 | (goto-char (match-beginning 0)) |
| 209 | (cond | 212 | (let ((syntax (save-match-data (syntax-ppss)))) |
| 210 | ;; Consider property for the last char if in a fenced string. | 213 | (cond |
| 211 | ((= n 3) | 214 | ((eq t (nth 3 syntax)) ; after unclosed fence |
| 212 | (let* ((font-lock-syntactic-keywords nil) | 215 | ;; Consider property for the last char if in a fenced string. |
| 213 | (syntax (syntax-ppss))) | 216 | (goto-char (nth 8 syntax)) ; fence position |
| 214 | (when (eq t (nth 3 syntax)) ; after unclosed fence | 217 | (skip-chars-forward "uUrR") ; skip any prefix |
| 215 | (goto-char (nth 8 syntax)) ; fence position | 218 | ;; Is it a matching sequence? |
| 216 | (skip-chars-forward "uUrR") ; skip any prefix | 219 | (if (eq (char-after) (char-after (match-beginning 2))) |
| 217 | ;; Is it a matching sequence? | 220 | (put-text-property (match-beginning 3) (match-end 3) |
| 218 | (if (eq (char-after) (char-after (match-beginning 2))) | 221 | 'syntax-table (string-to-syntax "|")))) |
| 219 | (eval-when-compile (string-to-syntax "|")))))) | 222 | ((match-end 1) |
| 220 | ;; Consider property for initial char, accounting for prefixes. | 223 | ;; Consider property for initial char, accounting for prefixes. |
| 221 | ((or (and (= n 2) ; leading quote (not prefix) | 224 | (put-text-property (match-beginning 1) (match-end 1) |
| 222 | (= (match-beginning 1) (match-end 1))) ; prefix is null | 225 | 'syntax-table (string-to-syntax "|"))) |
| 223 | (and (= n 1) ; prefix | 226 | (t |
| 224 | (/= (match-beginning 1) (match-end 1)))) ; non-empty | 227 | ;; Consider property for initial char, accounting for prefixes. |
| 225 | (let ((font-lock-syntactic-keywords nil)) | 228 | (put-text-property (match-beginning 2) (match-end 2) |
| 226 | (unless (eq 'string (syntax-ppss-context (syntax-ppss))) | 229 | 'syntax-table (string-to-syntax "|")))) |
| 227 | (eval-when-compile (string-to-syntax "|"))))) | 230 | ))) |
| 228 | ;; Otherwise (we're in a non-matching string) the property is | ||
| 229 | ;; nil, which is OK. | ||
| 230 | ))) | ||
| 231 | 231 | ||
| 232 | ;; This isn't currently in `font-lock-defaults' as probably not worth | 232 | ;; This isn't currently in `font-lock-defaults' as probably not worth |
| 233 | ;; it -- we basically only mess with a few normally-symbol characters. | 233 | ;; it -- we basically only mess with a few normally-symbol characters. |
| @@ -2495,12 +2495,12 @@ with skeleton expansions for compound statement templates. | |||
| 2495 | :group 'python | 2495 | :group 'python |
| 2496 | (set (make-local-variable 'font-lock-defaults) | 2496 | (set (make-local-variable 'font-lock-defaults) |
| 2497 | '(python-font-lock-keywords nil nil nil nil | 2497 | '(python-font-lock-keywords nil nil nil nil |
| 2498 | (font-lock-syntactic-keywords | 2498 | ;; This probably isn't worth it. |
| 2499 | . python-font-lock-syntactic-keywords) | 2499 | ;; (font-lock-syntactic-face-function |
| 2500 | ;; This probably isn't worth it. | 2500 | ;; . python-font-lock-syntactic-face-function) |
| 2501 | ;; (font-lock-syntactic-face-function | 2501 | )) |
| 2502 | ;; . python-font-lock-syntactic-face-function) | 2502 | (set (make-local-variable 'syntax-propertize-function) |
| 2503 | )) | 2503 | python-syntax-propertize-function) |
| 2504 | (set (make-local-variable 'parse-sexp-lookup-properties) t) | 2504 | (set (make-local-variable 'parse-sexp-lookup-properties) t) |
| 2505 | (set (make-local-variable 'parse-sexp-ignore-comments) t) | 2505 | (set (make-local-variable 'parse-sexp-ignore-comments) t) |
| 2506 | (set (make-local-variable 'comment-start) "# ") | 2506 | (set (make-local-variable 'comment-start) "# ") |
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 0b92234bf1c..4d015de5198 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el | |||
| @@ -100,17 +100,10 @@ | |||
| 100 | 100 | ||
| 101 | (defconst ruby-block-end-re "\\<end\\>") | 101 | (defconst ruby-block-end-re "\\<end\\>") |
| 102 | 102 | ||
| 103 | (defconst ruby-here-doc-beg-re | 103 | (eval-and-compile |
| 104 | (defconst ruby-here-doc-beg-re | ||
| 104 | "\\(<\\)<\\(-\\)?\\(\\([a-zA-Z0-9_]+\\)\\|[\"]\\([^\"]+\\)[\"]\\|[']\\([^']+\\)[']\\)" | 105 | "\\(<\\)<\\(-\\)?\\(\\([a-zA-Z0-9_]+\\)\\|[\"]\\([^\"]+\\)[\"]\\|[']\\([^']+\\)[']\\)" |
| 105 | "Regexp to match the beginning of a heredoc.") | 106 | "Regexp to match the beginning of a heredoc.")) |
| 106 | |||
| 107 | (defconst ruby-here-doc-end-re | ||
| 108 | "^\\([ \t]+\\)?\\(.*\\)\\(.\\)$" | ||
| 109 | "Regexp to match the end of heredocs. | ||
| 110 | |||
| 111 | This will actually match any line with one or more characters. | ||
| 112 | It's useful in that it divides up the match string so that | ||
| 113 | `ruby-here-doc-beg-match' can search for the beginning of the heredoc.") | ||
| 114 | 107 | ||
| 115 | (defun ruby-here-doc-end-match () | 108 | (defun ruby-here-doc-end-match () |
| 116 | "Return a regexp to find the end of a heredoc. | 109 | "Return a regexp to find the end of a heredoc. |
| @@ -123,18 +116,6 @@ This should only be called after matching against `ruby-here-doc-beg-re'." | |||
| 123 | (match-string 5) | 116 | (match-string 5) |
| 124 | (match-string 6))))) | 117 | (match-string 6))))) |
| 125 | 118 | ||
| 126 | (defun ruby-here-doc-beg-match () | ||
| 127 | "Return a regexp to find the beginning of a heredoc. | ||
| 128 | |||
| 129 | This should only be called after matching against `ruby-here-doc-end-re'." | ||
| 130 | (let ((contents (regexp-quote (concat (match-string 2) (match-string 3))))) | ||
| 131 | (concat "<<" | ||
| 132 | (let ((match (match-string 1))) | ||
| 133 | (if (and match (> (length match) 0)) | ||
| 134 | (concat "\\(?:-\\([\"']?\\)\\|\\([\"']\\)" (match-string 1) "\\)" | ||
| 135 | contents "\\b\\(\\1\\|\\2\\)") | ||
| 136 | (concat "-?\\([\"']\\|\\)" contents "\\b\\1")))))) | ||
| 137 | |||
| 138 | (defconst ruby-delimiter | 119 | (defconst ruby-delimiter |
| 139 | (concat "[?$/%(){}#\"'`.:]\\|<<\\|\\[\\|\\]\\|\\<\\(" | 120 | (concat "[?$/%(){}#\"'`.:]\\|<<\\|\\[\\|\\]\\|\\<\\(" |
| 140 | ruby-block-beg-re | 121 | ruby-block-beg-re |
| @@ -362,7 +343,7 @@ Also ignores spaces after parenthesis when 'space." | |||
| 362 | (back-to-indentation) | 343 | (back-to-indentation) |
| 363 | (current-column))) | 344 | (current-column))) |
| 364 | 345 | ||
| 365 | (defun ruby-indent-line (&optional flag) | 346 | (defun ruby-indent-line (&optional ignored) |
| 366 | "Correct the indentation of the current Ruby line." | 347 | "Correct the indentation of the current Ruby line." |
| 367 | (interactive) | 348 | (interactive) |
| 368 | (ruby-indent-to (ruby-calculate-indent))) | 349 | (ruby-indent-to (ruby-calculate-indent))) |
| @@ -405,8 +386,7 @@ and `\\' when preceded by `?'." | |||
| 405 | "TODO: document." | 386 | "TODO: document." |
| 406 | (save-excursion | 387 | (save-excursion |
| 407 | (store-match-data nil) | 388 | (store-match-data nil) |
| 408 | (let ((space (skip-chars-backward " \t")) | 389 | (let ((space (skip-chars-backward " \t"))) |
| 409 | (start (point))) | ||
| 410 | (cond | 390 | (cond |
| 411 | ((bolp) t) | 391 | ((bolp) t) |
| 412 | ((progn | 392 | ((progn |
| @@ -700,7 +680,7 @@ and `\\' when preceded by `?'." | |||
| 700 | (beginning-of-line) | 680 | (beginning-of-line) |
| 701 | (let ((ruby-indent-point (point)) | 681 | (let ((ruby-indent-point (point)) |
| 702 | (case-fold-search nil) | 682 | (case-fold-search nil) |
| 703 | state bol eol begin op-end | 683 | state eol begin op-end |
| 704 | (paren (progn (skip-syntax-forward " ") | 684 | (paren (progn (skip-syntax-forward " ") |
| 705 | (and (char-after) (matching-paren (char-after))))) | 685 | (and (char-after) (matching-paren (char-after))))) |
| 706 | (indent 0)) | 686 | (indent 0)) |
| @@ -780,7 +760,6 @@ and `\\' when preceded by `?'." | |||
| 780 | (if (re-search-forward "^\\s *#" end t) | 760 | (if (re-search-forward "^\\s *#" end t) |
| 781 | (beginning-of-line) | 761 | (beginning-of-line) |
| 782 | (setq done t)))) | 762 | (setq done t)))) |
| 783 | (setq bol (point)) | ||
| 784 | (end-of-line) | 763 | (end-of-line) |
| 785 | ;; skip the comment at the end | 764 | ;; skip the comment at the end |
| 786 | (skip-chars-backward " \t") | 765 | (skip-chars-backward " \t") |
| @@ -1037,10 +1016,8 @@ With ARG, do it many times. Negative ARG means move forward." | |||
| 1037 | (ruby-beginning-of-defun) | 1016 | (ruby-beginning-of-defun) |
| 1038 | (re-search-backward "^\n" (- (point) 1) t)) | 1017 | (re-search-backward "^\n" (- (point) 1) t)) |
| 1039 | 1018 | ||
| 1040 | (defun ruby-indent-exp (&optional shutup-p) | 1019 | (defun ruby-indent-exp (&optional ignored) |
| 1041 | "Indent each line in the balanced expression following the point. | 1020 | "Indent each line in the balanced expression following the point." |
| 1042 | If a prefix arg is given or SHUTUP-P is non-nil, no errors | ||
| 1043 | are signalled if a balanced expression isn't found." | ||
| 1044 | (interactive "*P") | 1021 | (interactive "*P") |
| 1045 | (let ((here (point-marker)) start top column (nest t)) | 1022 | (let ((here (point-marker)) start top column (nest t)) |
| 1046 | (set-marker-insertion-type here t) | 1023 | (set-marker-insertion-type here t) |
| @@ -1133,58 +1110,208 @@ See `add-log-current-defun-function'." | |||
| 1133 | (if mlist (concat mlist mname) mname) | 1110 | (if mlist (concat mlist mname) mname) |
| 1134 | mlist))))) | 1111 | mlist))))) |
| 1135 | 1112 | ||
| 1136 | (defconst ruby-font-lock-syntactic-keywords | 1113 | (if (eval-when-compile (fboundp #'syntax-propertize-rules)) |
| 1137 | `(;; #{ }, #$hoge, #@foo are not comments | 1114 | ;; New code that works independently from font-lock. |
| 1138 | ("\\(#\\)[{$@]" 1 (1 . nil)) | 1115 | (progn |
| 1139 | ;; the last $', $", $` in the respective string is not variable | 1116 | (defun ruby-syntax-propertize-function (start end) |
| 1140 | ;; the last ?', ?", ?` in the respective string is not ascii code | 1117 | "Syntactic keywords for Ruby mode. See `syntax-propertize-function'." |
| 1141 | ("\\(^\\|[\[ \t\n<+\(,=]\\)\\(['\"`]\\)\\(\\\\.\\|\\2\\|[^'\"`\n\\\\]\\)*?\\\\?[?$]\\(\\2\\)" | 1118 | (goto-char start) |
| 1142 | (2 (7 . nil)) | 1119 | (ruby-syntax-propertize-heredoc end) |
| 1143 | (4 (7 . nil))) | 1120 | (funcall |
| 1144 | ;; $' $" $` .... are variables | 1121 | (syntax-propertize-rules |
| 1145 | ;; ?' ?" ?` are ascii codes | 1122 | ;; #{ }, #$hoge, #@foo are not comments |
| 1146 | ("\\(^\\|[^\\\\]\\)\\(\\\\\\\\\\)*[?$]\\([#\"'`]\\)" 3 (1 . nil)) | 1123 | ("\\(#\\)[{$@]" (1 ".")) |
| 1147 | ;; regexps | 1124 | ;; the last $', $", $` in the respective string is not variable |
| 1148 | ("\\(^\\|[=(,~?:;<>]\\|\\(^\\|\\s \\)\\(if\\|elsif\\|unless\\|while\\|until\\|when\\|and\\|or\\|&&\\|||\\)\\|g?sub!?\\|scan\\|split!?\\)\\s *\\(/\\)[^/\n\\\\]*\\(\\\\.[^/\n\\\\]*\\)*\\(/\\)" | 1125 | ;; the last ?', ?", ?` in the respective string is not ascii code |
| 1149 | (4 (7 . ?/)) | 1126 | ("\\(^\\|[\[ \t\n<+\(,=]\\)\\(['\"`]\\)\\(\\\\.\\|\\2\\|[^'\"`\n\\\\]\\)*?\\\\?[?$]\\(\\2\\)" |
| 1150 | (6 (7 . ?/))) | 1127 | (2 "\"") |
| 1151 | ("^=en\\(d\\)\\_>" 1 "!") | 1128 | (4 "\"")) |
| 1152 | ("^\\(=\\)begin\\_>" 1 (ruby-comment-beg-syntax)) | 1129 | ;; $' $" $` .... are variables |
| 1153 | ;; Currently, the following case is highlighted incorrectly: | 1130 | ;; ?' ?" ?` are ascii codes |
| 1154 | ;; | 1131 | ("\\(^\\|[^\\\\]\\)\\(\\\\\\\\\\)*[?$]\\([#\"'`]\\)" (3 ".")) |
| 1155 | ;; <<FOO | 1132 | ;; regexps |
| 1156 | ;; FOO | 1133 | ("\\(^\\|[=(,~?:;<>]\\|\\(^\\|\\s \\)\\(if\\|elsif\\|unless\\|while\\|until\\|when\\|and\\|or\\|&&\\|||\\)\\|g?sub!?\\|scan\\|split!?\\)\\s *\\(/\\)[^/\n\\\\]*\\(\\\\.[^/\n\\\\]*\\)*\\(/\\)" |
| 1157 | ;; <<BAR | 1134 | (4 "\"/") |
| 1158 | ;; <<BAZ | 1135 | (6 "\"/")) |
| 1159 | ;; BAZ | 1136 | ("^=en\\(d\\)\\_>" (1 "!")) |
| 1160 | ;; BAR | 1137 | ("^\\(=\\)begin\\_>" (1 "!")) |
| 1161 | ;; | 1138 | ;; Handle here documents. |
| 1162 | ;; This is because all here-doc beginnings are highlighted before any endings, | 1139 | ((concat ruby-here-doc-beg-re ".*\\(\n\\)") |
| 1163 | ;; so although <<BAR is properly marked as a beginning, when we get to <<BAZ | 1140 | (7 (prog1 "\"" (ruby-syntax-propertize-heredoc end))))) |
| 1164 | ;; it thinks <<BAR is part of a string so it's marked as well. | 1141 | (point) end)) |
| 1165 | ;; | 1142 | |
| 1166 | ;; This may be fixable by modifying ruby-in-here-doc-p to use | 1143 | (defun ruby-syntax-propertize-heredoc (limit) |
| 1167 | ;; ruby-in-non-here-doc-string-p rather than syntax-ppss-context, | 1144 | (let ((ppss (syntax-ppss)) |
| 1168 | ;; but I don't want to try that until we've got unit tests set up | 1145 | (res '())) |
| 1169 | ;; to make sure I don't break anything else. | 1146 | (when (eq ?\n (nth 3 ppss)) |
| 1170 | (,(concat ruby-here-doc-beg-re ".*\\(\n\\)") | 1147 | (save-excursion |
| 1171 | ,(+ 1 (regexp-opt-depth ruby-here-doc-beg-re)) | 1148 | (goto-char (nth 8 ppss)) |
| 1172 | (ruby-here-doc-beg-syntax)) | 1149 | (beginning-of-line) |
| 1173 | (,ruby-here-doc-end-re 3 (ruby-here-doc-end-syntax))) | 1150 | (while (re-search-forward ruby-here-doc-beg-re |
| 1174 | "Syntactic keywords for Ruby mode. See `font-lock-syntactic-keywords'.") | 1151 | (line-end-position) t) |
| 1175 | 1152 | (push (concat (ruby-here-doc-end-match) "\n") res))) | |
| 1176 | (defun ruby-comment-beg-syntax () | 1153 | (let ((start (point))) |
| 1177 | "Return the syntax cell for a the first character of a =begin. | 1154 | ;; With multiple openers on the same line, we don't know in which |
| 1155 | ;; part `start' is, so we have to go back to the beginning. | ||
| 1156 | (when (cdr res) | ||
| 1157 | (goto-char (nth 8 ppss)) | ||
| 1158 | (setq res (nreverse res))) | ||
| 1159 | (while (and res (re-search-forward (pop res) limit 'move)) | ||
| 1160 | (if (null res) | ||
| 1161 | (put-text-property (1- (point)) (point) | ||
| 1162 | 'syntax-table (string-to-syntax "\"")))) | ||
| 1163 | ;; Make extra sure we don't move back, lest we could fall into an | ||
| 1164 | ;; inf-loop. | ||
| 1165 | (if (< (point) start) (goto-char start)))))) | ||
| 1166 | ) | ||
| 1167 | |||
| 1168 | ;; For Emacsen where syntax-propertize-rules is not (yet) available, | ||
| 1169 | ;; fallback on the old font-lock-syntactic-keywords stuff. | ||
| 1170 | |||
| 1171 | (defconst ruby-here-doc-end-re | ||
| 1172 | "^\\([ \t]+\\)?\\(.*\\)\\(\n\\)" | ||
| 1173 | "Regexp to match the end of heredocs. | ||
| 1174 | |||
| 1175 | This will actually match any line with one or more characters. | ||
| 1176 | It's useful in that it divides up the match string so that | ||
| 1177 | `ruby-here-doc-beg-match' can search for the beginning of the heredoc.") | ||
| 1178 | |||
| 1179 | (defun ruby-here-doc-beg-match () | ||
| 1180 | "Return a regexp to find the beginning of a heredoc. | ||
| 1181 | |||
| 1182 | This should only be called after matching against `ruby-here-doc-end-re'." | ||
| 1183 | (let ((contents (regexp-quote (match-string 2)))) | ||
| 1184 | (concat "<<" | ||
| 1185 | (let ((match (match-string 1))) | ||
| 1186 | (if (and match (> (length match) 0)) | ||
| 1187 | (concat "\\(?:-\\([\"']?\\)\\|\\([\"']\\)" match "\\)" | ||
| 1188 | contents "\\b\\(\\1\\|\\2\\)") | ||
| 1189 | (concat "-?\\([\"']\\|\\)" contents "\\b\\1")))))) | ||
| 1190 | |||
| 1191 | (defconst ruby-font-lock-syntactic-keywords | ||
| 1192 | `( ;; #{ }, #$hoge, #@foo are not comments | ||
| 1193 | ("\\(#\\)[{$@]" 1 (1 . nil)) | ||
| 1194 | ;; the last $', $", $` in the respective string is not variable | ||
| 1195 | ;; the last ?', ?", ?` in the respective string is not ascii code | ||
| 1196 | ("\\(^\\|[\[ \t\n<+\(,=]\\)\\(['\"`]\\)\\(\\\\.\\|\\2\\|[^'\"`\n\\\\]\\)*?\\\\?[?$]\\(\\2\\)" | ||
| 1197 | (2 (7 . nil)) | ||
| 1198 | (4 (7 . nil))) | ||
| 1199 | ;; $' $" $` .... are variables | ||
| 1200 | ;; ?' ?" ?` are ascii codes | ||
| 1201 | ("\\(^\\|[^\\\\]\\)\\(\\\\\\\\\\)*[?$]\\([#\"'`]\\)" 3 (1 . nil)) | ||
| 1202 | ;; regexps | ||
| 1203 | ("\\(^\\|[=(,~?:;<>]\\|\\(^\\|\\s \\)\\(if\\|elsif\\|unless\\|while\\|until\\|when\\|and\\|or\\|&&\\|||\\)\\|g?sub!?\\|scan\\|split!?\\)\\s *\\(/\\)[^/\n\\\\]*\\(\\\\.[^/\n\\\\]*\\)*\\(/\\)" | ||
| 1204 | (4 (7 . ?/)) | ||
| 1205 | (6 (7 . ?/))) | ||
| 1206 | ("^=en\\(d\\)\\_>" 1 "!") | ||
| 1207 | ("^\\(=\\)begin\\_>" 1 (ruby-comment-beg-syntax)) | ||
| 1208 | ;; Currently, the following case is highlighted incorrectly: | ||
| 1209 | ;; | ||
| 1210 | ;; <<FOO | ||
| 1211 | ;; FOO | ||
| 1212 | ;; <<BAR | ||
| 1213 | ;; <<BAZ | ||
| 1214 | ;; BAZ | ||
| 1215 | ;; BAR | ||
| 1216 | ;; | ||
| 1217 | ;; This is because all here-doc beginnings are highlighted before any endings, | ||
| 1218 | ;; so although <<BAR is properly marked as a beginning, when we get to <<BAZ | ||
| 1219 | ;; it thinks <<BAR is part of a string so it's marked as well. | ||
| 1220 | ;; | ||
| 1221 | ;; This may be fixable by modifying ruby-in-here-doc-p to use | ||
| 1222 | ;; ruby-in-non-here-doc-string-p rather than syntax-ppss-context, | ||
| 1223 | ;; but I don't want to try that until we've got unit tests set up | ||
| 1224 | ;; to make sure I don't break anything else. | ||
| 1225 | (,(concat ruby-here-doc-beg-re ".*\\(\n\\)") | ||
| 1226 | ,(+ 1 (regexp-opt-depth ruby-here-doc-beg-re)) | ||
| 1227 | (ruby-here-doc-beg-syntax)) | ||
| 1228 | (,ruby-here-doc-end-re 3 (ruby-here-doc-end-syntax))) | ||
| 1229 | "Syntactic keywords for Ruby mode. See `font-lock-syntactic-keywords'.") | ||
| 1230 | |||
| 1231 | (defun ruby-comment-beg-syntax () | ||
| 1232 | "Return the syntax cell for a the first character of a =begin. | ||
| 1178 | See the definition of `ruby-font-lock-syntactic-keywords'. | 1233 | See the definition of `ruby-font-lock-syntactic-keywords'. |
| 1179 | 1234 | ||
| 1180 | This returns a comment-delimiter cell as long as the =begin | 1235 | This returns a comment-delimiter cell as long as the =begin |
| 1181 | isn't in a string or another comment." | 1236 | isn't in a string or another comment." |
| 1182 | (when (not (nth 3 (syntax-ppss))) | 1237 | (when (not (nth 3 (syntax-ppss))) |
| 1183 | (string-to-syntax "!"))) | 1238 | (string-to-syntax "!"))) |
| 1239 | |||
| 1240 | (defun ruby-in-here-doc-p () | ||
| 1241 | "Return whether or not the point is in a heredoc." | ||
| 1242 | (save-excursion | ||
| 1243 | (let ((old-point (point)) (case-fold-search nil)) | ||
| 1244 | (beginning-of-line) | ||
| 1245 | (catch 'found-beg | ||
| 1246 | (while (re-search-backward ruby-here-doc-beg-re nil t) | ||
| 1247 | (if (not (or (ruby-in-ppss-context-p 'anything) | ||
| 1248 | (ruby-here-doc-find-end old-point))) | ||
| 1249 | (throw 'found-beg t))))))) | ||
| 1250 | |||
| 1251 | (defun ruby-here-doc-find-end (&optional limit) | ||
| 1252 | "Expects the point to be on a line with one or more heredoc openers. | ||
| 1253 | Returns the buffer position at which all heredocs on the line | ||
| 1254 | are terminated, or nil if they aren't terminated before the | ||
| 1255 | buffer position `limit' or the end of the buffer." | ||
| 1256 | (save-excursion | ||
| 1257 | (beginning-of-line) | ||
| 1258 | (catch 'done | ||
| 1259 | (let ((eol (save-excursion (end-of-line) (point))) | ||
| 1260 | (case-fold-search nil) | ||
| 1261 | ;; Fake match data such that (match-end 0) is at eol | ||
| 1262 | (end-match-data (progn (looking-at ".*$") (match-data))) | ||
| 1263 | beg-match-data end-re) | ||
| 1264 | (while (re-search-forward ruby-here-doc-beg-re eol t) | ||
| 1265 | (setq beg-match-data (match-data)) | ||
| 1266 | (setq end-re (ruby-here-doc-end-match)) | ||
| 1267 | |||
| 1268 | (set-match-data end-match-data) | ||
| 1269 | (goto-char (match-end 0)) | ||
| 1270 | (unless (re-search-forward end-re limit t) (throw 'done nil)) | ||
| 1271 | (setq end-match-data (match-data)) | ||
| 1272 | |||
| 1273 | (set-match-data beg-match-data) | ||
| 1274 | (goto-char (match-end 0))) | ||
| 1275 | (set-match-data end-match-data) | ||
| 1276 | (goto-char (match-end 0)) | ||
| 1277 | (point))))) | ||
| 1278 | |||
| 1279 | (defun ruby-here-doc-beg-syntax () | ||
| 1280 | "Return the syntax cell for a line that may begin a heredoc. | ||
| 1281 | See the definition of `ruby-font-lock-syntactic-keywords'. | ||
| 1282 | |||
| 1283 | This sets the syntax cell for the newline ending the line | ||
| 1284 | containing the heredoc beginning so that cases where multiple | ||
| 1285 | heredocs are started on one line are handled correctly." | ||
| 1286 | (save-excursion | ||
| 1287 | (goto-char (match-beginning 0)) | ||
| 1288 | (unless (or (ruby-in-ppss-context-p 'non-heredoc) | ||
| 1289 | (ruby-in-here-doc-p)) | ||
| 1290 | (string-to-syntax "\"")))) | ||
| 1291 | |||
| 1292 | (defun ruby-here-doc-end-syntax () | ||
| 1293 | "Return the syntax cell for a line that may end a heredoc. | ||
| 1294 | See the definition of `ruby-font-lock-syntactic-keywords'." | ||
| 1295 | (let ((pss (syntax-ppss)) (case-fold-search nil)) | ||
| 1296 | ;; If we aren't in a string, we definitely aren't ending a heredoc, | ||
| 1297 | ;; so we can just give up. | ||
| 1298 | ;; This means we aren't doing a full-document search | ||
| 1299 | ;; every time we enter a character. | ||
| 1300 | (when (ruby-in-ppss-context-p 'heredoc pss) | ||
| 1301 | (save-excursion | ||
| 1302 | (goto-char (nth 8 pss)) ; Go to the beginning of heredoc. | ||
| 1303 | (let ((eol (point))) | ||
| 1304 | (beginning-of-line) | ||
| 1305 | (if (and (re-search-forward (ruby-here-doc-beg-match) eol t) ; If there is a heredoc that matches this line... | ||
| 1306 | (not (ruby-in-ppss-context-p 'anything)) ; And that's not inside a heredoc/string/comment... | ||
| 1307 | (progn (goto-char (match-end 0)) ; And it's the last heredoc on its line... | ||
| 1308 | (not (re-search-forward ruby-here-doc-beg-re eol t)))) | ||
| 1309 | (string-to-syntax "\""))))))) | ||
| 1184 | 1310 | ||
| 1185 | (unless (functionp 'syntax-ppss) | 1311 | (unless (functionp 'syntax-ppss) |
| 1186 | (defun syntax-ppss (&optional pos) | 1312 | (defun syntax-ppss (&optional pos) |
| 1187 | (parse-partial-sexp (point-min) (or pos (point))))) | 1313 | (parse-partial-sexp (point-min) (or pos (point))))) |
| 1314 | ) | ||
| 1188 | 1315 | ||
| 1189 | (defun ruby-in-ppss-context-p (context &optional ppss) | 1316 | (defun ruby-in-ppss-context-p (context &optional ppss) |
| 1190 | (let ((ppss (or ppss (syntax-ppss (point))))) | 1317 | (let ((ppss (or ppss (syntax-ppss (point))))) |
| @@ -1195,10 +1322,7 @@ isn't in a string or another comment." | |||
| 1195 | ((eq context 'string) | 1322 | ((eq context 'string) |
| 1196 | (nth 3 ppss)) | 1323 | (nth 3 ppss)) |
| 1197 | ((eq context 'heredoc) | 1324 | ((eq context 'heredoc) |
| 1198 | (and (nth 3 ppss) | 1325 | (eq ?\n (nth 3 ppss))) |
| 1199 | ;; If it's generic string, it's a heredoc and we don't care | ||
| 1200 | ;; See `parse-partial-sexp' | ||
| 1201 | (not (numberp (nth 3 ppss))))) | ||
| 1202 | ((eq context 'non-heredoc) | 1326 | ((eq context 'non-heredoc) |
| 1203 | (and (ruby-in-ppss-context-p 'anything) | 1327 | (and (ruby-in-ppss-context-p 'anything) |
| 1204 | (not (ruby-in-ppss-context-p 'heredoc)))) | 1328 | (not (ruby-in-ppss-context-p 'heredoc)))) |
| @@ -1210,77 +1334,6 @@ isn't in a string or another comment." | |||
| 1210 | "context name `" (symbol-name context) "' is unknown")))) | 1334 | "context name `" (symbol-name context) "' is unknown")))) |
| 1211 | t))) | 1335 | t))) |
| 1212 | 1336 | ||
| 1213 | (defun ruby-in-here-doc-p () | ||
| 1214 | "Return whether or not the point is in a heredoc." | ||
| 1215 | (save-excursion | ||
| 1216 | (let ((old-point (point)) (case-fold-search nil)) | ||
| 1217 | (beginning-of-line) | ||
| 1218 | (catch 'found-beg | ||
| 1219 | (while (re-search-backward ruby-here-doc-beg-re nil t) | ||
| 1220 | (if (not (or (ruby-in-ppss-context-p 'anything) | ||
| 1221 | (ruby-here-doc-find-end old-point))) | ||
| 1222 | (throw 'found-beg t))))))) | ||
| 1223 | |||
| 1224 | (defun ruby-here-doc-find-end (&optional limit) | ||
| 1225 | "Expects the point to be on a line with one or more heredoc openers. | ||
| 1226 | Returns the buffer position at which all heredocs on the line | ||
| 1227 | are terminated, or nil if they aren't terminated before the | ||
| 1228 | buffer position `limit' or the end of the buffer." | ||
| 1229 | (save-excursion | ||
| 1230 | (beginning-of-line) | ||
| 1231 | (catch 'done | ||
| 1232 | (let ((eol (save-excursion (end-of-line) (point))) | ||
| 1233 | (case-fold-search nil) | ||
| 1234 | ;; Fake match data such that (match-end 0) is at eol | ||
| 1235 | (end-match-data (progn (looking-at ".*$") (match-data))) | ||
| 1236 | beg-match-data end-re) | ||
| 1237 | (while (re-search-forward ruby-here-doc-beg-re eol t) | ||
| 1238 | (setq beg-match-data (match-data)) | ||
| 1239 | (setq end-re (ruby-here-doc-end-match)) | ||
| 1240 | |||
| 1241 | (set-match-data end-match-data) | ||
| 1242 | (goto-char (match-end 0)) | ||
| 1243 | (unless (re-search-forward end-re limit t) (throw 'done nil)) | ||
| 1244 | (setq end-match-data (match-data)) | ||
| 1245 | |||
| 1246 | (set-match-data beg-match-data) | ||
| 1247 | (goto-char (match-end 0))) | ||
| 1248 | (set-match-data end-match-data) | ||
| 1249 | (goto-char (match-end 0)) | ||
| 1250 | (point))))) | ||
| 1251 | |||
| 1252 | (defun ruby-here-doc-beg-syntax () | ||
| 1253 | "Return the syntax cell for a line that may begin a heredoc. | ||
| 1254 | See the definition of `ruby-font-lock-syntactic-keywords'. | ||
| 1255 | |||
| 1256 | This sets the syntax cell for the newline ending the line | ||
| 1257 | containing the heredoc beginning so that cases where multiple | ||
| 1258 | heredocs are started on one line are handled correctly." | ||
| 1259 | (save-excursion | ||
| 1260 | (goto-char (match-beginning 0)) | ||
| 1261 | (unless (or (ruby-in-ppss-context-p 'non-heredoc) | ||
| 1262 | (ruby-in-here-doc-p)) | ||
| 1263 | (string-to-syntax "|")))) | ||
| 1264 | |||
| 1265 | (defun ruby-here-doc-end-syntax () | ||
| 1266 | "Return the syntax cell for a line that may end a heredoc. | ||
| 1267 | See the definition of `ruby-font-lock-syntactic-keywords'." | ||
| 1268 | (let ((pss (syntax-ppss)) (case-fold-search nil)) | ||
| 1269 | ;; If we aren't in a string, we definitely aren't ending a heredoc, | ||
| 1270 | ;; so we can just give up. | ||
| 1271 | ;; This means we aren't doing a full-document search | ||
| 1272 | ;; every time we enter a character. | ||
| 1273 | (when (ruby-in-ppss-context-p 'heredoc pss) | ||
| 1274 | (save-excursion | ||
| 1275 | (goto-char (nth 8 pss)) ; Go to the beginning of heredoc. | ||
| 1276 | (let ((eol (point))) | ||
| 1277 | (beginning-of-line) | ||
| 1278 | (if (and (re-search-forward (ruby-here-doc-beg-match) eol t) ; If there is a heredoc that matches this line... | ||
| 1279 | (not (ruby-in-ppss-context-p 'anything)) ; And that's not inside a heredoc/string/comment... | ||
| 1280 | (progn (goto-char (match-end 0)) ; And it's the last heredoc on its line... | ||
| 1281 | (not (re-search-forward ruby-here-doc-beg-re eol t)))) | ||
| 1282 | (string-to-syntax "|"))))))) | ||
| 1283 | |||
| 1284 | (if (featurep 'xemacs) | 1337 | (if (featurep 'xemacs) |
| 1285 | (put 'ruby-mode 'font-lock-defaults | 1338 | (put 'ruby-mode 'font-lock-defaults |
| 1286 | '((ruby-font-lock-keywords) | 1339 | '((ruby-font-lock-keywords) |
| @@ -1377,8 +1430,10 @@ See `font-lock-syntax-table'.") | |||
| 1377 | ) | 1430 | ) |
| 1378 | "Additional expressions to highlight in Ruby mode.") | 1431 | "Additional expressions to highlight in Ruby mode.") |
| 1379 | 1432 | ||
| 1433 | (defvar electric-indent-chars) | ||
| 1434 | |||
| 1380 | ;;;###autoload | 1435 | ;;;###autoload |
| 1381 | (defun ruby-mode () | 1436 | (define-derived-mode ruby-mode prog-mode "Ruby" |
| 1382 | "Major mode for editing Ruby scripts. | 1437 | "Major mode for editing Ruby scripts. |
| 1383 | \\[ruby-indent-line] properly indents subexpressions of multi-line | 1438 | \\[ruby-indent-line] properly indents subexpressions of multi-line |
| 1384 | class, module, def, if, while, for, do, and case statements, taking | 1439 | class, module, def, if, while, for, do, and case statements, taking |
| @@ -1387,27 +1442,22 @@ nesting into account. | |||
| 1387 | The variable `ruby-indent-level' controls the amount of indentation. | 1442 | The variable `ruby-indent-level' controls the amount of indentation. |
| 1388 | 1443 | ||
| 1389 | \\{ruby-mode-map}" | 1444 | \\{ruby-mode-map}" |
| 1390 | (interactive) | ||
| 1391 | (kill-all-local-variables) | ||
| 1392 | (use-local-map ruby-mode-map) | ||
| 1393 | (setq mode-name "Ruby") | ||
| 1394 | (setq major-mode 'ruby-mode) | ||
| 1395 | (ruby-mode-variables) | 1445 | (ruby-mode-variables) |
| 1396 | 1446 | ||
| 1397 | (set (make-local-variable 'indent-line-function) | ||
| 1398 | 'ruby-indent-line) | ||
| 1399 | (set (make-local-variable 'imenu-create-index-function) | 1447 | (set (make-local-variable 'imenu-create-index-function) |
| 1400 | 'ruby-imenu-create-index) | 1448 | 'ruby-imenu-create-index) |
| 1401 | (set (make-local-variable 'add-log-current-defun-function) | 1449 | (set (make-local-variable 'add-log-current-defun-function) |
| 1402 | 'ruby-add-log-current-method) | 1450 | 'ruby-add-log-current-method) |
| 1403 | 1451 | ||
| 1404 | (add-hook | 1452 | (add-hook |
| 1405 | (cond ((boundp 'before-save-hook) | 1453 | (cond ((boundp 'before-save-hook) 'before-save-hook) |
| 1406 | (make-local-variable 'before-save-hook) | ||
| 1407 | 'before-save-hook) | ||
| 1408 | ((boundp 'write-contents-functions) 'write-contents-functions) | 1454 | ((boundp 'write-contents-functions) 'write-contents-functions) |
| 1409 | ((boundp 'write-contents-hooks) 'write-contents-hooks)) | 1455 | ((boundp 'write-contents-hooks) 'write-contents-hooks)) |
| 1410 | 'ruby-mode-set-encoding) | 1456 | 'ruby-mode-set-encoding nil 'local) |
| 1457 | |||
| 1458 | (set (make-local-variable 'electric-indent-chars) | ||
| 1459 | (append '(?\{ ?\}) (if (boundp 'electric-indent-chars) | ||
| 1460 | (default-value 'electric-indent-chars)))) | ||
| 1411 | 1461 | ||
| 1412 | (set (make-local-variable 'font-lock-defaults) | 1462 | (set (make-local-variable 'font-lock-defaults) |
| 1413 | '((ruby-font-lock-keywords) nil nil)) | 1463 | '((ruby-font-lock-keywords) nil nil)) |
| @@ -1415,12 +1465,12 @@ The variable `ruby-indent-level' controls the amount of indentation. | |||
| 1415 | ruby-font-lock-keywords) | 1465 | ruby-font-lock-keywords) |
| 1416 | (set (make-local-variable 'font-lock-syntax-table) | 1466 | (set (make-local-variable 'font-lock-syntax-table) |
| 1417 | ruby-font-lock-syntax-table) | 1467 | ruby-font-lock-syntax-table) |
| 1418 | (set (make-local-variable 'font-lock-syntactic-keywords) | ||
| 1419 | ruby-font-lock-syntactic-keywords) | ||
| 1420 | 1468 | ||
| 1421 | (if (fboundp 'run-mode-hooks) | 1469 | (if (eval-when-compile (fboundp 'syntax-propertize-rules)) |
| 1422 | (run-mode-hooks 'ruby-mode-hook) | 1470 | (set (make-local-variable 'syntax-propertize-function) |
| 1423 | (run-hooks 'ruby-mode-hook))) | 1471 | #'ruby-syntax-propertize-function) |
| 1472 | (set (make-local-variable 'font-lock-syntactic-keywords) | ||
| 1473 | ruby-font-lock-syntactic-keywords))) | ||
| 1424 | 1474 | ||
| 1425 | ;;; Invoke ruby-mode when appropriate | 1475 | ;;; Invoke ruby-mode when appropriate |
| 1426 | 1476 | ||
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 9041bd50259..d41a81e38a6 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el | |||
| @@ -939,7 +939,6 @@ See `sh-feature'.") | |||
| 939 | ;; These are used for the syntax table stuff (derived from cperl-mode). | 939 | ;; These are used for the syntax table stuff (derived from cperl-mode). |
| 940 | ;; Note: parse-sexp-lookup-properties must be set to t for it to work. | 940 | ;; Note: parse-sexp-lookup-properties must be set to t for it to work. |
| 941 | (defconst sh-st-punc (string-to-syntax ".")) | 941 | (defconst sh-st-punc (string-to-syntax ".")) |
| 942 | (defconst sh-st-symbol (string-to-syntax "_")) | ||
| 943 | (defconst sh-here-doc-syntax (string-to-syntax "|")) ;; generic string | 942 | (defconst sh-here-doc-syntax (string-to-syntax "|")) ;; generic string |
| 944 | 943 | ||
| 945 | (defconst sh-escaped-line-re | 944 | (defconst sh-escaped-line-re |
| @@ -957,7 +956,7 @@ See `sh-feature'.") | |||
| 957 | (defvar sh-here-doc-re sh-here-doc-open-re) | 956 | (defvar sh-here-doc-re sh-here-doc-open-re) |
| 958 | (make-variable-buffer-local 'sh-here-doc-re) | 957 | (make-variable-buffer-local 'sh-here-doc-re) |
| 959 | 958 | ||
| 960 | (defun sh-font-lock-close-heredoc (bol eof indented) | 959 | (defun sh-font-lock-close-heredoc (bol eof indented eol) |
| 961 | "Determine the syntax of the \\n after an EOF. | 960 | "Determine the syntax of the \\n after an EOF. |
| 962 | If non-nil INDENTED indicates that the EOF was indented." | 961 | If non-nil INDENTED indicates that the EOF was indented." |
| 963 | (let* ((eof-re (if eof (regexp-quote eof) "")) | 962 | (let* ((eof-re (if eof (regexp-quote eof) "")) |
| @@ -971,6 +970,8 @@ If non-nil INDENTED indicates that the EOF was indented." | |||
| 971 | (ere (concat "^" (if indented "[ \t]*") eof-re "\n")) | 970 | (ere (concat "^" (if indented "[ \t]*") eof-re "\n")) |
| 972 | (start (save-excursion | 971 | (start (save-excursion |
| 973 | (goto-char bol) | 972 | (goto-char bol) |
| 973 | ;; FIXME: will incorrectly find a <<EOF embedded inside | ||
| 974 | ;; the heredoc. | ||
| 974 | (re-search-backward (concat sre "\\|" ere) nil t)))) | 975 | (re-search-backward (concat sre "\\|" ere) nil t)))) |
| 975 | ;; If subgroup 1 matched, we found an open-heredoc, otherwise we first | 976 | ;; If subgroup 1 matched, we found an open-heredoc, otherwise we first |
| 976 | ;; found a close-heredoc which makes the current close-heredoc inoperant. | 977 | ;; found a close-heredoc which makes the current close-heredoc inoperant. |
| @@ -990,7 +991,7 @@ If non-nil INDENTED indicates that the EOF was indented." | |||
| 990 | (sh-in-comment-or-string (point))))) | 991 | (sh-in-comment-or-string (point))))) |
| 991 | ;; No <<EOF2 found after our <<. | 992 | ;; No <<EOF2 found after our <<. |
| 992 | (= (point) start))) | 993 | (= (point) start))) |
| 993 | sh-here-doc-syntax) | 994 | (put-text-property eol (1+ eol) 'syntax-table sh-here-doc-syntax)) |
| 994 | ((not (or start (save-excursion (re-search-forward sre nil t)))) | 995 | ((not (or start (save-excursion (re-search-forward sre nil t)))) |
| 995 | ;; There's no <<EOF either before or after us, | 996 | ;; There's no <<EOF either before or after us, |
| 996 | ;; so we should remove ourselves from font-lock's keywords. | 997 | ;; so we should remove ourselves from font-lock's keywords. |
| @@ -1000,7 +1001,7 @@ If non-nil INDENTED indicates that the EOF was indented." | |||
| 1000 | (regexp-opt sh-here-doc-markers t) "\\(\n\\)")) | 1001 | (regexp-opt sh-here-doc-markers t) "\\(\n\\)")) |
| 1001 | nil)))) | 1002 | nil)))) |
| 1002 | 1003 | ||
| 1003 | (defun sh-font-lock-open-heredoc (start string) | 1004 | (defun sh-font-lock-open-heredoc (start string eol) |
| 1004 | "Determine the syntax of the \\n after a <<EOF. | 1005 | "Determine the syntax of the \\n after a <<EOF. |
| 1005 | START is the position of <<. | 1006 | START is the position of <<. |
| 1006 | STRING is the actual word used as delimiter (e.g. \"EOF\"). | 1007 | STRING is the actual word used as delimiter (e.g. \"EOF\"). |
| @@ -1030,13 +1031,8 @@ Point is at the beginning of the next line." | |||
| 1030 | ;; Don't bother fixing it now, but place a multiline property so | 1031 | ;; Don't bother fixing it now, but place a multiline property so |
| 1031 | ;; that when jit-lock-context-* refontifies the rest of the | 1032 | ;; that when jit-lock-context-* refontifies the rest of the |
| 1032 | ;; buffer, it also refontifies the current line with it. | 1033 | ;; buffer, it also refontifies the current line with it. |
| 1033 | (put-text-property start (point) 'font-lock-multiline t))) | 1034 | (put-text-property start (point) 'syntax-multiline t))) |
| 1034 | sh-here-doc-syntax)) | 1035 | (put-text-property eol (1+ eol) 'syntax-table sh-here-doc-syntax))) |
| 1035 | |||
| 1036 | (defun sh-font-lock-here-doc (limit) | ||
| 1037 | "Search for a heredoc marker." | ||
| 1038 | ;; This looks silly, but it's because `sh-here-doc-re' keeps changing. | ||
| 1039 | (re-search-forward sh-here-doc-re limit t)) | ||
| 1040 | 1036 | ||
| 1041 | (defun sh-font-lock-quoted-subshell (limit) | 1037 | (defun sh-font-lock-quoted-subshell (limit) |
| 1042 | "Search for a subshell embedded in a string. | 1038 | "Search for a subshell embedded in a string. |
| @@ -1045,9 +1041,7 @@ subshells can nest." | |||
| 1045 | ;; FIXME: This can (and often does) match multiple lines, yet it makes no | 1041 | ;; FIXME: This can (and often does) match multiple lines, yet it makes no |
| 1046 | ;; effort to handle multiline cases correctly, so it ends up being | 1042 | ;; effort to handle multiline cases correctly, so it ends up being |
| 1047 | ;; rather flakey. | 1043 | ;; rather flakey. |
| 1048 | (when (and (re-search-forward "\"\\(?:\\(?:.\\|\n\\)*?[^\\]\\(?:\\\\\\\\\\)*\\)??\\(\\$(\\|`\\)" limit t) | 1044 | (when (eq ?\" (nth 3 (syntax-ppss))) ; Check we matched an opening quote. |
| 1049 | ;; Make sure the " we matched is an opening quote. | ||
| 1050 | (eq ?\" (nth 3 (syntax-ppss)))) | ||
| 1051 | ;; bingo we have a $( or a ` inside a "" | 1045 | ;; bingo we have a $( or a ` inside a "" |
| 1052 | (let ((char (char-after (point))) | 1046 | (let ((char (char-after (point))) |
| 1053 | ;; `state' can be: double-quote, backquote, code. | 1047 | ;; `state' can be: double-quote, backquote, code. |
| @@ -1082,8 +1076,7 @@ subshells can nest." | |||
| 1082 | (double-quote nil) | 1076 | (double-quote nil) |
| 1083 | (t (setq state (pop states))))) | 1077 | (t (setq state (pop states))))) |
| 1084 | (t (error "Internal error in sh-font-lock-quoted-subshell"))) | 1078 | (t (error "Internal error in sh-font-lock-quoted-subshell"))) |
| 1085 | (forward-char 1))) | 1079 | (forward-char 1))))) |
| 1086 | t)) | ||
| 1087 | 1080 | ||
| 1088 | 1081 | ||
| 1089 | (defun sh-is-quoted-p (pos) | 1082 | (defun sh-is-quoted-p (pos) |
| @@ -1122,7 +1115,7 @@ subshells can nest." | |||
| 1122 | (when (progn (backward-char 2) | 1115 | (when (progn (backward-char 2) |
| 1123 | (if (> start (line-end-position)) | 1116 | (if (> start (line-end-position)) |
| 1124 | (put-text-property (point) (1+ start) | 1117 | (put-text-property (point) (1+ start) |
| 1125 | 'font-lock-multiline t)) | 1118 | 'syntax-multiline t)) |
| 1126 | ;; FIXME: The `in' may just be a random argument to | 1119 | ;; FIXME: The `in' may just be a random argument to |
| 1127 | ;; a normal command rather than the real `in' keyword. | 1120 | ;; a normal command rather than the real `in' keyword. |
| 1128 | ;; I.e. we should look back to try and find the | 1121 | ;; I.e. we should look back to try and find the |
| @@ -1136,40 +1129,44 @@ subshells can nest." | |||
| 1136 | sh-st-punc | 1129 | sh-st-punc |
| 1137 | nil)) | 1130 | nil)) |
| 1138 | 1131 | ||
| 1139 | (defun sh-font-lock-flush-syntax-ppss-cache (limit) | 1132 | (defun sh-syntax-propertize-function (start end) |
| 1140 | ;; This should probably be a standard function provided by font-lock.el | 1133 | (goto-char start) |
| 1141 | ;; (or syntax.el). | 1134 | (while (prog1 |
| 1142 | (syntax-ppss-flush-cache (point)) | 1135 | (re-search-forward sh-here-doc-re end 'move) |
| 1143 | (goto-char limit) | 1136 | (save-excursion |
| 1144 | nil) | 1137 | (save-match-data |
| 1145 | 1138 | (funcall | |
| 1146 | (defconst sh-font-lock-syntactic-keywords | 1139 | (syntax-propertize-rules |
| 1147 | ;; A `#' begins a comment when it is unquoted and at the beginning of a | 1140 | ;; A `#' begins a comment when it is unquoted and at the |
| 1148 | ;; word. In the shell, words are separated by metacharacters. | 1141 | ;; beginning of a word. In the shell, words are separated by |
| 1149 | ;; The list of special chars is taken from the single-unix spec | 1142 | ;; metacharacters. The list of special chars is taken from |
| 1150 | ;; of the shell command language (under `quoting') but with `$' removed. | 1143 | ;; the single-unix spec of the shell command language (under |
| 1151 | `(("[^|&;<>()`\\\"' \t\n]\\(#+\\)" 1 ,sh-st-symbol) | 1144 | ;; `quoting') but with `$' removed. |
| 1152 | ;; In a '...' the backslash is not escaping. | 1145 | ("[^|&;<>()`\\\"' \t\n]\\(#+\\)" (1 "_")) |
| 1153 | ("\\(\\\\\\)'" (1 (sh-font-lock-backslash-quote))) | 1146 | ;; In a '...' the backslash is not escaping. |
| 1154 | ;; The previous rule uses syntax-ppss, but the subsequent rules may | 1147 | ("\\(\\\\\\)'" (1 (sh-font-lock-backslash-quote))) |
| 1155 | ;; change the syntax, so we have to tell syntax-ppss that the states it | 1148 | ;; Make sure $@ and $? are correctly recognized as sexps. |
| 1156 | ;; has just computed will need to be recomputed. | 1149 | ("\\$\\([?@]\\)" (1 "_")) |
| 1157 | (sh-font-lock-flush-syntax-ppss-cache) | 1150 | ;; Distinguish the special close-paren in `case'. |
| 1158 | ;; Make sure $@ and $? are correctly recognized as sexps. | 1151 | (")" (0 (sh-font-lock-paren (match-beginning 0)))) |
| 1159 | ("\\$\\([?@]\\)" 1 ,sh-st-symbol) | 1152 | ;; Highlight (possibly nested) subshells inside "" quoted |
| 1160 | ;; Find HEREDOC starters and add a corresponding rule for the ender. | 1153 | ;; regions correctly. |
| 1161 | (sh-font-lock-here-doc | 1154 | ("\"\\(?:\\(?:.\\|\n\\)*?[^\\]\\(?:\\\\\\\\\\)*\\)??\\(\\$(\\|`\\)" |
| 1162 | (2 (sh-font-lock-open-heredoc | 1155 | (1 (ignore |
| 1163 | (match-beginning 0) (match-string 1)) nil t) | 1156 | ;; Save excursion because we want to also apply other |
| 1164 | (5 (sh-font-lock-close-heredoc | 1157 | ;; syntax-propertize rules within the affected region. |
| 1165 | (match-beginning 0) (match-string 4) | 1158 | (save-excursion |
| 1166 | (and (match-beginning 3) (/= (match-beginning 3) (match-end 3)))) | 1159 | (sh-font-lock-quoted-subshell end)))))) |
| 1167 | nil t)) | 1160 | (prog1 start (setq start (point))) (point))))) |
| 1168 | ;; Distinguish the special close-paren in `case'. | 1161 | (if (match-beginning 2) |
| 1169 | (")" 0 (sh-font-lock-paren (match-beginning 0))) | 1162 | ;; FIXME: actually, once we see an heredoc opener, we should just |
| 1170 | ;; highlight (possibly nested) subshells inside "" quoted regions correctly. | 1163 | ;; search for its ender without propertizing anything in it. |
| 1171 | ;; This should be at the very end because it uses syntax-ppss. | 1164 | (sh-font-lock-open-heredoc |
| 1172 | (sh-font-lock-quoted-subshell))) | 1165 | (match-beginning 0) (match-string 1) (match-beginning 2)) |
| 1166 | (sh-font-lock-close-heredoc | ||
| 1167 | (match-beginning 0) (match-string 4) | ||
| 1168 | (and (match-beginning 3) (/= (match-beginning 3) (match-end 3))) | ||
| 1169 | (match-beginning 5))))) | ||
| 1173 | 1170 | ||
| 1174 | (defun sh-font-lock-syntactic-face-function (state) | 1171 | (defun sh-font-lock-syntactic-face-function (state) |
| 1175 | (let ((q (nth 3 state))) | 1172 | (let ((q (nth 3 state))) |
| @@ -1553,9 +1550,12 @@ with your script for an edit-interpret-debug cycle." | |||
| 1553 | sh-font-lock-keywords-1 sh-font-lock-keywords-2) | 1550 | sh-font-lock-keywords-1 sh-font-lock-keywords-2) |
| 1554 | nil nil | 1551 | nil nil |
| 1555 | ((?/ . "w") (?~ . "w") (?. . "w") (?- . "w") (?_ . "w")) nil | 1552 | ((?/ . "w") (?~ . "w") (?. . "w") (?- . "w") (?_ . "w")) nil |
| 1556 | (font-lock-syntactic-keywords . sh-font-lock-syntactic-keywords) | ||
| 1557 | (font-lock-syntactic-face-function | 1553 | (font-lock-syntactic-face-function |
| 1558 | . sh-font-lock-syntactic-face-function))) | 1554 | . sh-font-lock-syntactic-face-function))) |
| 1555 | (set (make-local-variable 'syntax-propertize-function) | ||
| 1556 | #'sh-syntax-propertize-function) | ||
| 1557 | (add-hook 'syntax-propertize-extend-region-functions | ||
| 1558 | #'syntax-propertize-multiline 'append 'local) | ||
| 1559 | (set (make-local-variable 'skeleton-pair-alist) '((?` _ ?`))) | 1559 | (set (make-local-variable 'skeleton-pair-alist) '((?` _ ?`))) |
| 1560 | (set (make-local-variable 'skeleton-pair-filter-function) 'sh-quoted-p) | 1560 | (set (make-local-variable 'skeleton-pair-filter-function) 'sh-quoted-p) |
| 1561 | (set (make-local-variable 'skeleton-further-elements) | 1561 | (set (make-local-variable 'skeleton-further-elements) |
diff --git a/lisp/progmodes/simula.el b/lisp/progmodes/simula.el index f8d1a6aca97..34c50b6cfe5 100644 --- a/lisp/progmodes/simula.el +++ b/lisp/progmodes/simula.el | |||
| @@ -163,17 +163,18 @@ for SIMULA mode to function correctly." | |||
| 163 | (defvar simula-mode-syntax-table nil | 163 | (defvar simula-mode-syntax-table nil |
| 164 | "Syntax table in SIMULA mode buffers.") | 164 | "Syntax table in SIMULA mode buffers.") |
| 165 | 165 | ||
| 166 | (defconst simula-font-lock-syntactic-keywords | 166 | (defconst simula-syntax-propertize-function |
| 167 | `(;; `comment' directive. | 167 | (syntax-propertize-rules |
| 168 | ("\\<\\(c\\)omment\\>" 1 "<") | 168 | ;; `comment' directive. |
| 169 | ;; end comments | 169 | ("\\<\\(c\\)omment\\>" (1 "<")) |
| 170 | (,(concat "\\<end\\>\\([^;\n]\\).*?\\(\n\\|\\(.\\)\\(;\\|" | 170 | ;; end comments |
| 171 | (regexp-opt '("end" "else" "when" "otherwise")) | 171 | ((concat "\\<end\\>\\([^;\n]\\).*?\\(\n\\|\\(.\\)\\(;\\|" |
| 172 | "\\)\\)") | 172 | (regexp-opt '("end" "else" "when" "otherwise")) |
| 173 | (1 "< b") | 173 | "\\)\\)") |
| 174 | (3 "> b" nil t)) | 174 | (1 "< b") |
| 175 | ;; non-quoted single-quote char. | 175 | (3 "> b")) |
| 176 | ("'\\('\\)'" 1 "."))) | 176 | ;; non-quoted single-quote char. |
| 177 | ("'\\('\\)'" (1 ".")))) | ||
| 177 | 178 | ||
| 178 | ;; Regexps written with help from Alf-Ivar Holm <alfh@ifi.uio.no>. | 179 | ;; Regexps written with help from Alf-Ivar Holm <alfh@ifi.uio.no>. |
| 179 | (defconst simula-font-lock-keywords-1 | 180 | (defconst simula-font-lock-keywords-1 |
| @@ -396,8 +397,9 @@ with no arguments, if that value is non-nil." | |||
| 396 | (setq font-lock-defaults | 397 | (setq font-lock-defaults |
| 397 | '((simula-font-lock-keywords simula-font-lock-keywords-1 | 398 | '((simula-font-lock-keywords simula-font-lock-keywords-1 |
| 398 | simula-font-lock-keywords-2 simula-font-lock-keywords-3) | 399 | simula-font-lock-keywords-2 simula-font-lock-keywords-3) |
| 399 | nil t ((?_ . "w")) nil | 400 | nil t ((?_ . "w")))) |
| 400 | (font-lock-syntactic-keywords . simula-font-lock-syntactic-keywords))) | 401 | (set (make-local-variable 'syntax-propertize-function) |
| 402 | simula-syntax-propertize-function) | ||
| 401 | (abbrev-mode 1)) | 403 | (abbrev-mode 1)) |
| 402 | 404 | ||
| 403 | (defun simula-indent-exp () | 405 | (defun simula-indent-exp () |
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el index e44504688f2..a80a555c13f 100644 --- a/lisp/progmodes/sql.el +++ b/lisp/progmodes/sql.el | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | ;; Author: Alex Schroeder <alex@gnu.org> | 6 | ;; Author: Alex Schroeder <alex@gnu.org> |
| 7 | ;; Maintainer: Michael Mauger <mmaug@yahoo.com> | 7 | ;; Maintainer: Michael Mauger <mmaug@yahoo.com> |
| 8 | ;; Version: 2.5 | 8 | ;; Version: 2.6 |
| 9 | ;; Keywords: comm languages processes | 9 | ;; Keywords: comm languages processes |
| 10 | ;; URL: http://savannah.gnu.org/cgi-bin/viewcvs/emacs/emacs/lisp/progmodes/sql.el | 10 | ;; URL: http://savannah.gnu.org/cgi-bin/viewcvs/emacs/emacs/lisp/progmodes/sql.el |
| 11 | ;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?SqlMode | 11 | ;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?SqlMode |
| @@ -187,10 +187,10 @@ | |||
| 187 | 187 | ||
| 188 | ;; 6) Define a convienence function to invoke the SQL interpreter. | 188 | ;; 6) Define a convienence function to invoke the SQL interpreter. |
| 189 | 189 | ||
| 190 | ;; (defun my-sql-xyz () | 190 | ;; (defun my-sql-xyz (&optional buffer) |
| 191 | ;; "Run ixyz by XyzDB as an inferior process." | 191 | ;; "Run ixyz by XyzDB as an inferior process." |
| 192 | ;; (interactive) | 192 | ;; (interactive "P") |
| 193 | ;; (sql-product-interactive 'xyz)) | 193 | ;; (sql-product-interactive 'xyz buffer)) |
| 194 | 194 | ||
| 195 | ;;; To Do: | 195 | ;;; To Do: |
| 196 | 196 | ||
| @@ -275,8 +275,8 @@ Customizing your password will store it in your ~/.emacs file." | |||
| 275 | :group 'SQL | 275 | :group 'SQL |
| 276 | :safe 'stringp) | 276 | :safe 'stringp) |
| 277 | 277 | ||
| 278 | (defcustom sql-port nil | 278 | (defcustom sql-port 0 |
| 279 | "Default server or host." | 279 | "Default port." |
| 280 | :version "24.1" | 280 | :version "24.1" |
| 281 | :type 'number | 281 | :type 'number |
| 282 | :group 'SQL | 282 | :group 'SQL |
| @@ -430,9 +430,9 @@ Customizing your password will store it in your ~/.emacs file." | |||
| 430 | :sqli-comint-func sql-comint-postgres | 430 | :sqli-comint-func sql-comint-postgres |
| 431 | :prompt-regexp "^.*=[#>] " | 431 | :prompt-regexp "^.*=[#>] " |
| 432 | :prompt-length 5 | 432 | :prompt-length 5 |
| 433 | :prompt-cont-regexp "^.*-[#>] " | 433 | :prompt-cont-regexp "^.*[-(][#>] " |
| 434 | :input-filter sql-remove-tabs-filter | 434 | :input-filter sql-remove-tabs-filter |
| 435 | :terminator ("\\(^[\\]g\\|;\\)" . ";")) | 435 | :terminator ("\\(^\\s-*\\\\g\\|;\\)" . ";")) |
| 436 | 436 | ||
| 437 | (solid | 437 | (solid |
| 438 | :name "Solid" | 438 | :name "Solid" |
| @@ -551,7 +551,6 @@ settings.") | |||
| 551 | (defvar sql-indirect-features | 551 | (defvar sql-indirect-features |
| 552 | '(:font-lock :sqli-program :sqli-options :sqli-login)) | 552 | '(:font-lock :sqli-program :sqli-options :sqli-login)) |
| 553 | 553 | ||
| 554 | ;;;###autoload | ||
| 555 | (defcustom sql-connection-alist nil | 554 | (defcustom sql-connection-alist nil |
| 556 | "An alist of connection parameters for interacting with a SQL | 555 | "An alist of connection parameters for interacting with a SQL |
| 557 | product. | 556 | product. |
| @@ -600,7 +599,6 @@ prompted for during login." | |||
| 600 | :version "24.1" | 599 | :version "24.1" |
| 601 | :group 'SQL) | 600 | :group 'SQL) |
| 602 | 601 | ||
| 603 | ;;;###autoload | ||
| 604 | (defcustom sql-product 'ansi | 602 | (defcustom sql-product 'ansi |
| 605 | "Select the SQL database product used so that buffers can be | 603 | "Select the SQL database product used so that buffers can be |
| 606 | highlighted properly when you open them." | 604 | highlighted properly when you open them." |
| @@ -613,6 +611,7 @@ highlighted properly when you open them." | |||
| 613 | sql-product-alist)) | 611 | sql-product-alist)) |
| 614 | :group 'SQL | 612 | :group 'SQL |
| 615 | :safe 'symbolp) | 613 | :safe 'symbolp) |
| 614 | (defvaralias 'sql-dialect 'sql-product) | ||
| 616 | 615 | ||
| 617 | ;; misc customization of sql.el behaviour | 616 | ;; misc customization of sql.el behaviour |
| 618 | 617 | ||
| @@ -788,7 +787,9 @@ to be safe: | |||
| 788 | 787 | ||
| 789 | ;; Customization for SQLite | 788 | ;; Customization for SQLite |
| 790 | 789 | ||
| 791 | (defcustom sql-sqlite-program "sqlite3" | 790 | (defcustom sql-sqlite-program (or (executable-find "sqlite3") |
| 791 | (executable-find "sqlite") | ||
| 792 | "sqlite") | ||
| 792 | "Command to start SQLite. | 793 | "Command to start SQLite. |
| 793 | 794 | ||
| 794 | Starts `sql-interactive-mode' after doing some setup." | 795 | Starts `sql-interactive-mode' after doing some setup." |
| @@ -801,7 +802,7 @@ Starts `sql-interactive-mode' after doing some setup." | |||
| 801 | :version "20.8" | 802 | :version "20.8" |
| 802 | :group 'SQL) | 803 | :group 'SQL) |
| 803 | 804 | ||
| 804 | (defcustom sql-sqlite-login-params '((database :file ".*\\.db")) | 805 | (defcustom sql-sqlite-login-params '((database :file ".*\\.\\(db\\|sqlite[23]?\\)")) |
| 805 | "List of login parameters needed to connect to SQLite." | 806 | "List of login parameters needed to connect to SQLite." |
| 806 | :type 'sql-login-params | 807 | :type 'sql-login-params |
| 807 | :version "24.1" | 808 | :version "24.1" |
| @@ -1022,9 +1023,6 @@ Starts `sql-interactive-mode' after doing some setup." | |||
| 1022 | (defvar sql-server-history nil | 1023 | (defvar sql-server-history nil |
| 1023 | "History of servers used.") | 1024 | "History of servers used.") |
| 1024 | 1025 | ||
| 1025 | (defvar sql-port-history nil | ||
| 1026 | "History of ports used.") | ||
| 1027 | |||
| 1028 | ;; Passwords are not kept in a history. | 1026 | ;; Passwords are not kept in a history. |
| 1029 | 1027 | ||
| 1030 | (defvar sql-buffer nil | 1028 | (defvar sql-buffer nil |
| @@ -1054,6 +1052,12 @@ You can change `sql-prompt-length' on `sql-interactive-mode-hook'.") | |||
| 1054 | 1052 | ||
| 1055 | Used by `sql-rename-buffer'.") | 1053 | Used by `sql-rename-buffer'.") |
| 1056 | 1054 | ||
| 1055 | (defun sql-buffer-live-p (buffer) | ||
| 1056 | "Returns non-nil if the process associated with buffer is live." | ||
| 1057 | (and buffer | ||
| 1058 | (buffer-live-p (get-buffer buffer)) | ||
| 1059 | (get-buffer-process buffer))) | ||
| 1060 | |||
| 1057 | ;; Keymap for sql-interactive-mode. | 1061 | ;; Keymap for sql-interactive-mode. |
| 1058 | 1062 | ||
| 1059 | (defvar sql-interactive-mode-map | 1063 | (defvar sql-interactive-mode-map |
| @@ -1091,15 +1095,11 @@ Based on `comint-mode-map'.") | |||
| 1091 | sql-mode-menu sql-mode-map | 1095 | sql-mode-menu sql-mode-map |
| 1092 | "Menu for `sql-mode'." | 1096 | "Menu for `sql-mode'." |
| 1093 | `("SQL" | 1097 | `("SQL" |
| 1094 | ["Send Paragraph" sql-send-paragraph (and (buffer-live-p sql-buffer) | 1098 | ["Send Paragraph" sql-send-paragraph (sql-buffer-live-p sql-buffer)] |
| 1095 | (get-buffer-process sql-buffer))] | ||
| 1096 | ["Send Region" sql-send-region (and mark-active | 1099 | ["Send Region" sql-send-region (and mark-active |
| 1097 | (buffer-live-p sql-buffer) | 1100 | (sql-buffer-live-p sql-buffer))] |
| 1098 | (get-buffer-process sql-buffer))] | 1101 | ["Send Buffer" sql-send-buffer (sql-buffer-live-p sql-buffer)] |
| 1099 | ["Send Buffer" sql-send-buffer (and (buffer-live-p sql-buffer) | 1102 | ["Send String" sql-send-string (sql-buffer-live-p sql-buffer)] |
| 1100 | (get-buffer-process sql-buffer))] | ||
| 1101 | ["Send String" sql-send-string (and (buffer-live-p sql-buffer) | ||
| 1102 | (get-buffer-process sql-buffer))] | ||
| 1103 | "--" | 1103 | "--" |
| 1104 | ["Start SQLi session" sql-product-interactive | 1104 | ["Start SQLi session" sql-product-interactive |
| 1105 | :visible (not sql-connection-alist) | 1105 | :visible (not sql-connection-alist) |
| @@ -1364,7 +1364,7 @@ to add functions and PL/SQL keywords.") | |||
| 1364 | ;; Oracle SQL*Plus Commands | 1364 | ;; Oracle SQL*Plus Commands |
| 1365 | (cons | 1365 | (cons |
| 1366 | (concat | 1366 | (concat |
| 1367 | "^\\(?:\\(?:" (regexp-opt '( | 1367 | "^\\s-*\\(?:\\(?:" (regexp-opt '( |
| 1368 | "@" "@@" "accept" "append" "archive" "attribute" "break" | 1368 | "@" "@@" "accept" "append" "archive" "attribute" "break" |
| 1369 | "btitle" "change" "clear" "column" "connect" "copy" "define" | 1369 | "btitle" "change" "clear" "column" "connect" "copy" "define" |
| 1370 | "del" "describe" "disconnect" "edit" "execute" "exit" "get" "help" | 1370 | "del" "describe" "disconnect" "edit" "execute" "exit" "get" "help" |
| @@ -1403,7 +1403,7 @@ to add functions and PL/SQL keywords.") | |||
| 1403 | "\\)\\b.*" | 1403 | "\\)\\b.*" |
| 1404 | ) | 1404 | ) |
| 1405 | 'font-lock-doc-face) | 1405 | 'font-lock-doc-face) |
| 1406 | '("^[ \t]*rem\\(?:ark\\)?.*" . font-lock-comment-face) | 1406 | '("^\\s-*rem\\(?:ark\\)?\\>.*" . font-lock-comment-face) |
| 1407 | 1407 | ||
| 1408 | ;; Oracle Functions | 1408 | ;; Oracle Functions |
| 1409 | (sql-font-lock-keywords-builder 'font-lock-builtin-face nil | 1409 | (sql-font-lock-keywords-builder 'font-lock-builtin-face nil |
| @@ -1585,81 +1585,153 @@ to add functions and PL/SQL keywords.") | |||
| 1585 | (defvar sql-mode-postgres-font-lock-keywords | 1585 | (defvar sql-mode-postgres-font-lock-keywords |
| 1586 | (eval-when-compile | 1586 | (eval-when-compile |
| 1587 | (list | 1587 | (list |
| 1588 | ;; Postgres Functions | 1588 | ;; Postgres psql commands |
| 1589 | '("^\\s-*\\\\.*$" . font-lock-doc-face) | ||
| 1590 | |||
| 1591 | ;; Postgres unreserved words but may have meaning | ||
| 1592 | (sql-font-lock-keywords-builder 'font-lock-builtin-face nil "a" | ||
| 1593 | "abs" "absent" "according" "ada" "alias" "allocate" "are" "array_agg" | ||
| 1594 | "asensitive" "atomic" "attribute" "attributes" "avg" "base64" | ||
| 1595 | "bernoulli" "bit_length" "bitvar" "blob" "blocked" "bom" "breadth" "c" | ||
| 1596 | "call" "cardinality" "catalog_name" "ceil" "ceiling" "char_length" | ||
| 1597 | "character_length" "character_set_catalog" "character_set_name" | ||
| 1598 | "character_set_schema" "characters" "checked" "class_origin" "clob" | ||
| 1599 | "cobol" "collation" "collation_catalog" "collation_name" | ||
| 1600 | "collation_schema" "collect" "column_name" "columns" | ||
| 1601 | "command_function" "command_function_code" "completion" "condition" | ||
| 1602 | "condition_number" "connect" "connection_name" "constraint_catalog" | ||
| 1603 | "constraint_name" "constraint_schema" "constructor" "contains" | ||
| 1604 | "control" "convert" "corr" "corresponding" "count" "covar_pop" | ||
| 1605 | "covar_samp" "cube" "cume_dist" "current_default_transform_group" | ||
| 1606 | "current_path" "current_transform_group_for_type" "cursor_name" | ||
| 1607 | "datalink" "datetime_interval_code" "datetime_interval_precision" "db" | ||
| 1608 | "defined" "degree" "dense_rank" "depth" "deref" "derived" "describe" | ||
| 1609 | "descriptor" "destroy" "destructor" "deterministic" "diagnostics" | ||
| 1610 | "disconnect" "dispatch" "dlnewcopy" "dlpreviouscopy" "dlurlcomplete" | ||
| 1611 | "dlurlcompleteonly" "dlurlcompletewrite" "dlurlpath" "dlurlpathonly" | ||
| 1612 | "dlurlpathwrite" "dlurlscheme" "dlurlserver" "dlvalue" "dynamic" | ||
| 1613 | "dynamic_function" "dynamic_function_code" "element" "empty" | ||
| 1614 | "end-exec" "equals" "every" "exception" "exec" "existing" "exp" "file" | ||
| 1615 | "filter" "final" "first_value" "flag" "floor" "fortran" "found" "free" | ||
| 1616 | "fs" "fusion" "g" "general" "generated" "get" "go" "goto" "grouping" | ||
| 1617 | "hex" "hierarchy" "host" "id" "ignore" "implementation" "import" | ||
| 1618 | "indent" "indicator" "infix" "initialize" "instance" "instantiable" | ||
| 1619 | "integrity" "intersection" "iterate" "k" "key_member" "key_type" "lag" | ||
| 1620 | "last_value" "lateral" "lead" "length" "less" "library" "like_regex" | ||
| 1621 | "link" "ln" "locator" "lower" "m" "map" "matched" "max" | ||
| 1622 | "max_cardinality" "member" "merge" "message_length" | ||
| 1623 | "message_octet_length" "message_text" "method" "min" "mod" "modifies" | ||
| 1624 | "modify" "module" "more" "multiset" "mumps" "namespace" "nclob" | ||
| 1625 | "nesting" "new" "nfc" "nfd" "nfkc" "nfkd" "nil" "normalize" | ||
| 1626 | "normalized" "nth_value" "ntile" "nullable" "number" | ||
| 1627 | "occurrences_regex" "octet_length" "octets" "old" "open" "operation" | ||
| 1628 | "ordering" "ordinality" "others" "output" "overriding" "p" "pad" | ||
| 1629 | "parameter" "parameter_mode" "parameter_name" | ||
| 1630 | "parameter_ordinal_position" "parameter_specific_catalog" | ||
| 1631 | "parameter_specific_name" "parameter_specific_schema" "parameters" | ||
| 1632 | "pascal" "passing" "passthrough" "percent_rank" "percentile_cont" | ||
| 1633 | "percentile_disc" "permission" "pli" "position_regex" "postfix" | ||
| 1634 | "power" "prefix" "preorder" "public" "rank" "reads" "recovery" "ref" | ||
| 1635 | "referencing" "regr_avgx" "regr_avgy" "regr_count" "regr_intercept" | ||
| 1636 | "regr_r2" "regr_slope" "regr_sxx" "regr_sxy" "regr_syy" "requiring" | ||
| 1637 | "respect" "restore" "result" "return" "returned_cardinality" | ||
| 1638 | "returned_length" "returned_octet_length" "returned_sqlstate" "rollup" | ||
| 1639 | "routine" "routine_catalog" "routine_name" "routine_schema" | ||
| 1640 | "row_count" "row_number" "scale" "schema_name" "scope" "scope_catalog" | ||
| 1641 | "scope_name" "scope_schema" "section" "selective" "self" "sensitive" | ||
| 1642 | "server_name" "sets" "size" "source" "space" "specific" | ||
| 1643 | "specific_name" "specifictype" "sql" "sqlcode" "sqlerror" | ||
| 1644 | "sqlexception" "sqlstate" "sqlwarning" "sqrt" "state" "static" | ||
| 1645 | "stddev_pop" "stddev_samp" "structure" "style" "subclass_origin" | ||
| 1646 | "sublist" "submultiset" "substring_regex" "sum" "system_user" "t" | ||
| 1647 | "table_name" "tablesample" "terminate" "than" "ties" "timezone_hour" | ||
| 1648 | "timezone_minute" "token" "top_level_count" "transaction_active" | ||
| 1649 | "transactions_committed" "transactions_rolled_back" "transform" | ||
| 1650 | "transforms" "translate" "translate_regex" "translation" | ||
| 1651 | "trigger_catalog" "trigger_name" "trigger_schema" "trim_array" | ||
| 1652 | "uescape" "under" "unlink" "unnamed" "unnest" "untyped" "upper" "uri" | ||
| 1653 | "usage" "user_defined_type_catalog" "user_defined_type_code" | ||
| 1654 | "user_defined_type_name" "user_defined_type_schema" "var_pop" | ||
| 1655 | "var_samp" "varbinary" "variable" "whenever" "width_bucket" "within" | ||
| 1656 | "xmlagg" "xmlbinary" "xmlcast" "xmlcomment" "xmldeclaration" | ||
| 1657 | "xmldocument" "xmlexists" "xmliterate" "xmlnamespaces" "xmlquery" | ||
| 1658 | "xmlschema" "xmltable" "xmltext" "xmlvalidate" | ||
| 1659 | ) | ||
| 1660 | |||
| 1661 | ;; Postgres non-reserved words | ||
| 1589 | (sql-font-lock-keywords-builder 'font-lock-builtin-face nil | 1662 | (sql-font-lock-keywords-builder 'font-lock-builtin-face nil |
| 1590 | "abbrev" "abs" "acos" "age" "area" "ascii" "asin" "atab2" "atan" | 1663 | "abort" "absolute" "access" "action" "add" "admin" "after" "aggregate" |
| 1591 | "atan2" "avg" "bit_length" "both" "broadcast" "btrim" "cbrt" "ceil" | 1664 | "also" "alter" "always" "assertion" "assignment" "at" "backward" |
| 1592 | "center" "char_length" "chr" "coalesce" "col_description" "convert" | 1665 | "before" "begin" "between" "by" "cache" "called" "cascade" "cascaded" |
| 1593 | "cos" "cot" "count" "current_database" "current_date" "current_schema" | 1666 | "catalog" "chain" "characteristics" "checkpoint" "class" "close" |
| 1594 | "current_schemas" "current_setting" "current_time" "current_timestamp" | 1667 | "cluster" "coalesce" "comment" "comments" "commit" "committed" |
| 1595 | "current_user" "currval" "date_part" "date_trunc" "decode" "degrees" | 1668 | "configuration" "connection" "constraints" "content" "continue" |
| 1596 | "diameter" "encode" "exp" "extract" "floor" "get_bit" "get_byte" | 1669 | "conversion" "copy" "cost" "createdb" "createrole" "createuser" "csv" |
| 1597 | "has_database_privilege" "has_function_privilege" | 1670 | "current" "cursor" "cycle" "data" "database" "day" "deallocate" "dec" |
| 1598 | "has_language_privilege" "has_schema_privilege" "has_table_privilege" | 1671 | "declare" "defaults" "deferred" "definer" "delete" "delimiter" |
| 1599 | "height" "host" "initcap" "isclosed" "isfinite" "isopen" "leading" | 1672 | "delimiters" "dictionary" "disable" "discard" "document" "domain" |
| 1600 | "length" "ln" "localtime" "localtimestamp" "log" "lower" "lpad" | 1673 | "drop" "each" "enable" "encoding" "encrypted" "enum" "escape" |
| 1601 | "ltrim" "masklen" "max" "min" "mod" "netmask" "network" "nextval" | 1674 | "exclude" "excluding" "exclusive" "execute" "exists" "explain" |
| 1602 | "now" "npoints" "nullif" "obj_description" "octet_length" "overlay" | 1675 | "external" "extract" "family" "first" "float" "following" "force" |
| 1603 | "pclose" "pg_client_encoding" "pg_function_is_visible" | 1676 | "forward" "function" "functions" "global" "granted" "greatest" |
| 1604 | "pg_get_constraintdef" "pg_get_indexdef" "pg_get_ruledef" | 1677 | "handler" "header" "hold" "hour" "identity" "if" "immediate" |
| 1605 | "pg_get_userbyid" "pg_get_viewdef" "pg_opclass_is_visible" | 1678 | "immutable" "implicit" "including" "increment" "index" "indexes" |
| 1606 | "pg_operator_is_visible" "pg_table_is_visible" "pg_type_is_visible" | 1679 | "inherit" "inherits" "inline" "inout" "input" "insensitive" "insert" |
| 1607 | "pi" "popen" "position" "pow" "quote_ident" "quote_literal" "radians" | 1680 | "instead" "invoker" "isolation" "key" "language" "large" "last" |
| 1608 | "radius" "random" "repeat" "replace" "round" "rpad" "rtrim" | 1681 | "lc_collate" "lc_ctype" "least" "level" "listen" "load" "local" |
| 1609 | "session_user" "set_bit" "set_byte" "set_config" "set_masklen" | 1682 | "location" "lock" "login" "mapping" "match" "maxvalue" "minute" |
| 1610 | "setval" "sign" "sin" "split_part" "sqrt" "stddev" "strpos" "substr" | 1683 | "minvalue" "mode" "month" "move" "name" "names" "national" "nchar" |
| 1611 | "substring" "sum" "tan" "timeofday" "to_ascii" "to_char" "to_date" | 1684 | "next" "no" "nocreatedb" "nocreaterole" "nocreateuser" "noinherit" |
| 1612 | "to_hex" "to_number" "to_timestamp" "trailing" "translate" "trim" | 1685 | "nologin" "none" "nosuperuser" "nothing" "notify" "nowait" "nullif" |
| 1613 | "trunc" "upper" "variance" "version" "width" | 1686 | "nulls" "object" "of" "oids" "operator" "option" "options" "out" |
| 1687 | "overlay" "owned" "owner" "parser" "partial" "partition" "password" | ||
| 1688 | "plans" "position" "preceding" "prepare" "prepared" "preserve" "prior" | ||
| 1689 | "privileges" "procedural" "procedure" "quote" "range" "read" | ||
| 1690 | "reassign" "recheck" "recursive" "reindex" "relative" "release" | ||
| 1691 | "rename" "repeatable" "replace" "replica" "reset" "restart" "restrict" | ||
| 1692 | "returns" "revoke" "role" "rollback" "row" "rows" "rule" "savepoint" | ||
| 1693 | "schema" "scroll" "search" "second" "security" "sequence" "sequences" | ||
| 1694 | "serializable" "server" "session" "set" "setof" "share" "show" | ||
| 1695 | "simple" "stable" "standalone" "start" "statement" "statistics" | ||
| 1696 | "stdin" "stdout" "storage" "strict" "strip" "substring" "superuser" | ||
| 1697 | "sysid" "system" "tables" "tablespace" "temp" "template" "temporary" | ||
| 1698 | "transaction" "treat" "trigger" "trim" "truncate" "trusted" "type" | ||
| 1699 | "unbounded" "uncommitted" "unencrypted" "unknown" "unlisten" "until" | ||
| 1700 | "update" "vacuum" "valid" "validator" "value" "values" "version" | ||
| 1701 | "view" "volatile" "whitespace" "work" "wrapper" "write" | ||
| 1702 | "xmlattributes" "xmlconcat" "xmlelement" "xmlforest" "xmlparse" | ||
| 1703 | "xmlpi" "xmlroot" "xmlserialize" "year" "yes" | ||
| 1614 | ) | 1704 | ) |
| 1705 | |||
| 1615 | ;; Postgres Reserved | 1706 | ;; Postgres Reserved |
| 1616 | (sql-font-lock-keywords-builder 'font-lock-keyword-face nil | 1707 | (sql-font-lock-keywords-builder 'font-lock-keyword-face nil |
| 1617 | "abort" "access" "add" "after" "aggregate" "alignment" "all" "alter" | 1708 | "all" "analyse" "analyze" "and" "any" "array" "asc" "as" "asymmetric" |
| 1618 | "analyze" "and" "any" "as" "asc" "assignment" "authorization" | 1709 | "authorization" "binary" "both" "case" "cast" "check" "collate" |
| 1619 | "backward" "basetype" "before" "begin" "between" "binary" "by" "cache" | 1710 | "column" "concurrently" "constraint" "create" "cross" |
| 1620 | "called" "cascade" "case" "cast" "characteristics" "check" | 1711 | "current_catalog" "current_date" "current_role" "current_schema" |
| 1621 | "checkpoint" "class" "close" "cluster" "column" "comment" "commit" | 1712 | "current_time" "current_timestamp" "current_user" "default" |
| 1622 | "committed" "commutator" "constraint" "constraints" "conversion" | 1713 | "deferrable" "desc" "distinct" "do" "else" "end" "except" "false" |
| 1623 | "copy" "create" "createdb" "createuser" "cursor" "cycle" "database" | 1714 | "fetch" "foreign" "for" "freeze" "from" "full" "grant" "group" |
| 1624 | "deallocate" "declare" "default" "deferrable" "deferred" "definer" | 1715 | "having" "ilike" "initially" "inner" "in" "intersect" "into" "isnull" |
| 1625 | "delete" "delimiter" "desc" "distinct" "do" "domain" "drop" "each" | 1716 | "is" "join" "leading" "left" "like" "limit" "localtime" |
| 1626 | "element" "else" "encoding" "encrypted" "end" "escape" "except" | 1717 | "localtimestamp" "natural" "notnull" "not" "null" "off" "offset" |
| 1627 | "exclusive" "execute" "exists" "explain" "extended" "external" "false" | 1718 | "only" "on" "order" "or" "outer" "overlaps" "over" "placing" "primary" |
| 1628 | "fetch" "finalfunc" "for" "force" "foreign" "forward" "freeze" "from" | 1719 | "references" "returning" "right" "select" "session_user" "similar" |
| 1629 | "full" "function" "grant" "group" "gtcmp" "handler" "hashes" "having" | 1720 | "some" "symmetric" "table" "then" "to" "trailing" "true" "union" |
| 1630 | "immediate" "immutable" "implicit" "in" "increment" "index" "inherits" | 1721 | "unique" "user" "using" "variadic" "verbose" "when" "where" "window" |
| 1631 | "initcond" "initially" "input" "insensitive" "insert" "instead" | 1722 | "with" |
| 1632 | "internallength" "intersect" "into" "invoker" "is" "isnull" | ||
| 1633 | "isolation" "join" "key" "language" "leftarg" "level" "like" "limit" | ||
| 1634 | "listen" "load" "local" "location" "lock" "ltcmp" "main" "match" | ||
| 1635 | "maxvalue" "merges" "minvalue" "mode" "move" "natural" "negator" | ||
| 1636 | "next" "nocreatedb" "nocreateuser" "none" "not" "nothing" "notify" | ||
| 1637 | "notnull" "null" "of" "offset" "oids" "on" "only" "operator" "or" | ||
| 1638 | "order" "output" "owner" "partial" "passedbyvalue" "password" "plain" | ||
| 1639 | "prepare" "primary" "prior" "privileges" "procedural" "procedure" | ||
| 1640 | "public" "read" "recheck" "references" "reindex" "relative" "rename" | ||
| 1641 | "reset" "restrict" "returns" "revoke" "rightarg" "rollback" "row" | ||
| 1642 | "rule" "schema" "scroll" "security" "select" "sequence" "serializable" | ||
| 1643 | "session" "set" "sfunc" "share" "show" "similar" "some" "sort1" | ||
| 1644 | "sort2" "stable" "start" "statement" "statistics" "storage" "strict" | ||
| 1645 | "stype" "sysid" "table" "temp" "template" "temporary" "then" "to" | ||
| 1646 | "transaction" "trigger" "true" "truncate" "trusted" "type" | ||
| 1647 | "unencrypted" "union" "unique" "unknown" "unlisten" "until" "update" | ||
| 1648 | "usage" "user" "using" "vacuum" "valid" "validator" "values" | ||
| 1649 | "variable" "verbose" "view" "volatile" "when" "where" "with" "without" | ||
| 1650 | "work" | ||
| 1651 | ) | 1723 | ) |
| 1652 | 1724 | ||
| 1653 | ;; Postgres Data Types | 1725 | ;; Postgres Data Types |
| 1654 | (sql-font-lock-keywords-builder 'font-lock-type-face nil | 1726 | (sql-font-lock-keywords-builder 'font-lock-type-face nil |
| 1655 | "anyarray" "bigint" "bigserial" "bit" "boolean" "box" "bytea" "char" | 1727 | "bigint" "bigserial" "bit" "bool" "boolean" "box" "bytea" "char" |
| 1656 | "character" "cidr" "circle" "cstring" "date" "decimal" "double" | 1728 | "character" "cidr" "circle" "date" "decimal" "double" "float4" |
| 1657 | "float4" "float8" "inet" "int2" "int4" "int8" "integer" "internal" | 1729 | "float8" "inet" "int" "int2" "int4" "int8" "integer" "interval" "line" |
| 1658 | "interval" "language_handler" "line" "lseg" "macaddr" "money" | 1730 | "lseg" "macaddr" "money" "numeric" "path" "point" "polygon" |
| 1659 | "numeric" "oid" "opaque" "path" "point" "polygon" "precision" "real" | 1731 | "precision" "real" "serial" "serial4" "serial8" "smallint" "text" |
| 1660 | "record" "regclass" "regoper" "regoperator" "regproc" "regprocedure" | 1732 | "time" "timestamp" "timestamptz" "timetz" "tsquery" "tsvector" |
| 1661 | "regtype" "serial" "serial4" "serial8" "smallint" "text" "time" | 1733 | "txid_snapshot" "uuid" "varbit" "varchar" "varying" "without" |
| 1662 | "timestamp" "varchar" "varying" "void" "zone" | 1734 | "xml" "zone" |
| 1663 | ))) | 1735 | ))) |
| 1664 | 1736 | ||
| 1665 | "Postgres SQL keywords used by font-lock. | 1737 | "Postgres SQL keywords used by font-lock. |
| @@ -1979,6 +2051,9 @@ you define your own `sql-mode-mysql-font-lock-keywords'.") | |||
| 1979 | (defvar sql-mode-sqlite-font-lock-keywords | 2051 | (defvar sql-mode-sqlite-font-lock-keywords |
| 1980 | (eval-when-compile | 2052 | (eval-when-compile |
| 1981 | (list | 2053 | (list |
| 2054 | ;; SQLite commands | ||
| 2055 | '("^[.].*$" . font-lock-doc-face) | ||
| 2056 | |||
| 1982 | ;; SQLite Keyword | 2057 | ;; SQLite Keyword |
| 1983 | (sql-font-lock-keywords-builder 'font-lock-keyword-face nil | 2058 | (sql-font-lock-keywords-builder 'font-lock-keyword-face nil |
| 1984 | "abort" "action" "add" "after" "all" "alter" "analyze" "and" "as" | 2059 | "abort" "action" "add" "after" "all" "alter" "analyze" "and" "as" |
| @@ -2493,16 +2568,18 @@ function like this: (sql-get-login 'user 'password 'database)." | |||
| 2493 | 2568 | ||
| 2494 | ((eq token 'port) ; port | 2569 | ((eq token 'port) ; port |
| 2495 | (setq sql-port | 2570 | (setq sql-port |
| 2496 | (read-number "Port: " sql-port)))))) | 2571 | (read-number "Port: " (if (numberp sql-port) |
| 2497 | what)) | 2572 | sql-port |
| 2573 | 0))))))) | ||
| 2574 | what)) | ||
| 2498 | 2575 | ||
| 2499 | (defun sql-find-sqli-buffer () | 2576 | (defun sql-find-sqli-buffer () |
| 2500 | "Returns the current default SQLi buffer or nil. | 2577 | "Returns the name of the current default SQLi buffer or nil. |
| 2501 | In order to qualify, the SQLi buffer must be alive, | 2578 | In order to qualify, the SQLi buffer must be alive, be in |
| 2502 | be in `sql-interactive-mode' and have a process." | 2579 | `sql-interactive-mode' and have a process." |
| 2503 | (let ((default-buffer (default-value 'sql-buffer))) | 2580 | (let ((default-buffer (default-value 'sql-buffer)) |
| 2504 | (if (and (buffer-live-p default-buffer) | 2581 | (current-product sql-product)) |
| 2505 | (get-buffer-process default-buffer)) | 2582 | (if (sql-buffer-live-p default-buffer) |
| 2506 | default-buffer | 2583 | default-buffer |
| 2507 | (save-current-buffer | 2584 | (save-current-buffer |
| 2508 | (let ((buflist (buffer-list)) | 2585 | (let ((buflist (buffer-list)) |
| @@ -2511,9 +2588,10 @@ be in `sql-interactive-mode' and have a process." | |||
| 2511 | found)) | 2588 | found)) |
| 2512 | (let ((candidate (car buflist))) | 2589 | (let ((candidate (car buflist))) |
| 2513 | (set-buffer candidate) | 2590 | (set-buffer candidate) |
| 2514 | (if (and (derived-mode-p 'sql-interactive-mode) | 2591 | (if (and (sql-buffer-live-p candidate) |
| 2515 | (get-buffer-process candidate)) | 2592 | (derived-mode-p 'sql-interactive-mode) |
| 2516 | (setq found candidate)) | 2593 | (eq sql-product current-product)) |
| 2594 | (setq found (buffer-name candidate))) | ||
| 2517 | (setq buflist (cdr buflist)))) | 2595 | (setq buflist (cdr buflist)))) |
| 2518 | found))))) | 2596 | found))))) |
| 2519 | 2597 | ||
| @@ -2527,15 +2605,15 @@ using `sql-find-sqli-buffer'. If `sql-buffer' is set, | |||
| 2527 | (interactive) | 2605 | (interactive) |
| 2528 | (save-excursion | 2606 | (save-excursion |
| 2529 | (let ((buflist (buffer-list)) | 2607 | (let ((buflist (buffer-list)) |
| 2530 | (default-sqli-buffer (sql-find-sqli-buffer))) | 2608 | (default-buffer (sql-find-sqli-buffer))) |
| 2531 | (setq-default sql-buffer default-sqli-buffer) | 2609 | (setq-default sql-buffer default-buffer) |
| 2532 | (while (not (null buflist)) | 2610 | (while (not (null buflist)) |
| 2533 | (let ((candidate (car buflist))) | 2611 | (let ((candidate (car buflist))) |
| 2534 | (set-buffer candidate) | 2612 | (set-buffer candidate) |
| 2535 | (if (and (derived-mode-p 'sql-mode) | 2613 | (if (and (derived-mode-p 'sql-mode) |
| 2536 | (not (buffer-live-p sql-buffer))) | 2614 | (not (buffer-live-p sql-buffer))) |
| 2537 | (progn | 2615 | (progn |
| 2538 | (setq sql-buffer default-sqli-buffer) | 2616 | (setq sql-buffer default-buffer) |
| 2539 | (run-hooks 'sql-set-sqli-hook)))) | 2617 | (run-hooks 'sql-set-sqli-hook)))) |
| 2540 | (setq buflist (cdr buflist)))))) | 2618 | (setq buflist (cdr buflist)))))) |
| 2541 | 2619 | ||
| @@ -2561,11 +2639,11 @@ If you call it from anywhere else, it sets the global copy of | |||
| 2561 | (if (null (get-buffer-process new-buffer)) | 2639 | (if (null (get-buffer-process new-buffer)) |
| 2562 | (error "Buffer %s has no process" (buffer-name new-buffer))) | 2640 | (error "Buffer %s has no process" (buffer-name new-buffer))) |
| 2563 | (if (null (with-current-buffer new-buffer | 2641 | (if (null (with-current-buffer new-buffer |
| 2564 | (equal major-mode 'sql-interactive-mode))) | 2642 | (derived-mode-p 'sql-interactive-mode))) |
| 2565 | (error "Buffer %s is no SQLi buffer" (buffer-name new-buffer))) | 2643 | (error "Buffer %s is no SQLi buffer" (buffer-name new-buffer))) |
| 2566 | (if new-buffer | 2644 | (if new-buffer |
| 2567 | (progn | 2645 | (progn |
| 2568 | (setq sql-buffer new-buffer) | 2646 | (setq sql-buffer (buffer-name new-buffer)) |
| 2569 | (run-hooks 'sql-set-sqli-hook)))))) | 2647 | (run-hooks 'sql-set-sqli-hook)))))) |
| 2570 | 2648 | ||
| 2571 | (defun sql-show-sqli-buffer () | 2649 | (defun sql-show-sqli-buffer () |
| @@ -2574,11 +2652,11 @@ If you call it from anywhere else, it sets the global copy of | |||
| 2574 | This is the buffer SQL strings are sent to. It is stored in the | 2652 | This is the buffer SQL strings are sent to. It is stored in the |
| 2575 | variable `sql-buffer'. See `sql-help' on how to create such a buffer." | 2653 | variable `sql-buffer'. See `sql-help' on how to create such a buffer." |
| 2576 | (interactive) | 2654 | (interactive) |
| 2577 | (if (null (buffer-live-p sql-buffer)) | 2655 | (if (null (buffer-live-p (get-buffer sql-buffer))) |
| 2578 | (message "%s has no SQLi buffer set." (buffer-name (current-buffer))) | 2656 | (message "%s has no SQLi buffer set." (buffer-name (current-buffer))) |
| 2579 | (if (null (get-buffer-process sql-buffer)) | 2657 | (if (null (get-buffer-process sql-buffer)) |
| 2580 | (message "Buffer %s has no process." (buffer-name sql-buffer)) | 2658 | (message "Buffer %s has no process." sql-buffer) |
| 2581 | (message "Current SQLi buffer is %s." (buffer-name sql-buffer))))) | 2659 | (message "Current SQLi buffer is %s." sql-buffer)))) |
| 2582 | 2660 | ||
| 2583 | (defun sql-make-alternate-buffer-name () | 2661 | (defun sql-make-alternate-buffer-name () |
| 2584 | "Return a string that can be used to rename a SQLi buffer. | 2662 | "Return a string that can be used to rename a SQLi buffer. |
| @@ -2610,8 +2688,9 @@ server/database name." | |||
| 2610 | (unless (string= "" sql-user) | 2688 | (unless (string= "" sql-user) |
| 2611 | (list "/" sql-user))) | 2689 | (list "/" sql-user))) |
| 2612 | ((eq token 'port) | 2690 | ((eq token 'port) |
| 2613 | (unless (= 0 sql-port) | 2691 | (unless (or (not (numberp sql-port)) |
| 2614 | (list ":" sql-port))) | 2692 | (= 0 sql-port)) |
| 2693 | (list ":" (number-to-string sql-port)))) | ||
| 2615 | ((eq token 'server) | 2694 | ((eq token 'server) |
| 2616 | (unless (string= "" sql-server) | 2695 | (unless (string= "" sql-server) |
| 2617 | (list "." | 2696 | (list "." |
| @@ -2619,7 +2698,7 @@ server/database name." | |||
| 2619 | (file-name-nondirectory sql-server) | 2698 | (file-name-nondirectory sql-server) |
| 2620 | sql-server)))) | 2699 | sql-server)))) |
| 2621 | ((eq token 'database) | 2700 | ((eq token 'database) |
| 2622 | (when (string= "" sql-database) | 2701 | (unless (string= "" sql-database) |
| 2623 | (list "@" | 2702 | (list "@" |
| 2624 | (if (eq type :file) | 2703 | (if (eq type :file) |
| 2625 | (file-name-nondirectory sql-database) | 2704 | (file-name-nondirectory sql-database) |
| @@ -2649,10 +2728,32 @@ server/database name." | |||
| 2649 | ;; Use the name we've got | 2728 | ;; Use the name we've got |
| 2650 | name)))) | 2729 | name)))) |
| 2651 | 2730 | ||
| 2652 | (defun sql-rename-buffer () | 2731 | (defun sql-rename-buffer (&optional new-name) |
| 2653 | "Rename a SQLi buffer." | 2732 | "Rename a SQL interactive buffer. |
| 2654 | (interactive) | 2733 | |
| 2655 | (rename-buffer (format "*SQL: %s*" sql-alternate-buffer-name) t)) | 2734 | Prompts for the new name if command is preceeded by |
| 2735 | \\[universal-argument]. If no buffer name is provided, then the | ||
| 2736 | `sql-alternate-buffer-name' is used. | ||
| 2737 | |||
| 2738 | The actual buffer name set will be \"*SQL: NEW-NAME*\". If | ||
| 2739 | NEW-NAME is empty, then the buffer name will be \"*SQL*\"." | ||
| 2740 | (interactive "P") | ||
| 2741 | |||
| 2742 | (if (not (derived-mode-p 'sql-interactive-mode)) | ||
| 2743 | (message "Current buffer is not a SQL interactive buffer") | ||
| 2744 | |||
| 2745 | (cond | ||
| 2746 | ((stringp new-name) | ||
| 2747 | (setq sql-alternate-buffer-name new-name)) | ||
| 2748 | ((listp new-name) | ||
| 2749 | (setq sql-alternate-buffer-name | ||
| 2750 | (read-string "Buffer name (\"*SQL: XXX*\"; enter `XXX'): " | ||
| 2751 | sql-alternate-buffer-name)))) | ||
| 2752 | |||
| 2753 | (rename-buffer (if (string= "" sql-alternate-buffer-name) | ||
| 2754 | "*SQL*" | ||
| 2755 | (format "*SQL: %s*" sql-alternate-buffer-name)) | ||
| 2756 | t))) | ||
| 2656 | 2757 | ||
| 2657 | (defun sql-copy-column () | 2758 | (defun sql-copy-column () |
| 2658 | "Copy current column to the end of buffer. | 2759 | "Copy current column to the end of buffer. |
| @@ -2801,7 +2902,7 @@ to force the output from the query to appear on a new line." | |||
| 2801 | 2902 | ||
| 2802 | (let ((comint-input-sender-no-newline nil) | 2903 | (let ((comint-input-sender-no-newline nil) |
| 2803 | (s (replace-regexp-in-string "[[:space:]\n\r]+\\'" "" str))) | 2904 | (s (replace-regexp-in-string "[[:space:]\n\r]+\\'" "" str))) |
| 2804 | (if (buffer-live-p sql-buffer) | 2905 | (if (sql-buffer-live-p sql-buffer) |
| 2805 | (progn | 2906 | (progn |
| 2806 | ;; Ignore the hoping around... | 2907 | ;; Ignore the hoping around... |
| 2807 | (save-excursion | 2908 | (save-excursion |
| @@ -2814,7 +2915,7 @@ to force the output from the query to appear on a new line." | |||
| 2814 | (if sql-send-terminator | 2915 | (if sql-send-terminator |
| 2815 | (sql-send-magic-terminator sql-buffer s sql-send-terminator)) | 2916 | (sql-send-magic-terminator sql-buffer s sql-send-terminator)) |
| 2816 | 2917 | ||
| 2817 | (message "Sent string to buffer %s." (buffer-name sql-buffer)))) | 2918 | (message "Sent string to buffer %s." sql-buffer))) |
| 2818 | 2919 | ||
| 2819 | ;; Display the sql buffer | 2920 | ;; Display the sql buffer |
| 2820 | (if sql-pop-to-buffer-after-send-region | 2921 | (if sql-pop-to-buffer-after-send-region |
| @@ -3063,7 +3164,7 @@ you entered, right above the output it created. | |||
| 3063 | (setq local-abbrev-table sql-mode-abbrev-table) | 3164 | (setq local-abbrev-table sql-mode-abbrev-table) |
| 3064 | (setq abbrev-all-caps 1) | 3165 | (setq abbrev-all-caps 1) |
| 3065 | ;; Exiting the process will call sql-stop. | 3166 | ;; Exiting the process will call sql-stop. |
| 3066 | (set-process-sentinel (get-buffer-process sql-buffer) 'sql-stop) | 3167 | (set-process-sentinel (get-buffer-process (current-buffer)) 'sql-stop) |
| 3067 | ;; Save the connection name | 3168 | ;; Save the connection name |
| 3068 | (make-local-variable 'sql-connection) | 3169 | (make-local-variable 'sql-connection) |
| 3069 | ;; Create a usefull name for renaming this buffer later. | 3170 | ;; Create a usefull name for renaming this buffer later. |
| @@ -3248,49 +3349,60 @@ optionally is saved to the user's init file." | |||
| 3248 | ;;; Entry functions for different SQL interpreters. | 3349 | ;;; Entry functions for different SQL interpreters. |
| 3249 | 3350 | ||
| 3250 | ;;;###autoload | 3351 | ;;;###autoload |
| 3251 | (defun sql-product-interactive (&optional product) | 3352 | (defun sql-product-interactive (&optional product new-name) |
| 3252 | "Run PRODUCT interpreter as an inferior process. | 3353 | "Run PRODUCT interpreter as an inferior process. |
| 3253 | 3354 | ||
| 3254 | If buffer `*SQL*' exists but no process is running, make a new process. | 3355 | If buffer `*SQL*' exists but no process is running, make a new process. |
| 3255 | If buffer exists and a process is running, just switch to buffer `*SQL*'. | 3356 | If buffer exists and a process is running, just switch to buffer `*SQL*'. |
| 3256 | 3357 | ||
| 3358 | To specify the SQL product, prefix the call with | ||
| 3359 | \\[universal-argument]. To set the buffer name as well, prefix | ||
| 3360 | the call to \\[sql-product-interactive] with | ||
| 3361 | \\[universal-argument] \\[universal-argument]. | ||
| 3362 | |||
| 3257 | \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" | 3363 | \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" |
| 3258 | (interactive "P") | 3364 | (interactive "P") |
| 3259 | 3365 | ||
| 3366 | ;; Handle universal arguments if specified | ||
| 3367 | (when (not (or executing-kbd-macro noninteractive)) | ||
| 3368 | (when (and (listp product) | ||
| 3369 | (not (cdr product)) | ||
| 3370 | (numberp (car product))) | ||
| 3371 | (when (>= (car product) 16) | ||
| 3372 | (when (not new-name) | ||
| 3373 | (setq new-name '(4))) | ||
| 3374 | (setq product '(4))))) | ||
| 3375 | |||
| 3376 | ;; Get the value of product that we need | ||
| 3260 | (setq product | 3377 | (setq product |
| 3261 | (cond | 3378 | (cond |
| 3262 | ((equal product '(4)) ; Universal arg, prompt for product | 3379 | ((equal product '(4)) ; C-u, prompt for product |
| 3263 | (intern (completing-read "SQL product: " | 3380 | (intern (completing-read "SQL product: " |
| 3264 | (mapcar (lambda (info) (symbol-name (car info))) | 3381 | (mapcar (lambda (info) (symbol-name (car info))) |
| 3265 | sql-product-alist) | 3382 | sql-product-alist) |
| 3266 | nil 'require-match | 3383 | nil 'require-match |
| 3267 | (or (and sql-product (symbol-name sql-product)) "ansi")))) | 3384 | (or (and sql-product |
| 3385 | (symbol-name sql-product)) | ||
| 3386 | "ansi")))) | ||
| 3268 | ((and product ; Product specified | 3387 | ((and product ; Product specified |
| 3269 | (symbolp product)) product) | 3388 | (symbolp product)) product) |
| 3270 | (t sql-product))) ; Default to sql-product | 3389 | (t sql-product))) ; Default to sql-product |
| 3271 | 3390 | ||
| 3391 | ;; If we have a product and it has a interactive mode | ||
| 3272 | (if product | 3392 | (if product |
| 3273 | (when (sql-get-product-feature product :sqli-comint-func) | 3393 | (when (sql-get-product-feature product :sqli-comint-func) |
| 3274 | (if (and sql-buffer | 3394 | ;; If no new name specified, fall back on sql-buffer if its for |
| 3275 | (buffer-live-p sql-buffer) | 3395 | ;; the same product |
| 3276 | (comint-check-proc sql-buffer)) | 3396 | (if (and (not new-name) |
| 3397 | sql-buffer | ||
| 3398 | (sql-buffer-live-p sql-buffer) | ||
| 3399 | (comint-check-proc sql-buffer) | ||
| 3400 | (eq product (with-current-buffer sql-buffer sql-product))) | ||
| 3277 | (pop-to-buffer sql-buffer) | 3401 | (pop-to-buffer sql-buffer) |
| 3278 | 3402 | ||
| 3279 | ;; Is the current buffer in sql-mode and | 3403 | ;; We have a new name or sql-buffer doesn't exist or match |
| 3280 | ;; there is a buffer local setting of sql-buffer | 3404 | ;; Start by remembering where we start |
| 3281 | (let* ((start-buffer | 3405 | (let* ((start-buffer (current-buffer)) |
| 3282 | (and (derived-mode-p 'sql-mode) | ||
| 3283 | (current-buffer))) | ||
| 3284 | (start-sql-buffer | ||
| 3285 | (and start-buffer | ||
| 3286 | (let (found) | ||
| 3287 | (dolist (var (buffer-local-variables)) | ||
| 3288 | (and (consp var) | ||
| 3289 | (eq (car var) 'sql-buffer) | ||
| 3290 | (buffer-live-p (cdr var)) | ||
| 3291 | (get-buffer-process (cdr var)) | ||
| 3292 | (setq found (cdr var)))) | ||
| 3293 | found))) | ||
| 3294 | new-sqli-buffer) | 3406 | new-sqli-buffer) |
| 3295 | 3407 | ||
| 3296 | ;; Get credentials. | 3408 | ;; Get credentials. |
| @@ -3303,15 +3415,18 @@ If buffer exists and a process is running, just switch to buffer `*SQL*'. | |||
| 3303 | (sql-get-product-feature product :sqli-options)) | 3415 | (sql-get-product-feature product :sqli-options)) |
| 3304 | 3416 | ||
| 3305 | ;; Set SQLi mode. | 3417 | ;; Set SQLi mode. |
| 3306 | (setq sql-interactive-product product | 3418 | (setq new-sqli-buffer (current-buffer)) |
| 3307 | new-sqli-buffer (current-buffer) | 3419 | (let ((sql-interactive-product product)) |
| 3308 | sql-buffer new-sqli-buffer) | 3420 | (sql-interactive-mode)) |
| 3309 | (sql-interactive-mode) | 3421 | |
| 3422 | ;; Set the new buffer name | ||
| 3423 | (when new-name | ||
| 3424 | (sql-rename-buffer new-name)) | ||
| 3310 | 3425 | ||
| 3311 | ;; Set `sql-buffer' in the start buffer | 3426 | ;; Set `sql-buffer' in the start buffer |
| 3312 | (when (and start-buffer (not start-sql-buffer)) | 3427 | (setq sql-buffer (buffer-name new-sqli-buffer)) |
| 3313 | (with-current-buffer start-buffer | 3428 | (with-current-buffer start-buffer |
| 3314 | (setq sql-buffer new-sqli-buffer))) | 3429 | (setq sql-buffer (buffer-name new-sqli-buffer))) |
| 3315 | 3430 | ||
| 3316 | ;; All done. | 3431 | ;; All done. |
| 3317 | (message "Login...done") | 3432 | (message "Login...done") |
| @@ -3323,12 +3438,22 @@ If buffer exists and a process is running, just switch to buffer `*SQL*'. | |||
| 3323 | 3438 | ||
| 3324 | PRODUCT is the SQL product. PARAMS is a list of strings which are | 3439 | PRODUCT is the SQL product. PARAMS is a list of strings which are |
| 3325 | passed as command line arguments." | 3440 | passed as command line arguments." |
| 3326 | (let ((program (sql-get-product-feature product :sqli-program))) | 3441 | (let ((program (sql-get-product-feature product :sqli-program)) |
| 3442 | (buf-name "SQL")) | ||
| 3443 | ;; Make sure buffer name is unique | ||
| 3444 | (when (get-buffer (format "*%s*" buf-name)) | ||
| 3445 | (setq buf-name (format "SQL-%s" product)) | ||
| 3446 | (when (get-buffer (format "*%s*" buf-name)) | ||
| 3447 | (let ((i 1)) | ||
| 3448 | (while (get-buffer (format "*%s*" | ||
| 3449 | (setq buf-name | ||
| 3450 | (format "SQL-%s%d" product i)))) | ||
| 3451 | (setq i (1+ i)))))) | ||
| 3327 | (set-buffer | 3452 | (set-buffer |
| 3328 | (apply 'make-comint "SQL" program nil params)))) | 3453 | (apply 'make-comint buf-name program nil params)))) |
| 3329 | 3454 | ||
| 3330 | ;;;###autoload | 3455 | ;;;###autoload |
| 3331 | (defun sql-oracle () | 3456 | (defun sql-oracle (&optional buffer) |
| 3332 | "Run sqlplus by Oracle as an inferior process. | 3457 | "Run sqlplus by Oracle as an inferior process. |
| 3333 | 3458 | ||
| 3334 | If buffer `*SQL*' exists but no process is running, make a new process. | 3459 | If buffer `*SQL*' exists but no process is running, make a new process. |
| @@ -3343,6 +3468,11 @@ the list `sql-oracle-options'. | |||
| 3343 | The buffer is put in SQL interactive mode, giving commands for sending | 3468 | The buffer is put in SQL interactive mode, giving commands for sending |
| 3344 | input. See `sql-interactive-mode'. | 3469 | input. See `sql-interactive-mode'. |
| 3345 | 3470 | ||
| 3471 | To set the buffer name directly, use \\[universal-argument] | ||
| 3472 | before \\[sql-oracle]. Once session has started, | ||
| 3473 | \\[sql-rename-buffer] can be called separately to rename the | ||
| 3474 | buffer. | ||
| 3475 | |||
| 3346 | To specify a coding system for converting non-ASCII characters | 3476 | To specify a coding system for converting non-ASCII characters |
| 3347 | in the input and output to the process, use \\[universal-coding-system-argument] | 3477 | in the input and output to the process, use \\[universal-coding-system-argument] |
| 3348 | before \\[sql-oracle]. You can also specify this with \\[set-buffer-process-coding-system] | 3478 | before \\[sql-oracle]. You can also specify this with \\[set-buffer-process-coding-system] |
| @@ -3351,8 +3481,8 @@ The default comes from `process-coding-system-alist' and | |||
| 3351 | `default-process-coding-system'. | 3481 | `default-process-coding-system'. |
| 3352 | 3482 | ||
| 3353 | \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" | 3483 | \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" |
| 3354 | (interactive) | 3484 | (interactive "P") |
| 3355 | (sql-product-interactive 'oracle)) | 3485 | (sql-product-interactive 'oracle buffer)) |
| 3356 | 3486 | ||
| 3357 | (defun sql-comint-oracle (product options) | 3487 | (defun sql-comint-oracle (product options) |
| 3358 | "Create comint buffer and connect to Oracle." | 3488 | "Create comint buffer and connect to Oracle." |
| @@ -3375,7 +3505,7 @@ The default comes from `process-coding-system-alist' and | |||
| 3375 | 3505 | ||
| 3376 | 3506 | ||
| 3377 | ;;;###autoload | 3507 | ;;;###autoload |
| 3378 | (defun sql-sybase () | 3508 | (defun sql-sybase (&optional buffer) |
| 3379 | "Run isql by Sybase as an inferior process. | 3509 | "Run isql by Sybase as an inferior process. |
| 3380 | 3510 | ||
| 3381 | If buffer `*SQL*' exists but no process is running, make a new process. | 3511 | If buffer `*SQL*' exists but no process is running, make a new process. |
| @@ -3390,6 +3520,11 @@ can be stored in the list `sql-sybase-options'. | |||
| 3390 | The buffer is put in SQL interactive mode, giving commands for sending | 3520 | The buffer is put in SQL interactive mode, giving commands for sending |
| 3391 | input. See `sql-interactive-mode'. | 3521 | input. See `sql-interactive-mode'. |
| 3392 | 3522 | ||
| 3523 | To set the buffer name directly, use \\[universal-argument] | ||
| 3524 | before \\[sql-sybase]. Once session has started, | ||
| 3525 | \\[sql-rename-buffer] can be called separately to rename the | ||
| 3526 | buffer. | ||
| 3527 | |||
| 3393 | To specify a coding system for converting non-ASCII characters | 3528 | To specify a coding system for converting non-ASCII characters |
| 3394 | in the input and output to the process, use \\[universal-coding-system-argument] | 3529 | in the input and output to the process, use \\[universal-coding-system-argument] |
| 3395 | before \\[sql-sybase]. You can also specify this with \\[set-buffer-process-coding-system] | 3530 | before \\[sql-sybase]. You can also specify this with \\[set-buffer-process-coding-system] |
| @@ -3398,8 +3533,8 @@ The default comes from `process-coding-system-alist' and | |||
| 3398 | `default-process-coding-system'. | 3533 | `default-process-coding-system'. |
| 3399 | 3534 | ||
| 3400 | \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" | 3535 | \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" |
| 3401 | (interactive) | 3536 | (interactive "P") |
| 3402 | (sql-product-interactive 'sybase)) | 3537 | (sql-product-interactive 'sybase buffer)) |
| 3403 | 3538 | ||
| 3404 | (defun sql-comint-sybase (product options) | 3539 | (defun sql-comint-sybase (product options) |
| 3405 | "Create comint buffer and connect to Sybase." | 3540 | "Create comint buffer and connect to Sybase." |
| @@ -3419,7 +3554,7 @@ The default comes from `process-coding-system-alist' and | |||
| 3419 | 3554 | ||
| 3420 | 3555 | ||
| 3421 | ;;;###autoload | 3556 | ;;;###autoload |
| 3422 | (defun sql-informix () | 3557 | (defun sql-informix (&optional buffer) |
| 3423 | "Run dbaccess by Informix as an inferior process. | 3558 | "Run dbaccess by Informix as an inferior process. |
| 3424 | 3559 | ||
| 3425 | If buffer `*SQL*' exists but no process is running, make a new process. | 3560 | If buffer `*SQL*' exists but no process is running, make a new process. |
| @@ -3432,6 +3567,11 @@ the variable `sql-database' as default, if set. | |||
| 3432 | The buffer is put in SQL interactive mode, giving commands for sending | 3567 | The buffer is put in SQL interactive mode, giving commands for sending |
| 3433 | input. See `sql-interactive-mode'. | 3568 | input. See `sql-interactive-mode'. |
| 3434 | 3569 | ||
| 3570 | To set the buffer name directly, use \\[universal-argument] | ||
| 3571 | before \\[sql-informix]. Once session has started, | ||
| 3572 | \\[sql-rename-buffer] can be called separately to rename the | ||
| 3573 | buffer. | ||
| 3574 | |||
| 3435 | To specify a coding system for converting non-ASCII characters | 3575 | To specify a coding system for converting non-ASCII characters |
| 3436 | in the input and output to the process, use \\[universal-coding-system-argument] | 3576 | in the input and output to the process, use \\[universal-coding-system-argument] |
| 3437 | before \\[sql-informix]. You can also specify this with \\[set-buffer-process-coding-system] | 3577 | before \\[sql-informix]. You can also specify this with \\[set-buffer-process-coding-system] |
| @@ -3440,8 +3580,8 @@ The default comes from `process-coding-system-alist' and | |||
| 3440 | `default-process-coding-system'. | 3580 | `default-process-coding-system'. |
| 3441 | 3581 | ||
| 3442 | \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" | 3582 | \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" |
| 3443 | (interactive) | 3583 | (interactive "P") |
| 3444 | (sql-product-interactive 'informix)) | 3584 | (sql-product-interactive 'informix buffer)) |
| 3445 | 3585 | ||
| 3446 | (defun sql-comint-informix (product options) | 3586 | (defun sql-comint-informix (product options) |
| 3447 | "Create comint buffer and connect to Informix." | 3587 | "Create comint buffer and connect to Informix." |
| @@ -3456,7 +3596,7 @@ The default comes from `process-coding-system-alist' and | |||
| 3456 | 3596 | ||
| 3457 | 3597 | ||
| 3458 | ;;;###autoload | 3598 | ;;;###autoload |
| 3459 | (defun sql-sqlite () | 3599 | (defun sql-sqlite (&optional buffer) |
| 3460 | "Run sqlite as an inferior process. | 3600 | "Run sqlite as an inferior process. |
| 3461 | 3601 | ||
| 3462 | SQLite is free software. | 3602 | SQLite is free software. |
| @@ -3473,6 +3613,11 @@ can be stored in the list `sql-sqlite-options'. | |||
| 3473 | The buffer is put in SQL interactive mode, giving commands for sending | 3613 | The buffer is put in SQL interactive mode, giving commands for sending |
| 3474 | input. See `sql-interactive-mode'. | 3614 | input. See `sql-interactive-mode'. |
| 3475 | 3615 | ||
| 3616 | To set the buffer name directly, use \\[universal-argument] | ||
| 3617 | before \\[sql-sqlite]. Once session has started, | ||
| 3618 | \\[sql-rename-buffer] can be called separately to rename the | ||
| 3619 | buffer. | ||
| 3620 | |||
| 3476 | To specify a coding system for converting non-ASCII characters | 3621 | To specify a coding system for converting non-ASCII characters |
| 3477 | in the input and output to the process, use \\[universal-coding-system-argument] | 3622 | in the input and output to the process, use \\[universal-coding-system-argument] |
| 3478 | before \\[sql-sqlite]. You can also specify this with \\[set-buffer-process-coding-system] | 3623 | before \\[sql-sqlite]. You can also specify this with \\[set-buffer-process-coding-system] |
| @@ -3481,8 +3626,8 @@ The default comes from `process-coding-system-alist' and | |||
| 3481 | `default-process-coding-system'. | 3626 | `default-process-coding-system'. |
| 3482 | 3627 | ||
| 3483 | \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" | 3628 | \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" |
| 3484 | (interactive) | 3629 | (interactive "P") |
| 3485 | (sql-product-interactive 'sqlite)) | 3630 | (sql-product-interactive 'sqlite buffer)) |
| 3486 | 3631 | ||
| 3487 | (defun sql-comint-sqlite (product options) | 3632 | (defun sql-comint-sqlite (product options) |
| 3488 | "Create comint buffer and connect to SQLite." | 3633 | "Create comint buffer and connect to SQLite." |
| @@ -3498,7 +3643,7 @@ The default comes from `process-coding-system-alist' and | |||
| 3498 | 3643 | ||
| 3499 | 3644 | ||
| 3500 | ;;;###autoload | 3645 | ;;;###autoload |
| 3501 | (defun sql-mysql () | 3646 | (defun sql-mysql (&optional buffer) |
| 3502 | "Run mysql by TcX as an inferior process. | 3647 | "Run mysql by TcX as an inferior process. |
| 3503 | 3648 | ||
| 3504 | Mysql versions 3.23 and up are free software. | 3649 | Mysql versions 3.23 and up are free software. |
| @@ -3515,6 +3660,11 @@ can be stored in the list `sql-mysql-options'. | |||
| 3515 | The buffer is put in SQL interactive mode, giving commands for sending | 3660 | The buffer is put in SQL interactive mode, giving commands for sending |
| 3516 | input. See `sql-interactive-mode'. | 3661 | input. See `sql-interactive-mode'. |
| 3517 | 3662 | ||
| 3663 | To set the buffer name directly, use \\[universal-argument] | ||
| 3664 | before \\[sql-mysql]. Once session has started, | ||
| 3665 | \\[sql-rename-buffer] can be called separately to rename the | ||
| 3666 | buffer. | ||
| 3667 | |||
| 3518 | To specify a coding system for converting non-ASCII characters | 3668 | To specify a coding system for converting non-ASCII characters |
| 3519 | in the input and output to the process, use \\[universal-coding-system-argument] | 3669 | in the input and output to the process, use \\[universal-coding-system-argument] |
| 3520 | before \\[sql-mysql]. You can also specify this with \\[set-buffer-process-coding-system] | 3670 | before \\[sql-mysql]. You can also specify this with \\[set-buffer-process-coding-system] |
| @@ -3523,8 +3673,8 @@ The default comes from `process-coding-system-alist' and | |||
| 3523 | `default-process-coding-system'. | 3673 | `default-process-coding-system'. |
| 3524 | 3674 | ||
| 3525 | \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" | 3675 | \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" |
| 3526 | (interactive) | 3676 | (interactive "P") |
| 3527 | (sql-product-interactive 'mysql)) | 3677 | (sql-product-interactive 'mysql buffer)) |
| 3528 | 3678 | ||
| 3529 | (defun sql-comint-mysql (product options) | 3679 | (defun sql-comint-mysql (product options) |
| 3530 | "Create comint buffer and connect to MySQL." | 3680 | "Create comint buffer and connect to MySQL." |
| @@ -3535,7 +3685,7 @@ The default comes from `process-coding-system-alist' and | |||
| 3535 | (setq params (append (list sql-database) params))) | 3685 | (setq params (append (list sql-database) params))) |
| 3536 | (if (not (string= "" sql-server)) | 3686 | (if (not (string= "" sql-server)) |
| 3537 | (setq params (append (list (concat "--host=" sql-server)) params))) | 3687 | (setq params (append (list (concat "--host=" sql-server)) params))) |
| 3538 | (if (and sql-port (numberp sql-port)) | 3688 | (if (not (= 0 sql-port)) |
| 3539 | (setq params (append (list (concat "--port=" (number-to-string sql-port))) params))) | 3689 | (setq params (append (list (concat "--port=" (number-to-string sql-port))) params))) |
| 3540 | (if (not (string= "" sql-password)) | 3690 | (if (not (string= "" sql-password)) |
| 3541 | (setq params (append (list (concat "--password=" sql-password)) params))) | 3691 | (setq params (append (list (concat "--password=" sql-password)) params))) |
| @@ -3547,7 +3697,7 @@ The default comes from `process-coding-system-alist' and | |||
| 3547 | 3697 | ||
| 3548 | 3698 | ||
| 3549 | ;;;###autoload | 3699 | ;;;###autoload |
| 3550 | (defun sql-solid () | 3700 | (defun sql-solid (&optional buffer) |
| 3551 | "Run solsql by Solid as an inferior process. | 3701 | "Run solsql by Solid as an inferior process. |
| 3552 | 3702 | ||
| 3553 | If buffer `*SQL*' exists but no process is running, make a new process. | 3703 | If buffer `*SQL*' exists but no process is running, make a new process. |
| @@ -3561,6 +3711,11 @@ defaults, if set. | |||
| 3561 | The buffer is put in SQL interactive mode, giving commands for sending | 3711 | The buffer is put in SQL interactive mode, giving commands for sending |
| 3562 | input. See `sql-interactive-mode'. | 3712 | input. See `sql-interactive-mode'. |
| 3563 | 3713 | ||
| 3714 | To set the buffer name directly, use \\[universal-argument] | ||
| 3715 | before \\[sql-solid]. Once session has started, | ||
| 3716 | \\[sql-rename-buffer] can be called separately to rename the | ||
| 3717 | buffer. | ||
| 3718 | |||
| 3564 | To specify a coding system for converting non-ASCII characters | 3719 | To specify a coding system for converting non-ASCII characters |
| 3565 | in the input and output to the process, use \\[universal-coding-system-argument] | 3720 | in the input and output to the process, use \\[universal-coding-system-argument] |
| 3566 | before \\[sql-solid]. You can also specify this with \\[set-buffer-process-coding-system] | 3721 | before \\[sql-solid]. You can also specify this with \\[set-buffer-process-coding-system] |
| @@ -3569,8 +3724,8 @@ The default comes from `process-coding-system-alist' and | |||
| 3569 | `default-process-coding-system'. | 3724 | `default-process-coding-system'. |
| 3570 | 3725 | ||
| 3571 | \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" | 3726 | \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" |
| 3572 | (interactive) | 3727 | (interactive "P") |
| 3573 | (sql-product-interactive 'solid)) | 3728 | (sql-product-interactive 'solid buffer)) |
| 3574 | 3729 | ||
| 3575 | (defun sql-comint-solid (product options) | 3730 | (defun sql-comint-solid (product options) |
| 3576 | "Create comint buffer and connect to Solid." | 3731 | "Create comint buffer and connect to Solid." |
| @@ -3588,7 +3743,7 @@ The default comes from `process-coding-system-alist' and | |||
| 3588 | 3743 | ||
| 3589 | 3744 | ||
| 3590 | ;;;###autoload | 3745 | ;;;###autoload |
| 3591 | (defun sql-ingres () | 3746 | (defun sql-ingres (&optional buffer) |
| 3592 | "Run sql by Ingres as an inferior process. | 3747 | "Run sql by Ingres as an inferior process. |
| 3593 | 3748 | ||
| 3594 | If buffer `*SQL*' exists but no process is running, make a new process. | 3749 | If buffer `*SQL*' exists but no process is running, make a new process. |
| @@ -3601,6 +3756,11 @@ the variable `sql-database' as default, if set. | |||
| 3601 | The buffer is put in SQL interactive mode, giving commands for sending | 3756 | The buffer is put in SQL interactive mode, giving commands for sending |
| 3602 | input. See `sql-interactive-mode'. | 3757 | input. See `sql-interactive-mode'. |
| 3603 | 3758 | ||
| 3759 | To set the buffer name directly, use \\[universal-argument] | ||
| 3760 | before \\[sql-ingres]. Once session has started, | ||
| 3761 | \\[sql-rename-buffer] can be called separately to rename the | ||
| 3762 | buffer. | ||
| 3763 | |||
| 3604 | To specify a coding system for converting non-ASCII characters | 3764 | To specify a coding system for converting non-ASCII characters |
| 3605 | in the input and output to the process, use \\[universal-coding-system-argument] | 3765 | in the input and output to the process, use \\[universal-coding-system-argument] |
| 3606 | before \\[sql-ingres]. You can also specify this with \\[set-buffer-process-coding-system] | 3766 | before \\[sql-ingres]. You can also specify this with \\[set-buffer-process-coding-system] |
| @@ -3609,8 +3769,8 @@ The default comes from `process-coding-system-alist' and | |||
| 3609 | `default-process-coding-system'. | 3769 | `default-process-coding-system'. |
| 3610 | 3770 | ||
| 3611 | \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" | 3771 | \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" |
| 3612 | (interactive) | 3772 | (interactive "P") |
| 3613 | (sql-product-interactive 'ingres)) | 3773 | (sql-product-interactive 'ingres buffer)) |
| 3614 | 3774 | ||
| 3615 | (defun sql-comint-ingres (product options) | 3775 | (defun sql-comint-ingres (product options) |
| 3616 | "Create comint buffer and connect to Ingres." | 3776 | "Create comint buffer and connect to Ingres." |
| @@ -3624,7 +3784,7 @@ The default comes from `process-coding-system-alist' and | |||
| 3624 | 3784 | ||
| 3625 | 3785 | ||
| 3626 | ;;;###autoload | 3786 | ;;;###autoload |
| 3627 | (defun sql-ms () | 3787 | (defun sql-ms (&optional buffer) |
| 3628 | "Run osql by Microsoft as an inferior process. | 3788 | "Run osql by Microsoft as an inferior process. |
| 3629 | 3789 | ||
| 3630 | If buffer `*SQL*' exists but no process is running, make a new process. | 3790 | If buffer `*SQL*' exists but no process is running, make a new process. |
| @@ -3639,6 +3799,11 @@ in the list `sql-ms-options'. | |||
| 3639 | The buffer is put in SQL interactive mode, giving commands for sending | 3799 | The buffer is put in SQL interactive mode, giving commands for sending |
| 3640 | input. See `sql-interactive-mode'. | 3800 | input. See `sql-interactive-mode'. |
| 3641 | 3801 | ||
| 3802 | To set the buffer name directly, use \\[universal-argument] | ||
| 3803 | before \\[sql-ms]. Once session has started, | ||
| 3804 | \\[sql-rename-buffer] can be called separately to rename the | ||
| 3805 | buffer. | ||
| 3806 | |||
| 3642 | To specify a coding system for converting non-ASCII characters | 3807 | To specify a coding system for converting non-ASCII characters |
| 3643 | in the input and output to the process, use \\[universal-coding-system-argument] | 3808 | in the input and output to the process, use \\[universal-coding-system-argument] |
| 3644 | before \\[sql-ms]. You can also specify this with \\[set-buffer-process-coding-system] | 3809 | before \\[sql-ms]. You can also specify this with \\[set-buffer-process-coding-system] |
| @@ -3647,8 +3812,8 @@ The default comes from `process-coding-system-alist' and | |||
| 3647 | `default-process-coding-system'. | 3812 | `default-process-coding-system'. |
| 3648 | 3813 | ||
| 3649 | \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" | 3814 | \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" |
| 3650 | (interactive) | 3815 | (interactive "P") |
| 3651 | (sql-product-interactive 'ms)) | 3816 | (sql-product-interactive 'ms buffer)) |
| 3652 | 3817 | ||
| 3653 | (defun sql-comint-ms (product options) | 3818 | (defun sql-comint-ms (product options) |
| 3654 | "Create comint buffer and connect to Microsoft SQL Server." | 3819 | "Create comint buffer and connect to Microsoft SQL Server." |
| @@ -3675,7 +3840,7 @@ The default comes from `process-coding-system-alist' and | |||
| 3675 | 3840 | ||
| 3676 | 3841 | ||
| 3677 | ;;;###autoload | 3842 | ;;;###autoload |
| 3678 | (defun sql-postgres () | 3843 | (defun sql-postgres (&optional buffer) |
| 3679 | "Run psql by Postgres as an inferior process. | 3844 | "Run psql by Postgres as an inferior process. |
| 3680 | 3845 | ||
| 3681 | If buffer `*SQL*' exists but no process is running, make a new process. | 3846 | If buffer `*SQL*' exists but no process is running, make a new process. |
| @@ -3690,6 +3855,11 @@ Additional command line parameters can be stored in the list | |||
| 3690 | The buffer is put in SQL interactive mode, giving commands for sending | 3855 | The buffer is put in SQL interactive mode, giving commands for sending |
| 3691 | input. See `sql-interactive-mode'. | 3856 | input. See `sql-interactive-mode'. |
| 3692 | 3857 | ||
| 3858 | To set the buffer name directly, use \\[universal-argument] | ||
| 3859 | before \\[sql-postgres]. Once session has started, | ||
| 3860 | \\[sql-rename-buffer] can be called separately to rename the | ||
| 3861 | buffer. | ||
| 3862 | |||
| 3693 | To specify a coding system for converting non-ASCII characters | 3863 | To specify a coding system for converting non-ASCII characters |
| 3694 | in the input and output to the process, use \\[universal-coding-system-argument] | 3864 | in the input and output to the process, use \\[universal-coding-system-argument] |
| 3695 | before \\[sql-postgres]. You can also specify this with \\[set-buffer-process-coding-system] | 3865 | before \\[sql-postgres]. You can also specify this with \\[set-buffer-process-coding-system] |
| @@ -3703,8 +3873,8 @@ Try to set `comint-output-filter-functions' like this: | |||
| 3703 | '(comint-strip-ctrl-m))) | 3873 | '(comint-strip-ctrl-m))) |
| 3704 | 3874 | ||
| 3705 | \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" | 3875 | \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" |
| 3706 | (interactive) | 3876 | (interactive "P") |
| 3707 | (sql-product-interactive 'postgres)) | 3877 | (sql-product-interactive 'postgres buffer)) |
| 3708 | 3878 | ||
| 3709 | (defun sql-comint-postgres (product options) | 3879 | (defun sql-comint-postgres (product options) |
| 3710 | "Create comint buffer and connect to Postgres." | 3880 | "Create comint buffer and connect to Postgres." |
| @@ -3725,7 +3895,7 @@ Try to set `comint-output-filter-functions' like this: | |||
| 3725 | 3895 | ||
| 3726 | 3896 | ||
| 3727 | ;;;###autoload | 3897 | ;;;###autoload |
| 3728 | (defun sql-interbase () | 3898 | (defun sql-interbase (&optional buffer) |
| 3729 | "Run isql by Interbase as an inferior process. | 3899 | "Run isql by Interbase as an inferior process. |
| 3730 | 3900 | ||
| 3731 | If buffer `*SQL*' exists but no process is running, make a new process. | 3901 | If buffer `*SQL*' exists but no process is running, make a new process. |
| @@ -3739,6 +3909,11 @@ defaults, if set. | |||
| 3739 | The buffer is put in SQL interactive mode, giving commands for sending | 3909 | The buffer is put in SQL interactive mode, giving commands for sending |
| 3740 | input. See `sql-interactive-mode'. | 3910 | input. See `sql-interactive-mode'. |
| 3741 | 3911 | ||
| 3912 | To set the buffer name directly, use \\[universal-argument] | ||
| 3913 | before \\[sql-interbase]. Once session has started, | ||
| 3914 | \\[sql-rename-buffer] can be called separately to rename the | ||
| 3915 | buffer. | ||
| 3916 | |||
| 3742 | To specify a coding system for converting non-ASCII characters | 3917 | To specify a coding system for converting non-ASCII characters |
| 3743 | in the input and output to the process, use \\[universal-coding-system-argument] | 3918 | in the input and output to the process, use \\[universal-coding-system-argument] |
| 3744 | before \\[sql-interbase]. You can also specify this with \\[set-buffer-process-coding-system] | 3919 | before \\[sql-interbase]. You can also specify this with \\[set-buffer-process-coding-system] |
| @@ -3747,8 +3922,8 @@ The default comes from `process-coding-system-alist' and | |||
| 3747 | `default-process-coding-system'. | 3922 | `default-process-coding-system'. |
| 3748 | 3923 | ||
| 3749 | \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" | 3924 | \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" |
| 3750 | (interactive) | 3925 | (interactive "P") |
| 3751 | (sql-product-interactive 'interbase)) | 3926 | (sql-product-interactive 'interbase buffer)) |
| 3752 | 3927 | ||
| 3753 | (defun sql-comint-interbase (product options) | 3928 | (defun sql-comint-interbase (product options) |
| 3754 | "Create comint buffer and connect to Interbase." | 3929 | "Create comint buffer and connect to Interbase." |
| @@ -3766,7 +3941,7 @@ The default comes from `process-coding-system-alist' and | |||
| 3766 | 3941 | ||
| 3767 | 3942 | ||
| 3768 | ;;;###autoload | 3943 | ;;;###autoload |
| 3769 | (defun sql-db2 () | 3944 | (defun sql-db2 (&optional buffer) |
| 3770 | "Run db2 by IBM as an inferior process. | 3945 | "Run db2 by IBM as an inferior process. |
| 3771 | 3946 | ||
| 3772 | If buffer `*SQL*' exists but no process is running, make a new process. | 3947 | If buffer `*SQL*' exists but no process is running, make a new process. |
| @@ -3784,6 +3959,11 @@ db2, newlines will be escaped if necessary. If you don't want that, set | |||
| 3784 | `comint-input-sender' back to `comint-simple-send' by writing an after | 3959 | `comint-input-sender' back to `comint-simple-send' by writing an after |
| 3785 | advice. See the elisp manual for more information. | 3960 | advice. See the elisp manual for more information. |
| 3786 | 3961 | ||
| 3962 | To set the buffer name directly, use \\[universal-argument] | ||
| 3963 | before \\[sql-db2]. Once session has started, | ||
| 3964 | \\[sql-rename-buffer] can be called separately to rename the | ||
| 3965 | buffer. | ||
| 3966 | |||
| 3787 | To specify a coding system for converting non-ASCII characters | 3967 | To specify a coding system for converting non-ASCII characters |
| 3788 | in the input and output to the process, use \\[universal-coding-system-argument] | 3968 | in the input and output to the process, use \\[universal-coding-system-argument] |
| 3789 | before \\[sql-db2]. You can also specify this with \\[set-buffer-process-coding-system] | 3969 | before \\[sql-db2]. You can also specify this with \\[set-buffer-process-coding-system] |
| @@ -3792,8 +3972,8 @@ The default comes from `process-coding-system-alist' and | |||
| 3792 | `default-process-coding-system'. | 3972 | `default-process-coding-system'. |
| 3793 | 3973 | ||
| 3794 | \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" | 3974 | \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" |
| 3795 | (interactive) | 3975 | (interactive "P") |
| 3796 | (sql-product-interactive 'db2)) | 3976 | (sql-product-interactive 'db2 buffer)) |
| 3797 | 3977 | ||
| 3798 | (defun sql-comint-db2 (product options) | 3978 | (defun sql-comint-db2 (product options) |
| 3799 | "Create comint buffer and connect to DB2." | 3979 | "Create comint buffer and connect to DB2." |
| @@ -3801,11 +3981,9 @@ The default comes from `process-coding-system-alist' and | |||
| 3801 | ;; make-comint. | 3981 | ;; make-comint. |
| 3802 | (sql-comint product options) | 3982 | (sql-comint product options) |
| 3803 | ) | 3983 | ) |
| 3804 | ;; ;; Properly escape newlines when DB2 is interactive. | ||
| 3805 | ;; (setq comint-input-sender 'sql-escape-newlines-and-send)) | ||
| 3806 | 3984 | ||
| 3807 | ;;;###autoload | 3985 | ;;;###autoload |
| 3808 | (defun sql-linter () | 3986 | (defun sql-linter (&optional buffer) |
| 3809 | "Run inl by RELEX as an inferior process. | 3987 | "Run inl by RELEX as an inferior process. |
| 3810 | 3988 | ||
| 3811 | If buffer `*SQL*' exists but no process is running, make a new process. | 3989 | If buffer `*SQL*' exists but no process is running, make a new process. |
| @@ -3827,9 +4005,14 @@ an empty password. | |||
| 3827 | The buffer is put in SQL interactive mode, giving commands for sending | 4005 | The buffer is put in SQL interactive mode, giving commands for sending |
| 3828 | input. See `sql-interactive-mode'. | 4006 | input. See `sql-interactive-mode'. |
| 3829 | 4007 | ||
| 4008 | To set the buffer name directly, use \\[universal-argument] | ||
| 4009 | before \\[sql-linter]. Once session has started, | ||
| 4010 | \\[sql-rename-buffer] can be called separately to rename the | ||
| 4011 | buffer. | ||
| 4012 | |||
| 3830 | \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" | 4013 | \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" |
| 3831 | (interactive) | 4014 | (interactive "P") |
| 3832 | (sql-product-interactive 'linter)) | 4015 | (sql-product-interactive 'linter buffer)) |
| 3833 | 4016 | ||
| 3834 | (defun sql-comint-linter (product options) | 4017 | (defun sql-comint-linter (product options) |
| 3835 | "Create comint buffer and connect to Linter." | 4018 | "Create comint buffer and connect to Linter." |
diff --git a/lisp/progmodes/tcl.el b/lisp/progmodes/tcl.el index 29096a23046..8f80d13bab6 100644 --- a/lisp/progmodes/tcl.el +++ b/lisp/progmodes/tcl.el | |||
| @@ -411,9 +411,10 @@ This variable is generally set from `tcl-proc-regexp', | |||
| 411 | `tcl-typeword-list', and `tcl-keyword-list' by the function | 411 | `tcl-typeword-list', and `tcl-keyword-list' by the function |
| 412 | `tcl-set-font-lock-keywords'.") | 412 | `tcl-set-font-lock-keywords'.") |
| 413 | 413 | ||
| 414 | (defvar tcl-font-lock-syntactic-keywords | 414 | (defconst tcl-syntax-propertize-function |
| 415 | ;; Mark the few `#' that are not comment-markers. | 415 | (syntax-propertize-rules |
| 416 | '(("[^;[{ \t\n][ \t]*\\(#\\)" (1 "."))) | 416 | ;; Mark the few `#' that are not comment-markers. |
| 417 | ("[^;[{ \t\n][ \t]*\\(#\\)" (1 "."))) | ||
| 417 | "Syntactic keywords for `tcl-mode'.") | 418 | "Syntactic keywords for `tcl-mode'.") |
| 418 | 419 | ||
| 419 | ;; FIXME need some way to recognize variables because array refs look | 420 | ;; FIXME need some way to recognize variables because array refs look |
| @@ -593,9 +594,9 @@ Commands: | |||
| 593 | (set (make-local-variable 'outline-level) 'tcl-outline-level) | 594 | (set (make-local-variable 'outline-level) 'tcl-outline-level) |
| 594 | 595 | ||
| 595 | (set (make-local-variable 'font-lock-defaults) | 596 | (set (make-local-variable 'font-lock-defaults) |
| 596 | '(tcl-font-lock-keywords nil nil nil beginning-of-defun | 597 | '(tcl-font-lock-keywords nil nil nil beginning-of-defun)) |
| 597 | (font-lock-syntactic-keywords . tcl-font-lock-syntactic-keywords) | 598 | (set (make-local-variable 'syntax-propertize-function) |
| 598 | (parse-sexp-lookup-properties . t))) | 599 | tcl-syntax-propertize-function) |
| 599 | 600 | ||
| 600 | (set (make-local-variable 'imenu-generic-expression) | 601 | (set (make-local-variable 'imenu-generic-expression) |
| 601 | tcl-imenu-generic-expression) | 602 | tcl-imenu-generic-expression) |
diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el index 4ff9cf92b8d..24768d93e6a 100644 --- a/lisp/progmodes/vhdl-mode.el +++ b/lisp/progmodes/vhdl-mode.el | |||
| @@ -4693,8 +4693,15 @@ Key bindings: | |||
| 4693 | (set (make-local-variable 'font-lock-defaults) | 4693 | (set (make-local-variable 'font-lock-defaults) |
| 4694 | (list | 4694 | (list |
| 4695 | '(nil vhdl-font-lock-keywords) nil | 4695 | '(nil vhdl-font-lock-keywords) nil |
| 4696 | (not vhdl-highlight-case-sensitive) '((?\_ . "w")) 'beginning-of-line | 4696 | (not vhdl-highlight-case-sensitive) '((?\_ . "w")) 'beginning-of-line)) |
| 4697 | '(font-lock-syntactic-keywords . vhdl-font-lock-syntactic-keywords))) | 4697 | (if (eval-when-compile (fboundp 'syntax-propertize-rules)) |
| 4698 | (set (make-local-variable 'syntax-propertize-function) | ||
| 4699 | (syntax-propertize-rules | ||
| 4700 | ;; Mark single quotes as having string quote syntax in | ||
| 4701 | ;; 'c' instances. | ||
| 4702 | ("\\(\'\\).\\(\'\\)" (1 "\"'") (2 "\"'")))) | ||
| 4703 | (set (make-local-variable 'font-lock-syntactic-keywords) | ||
| 4704 | vhdl-font-lock-syntactic-keywords)) | ||
| 4698 | (unless vhdl-emacs-21 | 4705 | (unless vhdl-emacs-21 |
| 4699 | (set (make-local-variable 'font-lock-support-mode) 'lazy-lock-mode) | 4706 | (set (make-local-variable 'font-lock-support-mode) 'lazy-lock-mode) |
| 4700 | (set (make-local-variable 'lazy-lock-defer-contextually) nil) | 4707 | (set (make-local-variable 'lazy-lock-defer-contextually) nil) |
| @@ -12914,10 +12921,9 @@ This does background highlighting of translate-off regions.") | |||
| 12914 | "Re-initialize fontification and fontify buffer." | 12921 | "Re-initialize fontification and fontify buffer." |
| 12915 | (interactive) | 12922 | (interactive) |
| 12916 | (setq font-lock-defaults | 12923 | (setq font-lock-defaults |
| 12917 | (list | 12924 | `(vhdl-font-lock-keywords |
| 12918 | 'vhdl-font-lock-keywords nil | 12925 | nil ,(not vhdl-highlight-case-sensitive) ((?\_ . "w")) |
| 12919 | (not vhdl-highlight-case-sensitive) '((?\_ . "w")) 'beginning-of-line | 12926 | beginning-of-line)) |
| 12920 | '(font-lock-syntactic-keywords . vhdl-font-lock-syntactic-keywords))) | ||
| 12921 | (when (fboundp 'font-lock-unset-defaults) | 12927 | (when (fboundp 'font-lock-unset-defaults) |
| 12922 | (font-lock-unset-defaults)) ; not implemented in XEmacs | 12928 | (font-lock-unset-defaults)) ; not implemented in XEmacs |
| 12923 | (font-lock-set-defaults) | 12929 | (font-lock-set-defaults) |
diff --git a/lisp/simple.el b/lisp/simple.el index 18b2c3a300a..36931c7777c 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -5541,6 +5541,7 @@ The function should return non-nil if the two tokens do not match.") | |||
| 5541 | (if (minibufferp) | 5541 | (if (minibufferp) |
| 5542 | (minibuffer-message " [Unmatched parenthesis]") | 5542 | (minibuffer-message " [Unmatched parenthesis]") |
| 5543 | (message "Unmatched parenthesis")))) | 5543 | (message "Unmatched parenthesis")))) |
| 5544 | ((not blinkpos) nil) | ||
| 5544 | ((pos-visible-in-window-p blinkpos) | 5545 | ((pos-visible-in-window-p blinkpos) |
| 5545 | ;; Matching open within window, temporarily move to blinkpos but only | 5546 | ;; Matching open within window, temporarily move to blinkpos but only |
| 5546 | ;; if `blink-matching-paren-on-screen' is non-nil. | 5547 | ;; if `blink-matching-paren-on-screen' is non-nil. |
diff --git a/lisp/subr.el b/lisp/subr.el index 83cf7211906..f2c12a736c2 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -3358,6 +3358,52 @@ clone should be incorporated in the clone." | |||
| 3358 | (overlay-put ol2 'evaporate t) | 3358 | (overlay-put ol2 'evaporate t) |
| 3359 | (overlay-put ol2 'text-clones dups))) | 3359 | (overlay-put ol2 'text-clones dups))) |
| 3360 | 3360 | ||
| 3361 | ;;;; Misc functions moved over from the C side. | ||
| 3362 | |||
| 3363 | (defun y-or-n-p (prompt) | ||
| 3364 | "Ask user a \"y or n\" question. Return t if answer is \"y\". | ||
| 3365 | The argument PROMPT is the string to display to ask the question. | ||
| 3366 | It should end in a space; `y-or-n-p' adds `(y or n) ' to it. | ||
| 3367 | No confirmation of the answer is requested; a single character is enough. | ||
| 3368 | Also accepts Space to mean yes, or Delete to mean no. \(Actually, it uses | ||
| 3369 | the bindings in `query-replace-map'; see the documentation of that variable | ||
| 3370 | for more information. In this case, the useful bindings are `act', `skip', | ||
| 3371 | `recenter', and `quit'.\) | ||
| 3372 | |||
| 3373 | Under a windowing system a dialog box will be used if `last-nonmenu-event' | ||
| 3374 | is nil and `use-dialog-box' is non-nil." | ||
| 3375 | ;; ¡Beware! when I tried to edebug this code, Emacs got into a weird state | ||
| 3376 | ;; where all the keys were unbound (i.e. it somehow got triggered | ||
| 3377 | ;; within read-key, apparently). I had to kill it. | ||
| 3378 | (let ((answer 'none) | ||
| 3379 | (xprompt prompt)) | ||
| 3380 | (if (and (display-popup-menus-p) | ||
| 3381 | (listp last-nonmenu-event) | ||
| 3382 | use-dialog-box) | ||
| 3383 | (setq answer | ||
| 3384 | (x-popup-dialog t `(,prompt ("yes" . act) ("No" . skip)))) | ||
| 3385 | (while | ||
| 3386 | (let* ((key | ||
| 3387 | (let ((cursor-in-echo-area t)) | ||
| 3388 | (when minibuffer-auto-raise | ||
| 3389 | (raise-frame (window-frame (minibuffer-window)))) | ||
| 3390 | (read-key (propertize xprompt 'face 'minibuffer-prompt))))) | ||
| 3391 | (setq answer (lookup-key query-replace-map (vector key) t)) | ||
| 3392 | (cond | ||
| 3393 | ((memq answer '(skip act)) nil) | ||
| 3394 | ((eq answer 'recenter) (recenter) t) | ||
| 3395 | ((memq answer '(exit-prefix quit)) (signal 'quit nil) t) | ||
| 3396 | (t t))) | ||
| 3397 | (ding) | ||
| 3398 | (discard-input) | ||
| 3399 | (setq xprompt | ||
| 3400 | (if (eq answer 'recenter) prompt | ||
| 3401 | (concat "Please answer y or n. " prompt))))) | ||
| 3402 | (let ((ret (eq answer 'act))) | ||
| 3403 | (unless noninteractive | ||
| 3404 | (message "%s %s" prompt (if ret "y" "n"))) | ||
| 3405 | ret))) | ||
| 3406 | |||
| 3361 | ;;;; Mail user agents. | 3407 | ;;;; Mail user agents. |
| 3362 | 3408 | ||
| 3363 | ;; Here we include just enough for other packages to be able | 3409 | ;; Here we include just enough for other packages to be able |
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el index e17cd9e5b28..0662acf2c50 100644 --- a/lisp/textmodes/bibtex.el +++ b/lisp/textmodes/bibtex.el | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | ;; Mike Newton <newton@gumby.cs.caltech.edu> | 9 | ;; Mike Newton <newton@gumby.cs.caltech.edu> |
| 10 | ;; Aaron Larson <alarson@src.honeywell.com> | 10 | ;; Aaron Larson <alarson@src.honeywell.com> |
| 11 | ;; Dirk Herrmann <D.Herrmann@tu-bs.de> | 11 | ;; Dirk Herrmann <D.Herrmann@tu-bs.de> |
| 12 | ;; Maintainer: Roland Winkler <roland.winkler@physik.uni-erlangen.de> | 12 | ;; Maintainer: Roland Winkler <winkler@gnu.org> |
| 13 | ;; Keywords: BibTeX, LaTeX, TeX | 13 | ;; Keywords: BibTeX, LaTeX, TeX |
| 14 | 14 | ||
| 15 | ;; This file is part of GNU Emacs. | 15 | ;; This file is part of GNU Emacs. |
| @@ -3027,12 +3027,14 @@ if that value is non-nil. | |||
| 3027 | ;; brace-delimited ones | 3027 | ;; brace-delimited ones |
| 3028 | ) | 3028 | ) |
| 3029 | nil | 3029 | nil |
| 3030 | (font-lock-syntactic-keywords . bibtex-font-lock-syntactic-keywords) | ||
| 3031 | (font-lock-extra-managed-props . (category)) | 3030 | (font-lock-extra-managed-props . (category)) |
| 3032 | (font-lock-mark-block-function | 3031 | (font-lock-mark-block-function |
| 3033 | . (lambda () | 3032 | . (lambda () |
| 3034 | (set-mark (bibtex-end-of-entry)) | 3033 | (set-mark (bibtex-end-of-entry)) |
| 3035 | (bibtex-beginning-of-entry))))) | 3034 | (bibtex-beginning-of-entry))))) |
| 3035 | (set (make-local-variable 'syntax-propertize-function) | ||
| 3036 | (syntax-propertize-via-font-lock | ||
| 3037 | bibtex-font-lock-syntactic-keywords)) | ||
| 3036 | (setq imenu-generic-expression | 3038 | (setq imenu-generic-expression |
| 3037 | (list (list nil bibtex-entry-head bibtex-key-in-head)) | 3039 | (list (list nil bibtex-entry-head bibtex-key-in-head)) |
| 3038 | imenu-case-fold-search t) | 3040 | imenu-case-fold-search t) |
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index e30da02df4f..ad2838adaa9 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el | |||
| @@ -1116,26 +1116,24 @@ The variable `ispell-library-directory' defines the library location." | |||
| 1116 | 1116 | ||
| 1117 | (let ((dicts (append ispell-local-dictionary-alist ispell-dictionary-alist)) | 1117 | (let ((dicts (append ispell-local-dictionary-alist ispell-dictionary-alist)) |
| 1118 | (dict-list (cons "default" nil)) | 1118 | (dict-list (cons "default" nil)) |
| 1119 | name load-dict) | 1119 | name dict-bname) |
| 1120 | (dolist (dict dicts) | 1120 | (dolist (dict dicts) |
| 1121 | (setq name (car dict) | 1121 | (setq name (car dict) |
| 1122 | load-dict (car (cdr (member "-d" (nth 5 dict))))) | 1122 | dict-bname (or (car (cdr (member "-d" (nth 5 dict)))) |
| 1123 | name)) | ||
| 1123 | ;; Include if the dictionary is in the library, or dir not defined. | 1124 | ;; Include if the dictionary is in the library, or dir not defined. |
| 1124 | (if (and | 1125 | (if (and |
| 1125 | name | 1126 | name |
| 1126 | ;; include all dictionaries if lib directory not known. | ||
| 1127 | ;; For Aspell, we already know which dictionaries exist. | 1127 | ;; For Aspell, we already know which dictionaries exist. |
| 1128 | (or ispell-really-aspell | 1128 | (or ispell-really-aspell |
| 1129 | ;; Include all dictionaries if lib directory not known. | ||
| 1130 | ;; Same for Hunspell, where ispell-library-directory is nil. | ||
| 1129 | (not ispell-library-directory) | 1131 | (not ispell-library-directory) |
| 1130 | (file-exists-p (concat ispell-library-directory | 1132 | (file-exists-p (concat ispell-library-directory |
| 1131 | "/" name ".hash")) | 1133 | "/" dict-bname ".hash")) |
| 1132 | (file-exists-p (concat ispell-library-directory "/" name ".has")) | 1134 | (file-exists-p (concat ispell-library-directory |
| 1133 | (and load-dict | 1135 | "/" dict-bname ".has")))) |
| 1134 | (or (file-exists-p (concat ispell-library-directory | 1136 | (push name dict-list))) |
| 1135 | "/" load-dict ".hash")) | ||
| 1136 | (file-exists-p (concat ispell-library-directory | ||
| 1137 | "/" load-dict ".has")))))) | ||
| 1138 | (setq dict-list (cons name dict-list)))) | ||
| 1139 | dict-list)) | 1137 | dict-list)) |
| 1140 | 1138 | ||
| 1141 | ;;; define commands in menu in opposite order you want them to appear. | 1139 | ;;; define commands in menu in opposite order you want them to appear. |
| @@ -2591,12 +2589,13 @@ Keeps argument list for future ispell invocations for no async support." | |||
| 2591 | default-directory | 2589 | default-directory |
| 2592 | ;; Defend against bad `default-directory'. | 2590 | ;; Defend against bad `default-directory'. |
| 2593 | (expand-file-name "~/"))) | 2591 | (expand-file-name "~/"))) |
| 2592 | (orig-args (ispell-get-ispell-args)) | ||
| 2594 | (args | 2593 | (args |
| 2595 | (append | 2594 | (append |
| 2596 | (if (and ispell-current-dictionary ; Use specified dictionary. | 2595 | (if (and ispell-current-dictionary ; Not for default dict (nil) |
| 2597 | (not (member "-d" args))) ; Only define if not overridden. | 2596 | (not (member "-d" orig-args))) ; Only define if not overridden. |
| 2598 | (list "-d" ispell-current-dictionary)) | 2597 | (list "-d" ispell-current-dictionary)) |
| 2599 | (ispell-get-ispell-args) | 2598 | orig-args |
| 2600 | (if ispell-current-personal-dictionary ; Use specified pers dict. | 2599 | (if ispell-current-personal-dictionary ; Use specified pers dict. |
| 2601 | (list "-p" | 2600 | (list "-p" |
| 2602 | (expand-file-name ispell-current-personal-dictionary))) | 2601 | (expand-file-name ispell-current-personal-dictionary))) |
| @@ -2675,24 +2674,27 @@ Keeps argument list for future ispell invocations for no async support." | |||
| 2675 | ispell-filter-continue nil | 2674 | ispell-filter-continue nil |
| 2676 | ispell-process-directory default-directory) | 2675 | ispell-process-directory default-directory) |
| 2677 | 2676 | ||
| 2678 | ;; Kill ispell process when killing its associated buffer if using Ispell | ||
| 2679 | ;; per-directory personal dictionaries. | ||
| 2680 | (unless (equal ispell-process-directory (expand-file-name "~/")) | 2677 | (unless (equal ispell-process-directory (expand-file-name "~/")) |
| 2681 | (with-current-buffer | 2678 | ;; At this point, `ispell-process-directory' will be "~/" unless using |
| 2682 | (if (and (window-minibuffer-p) | 2679 | ;; Ispell with directory-specific dicts and not in XEmacs minibuffer. |
| 2683 | (fboundp 'minibuffer-selected-window)) ;; E.g. XEmacs. | 2680 | ;; If not, kill ispell process when killing buffer. It may be in a |
| 2684 | ;; When spellchecking minibuffer contents, assign ispell | 2681 | ;; removable device that would otherwise become un-mountable. |
| 2685 | ;; process to parent buffer if known (not known for XEmacs). | 2682 | (with-current-buffer |
| 2686 | ;; Use (buffer-name) otherwise. | 2683 | (if (and (window-minibuffer-p) ;; In minibuffer |
| 2684 | (fboundp 'minibuffer-selected-window)) ;; Not XEmacs. | ||
| 2685 | ;; In this case kill ispell only when parent buffer is killed | ||
| 2686 | ;; to avoid over and over ispell kill. | ||
| 2687 | (window-buffer (minibuffer-selected-window)) | 2687 | (window-buffer (minibuffer-selected-window)) |
| 2688 | (current-buffer)) | 2688 | (current-buffer)) |
| 2689 | (add-hook 'kill-buffer-hook (lambda () (ispell-kill-ispell t)) | 2689 | ;; 'local does not automatically make hook buffer-local in XEmacs. |
| 2690 | nil 'local))) | 2690 | (if (featurep 'xemacs) |
| 2691 | (make-local-hook 'kill-buffer-hook)) | ||
| 2692 | (add-hook 'kill-buffer-hook | ||
| 2693 | (lambda () (ispell-kill-ispell t)) nil 'local))) | ||
| 2691 | 2694 | ||
| 2692 | (if ispell-async-processp | 2695 | (if ispell-async-processp |
| 2693 | (set-process-filter ispell-process 'ispell-filter)) | 2696 | (set-process-filter ispell-process 'ispell-filter)) |
| 2694 | ;; protect against bogus binding of `enable-multibyte-characters' in | 2697 | ;; Protect against XEmacs bogus binding of `enable-multibyte-characters'. |
| 2695 | ;; XEmacs. | ||
| 2696 | (if (and (or (featurep 'xemacs) | 2698 | (if (and (or (featurep 'xemacs) |
| 2697 | (and (boundp 'enable-multibyte-characters) | 2699 | (and (boundp 'enable-multibyte-characters) |
| 2698 | enable-multibyte-characters)) | 2700 | enable-multibyte-characters)) |
| @@ -2728,7 +2730,9 @@ Keeps argument list for future ispell invocations for no async support." | |||
| 2728 | (if extended-char-mode ; ~ extended character mode | 2730 | (if extended-char-mode ; ~ extended character mode |
| 2729 | (ispell-send-string (concat extended-char-mode "\n")))) | 2731 | (ispell-send-string (concat extended-char-mode "\n")))) |
| 2730 | (if ispell-async-processp | 2732 | (if ispell-async-processp |
| 2731 | (set-process-query-on-exit-flag ispell-process nil))))) | 2733 | (if (fboundp 'set-process-query-on-exit-flag) ;; not XEmacs |
| 2734 | (set-process-query-on-exit-flag ispell-process nil) | ||
| 2735 | (process-kill-without-query ispell-process)))))) | ||
| 2732 | 2736 | ||
| 2733 | ;;;###autoload | 2737 | ;;;###autoload |
| 2734 | (defun ispell-kill-ispell (&optional no-error) | 2738 | (defun ispell-kill-ispell (&optional no-error) |
diff --git a/lisp/textmodes/page.el b/lisp/textmodes/page.el index 1c213fcbea2..e85c0835387 100644 --- a/lisp/textmodes/page.el +++ b/lisp/textmodes/page.el | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | ;; (push-mark (point) t) needed at the end of forward-page | ||
| 2 | ;; The documentation in simple.el for set-mark says | ||
| 3 | ;; To remember a location for internal use in the Lisp program, | ||
| 4 | ;; store it in a Lisp variable. Example: | ||
| 5 | ;; (let ((beg (point))) (forward-line 1) (delete-region beg (point)))." | ||
| 6 | |||
| 7 | |||
| 1 | ;;; page.el --- page motion commands for Emacs | 8 | ;;; page.el --- page motion commands for Emacs |
| 2 | 9 | ||
| 3 | ;; Copyright (C) 1985, 2001, 2002, 2003, 2004, 2005, | 10 | ;; Copyright (C) 1985, 2001, 2002, 2003, 2004, 2005, |
diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el index b4b0a281ca6..2a2e725e92e 100644 --- a/lisp/textmodes/reftex.el +++ b/lisp/textmodes/reftex.el | |||
| @@ -599,7 +599,6 @@ on the menu bar. | |||
| 599 | (defvar font-lock-mode) | 599 | (defvar font-lock-mode) |
| 600 | (defvar font-lock-keywords) | 600 | (defvar font-lock-keywords) |
| 601 | (defvar font-lock-fontify-region-function) | 601 | (defvar font-lock-fontify-region-function) |
| 602 | (defvar font-lock-syntactic-keywords) | ||
| 603 | 602 | ||
| 604 | ;;; ========================================================================= | 603 | ;;; ========================================================================= |
| 605 | ;;; | 604 | ;;; |
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el index 87ffecd5d5a..bc1af67d587 100644 --- a/lisp/textmodes/sgml-mode.el +++ b/lisp/textmodes/sgml-mode.el | |||
| @@ -293,11 +293,12 @@ Any terminating `>' or `/' is not matched.") | |||
| 293 | (defvar sgml-font-lock-keywords sgml-font-lock-keywords-1 | 293 | (defvar sgml-font-lock-keywords sgml-font-lock-keywords-1 |
| 294 | "*Rules for highlighting SGML code. See also `sgml-tag-face-alist'.") | 294 | "*Rules for highlighting SGML code. See also `sgml-tag-face-alist'.") |
| 295 | 295 | ||
| 296 | (defvar sgml-font-lock-syntactic-keywords | 296 | (defconst sgml-syntax-propertize-function |
| 297 | (syntax-propertize-rules | ||
| 297 | ;; Use the `b' style of comments to avoid interference with the -- ... -- | 298 | ;; Use the `b' style of comments to avoid interference with the -- ... -- |
| 298 | ;; comments recognized when `sgml-specials' includes ?-. | 299 | ;; comments recognized when `sgml-specials' includes ?-. |
| 299 | ;; FIXME: beware of <!--> blabla <!--> !! | 300 | ;; FIXME: beware of <!--> blabla <!--> !! |
| 300 | '(("\\(<\\)!--" (1 "< b")) | 301 | ("\\(<\\)!--" (1 "< b")) |
| 301 | ("--[ \t\n]*\\(>\\)" (1 "> b")) | 302 | ("--[ \t\n]*\\(>\\)" (1 "> b")) |
| 302 | ;; Double quotes outside of tags should not introduce strings. | 303 | ;; Double quotes outside of tags should not introduce strings. |
| 303 | ;; Be careful to call `syntax-ppss' on a position before the one we're | 304 | ;; Be careful to call `syntax-ppss' on a position before the one we're |
| @@ -477,9 +478,9 @@ Do \\[describe-key] on the following bindings to discover what they do. | |||
| 477 | '((sgml-font-lock-keywords | 478 | '((sgml-font-lock-keywords |
| 478 | sgml-font-lock-keywords-1 | 479 | sgml-font-lock-keywords-1 |
| 479 | sgml-font-lock-keywords-2) | 480 | sgml-font-lock-keywords-2) |
| 480 | nil t nil nil | 481 | nil t)) |
| 481 | (font-lock-syntactic-keywords | 482 | (set (make-local-variable 'syntax-propertize-function) |
| 482 | . sgml-font-lock-syntactic-keywords))) | 483 | sgml-syntax-propertize-function) |
| 483 | (set (make-local-variable 'facemenu-add-face-function) | 484 | (set (make-local-variable 'facemenu-add-face-function) |
| 484 | 'sgml-mode-facemenu-add-face-function) | 485 | 'sgml-mode-facemenu-add-face-function) |
| 485 | (set (make-local-variable 'sgml-xml-mode) (sgml-xml-guess)) | 486 | (set (make-local-variable 'sgml-xml-mode) (sgml-xml-guess)) |
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index da0c5396f2c..81a3816c1e8 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el | |||
| @@ -488,7 +488,7 @@ An alternative value is \" . \", if you use a font with a narrow period." | |||
| 488 | ;; (arg "\\(?:{\\(\\(?:[^{}\\]+\\|\\\\.\\|{[^}]*}\\)+\\)\\|\\\\[a-z*]+\\)")) | 488 | ;; (arg "\\(?:{\\(\\(?:[^{}\\]+\\|\\\\.\\|{[^}]*}\\)+\\)\\|\\\\[a-z*]+\\)")) |
| 489 | (arg "{\\(\\(?:[^{}\\]+\\|\\\\.\\|{[^}]*}\\)+\\)")) | 489 | (arg "{\\(\\(?:[^{}\\]+\\|\\\\.\\|{[^}]*}\\)+\\)")) |
| 490 | (list | 490 | (list |
| 491 | ;; font-lock-syntactic-keywords causes the \ of \end{verbatim} to be | 491 | ;; tex-font-lock-syntactic-keywords causes the \ of \end{verbatim} to be |
| 492 | ;; highlighted as tex-verbatim face. Let's undo that. | 492 | ;; highlighted as tex-verbatim face. Let's undo that. |
| 493 | ;; This is ugly and brittle :-( --Stef | 493 | ;; This is ugly and brittle :-( --Stef |
| 494 | '("^\\(\\\\\\)end" (1 (get-text-property (match-end 1) 'face) t)) | 494 | '("^\\(\\\\\\)end" (1 (get-text-property (match-end 1) 'face) t)) |
| @@ -655,6 +655,7 @@ An alternative value is \" . \", if you use a font with a narrow period." | |||
| 655 | ;; line is re-font-locked on its own. | 655 | ;; line is re-font-locked on its own. |
| 656 | ;; There's a hack in tex-font-lock-keywords-1 to remove the verbatim | 656 | ;; There's a hack in tex-font-lock-keywords-1 to remove the verbatim |
| 657 | ;; face from the \ but C-M-f still jumps to the wrong spot :-( --Stef | 657 | ;; face from the \ but C-M-f still jumps to the wrong spot :-( --Stef |
| 658 | ;; FIXME: See gud.el for an example of a solution to a similar problem. | ||
| 658 | (eval . `(,(concat "^\\(\\\\\\)end *{" | 659 | (eval . `(,(concat "^\\(\\\\\\)end *{" |
| 659 | (regexp-opt tex-verbatim-environments t) | 660 | (regexp-opt tex-verbatim-environments t) |
| 660 | "}\\(.?\\)") (1 "|") (3 "<"))) | 661 | "}\\(.?\\)") (1 "|") (3 "<"))) |
| @@ -1163,10 +1164,9 @@ Entering SliTeX mode runs the hook `text-mode-hook', then the hook | |||
| 1163 | (font-lock-syntactic-face-function | 1164 | (font-lock-syntactic-face-function |
| 1164 | . tex-font-lock-syntactic-face-function) | 1165 | . tex-font-lock-syntactic-face-function) |
| 1165 | (font-lock-unfontify-region-function | 1166 | (font-lock-unfontify-region-function |
| 1166 | . tex-font-lock-unfontify-region) | 1167 | . tex-font-lock-unfontify-region))) |
| 1167 | (font-lock-syntactic-keywords | 1168 | (set (make-local-variable 'syntax-propertize-function) |
| 1168 | . tex-font-lock-syntactic-keywords) | 1169 | (syntax-propertize-via-font-lock tex-font-lock-syntactic-keywords)) |
| 1169 | (parse-sexp-lookup-properties . t))) | ||
| 1170 | ;; TABs in verbatim environments don't do what you think. | 1170 | ;; TABs in verbatim environments don't do what you think. |
| 1171 | (set (make-local-variable 'indent-tabs-mode) nil) | 1171 | (set (make-local-variable 'indent-tabs-mode) nil) |
| 1172 | ;; Other vars that should be buffer-local. | 1172 | ;; Other vars that should be buffer-local. |
| @@ -2850,12 +2850,12 @@ There might be text before point." | |||
| 2850 | (mapcar | 2850 | (mapcar |
| 2851 | (lambda (x) | 2851 | (lambda (x) |
| 2852 | (case (car-safe x) | 2852 | (case (car-safe x) |
| 2853 | (font-lock-syntactic-keywords | ||
| 2854 | (cons (car x) 'doctex-font-lock-syntactic-keywords)) | ||
| 2855 | (font-lock-syntactic-face-function | 2853 | (font-lock-syntactic-face-function |
| 2856 | (cons (car x) 'doctex-font-lock-syntactic-face-function)) | 2854 | (cons (car x) 'doctex-font-lock-syntactic-face-function)) |
| 2857 | (t x))) | 2855 | (t x))) |
| 2858 | (cdr font-lock-defaults))))) | 2856 | (cdr font-lock-defaults)))) |
| 2857 | (set (make-local-variable 'syntax-propertize-function) | ||
| 2858 | (syntax-propertize-via-font-lock doctex-font-lock-syntactic-keywords))) | ||
| 2859 | 2859 | ||
| 2860 | (run-hooks 'tex-mode-load-hook) | 2860 | (run-hooks 'tex-mode-load-hook) |
| 2861 | 2861 | ||
diff --git a/lisp/textmodes/texinfo.el b/lisp/textmodes/texinfo.el index 7c71acd044b..be23a439bf3 100644 --- a/lisp/textmodes/texinfo.el +++ b/lisp/textmodes/texinfo.el | |||
| @@ -310,10 +310,11 @@ chapter." | |||
| 310 | ("Chapters" "^@chapter[ \t]+\\(.*\\)$" 1)) | 310 | ("Chapters" "^@chapter[ \t]+\\(.*\\)$" 1)) |
| 311 | "Imenu generic expression for Texinfo mode. See `imenu-generic-expression'.") | 311 | "Imenu generic expression for Texinfo mode. See `imenu-generic-expression'.") |
| 312 | 312 | ||
| 313 | (defvar texinfo-font-lock-syntactic-keywords | 313 | (defconst texinfo-syntax-propertize-function |
| 314 | '(("\\(@\\)c\\(omment\\)?\\>" (1 "<")) | 314 | (syntax-propertize-rules |
| 315 | ("^\\(@\\)ignore\\>" (1 "< b")) | 315 | ("\\(@\\)c\\(omment\\)?\\>" (1 "<")) |
| 316 | ("^@end ignore\\(\n\\)" (1 "> b"))) | 316 | ("^\\(@\\)ignore\\>" (1 "< b")) |
| 317 | ("^@end ignore\\(\n\\)" (1 "> b"))) | ||
| 317 | "Syntactic keywords to catch comment delimiters in `texinfo-mode'.") | 318 | "Syntactic keywords to catch comment delimiters in `texinfo-mode'.") |
| 318 | 319 | ||
| 319 | (defconst texinfo-environments | 320 | (defconst texinfo-environments |
| @@ -600,9 +601,9 @@ value of `texinfo-mode-hook'." | |||
| 600 | (setq imenu-case-fold-search nil) | 601 | (setq imenu-case-fold-search nil) |
| 601 | (make-local-variable 'font-lock-defaults) | 602 | (make-local-variable 'font-lock-defaults) |
| 602 | (setq font-lock-defaults | 603 | (setq font-lock-defaults |
| 603 | '(texinfo-font-lock-keywords nil nil nil backward-paragraph | 604 | '(texinfo-font-lock-keywords nil nil nil backward-paragraph)) |
| 604 | (font-lock-syntactic-keywords | 605 | (set (make-local-variable 'syntax-propertize-function) |
| 605 | . texinfo-font-lock-syntactic-keywords))) | 606 | texinfo-syntax-propertize-function) |
| 606 | (set (make-local-variable 'parse-sexp-lookup-properties) t) | 607 | (set (make-local-variable 'parse-sexp-lookup-properties) t) |
| 607 | 608 | ||
| 608 | ;; Outline settings. | 609 | ;; Outline settings. |
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index e3f76e72e37..170bedd3b28 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2010-09-11 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * url-cache.el, url-gw.el, url-history.el, url-irc.el, url-util.el: | ||
| 4 | * url-vars.el: Remove leading `*' from defcustom docs. | ||
| 5 | |||
| 1 | 2010-07-27 Michael Albinus <michael.albinus@gmx.de> | 6 | 2010-07-27 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 7 | ||
| 3 | * url-http (url-http-parse-headers): Disable file name handlers at | 8 | * url-http (url-http-parse-headers): Disable file name handlers at |
diff --git a/lisp/url/url-cache.el b/lisp/url/url-cache.el index 71841c9a0ca..7cff9aa923d 100644 --- a/lisp/url/url-cache.el +++ b/lisp/url/url-cache.el | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | ;;; url-cache.el --- Uniform Resource Locator retrieval tool | 1 | ;;; url-cache.el --- Uniform Resource Locator retrieval tool |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1996, 1997, 1998, 1999, 2004, | 3 | ;; Copyright (C) 1996, 1997, 1998, 1999, 2004, 2005, 2006, 2007, 2008, |
| 4 | ;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. | 4 | ;; 2009, 2010 Free Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | ;; Keywords: comm, data, processes, hypermedia | 6 | ;; Keywords: comm, data, processes, hypermedia |
| 7 | 7 | ||
| @@ -28,7 +28,7 @@ | |||
| 28 | 28 | ||
| 29 | (defcustom url-cache-directory | 29 | (defcustom url-cache-directory |
| 30 | (expand-file-name "cache" url-configuration-directory) | 30 | (expand-file-name "cache" url-configuration-directory) |
| 31 | "*The directory where cache files should be stored." | 31 | "The directory where cache files should be stored." |
| 32 | :type 'directory | 32 | :type 'directory |
| 33 | :group 'url-file) | 33 | :group 'url-file) |
| 34 | 34 | ||
| @@ -165,7 +165,7 @@ Very fast if you have an `md5' primitive function, suitably fast otherwise." | |||
| 165 | url-cache-directory)))))) | 165 | url-cache-directory)))))) |
| 166 | 166 | ||
| 167 | (defcustom url-cache-creation-function 'url-cache-create-filename-using-md5 | 167 | (defcustom url-cache-creation-function 'url-cache-create-filename-using-md5 |
| 168 | "*What function to use to create a cached filename." | 168 | "What function to use to create a cached filename." |
| 169 | :type '(choice (const :tag "MD5 of filename (low collision rate)" | 169 | :type '(choice (const :tag "MD5 of filename (low collision rate)" |
| 170 | :value url-cache-create-filename-using-md5) | 170 | :value url-cache-create-filename-using-md5) |
| 171 | (const :tag "Human readable filenames (higher collision rate)" | 171 | (const :tag "Human readable filenames (higher collision rate)" |
diff --git a/lisp/url/url-gw.el b/lisp/url/url-gw.el index 9915ccc6781..714d12f3f10 100644 --- a/lisp/url/url-gw.el +++ b/lisp/url/url-gw.el | |||
| @@ -37,50 +37,50 @@ | |||
| 37 | :group 'url) | 37 | :group 'url) |
| 38 | 38 | ||
| 39 | (defcustom url-gateway-local-host-regexp nil | 39 | (defcustom url-gateway-local-host-regexp nil |
| 40 | "*A regular expression specifying local hostnames/machines." | 40 | "A regular expression specifying local hostnames/machines." |
| 41 | :type '(choice (const nil) regexp) | 41 | :type '(choice (const nil) regexp) |
| 42 | :group 'url-gateway) | 42 | :group 'url-gateway) |
| 43 | 43 | ||
| 44 | (defcustom url-gateway-prompt-pattern | 44 | (defcustom url-gateway-prompt-pattern |
| 45 | "^[^#$%>;]*[#$%>;] *" ;; "bash\\|\$ *\r?$\\|> *\r?" | 45 | "^[^#$%>;]*[#$%>;] *" ;; "bash\\|\$ *\r?$\\|> *\r?" |
| 46 | "*A regular expression matching a shell prompt." | 46 | "A regular expression matching a shell prompt." |
| 47 | :type 'regexp | 47 | :type 'regexp |
| 48 | :group 'url-gateway) | 48 | :group 'url-gateway) |
| 49 | 49 | ||
| 50 | (defcustom url-gateway-rlogin-host nil | 50 | (defcustom url-gateway-rlogin-host nil |
| 51 | "*What hostname to actually rlog into before doing a telnet." | 51 | "What hostname to actually rlog into before doing a telnet." |
| 52 | :type '(choice (const nil) string) | 52 | :type '(choice (const nil) string) |
| 53 | :group 'url-gateway) | 53 | :group 'url-gateway) |
| 54 | 54 | ||
| 55 | (defcustom url-gateway-rlogin-user-name nil | 55 | (defcustom url-gateway-rlogin-user-name nil |
| 56 | "*Username to log into the remote machine with when using rlogin." | 56 | "Username to log into the remote machine with when using rlogin." |
| 57 | :type '(choice (const nil) string) | 57 | :type '(choice (const nil) string) |
| 58 | :group 'url-gateway) | 58 | :group 'url-gateway) |
| 59 | 59 | ||
| 60 | (defcustom url-gateway-rlogin-parameters '("telnet" "-8") | 60 | (defcustom url-gateway-rlogin-parameters '("telnet" "-8") |
| 61 | "*Parameters to `url-open-rlogin'. | 61 | "Parameters to `url-open-rlogin'. |
| 62 | This list will be used as the parameter list given to rsh." | 62 | This list will be used as the parameter list given to rsh." |
| 63 | :type '(repeat string) | 63 | :type '(repeat string) |
| 64 | :group 'url-gateway) | 64 | :group 'url-gateway) |
| 65 | 65 | ||
| 66 | (defcustom url-gateway-telnet-host nil | 66 | (defcustom url-gateway-telnet-host nil |
| 67 | "*What hostname to actually login to before doing a telnet." | 67 | "What hostname to actually login to before doing a telnet." |
| 68 | :type '(choice (const nil) string) | 68 | :type '(choice (const nil) string) |
| 69 | :group 'url-gateway) | 69 | :group 'url-gateway) |
| 70 | 70 | ||
| 71 | (defcustom url-gateway-telnet-parameters '("exec" "telnet" "-8") | 71 | (defcustom url-gateway-telnet-parameters '("exec" "telnet" "-8") |
| 72 | "*Parameters to `url-open-telnet'. | 72 | "Parameters to `url-open-telnet'. |
| 73 | This list will be executed as a command after logging in via telnet." | 73 | This list will be executed as a command after logging in via telnet." |
| 74 | :type '(repeat string) | 74 | :type '(repeat string) |
| 75 | :group 'url-gateway) | 75 | :group 'url-gateway) |
| 76 | 76 | ||
| 77 | (defcustom url-gateway-telnet-login-prompt "^\r*.?login:" | 77 | (defcustom url-gateway-telnet-login-prompt "^\r*.?login:" |
| 78 | "*Prompt that tells us we should send our username when loggin in w/telnet." | 78 | "Prompt that tells us we should send our username when loggin in w/telnet." |
| 79 | :type 'regexp | 79 | :type 'regexp |
| 80 | :group 'url-gateway) | 80 | :group 'url-gateway) |
| 81 | 81 | ||
| 82 | (defcustom url-gateway-telnet-password-prompt "^\r*.?password:" | 82 | (defcustom url-gateway-telnet-password-prompt "^\r*.?password:" |
| 83 | "*Prompt that tells us we should send our password when loggin in w/telnet." | 83 | "Prompt that tells us we should send our password when loggin in w/telnet." |
| 84 | :type 'regexp | 84 | :type 'regexp |
| 85 | :group 'url-gateway) | 85 | :group 'url-gateway) |
| 86 | 86 | ||
| @@ -95,7 +95,7 @@ This list will be executed as a command after logging in via telnet." | |||
| 95 | :group 'url-gateway) | 95 | :group 'url-gateway) |
| 96 | 96 | ||
| 97 | (defcustom url-gateway-broken-resolution nil | 97 | (defcustom url-gateway-broken-resolution nil |
| 98 | "*Whether to use nslookup to resolve hostnames. | 98 | "Whether to use nslookup to resolve hostnames. |
| 99 | This should be used when your version of Emacs cannot correctly use DNS, | 99 | This should be used when your version of Emacs cannot correctly use DNS, |
| 100 | but your machine can. This usually happens if you are running a statically | 100 | but your machine can. This usually happens if you are running a statically |
| 101 | linked Emacs under SunOS 4.x." | 101 | linked Emacs under SunOS 4.x." |
| @@ -103,7 +103,7 @@ linked Emacs under SunOS 4.x." | |||
| 103 | :group 'url-gateway) | 103 | :group 'url-gateway) |
| 104 | 104 | ||
| 105 | (defcustom url-gateway-nslookup-program "nslookup" | 105 | (defcustom url-gateway-nslookup-program "nslookup" |
| 106 | "*If non-nil then a string naming nslookup program." | 106 | "If non-nil then a string naming nslookup program." |
| 107 | :type '(choice (const :tag "None" :value nil) string) | 107 | :type '(choice (const :tag "None" :value nil) string) |
| 108 | :group 'url-gateway) | 108 | :group 'url-gateway) |
| 109 | 109 | ||
diff --git a/lisp/url/url-history.el b/lisp/url/url-history.el index 5b4f330ed2e..0cc891b32b7 100644 --- a/lisp/url/url-history.el +++ b/lisp/url/url-history.el | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | ;;; url-history.el --- Global history tracking for URL package | 1 | ;;; url-history.el --- Global history tracking for URL package |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1996, 1997, 1998, 1999, 2004, | 3 | ;; Copyright (C) 1996, 1997, 1998, 1999, 2004, 2005, 2006, 2007, 2008, |
| 4 | ;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. | 4 | ;; 2009, 2010 Free Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | ;; Keywords: comm, data, processes, hypermedia | 6 | ;; Keywords: comm, data, processes, hypermedia |
| 7 | 7 | ||
| @@ -35,7 +35,7 @@ | |||
| 35 | :group 'url) | 35 | :group 'url) |
| 36 | 36 | ||
| 37 | (defcustom url-history-track nil | 37 | (defcustom url-history-track nil |
| 38 | "*Controls whether to keep a list of all the URLs being visited. | 38 | "Controls whether to keep a list of all the URLs being visited. |
| 39 | If non-nil, the URL package will keep track of all the URLs visited. | 39 | If non-nil, the URL package will keep track of all the URLs visited. |
| 40 | If set to t, then the list is saved to disk at the end of each Emacs | 40 | If set to t, then the list is saved to disk at the end of each Emacs |
| 41 | session." | 41 | session." |
| @@ -49,14 +49,14 @@ session." | |||
| 49 | :group 'url-history) | 49 | :group 'url-history) |
| 50 | 50 | ||
| 51 | (defcustom url-history-file nil | 51 | (defcustom url-history-file nil |
| 52 | "*The global history file for the URL package. | 52 | "The global history file for the URL package. |
| 53 | This file contains a list of all the URLs you have visited. This file | 53 | This file contains a list of all the URLs you have visited. This file |
| 54 | is parsed at startup and used to provide URL completion." | 54 | is parsed at startup and used to provide URL completion." |
| 55 | :type '(choice (const :tag "Default" :value nil) file) | 55 | :type '(choice (const :tag "Default" :value nil) file) |
| 56 | :group 'url-history) | 56 | :group 'url-history) |
| 57 | 57 | ||
| 58 | (defcustom url-history-save-interval 3600 | 58 | (defcustom url-history-save-interval 3600 |
| 59 | "*The number of seconds between automatic saves of the history list. | 59 | "The number of seconds between automatic saves of the history list. |
| 60 | Default is 1 hour. Note that if you change this variable outside of | 60 | Default is 1 hour. Note that if you change this variable outside of |
| 61 | the `customize' interface after `url-do-setup' has been run, you need | 61 | the `customize' interface after `url-do-setup' has been run, you need |
| 62 | to run the `url-history-setup-save-timer' function manually." | 62 | to run the `url-history-setup-save-timer' function manually." |
diff --git a/lisp/url/url-irc.el b/lisp/url/url-irc.el index 1469cb9eb8b..715eecd211c 100644 --- a/lisp/url/url-irc.el +++ b/lisp/url/url-irc.el | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | ;;; url-irc.el --- IRC URL interface | 1 | ;;; url-irc.el --- IRC URL interface |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1996, 1997, 1998, 1999, 2004, | 3 | ;; Copyright (C) 1996, 1997, 1998, 1999, 2004, 2005, 2006, 2007, 2008, |
| 4 | ;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. | 4 | ;; 2009, 2010 Free Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | ;; Keywords: comm, data, processes | 6 | ;; Keywords: comm, data, processes |
| 7 | 7 | ||
| @@ -22,7 +22,8 @@ | |||
| 22 | 22 | ||
| 23 | ;;; Commentary: | 23 | ;;; Commentary: |
| 24 | 24 | ||
| 25 | ;; IRC URLs are defined in http://www.w3.org/Addressing/draft-mirashi-url-irc-01.txt | 25 | ;; IRC URLs are defined in |
| 26 | ;; http://www.w3.org/Addressing/draft-mirashi-url-irc-01.txt | ||
| 26 | 27 | ||
| 27 | ;;; Code: | 28 | ;;; Code: |
| 28 | 29 | ||
| @@ -32,7 +33,7 @@ | |||
| 32 | (defconst url-irc-default-port 6667 "Default port for IRC connections.") | 33 | (defconst url-irc-default-port 6667 "Default port for IRC connections.") |
| 33 | 34 | ||
| 34 | (defcustom url-irc-function 'url-irc-rcirc | 35 | (defcustom url-irc-function 'url-irc-rcirc |
| 35 | "*Function to actually open an IRC connection. | 36 | "Function to actually open an IRC connection. |
| 36 | The function should take the following arguments: | 37 | The function should take the following arguments: |
| 37 | HOST - the hostname of the IRC server to contact | 38 | HOST - the hostname of the IRC server to contact |
| 38 | PORT - the port number of the IRC server to contact | 39 | PORT - the port number of the IRC server to contact |
diff --git a/lisp/url/url-util.el b/lisp/url/url-util.el index e92ccc76285..8beffe60a7f 100644 --- a/lisp/url/url-util.el +++ b/lisp/url/url-util.el | |||
| @@ -43,7 +43,7 @@ | |||
| 43 | 43 | ||
| 44 | ;;;###autoload | 44 | ;;;###autoload |
| 45 | (defcustom url-debug nil | 45 | (defcustom url-debug nil |
| 46 | "*What types of debug messages from the URL library to show. | 46 | "What types of debug messages from the URL library to show. |
| 47 | Debug messages are logged to the *URL-DEBUG* buffer. | 47 | Debug messages are logged to the *URL-DEBUG* buffer. |
| 48 | 48 | ||
| 49 | If t, all messages will be logged. | 49 | If t, all messages will be logged. |
diff --git a/lisp/url/url-vars.el b/lisp/url/url-vars.el index 65622a06e02..74192478224 100644 --- a/lisp/url/url-vars.el +++ b/lisp/url/url-vars.el | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | ;;; url-vars.el --- Variables for Uniform Resource Locator tool | 1 | ;;; url-vars.el --- Variables for Uniform Resource Locator tool |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, | 3 | ;; Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, 2005, 2006, 2007, |
| 4 | ;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. | 4 | ;; 2008, 2009, 2010 Free Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | ;; Keywords: comm, data, processes, hypermedia | 6 | ;; Keywords: comm, data, processes, hypermedia |
| 7 | 7 | ||
| @@ -68,7 +68,7 @@ | |||
| 68 | )) | 68 | )) |
| 69 | 69 | ||
| 70 | (defcustom url-honor-refresh-requests t | 70 | (defcustom url-honor-refresh-requests t |
| 71 | "*Whether to do automatic page reloads. | 71 | "Whether to do automatic page reloads. |
| 72 | These are done at the request of the document author or the server via | 72 | These are done at the request of the document author or the server via |
| 73 | the `Refresh' header in an HTTP response. If nil, no refresh | 73 | the `Refresh' header in an HTTP response. If nil, no refresh |
| 74 | requests will be honored. If t, all refresh requests will be honored. | 74 | requests will be honored. If t, all refresh requests will be honored. |
| @@ -79,14 +79,14 @@ If non-nil and not t, the user will be asked for each refresh request." | |||
| 79 | :group 'url-hairy) | 79 | :group 'url-hairy) |
| 80 | 80 | ||
| 81 | (defcustom url-automatic-caching nil | 81 | (defcustom url-automatic-caching nil |
| 82 | "*If non-nil, all documents will be automatically cached to the local disk." | 82 | "If non-nil, all documents will be automatically cached to the local disk." |
| 83 | :type 'boolean | 83 | :type 'boolean |
| 84 | :group 'url-cache) | 84 | :group 'url-cache) |
| 85 | 85 | ||
| 86 | ;; Fixme: sanitize this. | 86 | ;; Fixme: sanitize this. |
| 87 | (defcustom url-cache-expired | 87 | (defcustom url-cache-expired |
| 88 | (lambda (t1 t2) (>= (- (car t2) (car t1)) 5)) | 88 | (lambda (t1 t2) (>= (- (car t2) (car t1)) 5)) |
| 89 | "*A function determining if a cached item has expired. | 89 | "A function determining if a cached item has expired. |
| 90 | It takes two times (numbers) as its arguments, and returns non-nil if | 90 | It takes two times (numbers) as its arguments, and returns non-nil if |
| 91 | the second time is 'too old' when compared to the first time." | 91 | the second time is 'too old' when compared to the first time." |
| 92 | :type 'function | 92 | :type 'function |
| @@ -96,14 +96,14 @@ the second time is 'too old' when compared to the first time." | |||
| 96 | "Where to send bug reports.") | 96 | "Where to send bug reports.") |
| 97 | 97 | ||
| 98 | (defcustom url-personal-mail-address nil | 98 | (defcustom url-personal-mail-address nil |
| 99 | "*Your full email address. | 99 | "Your full email address. |
| 100 | This is what is sent to HTTP servers as the FROM field in an HTTP | 100 | This is what is sent to HTTP servers as the FROM field in an HTTP |
| 101 | request." | 101 | request." |
| 102 | :type '(choice (const :tag "Unspecified" nil) string) | 102 | :type '(choice (const :tag "Unspecified" nil) string) |
| 103 | :group 'url) | 103 | :group 'url) |
| 104 | 104 | ||
| 105 | (defcustom url-directory-index-file "index.html" | 105 | (defcustom url-directory-index-file "index.html" |
| 106 | "*The filename to look for when indexing a directory. | 106 | "The filename to look for when indexing a directory. |
| 107 | If this file exists, and is readable, then it will be viewed instead of | 107 | If this file exists, and is readable, then it will be viewed instead of |
| 108 | using `dired' to view the directory." | 108 | using `dired' to view the directory." |
| 109 | :type 'string | 109 | :type 'string |
| @@ -166,14 +166,14 @@ variable." | |||
| 166 | (".hqx" . "x-hqx") | 166 | (".hqx" . "x-hqx") |
| 167 | (".Z" . "x-compress") | 167 | (".Z" . "x-compress") |
| 168 | (".bz2" . "x-bzip2")) | 168 | (".bz2" . "x-bzip2")) |
| 169 | "*An alist of file extensions and appropriate content-transfer-encodings." | 169 | "An alist of file extensions and appropriate content-transfer-encodings." |
| 170 | :type '(repeat (cons :format "%v" | 170 | :type '(repeat (cons :format "%v" |
| 171 | (string :tag "Extension") | 171 | (string :tag "Extension") |
| 172 | (string :tag "Encoding"))) | 172 | (string :tag "Encoding"))) |
| 173 | :group 'url-mime) | 173 | :group 'url-mime) |
| 174 | 174 | ||
| 175 | (defcustom url-mail-command 'compose-mail | 175 | (defcustom url-mail-command 'compose-mail |
| 176 | "*This function will be called whenever URL needs to send mail. | 176 | "This function will be called whenever URL needs to send mail. |
| 177 | It should enter a mail-mode-like buffer in the current window. | 177 | It should enter a mail-mode-like buffer in the current window. |
| 178 | The commands `mail-to' and `mail-subject' should still work in this | 178 | The commands `mail-to' and `mail-subject' should still work in this |
| 179 | buffer, and it should use `mail-header-separator' if possible." | 179 | buffer, and it should use `mail-header-separator' if possible." |
| @@ -181,7 +181,7 @@ buffer, and it should use `mail-header-separator' if possible." | |||
| 181 | :group 'url) | 181 | :group 'url) |
| 182 | 182 | ||
| 183 | (defcustom url-proxy-services nil | 183 | (defcustom url-proxy-services nil |
| 184 | "*An alist of schemes and proxy servers that gateway them. | 184 | "An alist of schemes and proxy servers that gateway them. |
| 185 | Looks like ((\"http\" . \"hostname:portnumber\") ...). This is set up | 185 | Looks like ((\"http\" . \"hostname:portnumber\") ...). This is set up |
| 186 | from the ACCESS_proxy environment variables." | 186 | from the ACCESS_proxy environment variables." |
| 187 | :type '(repeat (cons :format "%v" | 187 | :type '(repeat (cons :format "%v" |
| @@ -190,7 +190,7 @@ from the ACCESS_proxy environment variables." | |||
| 190 | :group 'url) | 190 | :group 'url) |
| 191 | 191 | ||
| 192 | (defcustom url-standalone-mode nil | 192 | (defcustom url-standalone-mode nil |
| 193 | "*Rely solely on the cache?" | 193 | "Rely solely on the cache?" |
| 194 | :type 'boolean | 194 | :type 'boolean |
| 195 | :group 'url-cache) | 195 | :group 'url-cache) |
| 196 | 196 | ||
| @@ -202,7 +202,7 @@ from the ACCESS_proxy environment variables." | |||
| 202 | 202 | ||
| 203 | (defcustom url-bad-port-list | 203 | (defcustom url-bad-port-list |
| 204 | '("25" "119" "19") | 204 | '("25" "119" "19") |
| 205 | "*List of ports to warn the user about connecting to. | 205 | "List of ports to warn the user about connecting to. |
| 206 | Defaults to just the mail, chargen, and NNTP ports so you cannot be | 206 | Defaults to just the mail, chargen, and NNTP ports so you cannot be |
| 207 | tricked into sending fake mail or forging messages by a malicious HTML | 207 | tricked into sending fake mail or forging messages by a malicious HTML |
| 208 | document." | 208 | document." |
| @@ -255,7 +255,7 @@ given priority 1 and the rest are given priority 0.5.") | |||
| 255 | 255 | ||
| 256 | ;; Fixme: set from the locale. | 256 | ;; Fixme: set from the locale. |
| 257 | (defcustom url-mime-language-string nil | 257 | (defcustom url-mime-language-string nil |
| 258 | "*String to send in the Accept-language: field in HTTP requests. | 258 | "String to send in the Accept-language: field in HTTP requests. |
| 259 | 259 | ||
| 260 | Specifies the preferred language when servers can serve documents in | 260 | Specifies the preferred language when servers can serve documents in |
| 261 | several languages. Use RFC 1766 abbreviations, e.g.: `en' for | 261 | several languages. Use RFC 1766 abbreviations, e.g.: `en' for |
| @@ -284,20 +284,20 @@ get the first available language (as opposed to the default)." | |||
| 284 | "What OS we are on.") | 284 | "What OS we are on.") |
| 285 | 285 | ||
| 286 | (defcustom url-max-password-attempts 5 | 286 | (defcustom url-max-password-attempts 5 |
| 287 | "*Maximum number of times a password will be prompted for. | 287 | "Maximum number of times a password will be prompted for. |
| 288 | Applies when a protected document is denied by the server." | 288 | Applies when a protected document is denied by the server." |
| 289 | :type 'integer | 289 | :type 'integer |
| 290 | :group 'url) | 290 | :group 'url) |
| 291 | 291 | ||
| 292 | (defcustom url-temporary-directory (or (getenv "TMPDIR") "/tmp") | 292 | (defcustom url-temporary-directory (or (getenv "TMPDIR") "/tmp") |
| 293 | "*Where temporary files go." | 293 | "Where temporary files go." |
| 294 | :type 'directory | 294 | :type 'directory |
| 295 | :group 'url-file) | 295 | :group 'url-file) |
| 296 | (make-obsolete-variable 'url-temporary-directory | 296 | (make-obsolete-variable 'url-temporary-directory |
| 297 | 'temporary-file-directory "23.1") | 297 | 'temporary-file-directory "23.1") |
| 298 | 298 | ||
| 299 | (defcustom url-show-status t | 299 | (defcustom url-show-status t |
| 300 | "*Whether to show a running total of bytes transferred. | 300 | "Whether to show a running total of bytes transferred. |
| 301 | Can cause a large hit if using a remote X display over a slow link, or | 301 | Can cause a large hit if using a remote X display over a slow link, or |
| 302 | a terminal with a slow modem." | 302 | a terminal with a slow modem." |
| 303 | :type 'boolean | 303 | :type 'boolean |
| @@ -308,7 +308,7 @@ a terminal with a slow modem." | |||
| 308 | http://www.example.com/") | 308 | http://www.example.com/") |
| 309 | 309 | ||
| 310 | (defcustom url-news-server nil | 310 | (defcustom url-news-server nil |
| 311 | "*The default news server from which to get newsgroups/articles. | 311 | "The default news server from which to get newsgroups/articles. |
| 312 | Applies if no server is specified in the URL. Defaults to the | 312 | Applies if no server is specified in the URL. Defaults to the |
| 313 | environment variable NNTPSERVER or \"news\" if NNTPSERVER is | 313 | environment variable NNTPSERVER or \"news\" if NNTPSERVER is |
| 314 | undefined." | 314 | undefined." |
| @@ -320,13 +320,13 @@ undefined." | |||
| 320 | "A regular expression that will match an absolute URL.") | 320 | "A regular expression that will match an absolute URL.") |
| 321 | 321 | ||
| 322 | (defcustom url-max-redirections 30 | 322 | (defcustom url-max-redirections 30 |
| 323 | "*The maximum number of redirection requests to honor in a HTTP connection. | 323 | "The maximum number of redirection requests to honor in a HTTP connection. |
| 324 | A negative number means to honor an unlimited number of redirection requests." | 324 | A negative number means to honor an unlimited number of redirection requests." |
| 325 | :type 'integer | 325 | :type 'integer |
| 326 | :group 'url) | 326 | :group 'url) |
| 327 | 327 | ||
| 328 | (defcustom url-confirmation-func 'y-or-n-p | 328 | (defcustom url-confirmation-func 'y-or-n-p |
| 329 | "*What function to use for asking yes or no functions. | 329 | "What function to use for asking yes or no functions. |
| 330 | Possible values are `yes-or-no-p' or `y-or-n-p', or any function that | 330 | Possible values are `yes-or-no-p' or `y-or-n-p', or any function that |
| 331 | takes a single argument (the prompt), and returns t only if a positive | 331 | takes a single argument (the prompt), and returns t only if a positive |
| 332 | answer is given." | 332 | answer is given." |
| @@ -336,7 +336,7 @@ answer is given." | |||
| 336 | :group 'url-hairy) | 336 | :group 'url-hairy) |
| 337 | 337 | ||
| 338 | (defcustom url-gateway-method 'native | 338 | (defcustom url-gateway-method 'native |
| 339 | "*The type of gateway support to use. | 339 | "The type of gateway support to use. |
| 340 | Should be a symbol specifying how to get a connection from the local machine. | 340 | Should be a symbol specifying how to get a connection from the local machine. |
| 341 | 341 | ||
| 342 | Currently supported methods: | 342 | Currently supported methods: |