diff options
| author | Miles Bader | 2005-05-05 00:04:55 +0000 |
|---|---|---|
| committer | Miles Bader | 2005-05-05 00:04:55 +0000 |
| commit | cca4e3b099ec4c3f4a36fd0cb865c618a5589069 (patch) | |
| tree | 711e73e53dbe1ab3a59b53fb56a10836e777b43e /lisp | |
| parent | d469f5c370dbb6fac0e8d6687b47ccfcf96a13a5 (diff) | |
| parent | d68a5392cafedbe0ee6c3eca0444fce4a58b6cdf (diff) | |
| download | emacs-cca4e3b099ec4c3f4a36fd0cb865c618a5589069.tar.gz emacs-cca4e3b099ec4c3f4a36fd0cb865c618a5589069.zip | |
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-44
Merge from emacs--cvs-trunk--0
Patches applied:
* emacs--cvs-trunk--0 (patch 272-288)
- src/xdisp.c (dump_glyph_row): Don't display overlay_arrow_p field.
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 67)
- Update from CVS
Diffstat (limited to 'lisp')
82 files changed, 4032 insertions, 2094 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 75822754e85..c95e169bebc 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,11 +1,590 @@ | |||
| 1 | 2005-05-05 Nick Roberts <nickrob@snap.net.nz> | ||
| 2 | |||
| 3 | * progmodes/cmacexp.el (c-macro-preprocessor): Update for BSD and | ||
| 4 | use gcc instead of cpp. | ||
| 5 | |||
| 6 | * progmodes/gdb-ui.el (gdb-cpp-define-alist-flags): New variable. | ||
| 7 | (gdb-create-define-alist): Use. it. | ||
| 8 | (gdb-cpp-define-alist-program): Update for MS-DOS? | ||
| 9 | |||
| 10 | 2005-05-04 Nick Roberts <nickrob@snap.net.nz> | ||
| 11 | |||
| 12 | * progmodes/cmacexp.el (c-macro-preprocessor): Update for Mac OSX. | ||
| 13 | |||
| 14 | 2005-05-03 Ulf Jasper <ulf.jasper@web.de> | ||
| 15 | |||
| 16 | * calendar/icalendar.el (icalendar-version): Now at 0.12. | ||
| 17 | (icalendar-duration-correction): Remove. | ||
| 18 | (icalendar--get-event-properties): Split result at commas. | ||
| 19 | (icalendar--decode-isoduration): New optional argument | ||
| 20 | DURATION-CORRECTION. | ||
| 21 | (icalendar--convert-ordinary-to-ical, icalendar--convert-sexp-to-ical) | ||
| 22 | (icalendar--convert-yearly-to-ical, icalendar--convert-weekly-to-ical) | ||
| 23 | (icalendar--convert-block-to-ical, icalendar--convert-float-to-ical) | ||
| 24 | (icalendar--convert-date-to-ical, icalendar--convert-cyclic-to-ical) | ||
| 25 | (icalendar--convert-anniversary-to-ical): New functions, extracted | ||
| 26 | from icalendar-export-region, with bug fixes. | ||
| 27 | (icalendar-export-region): Use the above functions. | ||
| 28 | (icalendar-import-buffer): Check before saving diary file. | ||
| 29 | (icalendar--convert-recurring-to-diary) | ||
| 30 | (icalendar--convert-non-recurring-all-day-to-diary) | ||
| 31 | (icalendar--convert-non-recurring-not-all-day-to-diary): New functions, | ||
| 32 | extracted from icalendar--convert-ical-to-diary, with bug fixes. | ||
| 33 | (icalendar--convert-ical-to-diary): Use the above functions. | ||
| 34 | |||
| 35 | 2005-05-03 Nick Roberts <nickrob@snap.net.nz> | ||
| 36 | |||
| 37 | * progmodes/cc-mode.el (cc-define-alist, cc-create-define-alist): | ||
| 38 | Remove these recent additions. | ||
| 39 | (c-mode): Restore to before 2005-04-28. | ||
| 40 | |||
| 41 | * progmodes/cc-vars.el (cc-define-list-program): Remove this | ||
| 42 | recent addition. | ||
| 43 | |||
| 44 | * progmodes/gdb-ui.el (gdb-cpp-define-alist-program) | ||
| 45 | (gdb-define-alist): New variables. | ||
| 46 | (gdb-create-define-alist): New function. | ||
| 47 | (gdb-set-gud-minor-mode-1): Handle gdb-define-alist. | ||
| 48 | (gdb-source, gdb-memory-set-repeat-count): Replace string-to-int | ||
| 49 | with string-to-number. | ||
| 50 | (gdb-reset): Kill gdb-define-alist. Move assignments outside loop. | ||
| 51 | |||
| 52 | * progmodes/gud.el: Replace string-to-int with string-to-number. | ||
| 53 | (gud-find-file): Handle gdb-define-alist. | ||
| 54 | |||
| 55 | * tooltip.el (tooltip-gud-tips): Use gdb-define-alist. | ||
| 56 | |||
| 57 | 2005-05-02 Jay Belanger <belanger@truman.edu> | ||
| 58 | |||
| 59 | * calc/calc-aent.el (math-read-token): | ||
| 60 | * calc/calc-bin.el (calc-word-size): | ||
| 61 | * calc/calc-ext.el (calc-read-number-fancy): | ||
| 62 | * calc/calc-forms.el (calc-time, calc-date-notation, math-this-year) | ||
| 63 | (math-parse-date, math-parse-standard-date, calcFunc-tzone): | ||
| 64 | * calc/calc-frac.el (calc-over-notation): | ||
| 65 | * calc/calc-graph.el (calc-graph-plot, calc-graph-set-styles) | ||
| 66 | (calc-graph-num-points, calc-graph-init): | ||
| 67 | * calc/calc-prog.el (calc-read-parse-table-part) | ||
| 68 | (calc-edit-macro-repeats): | ||
| 69 | * calc/calc-yank.el (calc-do-grab-rectangle): | ||
| 70 | * calc/calc.el (calcDigit-key, math-read-number, math-read-bignum): | ||
| 71 | Replace `string-to-int' by `string-to-number'. | ||
| 72 | |||
| 73 | 2005-05-02 Kim F. Storm <storm@cua.dk> | ||
| 74 | |||
| 75 | * kmacro.el: Use executing-kbd-macro-index variable. | ||
| 76 | |||
| 77 | 2005-05-02 Thien-Thi Nguyen <ttn@gnu.org> | ||
| 78 | |||
| 79 | * net/rlogin.el (rlogin-parse-words): Delete func. | ||
| 80 | (rlogin): Use split-string, not rlogin-parse-words. | ||
| 81 | Also, if there are option-like elements in the parsed args, | ||
| 82 | take the host to be the first arg immediately following them. | ||
| 83 | Suggested by Michael Mauger. | ||
| 84 | |||
| 85 | 2005-05-01 Luc Teirlinck <teirllm@auburn.edu> | ||
| 86 | |||
| 87 | * subr.el (executing-macro): Use `define-obsolete-variable-alias'. | ||
| 88 | |||
| 89 | 2005-05-02 Nick Roberts <nickrob@snap.net.nz> | ||
| 90 | |||
| 91 | * progmodes/cc-mode.el (cc-create-define-alist): Use a shell. | ||
| 92 | (cc-mode-cpp-program): Rename to cc-define-list-program and | ||
| 93 | move to cc-vars.el. | ||
| 94 | |||
| 95 | * progmodes/cc-vars.el (cc-define-list-program): | ||
| 96 | Change to "gcc -E -dM -". Make customizable. | ||
| 97 | |||
| 98 | 2005-05-02 Kim F. Storm <storm@cua.dk> | ||
| 99 | |||
| 100 | * emulation/cua-base.el: Fix check for CUA-mode if no init file. | ||
| 101 | |||
| 102 | 2005-05-02 Nick Roberts <nickrob@snap.net.nz> | ||
| 103 | |||
| 104 | * progmodes/cc-mode.el (cc-mode-cpp-program): Change to "gcc -E". | ||
| 105 | |||
| 106 | * international/mule-util.el (truncate-string): Remove alias and | ||
| 107 | obsolete declaration. | ||
| 108 | |||
| 109 | * international/mule-cmds.el (update-iso-coding-systems): | ||
| 110 | Remove alias and obsolete declaration. | ||
| 111 | |||
| 112 | * international/mule.el (coding-system-parent): Remove alias and | ||
| 113 | obsolete declaration. | ||
| 114 | |||
| 115 | * subr.el (define-function, sref): Remove aliases and obsolete | ||
| 116 | declarations. | ||
| 117 | (chars-in-region): Remove obsolete declaration. | ||
| 118 | |||
| 119 | 2005-05-01 Richard M. Stallman <rms@gnu.org> | ||
| 120 | |||
| 121 | * info.el (Info-mode): Set widen-automatically to nil, locally. | ||
| 122 | |||
| 123 | * simple.el (widen-automatically): New variable. | ||
| 124 | (pop-global-mark): Obey widen-automatically. | ||
| 125 | |||
| 126 | 2005-05-01 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 127 | |||
| 128 | * term/xterm.el (function-key-map): Call substitute-key-definition | ||
| 129 | before the keymap size is increased by a lot of define-key calls. | ||
| 130 | |||
| 131 | 2005-05-01 Richard M. Stallman <rms@gnu.org> | ||
| 132 | |||
| 133 | * subr.el (add-to-invisibility-spec, remove-from-invisibility-spec): | ||
| 134 | Rename ARG to ELEMENT. Doc fix. | ||
| 135 | |||
| 136 | 2005-05-01 Nick Roberts <nickrob@snap.net.nz> | ||
| 137 | |||
| 138 | * allout.el (allout-exposure): Remove macro and obsolete declaration. | ||
| 139 | Remove references to allout-exposure/change to allout-new-exposure. | ||
| 140 | |||
| 141 | * emacs-lisp/bytecomp.el (dot, dot-min, dot-max): Don't create | ||
| 142 | bytecode symbols. | ||
| 143 | |||
| 144 | * subr.el (dot, dot-marker, dot-min, dot-max, buffer-flush-undo) | ||
| 145 | (compiled-function-p, focus-frame, unfocus-frame): | ||
| 146 | Remove aliases and obsolete declarations. | ||
| 147 | Back out inadvertant changes from previous commit. | ||
| 148 | |||
| 149 | 2005-05-01 Luc Teirlinck <teirllm@auburn.edu> | ||
| 150 | |||
| 151 | * files.el (require-final-newline): Make Custom tags consistent | ||
| 152 | with mode-require-final-newline. | ||
| 153 | (mode-require-final-newline): Doc fix. | ||
| 154 | |||
| 155 | 2005-05-01 Lute Kamstra <lute@gnu.org> | ||
| 156 | |||
| 157 | * international/latexenc.el (latexenc-find-file-coding-system): | ||
| 158 | Fix regular expressions. Suggested by David Kastrup <dak@gnu.org> | ||
| 159 | and Stefan Monnier <monnier@iro.umontreal.ca>. | ||
| 160 | |||
| 161 | 2005-05-01 Nick Roberts <nickrob@snap.net.nz> | ||
| 162 | |||
| 163 | * subr.el (string-to-int): Make obsolete. | ||
| 164 | |||
| 165 | 2005-04-30 Richard M. Stallman <rms@gnu.org> | ||
| 166 | |||
| 167 | * simple.el (next-error-overlay-arrow-position): Turn off, for ttys. | ||
| 168 | |||
| 169 | * loadup.el: load jka-comp-hook. | ||
| 170 | |||
| 171 | * jka-compr.el: Many functions and vars moved to jka-compr-hook.el. | ||
| 172 | (jka-compr-handler): Add autoload. `put' calls moved | ||
| 173 | to jka-compr-hook.el. | ||
| 174 | (compression, jka-compr): defgroups moved to jka-compr-hook.el. | ||
| 175 | (jka-compr-inhibit): Autoload. | ||
| 176 | |||
| 177 | * jka-comp-hook.el: New file. | ||
| 178 | Enable the mode by default. | ||
| 179 | |||
| 180 | * files.el (backup-buffer-copy): Use copy-file instead | ||
| 181 | of write-region, and put back the 'excl. | ||
| 182 | |||
| 183 | 2005-04-30 Chong Yidong <cyd@stupidchicken.com> | ||
| 184 | |||
| 185 | * progmodes/flymake.el (flymake-split-string) | ||
| 186 | (flymake-split-string, flymake-log, flymake-pid-to-names) | ||
| 187 | (flymake-reg-names, flymake-get-source-buffer-name) | ||
| 188 | (flymake-unreg-names, flymake-add-line-err-info) | ||
| 189 | (flymake-add-err-info): Clarify docstrings. | ||
| 190 | (flymake-popup-menu, flymake-make-emacs-menu) | ||
| 191 | (flymake-make-xemacs-menu): Add docstrings. | ||
| 192 | (flymake-get-buffer-*, flymake-set-buffer-*): Functions deleted. | ||
| 193 | Set variables directly throughout. | ||
| 194 | |||
| 195 | 2005-04-30 Nick Roberts <nickrob@snap.net.nz> | ||
| 196 | |||
| 197 | * progmodes/cc-mode.el (cc-create-define-alist): Check that file | ||
| 198 | exists. Initialise cc-define-alist. | ||
| 199 | (c-mode): Add cc-create-define-alist locally to after-save-hook. | ||
| 200 | If there is no file (Macroexpansion) don't create an alist. | ||
| 201 | |||
| 202 | 2005-04-29 Sam Steingold <sds@gnu.org> | ||
| 203 | |||
| 204 | * progmodes/cc-mode.el (cc-mode-cpp-program): New user variable. | ||
| 205 | (cc-create-define-alist): Use it instead of the hard-coded string. | ||
| 206 | |||
| 207 | 2005-04-29 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 208 | |||
| 209 | * international/mule-conf.el (file-coding-system-alist): Fix regexp | ||
| 210 | for latexenc. | ||
| 211 | |||
| 212 | 2005-04-29 Lute Kamstra <lute@gnu.org> | ||
| 213 | |||
| 214 | * emacs-lisp/generic.el: Improve commentary section. | ||
| 215 | (define-generic-mode): Improve docstring. | ||
| 216 | |||
| 217 | 2005-04-29 Carsten Dominik <dominik@science.uva.nl> | ||
| 218 | |||
| 219 | * textmodes/org.el (many places): Change to quiet the byte compiler. | ||
| 220 | (org-prefix-format-compiled): New variable. | ||
| 221 | (org-compile-prefix-format): New function. | ||
| 222 | (org-timeline, org-agenda, org-diary): Call org-compile-prefix-format. | ||
| 223 | (org-agenda-prefix-format,org-timeline-prefix-format): New options. | ||
| 224 | (org-agenda-get-scheduled): Check if file is opened in `org-mode'. | ||
| 225 | (org-get-entries-from-diary): Use `org-get-time-of-day' for | ||
| 226 | consistency with entries from `org-mode' files. | ||
| 227 | (org-get-time-of-day): Fix bug with partial matches early in a line. | ||
| 228 | (org-non-link-chars): New constant. | ||
| 229 | (org-link-regexp): Respect `org-non-link-chars'. | ||
| 230 | (org-agenda-day-view): Remove command. | ||
| 231 | (org-agenda-toggle-week-view): Rename from `org-agenda-week-view'. | ||
| 232 | (org-follow-bbdb-link, org-store-link): Search also company field. | ||
| 233 | (org-highlight-overlay): New variable. | ||
| 234 | (org-highlight, org-unhighlight): New functions. | ||
| 235 | (org-agenda-mode): Add pre-command-hook to remove highlight. | ||
| 236 | (org-evaluate-time-range): Behavior depends upon whether time stamp | ||
| 237 | contains a time or not. | ||
| 238 | (org-show-subtree, org-show-entry): New functions. | ||
| 239 | (org-agenda-cleanup-fancy-diary): Remove empty lines. | ||
| 240 | |||
| 241 | 2005-04-28 Luc Teirlinck <teirllm@auburn.edu> | ||
| 242 | |||
| 243 | * comint.el (comint-output-filter-functions): Add autoload cookie. | ||
| 244 | |||
| 245 | 2005-04-28 Kim F. Storm <storm@cua.dk> | ||
| 246 | |||
| 247 | * ido.el (ido-everywhere): Fix last change. | ||
| 248 | |||
| 249 | 2005-04-28 Arne J,Ax(Brgensen <arne@arnested.dk> | ||
| 250 | |||
| 251 | * international/latexenc.el: New file. | ||
| 252 | * international/mule-conf.el (file-coding-system-alist): For .tex, | ||
| 253 | .ltx, .dtx and .drv extensions, use `latexenc-find-file-coding-system'. | ||
| 254 | |||
| 255 | 2005-04-28 Lute Kamstra <lute@gnu.org> | ||
| 256 | |||
| 257 | * font-lock.el (font-lock-add-keywords) | ||
| 258 | (font-lock-remove-keywords): Clarify docstring. | ||
| 259 | (font-lock-keywords-alist, font-lock-removed-keywords-alist): | ||
| 260 | Don't start docstrings with a `*'. | ||
| 261 | (font-lock-update-removed-keyword-alist): Give it a docstring. | ||
| 262 | |||
| 263 | * generic-x.el: Update commentary section. | ||
| 264 | Only require font-lock when compiling. | ||
| 265 | Define all modes conditionally. | ||
| 266 | Place all generic modes in the generic-x-modes customization group. | ||
| 267 | (generic-x-modes): New customization group. | ||
| 268 | (generic-default-modes, generic-mswindows-modes) | ||
| 269 | (generic-unix-modes, generic-other-modes): New constants. | ||
| 270 | (generic-define-mswindows-modes, generic-define-unix-modes): | ||
| 271 | Update docstrings. Make them obsolete. | ||
| 272 | (generic-extras-enable-list): New default value. Update docstring. | ||
| 273 | Improve :type. Change :set function. | ||
| 274 | (bat-generic-mode-syntax-table, rul-generic-mode-syntax-table): | ||
| 275 | Fix docstring. | ||
| 276 | |||
| 277 | * emacs-lisp/generic.el (generic-mode-internal): | ||
| 278 | Simplify font-lock-defaults. | ||
| 279 | (define-generic-mode): Fix docstring. | ||
| 280 | |||
| 281 | 2005-04-28 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 282 | |||
| 283 | * progmodes/grep.el (grep-mode-font-lock-keywords): Use the | ||
| 284 | font-lock-face property to highlight matches. | ||
| 285 | |||
| 286 | 2005-04-28 Nick Roberts <nickrob@snap.net.nz> | ||
| 287 | |||
| 288 | * progmodes/cc-mode.el: (cc-create-define-alist): New function. | ||
| 289 | (cc-define-alist): New variable. | ||
| 290 | (c-mode): Make it local and initialise it. | ||
| 291 | |||
| 292 | * progmodes/gdb-ui.el (gdb-active-process): New variable. | ||
| 293 | (gdb-exited): New function. | ||
| 294 | (gdb-annotation-rules): Use it. | ||
| 295 | (gdb-starting): Set gdb-active-process to t. | ||
| 296 | (gdb-stopping): Amend doc string. | ||
| 297 | (gdb-reset): Set gdb-active-process to nil. | ||
| 298 | |||
| 299 | * tooltip.el (tooltip-gud-tips): Show the associated #define | ||
| 300 | directives when a C program under GDB is not executing. | ||
| 301 | |||
| 302 | 2005-04-27 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 303 | |||
| 304 | * progmodes/cperl-mode.el (cperl-mode): Don't precompile the | ||
| 305 | font-lock-fontify-syntactic-keywords. | ||
| 306 | |||
| 307 | * font-lock.el (font-lock-default-fontify-region): Don't force | ||
| 308 | parse-sexp-lookup-properties to nil. | ||
| 309 | |||
| 310 | 2005-04-27 Alexander Klimov <alserkli@inbox.ru> (tiny change) | ||
| 311 | |||
| 312 | * man.el (man-mode-syntax-table): Set up `:' to have | ||
| 313 | word-constituent syntax. | ||
| 314 | |||
| 315 | 2005-04-27 Lute Kamstra <lute@gnu.org> | ||
| 316 | |||
| 317 | * novice.el (disable-command): Don't add spurious newlines to the | ||
| 318 | init file. Reported by Dan Jacobson <jidanni@jidanni.org>. | ||
| 319 | |||
| 320 | 2005-04-26 Jay Belanger <belanger@truman.edu> | ||
| 321 | |||
| 322 | * calc/calc-yank.el (calc-edit-finish): Make sure there is more | ||
| 323 | than one window before deleting window. | ||
| 324 | |||
| 325 | 2005-04-26 Luc Teirlinck <teirllm@auburn.edu> | ||
| 326 | |||
| 327 | * shell.el (shell-prompt-pattern): Doc fix. | ||
| 328 | (shell-mode): Set paragraph-separate buffer locally to "\\'". | ||
| 329 | |||
| 330 | * comint.el (comint-prompt-regexp, comint-get-old-input) | ||
| 331 | (comint-use-prompt-regexp) | ||
| 332 | (comint-use-prompt-regexp-instead-of-fields) | ||
| 333 | (comint-replace-by-expanded-history, comint-send-input) | ||
| 334 | (comint-output-filter, comint-get-old-input-default) | ||
| 335 | (comint-line-beginning-position, comint-bol, comint-show-output) | ||
| 336 | (comint-backward-matching-input, comint-forward-matching-input) | ||
| 337 | (comint-next-prompt, comint-previous-prompt): | ||
| 338 | Rename `comint-use-prompt-regexp-instead-of-fields' to | ||
| 339 | `comint-use-prompt-regexp'. Keep old name as alias and declare | ||
| 340 | obsolete. | ||
| 341 | (comint-use-prompt-regexp): Shorten first line of doc string. | ||
| 342 | |||
| 343 | * ielm.el (inferior-emacs-lisp-mode): Adapt to above name change. | ||
| 344 | Set paragraph-separate buffer locally to "\\'". | ||
| 345 | |||
| 346 | * hippie-exp.el (try-expand-line, try-expand-line-all-buffers): | ||
| 347 | Adapt to above name change. | ||
| 348 | |||
| 349 | * net/net-utils.el (nslookup-prompt-regexp, ftp-prompt-regexp) | ||
| 350 | (smbclient-prompt-regexp): Ditto. | ||
| 351 | |||
| 352 | * progmodes/inf-lisp.el (inferior-lisp-prompt): Ditto. | ||
| 353 | |||
| 354 | 2005-04-27 Nick Roberts <nickrob@snap.net.nz> | ||
| 355 | |||
| 356 | * progmodes/gdb-ui.el (gdb-location-alist): Rename from | ||
| 357 | gdb-location-list. | ||
| 358 | Break lines that are over 80 characters wide. | ||
| 359 | |||
| 360 | 2005-04-26 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 361 | |||
| 362 | * pcvs-info.el (cvs-fileinfo->full-path, cvs-display-full-path): | ||
| 363 | New fun and var, to preserve compatibility. | ||
| 364 | |||
| 365 | * pcvs.el, pcvs-info.el: Rename "full-path" -> "full-name". | ||
| 366 | |||
| 367 | 2005-04-26 Dominique de Waleffe <ddw@missioncriticalit.com> (tiny change) | ||
| 368 | |||
| 369 | * pcvs-info.el (cvs-fileinfo->backup-file): Don't pass the full file | ||
| 370 | name to file-newer-than-file-p. | ||
| 371 | |||
| 372 | 2005-04-26 Richard M. Stallman <rms@gnu.org> | ||
| 373 | |||
| 374 | * simple.el (line-move-1): Avoid using vertical-motion in easy cases. | ||
| 375 | |||
| 376 | * progmodes/python.el (python-mode): | ||
| 377 | Use new name eldoc-documentation-function. | ||
| 378 | |||
| 379 | * hexl.el (hexl-mode): Use new name eldoc-documentation-function. | ||
| 380 | |||
| 381 | * emacs-lisp/eldoc.el (eldoc-mode): Doc fix. | ||
| 382 | (eldoc-documentation-function): | ||
| 383 | Rename from eldoc-print-current-symbol-info-function. Calls changed. | ||
| 384 | |||
| 385 | 2005-04-26 Nick Roberts <nickrob@snap.net.nz> | ||
| 386 | |||
| 387 | * emacs-lisp/byte-run.el (define-obsolete-function-alias): New macro. | ||
| 388 | |||
| 389 | 2005-04-25 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 390 | |||
| 391 | * term/xterm.el (function-key-map): Fix strings for | ||
| 392 | {C,S,A,C-S}-f[1-4]. Use substitute-key-definition to bind | ||
| 393 | {C,S,A,C-S}-{f1-f12}. | ||
| 394 | |||
| 395 | 2005-04-26 Kenichi Handa <handa@m17n.org> | ||
| 396 | |||
| 397 | * international/mule-cmds.el (select-safe-coding-system): | ||
| 398 | Fix previous change. | ||
| 399 | |||
| 400 | 2005-04-26 Lute Kamstra <lute@gnu.org> | ||
| 401 | |||
| 402 | * emacs-lisp/easy-mmode.el (define-minor-mode): Fix docstring. | ||
| 403 | |||
| 404 | * font-lock.el (font-lock-fontify-region-function): Fix docstring. | ||
| 405 | (font-lock-comment-delimiter-face): Ditto. | ||
| 406 | |||
| 407 | * calc/calc.el (calc-trail-mode): Don't set font-lock-defaults. | ||
| 408 | |||
| 409 | 2005-04-25 Jay Belanger <belanger@truman.edu> | ||
| 410 | |||
| 411 | * calc/calc-help.el (calc-view-news): Let-bind inhibit-read-only | ||
| 412 | to t while inserting information; use help-mode. | ||
| 413 | |||
| 414 | 2005-04-25 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 415 | |||
| 416 | * term.el (ansi-term-color-vector): Use the xterm colors. | ||
| 417 | (term-raw-map): Don't add mappings for \eO and \e[. Map deletechar. | ||
| 418 | |||
| 419 | 2005-04-25 Lute Kamstra <lute@gnu.org> | ||
| 420 | |||
| 421 | * font-core.el (font-lock-defaults): Fix docstring. | ||
| 422 | |||
| 423 | * font-lock.el (font-lock-syntactic-face-function): Fix docstring. | ||
| 424 | |||
| 425 | 2005-04-25 Kenichi Handa <handa@m17n.org> | ||
| 426 | |||
| 427 | * international/mule-cmds.el (select-safe-coding-system): | ||
| 428 | Don't check consistency with coding: spec, etc if raw-text or | ||
| 429 | no-conversion was found to be safe. | ||
| 430 | |||
| 431 | 2005-04-24 Richard M. Stallman <rms@gnu.org> | ||
| 432 | |||
| 433 | * mail/sendmail.el (mail-font-lock-keywords): Match any number of | ||
| 434 | citation markers at start of each line. | ||
| 435 | |||
| 436 | * mail/rmail.el (rmail-font-lock-keywords): Match any number of | ||
| 437 | citation markers at start of each line. | ||
| 438 | |||
| 439 | * font-lock.el (font-lock-comment-delimiter-face): Doc fix. | ||
| 440 | |||
| 441 | * files.el (mode-require-final-newline): Fix previous change. | ||
| 442 | (require-final-newline): Fix type label. | ||
| 443 | |||
| 444 | 2005-04-24 Glenn Morris <gmorris@ast.cam.ac.uk> | ||
| 445 | |||
| 446 | * progmodes/f90.el (f90-calculate-indent): Fix treatment of first | ||
| 447 | statement in buffer (broken by 2004-11-24 change). | ||
| 448 | |||
| 449 | 2005-04-24 Kim F. Storm <storm@cua.dk> | ||
| 450 | |||
| 451 | * ido.el (ido-everywhere): Save and restore old read-buffer-function | ||
| 452 | and read-file-name-function values. Don't overwrite existing | ||
| 453 | non-nil values if ido-mode is enabled without ido-everywhere. | ||
| 454 | |||
| 455 | 2005-04-24 Luc Teirlinck <teirllm@auburn.edu> | ||
| 456 | |||
| 457 | * files.el (mode-require-final-newline): Minor doc fix. | ||
| 458 | |||
| 459 | 2005-04-24 Eli Zaretskii <eliz@gnu.org> | ||
| 460 | |||
| 461 | * subr.el (syntax-after): Doc fix. | ||
| 462 | (syntax-class): If argument is nil, return nil. Mask off upper 16 | ||
| 463 | bits, not 8 bits. | ||
| 464 | |||
| 465 | * files.el (mode-require-final-newline): Doc fix. | ||
| 466 | (backup-buffer-copy): Fix last change. | ||
| 467 | |||
| 468 | 2005-04-24 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 469 | |||
| 470 | * term/mac-win.el: Require select. Set selection-coding-system to | ||
| 471 | mac-system-coding-system. Call menu-bar-enable-clipboard. | ||
| 472 | (x-last-selected-text-clipboard, x-last-selected-text-primary) | ||
| 473 | (x-select-enable-clipboard): New variables. | ||
| 474 | (x-select-text, x-get-selection, x-selection-value) | ||
| 475 | (x-get-selection-value, mac-select-convert-to-string) | ||
| 476 | (mac-services-open-file, mac-services-open-selection) | ||
| 477 | (mac-services-insert-text): New functions. | ||
| 478 | (CLIPBOARD, FIND): Put mac-scrap-name property. | ||
| 479 | (com.apple.traditional-mac-plain-text, public.utf16-plain-text) | ||
| 480 | (public.tiff): Put mac-ostype property. | ||
| 481 | (selection-converter-alist): Add entries for them. | ||
| 482 | (mac-application-menu-map): New keymap. | ||
| 483 | (interprogram-cut-function, interprogram-paste-function): Set to | ||
| 484 | x-select-text and x-get-selection-value, respectively. | ||
| 485 | (split-window-keep-point): Set to t. | ||
| 486 | |||
| 487 | 2005-04-23 Richard M. Stallman <rms@gnu.org> | ||
| 488 | |||
| 489 | * files.el (read-directory-name): Always pass non-nil | ||
| 490 | DEFAULT-FILENAME arg to read-file-name. | ||
| 491 | (backup-buffer-copy, basic-save-buffer-2): Take care against | ||
| 492 | writing thru an unexpected existing symlink. | ||
| 493 | (revert-buffer): In indirect buffer, revert the base buffer. | ||
| 494 | (magic-mode-alist): Doc fix. | ||
| 495 | (buffer-stale-function): Doc fix. | ||
| 496 | (minibuffer-with-setup-hook): Avoid warning. | ||
| 497 | (mode-require-final-newline): Doc and custom fix. | ||
| 498 | |||
| 499 | * follow.el (follow-end-of-buffer): Use with-no-warnings. | ||
| 500 | |||
| 501 | * font-lock.el (font-lock-comment-face): On terminals with few colors, | ||
| 502 | use the default appearance. | ||
| 503 | (font-lock-comment-delimiter-face): New face, new variable. | ||
| 504 | |||
| 505 | * imenu.el (imenu--generic-function): The official position of a | ||
| 506 | definition is the start of the line that BEG is in. | ||
| 507 | |||
| 508 | * midnight.el (midnight-timer): Move defvar up. | ||
| 509 | |||
| 510 | * mouse.el (mouse-drag-region-1): Delete some debugging code. | ||
| 511 | |||
| 512 | * saveplace.el (save-place-to-alist): Use with-no-warnings. | ||
| 513 | |||
| 514 | * startup.el (command-line): Use with-no-warnings. | ||
| 515 | |||
| 516 | * window.el (window-size-fixed): New defvar. | ||
| 517 | |||
| 518 | * emacs-lisp/easymenu.el (easy-menu-do-define): Use defalias, not fset. | ||
| 519 | |||
| 520 | * mail/rmail.el (rmail-font-lock-keywords): | ||
| 521 | Use font-lock-comment-delimiter-face. | ||
| 522 | |||
| 523 | * mail/sendmail.el (mail-font-lock-keywords): | ||
| 524 | Use font-lock-comment-delimiter-face. | ||
| 525 | |||
| 526 | * progmodes/compile.el (next-error-highlight-timer): New defvar. | ||
| 527 | |||
| 528 | 2005-04-23 SAITO Takuya <tabmore@rivo.mediatti.net> (tiny change) | ||
| 529 | |||
| 530 | * progmodes/compile.el (compilation-mode-font-lock-keywords): | ||
| 531 | Specify t for LAXMATCH when matching directories. | ||
| 532 | Save match data around compilation-compat-error-properties form. | ||
| 533 | |||
| 534 | 2005-04-23 David Kastrup <dak@gnu.org> | ||
| 535 | |||
| 536 | * textmodes/tex-mode.el (TeX-mode, plain-TeX-mode, LaTeX-mode): | ||
| 537 | Mention that the autoloaded aliases should be kept for AUCTeX. | ||
| 538 | |||
| 539 | 2005-04-23 Andreas Schwab <schwab@suse.de> | ||
| 540 | |||
| 541 | * isearch.el (isearch-forward): Doc fix. | ||
| 542 | |||
| 543 | 2005-04-23 Eli Zaretskii <eliz@gnu.org> | ||
| 544 | |||
| 545 | * jit-lock.el (jit-lock-stealth-time): Change default value to 16. | ||
| 546 | (jit-lock-stealth-nice): Change default value to 0.5. | ||
| 547 | |||
| 548 | 2005-04-23 Eric Hanchrow <offby1@blarg.net> (tiny change) | ||
| 549 | |||
| 550 | * abbrev.el (write-abbrev-file): Write table entries in | ||
| 551 | alphabetical order by table name. | ||
| 552 | |||
| 553 | 2005-04-22 Kim F. Storm <storm@cua.dk> | ||
| 554 | |||
| 555 | * ido.el (ido-read-internal): Fix `list' completion. | ||
| 556 | |||
| 557 | 2005-04-22 Kenichi Handa <handa@m17n.org> | ||
| 558 | |||
| 559 | * recentf.el (recentf-save-file-coding-system): New variable. | ||
| 560 | (recentf-save-list): Encode the file by | ||
| 561 | recentf-save-file-coding-system and add coding: tag. | ||
| 562 | |||
| 563 | 2005-04-22 Nick Roberts <nickrob@snap.net.nz> | ||
| 564 | |||
| 565 | * emacs-lisp/byte-run.el (define-obsolete-variable-alias): New macro. | ||
| 566 | |||
| 567 | 2005-04-21 Lute Kamstra <lute@gnu.org> | ||
| 568 | |||
| 569 | * loadhist.el (unload-feature): Don't remove a function from hooks | ||
| 570 | if it is about to be restored to an autoload . Remove functions | ||
| 571 | that will become unbound from auto-mode-alist. Simplify the code. | ||
| 572 | |||
| 573 | * subr.el (assq-delete-all): New implementation that is linear, | ||
| 574 | not quadratic. Suggested by David Kastrup <dak@gnu.org>. | ||
| 575 | (rassq-delete-all): New function. | ||
| 576 | |||
| 577 | * menu-bar.el (menu-bar-options-save, menu-bar-showhide-menu): | ||
| 578 | Add size-indication-mode. | ||
| 579 | |||
| 1 | 2005-04-21 Kenichi Handa <handa@m17n.org> | 580 | 2005-04-21 Kenichi Handa <handa@m17n.org> |
| 2 | 581 | ||
| 3 | * international/mule-cmds.el: Add autoload for widget-value in | 582 | * international/mule-cmds.el: Add autoload for widget-value in |
| 4 | eval-when-compile | 583 | eval-when-compile. |
| 5 | 584 | ||
| 6 | 2005-04-21 Nick Roberts <nickrob@snap.net.nz> | 585 | 2005-04-21 Nick Roberts <nickrob@snap.net.nz> |
| 7 | 586 | ||
| 8 | * menu-bar.el (menu-bar-options-save, menu-bar-showhide-menu): | 587 | * menu-bar.el (menu-bar-options-save, menu-bar-showhide-menu): |
| 9 | Add tooltip-mode. | 588 | Add tooltip-mode. |
| 10 | 589 | ||
| 11 | * bindings.el (mode-line-mode-menu): Remove tooltip-mode. | 590 | * bindings.el (mode-line-mode-menu): Remove tooltip-mode. |
| @@ -372,8 +951,8 @@ | |||
| 372 | 2005-04-11 Rajesh Vaidheeswarran <rv@gnu.org> | 951 | 2005-04-11 Rajesh Vaidheeswarran <rv@gnu.org> |
| 373 | 952 | ||
| 374 | * whitespace.el (whitespace-buffer-leading) | 953 | * whitespace.el (whitespace-buffer-leading) |
| 375 | (whitespace-buffer-trailing): Revert the incorrect test | 954 | (whitespace-buffer-trailing): Revert the incorrect test inversion. |
| 376 | inversion. However, fix the highlight area for the leading and | 955 | However, fix the highlight area for the leading and |
| 377 | trailing whitespaces to show space. | 956 | trailing whitespaces to show space. |
| 378 | 957 | ||
| 379 | 2005-04-11 Rajesh Vaidheeswarran <rv@gnu.org> | 958 | 2005-04-11 Rajesh Vaidheeswarran <rv@gnu.org> |
diff --git a/lisp/abbrev.el b/lisp/abbrev.el index aa4249d014e..711e8e2ebe9 100644 --- a/lisp/abbrev.el +++ b/lisp/abbrev.el | |||
| @@ -92,11 +92,11 @@ Mark is set after the inserted text." | |||
| 92 | (interactive) | 92 | (interactive) |
| 93 | (push-mark | 93 | (push-mark |
| 94 | (save-excursion | 94 | (save-excursion |
| 95 | (let ((tables abbrev-table-name-list)) | 95 | (let ((tables abbrev-table-name-list)) |
| 96 | (while tables | 96 | (while tables |
| 97 | (insert-abbrev-table-description (car tables) t) | 97 | (insert-abbrev-table-description (car tables) t) |
| 98 | (setq tables (cdr tables)))) | 98 | (setq tables (cdr tables)))) |
| 99 | (point)))) | 99 | (point)))) |
| 100 | 100 | ||
| 101 | (defun list-abbrevs (&optional local) | 101 | (defun list-abbrevs (&optional local) |
| 102 | "Display a list of defined abbrevs. | 102 | "Display a list of defined abbrevs. |
| @@ -168,23 +168,23 @@ the ones defined from the buffer now." | |||
| 168 | (interactive "P") | 168 | (interactive "P") |
| 169 | (if arg (kill-all-abbrevs)) | 169 | (if arg (kill-all-abbrevs)) |
| 170 | (save-excursion | 170 | (save-excursion |
| 171 | (goto-char (point-min)) | 171 | (goto-char (point-min)) |
| 172 | (while (and (not (eobp)) (re-search-forward "^(" nil t)) | 172 | (while (and (not (eobp)) (re-search-forward "^(" nil t)) |
| 173 | (let* ((buf (current-buffer)) | 173 | (let* ((buf (current-buffer)) |
| 174 | (table (read buf)) | 174 | (table (read buf)) |
| 175 | abbrevs name hook exp count sys) | 175 | abbrevs name hook exp count sys) |
| 176 | (forward-line 1) | 176 | (forward-line 1) |
| 177 | (while (progn (forward-line 1) | 177 | (while (progn (forward-line 1) |
| 178 | (not (eolp))) | 178 | (not (eolp))) |
| 179 | (setq name (read buf) count (read buf)) | 179 | (setq name (read buf) count (read buf)) |
| 180 | (if (equal count '(sys)) | 180 | (if (equal count '(sys)) |
| 181 | (setq sys t count (read buf))) | 181 | (setq sys t count (read buf))) |
| 182 | (setq exp (read buf)) | 182 | (setq exp (read buf)) |
| 183 | (skip-chars-backward " \t\n\f") | 183 | (skip-chars-backward " \t\n\f") |
| 184 | (setq hook (if (not (eolp)) (read buf))) | 184 | (setq hook (if (not (eolp)) (read buf))) |
| 185 | (skip-chars-backward " \t\n\f") | 185 | (skip-chars-backward " \t\n\f") |
| 186 | (setq abbrevs (cons (list name exp hook count sys) abbrevs))) | 186 | (setq abbrevs (cons (list name exp hook count sys) abbrevs))) |
| 187 | (define-abbrev-table table abbrevs))))) | 187 | (define-abbrev-table table abbrevs))))) |
| 188 | 188 | ||
| 189 | (defun read-abbrev-file (&optional file quietly) | 189 | (defun read-abbrev-file (&optional file quietly) |
| 190 | "Read abbrev definitions from file written with `write-abbrev-file'. | 190 | "Read abbrev definitions from file written with `write-abbrev-file'. |
| @@ -201,7 +201,7 @@ Optional second argument QUIETLY non-nil means don't display a message." | |||
| 201 | Optional argument FILE is the name of the file to read; | 201 | Optional argument FILE is the name of the file to read; |
| 202 | it defaults to the value of `abbrev-file-name'. | 202 | it defaults to the value of `abbrev-file-name'. |
| 203 | Does not display any message." | 203 | Does not display any message." |
| 204 | ;(interactive "fRead abbrev file: ") | 204 | ;(interactive "fRead abbrev file: ") |
| 205 | (read-abbrev-file file t)) | 205 | (read-abbrev-file file t)) |
| 206 | 206 | ||
| 207 | (defun write-abbrev-file (&optional file) | 207 | (defun write-abbrev-file (&optional file) |
| @@ -221,7 +221,17 @@ specified in `abbrev-file-name' is used." | |||
| 221 | (let ((coding-system-for-write 'emacs-mule)) | 221 | (let ((coding-system-for-write 'emacs-mule)) |
| 222 | (with-temp-file file | 222 | (with-temp-file file |
| 223 | (insert ";;-*-coding: emacs-mule;-*-\n") | 223 | (insert ";;-*-coding: emacs-mule;-*-\n") |
| 224 | (dolist (table abbrev-table-name-list) | 224 | (dolist (table |
| 225 | ;; We sort the table in order to ease the automatic | ||
| 226 | ;; merging of different versions of the user's abbrevs | ||
| 227 | ;; file. This is useful, for example, for when the | ||
| 228 | ;; user keeps their home directory in a revision | ||
| 229 | ;; control system, and is therefore keeping multiple | ||
| 230 | ;; slightly-differing copies loosely synchronized. | ||
| 231 | (sort (copy-sequence abbrev-table-name-list) | ||
| 232 | (lambda (s1 s2) | ||
| 233 | (string< (symbol-name s1) | ||
| 234 | (symbol-name s2))))) | ||
| 225 | (insert-abbrev-table-description table nil))))) | 235 | (insert-abbrev-table-description table nil))))) |
| 226 | 236 | ||
| 227 | (defun add-mode-abbrev (arg) | 237 | (defun add-mode-abbrev (arg) |
diff --git a/lisp/allout.el b/lisp/allout.el index 4b1c152b6b1..6fb81f9f6f7 100644 --- a/lisp/allout.el +++ b/lisp/allout.el | |||
| @@ -3975,18 +3975,16 @@ need not be quoted in `allout-new-exposure'. | |||
| 3975 | 3975 | ||
| 3976 | Cursor is left at start position. | 3976 | Cursor is left at start position. |
| 3977 | 3977 | ||
| 3978 | Use this instead of obsolete `allout-exposure'. | ||
| 3979 | |||
| 3980 | Examples: | 3978 | Examples: |
| 3981 | \(allout-exposure (-1 () () () 1) 0) | 3979 | \(allout-new-exposure (-1 () () () 1) 0) |
| 3982 | Close current topic at current level so only the immediate | 3980 | Close current topic at current level so only the immediate |
| 3983 | subtopics are shown, except also show the children of the | 3981 | subtopics are shown, except also show the children of the |
| 3984 | third subtopic; and close the next topic at the current level. | 3982 | third subtopic; and close the next topic at the current level. |
| 3985 | \(allout-exposure : -1 0) | 3983 | \(allout-new-exposure : -1 0) |
| 3986 | Close all topics at current level to expose only their | 3984 | Close all topics at current level to expose only their |
| 3987 | immediate children, except for the last topic at the current | 3985 | immediate children, except for the last topic at the current |
| 3988 | level, in which even its immediate children are hidden. | 3986 | level, in which even its immediate children are hidden. |
| 3989 | \(allout-exposure -2 : -1 *) | 3987 | \(allout-new-exposure -2 : -1 *) |
| 3990 | Expose children and grandchildren of first topic at current | 3988 | Expose children and grandchildren of first topic at current |
| 3991 | level, and expose children of subsequent topics at current | 3989 | level, and expose children of subsequent topics at current |
| 3992 | level *except* for the last, which should be opened completely." | 3990 | level *except* for the last, which should be opened completely." |
| @@ -3995,17 +3993,6 @@ Examples: | |||
| 3995 | (allout-next-heading))) | 3993 | (allout-next-heading))) |
| 3996 | (error "allout-new-exposure: Can't find any outline topics")) | 3994 | (error "allout-new-exposure: Can't find any outline topics")) |
| 3997 | (list 'allout-expose-topic (list 'quote spec)))) | 3995 | (list 'allout-expose-topic (list 'quote spec)))) |
| 3998 | ;;;_ > allout-exposure '() | ||
| 3999 | (defmacro allout-exposure (&rest spec) | ||
| 4000 | "Literal frontend for `allout-old-expose-topic', doesn't evaluate arguments | ||
| 4001 | and retains start position." | ||
| 4002 | (list 'save-excursion | ||
| 4003 | '(if (not (or (allout-goto-prefix) | ||
| 4004 | (allout-next-heading))) | ||
| 4005 | (error "Can't find any outline topics")) | ||
| 4006 | (cons 'allout-old-expose-topic | ||
| 4007 | (mapcar (function (lambda (x) (list 'quote x))) spec)))) | ||
| 4008 | (make-obsolete 'allout-exposure 'allout-new-exposure "19.23") | ||
| 4009 | 3996 | ||
| 4010 | ;;;_ #7 Systematic outline presentation - copying, printing, flattening | 3997 | ;;;_ #7 Systematic outline presentation - copying, printing, flattening |
| 4011 | 3998 | ||
diff --git a/lisp/calc/calc-aent.el b/lisp/calc/calc-aent.el index a2d6e9dc88c..b947b597acf 100644 --- a/lisp/calc/calc-aent.el +++ b/lisp/calc/calc-aent.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; calc-aent.el --- algebraic entry functions for Calc | 1 | ;;; calc-aent.el --- algebraic entry functions for Calc |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2005 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Dave Gillespie <daveg@synaptics.com> | 5 | ;; Author: Dave Gillespie <daveg@synaptics.com> |
| 6 | ;; Maintainer: Jay Belanger <belanger@truman.edu> | 6 | ;; Maintainer: Jay Belanger <belanger@truman.edu> |
| @@ -734,7 +734,7 @@ in Calc algebraic input.") | |||
| 734 | math-exp-pos (match-end 1)) | 734 | math-exp-pos (match-end 1)) |
| 735 | (if (eq (string-match "\\$\\([1-9][0-9]*\\)" math-exp-str math-exp-pos) | 735 | (if (eq (string-match "\\$\\([1-9][0-9]*\\)" math-exp-str math-exp-pos) |
| 736 | math-exp-pos) | 736 | math-exp-pos) |
| 737 | (setq math-expr-data (- (string-to-int (math-match-substring | 737 | (setq math-expr-data (- (string-to-number (math-match-substring |
| 738 | math-exp-str 1)))) | 738 | math-exp-str 1)))) |
| 739 | (string-match "\\$+" math-exp-str math-exp-pos) | 739 | (string-match "\\$+" math-exp-str math-exp-pos) |
| 740 | (setq math-expr-data (- (match-end 0) (match-beginning 0)))) | 740 | (setq math-expr-data (- (match-end 0) (match-beginning 0)))) |
| @@ -743,7 +743,7 @@ in Calc algebraic input.") | |||
| 743 | ((eq ch ?\#) | 743 | ((eq ch ?\#) |
| 744 | (if (eq (string-match "#\\([1-9][0-9]*\\)" math-exp-str math-exp-pos) | 744 | (if (eq (string-match "#\\([1-9][0-9]*\\)" math-exp-str math-exp-pos) |
| 745 | math-exp-pos) | 745 | math-exp-pos) |
| 746 | (setq math-expr-data (string-to-int | 746 | (setq math-expr-data (string-to-number |
| 747 | (math-match-substring math-exp-str 1)) | 747 | (math-match-substring math-exp-str 1)) |
| 748 | math-exp-pos (match-end 0)) | 748 | math-exp-pos (match-end 0)) |
| 749 | (setq math-expr-data 1 | 749 | (setq math-expr-data 1 |
diff --git a/lisp/calc/calc-bin.el b/lisp/calc/calc-bin.el index e960220c09b..445f9d28531 100644 --- a/lisp/calc/calc-bin.el +++ b/lisp/calc/calc-bin.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; calc-bin.el --- binary functions for Calc | 1 | ;;; calc-bin.el --- binary functions for Calc |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2005 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: David Gillespie <daveg@synaptics.com> | 5 | ;; Author: David Gillespie <daveg@synaptics.com> |
| 6 | ;; Maintainer: Jay Belanger <belanger@truman.edu> | 6 | ;; Maintainer: Jay Belanger <belanger@truman.edu> |
| @@ -135,7 +135,7 @@ | |||
| 135 | (if (equal n "") | 135 | (if (equal n "") |
| 136 | calc-word-size | 136 | calc-word-size |
| 137 | (if (string-match "\\`[-+]?[0-9]+\\'" n) | 137 | (if (string-match "\\`[-+]?[0-9]+\\'" n) |
| 138 | (string-to-int n) | 138 | (string-to-number n) |
| 139 | (error "Expected an integer"))) | 139 | (error "Expected an integer"))) |
| 140 | (prefix-numeric-value n))) | 140 | (prefix-numeric-value n))) |
| 141 | (or (= n calc-word-size) | 141 | (or (= n calc-word-size) |
diff --git a/lisp/calc/calc-ext.el b/lisp/calc/calc-ext.el index d4d50d64658..df9f9512aaa 100644 --- a/lisp/calc/calc-ext.el +++ b/lisp/calc/calc-ext.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; calc-ext.el --- various extension functions for Calc | 1 | ;;; calc-ext.el --- various extension functions for Calc |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2004 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2004, 2005 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: David Gillespie <daveg@synaptics.com> | 5 | ;; Author: David Gillespie <daveg@synaptics.com> |
| 6 | ;; Maintainer: Jay Belanger <belanger@truman.edu> | 6 | ;; Maintainer: Jay Belanger <belanger@truman.edu> |
| @@ -2815,7 +2815,7 @@ calc-kill calc-kill-region calc-yank)))) | |||
| 2815 | 2815 | ||
| 2816 | ;; Integer+fraction with explicit radix | 2816 | ;; Integer+fraction with explicit radix |
| 2817 | ((string-match "^\\([0-9]+\\)\\(#\\|\\^\\^\\)\\([0-9a-zA-Z]*\\)[:/]\\([0-9a-zA-Z]*\\)[:/]\\([0-9a-zA-Z]\\)$" s) | 2817 | ((string-match "^\\([0-9]+\\)\\(#\\|\\^\\^\\)\\([0-9a-zA-Z]*\\)[:/]\\([0-9a-zA-Z]*\\)[:/]\\([0-9a-zA-Z]\\)$" s) |
| 2818 | (let ((radix (string-to-int (math-match-substring s 1))) | 2818 | (let ((radix (string-to-number (math-match-substring s 1))) |
| 2819 | (int (math-match-substring s 3)) | 2819 | (int (math-match-substring s 3)) |
| 2820 | (num (math-match-substring s 4)) | 2820 | (num (math-match-substring s 4)) |
| 2821 | (den (math-match-substring s 5))) | 2821 | (den (math-match-substring s 5))) |
| @@ -2829,7 +2829,7 @@ calc-kill calc-kill-region calc-yank)))) | |||
| 2829 | 2829 | ||
| 2830 | ;; Fraction with explicit radix | 2830 | ;; Fraction with explicit radix |
| 2831 | ((string-match "^\\([0-9]+\\)\\(#\\|\\^\\^\\)\\([0-9a-zA-Z]*\\)[:/]\\([0-9a-zA-Z]*\\)$" s) | 2831 | ((string-match "^\\([0-9]+\\)\\(#\\|\\^\\^\\)\\([0-9a-zA-Z]*\\)[:/]\\([0-9a-zA-Z]*\\)$" s) |
| 2832 | (let ((radix (string-to-int (math-match-substring s 1))) | 2832 | (let ((radix (string-to-number (math-match-substring s 1))) |
| 2833 | (num (math-match-substring s 3)) | 2833 | (num (math-match-substring s 3)) |
| 2834 | (den (math-match-substring s 4))) | 2834 | (den (math-match-substring s 4))) |
| 2835 | (let ((num (if (> (length num) 0) (math-read-radix num radix) 1)) | 2835 | (let ((num (if (> (length num) 0) (math-read-radix num radix) 1)) |
| @@ -2839,7 +2839,7 @@ calc-kill calc-kill-region calc-yank)))) | |||
| 2839 | ;; Float with explicit radix and exponent | 2839 | ;; Float with explicit radix and exponent |
| 2840 | ((or (string-match "^0*\\(\\([2-9]\\|1[0-4]\\)\\(#\\|\\^\\^\\)[0-9a-dA-D.]+\\)[eE]\\([-+]?[0-9]+\\)$" s) | 2840 | ((or (string-match "^0*\\(\\([2-9]\\|1[0-4]\\)\\(#\\|\\^\\^\\)[0-9a-dA-D.]+\\)[eE]\\([-+]?[0-9]+\\)$" s) |
| 2841 | (string-match "^\\(\\([0-9]+\\)\\(#\\|\\^\\^\\)[0-9a-zA-Z.]+\\) *\\* *\\2\\.? *\\^ *\\([-+]?[0-9]+\\)$" s)) | 2841 | (string-match "^\\(\\([0-9]+\\)\\(#\\|\\^\\^\\)[0-9a-zA-Z.]+\\) *\\* *\\2\\.? *\\^ *\\([-+]?[0-9]+\\)$" s)) |
| 2842 | (let ((radix (string-to-int (math-match-substring s 2))) | 2842 | (let ((radix (string-to-number (math-match-substring s 2))) |
| 2843 | (mant (math-match-substring s 1)) | 2843 | (mant (math-match-substring s 1)) |
| 2844 | (exp (math-match-substring s 4))) | 2844 | (exp (math-match-substring s 4))) |
| 2845 | (let ((mant (math-read-number mant)) | 2845 | (let ((mant (math-read-number mant)) |
| @@ -2849,7 +2849,7 @@ calc-kill calc-kill-region calc-yank)))) | |||
| 2849 | 2849 | ||
| 2850 | ;; Float with explicit radix, no exponent | 2850 | ;; Float with explicit radix, no exponent |
| 2851 | ((string-match "^\\([0-9]+\\)\\(#\\|\\^\\^\\)\\([0-9a-zA-Z]*\\)\\.\\([0-9a-zA-Z]*\\)$" s) | 2851 | ((string-match "^\\([0-9]+\\)\\(#\\|\\^\\^\\)\\([0-9a-zA-Z]*\\)\\.\\([0-9a-zA-Z]*\\)$" s) |
| 2852 | (let ((radix (string-to-int (math-match-substring s 1))) | 2852 | (let ((radix (string-to-number (math-match-substring s 1))) |
| 2853 | (int (math-match-substring s 3)) | 2853 | (int (math-match-substring s 3)) |
| 2854 | (fracs (math-match-substring s 4))) | 2854 | (fracs (math-match-substring s 4))) |
| 2855 | (let ((int (if (> (length int) 0) (math-read-radix int radix) 0)) | 2855 | (let ((int (if (> (length int) 0) (math-read-radix int radix) 0)) |
| @@ -2861,7 +2861,7 @@ calc-kill calc-kill-region calc-yank)))) | |||
| 2861 | ;; Integer with explicit radix | 2861 | ;; Integer with explicit radix |
| 2862 | ((string-match "^\\([0-9]+\\)\\(#\\|\\^\\^\\)\\([0-9a-zA-Z]+\\)$" s) | 2862 | ((string-match "^\\([0-9]+\\)\\(#\\|\\^\\^\\)\\([0-9a-zA-Z]+\\)$" s) |
| 2863 | (math-read-radix (math-match-substring s 3) | 2863 | (math-read-radix (math-match-substring s 3) |
| 2864 | (string-to-int (math-match-substring s 1)))) | 2864 | (string-to-number (math-match-substring s 1)))) |
| 2865 | 2865 | ||
| 2866 | ;; C language hexadecimal notation | 2866 | ;; C language hexadecimal notation |
| 2867 | ((and (eq calc-language 'c) | 2867 | ((and (eq calc-language 'c) |
diff --git a/lisp/calc/calc-forms.el b/lisp/calc/calc-forms.el index 4870891231a..10e4793c7a5 100644 --- a/lisp/calc/calc-forms.el +++ b/lisp/calc/calc-forms.el | |||
| @@ -39,9 +39,9 @@ | |||
| 39 | (calc-enter-result 0 "time" | 39 | (calc-enter-result 0 "time" |
| 40 | (list 'mod | 40 | (list 'mod |
| 41 | (list 'hms | 41 | (list 'hms |
| 42 | (string-to-int (substring time 11 13)) | 42 | (string-to-number (substring time 11 13)) |
| 43 | (string-to-int (substring time 14 16)) | 43 | (string-to-number (substring time 14 16)) |
| 44 | (string-to-int (substring time 17 19))) | 44 | (string-to-number (substring time 17 19))) |
| 45 | (list 'hms 24 0 0)))))) | 45 | (list 'hms 24 0 0)))))) |
| 46 | 46 | ||
| 47 | (defun calc-to-hms (arg) | 47 | (defun calc-to-hms (arg) |
| @@ -80,7 +80,7 @@ | |||
| 80 | (if (equal fmt "") | 80 | (if (equal fmt "") |
| 81 | (setq fmt "1")) | 81 | (setq fmt "1")) |
| 82 | (if (string-match "\\` *[0-9] *\\'" fmt) | 82 | (if (string-match "\\` *[0-9] *\\'" fmt) |
| 83 | (setq fmt (nth (string-to-int fmt) calc-standard-date-formats))) | 83 | (setq fmt (nth (string-to-number fmt) calc-standard-date-formats))) |
| 84 | (or (string-match "[a-zA-Z]" fmt) | 84 | (or (string-match "[a-zA-Z]" fmt) |
| 85 | (error "Bad date format specifier")) | 85 | (error "Bad date format specifier")) |
| 86 | (and arg | 86 | (and arg |
| @@ -441,7 +441,7 @@ | |||
| 441 | 441 | ||
| 442 | 442 | ||
| 443 | (defun math-this-year () | 443 | (defun math-this-year () |
| 444 | (string-to-int (substring (current-time-string) -4))) | 444 | (string-to-number (substring (current-time-string) -4))) |
| 445 | 445 | ||
| 446 | (defun math-leap-year-p (year) | 446 | (defun math-leap-year-p (year) |
| 447 | (if (Math-lessp year 1752) | 447 | (if (Math-lessp year 1752) |
| @@ -730,14 +730,14 @@ | |||
| 730 | (if (or (string-match "\\([0-9][0-9]?\\):\\([0-9][0-9]?\\)\\(:\\([0-9][0-9]?\\(\\.[0-9]+\\)?\\)\\)? *\\([ap]m?\\|[ap]\\. *m\\.\\|noon\\|n\\>\\|midnight\\|mid\\>\\|m\\>\\)?" math-pd-str) | 730 | (if (or (string-match "\\([0-9][0-9]?\\):\\([0-9][0-9]?\\)\\(:\\([0-9][0-9]?\\(\\.[0-9]+\\)?\\)\\)? *\\([ap]m?\\|[ap]\\. *m\\.\\|noon\\|n\\>\\|midnight\\|mid\\>\\|m\\>\\)?" math-pd-str) |
| 731 | (string-match "\\([0-9][0-9]?\\)\\(\\)\\(\\(\\(\\)\\)\\) *\\([ap]m?\\|[ap]\\. *m\\.\\|noon\\|n\\>\\|midnight\\|mid\\>\\|m\\>\\)" math-pd-str)) | 731 | (string-match "\\([0-9][0-9]?\\)\\(\\)\\(\\(\\(\\)\\)\\) *\\([ap]m?\\|[ap]\\. *m\\.\\|noon\\|n\\>\\|midnight\\|mid\\>\\|m\\>\\)" math-pd-str)) |
| 732 | (let ((ampm (math-match-substring math-pd-str 6))) | 732 | (let ((ampm (math-match-substring math-pd-str 6))) |
| 733 | (setq hour (string-to-int (math-match-substring math-pd-str 1)) | 733 | (setq hour (string-to-number (math-match-substring math-pd-str 1)) |
| 734 | minute (math-match-substring math-pd-str 2) | 734 | minute (math-match-substring math-pd-str 2) |
| 735 | second (math-match-substring math-pd-str 4) | 735 | second (math-match-substring math-pd-str 4) |
| 736 | math-pd-str (concat (substring math-pd-str 0 (match-beginning 0)) | 736 | math-pd-str (concat (substring math-pd-str 0 (match-beginning 0)) |
| 737 | (substring math-pd-str (match-end 0)))) | 737 | (substring math-pd-str (match-end 0)))) |
| 738 | (if (equal minute "") | 738 | (if (equal minute "") |
| 739 | (setq minute 0) | 739 | (setq minute 0) |
| 740 | (setq minute (string-to-int minute))) | 740 | (setq minute (string-to-number minute))) |
| 741 | (if (equal second "") | 741 | (if (equal second "") |
| 742 | (setq second 0) | 742 | (setq second 0) |
| 743 | (setq second (math-read-number second))) | 743 | (setq second (math-read-number second))) |
| @@ -801,7 +801,7 @@ | |||
| 801 | (setq temp 0) | 801 | (setq temp 0) |
| 802 | (while (string-match "[0-9]+" math-pd-str temp) | 802 | (while (string-match "[0-9]+" math-pd-str temp) |
| 803 | (and c (throw 'syntax "Too many numbers in date")) | 803 | (and c (throw 'syntax "Too many numbers in date")) |
| 804 | (setq c (string-to-int (math-match-substring math-pd-str 0))) | 804 | (setq c (string-to-number (math-match-substring math-pd-str 0))) |
| 805 | (or b (setq b c c nil)) | 805 | (or b (setq b c c nil)) |
| 806 | (or a (setq a b b nil)) | 806 | (or a (setq a b b nil)) |
| 807 | (setq temp (match-end 0))) | 807 | (setq temp (match-end 0))) |
| @@ -1021,7 +1021,7 @@ | |||
| 1021 | (string-match "\\` *[0-9][0-9][0-9]" math-pd-str) | 1021 | (string-match "\\` *[0-9][0-9][0-9]" math-pd-str) |
| 1022 | (string-match "\\` *[0-9][0-9]" math-pd-str)) | 1022 | (string-match "\\` *[0-9][0-9]" math-pd-str)) |
| 1023 | (string-match "\\` *[0-9]+" math-pd-str))) | 1023 | (string-match "\\` *[0-9]+" math-pd-str))) |
| 1024 | (and (setq num (string-to-int | 1024 | (and (setq num (string-to-number |
| 1025 | (math-match-substring math-pd-str 0)) | 1025 | (math-match-substring math-pd-str 0)) |
| 1026 | math-pd-str (substring math-pd-str (match-end 0))) | 1026 | math-pd-str (substring math-pd-str (match-end 0))) |
| 1027 | nil)) | 1027 | nil)) |
| @@ -1236,13 +1236,13 @@ | |||
| 1236 | (setq p (cdr p)))) | 1236 | (setq p (cdr p)))) |
| 1237 | (if (looking-at "\\([-+][0-9]?[0-9]\\)\\([0-9][0-9]\\)?\\(\\'\\|[^0-9]\\)") | 1237 | (if (looking-at "\\([-+][0-9]?[0-9]\\)\\([0-9][0-9]\\)?\\(\\'\\|[^0-9]\\)") |
| 1238 | (setq offset (math-add | 1238 | (setq offset (math-add |
| 1239 | (string-to-int (buffer-substring | 1239 | (string-to-number (buffer-substring |
| 1240 | (match-beginning 1) | 1240 | (match-beginning 1) |
| 1241 | (match-end 1))) | 1241 | (match-end 1))) |
| 1242 | (if (match-beginning 2) | 1242 | (if (match-beginning 2) |
| 1243 | (math-div (string-to-int (buffer-substring | 1243 | (math-div (string-to-number (buffer-substring |
| 1244 | (match-beginning 2) | 1244 | (match-beginning 2) |
| 1245 | (match-end 2))) | 1245 | (match-end 2))) |
| 1246 | 60) | 1246 | 60) |
| 1247 | 0))))) | 1247 | 0))))) |
| 1248 | (if p | 1248 | (if p |
diff --git a/lisp/calc/calc-frac.el b/lisp/calc/calc-frac.el index cdb8ac9beb6..87ee59440c3 100644 --- a/lisp/calc/calc-frac.el +++ b/lisp/calc/calc-frac.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; calc-frac.el --- fraction functions for Calc | 1 | ;;; calc-frac.el --- fraction functions for Calc |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2005 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: David Gillespie <daveg@synaptics.com> | 5 | ;; Author: David Gillespie <daveg@synaptics.com> |
| 6 | ;; Maintainer: Jay Belanger <belanger@truman.edu> | 6 | ;; Maintainer: Jay Belanger <belanger@truman.edu> |
| @@ -56,7 +56,7 @@ | |||
| 56 | (if (string-match "\\`\\([^ 0-9][^ 0-9]?\\)[0-9]*\\'" fmt) | 56 | (if (string-match "\\`\\([^ 0-9][^ 0-9]?\\)[0-9]*\\'" fmt) |
| 57 | (let ((n nil)) | 57 | (let ((n nil)) |
| 58 | (if (/= (match-end 0) (match-end 1)) | 58 | (if (/= (match-end 0) (match-end 1)) |
| 59 | (setq n (string-to-int (substring fmt (match-end 1))) | 59 | (setq n (string-to-number (substring fmt (match-end 1))) |
| 60 | fmt (math-match-substring fmt 1))) | 60 | fmt (math-match-substring fmt 1))) |
| 61 | (if (eq n 0) (error "Bad denominator")) | 61 | (if (eq n 0) (error "Bad denominator")) |
| 62 | (calc-change-mode 'calc-frac-format (list fmt n) t)) | 62 | (calc-change-mode 'calc-frac-format (list fmt n) t)) |
diff --git a/lisp/calc/calc-graph.el b/lisp/calc/calc-graph.el index 6a58a6215fa..09bea69cf73 100644 --- a/lisp/calc/calc-graph.el +++ b/lisp/calc/calc-graph.el | |||
| @@ -407,13 +407,13 @@ | |||
| 407 | (prin1-to-string output))))) | 407 | (prin1-to-string output))))) |
| 408 | (setq calc-graph-resolution (calc-graph-find-command "samples")) | 408 | (setq calc-graph-resolution (calc-graph-find-command "samples")) |
| 409 | (if calc-graph-resolution | 409 | (if calc-graph-resolution |
| 410 | (setq calc-graph-resolution (string-to-int calc-graph-resolution)) | 410 | (setq calc-graph-resolution (string-to-number calc-graph-resolution)) |
| 411 | (setq calc-graph-resolution (if calc-graph-is-splot | 411 | (setq calc-graph-resolution (if calc-graph-is-splot |
| 412 | calc-graph-default-resolution-3d | 412 | calc-graph-default-resolution-3d |
| 413 | calc-graph-default-resolution))) | 413 | calc-graph-default-resolution))) |
| 414 | (setq precision (calc-graph-find-command "precision")) | 414 | (setq precision (calc-graph-find-command "precision")) |
| 415 | (if precision | 415 | (if precision |
| 416 | (setq precision (string-to-int precision)) | 416 | (setq precision (string-to-number precision)) |
| 417 | (setq precision calc-graph-default-precision)) | 417 | (setq precision calc-graph-default-precision)) |
| 418 | (calc-graph-set-command "terminal") | 418 | (calc-graph-set-command "terminal") |
| 419 | (calc-graph-set-command "output") | 419 | (calc-graph-set-command "output") |
| @@ -1078,11 +1078,11 @@ This \"dumb\" driver will be present in Gnuplot 3.0." | |||
| 1078 | (setq mode (buffer-substring (match-beginning 1) | 1078 | (setq mode (buffer-substring (match-beginning 1) |
| 1079 | (match-end 1)))) | 1079 | (match-end 1)))) |
| 1080 | (if (looking-at "[ \ta-z]+\\([0-9]+\\)") | 1080 | (if (looking-at "[ \ta-z]+\\([0-9]+\\)") |
| 1081 | (setq lstyle (string-to-int | 1081 | (setq lstyle (string-to-number |
| 1082 | (buffer-substring (match-beginning 1) | 1082 | (buffer-substring (match-beginning 1) |
| 1083 | (match-end 1))))) | 1083 | (match-end 1))))) |
| 1084 | (if (looking-at "[ \ta-z]+[0-9]+[ \t]+\\([0-9]+\\)") | 1084 | (if (looking-at "[ \ta-z]+[0-9]+[ \t]+\\([0-9]+\\)") |
| 1085 | (setq pstyle (string-to-int | 1085 | (setq pstyle (string-to-number |
| 1086 | (buffer-substring (match-beginning 1) | 1086 | (buffer-substring (match-beginning 1) |
| 1087 | (match-end 1))))))) | 1087 | (match-end 1))))))) |
| 1088 | (setq lenbl (or (equal mode "lines") (equal mode "linespoints")) | 1088 | (setq lenbl (or (equal mode "lines") (equal mode "linespoints")) |
| @@ -1195,11 +1195,11 @@ This \"dumb\" driver will be present in Gnuplot 3.0." | |||
| 1195 | (if (equal res "") | 1195 | (if (equal res "") |
| 1196 | (message "Default resolution is %d" | 1196 | (message "Default resolution is %d" |
| 1197 | calc-graph-default-resolution) | 1197 | calc-graph-default-resolution) |
| 1198 | (setq calc-graph-default-resolution (string-to-int res))) | 1198 | (setq calc-graph-default-resolution (string-to-number res))) |
| 1199 | (if (equal res "") | 1199 | (if (equal res "") |
| 1200 | (message "Default 3D resolution is %d" | 1200 | (message "Default 3D resolution is %d" |
| 1201 | calc-graph-default-resolution-3d) | 1201 | calc-graph-default-resolution-3d) |
| 1202 | (setq calc-graph-default-resolution-3d (string-to-int res)))) | 1202 | (setq calc-graph-default-resolution-3d (string-to-number res)))) |
| 1203 | (calc-graph-set-command "samples" (if (not (equal res "")) res)))) | 1203 | (calc-graph-set-command "samples" (if (not (equal res "")) res)))) |
| 1204 | 1204 | ||
| 1205 | (defun calc-graph-device (name flag) | 1205 | (defun calc-graph-device (name flag) |
| @@ -1456,7 +1456,7 @@ This \"dumb\" driver will be present in Gnuplot 3.0." | |||
| 1456 | (goto-char origin) | 1456 | (goto-char origin) |
| 1457 | (re-search-forward | 1457 | (re-search-forward |
| 1458 | "G N U P L O T.*\n.*version \\([0-9]+\\)\\." nil t)) | 1458 | "G N U P L O T.*\n.*version \\([0-9]+\\)\\." nil t)) |
| 1459 | (setq calc-gnuplot-version (string-to-int (buffer-substring | 1459 | (setq calc-gnuplot-version (string-to-number (buffer-substring |
| 1460 | (match-beginning 1) | 1460 | (match-beginning 1) |
| 1461 | (match-end 1)))) | 1461 | (match-end 1)))) |
| 1462 | (setq calc-gnuplot-version 1)) | 1462 | (setq calc-gnuplot-version 1)) |
diff --git a/lisp/calc/calc-help.el b/lisp/calc/calc-help.el index 46b8cec2ac6..2a89bb2b883 100644 --- a/lisp/calc/calc-help.el +++ b/lisp/calc/calc-help.el | |||
| @@ -393,12 +393,14 @@ C-w Describe how there is no warranty for Calc." | |||
| 393 | (error "Can't locate Calc sources")) | 393 | (error "Can't locate Calc sources")) |
| 394 | (calc-quit) | 394 | (calc-quit) |
| 395 | (switch-to-buffer "*Help*") | 395 | (switch-to-buffer "*Help*") |
| 396 | (erase-buffer) | 396 | (let ((inhibit-read-only t)) |
| 397 | (insert-file-contents (expand-file-name "README" (car path))) | 397 | (erase-buffer) |
| 398 | (search-forward "Summary of changes") | 398 | (insert-file-contents (expand-file-name "README" (car path))) |
| 399 | (forward-line -1) | 399 | (search-forward "Summary of changes") |
| 400 | (delete-region (point-min) (point)) | 400 | (forward-line -1) |
| 401 | (goto-char (point-min)))) | 401 | (delete-region (point-min) (point)) |
| 402 | (goto-char (point-min))) | ||
| 403 | (help-mode))) | ||
| 402 | 404 | ||
| 403 | (defvar calc-help-long-names '((?b . "binary/business") | 405 | (defvar calc-help-long-names '((?b . "binary/business") |
| 404 | (?g . "graphics") | 406 | (?g . "graphics") |
diff --git a/lisp/calc/calc-prog.el b/lisp/calc/calc-prog.el index 05ec668cce9..01ca770ba27 100644 --- a/lisp/calc/calc-prog.el +++ b/lisp/calc/calc-prog.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; calc-prog.el --- user programmability functions for Calc | 1 | ;;; calc-prog.el --- user programmability functions for Calc |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2005 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: David Gillespie <daveg@synaptics.com> | 5 | ;; Author: David Gillespie <daveg@synaptics.com> |
| 6 | ;; Maintainer: Jay Belanger <belanger@truman.edu> | 6 | ;; Maintainer: Jay Belanger <belanger@truman.edu> |
| @@ -637,7 +637,7 @@ | |||
| 637 | (setq part (nconc part (list (if (= (match-beginning 1) | 637 | (setq part (nconc part (list (if (= (match-beginning 1) |
| 638 | (match-end 1)) | 638 | (match-end 1)) |
| 639 | 0 | 639 | 0 |
| 640 | (string-to-int | 640 | (string-to-number |
| 641 | (buffer-substring | 641 | (buffer-substring |
| 642 | (1+ (match-beginning 1)) | 642 | (1+ (match-beginning 1)) |
| 643 | (match-end 1))))))) | 643 | (match-end 1))))))) |
| @@ -727,7 +727,7 @@ | |||
| 727 | (goto-char calc-edit-top) | 727 | (goto-char calc-edit-top) |
| 728 | (while | 728 | (while |
| 729 | (re-search-forward "^\\([0-9]+\\)\\*" nil t) | 729 | (re-search-forward "^\\([0-9]+\\)\\*" nil t) |
| 730 | (let ((num (string-to-int (match-string 1))) | 730 | (let ((num (string-to-number (match-string 1))) |
| 731 | (line (buffer-substring (point) (line-end-position)))) | 731 | (line (buffer-substring (point) (line-end-position)))) |
| 732 | (goto-char (line-beginning-position)) | 732 | (goto-char (line-beginning-position)) |
| 733 | (kill-line 1) | 733 | (kill-line 1) |
diff --git a/lisp/calc/calc-yank.el b/lisp/calc/calc-yank.el index 339dfd838a4..84c117a1723 100644 --- a/lisp/calc/calc-yank.el +++ b/lisp/calc/calc-yank.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; calc-yank.el --- kill-ring functionality for Calc | 1 | ;;; calc-yank.el --- kill-ring functionality for Calc |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2005 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: David Gillespie <daveg@synaptics.com> | 5 | ;; Author: David Gillespie <daveg@synaptics.com> |
| 6 | ;; Maintainer: Jay Belanger <belanger@truman.edu> | 6 | ;; Maintainer: Jay Belanger <belanger@truman.edu> |
| @@ -231,7 +231,7 @@ | |||
| 231 | pos j))))) | 231 | pos j))))) |
| 232 | (if (string-match "\\` *-?[0-9][0-9]?[0-9]?[0-9]?[0-9]?[0-9]? *\\'" | 232 | (if (string-match "\\` *-?[0-9][0-9]?[0-9]?[0-9]?[0-9]?[0-9]? *\\'" |
| 233 | (car data)) | 233 | (car data)) |
| 234 | (setq vals (list 'vec (string-to-int (car data)))) | 234 | (setq vals (list 'vec (string-to-number (car data)))) |
| 235 | (if (and (null arg) | 235 | (if (and (null arg) |
| 236 | (string-match "[[{][^][{}]*[]}]" (car data))) | 236 | (string-match "[[{][^][{}]*[]}]" (car data))) |
| 237 | (setq pos (match-beginning 0) | 237 | (setq pos (match-beginning 0) |
| @@ -528,7 +528,7 @@ To cancel the edit, simply kill the *Calc Edit* buffer." | |||
| 528 | (goto-char calc-edit-top) | 528 | (goto-char calc-edit-top) |
| 529 | (if (buffer-modified-p) | 529 | (if (buffer-modified-p) |
| 530 | (eval calc-edit-handler)) | 530 | (eval calc-edit-handler)) |
| 531 | (if one-window | 531 | (if (and one-window (not (one-window-p t))) |
| 532 | (delete-window)) | 532 | (delete-window)) |
| 533 | (if (get-buffer-window return) | 533 | (if (get-buffer-window return) |
| 534 | (select-window (get-buffer-window return)) | 534 | (select-window (get-buffer-window return)) |
diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el index ceee013e493..617fc1ddc89 100644 --- a/lisp/calc/calc.el +++ b/lisp/calc/calc.el | |||
| @@ -1174,8 +1174,6 @@ commands given here will actually operate on the *Calculator* stack." | |||
| 1174 | (setq buffer-read-only t) | 1174 | (setq buffer-read-only t) |
| 1175 | (make-local-variable 'overlay-arrow-position) | 1175 | (make-local-variable 'overlay-arrow-position) |
| 1176 | (make-local-variable 'overlay-arrow-string) | 1176 | (make-local-variable 'overlay-arrow-string) |
| 1177 | (set (make-local-variable 'font-lock-defaults) | ||
| 1178 | '(nil t nil nil nil (font-lock-core-only . t))) | ||
| 1179 | (when buf | 1177 | (when buf |
| 1180 | (set (make-local-variable 'calc-main-buffer) buf)) | 1178 | (set (make-local-variable 'calc-main-buffer) buf)) |
| 1181 | (when (= (buffer-size) 0) | 1179 | (when (= (buffer-size) 0) |
| @@ -2138,7 +2136,7 @@ See calc-keypad for details." | |||
| 2138 | (t | 2136 | (t |
| 2139 | (insert (char-to-string last-command-char)) | 2137 | (insert (char-to-string last-command-char)) |
| 2140 | (if (or (and (calc-minibuffer-contains "[-+]?\\(.*\\+/- *\\|.*mod *\\)?\\([0-9][0-9]?\\)#[0-9a-zA-Z]*\\(:[0-9a-zA-Z]*\\(:[0-9a-zA-Z]*\\)?\\|.[0-9a-zA-Z]*\\(e[-+]?[0-9]*\\)?\\)?\\'") | 2138 | (if (or (and (calc-minibuffer-contains "[-+]?\\(.*\\+/- *\\|.*mod *\\)?\\([0-9][0-9]?\\)#[0-9a-zA-Z]*\\(:[0-9a-zA-Z]*\\(:[0-9a-zA-Z]*\\)?\\|.[0-9a-zA-Z]*\\(e[-+]?[0-9]*\\)?\\)?\\'") |
| 2141 | (let ((radix (string-to-int | 2139 | (let ((radix (string-to-number |
| 2142 | (buffer-substring | 2140 | (buffer-substring |
| 2143 | (match-beginning 2) (match-end 2))))) | 2141 | (match-beginning 2) (match-end 2))))) |
| 2144 | (and (>= radix 2) | 2142 | (and (>= radix 2) |
| @@ -3280,7 +3278,7 @@ See calc-keypad for details." | |||
| 3280 | (eq (aref digs 0) ?0)) | 3278 | (eq (aref digs 0) ?0)) |
| 3281 | (math-read-number (concat "8#" digs)) | 3279 | (math-read-number (concat "8#" digs)) |
| 3282 | (if (<= (length digs) 6) | 3280 | (if (<= (length digs) 6) |
| 3283 | (string-to-int digs) | 3281 | (string-to-number digs) |
| 3284 | (cons 'bigpos (math-read-bignum digs)))))) | 3282 | (cons 'bigpos (math-read-bignum digs)))))) |
| 3285 | 3283 | ||
| 3286 | ;; Clean up the string if necessary | 3284 | ;; Clean up the string if necessary |
| @@ -3317,7 +3315,7 @@ See calc-keypad for details." | |||
| 3317 | (exp (math-match-substring s 2))) | 3315 | (exp (math-match-substring s 2))) |
| 3318 | (let ((mant (if (> (length mant) 0) (math-read-number mant) 1)) | 3316 | (let ((mant (if (> (length mant) 0) (math-read-number mant) 1)) |
| 3319 | (exp (if (<= (length exp) (if (memq (aref exp 0) '(?+ ?-)) 8 7)) | 3317 | (exp (if (<= (length exp) (if (memq (aref exp 0) '(?+ ?-)) 8 7)) |
| 3320 | (string-to-int exp)))) | 3318 | (string-to-number exp)))) |
| 3321 | (and mant exp (Math-realp mant) (> exp -4000000) (< exp 4000000) | 3319 | (and mant exp (Math-realp mant) (> exp -4000000) (< exp 4000000) |
| 3322 | (let ((mant (math-float mant))) | 3320 | (let ((mant (math-float mant))) |
| 3323 | (list 'float (nth 1 mant) (+ (nth 2 mant) exp))))))) | 3321 | (list 'float (nth 1 mant) (+ (nth 2 mant) exp))))))) |
| @@ -3332,9 +3330,9 @@ See calc-keypad for details." | |||
| 3332 | 3330 | ||
| 3333 | (defun math-read-bignum (s) ; [l X] | 3331 | (defun math-read-bignum (s) ; [l X] |
| 3334 | (if (> (length s) 3) | 3332 | (if (> (length s) 3) |
| 3335 | (cons (string-to-int (substring s -3)) | 3333 | (cons (string-to-number (substring s -3)) |
| 3336 | (math-read-bignum (substring s 0 -3))) | 3334 | (math-read-bignum (substring s 0 -3))) |
| 3337 | (list (string-to-int s)))) | 3335 | (list (string-to-number s)))) |
| 3338 | 3336 | ||
| 3339 | 3337 | ||
| 3340 | (defconst math-tex-ignore-words | 3338 | (defconst math-tex-ignore-words |
diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el index 320a6aa0f72..f37b966a45a 100644 --- a/lisp/calendar/icalendar.el +++ b/lisp/calendar/icalendar.el | |||
| @@ -28,6 +28,13 @@ | |||
| 28 | 28 | ||
| 29 | ;; This package is documented in the Emacs Manual. | 29 | ;; This package is documented in the Emacs Manual. |
| 30 | 30 | ||
| 31 | ;; Please note: | ||
| 32 | ;; - Diary entries which have a start time but no end time are assumed to | ||
| 33 | ;; last for one hour when they are exported. | ||
| 34 | ;; - Weekly diary entries are assumed to occur the first time in the first | ||
| 35 | ;; week of the year 2000 when they are exported. | ||
| 36 | ;; - Yearly diary entries are assumed to occur the first time in the year | ||
| 37 | ;; 1900 when they are exported. | ||
| 31 | 38 | ||
| 32 | ;;; History: | 39 | ;;; History: |
| 33 | 40 | ||
| @@ -75,11 +82,11 @@ | |||
| 75 | ;; + the parser is too soft | 82 | ;; + the parser is too soft |
| 76 | ;; + error log is incomplete | 83 | ;; + error log is incomplete |
| 77 | ;; + nice to have: #include "webcal://foo.com/some-calendar.ics" | 84 | ;; + nice to have: #include "webcal://foo.com/some-calendar.ics" |
| 85 | ;; + timezones, currently all times are local! | ||
| 78 | 86 | ||
| 79 | ;; * Export from diary to ical | 87 | ;; * Export from diary to ical |
| 80 | ;; + diary-date, diary-float, and self-made sexp entries are not | 88 | ;; + diary-date, diary-float, and self-made sexp entries are not |
| 81 | ;; understood | 89 | ;; understood |
| 82 | ;; + timezones, currently all times are local! | ||
| 83 | 90 | ||
| 84 | ;; * Other things | 91 | ;; * Other things |
| 85 | ;; + clean up all those date/time parsing functions | 92 | ;; + clean up all those date/time parsing functions |
| @@ -90,7 +97,7 @@ | |||
| 90 | 97 | ||
| 91 | ;;; Code: | 98 | ;;; Code: |
| 92 | 99 | ||
| 93 | (defconst icalendar-version 0.11 | 100 | (defconst icalendar-version 0.12 |
| 94 | "Version number of icalendar.el.") | 101 | "Version number of icalendar.el.") |
| 95 | 102 | ||
| 96 | ;; ====================================================================== | 103 | ;; ====================================================================== |
| @@ -145,16 +152,8 @@ replaced by the organizer." | |||
| 145 | :type 'string | 152 | :type 'string |
| 146 | :group 'icalendar) | 153 | :group 'icalendar) |
| 147 | 154 | ||
| 148 | (defcustom icalendar-duration-correction | 155 | (defvar icalendar-debug nil |
| 149 | t | 156 | "Enable icalendar debug messages.") |
| 150 | "Workaround for all-day events. | ||
| 151 | If non-nil the length=duration of iCalendar appointments that | ||
| 152 | have a length of exactly n days is decreased by one day. This | ||
| 153 | fixes problems with all-day events, which appear to be one day | ||
| 154 | longer than they are." | ||
| 155 | :type 'boolean | ||
| 156 | :group 'icalendar) | ||
| 157 | |||
| 158 | 157 | ||
| 159 | ;; ====================================================================== | 158 | ;; ====================================================================== |
| 160 | ;; NO USER SERVICABLE PARTS BELOW THIS LINE | 159 | ;; NO USER SERVICABLE PARTS BELOW THIS LINE |
| @@ -162,8 +161,6 @@ longer than they are." | |||
| 162 | 161 | ||
| 163 | (defconst icalendar--weekday-array ["SU" "MO" "TU" "WE" "TH" "FR" "SA"]) | 162 | (defconst icalendar--weekday-array ["SU" "MO" "TU" "WE" "TH" "FR" "SA"]) |
| 164 | 163 | ||
| 165 | (defvar icalendar-debug nil ".") | ||
| 166 | |||
| 167 | ;; ====================================================================== | 164 | ;; ====================================================================== |
| 168 | ;; all the other libs we need | 165 | ;; all the other libs we need |
| 169 | ;; ====================================================================== | 166 | ;; ====================================================================== |
| @@ -295,7 +292,7 @@ it finds" | |||
| 295 | (while props | 292 | (while props |
| 296 | (setq pp (car props)) | 293 | (setq pp (car props)) |
| 297 | (if (eq (car pp) prop) | 294 | (if (eq (car pp) prop) |
| 298 | (setq result (cons (car (cddr pp)) result))) | 295 | (setq result (append (split-string (car (cddr pp)) ",") result))) |
| 299 | (setq props (cdr props))) | 296 | (setq props (cdr props))) |
| 300 | result)) | 297 | result)) |
| 301 | 298 | ||
| @@ -411,12 +408,15 @@ FIXME: multiple comma-separated values should be allowed!" | |||
| 411 | ;; isodatetimestring == nil | 408 | ;; isodatetimestring == nil |
| 412 | nil)) | 409 | nil)) |
| 413 | 410 | ||
| 414 | (defun icalendar--decode-isoduration (isodurationstring) | 411 | (defun icalendar--decode-isoduration (isodurationstring |
| 415 | "Return ISODURATIONSTRING in format like `decode-time'. | 412 | &optional duration-correction) |
| 413 | "Convert ISODURATIONSTRING into format provided by `decode-time'. | ||
| 416 | Converts from ISO-8601 to Emacs representation. If ISODURATIONSTRING | 414 | Converts from ISO-8601 to Emacs representation. If ISODURATIONSTRING |
| 417 | specifies UTC time (trailing letter Z) the decoded time is given in | 415 | specifies UTC time (trailing letter Z) the decoded time is given in |
| 418 | the local time zone! | 416 | the local time zone! |
| 419 | 417 | ||
| 418 | Optional argument DURATION-CORRECTION shortens result by one day. | ||
| 419 | |||
| 420 | FIXME: TZID-attributes are ignored....! | 420 | FIXME: TZID-attributes are ignored....! |
| 421 | FIXME: multiple comma-separated values should be allowed!" | 421 | FIXME: multiple comma-separated values should be allowed!" |
| 422 | (if isodurationstring | 422 | (if isodurationstring |
| @@ -442,7 +442,7 @@ FIXME: multiple comma-separated values should be allowed!" | |||
| 442 | (setq days (read (substring isodurationstring | 442 | (setq days (read (substring isodurationstring |
| 443 | (match-beginning 3) | 443 | (match-beginning 3) |
| 444 | (match-end 3)))) | 444 | (match-end 3)))) |
| 445 | (when icalendar-duration-correction | 445 | (when duration-correction |
| 446 | (setq days (1- days)))) | 446 | (setq days (1- days)))) |
| 447 | ((match-beginning 4) ;days and time | 447 | ((match-beginning 4) ;days and time |
| 448 | (if (match-beginning 5) | 448 | (if (match-beginning 5) |
| @@ -710,14 +710,14 @@ FExport diary data into iCalendar file: ") | |||
| 710 | "?"))) | 710 | "?"))) |
| 711 | ;; prepare buffer with error messages | 711 | ;; prepare buffer with error messages |
| 712 | (save-current-buffer | 712 | (save-current-buffer |
| 713 | (set-buffer (get-buffer-create " *icalendar-errors*")) | 713 | (set-buffer (get-buffer-create "*icalendar-errors*")) |
| 714 | (erase-buffer)) | 714 | (erase-buffer)) |
| 715 | 715 | ||
| 716 | ;; here we go | 716 | ;; here we go |
| 717 | (save-excursion | 717 | (save-excursion |
| 718 | (goto-char min) | 718 | (goto-char min) |
| 719 | (while (re-search-forward | 719 | (while (re-search-forward |
| 720 | "^\\([^ \t\n].*\\)\\(\\(\n[ \t].*\\)*\\)" max t) | 720 | "^\\([^ \t\n].+\\)\\(\\(\n[ \t].*\\)*\\)" max t) |
| 721 | (setq entry-main (match-string 1)) | 721 | (setq entry-main (match-string 1)) |
| 722 | (if (match-beginning 2) | 722 | (if (match-beginning 2) |
| 723 | (setq entry-rest (match-string 2)) | 723 | (setq entry-rest (match-string 2)) |
| @@ -728,369 +728,42 @@ FExport diary data into iCalendar file: ") | |||
| 728 | (car (cddr (current-time))))) | 728 | (car (cddr (current-time))))) |
| 729 | (condition-case error-val | 729 | (condition-case error-val |
| 730 | (progn | 730 | (progn |
| 731 | (cond | 731 | (setq contents |
| 732 | ;; anniversaries | 732 | (or |
| 733 | ((string-match | 733 | ;; anniversaries -- %%(diary-anniversary ...) |
| 734 | (concat nonmarker | 734 | (icalendar--convert-anniversary-to-ical nonmarker |
| 735 | "%%(diary-anniversary \\([^)]+\\))\\s-*\\(.*\\)") | 735 | entry-main) |
| 736 | entry-main) | 736 | ;; cyclic events -- %%(diary-cyclic ...) |
| 737 | (icalendar--dmsg "diary-anniversary %s" entry-main) | 737 | (icalendar--convert-cyclic-to-ical nonmarker entry-main) |
| 738 | (let* ((datetime (substring entry-main (match-beginning 1) | 738 | ;; diary-date -- %%(diary-date ...) |
| 739 | (match-end 1))) | 739 | (icalendar--convert-date-to-ical nonmarker entry-main) |
| 740 | (summary (icalendar--convert-string-for-export | 740 | ;; float events -- %%(diary-float ...) |
| 741 | (substring entry-main (match-beginning 2) | 741 | (icalendar--convert-float-to-ical nonmarker entry-main) |
| 742 | (match-end 2)))) | 742 | ;; block events -- %%(diary-block ...) |
| 743 | (startisostring (icalendar--datestring-to-isodate | 743 | (icalendar--convert-block-to-ical nonmarker entry-main) |
| 744 | datetime)) | 744 | ;; other sexp diary entries |
| 745 | (endisostring (icalendar--datestring-to-isodate | 745 | (icalendar--convert-sexp-to-ical nonmarker entry-main) |
| 746 | datetime 1))) | 746 | ;; weekly by day -- Monday 8:30 Team meeting |
| 747 | (setq contents | 747 | (icalendar--convert-weekly-to-ical nonmarker entry-main) |
| 748 | (concat "\nDTSTART;VALUE=DATE:" startisostring | 748 | ;; yearly by day -- 1 May Tag der Arbeit |
| 749 | "\nDTEND;VALUE=DATE:" endisostring | 749 | (icalendar--convert-yearly-to-ical nonmarker entry-main) |
| 750 | "\nSUMMARY:" summary | 750 | ;; "ordinary" events, start and end time given |
| 751 | "\nRRULE:FREQ=YEARLY;INTERVAL=1" | 751 | ;; 1 Feb 2003 blah |
| 752 | ;; the following is redundant, | 752 | (icalendar--convert-ordinary-to-ical nonmarker entry-main) |
| 753 | ;; but korganizer seems to expect this... ;( | 753 | ;; everything else |
| 754 | ;; and evolution doesn't understand it... :( | 754 | ;; Oops! what's that? |
| 755 | ;; so... who is wrong?! | 755 | (error "Could not parse entry"))) |
| 756 | ";BYMONTH=" | 756 | (unless (string= entry-rest "") |
| 757 | (substring startisostring 4 6) | 757 | (setq contents |
| 758 | ";BYMONTHDAY=" | 758 | (concat contents "\nDESCRIPTION:" |
| 759 | (substring startisostring 6 8)))) | 759 | (icalendar--convert-string-for-export |
| 760 | (unless (string= entry-rest "") | 760 | entry-rest)))) |
| 761 | (setq contents | ||
| 762 | (concat contents "\nDESCRIPTION:" | ||
| 763 | (icalendar--convert-string-for-export | ||
| 764 | entry-rest))))) | ||
| 765 | ;; cyclic events | ||
| 766 | ;; %%(diary-cyclic ) | ||
| 767 | ((string-match | ||
| 768 | (concat nonmarker | ||
| 769 | "%%(diary-cyclic \\([^ ]+\\) +" | ||
| 770 | "\\([^ /]+[ /]+[^ /]+[ /]+[^ ]+\\))\\s-*\\(.*\\)") | ||
| 771 | entry-main) | ||
| 772 | (icalendar--dmsg "diary-cyclic %s" entry-main) | ||
| 773 | (let* ((frequency (substring entry-main (match-beginning 1) | ||
| 774 | (match-end 1))) | ||
| 775 | (datetime (substring entry-main (match-beginning 2) | ||
| 776 | (match-end 2))) | ||
| 777 | (summary (icalendar--convert-string-for-export | ||
| 778 | (substring entry-main (match-beginning 3) | ||
| 779 | (match-end 3)))) | ||
| 780 | (startisostring (icalendar--datestring-to-isodate | ||
| 781 | datetime)) | ||
| 782 | (endisostring (icalendar--datestring-to-isodate | ||
| 783 | datetime 1))) | ||
| 784 | (setq contents | ||
| 785 | (concat "\nDTSTART;VALUE=DATE:" startisostring | ||
| 786 | "\nDTEND;VALUE=DATE:" endisostring | ||
| 787 | "\nSUMMARY:" summary | ||
| 788 | "\nRRULE:FREQ=DAILY;INTERVAL=" frequency | ||
| 789 | ;; strange: korganizer does not expect | ||
| 790 | ;; BYSOMETHING here... | ||
| 791 | ))) | ||
| 792 | (unless (string= entry-rest "") | ||
| 793 | (setq contents | ||
| 794 | (concat contents "\nDESCRIPTION:" | ||
| 795 | (icalendar--convert-string-for-export | ||
| 796 | entry-rest))))) | ||
| 797 | ;; diary-date -- FIXME | ||
| 798 | ((string-match | ||
| 799 | (concat nonmarker | ||
| 800 | "%%(diary-date \\([^)]+\\))\\s-*\\(.*\\)") | ||
| 801 | entry-main) | ||
| 802 | (icalendar--dmsg "diary-date %s" entry-main) | ||
| 803 | (error "`diary-date' is not supported yet")) | ||
| 804 | ;; float events -- FIXME | ||
| 805 | ((string-match | ||
| 806 | (concat nonmarker | ||
| 807 | "%%(diary-float \\([^)]+\\))\\s-*\\(.*\\)") | ||
| 808 | entry-main) | ||
| 809 | (icalendar--dmsg "diary-float %s" entry-main) | ||
| 810 | (error "`diary-float' is not supported yet")) | ||
| 811 | ;; block events | ||
| 812 | ((string-match | ||
| 813 | (concat nonmarker | ||
| 814 | "%%(diary-block \\([^ /]+[ /]+[^ /]+[ /]+[^ ]+\\)" | ||
| 815 | " +\\([^ /]+[ /]+[^ /]+[ /]+[^ ]+\\))\\s-*" | ||
| 816 | "\\(.*\\)") | ||
| 817 | entry-main) | ||
| 818 | (icalendar--dmsg "diary-block %s" entry-main) | ||
| 819 | (let* ((startstring (substring entry-main | ||
| 820 | (match-beginning 1) | ||
| 821 | (match-end 1))) | ||
| 822 | (endstring (substring entry-main | ||
| 823 | (match-beginning 2) | ||
| 824 | (match-end 2))) | ||
| 825 | (summary (icalendar--convert-string-for-export | ||
| 826 | (substring entry-main (match-beginning 3) | ||
| 827 | (match-end 3)))) | ||
| 828 | (startisostring (icalendar--datestring-to-isodate | ||
| 829 | startstring)) | ||
| 830 | (endisostring (icalendar--datestring-to-isodate | ||
| 831 | endstring 1))) | ||
| 832 | (setq contents | ||
| 833 | (concat "\nDTSTART;VALUE=DATE:" startisostring | ||
| 834 | "\nDTEND;VALUE=DATE:" endisostring | ||
| 835 | "\nSUMMARY:" summary)) | ||
| 836 | (unless (string= entry-rest "") | ||
| 837 | (setq contents | ||
| 838 | (concat contents "\nDESCRIPTION:" | ||
| 839 | (icalendar--convert-string-for-export | ||
| 840 | entry-rest)))))) | ||
| 841 | ;; other sexp diary entries -- FIXME | ||
| 842 | ((string-match | ||
| 843 | (concat nonmarker | ||
| 844 | "%%(\\([^)]+\\))\\s-*\\(.*\\)") | ||
| 845 | entry-main) | ||
| 846 | (icalendar--dmsg "diary-sexp %s" entry-main) | ||
| 847 | (error "sexp-entries are not supported yet")) | ||
| 848 | ;; weekly by day | ||
| 849 | ;; Monday 8:30 Team meeting | ||
| 850 | ((and (string-match | ||
| 851 | (concat nonmarker | ||
| 852 | "\\([a-z]+\\)\\s-+" | ||
| 853 | "\\(0?\\([1-9][0-9]?:[0-9][0-9]\\)" | ||
| 854 | "\\([ap]m\\)?" | ||
| 855 | "\\(-0?" | ||
| 856 | "\\([1-9][0-9]?:[0-9][0-9]\\)" | ||
| 857 | "\\([ap]m\\)?\\)?" | ||
| 858 | "\\)?" | ||
| 859 | "\\s-*\\(.*\\)$") | ||
| 860 | entry-main) | ||
| 861 | (icalendar--get-weekday-abbrev | ||
| 862 | (substring entry-main (match-beginning 1) | ||
| 863 | (match-end 1)))) | ||
| 864 | (icalendar--dmsg "weekly %s" entry-main) | ||
| 865 | (let* ((day (icalendar--get-weekday-abbrev | ||
| 866 | (substring entry-main (match-beginning 1) | ||
| 867 | (match-end 1)))) | ||
| 868 | (starttimestring (icalendar--diarytime-to-isotime | ||
| 869 | (if (match-beginning 3) | ||
| 870 | (substring entry-main | ||
| 871 | (match-beginning 3) | ||
| 872 | (match-end 3)) | ||
| 873 | nil) | ||
| 874 | (if (match-beginning 4) | ||
| 875 | (substring entry-main | ||
| 876 | (match-beginning 4) | ||
| 877 | (match-end 4)) | ||
| 878 | nil))) | ||
| 879 | (endtimestring (icalendar--diarytime-to-isotime | ||
| 880 | (if (match-beginning 6) | ||
| 881 | (substring entry-main | ||
| 882 | (match-beginning 6) | ||
| 883 | (match-end 6)) | ||
| 884 | nil) | ||
| 885 | (if (match-beginning 7) | ||
| 886 | (substring entry-main | ||
| 887 | (match-beginning 7) | ||
| 888 | (match-end 7)) | ||
| 889 | nil))) | ||
| 890 | (summary (icalendar--convert-string-for-export | ||
| 891 | (substring entry-main (match-beginning 8) | ||
| 892 | (match-end 8))))) | ||
| 893 | (when starttimestring | ||
| 894 | (unless endtimestring | ||
| 895 | (let ((time (read | ||
| 896 | (icalendar--rris "^T0?" "" | ||
| 897 | starttimestring)))) | ||
| 898 | (setq endtimestring (format "T%06d" | ||
| 899 | (+ 10000 time)))))) | ||
| 900 | (setq contents | ||
| 901 | (concat "\nDTSTART;" | ||
| 902 | (if starttimestring | ||
| 903 | "VALUE=DATE-TIME:" | ||
| 904 | "VALUE=DATE:") | ||
| 905 | ;; find the correct week day, | ||
| 906 | ;; 1st january 2000 was a saturday | ||
| 907 | (format | ||
| 908 | "200001%02d" | ||
| 909 | (+ (icalendar--get-weekday-number day) 2)) | ||
| 910 | (or starttimestring "") | ||
| 911 | "\nDTEND;" | ||
| 912 | (if endtimestring | ||
| 913 | "VALUE=DATE-TIME:" | ||
| 914 | "VALUE=DATE:") | ||
| 915 | (format | ||
| 916 | "200001%02d" | ||
| 917 | ;; end is non-inclusive! | ||
| 918 | (+ (icalendar--get-weekday-number day) | ||
| 919 | (if endtimestring 2 3))) | ||
| 920 | (or endtimestring "") | ||
| 921 | "\nSUMMARY:" summary | ||
| 922 | "\nRRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=" | ||
| 923 | day))) | ||
| 924 | (unless (string= entry-rest "") | ||
| 925 | (setq contents | ||
| 926 | (concat contents "\nDESCRIPTION:" | ||
| 927 | (icalendar--convert-string-for-export | ||
| 928 | entry-rest))))) | ||
| 929 | ;; yearly by day | ||
| 930 | ;; 1 May Tag der Arbeit | ||
| 931 | ((string-match | ||
| 932 | (concat nonmarker | ||
| 933 | (if european-calendar-style | ||
| 934 | "0?\\([1-9]+[0-9]?\\)\\s-+\\([a-z]+\\)\\s-+" | ||
| 935 | "\\([a-z]+\\)\\s-+0?\\([1-9]+[0-9]?\\)\\s-+") | ||
| 936 | "\\*?\\s-*" | ||
| 937 | "\\(0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?" | ||
| 938 | "\\(" | ||
| 939 | "-0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?\\)?" | ||
| 940 | "\\)?" | ||
| 941 | "\\s-*\\([^0-9]+.*\\)$" ; must not match years | ||
| 942 | ) | ||
| 943 | entry-main) | ||
| 944 | (icalendar--dmsg "yearly %s" entry-main) | ||
| 945 | (let* ((daypos (if european-calendar-style 1 2)) | ||
| 946 | (monpos (if european-calendar-style 2 1)) | ||
| 947 | (day (read (substring entry-main | ||
| 948 | (match-beginning daypos) | ||
| 949 | (match-end daypos)))) | ||
| 950 | (month (icalendar--get-month-number | ||
| 951 | (substring entry-main | ||
| 952 | (match-beginning monpos) | ||
| 953 | (match-end monpos)))) | ||
| 954 | (starttimestring (icalendar--diarytime-to-isotime | ||
| 955 | (if (match-beginning 4) | ||
| 956 | (substring entry-main | ||
| 957 | (match-beginning 4) | ||
| 958 | (match-end 4)) | ||
| 959 | nil) | ||
| 960 | (if (match-beginning 5) | ||
| 961 | (substring entry-main | ||
| 962 | (match-beginning 5) | ||
| 963 | (match-end 5)) | ||
| 964 | nil))) | ||
| 965 | (endtimestring (icalendar--diarytime-to-isotime | ||
| 966 | (if (match-beginning 7) | ||
| 967 | (substring entry-main | ||
| 968 | (match-beginning 7) | ||
| 969 | (match-end 7)) | ||
| 970 | nil) | ||
| 971 | (if (match-beginning 8) | ||
| 972 | (substring entry-main | ||
| 973 | (match-beginning 8) | ||
| 974 | (match-end 8)) | ||
| 975 | nil))) | ||
| 976 | (summary (icalendar--convert-string-for-export | ||
| 977 | (substring entry-main (match-beginning 9) | ||
| 978 | (match-end 9))))) | ||
| 979 | (when starttimestring | ||
| 980 | (unless endtimestring | ||
| 981 | (let ((time (read | ||
| 982 | (icalendar--rris "^T0?" "" | ||
| 983 | starttimestring)))) | ||
| 984 | (setq endtimestring (format "T%06d" | ||
| 985 | (+ 10000 time)))))) | ||
| 986 | (setq contents | ||
| 987 | (concat "\nDTSTART;" | ||
| 988 | (if starttimestring "VALUE=DATE-TIME:" | ||
| 989 | "VALUE=DATE:") | ||
| 990 | (format "1900%02d%02d" month day) | ||
| 991 | (or starttimestring "") | ||
| 992 | "\nDTEND;" | ||
| 993 | (if endtimestring "VALUE=DATE-TIME:" | ||
| 994 | "VALUE=DATE:") | ||
| 995 | ;; end is not included! shift by one day | ||
| 996 | (icalendar--date-to-isodate | ||
| 997 | (list month day 1900) | ||
| 998 | (if endtimestring 0 1)) | ||
| 999 | (or endtimestring "") | ||
| 1000 | "\nSUMMARY:" | ||
| 1001 | summary | ||
| 1002 | "\nRRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=" | ||
| 1003 | (format "%2d" month) | ||
| 1004 | ";BYMONTHDAY=" | ||
| 1005 | (format "%2d" day)))) | ||
| 1006 | (unless (string= entry-rest "") | ||
| 1007 | (setq contents | ||
| 1008 | (concat contents "\nDESCRIPTION:" | ||
| 1009 | (icalendar--convert-string-for-export | ||
| 1010 | entry-rest))))) | ||
| 1011 | ;; "ordinary" events, start and end time given | ||
| 1012 | ;; 1 Feb 2003 Hs Hochzeitsfeier, Dreieich | ||
| 1013 | ((string-match | ||
| 1014 | (concat nonmarker | ||
| 1015 | "\\([^ /]+[ /]+[^ /]+[ /]+[^ ]+\\)\\s-+" | ||
| 1016 | "\\(0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?" | ||
| 1017 | "\\(" | ||
| 1018 | "-0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?\\)?" | ||
| 1019 | "\\)?" | ||
| 1020 | "\\s-*\\(.*\\)") | ||
| 1021 | entry-main) | ||
| 1022 | (icalendar--dmsg "ordinary %s" entry-main) | ||
| 1023 | (let* ((startdatestring (icalendar--datestring-to-isodate | ||
| 1024 | (substring entry-main | ||
| 1025 | (match-beginning 1) | ||
| 1026 | (match-end 1)))) | ||
| 1027 | (starttimestring (icalendar--diarytime-to-isotime | ||
| 1028 | (if (match-beginning 3) | ||
| 1029 | (substring entry-main | ||
| 1030 | (match-beginning 3) | ||
| 1031 | (match-end 3)) | ||
| 1032 | nil) | ||
| 1033 | (if (match-beginning 4) | ||
| 1034 | (substring entry-main | ||
| 1035 | (match-beginning 4) | ||
| 1036 | (match-end 4)) | ||
| 1037 | nil))) | ||
| 1038 | (endtimestring (icalendar--diarytime-to-isotime | ||
| 1039 | (if (match-beginning 6) | ||
| 1040 | (substring entry-main | ||
| 1041 | (match-beginning 6) | ||
| 1042 | (match-end 6)) | ||
| 1043 | nil) | ||
| 1044 | (if (match-beginning 7) | ||
| 1045 | (substring entry-main | ||
| 1046 | (match-beginning 7) | ||
| 1047 | (match-end 7)) | ||
| 1048 | nil))) | ||
| 1049 | (summary (icalendar--convert-string-for-export | ||
| 1050 | (substring entry-main (match-beginning 8) | ||
| 1051 | (match-end 8))))) | ||
| 1052 | (unless startdatestring | ||
| 1053 | (error "Could not parse date")) | ||
| 1054 | (when starttimestring | ||
| 1055 | (unless endtimestring | ||
| 1056 | (let ((time | ||
| 1057 | (read (icalendar--rris "^T0?" "" | ||
| 1058 | starttimestring)))) | ||
| 1059 | (setq endtimestring (format "T%06d" | ||
| 1060 | (+ 10000 time)))))) | ||
| 1061 | (setq contents (concat | ||
| 1062 | "\nDTSTART;" | ||
| 1063 | (if starttimestring "VALUE=DATE-TIME:" | ||
| 1064 | "VALUE=DATE:") | ||
| 1065 | startdatestring | ||
| 1066 | (or starttimestring "") | ||
| 1067 | "\nDTEND;" | ||
| 1068 | (if endtimestring "VALUE=DATE-TIME:" | ||
| 1069 | "VALUE=DATE:") | ||
| 1070 | (icalendar--datestring-to-isodate | ||
| 1071 | (substring entry-main | ||
| 1072 | (match-beginning 1) | ||
| 1073 | (match-end 1)) | ||
| 1074 | (if endtimestring 0 1)) | ||
| 1075 | (or endtimestring "") | ||
| 1076 | "\nSUMMARY:" | ||
| 1077 | summary)) | ||
| 1078 | ;; could not parse the date | ||
| 1079 | (unless (string= entry-rest "") | ||
| 1080 | (setq contents | ||
| 1081 | (concat contents "\nDESCRIPTION:" | ||
| 1082 | (icalendar--convert-string-for-export | ||
| 1083 | entry-rest)))))) | ||
| 1084 | ;; everything else | ||
| 1085 | (t | ||
| 1086 | ;; Oops! what's that? | ||
| 1087 | (error "Could not parse entry"))) | ||
| 1088 | (setq result (concat result header contents "\nEND:VEVENT"))) | 761 | (setq result (concat result header contents "\nEND:VEVENT"))) |
| 1089 | ;; handle errors | 762 | ;; handle errors |
| 1090 | (error | 763 | (error |
| 1091 | (setq found-error t) | 764 | (setq found-error t) |
| 1092 | (save-current-buffer | 765 | (save-current-buffer |
| 1093 | (set-buffer (get-buffer-create " *icalendar-errors*")) | 766 | (set-buffer (get-buffer-create "*icalendar-errors*")) |
| 1094 | (insert (format "Error in line %d -- %s: `%s'\n" | 767 | (insert (format "Error in line %d -- %s: `%s'\n" |
| 1095 | (count-lines (point-min) (point)) | 768 | (count-lines (point-min) (point)) |
| 1096 | (cadr error-val) | 769 | (cadr error-val) |
| @@ -1110,6 +783,518 @@ FExport diary data into iCalendar file: ") | |||
| 1110 | (save-buffer)))) | 783 | (save-buffer)))) |
| 1111 | found-error)) | 784 | found-error)) |
| 1112 | 785 | ||
| 786 | ;; subroutines | ||
| 787 | (defun icalendar--convert-ordinary-to-ical (nonmarker entry-main) | ||
| 788 | "Convert \"ordinary\" diary entry to icalendar format. | ||
| 789 | |||
| 790 | NONMARKER is a regular expression matching the start of non-marking | ||
| 791 | entries. ENTRY-MAIN is the first line of the diary entry." | ||
| 792 | (if (string-match (concat nonmarker | ||
| 793 | "\\([^ /]+[ /]+[^ /]+[ /]+[^ ]+\\)\\s-*" | ||
| 794 | "\\(0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?" | ||
| 795 | "\\(" | ||
| 796 | "-0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?\\)?" | ||
| 797 | "\\)?" | ||
| 798 | "\\s-*\\(.*\\)") | ||
| 799 | entry-main) | ||
| 800 | (let* ((datetime (substring entry-main (match-beginning 1) | ||
| 801 | (match-end 1))) | ||
| 802 | (startisostring (icalendar--datestring-to-isodate | ||
| 803 | datetime)) | ||
| 804 | (endisostring (icalendar--datestring-to-isodate | ||
| 805 | datetime 1)) | ||
| 806 | (starttimestring (icalendar--diarytime-to-isotime | ||
| 807 | (if (match-beginning 3) | ||
| 808 | (substring entry-main | ||
| 809 | (match-beginning 3) | ||
| 810 | (match-end 3)) | ||
| 811 | nil) | ||
| 812 | (if (match-beginning 4) | ||
| 813 | (substring entry-main | ||
| 814 | (match-beginning 4) | ||
| 815 | (match-end 4)) | ||
| 816 | nil))) | ||
| 817 | (endtimestring (icalendar--diarytime-to-isotime | ||
| 818 | (if (match-beginning 6) | ||
| 819 | (substring entry-main | ||
| 820 | (match-beginning 6) | ||
| 821 | (match-end 6)) | ||
| 822 | nil) | ||
| 823 | (if (match-beginning 7) | ||
| 824 | (substring entry-main | ||
| 825 | (match-beginning 7) | ||
| 826 | (match-end 7)) | ||
| 827 | nil))) | ||
| 828 | (summary (icalendar--convert-string-for-export | ||
| 829 | (substring entry-main (match-beginning 8) | ||
| 830 | (match-end 8))))) | ||
| 831 | (icalendar--dmsg "ordinary %s" entry-main) | ||
| 832 | |||
| 833 | (unless startisostring | ||
| 834 | (error "Could not parse date")) | ||
| 835 | (when starttimestring | ||
| 836 | (unless endtimestring | ||
| 837 | (let ((time | ||
| 838 | (read (icalendar--rris "^T0?" "" | ||
| 839 | starttimestring)))) | ||
| 840 | (setq endtimestring (format "T%06d" | ||
| 841 | (+ 10000 time)))))) | ||
| 842 | (concat "\nDTSTART;" | ||
| 843 | (if starttimestring "VALUE=DATE-TIME:" | ||
| 844 | "VALUE=DATE:") | ||
| 845 | startisostring | ||
| 846 | (or starttimestring "") | ||
| 847 | "\nDTEND;" | ||
| 848 | (if endtimestring "VALUE=DATE-TIME:" | ||
| 849 | "VALUE=DATE:") | ||
| 850 | (if starttimestring | ||
| 851 | startisostring | ||
| 852 | endisostring) | ||
| 853 | (or endtimestring "") | ||
| 854 | "\nSUMMARY:" | ||
| 855 | summary)) | ||
| 856 | ;; no match | ||
| 857 | nil)) | ||
| 858 | |||
| 859 | (defun icalendar--convert-weekly-to-ical (nonmarker entry-main) | ||
| 860 | "Convert weekly diary entry to icalendar format. | ||
| 861 | |||
| 862 | NONMARKER is a regular expression matching the start of non-marking | ||
| 863 | entries. ENTRY-MAIN is the first line of the diary entry." | ||
| 864 | (if (and (string-match (concat nonmarker | ||
| 865 | "\\([a-z]+\\)\\s-+" | ||
| 866 | "\\(0?\\([1-9][0-9]?:[0-9][0-9]\\)" | ||
| 867 | "\\([ap]m\\)?" | ||
| 868 | "\\(-0?" | ||
| 869 | "\\([1-9][0-9]?:[0-9][0-9]\\)" | ||
| 870 | "\\([ap]m\\)?\\)?" | ||
| 871 | "\\)?" | ||
| 872 | "\\s-*\\(.*\\)$") | ||
| 873 | entry-main) | ||
| 874 | (icalendar--get-weekday-abbrev | ||
| 875 | (substring entry-main (match-beginning 1) | ||
| 876 | (match-end 1)))) | ||
| 877 | (let* ((day (icalendar--get-weekday-abbrev | ||
| 878 | (substring entry-main (match-beginning 1) | ||
| 879 | (match-end 1)))) | ||
| 880 | (starttimestring (icalendar--diarytime-to-isotime | ||
| 881 | (if (match-beginning 3) | ||
| 882 | (substring entry-main | ||
| 883 | (match-beginning 3) | ||
| 884 | (match-end 3)) | ||
| 885 | nil) | ||
| 886 | (if (match-beginning 4) | ||
| 887 | (substring entry-main | ||
| 888 | (match-beginning 4) | ||
| 889 | (match-end 4)) | ||
| 890 | nil))) | ||
| 891 | (endtimestring (icalendar--diarytime-to-isotime | ||
| 892 | (if (match-beginning 6) | ||
| 893 | (substring entry-main | ||
| 894 | (match-beginning 6) | ||
| 895 | (match-end 6)) | ||
| 896 | nil) | ||
| 897 | (if (match-beginning 7) | ||
| 898 | (substring entry-main | ||
| 899 | (match-beginning 7) | ||
| 900 | (match-end 7)) | ||
| 901 | nil))) | ||
| 902 | (summary (icalendar--convert-string-for-export | ||
| 903 | (substring entry-main (match-beginning 8) | ||
| 904 | (match-end 8))))) | ||
| 905 | (icalendar--dmsg "weekly %s" entry-main) | ||
| 906 | |||
| 907 | (when starttimestring | ||
| 908 | (unless endtimestring | ||
| 909 | (let ((time (read | ||
| 910 | (icalendar--rris "^T0?" "" | ||
| 911 | starttimestring)))) | ||
| 912 | (setq endtimestring (format "T%06d" | ||
| 913 | (+ 10000 time)))))) | ||
| 914 | (concat "\nDTSTART;" | ||
| 915 | (if starttimestring | ||
| 916 | "VALUE=DATE-TIME:" | ||
| 917 | "VALUE=DATE:") | ||
| 918 | ;; find the correct week day, | ||
| 919 | ;; 1st january 2000 was a saturday | ||
| 920 | (format | ||
| 921 | "200001%02d" | ||
| 922 | (+ (icalendar--get-weekday-number day) 2)) | ||
| 923 | (or starttimestring "") | ||
| 924 | "\nDTEND;" | ||
| 925 | (if endtimestring | ||
| 926 | "VALUE=DATE-TIME:" | ||
| 927 | "VALUE=DATE:") | ||
| 928 | (format | ||
| 929 | "200001%02d" | ||
| 930 | ;; end is non-inclusive! | ||
| 931 | (+ (icalendar--get-weekday-number day) | ||
| 932 | (if endtimestring 2 3))) | ||
| 933 | (or endtimestring "") | ||
| 934 | "\nSUMMARY:" summary | ||
| 935 | "\nRRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=" | ||
| 936 | day)) | ||
| 937 | ;; no match | ||
| 938 | nil)) | ||
| 939 | |||
| 940 | (defun icalendar--convert-yearly-to-ical (nonmarker entry-main) | ||
| 941 | "Convert yearly diary entry to icalendar format. | ||
| 942 | |||
| 943 | NONMARKER is a regular expression matching the start of non-marking | ||
| 944 | entries. ENTRY-MAIN is the first line of the diary entry." | ||
| 945 | (if (string-match (concat nonmarker | ||
| 946 | (if european-calendar-style | ||
| 947 | "0?\\([1-9]+[0-9]?\\)\\s-+\\([a-z]+\\)\\s-+" | ||
| 948 | "\\([a-z]+\\)\\s-+0?\\([1-9]+[0-9]?\\)\\s-+") | ||
| 949 | "\\*?\\s-*" | ||
| 950 | "\\(0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?" | ||
| 951 | "\\(" | ||
| 952 | "-0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?\\)?" | ||
| 953 | "\\)?" | ||
| 954 | "\\s-*\\([^0-9]+.*\\)$" ; must not match years | ||
| 955 | ) | ||
| 956 | entry-main) | ||
| 957 | (let* ((daypos (if european-calendar-style 1 2)) | ||
| 958 | (monpos (if european-calendar-style 2 1)) | ||
| 959 | (day (read (substring entry-main | ||
| 960 | (match-beginning daypos) | ||
| 961 | (match-end daypos)))) | ||
| 962 | (month (icalendar--get-month-number | ||
| 963 | (substring entry-main | ||
| 964 | (match-beginning monpos) | ||
| 965 | (match-end monpos)))) | ||
| 966 | (starttimestring (icalendar--diarytime-to-isotime | ||
| 967 | (if (match-beginning 4) | ||
| 968 | (substring entry-main | ||
| 969 | (match-beginning 4) | ||
| 970 | (match-end 4)) | ||
| 971 | nil) | ||
| 972 | (if (match-beginning 5) | ||
| 973 | (substring entry-main | ||
| 974 | (match-beginning 5) | ||
| 975 | (match-end 5)) | ||
| 976 | nil))) | ||
| 977 | (endtimestring (icalendar--diarytime-to-isotime | ||
| 978 | (if (match-beginning 7) | ||
| 979 | (substring entry-main | ||
| 980 | (match-beginning 7) | ||
| 981 | (match-end 7)) | ||
| 982 | nil) | ||
| 983 | (if (match-beginning 8) | ||
| 984 | (substring entry-main | ||
| 985 | (match-beginning 8) | ||
| 986 | (match-end 8)) | ||
| 987 | nil))) | ||
| 988 | (summary (icalendar--convert-string-for-export | ||
| 989 | (substring entry-main (match-beginning 9) | ||
| 990 | (match-end 9))))) | ||
| 991 | (icalendar--dmsg "yearly %s" entry-main) | ||
| 992 | |||
| 993 | (when starttimestring | ||
| 994 | (unless endtimestring | ||
| 995 | (let ((time (read | ||
| 996 | (icalendar--rris "^T0?" "" | ||
| 997 | starttimestring)))) | ||
| 998 | (setq endtimestring (format "T%06d" | ||
| 999 | (+ 10000 time)))))) | ||
| 1000 | (concat "\nDTSTART;" | ||
| 1001 | (if starttimestring "VALUE=DATE-TIME:" | ||
| 1002 | "VALUE=DATE:") | ||
| 1003 | (format "1900%02d%02d" month day) | ||
| 1004 | (or starttimestring "") | ||
| 1005 | "\nDTEND;" | ||
| 1006 | (if endtimestring "VALUE=DATE-TIME:" | ||
| 1007 | "VALUE=DATE:") | ||
| 1008 | ;; end is not included! shift by one day | ||
| 1009 | (icalendar--date-to-isodate | ||
| 1010 | (list month day 1900) | ||
| 1011 | (if endtimestring 0 1)) | ||
| 1012 | (or endtimestring "") | ||
| 1013 | "\nSUMMARY:" | ||
| 1014 | summary | ||
| 1015 | "\nRRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=" | ||
| 1016 | (format "%2d" month) | ||
| 1017 | ";BYMONTHDAY=" | ||
| 1018 | (format "%2d" day))) | ||
| 1019 | ;; no match | ||
| 1020 | nil)) | ||
| 1021 | |||
| 1022 | (defun icalendar--convert-sexp-to-ical (nonmarker entry-main) | ||
| 1023 | "Convert complex sexp diary entry to icalendar format -- unsupported! | ||
| 1024 | |||
| 1025 | FIXME! | ||
| 1026 | |||
| 1027 | NONMARKER is a regular expression matching the start of non-marking | ||
| 1028 | entries. ENTRY-MAIN is the first line of the diary entry." | ||
| 1029 | (if (string-match (concat nonmarker | ||
| 1030 | "%%(\\([^)]+\\))\\s-*\\(.*\\)") | ||
| 1031 | entry-main) | ||
| 1032 | (progn | ||
| 1033 | (icalendar--dmsg "diary-sexp %s" entry-main) | ||
| 1034 | (error "Sexp-entries are not supported yet")) | ||
| 1035 | ;; no match | ||
| 1036 | nil)) | ||
| 1037 | |||
| 1038 | (defun icalendar--convert-block-to-ical (nonmarker entry-main) | ||
| 1039 | "Convert block diary entry to icalendar format. | ||
| 1040 | |||
| 1041 | NONMARKER is a regular expression matching the start of non-marking | ||
| 1042 | entries. ENTRY-MAIN is the first line of the diary entry." | ||
| 1043 | (if (string-match (concat nonmarker | ||
| 1044 | "%%(diary-block \\([^ /]+[ /]+[^ /]+[ /]+[^ ]+\\)" | ||
| 1045 | " +\\([^ /]+[ /]+[^ /]+[ /]+[^ ]+\\))\\s-*" | ||
| 1046 | "\\(0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?" | ||
| 1047 | "\\(" | ||
| 1048 | "-0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?\\)?" | ||
| 1049 | "\\)?" | ||
| 1050 | "\\s-*\\(.*\\)") | ||
| 1051 | entry-main) | ||
| 1052 | (let* ((startstring (substring entry-main | ||
| 1053 | (match-beginning 1) | ||
| 1054 | (match-end 1))) | ||
| 1055 | (endstring (substring entry-main | ||
| 1056 | (match-beginning 2) | ||
| 1057 | (match-end 2))) | ||
| 1058 | (startisostring (icalendar--datestring-to-isodate | ||
| 1059 | startstring)) | ||
| 1060 | (endisostring (icalendar--datestring-to-isodate | ||
| 1061 | endstring)) | ||
| 1062 | (endisostring+1 (icalendar--datestring-to-isodate | ||
| 1063 | endstring 1)) | ||
| 1064 | (starttimestring (icalendar--diarytime-to-isotime | ||
| 1065 | (if (match-beginning 4) | ||
| 1066 | (substring entry-main | ||
| 1067 | (match-beginning 4) | ||
| 1068 | (match-end 4)) | ||
| 1069 | nil) | ||
| 1070 | (if (match-beginning 5) | ||
| 1071 | (substring entry-main | ||
| 1072 | (match-beginning 5) | ||
| 1073 | (match-end 5)) | ||
| 1074 | nil))) | ||
| 1075 | (endtimestring (icalendar--diarytime-to-isotime | ||
| 1076 | (if (match-beginning 7) | ||
| 1077 | (substring entry-main | ||
| 1078 | (match-beginning 7) | ||
| 1079 | (match-end 7)) | ||
| 1080 | nil) | ||
| 1081 | (if (match-beginning 8) | ||
| 1082 | (substring entry-main | ||
| 1083 | (match-beginning 8) | ||
| 1084 | (match-end 8)) | ||
| 1085 | nil))) | ||
| 1086 | (summary (icalendar--convert-string-for-export | ||
| 1087 | (substring entry-main (match-beginning 9) | ||
| 1088 | (match-end 9))))) | ||
| 1089 | (icalendar--dmsg "diary-block %s" entry-main) | ||
| 1090 | (when starttimestring | ||
| 1091 | (unless endtimestring | ||
| 1092 | (let ((time | ||
| 1093 | (read (icalendar--rris "^T0?" "" | ||
| 1094 | starttimestring)))) | ||
| 1095 | (setq endtimestring (format "T%06d" | ||
| 1096 | (+ 10000 time)))))) | ||
| 1097 | (if starttimestring | ||
| 1098 | ;; with time -> write rrule | ||
| 1099 | (concat "\nDTSTART;VALUE=DATE-TIME:" | ||
| 1100 | startisostring | ||
| 1101 | starttimestring | ||
| 1102 | "\nDTEND;VALUE=DATE-TIME:" | ||
| 1103 | startisostring | ||
| 1104 | endtimestring | ||
| 1105 | "\nSUMMARY:" | ||
| 1106 | summary | ||
| 1107 | "\nRRULE:FREQ=DAILY;INTERVAL=1;UNTIL=" | ||
| 1108 | endisostring) | ||
| 1109 | ;; no time -> write long event | ||
| 1110 | (concat "\nDTSTART;VALUE=DATE:" startisostring | ||
| 1111 | "\nDTEND;VALUE=DATE:" endisostring+1 | ||
| 1112 | "\nSUMMARY:" summary))) | ||
| 1113 | ;; no match | ||
| 1114 | nil)) | ||
| 1115 | |||
| 1116 | (defun icalendar--convert-float-to-ical (nonmarker entry-main) | ||
| 1117 | "Convert float diary entry to icalendar format -- unsupported! | ||
| 1118 | |||
| 1119 | FIXME! | ||
| 1120 | |||
| 1121 | NONMARKER is a regular expression matching the start of non-marking | ||
| 1122 | entries. ENTRY-MAIN is the first line of the diary entry." | ||
| 1123 | (if (string-match (concat nonmarker | ||
| 1124 | "%%(diary-float \\([^)]+\\))\\s-*\\(.*\\)") | ||
| 1125 | entry-main) | ||
| 1126 | (progn | ||
| 1127 | (icalendar--dmsg "diary-float %s" entry-main) | ||
| 1128 | (error "`diary-float' is not supported yet")) | ||
| 1129 | ;; no match | ||
| 1130 | nil)) | ||
| 1131 | |||
| 1132 | (defun icalendar--convert-date-to-ical (nonmarker entry-main) | ||
| 1133 | "Convert `diary-date' diary entry to icalendar format -- unsupported! | ||
| 1134 | |||
| 1135 | FIXME! | ||
| 1136 | |||
| 1137 | NONMARKER is a regular expression matching the start of non-marking | ||
| 1138 | entries. ENTRY-MAIN is the first line of the diary entry." | ||
| 1139 | (if (string-match (concat nonmarker | ||
| 1140 | "%%(diary-date \\([^)]+\\))\\s-*\\(.*\\)") | ||
| 1141 | entry-main) | ||
| 1142 | (progn | ||
| 1143 | (icalendar--dmsg "diary-date %s" entry-main) | ||
| 1144 | (error "`diary-date' is not supported yet")) | ||
| 1145 | ;; no match | ||
| 1146 | nil)) | ||
| 1147 | |||
| 1148 | (defun icalendar--convert-cyclic-to-ical (nonmarker entry-main) | ||
| 1149 | "Convert `diary-cyclic' diary entry to icalendar format. | ||
| 1150 | |||
| 1151 | NONMARKER is a regular expression matching the start of non-marking | ||
| 1152 | entries. ENTRY-MAIN is the first line of the diary entry." | ||
| 1153 | (if (string-match (concat nonmarker | ||
| 1154 | "%%(diary-cyclic \\([^ ]+\\) +" | ||
| 1155 | "\\([^ /]+[ /]+[^ /]+[ /]+[^ ]+\\))\\s-*" | ||
| 1156 | "\\(0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?" | ||
| 1157 | "\\(" | ||
| 1158 | "-0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?\\)?" | ||
| 1159 | "\\)?" | ||
| 1160 | "\\s-*\\(.*\\)") | ||
| 1161 | entry-main) | ||
| 1162 | (let* ((frequency (substring entry-main (match-beginning 1) | ||
| 1163 | (match-end 1))) | ||
| 1164 | (datetime (substring entry-main (match-beginning 2) | ||
| 1165 | (match-end 2))) | ||
| 1166 | (startisostring (icalendar--datestring-to-isodate | ||
| 1167 | datetime)) | ||
| 1168 | (endisostring (icalendar--datestring-to-isodate | ||
| 1169 | datetime)) | ||
| 1170 | (endisostring+1 (icalendar--datestring-to-isodate | ||
| 1171 | datetime 1)) | ||
| 1172 | (starttimestring (icalendar--diarytime-to-isotime | ||
| 1173 | (if (match-beginning 4) | ||
| 1174 | (substring entry-main | ||
| 1175 | (match-beginning 4) | ||
| 1176 | (match-end 4)) | ||
| 1177 | nil) | ||
| 1178 | (if (match-beginning 5) | ||
| 1179 | (substring entry-main | ||
| 1180 | (match-beginning 5) | ||
| 1181 | (match-end 5)) | ||
| 1182 | nil))) | ||
| 1183 | (endtimestring (icalendar--diarytime-to-isotime | ||
| 1184 | (if (match-beginning 7) | ||
| 1185 | (substring entry-main | ||
| 1186 | (match-beginning 7) | ||
| 1187 | (match-end 7)) | ||
| 1188 | nil) | ||
| 1189 | (if (match-beginning 8) | ||
| 1190 | (substring entry-main | ||
| 1191 | (match-beginning 8) | ||
| 1192 | (match-end 8)) | ||
| 1193 | nil))) | ||
| 1194 | (summary (icalendar--convert-string-for-export | ||
| 1195 | (substring entry-main (match-beginning 9) | ||
| 1196 | (match-end 9))))) | ||
| 1197 | (icalendar--dmsg "diary-cyclic %s" entry-main) | ||
| 1198 | (when starttimestring | ||
| 1199 | (unless endtimestring | ||
| 1200 | (let ((time | ||
| 1201 | (read (icalendar--rris "^T0?" "" | ||
| 1202 | starttimestring)))) | ||
| 1203 | (setq endtimestring (format "T%06d" | ||
| 1204 | (+ 10000 time)))))) | ||
| 1205 | (concat "\nDTSTART;" | ||
| 1206 | (if starttimestring "VALUE=DATE-TIME:" | ||
| 1207 | "VALUE=DATE:") | ||
| 1208 | startisostring | ||
| 1209 | (or starttimestring "") | ||
| 1210 | "\nDTEND;" | ||
| 1211 | (if endtimestring "VALUE=DATE-TIME:" | ||
| 1212 | "VALUE=DATE:") | ||
| 1213 | (if endtimestring endisostring endisostring+1) | ||
| 1214 | (or endtimestring "") | ||
| 1215 | "\nSUMMARY:" summary | ||
| 1216 | "\nRRULE:FREQ=DAILY;INTERVAL=" frequency | ||
| 1217 | ;; strange: korganizer does not expect | ||
| 1218 | ;; BYSOMETHING here... | ||
| 1219 | )) | ||
| 1220 | ;; no match | ||
| 1221 | nil)) | ||
| 1222 | |||
| 1223 | (defun icalendar--convert-anniversary-to-ical (nonmarker entry-main) | ||
| 1224 | "Convert `diary-anniversary' diary entry to icalendar format. | ||
| 1225 | |||
| 1226 | NONMARKER is a regular expression matching the start of non-marking | ||
| 1227 | entries. ENTRY-MAIN is the first line of the diary entry." | ||
| 1228 | (if (string-match (concat nonmarker | ||
| 1229 | "%%(diary-anniversary \\([^)]+\\))\\s-*" | ||
| 1230 | "\\(0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?" | ||
| 1231 | "\\(" | ||
| 1232 | "-0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?\\)?" | ||
| 1233 | "\\)?" | ||
| 1234 | "\\s-*\\(.*\\)") | ||
| 1235 | entry-main) | ||
| 1236 | (let* ((datetime (substring entry-main (match-beginning 1) | ||
| 1237 | (match-end 1))) | ||
| 1238 | (startisostring (icalendar--datestring-to-isodate | ||
| 1239 | datetime)) | ||
| 1240 | (endisostring (icalendar--datestring-to-isodate | ||
| 1241 | datetime 1)) | ||
| 1242 | (starttimestring (icalendar--diarytime-to-isotime | ||
| 1243 | (if (match-beginning 3) | ||
| 1244 | (substring entry-main | ||
| 1245 | (match-beginning 3) | ||
| 1246 | (match-end 3)) | ||
| 1247 | nil) | ||
| 1248 | (if (match-beginning 4) | ||
| 1249 | (substring entry-main | ||
| 1250 | (match-beginning 4) | ||
| 1251 | (match-end 4)) | ||
| 1252 | nil))) | ||
| 1253 | (endtimestring (icalendar--diarytime-to-isotime | ||
| 1254 | (if (match-beginning 6) | ||
| 1255 | (substring entry-main | ||
| 1256 | (match-beginning 6) | ||
| 1257 | (match-end 6)) | ||
| 1258 | nil) | ||
| 1259 | (if (match-beginning 7) | ||
| 1260 | (substring entry-main | ||
| 1261 | (match-beginning 7) | ||
| 1262 | (match-end 7)) | ||
| 1263 | nil))) | ||
| 1264 | (summary (icalendar--convert-string-for-export | ||
| 1265 | (substring entry-main (match-beginning 8) | ||
| 1266 | (match-end 8))))) | ||
| 1267 | (icalendar--dmsg "diary-anniversary %s" entry-main) | ||
| 1268 | (when starttimestring | ||
| 1269 | (unless endtimestring | ||
| 1270 | (let ((time | ||
| 1271 | (read (icalendar--rris "^T0?" "" | ||
| 1272 | starttimestring)))) | ||
| 1273 | (setq endtimestring (format "T%06d" | ||
| 1274 | (+ 10000 time)))))) | ||
| 1275 | (concat "\nDTSTART;" | ||
| 1276 | (if starttimestring "VALUE=DATE-TIME:" | ||
| 1277 | "VALUE=DATE:") | ||
| 1278 | startisostring | ||
| 1279 | (or starttimestring "") | ||
| 1280 | "\nDTEND;" | ||
| 1281 | (if endtimestring "VALUE=DATE-TIME:" | ||
| 1282 | "VALUE=DATE:") | ||
| 1283 | endisostring | ||
| 1284 | (or endtimestring "") | ||
| 1285 | "\nSUMMARY:" summary | ||
| 1286 | "\nRRULE:FREQ=YEARLY;INTERVAL=1" | ||
| 1287 | ;; the following is redundant, | ||
| 1288 | ;; but korganizer seems to expect this... ;( | ||
| 1289 | ;; and evolution doesn't understand it... :( | ||
| 1290 | ;; so... who is wrong?! | ||
| 1291 | ";BYMONTH=" | ||
| 1292 | (substring startisostring 4 6) | ||
| 1293 | ";BYMONTHDAY=" | ||
| 1294 | (substring startisostring 6 8))) | ||
| 1295 | ;; no match | ||
| 1296 | nil)) | ||
| 1297 | |||
| 1113 | ;; ====================================================================== | 1298 | ;; ====================================================================== |
| 1114 | ;; Import -- convert icalendar to emacs-diary | 1299 | ;; Import -- convert icalendar to emacs-diary |
| 1115 | ;; ====================================================================== | 1300 | ;; ====================================================================== |
| @@ -1170,10 +1355,12 @@ buffer `*icalendar-errors*'." | |||
| 1170 | ical-contents | 1355 | ical-contents |
| 1171 | diary-file do-not-ask non-marking)) | 1356 | diary-file do-not-ask non-marking)) |
| 1172 | (when diary-file | 1357 | (when diary-file |
| 1173 | ;; save the diary file | 1358 | ;; save the diary file if it is visited already |
| 1174 | (save-current-buffer | 1359 | (let ((b (find-buffer-visiting diary-file))) |
| 1175 | (set-buffer (find-buffer-visiting diary-file)) | 1360 | (when b |
| 1176 | (save-buffer))) | 1361 | (save-current-buffer |
| 1362 | (set-buffer b) | ||
| 1363 | (save-buffer))))) | ||
| 1177 | (message "Converting icalendar...done") | 1364 | (message "Converting icalendar...done") |
| 1178 | ;; return t if no error occured | 1365 | ;; return t if no error occured |
| 1179 | (not ical-errors)) | 1366 | (not ical-errors)) |
| @@ -1185,10 +1372,6 @@ buffer `*icalendar-errors*'." | |||
| 1185 | (defalias 'icalendar-extract-ical-from-buffer 'icalendar-import-buffer) | 1372 | (defalias 'icalendar-extract-ical-from-buffer 'icalendar-import-buffer) |
| 1186 | (make-obsolete 'icalendar-extract-ical-from-buffer 'icalendar-import-buffer) | 1373 | (make-obsolete 'icalendar-extract-ical-from-buffer 'icalendar-import-buffer) |
| 1187 | 1374 | ||
| 1188 | ;; ====================================================================== | ||
| 1189 | ;; private area | ||
| 1190 | ;; ====================================================================== | ||
| 1191 | |||
| 1192 | (defun icalendar--format-ical-event (event) | 1375 | (defun icalendar--format-ical-event (event) |
| 1193 | "Create a string representation of an iCalendar EVENT." | 1376 | "Create a string representation of an iCalendar EVENT." |
| 1194 | (let ((string icalendar-import-format) | 1377 | (let ((string icalendar-import-format) |
| @@ -1226,7 +1409,7 @@ whether to actually import it. NON-MARKING determines whether diary | |||
| 1226 | events are created as non-marking. | 1409 | events are created as non-marking. |
| 1227 | This function attempts to return t if something goes wrong. In this | 1410 | This function attempts to return t if something goes wrong. In this |
| 1228 | case an error string which describes all the errors and problems is | 1411 | case an error string which describes all the errors and problems is |
| 1229 | written into the buffer ` *icalendar-errors*'." | 1412 | written into the buffer `*icalendar-errors*'." |
| 1230 | (let* ((ev (icalendar--all-events ical-list)) | 1413 | (let* ((ev (icalendar--all-events ical-list)) |
| 1231 | (error-string "") | 1414 | (error-string "") |
| 1232 | (event-ok t) | 1415 | (event-ok t) |
| @@ -1238,14 +1421,16 @@ written into the buffer ` *icalendar-errors*'." | |||
| 1238 | (setq ev (cdr ev)) | 1421 | (setq ev (cdr ev)) |
| 1239 | (setq event-ok nil) | 1422 | (setq event-ok nil) |
| 1240 | (condition-case error-val | 1423 | (condition-case error-val |
| 1241 | (let* ((dtstart (icalendar--decode-isodatetime | 1424 | (let* ((dtstart (icalendar--get-event-property e 'DTSTART)) |
| 1242 | (icalendar--get-event-property e 'DTSTART))) | 1425 | (dtstart-dec (icalendar--decode-isodatetime dtstart)) |
| 1243 | (start-d (icalendar--datetime-to-diary-date | 1426 | (start-d (icalendar--datetime-to-diary-date |
| 1244 | dtstart)) | 1427 | dtstart-dec)) |
| 1245 | (start-t (icalendar--datetime-to-colontime dtstart)) | 1428 | (start-t (icalendar--datetime-to-colontime dtstart-dec)) |
| 1246 | (dtend (icalendar--decode-isodatetime | 1429 | (dtend (icalendar--get-event-property e 'DTEND)) |
| 1247 | (icalendar--get-event-property e 'DTEND))) | 1430 | (dtend-dec (icalendar--decode-isodatetime dtend)) |
| 1431 | (dtend-1-dec (icalendar--decode-isodatetime dtend -1)) | ||
| 1248 | end-d | 1432 | end-d |
| 1433 | end-1-d | ||
| 1249 | end-t | 1434 | end-t |
| 1250 | (subject (icalendar--convert-string-for-import | 1435 | (subject (icalendar--convert-string-for-import |
| 1251 | (or (icalendar--get-event-property e 'SUMMARY) | 1436 | (or (icalendar--get-event-property e 'SUMMARY) |
| @@ -1253,165 +1438,50 @@ written into the buffer ` *icalendar-errors*'." | |||
| 1253 | (rrule (icalendar--get-event-property e 'RRULE)) | 1438 | (rrule (icalendar--get-event-property e 'RRULE)) |
| 1254 | (rdate (icalendar--get-event-property e 'RDATE)) | 1439 | (rdate (icalendar--get-event-property e 'RDATE)) |
| 1255 | (duration (icalendar--get-event-property e 'DURATION))) | 1440 | (duration (icalendar--get-event-property e 'DURATION))) |
| 1256 | (icalendar--dmsg "%s: %s" start-d subject) | 1441 | (icalendar--dmsg "%s: `%s'" start-d subject) |
| 1257 | ;; check whether start-time is missing | 1442 | ;; check whether start-time is missing |
| 1258 | (if (and (icalendar--get-event-property-attributes | 1443 | (if (and dtstart |
| 1259 | e 'DTSTART) | 1444 | (string= |
| 1260 | (string= (cadr (icalendar--get-event-property-attributes | 1445 | (cadr (icalendar--get-event-property-attributes |
| 1261 | e 'DTSTART)) | 1446 | e 'DTSTART)) |
| 1262 | "DATE")) | 1447 | "DATE")) |
| 1263 | (setq start-t nil)) | 1448 | (setq start-t nil)) |
| 1264 | (when duration | 1449 | (when duration |
| 1265 | (let ((dtend2 (icalendar--add-decoded-times | 1450 | (let ((dtend-dec-d (icalendar--add-decoded-times |
| 1266 | dtstart | 1451 | dtstart-dec |
| 1267 | (icalendar--decode-isoduration duration)))) | 1452 | (icalendar--decode-isoduration duration))) |
| 1268 | (if (and dtend (not (eq dtend dtend2))) | 1453 | (dtend-1-dec-d (icalendar--add-decoded-times |
| 1454 | dtstart-dec | ||
| 1455 | (icalendar--decode-isoduration duration | ||
| 1456 | t)))) | ||
| 1457 | (if (and dtend-dec (not (eq dtend-dec dtend-dec-d))) | ||
| 1269 | (message "Inconsistent endtime and duration for %s" | 1458 | (message "Inconsistent endtime and duration for %s" |
| 1270 | subject)) | 1459 | subject)) |
| 1271 | (setq dtend dtend2))) | 1460 | (setq dtend-dec dtend-dec-d) |
| 1272 | (setq end-d (if dtend | 1461 | (setq dtend-1-dec dtend-1-dec-d))) |
| 1273 | (icalendar--datetime-to-diary-date dtend) | 1462 | (setq end-d (if dtend-dec |
| 1463 | (icalendar--datetime-to-diary-date dtend-dec) | ||
| 1274 | start-d)) | 1464 | start-d)) |
| 1275 | (setq end-t (if dtend | 1465 | (setq end-1-d (if dtend-1-dec |
| 1276 | (icalendar--datetime-to-colontime dtend) | 1466 | (icalendar--datetime-to-diary-date dtend-1-dec) |
| 1467 | start-d)) | ||
| 1468 | (setq end-t (if (and | ||
| 1469 | dtend-dec | ||
| 1470 | (not (string= | ||
| 1471 | (cadr | ||
| 1472 | (icalendar--get-event-property-attributes | ||
| 1473 | e 'DTEND)) | ||
| 1474 | "DATE"))) | ||
| 1475 | (icalendar--datetime-to-colontime dtend-dec) | ||
| 1277 | start-t)) | 1476 | start-t)) |
| 1278 | (icalendar--dmsg "start-d: %s, end-d: %s" start-d end-d) | 1477 | (icalendar--dmsg "start-d: %s, end-d: %s" start-d end-d) |
| 1279 | (cond | 1478 | (cond |
| 1280 | ;; recurring event | 1479 | ;; recurring event |
| 1281 | (rrule | 1480 | (rrule |
| 1282 | (icalendar--dmsg "recurring event") | 1481 | (setq diary-string |
| 1283 | (let* ((rrule-props (icalendar--split-value rrule)) | 1482 | (icalendar--convert-recurring-to-diary e dtstart-dec start-t |
| 1284 | (frequency (cadr (assoc 'FREQ rrule-props))) | 1483 | end-t)) |
| 1285 | (until (cadr (assoc 'UNTIL rrule-props))) | 1484 | (setq event-ok t)) |
| 1286 | (interval (read (cadr (assoc 'INTERVAL rrule-props))))) | ||
| 1287 | (cond ((string-equal frequency "WEEKLY") | ||
| 1288 | (if (not start-t) | ||
| 1289 | (progn | ||
| 1290 | ;; weekly and all-day | ||
| 1291 | (icalendar--dmsg "weekly all-day") | ||
| 1292 | (if until | ||
| 1293 | (let ((fro | ||
| 1294 | (icalendar--datetime-to-diary-date | ||
| 1295 | (icalendar--decode-isodatetime | ||
| 1296 | (icalendar--get-event-property | ||
| 1297 | e | ||
| 1298 | 'DTSTART)))) | ||
| 1299 | (unt | ||
| 1300 | (icalendar--datetime-to-diary-date | ||
| 1301 | (icalendar--decode-isodatetime | ||
| 1302 | until -1)))) | ||
| 1303 | (setq diary-string | ||
| 1304 | (format | ||
| 1305 | (concat "%%%%(and " | ||
| 1306 | "(diary-cyclic %d %s) " | ||
| 1307 | "(diary-block %s %s))") | ||
| 1308 | (* interval 7) | ||
| 1309 | (icalendar--datetime-to-diary-date | ||
| 1310 | dtstart) | ||
| 1311 | (icalendar--datetime-to-diary-date | ||
| 1312 | dtstart) | ||
| 1313 | (icalendar--datetime-to-diary-date | ||
| 1314 | (icalendar--decode-isodatetime | ||
| 1315 | until -1))))) | ||
| 1316 | (setq diary-string | ||
| 1317 | (format "%%%%(and (diary-cyclic %d %s))" | ||
| 1318 | (* interval 7) | ||
| 1319 | (icalendar--datetime-to-diary-date | ||
| 1320 | dtstart)))) | ||
| 1321 | (setq event-ok t)) | ||
| 1322 | ;; weekly and not all-day | ||
| 1323 | (let* ((byday (cadr (assoc 'BYDAY rrule-props))) | ||
| 1324 | (weekday | ||
| 1325 | (icalendar--get-weekday-number byday))) | ||
| 1326 | (icalendar--dmsg "weekly not-all-day") | ||
| 1327 | (if until | ||
| 1328 | (let ((fro | ||
| 1329 | (icalendar--datetime-to-diary-date | ||
| 1330 | (icalendar--decode-isodatetime | ||
| 1331 | (icalendar--get-event-property | ||
| 1332 | e | ||
| 1333 | 'DTSTART)))) | ||
| 1334 | (unt | ||
| 1335 | (icalendar--datetime-to-diary-date | ||
| 1336 | (icalendar--decode-isodatetime | ||
| 1337 | until)))) | ||
| 1338 | (setq diary-string | ||
| 1339 | (format | ||
| 1340 | (concat "%%%%(and " | ||
| 1341 | "(diary-cyclic %d %s) " | ||
| 1342 | "(diary-block %s %s)) " | ||
| 1343 | "%s%s%s") | ||
| 1344 | (* interval 7) | ||
| 1345 | (icalendar--datetime-to-diary-date | ||
| 1346 | dtstart) | ||
| 1347 | (icalendar--datetime-to-diary-date | ||
| 1348 | dtstart) | ||
| 1349 | (icalendar--datetime-to-diary-date | ||
| 1350 | (icalendar--decode-isodatetime | ||
| 1351 | until)) | ||
| 1352 | start-t | ||
| 1353 | (if end-t "-" "") (or end-t "")))) | ||
| 1354 | ;; no limit | ||
| 1355 | ;; FIXME!!!! | ||
| 1356 | ;; DTSTART;VALUE=DATE-TIME:20030919T090000 | ||
| 1357 | ;; DTEND;VALUE=DATE-TIME:20030919T113000 | ||
| 1358 | (setq diary-string | ||
| 1359 | (format | ||
| 1360 | "%%%%(and (diary-cyclic %s %s)) %s%s%s" | ||
| 1361 | (* interval 7) | ||
| 1362 | (icalendar--datetime-to-diary-date | ||
| 1363 | dtstart) | ||
| 1364 | start-t | ||
| 1365 | (if end-t "-" "") (or end-t "")))) | ||
| 1366 | (setq event-ok t)))) | ||
| 1367 | ;; yearly | ||
| 1368 | ((string-equal frequency "YEARLY") | ||
| 1369 | (icalendar--dmsg "yearly") | ||
| 1370 | (setq diary-string | ||
| 1371 | (format | ||
| 1372 | "%%%%(and (diary-anniversary %s))" | ||
| 1373 | (icalendar--datetime-to-diary-date dtstart))) | ||
| 1374 | (setq event-ok t)) | ||
| 1375 | ;; FIXME: war auskommentiert: | ||
| 1376 | ((and (string-equal frequency "DAILY") | ||
| 1377 | ;;(not (string= start-d end-d)) | ||
| 1378 | ;;(not start-t) | ||
| 1379 | ;;(not end-t) | ||
| 1380 | ) | ||
| 1381 | (let ((ds (icalendar--datetime-to-diary-date | ||
| 1382 | (icalendar--decode-isodatetime | ||
| 1383 | (icalendar--get-event-property | ||
| 1384 | e 'DTSTART)))) | ||
| 1385 | (de (icalendar--datetime-to-diary-date | ||
| 1386 | (icalendar--decode-isodatetime | ||
| 1387 | until -1)))) | ||
| 1388 | (setq diary-string | ||
| 1389 | (format | ||
| 1390 | "%%%%(and (diary-block %s %s))" | ||
| 1391 | ds de))) | ||
| 1392 | (setq event-ok t)))) | ||
| 1393 | ;; Handle exceptions from recurrence rules | ||
| 1394 | (let ((ex-dates (icalendar--get-event-properties e | ||
| 1395 | 'EXDATE))) | ||
| 1396 | (while ex-dates | ||
| 1397 | (let* ((ex-start (icalendar--decode-isodatetime | ||
| 1398 | (car ex-dates))) | ||
| 1399 | (ex-d (icalendar--datetime-to-diary-date | ||
| 1400 | ex-start))) | ||
| 1401 | (setq diary-string | ||
| 1402 | (icalendar--rris "^%%(\\(and \\)?" | ||
| 1403 | (format | ||
| 1404 | "%%%%(and (not (diary-date %s)) " | ||
| 1405 | ex-d) | ||
| 1406 | diary-string))) | ||
| 1407 | (setq ex-dates (cdr ex-dates)))) | ||
| 1408 | ;; FIXME: exception rules are not recognized | ||
| 1409 | (if (icalendar--get-event-property e 'EXRULE) | ||
| 1410 | (setq diary-string | ||
| 1411 | (concat diary-string | ||
| 1412 | "\n Exception rules: " | ||
| 1413 | (icalendar--get-event-properties | ||
| 1414 | e 'EXRULE))))) | ||
| 1415 | (rdate | 1485 | (rdate |
| 1416 | (icalendar--dmsg "rdate event") | 1486 | (icalendar--dmsg "rdate event") |
| 1417 | (setq diary-string "") | 1487 | (setq diary-string "") |
| @@ -1423,35 +1493,22 @@ written into the buffer ` *icalendar-errors*'." | |||
| 1423 | ;; non-recurring event | 1493 | ;; non-recurring event |
| 1424 | ;; all-day event | 1494 | ;; all-day event |
| 1425 | ((not (string= start-d end-d)) | 1495 | ((not (string= start-d end-d)) |
| 1426 | (icalendar--dmsg "non-recurring event") | 1496 | (setq diary-string |
| 1427 | (let ((ds (icalendar--datetime-to-diary-date dtstart)) | 1497 | (icalendar--convert-non-recurring-all-day-to-diary |
| 1428 | (de (icalendar--datetime-to-diary-date dtend))) | 1498 | e start-d end-1-d)) |
| 1429 | (setq diary-string | ||
| 1430 | (format "%%%%(and (diary-block %s %s))" | ||
| 1431 | ds de))) | ||
| 1432 | (setq event-ok t)) | 1499 | (setq event-ok t)) |
| 1433 | ;; not all-day | 1500 | ;; not all-day |
| 1434 | ((and start-t (or (not end-t) | 1501 | ((and start-t (or (not end-t) |
| 1435 | (not (string= start-t end-t)))) | 1502 | (not (string= start-t end-t)))) |
| 1436 | (icalendar--dmsg "not all day event") | 1503 | (setq diary-string |
| 1437 | (cond (end-t | 1504 | (icalendar--convert-non-recurring-not-all-day-to-diary |
| 1438 | (setq diary-string | 1505 | e dtstart-dec dtend-dec start-t end-t)) |
| 1439 | (format "%s %s-%s" | ||
| 1440 | (icalendar--datetime-to-diary-date | ||
| 1441 | dtstart "/") | ||
| 1442 | start-t end-t))) | ||
| 1443 | (t | ||
| 1444 | (setq diary-string | ||
| 1445 | (format "%s %s" | ||
| 1446 | (icalendar--datetime-to-diary-date | ||
| 1447 | dtstart "/") | ||
| 1448 | start-t)))) | ||
| 1449 | (setq event-ok t)) | 1506 | (setq event-ok t)) |
| 1450 | ;; all-day event | 1507 | ;; all-day event |
| 1451 | (t | 1508 | (t |
| 1452 | (icalendar--dmsg "all day event") | 1509 | (icalendar--dmsg "all day event") |
| 1453 | (setq diary-string (icalendar--datetime-to-diary-date | 1510 | (setq diary-string (icalendar--datetime-to-diary-date |
| 1454 | dtstart "/")) | 1511 | dtstart-dec "/")) |
| 1455 | (setq event-ok t))) | 1512 | (setq event-ok t))) |
| 1456 | ;; add all other elements unless the user doesn't want to have | 1513 | ;; add all other elements unless the user doesn't want to have |
| 1457 | ;; them | 1514 | ;; them |
| @@ -1478,12 +1535,237 @@ written into the buffer ` *icalendar-errors*'." | |||
| 1478 | (message error-string)))) | 1535 | (message error-string)))) |
| 1479 | (if found-error | 1536 | (if found-error |
| 1480 | (save-current-buffer | 1537 | (save-current-buffer |
| 1481 | (set-buffer (get-buffer-create " *icalendar-errors*")) | 1538 | (set-buffer (get-buffer-create "*icalendar-errors*")) |
| 1482 | (erase-buffer) | 1539 | (erase-buffer) |
| 1483 | (insert error-string))) | 1540 | (insert error-string))) |
| 1484 | (message "Converting icalendar...done") | 1541 | (message "Converting icalendar...done") |
| 1485 | found-error)) | 1542 | found-error)) |
| 1486 | 1543 | ||
| 1544 | ;; subroutines for importing | ||
| 1545 | (defun icalendar--convert-recurring-to-diary (e dtstart-dec start-t end-t) | ||
| 1546 | "Convert recurring icalendar event E to diary format. | ||
| 1547 | |||
| 1548 | DTSTART-DEC is the DTSTART property of E. | ||
| 1549 | START-T is the event's start time in diary format. | ||
| 1550 | END-T is the event's end time in diary format." | ||
| 1551 | (icalendar--dmsg "recurring event") | ||
| 1552 | (let* ((rrule (icalendar--get-event-property e 'RRULE)) | ||
| 1553 | (rrule-props (icalendar--split-value rrule)) | ||
| 1554 | (frequency (cadr (assoc 'FREQ rrule-props))) | ||
| 1555 | (until (cadr (assoc 'UNTIL rrule-props))) | ||
| 1556 | (count (cadr (assoc 'COUNT rrule-props))) | ||
| 1557 | (interval (read (or (cadr (assoc 'INTERVAL rrule-props)) "1"))) | ||
| 1558 | (dtstart-conv (icalendar--datetime-to-diary-date dtstart-dec)) | ||
| 1559 | (until-conv (icalendar--datetime-to-diary-date | ||
| 1560 | (icalendar--decode-isodatetime until))) | ||
| 1561 | (until-1-conv (icalendar--datetime-to-diary-date | ||
| 1562 | (icalendar--decode-isodatetime until -1))) | ||
| 1563 | (result "")) | ||
| 1564 | |||
| 1565 | ;; FIXME FIXME interval!!!!!!!!!!!!! | ||
| 1566 | |||
| 1567 | (when count | ||
| 1568 | (if until | ||
| 1569 | (message "Must not have UNTIL and COUNT -- ignoring COUNT element!") | ||
| 1570 | (let ((until-1 0)) | ||
| 1571 | (cond ((string-equal frequency "DAILY") | ||
| 1572 | (setq until (icalendar--add-decoded-times | ||
| 1573 | dtstart-dec | ||
| 1574 | (list 0 0 0 (* (read count) interval) 0 0))) | ||
| 1575 | (setq until-1 (icalendar--add-decoded-times | ||
| 1576 | dtstart-dec | ||
| 1577 | (list 0 0 0 (* (- (read count) 1) interval) | ||
| 1578 | 0 0))) | ||
| 1579 | ) | ||
| 1580 | ((string-equal frequency "WEEKLY") | ||
| 1581 | (setq until (icalendar--add-decoded-times | ||
| 1582 | dtstart-dec | ||
| 1583 | (list 0 0 0 (* (read count) 7 interval) 0 0))) | ||
| 1584 | (setq until-1 (icalendar--add-decoded-times | ||
| 1585 | dtstart-dec | ||
| 1586 | (list 0 0 0 (* (- (read count) 1) 7 | ||
| 1587 | interval) 0 0))) | ||
| 1588 | ) | ||
| 1589 | ((string-equal frequency "MONTHLY") | ||
| 1590 | (setq until (icalendar--add-decoded-times | ||
| 1591 | dtstart-dec (list 0 0 0 0 (* (- (read count) 1) | ||
| 1592 | interval) 0))) | ||
| 1593 | (setq until-1 (icalendar--add-decoded-times | ||
| 1594 | dtstart-dec (list 0 0 0 0 (* (- (read count) 1) | ||
| 1595 | interval) 0))) | ||
| 1596 | ) | ||
| 1597 | ((string-equal frequency "YEARLY") | ||
| 1598 | (setq until (icalendar--add-decoded-times | ||
| 1599 | dtstart-dec (list 0 0 0 0 0 (* (- (read count) 1) | ||
| 1600 | interval)))) | ||
| 1601 | (setq until-1 (icalendar--add-decoded-times | ||
| 1602 | dtstart-dec | ||
| 1603 | (list 0 0 0 0 0 (* (- (read count) 1) | ||
| 1604 | interval)))) | ||
| 1605 | ) | ||
| 1606 | (t | ||
| 1607 | (message "Cannot handle COUNT attribute for `%s' events." | ||
| 1608 | frequency))) | ||
| 1609 | (setq until-conv (icalendar--datetime-to-diary-date until)) | ||
| 1610 | (setq until-1-conv (icalendar--datetime-to-diary-date until-1)) | ||
| 1611 | )) | ||
| 1612 | ) | ||
| 1613 | (cond ((string-equal frequency "WEEKLY") | ||
| 1614 | (if (not start-t) | ||
| 1615 | (progn | ||
| 1616 | ;; weekly and all-day | ||
| 1617 | (icalendar--dmsg "weekly all-day") | ||
| 1618 | (if until | ||
| 1619 | (setq result | ||
| 1620 | (format | ||
| 1621 | (concat "%%%%(and " | ||
| 1622 | "(diary-cyclic %d %s) " | ||
| 1623 | "(diary-block %s %s))") | ||
| 1624 | (* interval 7) | ||
| 1625 | dtstart-conv | ||
| 1626 | dtstart-conv | ||
| 1627 | (if count until-1-conv until-conv) | ||
| 1628 | )) | ||
| 1629 | (setq result | ||
| 1630 | (format "%%%%(and (diary-cyclic %d %s))" | ||
| 1631 | (* interval 7) | ||
| 1632 | dtstart-conv)))) | ||
| 1633 | ;; weekly and not all-day | ||
| 1634 | (let* ((byday (cadr (assoc 'BYDAY rrule-props))) | ||
| 1635 | (weekday | ||
| 1636 | (icalendar--get-weekday-number byday))) | ||
| 1637 | (icalendar--dmsg "weekly not-all-day") | ||
| 1638 | (if until | ||
| 1639 | (setq result | ||
| 1640 | (format | ||
| 1641 | (concat "%%%%(and " | ||
| 1642 | "(diary-cyclic %d %s) " | ||
| 1643 | "(diary-block %s %s)) " | ||
| 1644 | "%s%s%s") | ||
| 1645 | (* interval 7) | ||
| 1646 | dtstart-conv | ||
| 1647 | dtstart-conv | ||
| 1648 | until-conv | ||
| 1649 | (or start-t "") | ||
| 1650 | (if end-t "-" "") (or end-t ""))) | ||
| 1651 | ;; no limit | ||
| 1652 | ;; FIXME!!!! | ||
| 1653 | ;; DTSTART;VALUE=DATE-TIME:20030919T090000 | ||
| 1654 | ;; DTEND;VALUE=DATE-TIME:20030919T113000 | ||
| 1655 | (setq result | ||
| 1656 | (format | ||
| 1657 | "%%%%(and (diary-cyclic %s %s)) %s%s%s" | ||
| 1658 | (* interval 7) | ||
| 1659 | dtstart-conv | ||
| 1660 | (or start-t "") | ||
| 1661 | (if end-t "-" "") (or end-t ""))))))) | ||
| 1662 | ;; yearly | ||
| 1663 | ((string-equal frequency "YEARLY") | ||
| 1664 | (icalendar--dmsg "yearly") | ||
| 1665 | (if until | ||
| 1666 | (setq result (format | ||
| 1667 | (concat "%%%%(and (diary-date %s %s t) " | ||
| 1668 | "(diary-block %s %s)) %s%s%s") | ||
| 1669 | (if european-calendar-style (nth 3 dtstart-dec) | ||
| 1670 | (nth 4 dtstart-dec)) | ||
| 1671 | (if european-calendar-style (nth 4 dtstart-dec) | ||
| 1672 | (nth 3 dtstart-dec)) | ||
| 1673 | dtstart-conv | ||
| 1674 | until-conv | ||
| 1675 | (or start-t "") | ||
| 1676 | (if end-t "-" "") (or end-t ""))) | ||
| 1677 | (setq result (format | ||
| 1678 | "%%%%(and (diary-anniversary %s)) %s%s%s" | ||
| 1679 | dtstart-conv | ||
| 1680 | (or start-t "") | ||
| 1681 | (if end-t "-" "") (or end-t ""))))) | ||
| 1682 | ;; monthly | ||
| 1683 | ((string-equal frequency "MONTHLY") | ||
| 1684 | (icalendar--dmsg "monthly") | ||
| 1685 | (setq result | ||
| 1686 | (format | ||
| 1687 | "%%%%(and (diary-date %s %s %s) (diary-block %s %s)) %s%s%s" | ||
| 1688 | (if european-calendar-style (nth 3 dtstart-dec) "t") | ||
| 1689 | (if european-calendar-style "t" (nth 3 dtstart-dec)) | ||
| 1690 | "t" | ||
| 1691 | dtstart-conv | ||
| 1692 | (if until | ||
| 1693 | until-conv | ||
| 1694 | "1 1 9999") ;; FIXME: should be unlimited | ||
| 1695 | (or start-t "") | ||
| 1696 | (if end-t "-" "") (or end-t "")))) | ||
| 1697 | ;; daily | ||
| 1698 | ((and (string-equal frequency "DAILY")) | ||
| 1699 | (if until | ||
| 1700 | (setq result | ||
| 1701 | (format | ||
| 1702 | (concat "%%%%(and (diary-cyclic %s %s) " | ||
| 1703 | "(diary-block %s %s)) %s%s%s") | ||
| 1704 | interval dtstart-conv dtstart-conv | ||
| 1705 | (if count until-1-conv until-conv) | ||
| 1706 | (or start-t "") | ||
| 1707 | (if end-t "-" "") (or end-t ""))) | ||
| 1708 | (setq result | ||
| 1709 | (format | ||
| 1710 | "%%%%(and (diary-cyclic %s %s)) %s%s%s" | ||
| 1711 | interval | ||
| 1712 | dtstart-conv | ||
| 1713 | (or start-t "") | ||
| 1714 | (if end-t "-" "") (or end-t "")))))) | ||
| 1715 | ;; Handle exceptions from recurrence rules | ||
| 1716 | (let ((ex-dates (icalendar--get-event-properties e 'EXDATE))) | ||
| 1717 | (while ex-dates | ||
| 1718 | (let* ((ex-start (icalendar--decode-isodatetime | ||
| 1719 | (car ex-dates))) | ||
| 1720 | (ex-d (icalendar--datetime-to-diary-date | ||
| 1721 | ex-start))) | ||
| 1722 | (setq result | ||
| 1723 | (icalendar--rris "^%%(\\(and \\)?" | ||
| 1724 | (format | ||
| 1725 | "%%%%(and (not (diary-date %s)) " | ||
| 1726 | ex-d) | ||
| 1727 | result))) | ||
| 1728 | (setq ex-dates (cdr ex-dates)))) | ||
| 1729 | ;; FIXME: exception rules are not recognized | ||
| 1730 | (if (icalendar--get-event-property e 'EXRULE) | ||
| 1731 | (setq result | ||
| 1732 | (concat result | ||
| 1733 | "\n Exception rules: " | ||
| 1734 | (icalendar--get-event-properties | ||
| 1735 | e 'EXRULE)))) | ||
| 1736 | result)) | ||
| 1737 | |||
| 1738 | (defun icalendar--convert-non-recurring-all-day-to-diary (event start-d end-d) | ||
| 1739 | "Convert non-recurring icalendar EVENT to diary format. | ||
| 1740 | |||
| 1741 | DTSTART is the decoded DTSTART property of E. | ||
| 1742 | Argument START-D gives the first day. | ||
| 1743 | Argument END-D gives the last day." | ||
| 1744 | (icalendar--dmsg "non-recurring all-day event") | ||
| 1745 | (format "%%%%(and (diary-block %s %s))" start-d end-d)) | ||
| 1746 | |||
| 1747 | (defun icalendar--convert-non-recurring-not-all-day-to-diary (event dtstart-dec | ||
| 1748 | dtend-dec | ||
| 1749 | start-t | ||
| 1750 | end-t) | ||
| 1751 | "Convert recurring icalendar EVENT to diary format. | ||
| 1752 | |||
| 1753 | DTSTART-DEC is the decoded DTSTART property of E. | ||
| 1754 | DTEND-DEC is the decoded DTEND property of E. | ||
| 1755 | START-T is the event's start time in diary format. | ||
| 1756 | END-T is the event's end time in diary format." | ||
| 1757 | (icalendar--dmsg "not all day event") | ||
| 1758 | (cond (end-t | ||
| 1759 | (format "%s %s-%s" | ||
| 1760 | (icalendar--datetime-to-diary-date | ||
| 1761 | dtstart-dec "/") | ||
| 1762 | start-t end-t)) | ||
| 1763 | (t | ||
| 1764 | (format "%s %s" | ||
| 1765 | (icalendar--datetime-to-diary-date | ||
| 1766 | dtstart-dec "/") | ||
| 1767 | start-t)))) | ||
| 1768 | |||
| 1487 | (defun icalendar--add-diary-entry (string diary-file non-marking | 1769 | (defun icalendar--add-diary-entry (string diary-file non-marking |
| 1488 | &optional subject) | 1770 | &optional subject) |
| 1489 | "Add STRING to the diary file DIARY-FILE. | 1771 | "Add STRING to the diary file DIARY-FILE. |
diff --git a/lisp/comint.el b/lisp/comint.el index 35309f7507a..fbb5810de16 100644 --- a/lisp/comint.el +++ b/lisp/comint.el | |||
| @@ -159,7 +159,7 @@ | |||
| 159 | Defaults to \"^\", the null string at BOL. | 159 | Defaults to \"^\", the null string at BOL. |
| 160 | 160 | ||
| 161 | This variable is only used if the variable | 161 | This variable is only used if the variable |
| 162 | `comint-use-prompt-regexp-instead-of-fields' is non-nil. | 162 | `comint-use-prompt-regexp' is non-nil. |
| 163 | 163 | ||
| 164 | Good choices: | 164 | Good choices: |
| 165 | Canonical Lisp: \"^[^> \\n]*>+:? *\" (Lucid, franz, kcl, T, cscheme, oaklisp) | 165 | Canonical Lisp: \"^[^> \\n]*>+:? *\" (Lucid, franz, kcl, T, cscheme, oaklisp) |
| @@ -353,7 +353,7 @@ text. It returns the text to be submitted as process input. The | |||
| 353 | default is `comint-get-old-input-default', which either grabs the | 353 | default is `comint-get-old-input-default', which either grabs the |
| 354 | current input field or grabs the current line and strips off leading | 354 | current input field or grabs the current line and strips off leading |
| 355 | text matching `comint-prompt-regexp', depending on the value of | 355 | text matching `comint-prompt-regexp', depending on the value of |
| 356 | `comint-use-prompt-regexp-instead-of-fields'.") | 356 | `comint-use-prompt-regexp'.") |
| 357 | 357 | ||
| 358 | (defvar comint-dynamic-complete-functions | 358 | (defvar comint-dynamic-complete-functions |
| 359 | '(comint-replace-by-expanded-history comint-dynamic-complete-filename) | 359 | '(comint-replace-by-expanded-history comint-dynamic-complete-filename) |
| @@ -373,6 +373,7 @@ history list. Default is to save anything that isn't all whitespace.") | |||
| 373 | "Abnormal hook run before input is sent to the process. | 373 | "Abnormal hook run before input is sent to the process. |
| 374 | These functions get one argument, a string containing the text to send.") | 374 | These functions get one argument, a string containing the text to send.") |
| 375 | 375 | ||
| 376 | ;;;###autoload | ||
| 376 | (defvar comint-output-filter-functions '(comint-postoutput-scroll-to-bottom comint-watch-for-password-prompt) | 377 | (defvar comint-output-filter-functions '(comint-postoutput-scroll-to-bottom comint-watch-for-password-prompt) |
| 377 | "Functions to call after output is inserted into the buffer. | 378 | "Functions to call after output is inserted into the buffer. |
| 378 | One possible function is `comint-postoutput-scroll-to-bottom'. | 379 | One possible function is `comint-postoutput-scroll-to-bottom'. |
| @@ -406,8 +407,8 @@ See `comint-send-input'." | |||
| 406 | ;; Note: If it is decided to purge comint-prompt-regexp from the source | 407 | ;; Note: If it is decided to purge comint-prompt-regexp from the source |
| 407 | ;; entirely, searching for uses of this variable will help to identify | 408 | ;; entirely, searching for uses of this variable will help to identify |
| 408 | ;; places that need attention. | 409 | ;; places that need attention. |
| 409 | (defcustom comint-use-prompt-regexp-instead-of-fields nil | 410 | (defcustom comint-use-prompt-regexp nil |
| 410 | "*If non-nil, use `comint-prompt-regexp' to distinguish prompts from user-input. | 411 | "*If non-nil, use `comint-prompt-regexp' to recognize prompts. |
| 411 | If nil, then program output and user-input are given different `field' | 412 | If nil, then program output and user-input are given different `field' |
| 412 | properties, which Emacs commands can use to distinguish them (in | 413 | properties, which Emacs commands can use to distinguish them (in |
| 413 | particular, common movement commands such as begining-of-line respect | 414 | particular, common movement commands such as begining-of-line respect |
| @@ -415,6 +416,13 @@ field boundaries in a natural way)." | |||
| 415 | :type 'boolean | 416 | :type 'boolean |
| 416 | :group 'comint) | 417 | :group 'comint) |
| 417 | 418 | ||
| 419 | ;; Autoload is necessary for Custom to recognize old alias. | ||
| 420 | ;;;###autoload | ||
| 421 | (defvaralias 'comint-use-prompt-regexp-instead-of-fields | ||
| 422 | 'comint-use-prompt-regexp) | ||
| 423 | (make-obsolete-variable 'comint-use-prompt-regexp-instead-of-fields | ||
| 424 | 'comint-use-prompt-regexp "22.1") | ||
| 425 | |||
| 418 | (defcustom comint-mode-hook '(turn-on-font-lock) | 426 | (defcustom comint-mode-hook '(turn-on-font-lock) |
| 419 | "Hook run upon entry to `comint-mode'. | 427 | "Hook run upon entry to `comint-mode'. |
| 420 | This is run before the process is cranked up." | 428 | This is run before the process is cranked up." |
| @@ -1150,7 +1158,7 @@ See `comint-magic-space' and `comint-replace-by-expanded-history-before-point'. | |||
| 1150 | Returns t if successful." | 1158 | Returns t if successful." |
| 1151 | (interactive) | 1159 | (interactive) |
| 1152 | (if (and comint-input-autoexpand | 1160 | (if (and comint-input-autoexpand |
| 1153 | (if comint-use-prompt-regexp-instead-of-fields | 1161 | (if comint-use-prompt-regexp |
| 1154 | ;; Use comint-prompt-regexp | 1162 | ;; Use comint-prompt-regexp |
| 1155 | (save-excursion | 1163 | (save-excursion |
| 1156 | (beginning-of-line) | 1164 | (beginning-of-line) |
| @@ -1419,10 +1427,10 @@ in the buffer. E.g., | |||
| 1419 | 1427 | ||
| 1420 | If the interpreter is the csh, | 1428 | If the interpreter is the csh, |
| 1421 | `comint-get-old-input' is the default: | 1429 | `comint-get-old-input' is the default: |
| 1422 | If `comint-use-prompt-regexp-instead-of-fields' is nil, then | 1430 | If `comint-use-prompt-regexp' is nil, then |
| 1423 | either return the current input field, if point is on an input | 1431 | either return the current input field, if point is on an input |
| 1424 | field, or the current line, if point is on an output field. | 1432 | field, or the current line, if point is on an output field. |
| 1425 | If `comint-use-prompt-regexp-instead-of-fields' is non-nil, then | 1433 | If `comint-use-prompt-regexp' is non-nil, then |
| 1426 | return the current line with any initial string matching the | 1434 | return the current line with any initial string matching the |
| 1427 | regexp `comint-prompt-regexp' removed. | 1435 | regexp `comint-prompt-regexp' removed. |
| 1428 | `comint-input-filter-functions' monitors input for \"cd\", \"pushd\", and | 1436 | `comint-input-filter-functions' monitors input for \"cd\", \"pushd\", and |
| @@ -1487,14 +1495,14 @@ Similarly for Soar, Scheme, etc." | |||
| 1487 | font-lock-face comint-highlight-input | 1495 | font-lock-face comint-highlight-input |
| 1488 | mouse-face highlight | 1496 | mouse-face highlight |
| 1489 | help-echo "mouse-2: insert after prompt as new input")) | 1497 | help-echo "mouse-2: insert after prompt as new input")) |
| 1490 | (unless comint-use-prompt-regexp-instead-of-fields | 1498 | (unless comint-use-prompt-regexp |
| 1491 | ;; Give old user input a field property of `input', to | 1499 | ;; Give old user input a field property of `input', to |
| 1492 | ;; distinguish it from both process output and unsent | 1500 | ;; distinguish it from both process output and unsent |
| 1493 | ;; input. The terminating newline is put into a special | 1501 | ;; input. The terminating newline is put into a special |
| 1494 | ;; `boundary' field to make cursor movement between input | 1502 | ;; `boundary' field to make cursor movement between input |
| 1495 | ;; and output fields smoother. | 1503 | ;; and output fields smoother. |
| 1496 | (put-text-property beg end 'field 'input))) | 1504 | (put-text-property beg end 'field 'input))) |
| 1497 | (unless (or no-newline comint-use-prompt-regexp-instead-of-fields) | 1505 | (unless (or no-newline comint-use-prompt-regexp) |
| 1498 | ;; Cover the terminating newline | 1506 | ;; Cover the terminating newline |
| 1499 | (add-text-properties end (1+ end) | 1507 | (add-text-properties end (1+ end) |
| 1500 | '(rear-nonsticky t | 1508 | '(rear-nonsticky t |
| @@ -1708,7 +1716,7 @@ Make backspaces delete the previous character." | |||
| 1708 | 1716 | ||
| 1709 | (goto-char (process-mark process)) ; in case a filter moved it | 1717 | (goto-char (process-mark process)) ; in case a filter moved it |
| 1710 | 1718 | ||
| 1711 | (unless comint-use-prompt-regexp-instead-of-fields | 1719 | (unless comint-use-prompt-regexp |
| 1712 | (let ((inhibit-read-only t) | 1720 | (let ((inhibit-read-only t) |
| 1713 | (inhibit-modification-hooks t)) | 1721 | (inhibit-modification-hooks t)) |
| 1714 | (add-text-properties comint-last-output-start (point) | 1722 | (add-text-properties comint-last-output-start (point) |
| @@ -1844,10 +1852,10 @@ This function could be on `comint-output-filter-functions' or bound to a key." | |||
| 1844 | 1852 | ||
| 1845 | (defun comint-get-old-input-default () | 1853 | (defun comint-get-old-input-default () |
| 1846 | "Default for `comint-get-old-input'. | 1854 | "Default for `comint-get-old-input'. |
| 1847 | If `comint-use-prompt-regexp-instead-of-fields' is nil, then either | 1855 | If `comint-use-prompt-regexp' is nil, then either |
| 1848 | return the current input field, if point is on an input field, or the | 1856 | return the current input field, if point is on an input field, or the |
| 1849 | current line, if point is on an output field. | 1857 | current line, if point is on an output field. |
| 1850 | If `comint-use-prompt-regexp-instead-of-fields' is non-nil, then return | 1858 | If `comint-use-prompt-regexp' is non-nil, then return |
| 1851 | the current line with any initial string matching the regexp | 1859 | the current line with any initial string matching the regexp |
| 1852 | `comint-prompt-regexp' removed." | 1860 | `comint-prompt-regexp' removed." |
| 1853 | (let ((bof (field-beginning))) | 1861 | (let ((bof (field-beginning))) |
| @@ -1880,10 +1888,10 @@ set the hook `comint-input-sender'." | |||
| 1880 | 1888 | ||
| 1881 | (defun comint-line-beginning-position () | 1889 | (defun comint-line-beginning-position () |
| 1882 | "Return the buffer position of the beginning of the line, after any prompt. | 1890 | "Return the buffer position of the beginning of the line, after any prompt. |
| 1883 | If `comint-use-prompt-regexp-instead-of-fields' is non-nil, then the | 1891 | If `comint-use-prompt-regexp' is non-nil, then the prompt skip is done by |
| 1884 | prompt skip is done by skipping text matching the regular expression | 1892 | skipping text matching the regular expression `comint-prompt-regexp', |
| 1885 | `comint-prompt-regexp', a buffer local variable." | 1893 | a buffer local variable." |
| 1886 | (if comint-use-prompt-regexp-instead-of-fields | 1894 | (if comint-use-prompt-regexp |
| 1887 | ;; Use comint-prompt-regexp | 1895 | ;; Use comint-prompt-regexp |
| 1888 | (save-excursion | 1896 | (save-excursion |
| 1889 | (beginning-of-line) | 1897 | (beginning-of-line) |
| @@ -1901,9 +1909,9 @@ prompt skip is done by skipping text matching the regular expression | |||
| 1901 | (defun comint-bol (&optional arg) | 1909 | (defun comint-bol (&optional arg) |
| 1902 | "Go to the beginning of line, then skip past the prompt, if any. | 1910 | "Go to the beginning of line, then skip past the prompt, if any. |
| 1903 | If prefix argument is given (\\[universal-argument]) the prompt is not skipped. | 1911 | If prefix argument is given (\\[universal-argument]) the prompt is not skipped. |
| 1904 | If `comint-use-prompt-regexp-instead-of-fields' is non-nil, then the | 1912 | If `comint-use-prompt-regexp' is non-nil, then the prompt skip is done |
| 1905 | prompt skip is done by skipping text matching the regular expression | 1913 | by skipping text matching the regular expression `comint-prompt-regexp', |
| 1906 | `comint-prompt-regexp', a buffer local variable." | 1914 | a buffer local variable." |
| 1907 | (interactive "P") | 1915 | (interactive "P") |
| 1908 | (if arg | 1916 | (if arg |
| 1909 | ;; Unlike `beginning-of-line', forward-line ignores field boundaries | 1917 | ;; Unlike `beginning-of-line', forward-line ignores field boundaries |
| @@ -2034,7 +2042,7 @@ Sets mark to the value of point when this command is run." | |||
| 2034 | (interactive) | 2042 | (interactive) |
| 2035 | (push-mark) | 2043 | (push-mark) |
| 2036 | (let ((pos (or (marker-position comint-last-input-end) (point-max)))) | 2044 | (let ((pos (or (marker-position comint-last-input-end) (point-max)))) |
| 2037 | (cond (comint-use-prompt-regexp-instead-of-fields | 2045 | (cond (comint-use-prompt-regexp |
| 2038 | (goto-char pos) | 2046 | (goto-char pos) |
| 2039 | (beginning-of-line 0) | 2047 | (beginning-of-line 0) |
| 2040 | (set-window-start (selected-window) (point)) | 2048 | (set-window-start (selected-window) (point)) |
| @@ -2127,13 +2135,13 @@ Sends an EOF only if point is at the end of the buffer and there is no input." | |||
| 2127 | 2135 | ||
| 2128 | (defun comint-backward-matching-input (regexp n) | 2136 | (defun comint-backward-matching-input (regexp n) |
| 2129 | "Search backward through buffer for input fields that match REGEXP. | 2137 | "Search backward through buffer for input fields that match REGEXP. |
| 2130 | If `comint-use-prompt-regexp-instead-of-fields' is non-nil, then input | 2138 | If `comint-use-prompt-regexp' is non-nil, then input fields are identified |
| 2131 | fields are identified by lines that match `comint-prompt-regexp'. | 2139 | by lines that match `comint-prompt-regexp'. |
| 2132 | 2140 | ||
| 2133 | With prefix argument N, search for Nth previous match. | 2141 | With prefix argument N, search for Nth previous match. |
| 2134 | If N is negative, find the next or Nth next match." | 2142 | If N is negative, find the next or Nth next match." |
| 2135 | (interactive (comint-regexp-arg "Backward input matching (regexp): ")) | 2143 | (interactive (comint-regexp-arg "Backward input matching (regexp): ")) |
| 2136 | (if comint-use-prompt-regexp-instead-of-fields | 2144 | (if comint-use-prompt-regexp |
| 2137 | ;; Use comint-prompt-regexp | 2145 | ;; Use comint-prompt-regexp |
| 2138 | (let* ((re (concat comint-prompt-regexp ".*" regexp)) | 2146 | (let* ((re (concat comint-prompt-regexp ".*" regexp)) |
| 2139 | (pos (save-excursion (end-of-line (if (> n 0) 0 1)) | 2147 | (pos (save-excursion (end-of-line (if (> n 0) 0 1)) |
| @@ -2159,8 +2167,8 @@ If N is negative, find the next or Nth next match." | |||
| 2159 | 2167 | ||
| 2160 | (defun comint-forward-matching-input (regexp arg) | 2168 | (defun comint-forward-matching-input (regexp arg) |
| 2161 | "Search forward through buffer for input fields that match REGEXP. | 2169 | "Search forward through buffer for input fields that match REGEXP. |
| 2162 | If `comint-use-prompt-regexp-instead-of-fields' is non-nil, then input | 2170 | If `comint-use-prompt-regexp' is non-nil, then input fields are identified |
| 2163 | fields are identified by lines that match `comint-prompt-regexp'. | 2171 | by lines that match `comint-prompt-regexp'. |
| 2164 | 2172 | ||
| 2165 | With prefix argument N, search for Nth following match. | 2173 | With prefix argument N, search for Nth following match. |
| 2166 | If N is negative, find the previous or Nth previous match." | 2174 | If N is negative, find the previous or Nth previous match." |
| @@ -2170,11 +2178,11 @@ If N is negative, find the previous or Nth previous match." | |||
| 2170 | 2178 | ||
| 2171 | (defun comint-next-prompt (n) | 2179 | (defun comint-next-prompt (n) |
| 2172 | "Move to end of Nth next prompt in the buffer. | 2180 | "Move to end of Nth next prompt in the buffer. |
| 2173 | If `comint-use-prompt-regexp-instead-of-fields' is nil, then this means | 2181 | If `comint-use-prompt-regexp' is nil, then this means the beginning of |
| 2174 | the beginning of the Nth next `input' field, otherwise, it means the Nth | 2182 | the Nth next `input' field, otherwise, it means the Nth occurrence of |
| 2175 | occurrence of text matching `comint-prompt-regexp'." | 2183 | text matching `comint-prompt-regexp'." |
| 2176 | (interactive "p") | 2184 | (interactive "p") |
| 2177 | (if comint-use-prompt-regexp-instead-of-fields | 2185 | (if comint-use-prompt-regexp |
| 2178 | ;; Use comint-prompt-regexp | 2186 | ;; Use comint-prompt-regexp |
| 2179 | (let ((paragraph-start comint-prompt-regexp)) | 2187 | (let ((paragraph-start comint-prompt-regexp)) |
| 2180 | (end-of-line (if (> n 0) 1 0)) | 2188 | (end-of-line (if (> n 0) 1 0)) |
| @@ -2207,9 +2215,9 @@ occurrence of text matching `comint-prompt-regexp'." | |||
| 2207 | 2215 | ||
| 2208 | (defun comint-previous-prompt (n) | 2216 | (defun comint-previous-prompt (n) |
| 2209 | "Move to end of Nth previous prompt in the buffer. | 2217 | "Move to end of Nth previous prompt in the buffer. |
| 2210 | If `comint-use-prompt-regexp-instead-of-fields' is nil, then this means | 2218 | If `comint-use-prompt-regexp' is nil, then this means the beginning of |
| 2211 | the beginning of the Nth previous `input' field, otherwise, it means the Nth | 2219 | the Nth previous `input' field, otherwise, it means the Nth occurrence of |
| 2212 | occurrence of text matching `comint-prompt-regexp'." | 2220 | text matching `comint-prompt-regexp'." |
| 2213 | (interactive "p") | 2221 | (interactive "p") |
| 2214 | (comint-next-prompt (- n))) | 2222 | (comint-next-prompt (- n))) |
| 2215 | 2223 | ||
| @@ -3022,7 +3030,7 @@ the process mark is at the beginning of the accumulated input." | |||
| 3022 | ;; appropriate magic default by examining what we think is the prompt)? | 3030 | ;; appropriate magic default by examining what we think is the prompt)? |
| 3023 | ;; | 3031 | ;; |
| 3024 | ;; Fixme: look for appropriate fields, rather than regexp, if | 3032 | ;; Fixme: look for appropriate fields, rather than regexp, if |
| 3025 | ;; `comint-use-prompt-regexp-instead-of-fields' is true. | 3033 | ;; `comint-use-prompt-regexp' is true. |
| 3026 | 3034 | ||
| 3027 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 3035 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 3028 | ;; Variables | 3036 | ;; Variables |
diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index 60fc862676d..5c92f247a05 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el | |||
| @@ -114,6 +114,18 @@ was first made obsolete, for example a date or a release number." | |||
| 114 | (put function 'byte-obsolete-info (list new handler when))) | 114 | (put function 'byte-obsolete-info (list new handler when))) |
| 115 | function) | 115 | function) |
| 116 | 116 | ||
| 117 | (defmacro define-obsolete-function-alias (function new | ||
| 118 | &optional when docstring) | ||
| 119 | "Set FUNCTION's function definition to NEW and warn that FUNCTION is obsolete. | ||
| 120 | If provided, WHEN should be a string indicating when FUNCTION was | ||
| 121 | first made obsolete, for example a date or a release number. The | ||
| 122 | optional argument DOCSTRING specifies the documentation string | ||
| 123 | for FUNCTION; if DOCSTRING is omitted or nil, FUNCTION uses the | ||
| 124 | documentation string of NEW unluess it already has one." | ||
| 125 | `(progn | ||
| 126 | (defalias ,function ,new ,docstring) | ||
| 127 | (make-obsolete ,function ,new ,when))) | ||
| 128 | |||
| 117 | (defun make-obsolete-variable (variable new &optional when) | 129 | (defun make-obsolete-variable (variable new &optional when) |
| 118 | "Make the byte-compiler warn that VARIABLE is obsolete. | 130 | "Make the byte-compiler warn that VARIABLE is obsolete. |
| 119 | The warning will say that NEW should be used instead. | 131 | The warning will say that NEW should be used instead. |
| @@ -129,6 +141,18 @@ was first made obsolete, for example a date or a release number." | |||
| 129 | (put variable 'byte-obsolete-variable (cons new when)) | 141 | (put variable 'byte-obsolete-variable (cons new when)) |
| 130 | variable) | 142 | variable) |
| 131 | 143 | ||
| 144 | (defmacro define-obsolete-variable-alias (variable new | ||
| 145 | &optional when docstring) | ||
| 146 | "Make VARIABLE a variable alias for NEW and warn that VARIABLE is obsolete. | ||
| 147 | If provided, WHEN should be a string indicating when VARIABLE was | ||
| 148 | first made obsolete, for example a date or a release number. The | ||
| 149 | optional argument DOCSTRING specifies the documentation string | ||
| 150 | for VARIABLE; if DOCSTRING is omitted or nil, VARIABLE uses the | ||
| 151 | documentation string of NEW unless it already has one." | ||
| 152 | `(progn | ||
| 153 | (defvaralias ,variable ,new ,docstring) | ||
| 154 | (make-obsolete-variable ,variable ,new ,when))) | ||
| 155 | |||
| 132 | (defmacro dont-compile (&rest body) | 156 | (defmacro dont-compile (&rest body) |
| 133 | "Like `progn', but the body always runs interpreted (not compiled). | 157 | "Like `progn', but the body always runs interpreted (not compiled). |
| 134 | If you think you need this, you're probably making a mistake somewhere." | 158 | If you think you need this, you're probably making a mistake somewhere." |
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 950193463f7..a752f9f9b61 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el | |||
| @@ -2900,9 +2900,6 @@ That command is designed for interactive use only" fn)) | |||
| 2900 | (put 'byte-concatN 'byte-opcode-invert 'concat) | 2900 | (put 'byte-concatN 'byte-opcode-invert 'concat) |
| 2901 | (put 'byte-insertN 'byte-opcode-invert 'insert) | 2901 | (put 'byte-insertN 'byte-opcode-invert 'insert) |
| 2902 | 2902 | ||
| 2903 | (byte-defop-compiler (dot byte-point) 0) | ||
| 2904 | (byte-defop-compiler (dot-max byte-point-max) 0) | ||
| 2905 | (byte-defop-compiler (dot-min byte-point-min) 0) | ||
| 2906 | (byte-defop-compiler point 0) | 2903 | (byte-defop-compiler point 0) |
| 2907 | ;;(byte-defop-compiler mark 0) ;; obsolete | 2904 | ;;(byte-defop-compiler mark 0) ;; obsolete |
| 2908 | (byte-defop-compiler point-max 0) | 2905 | (byte-defop-compiler point-max 0) |
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index 01935c9d5e8..831ffb2d576 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el | |||
| @@ -95,8 +95,8 @@ BODY contains code that will be executed each time the mode is (dis)activated. | |||
| 95 | will be passed to `defcustom' if the minor mode is global): | 95 | will be passed to `defcustom' if the minor mode is global): |
| 96 | :group GROUP Custom group name to use in all generated `defcustom' forms. | 96 | :group GROUP Custom group name to use in all generated `defcustom' forms. |
| 97 | Defaults to MODE without the possible trailing \"-mode\". | 97 | Defaults to MODE without the possible trailing \"-mode\". |
| 98 | (This default may not be a valid customization group defined | 98 | Don't use this default group name unless you have written a |
| 99 | with `defgroup'. Make sure it is.) | 99 | `defgroup' to define that group properly. |
| 100 | :global GLOBAL If non-nil specifies that the minor mode is not meant to be | 100 | :global GLOBAL If non-nil specifies that the minor mode is not meant to be |
| 101 | buffer-local, so don't make the variable MODE buffer-local. | 101 | buffer-local, so don't make the variable MODE buffer-local. |
| 102 | By default, the mode is buffer-local. | 102 | By default, the mode is buffer-local. |
diff --git a/lisp/emacs-lisp/easymenu.el b/lisp/emacs-lisp/easymenu.el index b0f3b9b9d3e..78ba1fe27bf 100644 --- a/lisp/emacs-lisp/easymenu.el +++ b/lisp/emacs-lisp/easymenu.el | |||
| @@ -160,18 +160,18 @@ A menu item can be a list with the same format as MENU. This is a submenu." | |||
| 160 | (let ((keymap (easy-menu-create-menu (car menu) (cdr menu)))) | 160 | (let ((keymap (easy-menu-create-menu (car menu) (cdr menu)))) |
| 161 | (when symbol | 161 | (when symbol |
| 162 | (set symbol keymap) | 162 | (set symbol keymap) |
| 163 | (fset symbol | 163 | (defalias symbol |
| 164 | `(lambda (event) ,doc (interactive "@e") | 164 | `(lambda (event) ,doc (interactive "@e") |
| 165 | ;; FIXME: XEmacs uses popup-menu which calls the binding | 165 | ;; FIXME: XEmacs uses popup-menu which calls the binding |
| 166 | ;; while x-popup-menu only returns the selection. | 166 | ;; while x-popup-menu only returns the selection. |
| 167 | (x-popup-menu event | 167 | (x-popup-menu event |
| 168 | (or (and (symbolp ,symbol) | 168 | (or (and (symbolp ,symbol) |
| 169 | (funcall | 169 | (funcall |
| 170 | (or (plist-get (get ,symbol 'menu-prop) | 170 | (or (plist-get (get ,symbol 'menu-prop) |
| 171 | :filter) | 171 | :filter) |
| 172 | 'identity) | 172 | 'identity) |
| 173 | (symbol-function ,symbol))) | 173 | (symbol-function ,symbol))) |
| 174 | ,symbol))))) | 174 | ,symbol))))) |
| 175 | (mapcar (lambda (map) | 175 | (mapcar (lambda (map) |
| 176 | (define-key map (vector 'menu-bar (easy-menu-intern (car menu))) | 176 | (define-key map (vector 'menu-bar (easy-menu-intern (car menu))) |
| 177 | (cons 'menu-item | 177 | (cons 'menu-item |
diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el index f31dafb7b11..b23217151e3 100644 --- a/lisp/emacs-lisp/eldoc.el +++ b/lisp/emacs-lisp/eldoc.el | |||
| @@ -45,7 +45,7 @@ | |||
| 45 | 45 | ||
| 46 | ;; Major modes for other languages may use Eldoc by defining an | 46 | ;; Major modes for other languages may use Eldoc by defining an |
| 47 | ;; appropriate function as the buffer-local value of | 47 | ;; appropriate function as the buffer-local value of |
| 48 | ;; `eldoc-print-current-symbol-info-function'. | 48 | ;; `eldoc-documentation-function'. |
| 49 | 49 | ||
| 50 | ;;; Code: | 50 | ;;; Code: |
| 51 | 51 | ||
| @@ -139,16 +139,11 @@ truncated to make more of the arglist or documentation string visible." | |||
| 139 | ;;;###autoload | 139 | ;;;###autoload |
| 140 | (define-minor-mode eldoc-mode | 140 | (define-minor-mode eldoc-mode |
| 141 | "Toggle ElDoc mode on or off. | 141 | "Toggle ElDoc mode on or off. |
| 142 | Show the defined parameters for the elisp function near point. | 142 | In ElDoc mode, the echo area displays information about a |
| 143 | 143 | function or variable in the text where point is. If point is | |
| 144 | For the emacs lisp function at the beginning of the sexp which point is | 144 | on a documented variable, it displays that variable's doc string. |
| 145 | within, show the defined parameters for the function in the echo area. | 145 | Otherwise it displays the argument list of the function called |
| 146 | This information is extracted directly from the function or macro if it is | 146 | in the expression point is on. |
| 147 | in pure lisp. If the emacs function is a subr, the parameters are obtained | ||
| 148 | from the documentation string if possible. | ||
| 149 | |||
| 150 | If point is over a documented variable, print that variable's docstring | ||
| 151 | instead. | ||
| 152 | 147 | ||
| 153 | With prefix ARG, turn ElDoc mode on if and only if ARG is positive." | 148 | With prefix ARG, turn ElDoc mode on if and only if ARG is positive." |
| 154 | :group 'eldoc :lighter eldoc-minor-mode-string | 149 | :group 'eldoc :lighter eldoc-minor-mode-string |
| @@ -167,7 +162,6 @@ With prefix ARG, turn ElDoc mode on if and only if ARG is positive." | |||
| 167 | (eldoc-mode 1)) | 162 | (eldoc-mode 1)) |
| 168 | 163 | ||
| 169 | 164 | ||
| 170 | ;; Idle timers are part of Emacs 19.31 and later. | ||
| 171 | (defun eldoc-schedule-timer () | 165 | (defun eldoc-schedule-timer () |
| 172 | (or (and eldoc-timer | 166 | (or (and eldoc-timer |
| 173 | (memq eldoc-timer timer-idle-list)) | 167 | (memq eldoc-timer timer-idle-list)) |
| @@ -235,7 +229,7 @@ With prefix ARG, turn ElDoc mode on if and only if ARG is positive." | |||
| 235 | (not (eq (selected-window) (minibuffer-window))))) | 229 | (not (eq (selected-window) (minibuffer-window))))) |
| 236 | 230 | ||
| 237 | 231 | ||
| 238 | (defvar eldoc-print-current-symbol-info-function nil | 232 | (defvar eldoc-documentation-function nil |
| 239 | "If non-nil, function to call to return doc string. | 233 | "If non-nil, function to call to return doc string. |
| 240 | The function of no args should return a one-line string for displaying | 234 | The function of no args should return a one-line string for displaying |
| 241 | doc about a function etc. appropriate to the context around point. | 235 | doc about a function etc. appropriate to the context around point. |
| @@ -249,8 +243,8 @@ Emacs Lisp mode) that support Eldoc.") | |||
| 249 | (defun eldoc-print-current-symbol-info () | 243 | (defun eldoc-print-current-symbol-info () |
| 250 | (condition-case err | 244 | (condition-case err |
| 251 | (and (eldoc-display-message-p) | 245 | (and (eldoc-display-message-p) |
| 252 | (if eldoc-print-current-symbol-info-function | 246 | (if eldoc-documentation-function |
| 253 | (eldoc-message (funcall eldoc-print-current-symbol-info-function)) | 247 | (eldoc-message (funcall eldoc-documentation-function)) |
| 254 | (let* ((current-symbol (eldoc-current-symbol)) | 248 | (let* ((current-symbol (eldoc-current-symbol)) |
| 255 | (current-fnsym (eldoc-fnsym-in-current-sexp)) | 249 | (current-fnsym (eldoc-fnsym-in-current-sexp)) |
| 256 | (doc (cond | 250 | (doc (cond |
diff --git a/lisp/emacs-lisp/generic.el b/lisp/emacs-lisp/generic.el index 6851faeddd6..410b1d8eaa5 100644 --- a/lisp/emacs-lisp/generic.el +++ b/lisp/emacs-lisp/generic.el | |||
| @@ -35,15 +35,15 @@ | |||
| 35 | ;; | 35 | ;; |
| 36 | ;; Each generic mode can define the following: | 36 | ;; Each generic mode can define the following: |
| 37 | ;; | 37 | ;; |
| 38 | ;; * List of comment-characters. The entries in this list should be | 38 | ;; * List of comment-characters. The elements of this list should be |
| 39 | ;; either a character, a one or two character string or a cons pair. | 39 | ;; either a character, a one or two character string, or a cons |
| 40 | ;; If the entry is a character or a string, it is added to the | 40 | ;; cell. If the entry is a character or a string, it is added to |
| 41 | ;; mode's syntax table with `comment-start' syntax. If the entry is | 41 | ;; the mode's syntax table with "comment starter" syntax. If the |
| 42 | ;; a cons pair, the elements of the pair are considered to be | 42 | ;; entry is a cons cell, the `car' and `cdr' of the pair are |
| 43 | ;; `comment-start' and `comment-end' respectively. (The latter | 43 | ;; considered the "comment starter" and "comment ender" |
| 44 | ;; should be nil if you want comments to end at end of line.) | 44 | ;; respectively. (The latter should be nil if you want comments to |
| 45 | ;; LIMITATIONS: Emacs does not support comment strings of more than | 45 | ;; end at the end of the line.) Emacs does not support comment |
| 46 | ;; two characters in length. | 46 | ;; strings of more than two characters in length. |
| 47 | ;; | 47 | ;; |
| 48 | ;; * List of keywords to font-lock. Each keyword should be a string. | 48 | ;; * List of keywords to font-lock. Each keyword should be a string. |
| 49 | ;; If you have additional keywords which should be highlighted in a | 49 | ;; If you have additional keywords which should be highlighted in a |
| @@ -121,40 +121,42 @@ instead (which see).") | |||
| 121 | &rest custom-keyword-args) | 121 | &rest custom-keyword-args) |
| 122 | "Create a new generic mode MODE. | 122 | "Create a new generic mode MODE. |
| 123 | 123 | ||
| 124 | MODE is the name of the command for the generic mode; it need not | 124 | MODE is the name of the command for the generic mode; don't quote |
| 125 | be quoted. The optional DOCSTRING is the documentation for the | 125 | it. The optional DOCSTRING is the documentation for the mode |
| 126 | mode command. If you do not supply it, a default documentation | 126 | command. If you do not supply it, `define-generic-mode' uses a |
| 127 | string will be used instead. | 127 | default documentation string instead. |
| 128 | 128 | ||
| 129 | COMMENT-LIST is a list, whose entries are either a single | 129 | COMMENT-LIST is a list in which each element is either a |
| 130 | character, a one or two character string or a cons pair. If the | 130 | character, a string of one or two characters, or a cons cell. A |
| 131 | entry is a character or a string, it is added to the mode's | 131 | character or a string is set up in the mode's syntax table as a |
| 132 | syntax table with `comment-start' syntax. If the entry is a cons | 132 | \"comment starter\". If the entry is a cons cell, the `car' is |
| 133 | pair, the elements of the pair are considered to be | 133 | set up as a \"comment starter\" and the `cdr' as a \"comment |
| 134 | `comment-start' and `comment-end' respectively. (The latter | 134 | ender\". (Use nil for the latter if you want comments to end at |
| 135 | should be nil if you want comments to end at end of line.) Note | 135 | the end of the line.) Note that the syntax table has limitations |
| 136 | that Emacs has limitations regarding comment characters. | 136 | about what comment starters and enders are actually possible. |
| 137 | 137 | ||
| 138 | KEYWORD-LIST is a list of keywords to highlight with | 138 | KEYWORD-LIST is a list of keywords to highlight with |
| 139 | `font-lock-keyword-face'. Each keyword should be a string. | 139 | `font-lock-keyword-face'. Each keyword should be a string. |
| 140 | 140 | ||
| 141 | FONT-LOCK-LIST is a list of additional expressions to highlight. | 141 | FONT-LOCK-LIST is a list of additional expressions to highlight. |
| 142 | Each entry in the list should have the same form as an entry in | 142 | Each element of this list should have the same form as an element |
| 143 | `font-lock-keywords'. | 143 | of `font-lock-keywords'. |
| 144 | 144 | ||
| 145 | AUTO-MODE-LIST is a list of regular expressions to add to | 145 | AUTO-MODE-LIST is a list of regular expressions to add to |
| 146 | `auto-mode-alist'. These regexps are added to `auto-mode-alist' | 146 | `auto-mode-alist'. These regular expressions are added when |
| 147 | as soon as `define-generic-mode' is called. | 147 | Emacs runs the macro expansion. |
| 148 | 148 | ||
| 149 | FUNCTION-LIST is a list of functions to call to do some | 149 | FUNCTION-LIST is a list of functions to call to do some |
| 150 | additional setup. | 150 | additional setup. The mode command calls these functions just |
| 151 | before it runs the mode hook. | ||
| 151 | 152 | ||
| 152 | The optional CUSTOM-KEYWORD-ARGS are pairs of keywords and | 153 | The optional CUSTOM-KEYWORD-ARGS are pairs of keywords and values |
| 153 | values. They will be passed to the generated `defcustom' form of | 154 | to include in the generated `defcustom' form for the mode hook |
| 154 | the mode hook variable MODE-hook. Defaults to MODE without the | 155 | variable `MODE-hook'. The default value for the `:group' keyword |
| 155 | possible trailing \"-mode\". (This default may not be a valid | 156 | is MODE with the final \"-mode\" (if any) removed. (Don't use |
| 156 | customization group defined with `defgroup'. Make sure it is.) | 157 | this default group name unless you have written a `defgroup' to |
| 157 | You can specify keyword arguments without specifying a docstring. | 158 | define that group properly.) You can specify keyword arguments |
| 159 | without specifying a docstring. | ||
| 158 | 160 | ||
| 159 | See the file generic-x.el for some examples of `define-generic-mode'." | 161 | See the file generic-x.el for some examples of `define-generic-mode'." |
| 160 | (declare (debug (sexp def-form def-form def-form form def-form | 162 | (declare (debug (sexp def-form def-form def-form form def-form |
| @@ -178,7 +180,7 @@ See the file generic-x.el for some examples of `define-generic-mode'." | |||
| 178 | 180 | ||
| 179 | (unless (plist-get custom-keyword-args :group) | 181 | (unless (plist-get custom-keyword-args :group) |
| 180 | (setq custom-keyword-args | 182 | (setq custom-keyword-args |
| 181 | (plist-put custom-keyword-args | 183 | (plist-put custom-keyword-args |
| 182 | :group `',(intern (replace-regexp-in-string | 184 | :group `',(intern (replace-regexp-in-string |
| 183 | "-mode\\'" "" name))))) | 185 | "-mode\\'" "" name))))) |
| 184 | 186 | ||
| @@ -226,7 +228,7 @@ See the file generic-x.el for some examples of `define-generic-mode'." | |||
| 226 | (when keyword-list | 228 | (when keyword-list |
| 227 | (push (concat "\\_<" (regexp-opt keyword-list t) "\\_>") | 229 | (push (concat "\\_<" (regexp-opt keyword-list t) "\\_>") |
| 228 | generic-font-lock-keywords)) | 230 | generic-font-lock-keywords)) |
| 229 | (setq font-lock-defaults '(generic-font-lock-keywords nil)) | 231 | (setq font-lock-defaults '(generic-font-lock-keywords)) |
| 230 | 232 | ||
| 231 | ;; Call a list of functions | 233 | ;; Call a list of functions |
| 232 | (mapcar 'funcall function-list) | 234 | (mapcar 'funcall function-list) |
diff --git a/lisp/emulation/cua-base.el b/lisp/emulation/cua-base.el index 6aeb4bab5a2..2a515bc95f7 100644 --- a/lisp/emulation/cua-base.el +++ b/lisp/emulation/cua-base.el | |||
| @@ -1397,10 +1397,11 @@ paste (in addition to the normal emacs bindings)." | |||
| 1397 | ;;;###autoload '(error (concat "\n\n" | 1397 | ;;;###autoload '(error (concat "\n\n" |
| 1398 | ;;;###autoload "CUA-mode is now part of the standard GNU Emacs distribution,\n" | 1398 | ;;;###autoload "CUA-mode is now part of the standard GNU Emacs distribution,\n" |
| 1399 | ;;;###autoload "so you may now enable and customize CUA via the Options menu.\n\n" | 1399 | ;;;###autoload "so you may now enable and customize CUA via the Options menu.\n\n" |
| 1400 | ;;;###autoload "Your " (file-name-nondirectory user-init-file) " loads an older version of CUA-mode which does\n" | 1400 | ;;;###autoload "You have loaded an older version of CUA-mode which does\n" |
| 1401 | ;;;###autoload "not work correctly with this version of GNU Emacs.\n" | 1401 | ;;;###autoload "not work correctly with this version of GNU Emacs.\n\n" |
| 1402 | ;;;###autoload (if user-init-file (concat | ||
| 1402 | ;;;###autoload "To correct this, remove the loading and customization of the\n" | 1403 | ;;;###autoload "To correct this, remove the loading and customization of the\n" |
| 1403 | ;;;###autoload "old version from the " user-init-file " file.\n\n"))) | 1404 | ;;;###autoload "old version from the " user-init-file " file.\n\n"))))) |
| 1404 | 1405 | ||
| 1405 | (provide 'cua) | 1406 | (provide 'cua) |
| 1406 | 1407 | ||
diff --git a/lisp/files.el b/lisp/files.el index 407922082f1..ea4799968fe 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -286,30 +286,30 @@ from `mode-require-final-newline'." | |||
| 286 | :type '(choice (const :tag "When visiting" visit) | 286 | :type '(choice (const :tag "When visiting" visit) |
| 287 | (const :tag "When saving" t) | 287 | (const :tag "When saving" t) |
| 288 | (const :tag "When visiting or saving" visit-save) | 288 | (const :tag "When visiting or saving" visit-save) |
| 289 | (const :tag "Never" nil) | 289 | (const :tag "Don't add newlines" nil) |
| 290 | (other :tag "Ask" ask)) | 290 | (other :tag "Ask each time" ask)) |
| 291 | :group 'editing-basics) | 291 | :group 'editing-basics) |
| 292 | 292 | ||
| 293 | (defcustom mode-require-final-newline t | 293 | (defcustom mode-require-final-newline t |
| 294 | "*Whether to add a newline at end of file, in certain major modes. | 294 | "*Whether to add a newline at end of file, in certain major modes. |
| 295 | Those modes set `require-final-newline' to this value when you enable them. | 295 | Those modes set `require-final-newline' to this value when you enable them. |
| 296 | They do so because they are used for files that are supposed | 296 | They do so because they are often used for files that are supposed |
| 297 | to end in newlines, and the question is how to arrange that. | 297 | to end in newlines, and the question is how to arrange that. |
| 298 | 298 | ||
| 299 | A value of t means do this only when the file is about to be saved. | 299 | A value of t means do this only when the file is about to be saved. |
| 300 | A value of `visit' means do this right after the file is visited. | 300 | A value of `visit' means do this right after the file is visited. |
| 301 | A value of `visit-save' means do it at both of those times. | 301 | A value of `visit-save' means do it at both of those times. |
| 302 | Any other non-nil value means ask user whether to add a newline, when saving. | 302 | Any other non-nil value means ask user whether to add a newline, when saving. |
| 303 | nil means don't add newlines. | ||
| 304 | 303 | ||
| 305 | You will have to be careful if you set this to nil: you will have | 304 | nil means do not add newlines. That is a risky choice in this variable |
| 306 | to remember to manually add a final newline whenever you finish a | 305 | since this value is used for modes for files that ought to have final newlines. |
| 307 | file that really needs one." | 306 | So if you set this to nil, you must explicitly check and add |
| 307 | a final newline, whenever you save a file that really needs one." | ||
| 308 | :type '(choice (const :tag "When visiting" visit) | 308 | :type '(choice (const :tag "When visiting" visit) |
| 309 | (const :tag "When saving" t) | 309 | (const :tag "When saving" t) |
| 310 | (const :tag "When visiting or saving" visit-save) | 310 | (const :tag "When visiting or saving" visit-save) |
| 311 | (const :tag "Never" nil) | 311 | (const :tag "Don't add newlines" nil) |
| 312 | (other :tag "Ask" ask)) | 312 | (other :tag "Ask each time" ask)) |
| 313 | :group 'editing-basics | 313 | :group 'editing-basics |
| 314 | :version "22.1") | 314 | :version "22.1") |
| 315 | 315 | ||
| @@ -529,8 +529,8 @@ See Info node `(elisp)Standard File Names' for more details." | |||
| 529 | Value is not expanded---you must call `expand-file-name' yourself. | 529 | Value is not expanded---you must call `expand-file-name' yourself. |
| 530 | Default name to DEFAULT-DIRNAME if user exits with the same | 530 | Default name to DEFAULT-DIRNAME if user exits with the same |
| 531 | non-empty string that was inserted by this function. | 531 | non-empty string that was inserted by this function. |
| 532 | (If DEFAULT-DIRNAME is omitted, the current buffer's directory is used, | 532 | (If DEFAULT-DIRNAME is omitted, DIR combined with INITIAL is used, |
| 533 | except that if INITIAL is specified, that combined with DIR is used.) | 533 | or just DIR if INITIAL is nil.) |
| 534 | If the user exits with an empty minibuffer, this function returns | 534 | If the user exits with an empty minibuffer, this function returns |
| 535 | an empty string. (This can only happen if the user erased the | 535 | an empty string. (This can only happen if the user erased the |
| 536 | pre-inserted contents or if `insert-default-directory' is nil.) | 536 | pre-inserted contents or if `insert-default-directory' is nil.) |
| @@ -544,7 +544,10 @@ the value of `default-directory'." | |||
| 544 | (unless default-dirname | 544 | (unless default-dirname |
| 545 | (setq default-dirname | 545 | (setq default-dirname |
| 546 | (if initial (concat dir initial) default-directory))) | 546 | (if initial (concat dir initial) default-directory))) |
| 547 | (read-file-name prompt dir default-dirname mustmatch initial | 547 | (read-file-name prompt dir (or default-dirname |
| 548 | (if initial (expand-file-name initial dir) | ||
| 549 | dir)) | ||
| 550 | mustmatch initial | ||
| 548 | 'file-directory-p)) | 551 | 'file-directory-p)) |
| 549 | 552 | ||
| 550 | 553 | ||
| @@ -940,12 +943,13 @@ BODY should use the minibuffer at most once. | |||
| 940 | Recursive uses of the minibuffer will not be affected." | 943 | Recursive uses of the minibuffer will not be affected." |
| 941 | (declare (indent 1) (debug t)) | 944 | (declare (indent 1) (debug t)) |
| 942 | (let ((hook (make-symbol "setup-hook"))) | 945 | (let ((hook (make-symbol "setup-hook"))) |
| 943 | `(let ((,hook | 946 | `(let (,hook) |
| 944 | (lambda () | 947 | (setq ,hook |
| 945 | ;; Clear out this hook so it does not interfere | 948 | (lambda () |
| 946 | ;; with any recursive minibuffer usage. | 949 | ;; Clear out this hook so it does not interfere |
| 947 | (remove-hook 'minibuffer-setup-hook ,hook) | 950 | ;; with any recursive minibuffer usage. |
| 948 | (,fun)))) | 951 | (remove-hook 'minibuffer-setup-hook ,hook) |
| 952 | (,fun))) | ||
| 949 | (unwind-protect | 953 | (unwind-protect |
| 950 | (progn | 954 | (progn |
| 951 | (add-hook 'minibuffer-setup-hook ,hook) | 955 | (add-hook 'minibuffer-setup-hook ,hook) |
| @@ -1973,8 +1977,13 @@ with that interpreter in `interpreter-mode-alist'.") | |||
| 1973 | ("%![^V]" . ps-mode) | 1977 | ("%![^V]" . ps-mode) |
| 1974 | ("# xmcd " . conf-unix-mode)) | 1978 | ("# xmcd " . conf-unix-mode)) |
| 1975 | "Alist of buffer beginnings vs. corresponding major mode functions. | 1979 | "Alist of buffer beginnings vs. corresponding major mode functions. |
| 1976 | Each element looks like (REGEXP . FUNCTION). FUNCTION will be | 1980 | Each element looks like (REGEXP . FUNCTION). After visiting a file, |
| 1977 | called, unless it is nil (to allow `auto-mode-alist' to override).") | 1981 | if REGEXP matches the text at the beginning of the buffer, |
| 1982 | `normal-mode' will call FUNCTION rather than allowing `auto-mode-alist' | ||
| 1983 | to decide the buffer's major mode. | ||
| 1984 | |||
| 1985 | If FUNCTION is nil, then it is not called. (That is a way of saying | ||
| 1986 | \"allow `auto-mode-alist' to decide for these files.") | ||
| 1978 | 1987 | ||
| 1979 | (defun set-auto-mode (&optional keep-mode-if-same) | 1988 | (defun set-auto-mode (&optional keep-mode-if-same) |
| 1980 | "Select major mode appropriate for current buffer. | 1989 | "Select major mode appropriate for current buffer. |
| @@ -2740,15 +2749,26 @@ BACKUPNAME is the backup file name, which is the old file renamed." | |||
| 2740 | (file-error nil)))))) | 2749 | (file-error nil)))))) |
| 2741 | 2750 | ||
| 2742 | (defun backup-buffer-copy (from-name to-name modes) | 2751 | (defun backup-buffer-copy (from-name to-name modes) |
| 2743 | (condition-case () | 2752 | (let ((umask (default-file-modes))) |
| 2744 | (copy-file from-name to-name t t) | 2753 | (unwind-protect |
| 2745 | (file-error | 2754 | (progn |
| 2746 | ;; If copying fails because file TO-NAME | 2755 | ;; Create temp files with strict access rights. It's easy to |
| 2747 | ;; is not writable, delete that file and try again. | 2756 | ;; loosen them later, whereas it's impossible to close the |
| 2748 | (if (and (file-exists-p to-name) | 2757 | ;; time-window of loose permissions otherwise. |
| 2749 | (not (file-writable-p to-name))) | 2758 | (set-default-file-modes ?\700) |
| 2750 | (delete-file to-name)) | 2759 | (while (condition-case () |
| 2751 | (copy-file from-name to-name t t))) | 2760 | (progn |
| 2761 | (condition-case nil | ||
| 2762 | (delete-file to-name) | ||
| 2763 | (file-error nil)) | ||
| 2764 | (copy-file from-name to-name t t 'excl) | ||
| 2765 | nil) | ||
| 2766 | (file-already-exists t)) | ||
| 2767 | ;; The file was somehow created by someone else between | ||
| 2768 | ;; `delete-file' and `copy-file', so let's try again. | ||
| 2769 | nil)) | ||
| 2770 | ;; Reset the umask. | ||
| 2771 | (set-default-file-modes umask))) | ||
| 2752 | (and modes | 2772 | (and modes |
| 2753 | (set-file-modes to-name (logand modes #o1777)))) | 2773 | (set-file-modes to-name (logand modes #o1777)))) |
| 2754 | 2774 | ||
| @@ -3331,39 +3351,41 @@ Before and after saving the buffer, this function runs | |||
| 3331 | ;; This requires write access to the containing dir, | 3351 | ;; This requires write access to the containing dir, |
| 3332 | ;; which is why we don't try it if we don't have that access. | 3352 | ;; which is why we don't try it if we don't have that access. |
| 3333 | (let ((realname buffer-file-name) | 3353 | (let ((realname buffer-file-name) |
| 3334 | tempname nogood i succeed | 3354 | tempname succeed |
| 3355 | (umask (default-file-modes)) | ||
| 3335 | (old-modtime (visited-file-modtime))) | 3356 | (old-modtime (visited-file-modtime))) |
| 3336 | (setq i 0) | 3357 | ;; Create temp files with strict access rights. It's easy to |
| 3337 | (setq nogood t) | 3358 | ;; loosen them later, whereas it's impossible to close the |
| 3338 | ;; Find the temporary name to write under. | 3359 | ;; time-window of loose permissions otherwise. |
| 3339 | (while nogood | ||
| 3340 | (setq tempname (format | ||
| 3341 | (if (and (eq system-type 'ms-dos) | ||
| 3342 | (not (msdos-long-file-names))) | ||
| 3343 | "%s#%d.tm#" ; MSDOS limits files to 8+3 | ||
| 3344 | (if (memq system-type '(vax-vms axp-vms)) | ||
| 3345 | "%s$tmp$%d" | ||
| 3346 | "%s#tmp#%d")) | ||
| 3347 | dir i)) | ||
| 3348 | (setq nogood (file-exists-p tempname)) | ||
| 3349 | (setq i (1+ i))) | ||
| 3350 | (unwind-protect | 3360 | (unwind-protect |
| 3351 | (progn (clear-visited-file-modtime) | 3361 | (progn |
| 3352 | (write-region (point-min) (point-max) | 3362 | (clear-visited-file-modtime) |
| 3353 | tempname nil realname | 3363 | (set-default-file-modes ?\700) |
| 3354 | buffer-file-truename) | 3364 | ;; Try various temporary names. |
| 3355 | (setq succeed t)) | 3365 | ;; This code follows the example of make-temp-file, |
| 3356 | ;; If writing the temp file fails, | 3366 | ;; but it calls write-region in the appropriate way |
| 3357 | ;; delete the temp file. | 3367 | ;; for saving the buffer. |
| 3358 | (or succeed | 3368 | (while (condition-case () |
| 3359 | (progn | 3369 | (progn |
| 3360 | (condition-case nil | 3370 | (setq tempname |
| 3361 | (delete-file tempname) | 3371 | (make-temp-name |
| 3362 | (file-error nil)) | 3372 | (expand-file-name "tmp" dir))) |
| 3363 | (set-visited-file-modtime old-modtime)))) | 3373 | (write-region (point-min) (point-max) |
| 3364 | ;; Since we have created an entirely new file | 3374 | tempname nil realname |
| 3365 | ;; and renamed it, make sure it gets the | 3375 | buffer-file-truename 'excl) |
| 3366 | ;; right permission bits set. | 3376 | nil) |
| 3377 | (file-already-exists t)) | ||
| 3378 | ;; The file was somehow created by someone else between | ||
| 3379 | ;; `make-temp-name' and `write-region', let's try again. | ||
| 3380 | nil) | ||
| 3381 | (setq succeed t)) | ||
| 3382 | ;; Reset the umask. | ||
| 3383 | (set-default-file-modes umask) | ||
| 3384 | ;; If we failed, restore the buffer's modtime. | ||
| 3385 | (unless succeed | ||
| 3386 | (set-visited-file-modtime old-modtime))) | ||
| 3387 | ;; Since we have created an entirely new file, | ||
| 3388 | ;; make sure it gets the right permission bits set. | ||
| 3367 | (setq setmodes (or setmodes (cons (file-modes buffer-file-name) | 3389 | (setq setmodes (or setmodes (cons (file-modes buffer-file-name) |
| 3368 | buffer-file-name))) | 3390 | buffer-file-name))) |
| 3369 | ;; We succeeded in writing the temp file, | 3391 | ;; We succeeded in writing the temp file, |
| @@ -3649,7 +3671,7 @@ The function you specify is responsible for updating (or preserving) point.") | |||
| 3649 | (defvar buffer-stale-function nil | 3671 | (defvar buffer-stale-function nil |
| 3650 | "Function to check whether a non-file buffer needs reverting. | 3672 | "Function to check whether a non-file buffer needs reverting. |
| 3651 | This should be a function with one optional argument NOCONFIRM. | 3673 | This should be a function with one optional argument NOCONFIRM. |
| 3652 | Auto Revert Mode sets NOCONFIRM to t. The function should return | 3674 | Auto Revert Mode passes t for NOCONFIRM. The function should return |
| 3653 | non-nil if the buffer should be reverted. A return value of | 3675 | non-nil if the buffer should be reverted. A return value of |
| 3654 | `fast' means that the need for reverting was not checked, but | 3676 | `fast' means that the need for reverting was not checked, but |
| 3655 | that reverting the buffer is fast. The buffer is current when | 3677 | that reverting the buffer is fast. The buffer is current when |
| @@ -3718,91 +3740,93 @@ non-nil, it is called instead of rereading visited file contents." | |||
| 3718 | (interactive (list (not current-prefix-arg))) | 3740 | (interactive (list (not current-prefix-arg))) |
| 3719 | (if revert-buffer-function | 3741 | (if revert-buffer-function |
| 3720 | (funcall revert-buffer-function ignore-auto noconfirm) | 3742 | (funcall revert-buffer-function ignore-auto noconfirm) |
| 3721 | (let* ((auto-save-p (and (not ignore-auto) | 3743 | (with-current-buffer (or (buffer-base-buffer (current-buffer)) |
| 3722 | (recent-auto-save-p) | 3744 | (current-buffer)) |
| 3723 | buffer-auto-save-file-name | 3745 | (let* ((auto-save-p (and (not ignore-auto) |
| 3724 | (file-readable-p buffer-auto-save-file-name) | 3746 | (recent-auto-save-p) |
| 3725 | (y-or-n-p | 3747 | buffer-auto-save-file-name |
| 3726 | "Buffer has been auto-saved recently. Revert from auto-save file? "))) | 3748 | (file-readable-p buffer-auto-save-file-name) |
| 3727 | (file-name (if auto-save-p | 3749 | (y-or-n-p |
| 3728 | buffer-auto-save-file-name | 3750 | "Buffer has been auto-saved recently. Revert from auto-save file? "))) |
| 3729 | buffer-file-name))) | 3751 | (file-name (if auto-save-p |
| 3730 | (cond ((null file-name) | 3752 | buffer-auto-save-file-name |
| 3731 | (error "Buffer does not seem to be associated with any file")) | 3753 | buffer-file-name))) |
| 3732 | ((or noconfirm | 3754 | (cond ((null file-name) |
| 3733 | (and (not (buffer-modified-p)) | 3755 | (error "Buffer does not seem to be associated with any file")) |
| 3734 | (let ((tail revert-without-query) | 3756 | ((or noconfirm |
| 3735 | (found nil)) | 3757 | (and (not (buffer-modified-p)) |
| 3736 | (while tail | 3758 | (let ((tail revert-without-query) |
| 3737 | (if (string-match (car tail) file-name) | 3759 | (found nil)) |
| 3738 | (setq found t)) | 3760 | (while tail |
| 3739 | (setq tail (cdr tail))) | 3761 | (if (string-match (car tail) file-name) |
| 3740 | found)) | 3762 | (setq found t)) |
| 3741 | (yes-or-no-p (format "Revert buffer from file %s? " | 3763 | (setq tail (cdr tail))) |
| 3742 | file-name))) | 3764 | found)) |
| 3743 | (run-hooks 'before-revert-hook) | 3765 | (yes-or-no-p (format "Revert buffer from file %s? " |
| 3744 | ;; If file was backed up but has changed since, | 3766 | file-name))) |
| 3745 | ;; we shd make another backup. | 3767 | (run-hooks 'before-revert-hook) |
| 3746 | (and (not auto-save-p) | 3768 | ;; If file was backed up but has changed since, |
| 3747 | (not (verify-visited-file-modtime (current-buffer))) | 3769 | ;; we shd make another backup. |
| 3748 | (setq buffer-backed-up nil)) | 3770 | (and (not auto-save-p) |
| 3749 | ;; Get rid of all undo records for this buffer. | 3771 | (not (verify-visited-file-modtime (current-buffer))) |
| 3750 | (or (eq buffer-undo-list t) | 3772 | (setq buffer-backed-up nil)) |
| 3751 | (setq buffer-undo-list nil)) | 3773 | ;; Get rid of all undo records for this buffer. |
| 3752 | ;; Effectively copy the after-revert-hook status, | 3774 | (or (eq buffer-undo-list t) |
| 3753 | ;; since after-find-file will clobber it. | 3775 | (setq buffer-undo-list nil)) |
| 3754 | (let ((global-hook (default-value 'after-revert-hook)) | 3776 | ;; Effectively copy the after-revert-hook status, |
| 3755 | (local-hook-p (local-variable-p 'after-revert-hook)) | 3777 | ;; since after-find-file will clobber it. |
| 3756 | (local-hook (and (local-variable-p 'after-revert-hook) | 3778 | (let ((global-hook (default-value 'after-revert-hook)) |
| 3757 | after-revert-hook))) | 3779 | (local-hook-p (local-variable-p 'after-revert-hook)) |
| 3758 | (let (buffer-read-only | 3780 | (local-hook (and (local-variable-p 'after-revert-hook) |
| 3759 | ;; Don't make undo records for the reversion. | 3781 | after-revert-hook))) |
| 3760 | (buffer-undo-list t)) | 3782 | (let (buffer-read-only |
| 3761 | (if revert-buffer-insert-file-contents-function | 3783 | ;; Don't make undo records for the reversion. |
| 3762 | (funcall revert-buffer-insert-file-contents-function | 3784 | (buffer-undo-list t)) |
| 3763 | file-name auto-save-p) | 3785 | (if revert-buffer-insert-file-contents-function |
| 3764 | (if (not (file-exists-p file-name)) | 3786 | (funcall revert-buffer-insert-file-contents-function |
| 3765 | (error (if buffer-file-number | 3787 | file-name auto-save-p) |
| 3766 | "File %s no longer exists!" | 3788 | (if (not (file-exists-p file-name)) |
| 3767 | "Cannot revert nonexistent file %s") | 3789 | (error (if buffer-file-number |
| 3768 | file-name)) | 3790 | "File %s no longer exists!" |
| 3769 | ;; Bind buffer-file-name to nil | 3791 | "Cannot revert nonexistent file %s") |
| 3770 | ;; so that we don't try to lock the file. | 3792 | file-name)) |
| 3771 | (let ((buffer-file-name nil)) | 3793 | ;; Bind buffer-file-name to nil |
| 3772 | (or auto-save-p | 3794 | ;; so that we don't try to lock the file. |
| 3773 | (unlock-buffer))) | 3795 | (let ((buffer-file-name nil)) |
| 3774 | (widen) | 3796 | (or auto-save-p |
| 3775 | (let ((coding-system-for-read | 3797 | (unlock-buffer))) |
| 3776 | ;; Auto-saved file shoule be read by Emacs' | 3798 | (widen) |
| 3777 | ;; internal coding. | 3799 | (let ((coding-system-for-read |
| 3778 | (if auto-save-p 'auto-save-coding | 3800 | ;; Auto-saved file shoule be read by Emacs' |
| 3779 | (or coding-system-for-read | 3801 | ;; internal coding. |
| 3780 | buffer-file-coding-system-explicit)))) | 3802 | (if auto-save-p 'auto-save-coding |
| 3781 | ;; This force after-insert-file-set-coding | 3803 | (or coding-system-for-read |
| 3782 | ;; (called from insert-file-contents) to set | 3804 | buffer-file-coding-system-explicit)))) |
| 3783 | ;; buffer-file-coding-system to a proper value. | 3805 | ;; This force after-insert-file-set-coding |
| 3784 | (kill-local-variable 'buffer-file-coding-system) | 3806 | ;; (called from insert-file-contents) to set |
| 3785 | 3807 | ;; buffer-file-coding-system to a proper value. | |
| 3786 | ;; Note that this preserves point in an intelligent way. | 3808 | (kill-local-variable 'buffer-file-coding-system) |
| 3787 | (if preserve-modes | 3809 | |
| 3788 | (let ((buffer-file-format buffer-file-format)) | 3810 | ;; Note that this preserves point in an intelligent way. |
| 3789 | (insert-file-contents file-name (not auto-save-p) | 3811 | (if preserve-modes |
| 3790 | nil nil t)) | 3812 | (let ((buffer-file-format buffer-file-format)) |
| 3791 | (insert-file-contents file-name (not auto-save-p) | 3813 | (insert-file-contents file-name (not auto-save-p) |
| 3792 | nil nil t))))) | 3814 | nil nil t)) |
| 3793 | ;; Recompute the truename in case changes in symlinks | 3815 | (insert-file-contents file-name (not auto-save-p) |
| 3794 | ;; have changed the truename. | 3816 | nil nil t))))) |
| 3795 | (setq buffer-file-truename | 3817 | ;; Recompute the truename in case changes in symlinks |
| 3796 | (abbreviate-file-name (file-truename buffer-file-name))) | 3818 | ;; have changed the truename. |
| 3797 | (after-find-file nil nil t t preserve-modes) | 3819 | (setq buffer-file-truename |
| 3798 | ;; Run after-revert-hook as it was before we reverted. | 3820 | (abbreviate-file-name (file-truename buffer-file-name))) |
| 3799 | (setq-default revert-buffer-internal-hook global-hook) | 3821 | (after-find-file nil nil t t preserve-modes) |
| 3800 | (if local-hook-p | 3822 | ;; Run after-revert-hook as it was before we reverted. |
| 3801 | (set (make-local-variable 'revert-buffer-internal-hook) | 3823 | (setq-default revert-buffer-internal-hook global-hook) |
| 3802 | local-hook) | 3824 | (if local-hook-p |
| 3803 | (kill-local-variable 'revert-buffer-internal-hook)) | 3825 | (set (make-local-variable 'revert-buffer-internal-hook) |
| 3804 | (run-hooks 'revert-buffer-internal-hook)) | 3826 | local-hook) |
| 3805 | t))))) | 3827 | (kill-local-variable 'revert-buffer-internal-hook)) |
| 3828 | (run-hooks 'revert-buffer-internal-hook)) | ||
| 3829 | t)))))) | ||
| 3806 | 3830 | ||
| 3807 | (defun recover-this-file () | 3831 | (defun recover-this-file () |
| 3808 | "Recover the visited file--get contents from its last auto-save file." | 3832 | "Recover the visited file--get contents from its last auto-save file." |
diff --git a/lisp/follow.el b/lisp/follow.el index a01b0e77eb2..61517a68ff1 100644 --- a/lisp/follow.el +++ b/lisp/follow.el | |||
| @@ -980,7 +980,8 @@ of the way from the true end." | |||
| 980 | (t | 980 | (t |
| 981 | (select-window (car (reverse followers))))) | 981 | (select-window (car (reverse followers))))) |
| 982 | (goto-char pos) | 982 | (goto-char pos) |
| 983 | (end-of-buffer arg))) | 983 | (with-no-warnings |
| 984 | (end-of-buffer arg)))) | ||
| 984 | 985 | ||
| 985 | ;;}}} | 986 | ;;}}} |
| 986 | 987 | ||
diff --git a/lisp/font-core.el b/lisp/font-core.el index 5bf30d4d6c5..a077ce756c0 100644 --- a/lisp/font-core.el +++ b/lisp/font-core.el | |||
| @@ -32,7 +32,7 @@ | |||
| 32 | "Defaults for Font Lock mode specified by the major mode. | 32 | "Defaults for Font Lock mode specified by the major mode. |
| 33 | Defaults should be of the form: | 33 | Defaults should be of the form: |
| 34 | 34 | ||
| 35 | (KEYWORDS KEYWORDS-ONLY CASE-FOLD SYNTAX-ALIST SYNTAX-BEGIN ...) | 35 | (KEYWORDS [KEYWORDS-ONLY [CASE-FOLD [SYNTAX-ALIST [SYNTAX-BEGIN ...]]]]) |
| 36 | 36 | ||
| 37 | KEYWORDS may be a symbol (a variable or function whose value is the keywords to | 37 | KEYWORDS may be a symbol (a variable or function whose value is the keywords to |
| 38 | use for fontification) or a list of symbols. If KEYWORDS-ONLY is non-nil, | 38 | use for fontification) or a list of symbols. If KEYWORDS-ONLY is non-nil, |
| @@ -66,11 +66,10 @@ textual modes (i.e., the mode-dependent function is known to put point and mark | |||
| 66 | around a text block relevant to that mode). | 66 | around a text block relevant to that mode). |
| 67 | 67 | ||
| 68 | Other variables include that for syntactic keyword fontification, | 68 | Other variables include that for syntactic keyword fontification, |
| 69 | `font-lock-syntactic-keywords' | 69 | `font-lock-syntactic-keywords' and those for buffer-specialized fontification |
| 70 | and those for buffer-specialized fontification functions, | 70 | functions, `font-lock-fontify-buffer-function', |
| 71 | `font-lock-fontify-buffer-function', `font-lock-unfontify-buffer-function', | 71 | `font-lock-unfontify-buffer-function', `font-lock-fontify-region-function', |
| 72 | `font-lock-fontify-region-function', `font-lock-unfontify-region-function', | 72 | `font-lock-unfontify-region-function', and `font-lock-inhibit-thing-lock'.") |
| 73 | `font-lock-inhibit-thing-lock' and `font-lock-maximum-size'.") | ||
| 74 | (make-variable-buffer-local 'font-lock-defaults) | 73 | (make-variable-buffer-local 'font-lock-defaults) |
| 75 | 74 | ||
| 76 | (defvar font-lock-defaults-alist nil | 75 | (defvar font-lock-defaults-alist nil |
diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 59d68e6376d..906169a0d9b 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el | |||
| @@ -309,6 +309,9 @@ If a number, only buffers greater than this size have fontification messages." | |||
| 309 | (defvar font-lock-comment-face 'font-lock-comment-face | 309 | (defvar font-lock-comment-face 'font-lock-comment-face |
| 310 | "Face name to use for comments.") | 310 | "Face name to use for comments.") |
| 311 | 311 | ||
| 312 | (defvar font-lock-comment-delimiter-face 'font-lock-comment-delimiter-face | ||
| 313 | "Face name to use for comment delimiters.") | ||
| 314 | |||
| 312 | (defvar font-lock-string-face 'font-lock-string-face | 315 | (defvar font-lock-string-face 'font-lock-string-face |
| 313 | "Face name to use for strings.") | 316 | "Face name to use for strings.") |
| 314 | 317 | ||
| @@ -463,12 +466,12 @@ user-level keywords, but normally their values have been | |||
| 463 | optimized.") | 466 | optimized.") |
| 464 | 467 | ||
| 465 | (defvar font-lock-keywords-alist nil | 468 | (defvar font-lock-keywords-alist nil |
| 466 | "*Alist of `font-lock-keywords' local to a `major-mode'. | 469 | "Alist of `font-lock-keywords' local to a `major-mode'. |
| 467 | This is normally set via `font-lock-add-keywords' and | 470 | This is normally set via `font-lock-add-keywords' and |
| 468 | `font-lock-remove-keywords'.") | 471 | `font-lock-remove-keywords'.") |
| 469 | 472 | ||
| 470 | (defvar font-lock-removed-keywords-alist nil | 473 | (defvar font-lock-removed-keywords-alist nil |
| 471 | "*Alist of `font-lock-keywords' removed from `major-mode'. | 474 | "Alist of `font-lock-keywords' removed from `major-mode'. |
| 472 | This is normally set via `font-lock-add-keywords' and | 475 | This is normally set via `font-lock-add-keywords' and |
| 473 | `font-lock-remove-keywords'.") | 476 | `font-lock-remove-keywords'.") |
| 474 | 477 | ||
| @@ -493,7 +496,7 @@ sometimes be slightly incorrect.") | |||
| 493 | "Function to determine which face to use when fontifying syntactically. | 496 | "Function to determine which face to use when fontifying syntactically. |
| 494 | The function is called with a single parameter (the state as returned by | 497 | The function is called with a single parameter (the state as returned by |
| 495 | `parse-partial-sexp' at the beginning of the region to highlight) and | 498 | `parse-partial-sexp' at the beginning of the region to highlight) and |
| 496 | should return a face.") | 499 | should return a face. This is normally set via `font-lock-defaults'.") |
| 497 | 500 | ||
| 498 | (defvar font-lock-syntactic-keywords nil | 501 | (defvar font-lock-syntactic-keywords nil |
| 499 | "A list of the syntactic keywords to highlight. | 502 | "A list of the syntactic keywords to highlight. |
| @@ -565,8 +568,8 @@ This is normally set via `font-lock-defaults'.") | |||
| 565 | (defvar font-lock-fontify-region-function 'font-lock-default-fontify-region | 568 | (defvar font-lock-fontify-region-function 'font-lock-default-fontify-region |
| 566 | "Function to use for fontifying a region. | 569 | "Function to use for fontifying a region. |
| 567 | It should take two args, the beginning and end of the region, and an optional | 570 | It should take two args, the beginning and end of the region, and an optional |
| 568 | third arg VERBOSE. If non-nil, the function should print status messages. | 571 | third arg VERBOSE. If VERBOSE is non-nil, the function should print status |
| 569 | This is normally set via `font-lock-defaults'.") | 572 | messages. This is normally set via `font-lock-defaults'.") |
| 570 | 573 | ||
| 571 | (defvar font-lock-unfontify-region-function 'font-lock-default-unfontify-region | 574 | (defvar font-lock-unfontify-region-function 'font-lock-default-unfontify-region |
| 572 | "Function to use for unfontifying a region. | 575 | "Function to use for unfontifying a region. |
| @@ -643,6 +646,7 @@ Major/minor modes can set this variable if they know which option applies.") | |||
| 643 | ;;;###autoload | 646 | ;;;###autoload |
| 644 | (defun font-lock-add-keywords (mode keywords &optional append) | 647 | (defun font-lock-add-keywords (mode keywords &optional append) |
| 645 | "Add highlighting KEYWORDS for MODE. | 648 | "Add highlighting KEYWORDS for MODE. |
| 649 | |||
| 646 | MODE should be a symbol, the major mode command name, such as `c-mode' | 650 | MODE should be a symbol, the major mode command name, such as `c-mode' |
| 647 | or nil. If nil, highlighting keywords are added for the current buffer. | 651 | or nil. If nil, highlighting keywords are added for the current buffer. |
| 648 | KEYWORDS should be a list; see the variable `font-lock-keywords'. | 652 | KEYWORDS should be a list; see the variable `font-lock-keywords'. |
| @@ -660,9 +664,9 @@ For example: | |||
| 660 | adds two fontification patterns for C mode, to fontify `FIXME:' words, even in | 664 | adds two fontification patterns for C mode, to fontify `FIXME:' words, even in |
| 661 | comments, and to fontify `and', `or' and `not' words as keywords. | 665 | comments, and to fontify `and', `or' and `not' words as keywords. |
| 662 | 666 | ||
| 663 | When used from an elisp package (such as a minor mode), it is recommended | 667 | When used from a Lisp program (such as a minor mode), it is recommended to |
| 664 | to use nil for MODE (and place the call in a loop or on a hook) to avoid | 668 | use nil for MODE (and place the call on a hook) to avoid subtle problems |
| 665 | subtle problems due to details of the implementation. | 669 | due to details of the implementation. |
| 666 | 670 | ||
| 667 | Note that some modes have specialized support for additional patterns, e.g., | 671 | Note that some modes have specialized support for additional patterns, e.g., |
| 668 | see the variables `c-font-lock-extra-types', `c++-font-lock-extra-types', | 672 | see the variables `c-font-lock-extra-types', `c++-font-lock-extra-types', |
| @@ -703,9 +707,7 @@ see the variables `c-font-lock-extra-types', `c++-font-lock-extra-types', | |||
| 703 | (font-lock-compile-keywords font-lock-keywords t))))))) | 707 | (font-lock-compile-keywords font-lock-keywords t))))))) |
| 704 | 708 | ||
| 705 | (defun font-lock-update-removed-keyword-alist (mode keywords append) | 709 | (defun font-lock-update-removed-keyword-alist (mode keywords append) |
| 706 | ;; Update `font-lock-removed-keywords-alist' when adding new | 710 | "Update `font-lock-removed-keywords-alist' when adding new KEYWORDS to MODE." |
| 707 | ;; KEYWORDS to MODE. | ||
| 708 | ;; | ||
| 709 | ;; When font-lock is enabled first all keywords in the list | 711 | ;; When font-lock is enabled first all keywords in the list |
| 710 | ;; `font-lock-keywords-alist' are added, then all keywords in the | 712 | ;; `font-lock-keywords-alist' are added, then all keywords in the |
| 711 | ;; list `font-lock-removed-keywords-alist' are removed. If a | 713 | ;; list `font-lock-removed-keywords-alist' are removed. If a |
| @@ -753,9 +755,9 @@ see the variables `c-font-lock-extra-types', `c++-font-lock-extra-types', | |||
| 753 | MODE should be a symbol, the major mode command name, such as `c-mode' | 755 | MODE should be a symbol, the major mode command name, such as `c-mode' |
| 754 | or nil. If nil, highlighting keywords are removed for the current buffer. | 756 | or nil. If nil, highlighting keywords are removed for the current buffer. |
| 755 | 757 | ||
| 756 | When used from an elisp package (such as a minor mode), it is recommended | 758 | When used from a Lisp program (such as a minor mode), it is recommended to |
| 757 | to use nil for MODE (and place the call in a loop or on a hook) to avoid | 759 | use nil for MODE (and place the call on a hook) to avoid subtle problems |
| 758 | subtle problems due to details of the implementation." | 760 | due to details of the implementation." |
| 759 | (cond (mode | 761 | (cond (mode |
| 760 | ;; Remove one keyword at the time. | 762 | ;; Remove one keyword at the time. |
| 761 | (dolist (keyword keywords) | 763 | (dolist (keyword keywords) |
| @@ -1004,7 +1006,8 @@ a very meaningful entity to highlight.") | |||
| 1004 | 1006 | ||
| 1005 | (defun font-lock-default-fontify-region (beg end loudly) | 1007 | (defun font-lock-default-fontify-region (beg end loudly) |
| 1006 | (save-buffer-state | 1008 | (save-buffer-state |
| 1007 | ((parse-sexp-lookup-properties font-lock-syntactic-keywords) | 1009 | ((parse-sexp-lookup-properties |
| 1010 | (or parse-sexp-lookup-properties font-lock-syntactic-keywords)) | ||
| 1008 | (old-syntax-table (syntax-table))) | 1011 | (old-syntax-table (syntax-table))) |
| 1009 | (unwind-protect | 1012 | (unwind-protect |
| 1010 | (save-restriction | 1013 | (save-restriction |
| @@ -1615,7 +1618,7 @@ Sets various variables using `font-lock-defaults' (or, if nil, using | |||
| 1615 | 1618 | ||
| 1616 | ;; But now we do it the custom way. Note that `defface' will not overwrite any | 1619 | ;; But now we do it the custom way. Note that `defface' will not overwrite any |
| 1617 | ;; faces declared above via `custom-declare-face'. | 1620 | ;; faces declared above via `custom-declare-face'. |
| 1618 | (defface font-lock-comment-face | 1621 | (defface font-lock-comment-delimiter-face |
| 1619 | '((((class grayscale) (background light)) | 1622 | '((((class grayscale) (background light)) |
| 1620 | (:foreground "DimGray" :weight bold :slant italic)) | 1623 | (:foreground "DimGray" :weight bold :slant italic)) |
| 1621 | (((class grayscale) (background dark)) | 1624 | (((class grayscale) (background dark)) |
| @@ -1633,6 +1636,27 @@ Sets various variables using `font-lock-defaults' (or, if nil, using | |||
| 1633 | (((class color) (min-colors 8) (background dark)) | 1636 | (((class color) (min-colors 8) (background dark)) |
| 1634 | (:foreground "red1")) | 1637 | (:foreground "red1")) |
| 1635 | (t (:weight bold :slant italic))) | 1638 | (t (:weight bold :slant italic))) |
| 1639 | "Font Lock mode face used to highlight comment delimiters." | ||
| 1640 | :group 'font-lock-highlighting-faces) | ||
| 1641 | |||
| 1642 | (defface font-lock-comment-face | ||
| 1643 | '((((class grayscale) (background light)) | ||
| 1644 | (:foreground "DimGray" :weight bold :slant italic)) | ||
| 1645 | (((class grayscale) (background dark)) | ||
| 1646 | (:foreground "LightGray" :weight bold :slant italic)) | ||
| 1647 | (((class color) (min-colors 88) (background light)) | ||
| 1648 | (:foreground "Firebrick")) | ||
| 1649 | (((class color) (min-colors 88) (background dark)) | ||
| 1650 | (:foreground "chocolate1")) | ||
| 1651 | (((class color) (min-colors 16) (background light)) | ||
| 1652 | (:foreground "red")) | ||
| 1653 | (((class color) (min-colors 16) (background dark)) | ||
| 1654 | (:foreground "red1")) | ||
| 1655 | (((class color) (min-colors 8) (background light)) | ||
| 1656 | ) | ||
| 1657 | (((class color) (min-colors 8) (background dark)) | ||
| 1658 | ) | ||
| 1659 | (t (:weight bold :slant italic))) | ||
| 1636 | "Font Lock mode face used to highlight comments." | 1660 | "Font Lock mode face used to highlight comments." |
| 1637 | :group 'font-lock-highlighting-faces) | 1661 | :group 'font-lock-highlighting-faces) |
| 1638 | 1662 | ||
diff --git a/lisp/generic-x.el b/lisp/generic-x.el index a13103edb3d..31aa9299fbb 100644 --- a/lisp/generic-x.el +++ b/lisp/generic-x.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; generic-x.el --- Extra Modes for generic-mode | 1 | ;;; generic-x.el --- A collection of generic modes |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1997, 1998, 2003, 2005 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1997, 1998, 2003, 2005 Free Software Foundation, Inc. |
| 4 | 4 | ||
| @@ -25,7 +25,7 @@ | |||
| 25 | 25 | ||
| 26 | ;;; Commentary: | 26 | ;;; Commentary: |
| 27 | ;; | 27 | ;; |
| 28 | ;; This file contains some pre-defined generic-modes. | 28 | ;; This file contains a collection generic modes. |
| 29 | ;; | 29 | ;; |
| 30 | ;; INSTALLATION: | 30 | ;; INSTALLATION: |
| 31 | ;; | 31 | ;; |
| @@ -34,12 +34,18 @@ | |||
| 34 | ;; (require 'generic-x) | 34 | ;; (require 'generic-x) |
| 35 | ;; | 35 | ;; |
| 36 | ;; You can decide which modes to load by setting the variable | 36 | ;; You can decide which modes to load by setting the variable |
| 37 | ;; `generic-extras-enable-list'. Some platform-specific modes are | 37 | ;; `generic-extras-enable-list'. Its default value is platform- |
| 38 | ;; affected by the variables `generic-define-mswindows-modes' and | 38 | ;; specific. The recommended way to set this variable is through |
| 39 | ;; `generic-define-unix-modes' (which see). | 39 | ;; customize: |
| 40 | ;; | 40 | ;; |
| 41 | ;; You can also send in new modes; if the file types a reasonably common, | 41 | ;; M-x customize-option RET generic-extras-enable-list RET |
| 42 | ;; we would like to install them. | 42 | ;; |
| 43 | ;; This lets you select generic modes from the list of available | ||
| 44 | ;; modes. If you manually set `generic-extras-enable-list' in your | ||
| 45 | ;; .emacs, do it BEFORE loading generic-x with (require 'generic-x). | ||
| 46 | ;; | ||
| 47 | ;; You can also send in new modes; if the file types are reasonably | ||
| 48 | ;; common, we would like to install them. | ||
| 43 | ;; | 49 | ;; |
| 44 | ;; DEFAULT GENERIC MODE: | 50 | ;; DEFAULT GENERIC MODE: |
| 45 | ;; | 51 | ;; |
| @@ -54,13 +60,13 @@ | |||
| 54 | ;; PROBLEMS WHEN USED WITH FOLDING MODE: | 60 | ;; PROBLEMS WHEN USED WITH FOLDING MODE: |
| 55 | ;; | 61 | ;; |
| 56 | ;; [The following relates to the obsolete selective-display technique. | 62 | ;; [The following relates to the obsolete selective-display technique. |
| 57 | ;; Folding mode should use invisible text properties instead. -- Dave | 63 | ;; Folding mode should use invisible text properties instead. -- Dave |
| 58 | ;; Love] | 64 | ;; Love] |
| 59 | ;; | 65 | ;; |
| 60 | ;; From Anders Lindgren <andersl@csd.uu.se> | 66 | ;; From Anders Lindgren <andersl@csd.uu.se> |
| 61 | ;; | 67 | ;; |
| 62 | ;; Problem summary: Wayne Adams has found a problem when using folding | 68 | ;; Problem summary: Wayne Adams has found a problem when using folding |
| 63 | ;; mode in conjuction with font-lock for a mode defined in | 69 | ;; mode in conjunction with font-lock for a mode defined in |
| 64 | ;; `generic-x.el'. | 70 | ;; `generic-x.el'. |
| 65 | ;; | 71 | ;; |
| 66 | ;; The problem, as Wayne described it, was that error messages of the | 72 | ;; The problem, as Wayne described it, was that error messages of the |
| @@ -69,18 +75,18 @@ | |||
| 69 | ;; > - various msgs including "Fontifying region...(error Stack | 75 | ;; > - various msgs including "Fontifying region...(error Stack |
| 70 | ;; > overflow in regexp matcher)" appear | 76 | ;; > overflow in regexp matcher)" appear |
| 71 | ;; | 77 | ;; |
| 72 | ;; I have just tracked down the cause of the problem. The regexp:s in | 78 | ;; I have just tracked down the cause of the problem. The regexp's in |
| 73 | ;; `generic-x.el' does not take into account the way that folding | 79 | ;; `generic-x.el' do not take into account the way that folding hides |
| 74 | ;; hides sections of the buffer. The technique is known as | 80 | ;; sections of the buffer. The technique is known as |
| 75 | ;; `selective-display' and has been available for a very long time (I | 81 | ;; `selective-display' and has been available for a very long time (I |
| 76 | ;; started using it back in the good old' Emacs 18 days). Basically, a | 82 | ;; started using it back in the good old Emacs 18 days). Basically, a |
| 77 | ;; section is hidden by creating one very long line were the newline | 83 | ;; section is hidden by creating one very long line were the newline |
| 78 | ;; character (C-j) is replaced by a linefeed (C-m) character. | 84 | ;; character (C-j) is replaced by a linefeed (C-m) character. |
| 79 | ;; | 85 | ;; |
| 80 | ;; Many other hiding packages, besides folding, use the same technique, | 86 | ;; Many other hiding packages, besides folding, use the same technique, |
| 81 | ;; the problem should occur when using them as well. | 87 | ;; the problem should occur when using them as well. |
| 82 | ;; | 88 | ;; |
| 83 | ;; The erroronous lines in `generic-extras' look like the following (this | 89 | ;; The erroneous lines in `generic-x.el' look like the following (this |
| 84 | ;; example is from the `ini' section): | 90 | ;; example is from the `ini' section): |
| 85 | ;; | 91 | ;; |
| 86 | ;; '(("^\\(\\[.*\\]\\)" 1 'font-lock-constant-face) | 92 | ;; '(("^\\(\\[.*\\]\\)" 1 'font-lock-constant-face) |
| @@ -92,17 +98,17 @@ | |||
| 92 | ;; [foo] | 98 | ;; [foo] |
| 93 | ;; bar = xxx | 99 | ;; bar = xxx |
| 94 | ;; | 100 | ;; |
| 95 | ;; However, since the `.' regexp symbol match the linefeed character the | 101 | ;; However, since the `.' regexp symbol matches the linefeed character |
| 96 | ;; entire folded section is searched, resulting in a regexp stack | 102 | ;; the entire folded section is searched, resulting in a regexp stack |
| 97 | ;; overflow. | 103 | ;; overflow. |
| 98 | ;; | 104 | ;; |
| 99 | ;; Solution suggestion 2: Instead of using ".", use the sequence | 105 | ;; Solution suggestion: Instead of using ".", use the sequence |
| 100 | ;; "[^\n\r]". This will make the rules behave just as before, but they | 106 | ;; "[^\n\r]". This will make the rules behave just as before, but |
| 101 | ;; will work together with selective-display. | 107 | ;; they will work together with selective-display. |
| 102 | 108 | ||
| 103 | ;;; Code: | 109 | ;;; Code: |
| 104 | 110 | ||
| 105 | (require 'font-lock) | 111 | (eval-when-compile (require 'font-lock)) |
| 106 | 112 | ||
| 107 | (defgroup generic-x nil | 113 | (defgroup generic-x nil |
| 108 | "A collection of generic modes." | 114 | "A collection of generic modes." |
| @@ -110,6 +116,11 @@ | |||
| 110 | :group 'data | 116 | :group 'data |
| 111 | :version "20.3") | 117 | :version "20.3") |
| 112 | 118 | ||
| 119 | (defgroup generic-x-modes nil | ||
| 120 | "Individual modes in the collection of generic modes." | ||
| 121 | :group 'generic-x | ||
| 122 | :version "22.1") | ||
| 123 | |||
| 113 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 124 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 114 | ;; Default-Generic mode | 125 | ;; Default-Generic mode |
| 115 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 126 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| @@ -147,7 +158,7 @@ the regexp in `generic-find-file-regexp'. If the value is nil, | |||
| 147 | :type '(choice (const :tag "Don't check file names" nil) regexp)) | 158 | :type '(choice (const :tag "Don't check file names" nil) regexp)) |
| 148 | 159 | ||
| 149 | ;; This generic mode is always defined | 160 | ;; This generic mode is always defined |
| 150 | (define-generic-mode default-generic-mode (list ?#) nil nil nil nil :group 'generic) | 161 | (define-generic-mode default-generic-mode (list ?#) nil nil nil nil :group 'generic-x-modes) |
| 151 | 162 | ||
| 152 | ;; A more general solution would allow us to enter generic-mode for | 163 | ;; A more general solution would allow us to enter generic-mode for |
| 153 | ;; *any* comment character, but would require us to synthesize a new | 164 | ;; *any* comment character, but would require us to synthesize a new |
| @@ -185,55 +196,101 @@ This hook will be installed if the variable | |||
| 185 | ;; Other Generic modes | 196 | ;; Other Generic modes |
| 186 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 197 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 187 | 198 | ||
| 188 | (defcustom generic-extras-enable-list nil | 199 | ;; If you add a generic mode to this file, put it in one of these four |
| 189 | "*List of generic modes to enable by default. | 200 | ;; lists as well. |
| 190 | Each entry in the list should be a symbol. The variables | 201 | |
| 191 | `generic-define-mswindows-modes' and `generic-define-unix-modes' | 202 | (defconst generic-default-modes |
| 192 | also affect which generic modes are defined. Please note that if | 203 | '(apache-conf-generic-mode |
| 193 | you set this variable after generic-x is loaded, you must reload | 204 | apache-log-generic-mode |
| 194 | generic-x to enable the specified modes." | 205 | hosts-generic-mode |
| 195 | :group 'generic-x | 206 | java-manifest-generic-mode |
| 196 | :type '(repeat sexp)) | 207 | java-properties-generic-mode |
| 208 | javascript-generic-mode | ||
| 209 | show-tabs-generic-mode | ||
| 210 | vrml-generic-mode) | ||
| 211 | "List of generic modes that are defined by default.") | ||
| 212 | |||
| 213 | (defconst generic-mswindows-modes | ||
| 214 | '(bat-generic-mode | ||
| 215 | inf-generic-mode | ||
| 216 | ini-generic-mode | ||
| 217 | rc-generic-mode | ||
| 218 | reg-generic-mode | ||
| 219 | rul-generic-mode) | ||
| 220 | "List of generic modes that are defined by default on MS-Windows.") | ||
| 221 | |||
| 222 | (defconst generic-unix-modes | ||
| 223 | '(alias-generic-mode | ||
| 224 | etc-fstab-generic-mode | ||
| 225 | etc-modules-conf-generic-mode | ||
| 226 | etc-passwd-generic-mode | ||
| 227 | etc-services-generic-mode | ||
| 228 | fvwm-generic-mode | ||
| 229 | inetd-conf-generic-mode | ||
| 230 | mailagent-rules-generic-mode | ||
| 231 | mailrc-generic-mode | ||
| 232 | named-boot-generic-mode | ||
| 233 | named-database-generic-mode | ||
| 234 | prototype-generic-mode | ||
| 235 | resolve-conf-generic-mode | ||
| 236 | samba-generic-mode | ||
| 237 | x-resource-generic-mode) | ||
| 238 | "List of generic modes that are defined by default on Unix.") | ||
| 239 | |||
| 240 | (defconst generic-other-modes | ||
| 241 | '(astap-generic-mode | ||
| 242 | ibis-generic-mode | ||
| 243 | pkginfo-generic-mode | ||
| 244 | spice-generic-mode) | ||
| 245 | "List of generic mode that are not defined by default.") | ||
| 197 | 246 | ||
| 198 | (defcustom generic-define-mswindows-modes | 247 | (defcustom generic-define-mswindows-modes |
| 199 | (memq system-type '(windows-nt ms-dos)) | 248 | (memq system-type '(windows-nt ms-dos)) |
| 200 | "*If non-nil, some MS-Windows specific generic modes will be defined." | 249 | "*Non-nil means the modes in `generic-mswindows-modes' will be defined. |
| 250 | This is a list of MS-Windows specific generic modes. This variable | ||
| 251 | only effects the default value of `generic-extras-enable-list'." | ||
| 201 | :group 'generic-x | 252 | :group 'generic-x |
| 202 | :type 'boolean) | 253 | :type 'boolean |
| 254 | :version "22.1") | ||
| 255 | (make-obsolete-variable 'generic-define-mswindows-modes 'generic-extras-enable-list "22.1") | ||
| 203 | 256 | ||
| 204 | (defcustom generic-define-unix-modes | 257 | (defcustom generic-define-unix-modes |
| 205 | (not (memq system-type '(windows-nt ms-dos))) | 258 | (not (memq system-type '(windows-nt ms-dos))) |
| 206 | "*If non-nil, some Unix specific generic modes will be defined." | 259 | "*Non-nil means the modes in `generic-unix-modes' will be defined. |
| 260 | This is a list of Unix specific generic modes. This variable only | ||
| 261 | effects the default value of `generic-extras-enable-list'." | ||
| 207 | :group 'generic-x | 262 | :group 'generic-x |
| 208 | :type 'boolean) | 263 | :type 'boolean |
| 209 | 264 | :version "22.1") | |
| 210 | (and generic-define-mswindows-modes | 265 | (make-obsolete-variable 'generic-define-unix-modes 'generic-extras-enable-list "22.1") |
| 211 | (setq generic-extras-enable-list | 266 | |
| 212 | (append '(bat-generic-mode | 267 | (defcustom generic-extras-enable-list |
| 213 | ini-generic-mode | 268 | (append generic-default-modes |
| 214 | inf-generic-mode | 269 | (if generic-define-mswindows-modes generic-mswindows-modes) |
| 215 | rc-generic-mode | 270 | (if generic-define-unix-modes generic-unix-modes) |
| 216 | reg-generic-mode | 271 | nil) |
| 217 | rul-generic-mode | 272 | "List of generic modes to define. |
| 218 | hosts-generic-mode | 273 | Each entry in the list should be a symbol. If you set this variable |
| 219 | apache-conf-generic-mode | 274 | directly, without using customize, you must reload generic-x to put |
| 220 | apache-log-generic-mode) | 275 | your changes into effect." |
| 221 | generic-extras-enable-list))) | 276 | :group 'generic-x |
| 222 | 277 | :type (let (list) | |
| 223 | (and generic-define-unix-modes | 278 | (dolist (mode |
| 224 | (setq generic-extras-enable-list | 279 | (sort (append generic-default-modes |
| 225 | (append '(apache-conf-generic-mode | 280 | generic-mswindows-modes |
| 226 | apache-log-generic-mode | 281 | generic-unix-modes |
| 227 | samba-generic-mode | 282 | generic-other-modes |
| 228 | hosts-generic-mode | 283 | nil) |
| 229 | fvwm-generic-mode | 284 | (lambda (a b) |
| 230 | x-resource-generic-mode | 285 | (string< (symbol-name b) |
| 231 | alias-generic-mode | 286 | (symbol-name a)))) |
| 232 | inetd-conf-generic-mode | 287 | (cons 'set list)) |
| 233 | etc-services-generic-mode | 288 | (push `(const ,mode) list))) |
| 234 | etc-passwd-generic-mode | 289 | :set (lambda (s v) |
| 235 | etc-fstab-generic-mode) | 290 | (set-default s v) |
| 236 | generic-extras-enable-list))) | 291 | (unless load-in-progress |
| 292 | (load "generic-x"))) | ||
| 293 | :version "22.1") | ||
| 237 | 294 | ||
| 238 | ;;; Apache | 295 | ;;; Apache |
| 239 | (when (memq 'apache-conf-generic-mode generic-extras-enable-list) | 296 | (when (memq 'apache-conf-generic-mode generic-extras-enable-list) |
| @@ -252,7 +309,7 @@ generic-x to enable the specified modes." | |||
| 252 | ("*Directories*" "^\\s-*<Directory\\s-*\\([^>]+\\)>" 1) | 309 | ("*Directories*" "^\\s-*<Directory\\s-*\\([^>]+\\)>" 1) |
| 253 | ("*Locations*" "^\\s-*<Location\\s-*\\([^>]+\\)>" 1)))))) | 310 | ("*Locations*" "^\\s-*<Location\\s-*\\([^>]+\\)>" 1)))))) |
| 254 | "Generic mode for Apache or HTTPD configuration files." | 311 | "Generic mode for Apache or HTTPD configuration files." |
| 255 | :group 'generic-x)) | 312 | :group 'generic-x-modes)) |
| 256 | 313 | ||
| 257 | (when (memq 'apache-log-generic-mode generic-extras-enable-list) | 314 | (when (memq 'apache-log-generic-mode generic-extras-enable-list) |
| 258 | 315 | ||
| @@ -266,7 +323,7 @@ generic-x to enable the specified modes." | |||
| 266 | '("access_log\\'") | 323 | '("access_log\\'") |
| 267 | nil | 324 | nil |
| 268 | "Mode for Apache log files" | 325 | "Mode for Apache log files" |
| 269 | :group 'generic-x)) | 326 | :group 'generic-x-modes)) |
| 270 | 327 | ||
| 271 | ;;; Samba | 328 | ;;; Samba |
| 272 | (when (memq 'samba-generic-mode generic-extras-enable-list) | 329 | (when (memq 'samba-generic-mode generic-extras-enable-list) |
| @@ -281,7 +338,7 @@ generic-x to enable the specified modes." | |||
| 281 | '("smb\\.conf\\'") | 338 | '("smb\\.conf\\'") |
| 282 | '(generic-bracket-support) | 339 | '(generic-bracket-support) |
| 283 | "Generic mode for Samba configuration files." | 340 | "Generic mode for Samba configuration files." |
| 284 | :group 'generic-x)) | 341 | :group 'generic-x-modes)) |
| 285 | 342 | ||
| 286 | ;;; Fvwm | 343 | ;;; Fvwm |
| 287 | ;; This is pretty basic. Also, modes for other window managers could | 344 | ;; This is pretty basic. Also, modes for other window managers could |
| @@ -307,7 +364,7 @@ generic-x to enable the specified modes." | |||
| 307 | '("\\.fvwmrc\\'" "\\.fvwm2rc\\'") | 364 | '("\\.fvwmrc\\'" "\\.fvwm2rc\\'") |
| 308 | nil | 365 | nil |
| 309 | "Generic mode for FVWM configuration files." | 366 | "Generic mode for FVWM configuration files." |
| 310 | :group 'generic-x)) | 367 | :group 'generic-x-modes)) |
| 311 | 368 | ||
| 312 | ;;; X Resource | 369 | ;;; X Resource |
| 313 | ;; I'm pretty sure I've seen an actual mode to do this, but I don't | 370 | ;; I'm pretty sure I've seen an actual mode to do this, but I don't |
| @@ -321,7 +378,7 @@ generic-x to enable the specified modes." | |||
| 321 | '("\\.Xdefaults\\'" "\\.Xresources\\'" "\\.Xenvironment\\'" "\\.ad\\'") | 378 | '("\\.Xdefaults\\'" "\\.Xresources\\'" "\\.Xenvironment\\'" "\\.ad\\'") |
| 322 | nil | 379 | nil |
| 323 | "Generic mode for X Resource configuration files." | 380 | "Generic mode for X Resource configuration files." |
| 324 | :group 'generic-x)) | 381 | :group 'generic-x-modes)) |
| 325 | 382 | ||
| 326 | ;;; Hosts | 383 | ;;; Hosts |
| 327 | (when (memq 'hosts-generic-mode generic-extras-enable-list) | 384 | (when (memq 'hosts-generic-mode generic-extras-enable-list) |
| @@ -333,7 +390,7 @@ generic-x to enable the specified modes." | |||
| 333 | '("[hH][oO][sS][tT][sS]\\'") | 390 | '("[hH][oO][sS][tT][sS]\\'") |
| 334 | nil | 391 | nil |
| 335 | "Generic mode for HOSTS files." | 392 | "Generic mode for HOSTS files." |
| 336 | :group 'generic-x)) | 393 | :group 'generic-x-modes)) |
| 337 | 394 | ||
| 338 | ;;; Windows INF files | 395 | ;;; Windows INF files |
| 339 | (when (memq 'inf-generic-mode generic-extras-enable-list) | 396 | (when (memq 'inf-generic-mode generic-extras-enable-list) |
| @@ -345,7 +402,7 @@ generic-x to enable the specified modes." | |||
| 345 | '("\\.[iI][nN][fF]\\'") | 402 | '("\\.[iI][nN][fF]\\'") |
| 346 | '(generic-bracket-support) | 403 | '(generic-bracket-support) |
| 347 | "Generic mode for MS-Windows INF files." | 404 | "Generic mode for MS-Windows INF files." |
| 348 | :group 'generic-x)) | 405 | :group 'generic-x-modes)) |
| 349 | 406 | ||
| 350 | ;;; Windows INI files | 407 | ;;; Windows INI files |
| 351 | ;; Should define escape character as well! | 408 | ;; Should define escape character as well! |
| @@ -368,7 +425,7 @@ generic-x to enable the specified modes." | |||
| 368 | "Generic mode for MS-Windows INI files. | 425 | "Generic mode for MS-Windows INI files. |
| 369 | You can use `ini-generic-mode-find-file-hook' to enter this mode | 426 | You can use `ini-generic-mode-find-file-hook' to enter this mode |
| 370 | automatically for INI files whose names do not end in \".ini\"." | 427 | automatically for INI files whose names do not end in \".ini\"." |
| 371 | :group 'generic-x) | 428 | :group 'generic-x-modes) |
| 372 | 429 | ||
| 373 | (defun ini-generic-mode-find-file-hook () | 430 | (defun ini-generic-mode-find-file-hook () |
| 374 | "Hook function to enter Ini-Generic mode automatically for INI files. | 431 | "Hook function to enter Ini-Generic mode automatically for INI files. |
| @@ -397,7 +454,7 @@ like an INI file. You can add this hook to `find-file-hook'." | |||
| 397 | (setq imenu-generic-expression | 454 | (setq imenu-generic-expression |
| 398 | '((nil "^\\s-*\\(.*\\)\\s-*=" 1)))))) | 455 | '((nil "^\\s-*\\(.*\\)\\s-*=" 1)))))) |
| 399 | "Generic mode for MS-Windows Registry files." | 456 | "Generic mode for MS-Windows Registry files." |
| 400 | :group 'generic-x)) | 457 | :group 'generic-x-modes)) |
| 401 | 458 | ||
| 402 | ;;; DOS/Windows BAT files | 459 | ;;; DOS/Windows BAT files |
| 403 | (when (memq 'bat-generic-mode generic-extras-enable-list) | 460 | (when (memq 'bat-generic-mode generic-extras-enable-list) |
| @@ -472,10 +529,10 @@ like an INI file. You can add this hook to `find-file-hook'." | |||
| 472 | "\\`[aA][uU][tT][oO][eE][xX][eE][cC]\\.") | 529 | "\\`[aA][uU][tT][oO][eE][xX][eE][cC]\\.") |
| 473 | '(generic-bat-mode-setup-function) | 530 | '(generic-bat-mode-setup-function) |
| 474 | "Generic mode for MS-Windows BAT files." | 531 | "Generic mode for MS-Windows BAT files." |
| 475 | :group 'generic-x) | 532 | :group 'generic-x-modes) |
| 476 | 533 | ||
| 477 | (defvar bat-generic-mode-syntax-table nil | 534 | (defvar bat-generic-mode-syntax-table nil |
| 478 | "Syntax table in use in bat-generic-mode buffers.") | 535 | "Syntax table in use in `bat-generic-mode' buffers.") |
| 479 | 536 | ||
| 480 | (defvar bat-generic-mode-keymap (make-sparse-keymap) | 537 | (defvar bat-generic-mode-keymap (make-sparse-keymap) |
| 481 | "Keymap for bet-generic-mode.") | 538 | "Keymap for bet-generic-mode.") |
| @@ -552,7 +609,7 @@ like an INI file. You can add this hook to `find-file-hook'." | |||
| 552 | (setq imenu-generic-expression | 609 | (setq imenu-generic-expression |
| 553 | '((nil "\\s-/\\([^/]+\\)/[i, \t\n]" 1)))))) | 610 | '((nil "\\s-/\\([^/]+\\)/[i, \t\n]" 1)))))) |
| 554 | "Mode for Mailagent rules files." | 611 | "Mode for Mailagent rules files." |
| 555 | :group 'generic-x)) | 612 | :group 'generic-x-modes)) |
| 556 | 613 | ||
| 557 | ;; Solaris/Sys V prototype files | 614 | ;; Solaris/Sys V prototype files |
| 558 | (when (memq 'prototype-generic-mode generic-extras-enable-list) | 615 | (when (memq 'prototype-generic-mode generic-extras-enable-list) |
| @@ -576,7 +633,7 @@ like an INI file. You can add this hook to `find-file-hook'." | |||
| 576 | '("prototype\\'") | 633 | '("prototype\\'") |
| 577 | nil | 634 | nil |
| 578 | "Mode for Sys V prototype files." | 635 | "Mode for Sys V prototype files." |
| 579 | :group 'generic-x)) | 636 | :group 'generic-x-modes)) |
| 580 | 637 | ||
| 581 | ;; Solaris/Sys V pkginfo files | 638 | ;; Solaris/Sys V pkginfo files |
| 582 | (when (memq 'pkginfo-generic-mode generic-extras-enable-list) | 639 | (when (memq 'pkginfo-generic-mode generic-extras-enable-list) |
| @@ -590,10 +647,12 @@ like an INI file. You can add this hook to `find-file-hook'." | |||
| 590 | '("pkginfo\\'") | 647 | '("pkginfo\\'") |
| 591 | nil | 648 | nil |
| 592 | "Mode for Sys V pkginfo files." | 649 | "Mode for Sys V pkginfo files." |
| 593 | :group 'generic-x)) | 650 | :group 'generic-x-modes)) |
| 594 | 651 | ||
| 595 | ;; Javascript mode | 652 | ;; Javascript mode |
| 596 | ;; Includes extra keywords from Armando Singer [asinger@MAIL.COLGATE.EDU] | 653 | ;; Includes extra keywords from Armando Singer [asinger@MAIL.COLGATE.EDU] |
| 654 | (when (memq 'javascript-generic-mode generic-extras-enable-list) | ||
| 655 | |||
| 597 | (define-generic-mode javascript-generic-mode | 656 | (define-generic-mode javascript-generic-mode |
| 598 | '("//" ("/*" . "*/")) | 657 | '("//" ("/*" . "*/")) |
| 599 | '("break" | 658 | '("break" |
| @@ -668,9 +727,11 @@ like an INI file. You can add this hook to `find-file-hook'." | |||
| 668 | '((nil "^function\\s-+\\([A-Za-z0-9_]+\\)" 1) | 727 | '((nil "^function\\s-+\\([A-Za-z0-9_]+\\)" 1) |
| 669 | ("*Variables*" "^var\\s-+\\([A-Za-z0-9_]+\\)" 1)))))) | 728 | ("*Variables*" "^var\\s-+\\([A-Za-z0-9_]+\\)" 1)))))) |
| 670 | "Mode for JavaScript files." | 729 | "Mode for JavaScript files." |
| 671 | :group 'generic-x) | 730 | :group 'generic-x-modes)) |
| 672 | 731 | ||
| 673 | ;; VRML files | 732 | ;; VRML files |
| 733 | (when (memq 'vrml-generic-mode generic-extras-enable-list) | ||
| 734 | |||
| 674 | (define-generic-mode vrml-generic-mode | 735 | (define-generic-mode vrml-generic-mode |
| 675 | '(?#) | 736 | '(?#) |
| 676 | '("DEF" | 737 | '("DEF" |
| @@ -720,9 +781,11 @@ like an INI file. You can add this hook to `find-file-hook'." | |||
| 720 | "DEF\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([A-Za-z0-9]+\\)\\s-*{" | 781 | "DEF\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([A-Za-z0-9]+\\)\\s-*{" |
| 721 | 1)))))) | 782 | 1)))))) |
| 722 | "Generic Mode for VRML files." | 783 | "Generic Mode for VRML files." |
| 723 | :group 'generic-x) | 784 | :group 'generic-x-modes)) |
| 724 | 785 | ||
| 725 | ;; Java Manifests | 786 | ;; Java Manifests |
| 787 | (when (memq 'java-manifest-generic-mode generic-extras-enable-list) | ||
| 788 | |||
| 726 | (define-generic-mode java-manifest-generic-mode | 789 | (define-generic-mode java-manifest-generic-mode |
| 727 | '(?#) | 790 | '(?#) |
| 728 | '("Name" | 791 | '("Name" |
| @@ -740,9 +803,11 @@ like an INI file. You can add this hook to `find-file-hook'." | |||
| 740 | '("[mM][aA][nN][iI][fF][eE][sS][tT]\\.[mM][fF]\\'") | 803 | '("[mM][aA][nN][iI][fF][eE][sS][tT]\\.[mM][fF]\\'") |
| 741 | nil | 804 | nil |
| 742 | "Mode for Java Manifest files" | 805 | "Mode for Java Manifest files" |
| 743 | :group 'generic-x) | 806 | :group 'generic-x-modes)) |
| 744 | 807 | ||
| 745 | ;; Java properties files | 808 | ;; Java properties files |
| 809 | (when (memq 'java-properties-generic-mode generic-extras-enable-list) | ||
| 810 | |||
| 746 | (define-generic-mode java-properties-generic-mode | 811 | (define-generic-mode java-properties-generic-mode |
| 747 | '(?! ?#) | 812 | '(?! ?#) |
| 748 | nil | 813 | nil |
| @@ -771,7 +836,7 @@ like an INI file. You can add this hook to `find-file-hook'." | |||
| 771 | (setq imenu-generic-expression | 836 | (setq imenu-generic-expression |
| 772 | '((nil "^\\([^#! \t\n\r=:]+\\)" 1)))))) | 837 | '((nil "^\\([^#! \t\n\r=:]+\\)" 1)))))) |
| 773 | "Mode for Java properties files." | 838 | "Mode for Java properties files." |
| 774 | :group 'generic-x) | 839 | :group 'generic-x-modes)) |
| 775 | 840 | ||
| 776 | ;; C shell alias definitions | 841 | ;; C shell alias definitions |
| 777 | (when (memq 'alias-generic-mode generic-extras-enable-list) | 842 | (when (memq 'alias-generic-mode generic-extras-enable-list) |
| @@ -790,7 +855,7 @@ like an INI file. You can add this hook to `find-file-hook'." | |||
| 790 | (setq imenu-generic-expression | 855 | (setq imenu-generic-expression |
| 791 | '((nil "^\\(alias\\|unalias\\)\\s-+\\([-a-zA-Z0-9_]+\\)" 2)))))) | 856 | '((nil "^\\(alias\\|unalias\\)\\s-+\\([-a-zA-Z0-9_]+\\)" 2)))))) |
| 792 | "Mode for C Shell alias files." | 857 | "Mode for C Shell alias files." |
| 793 | :group 'generic-x)) | 858 | :group 'generic-x-modes)) |
| 794 | 859 | ||
| 795 | ;;; Windows RC files | 860 | ;;; Windows RC files |
| 796 | ;; Contributed by ACorreir@pervasive-sw.com (Alfred Correira) | 861 | ;; Contributed by ACorreir@pervasive-sw.com (Alfred Correira) |
| @@ -883,7 +948,7 @@ like an INI file. You can add this hook to `find-file-hook'." | |||
| 883 | '("\\.[rR][cC]\\'") | 948 | '("\\.[rR][cC]\\'") |
| 884 | nil | 949 | nil |
| 885 | "Generic mode for MS-Windows Resource files." | 950 | "Generic mode for MS-Windows Resource files." |
| 886 | :group 'generic-x)) | 951 | :group 'generic-x-modes)) |
| 887 | 952 | ||
| 888 | ;; InstallShield RUL files | 953 | ;; InstallShield RUL files |
| 889 | ;; Contributed by Alfred.Correira@Pervasive.Com | 954 | ;; Contributed by Alfred.Correira@Pervasive.Com |
| @@ -1436,7 +1501,7 @@ like an INI file. You can add this hook to `find-file-hook'." | |||
| 1436 | "Function argument constants used in InstallShield 3 and 5.")) | 1501 | "Function argument constants used in InstallShield 3 and 5.")) |
| 1437 | 1502 | ||
| 1438 | (defvar rul-generic-mode-syntax-table nil | 1503 | (defvar rul-generic-mode-syntax-table nil |
| 1439 | "Syntax table to use in rul-generic-mode buffers.") | 1504 | "Syntax table to use in `rul-generic-mode' buffers.") |
| 1440 | 1505 | ||
| 1441 | (setq rul-generic-mode-syntax-table | 1506 | (setq rul-generic-mode-syntax-table |
| 1442 | (make-syntax-table c++-mode-syntax-table)) | 1507 | (make-syntax-table c++-mode-syntax-table)) |
| @@ -1504,7 +1569,7 @@ like an INI file. You can add this hook to `find-file-hook'." | |||
| 1504 | '("\\.[rR][uU][lL]\\'") | 1569 | '("\\.[rR][uU][lL]\\'") |
| 1505 | '(generic-rul-mode-setup-function) | 1570 | '(generic-rul-mode-setup-function) |
| 1506 | "Generic mode for InstallShield RUL files." | 1571 | "Generic mode for InstallShield RUL files." |
| 1507 | :group 'generic-x) | 1572 | :group 'generic-x-modes) |
| 1508 | 1573 | ||
| 1509 | (define-skeleton rul-if | 1574 | (define-skeleton rul-if |
| 1510 | "Insert an if statement." | 1575 | "Insert an if statement." |
| @@ -1531,6 +1596,8 @@ like an INI file. You can add this hook to `find-file-hook'." | |||
| 1531 | > "end;")) | 1596 | > "end;")) |
| 1532 | 1597 | ||
| 1533 | ;; Additions by ACorreir@pervasive-sw.com (Alfred Correira) | 1598 | ;; Additions by ACorreir@pervasive-sw.com (Alfred Correira) |
| 1599 | (when (memq 'mailrc-generic-mode generic-extras-enable-list) | ||
| 1600 | |||
| 1534 | (define-generic-mode mailrc-generic-mode | 1601 | (define-generic-mode mailrc-generic-mode |
| 1535 | '(?#) | 1602 | '(?#) |
| 1536 | '("alias" | 1603 | '("alias" |
| @@ -1553,7 +1620,7 @@ like an INI file. You can add this hook to `find-file-hook'." | |||
| 1553 | '("\\.mailrc\\'") | 1620 | '("\\.mailrc\\'") |
| 1554 | nil | 1621 | nil |
| 1555 | "Mode for mailrc files." | 1622 | "Mode for mailrc files." |
| 1556 | :group 'generic-x) | 1623 | :group 'generic-x-modes)) |
| 1557 | 1624 | ||
| 1558 | ;; Inetd.conf | 1625 | ;; Inetd.conf |
| 1559 | (when (memq 'inetd-conf-generic-mode generic-extras-enable-list) | 1626 | (when (memq 'inetd-conf-generic-mode generic-extras-enable-list) |
| @@ -1574,7 +1641,7 @@ like an INI file. You can add this hook to `find-file-hook'." | |||
| 1574 | (lambda () | 1641 | (lambda () |
| 1575 | (setq imenu-generic-expression | 1642 | (setq imenu-generic-expression |
| 1576 | '((nil "^\\([-A-Za-z0-9_]+\\)" 1)))))) | 1643 | '((nil "^\\([-A-Za-z0-9_]+\\)" 1)))))) |
| 1577 | :group 'generic-x)) | 1644 | :group 'generic-x-modes)) |
| 1578 | 1645 | ||
| 1579 | ;; Services | 1646 | ;; Services |
| 1580 | (when (memq 'etc-services-generic-mode generic-extras-enable-list) | 1647 | (when (memq 'etc-services-generic-mode generic-extras-enable-list) |
| @@ -1593,7 +1660,7 @@ like an INI file. You can add this hook to `find-file-hook'." | |||
| 1593 | (lambda () | 1660 | (lambda () |
| 1594 | (setq imenu-generic-expression | 1661 | (setq imenu-generic-expression |
| 1595 | '((nil "^\\([-A-Za-z0-9_]+\\)" 1)))))) | 1662 | '((nil "^\\([-A-Za-z0-9_]+\\)" 1)))))) |
| 1596 | :group 'generic-x)) | 1663 | :group 'generic-x-modes)) |
| 1597 | 1664 | ||
| 1598 | ;; Password and Group files | 1665 | ;; Password and Group files |
| 1599 | (when (memq 'etc-passwd-generic-mode generic-extras-enable-list) | 1666 | (when (memq 'etc-passwd-generic-mode generic-extras-enable-list) |
| @@ -1636,7 +1703,7 @@ like an INI file. You can add this hook to `find-file-hook'." | |||
| 1636 | (lambda () | 1703 | (lambda () |
| 1637 | (setq imenu-generic-expression | 1704 | (setq imenu-generic-expression |
| 1638 | '((nil "^\\([-A-Za-z0-9_]+\\):" 1)))))) | 1705 | '((nil "^\\([-A-Za-z0-9_]+\\):" 1)))))) |
| 1639 | :group 'generic-x)) | 1706 | :group 'generic-x-modes)) |
| 1640 | 1707 | ||
| 1641 | ;; Fstab | 1708 | ;; Fstab |
| 1642 | (when (memq 'etc-fstab-generic-mode generic-extras-enable-list) | 1709 | (when (memq 'etc-fstab-generic-mode generic-extras-enable-list) |
| @@ -1687,9 +1754,11 @@ like an INI file. You can add this hook to `find-file-hook'." | |||
| 1687 | (lambda () | 1754 | (lambda () |
| 1688 | (setq imenu-generic-expression | 1755 | (setq imenu-generic-expression |
| 1689 | '((nil "^\\([/-A-Za-z0-9_]+\\)\\s-+" 1)))))) | 1756 | '((nil "^\\([/-A-Za-z0-9_]+\\)\\s-+" 1)))))) |
| 1690 | :group 'generic-x)) | 1757 | :group 'generic-x-modes)) |
| 1691 | 1758 | ||
| 1692 | ;; From Jacques Duthen <jacques.duthen@sncf.fr> | 1759 | ;; From Jacques Duthen <jacques.duthen@sncf.fr> |
| 1760 | (when (memq 'show-tabs-generic-mode generic-extras-enable-list) | ||
| 1761 | |||
| 1693 | (eval-when-compile | 1762 | (eval-when-compile |
| 1694 | 1763 | ||
| 1695 | (defconst show-tabs-generic-mode-font-lock-defaults-1 | 1764 | (defconst show-tabs-generic-mode-font-lock-defaults-1 |
| @@ -1711,7 +1780,7 @@ like an INI file. You can add this hook to `find-file-hook'." | |||
| 1711 | (((class color)) (:background "red")) | 1780 | (((class color)) (:background "red")) |
| 1712 | (t (:weight bold))) | 1781 | (t (:weight bold))) |
| 1713 | "Font Lock mode face used to highlight TABs." | 1782 | "Font Lock mode face used to highlight TABs." |
| 1714 | :group 'generic-x) | 1783 | :group 'generic-x-modes) |
| 1715 | 1784 | ||
| 1716 | (defface show-tabs-space-face | 1785 | (defface show-tabs-space-face |
| 1717 | '((((class grayscale) (background light)) (:background "DimGray" :weight bold)) | 1786 | '((((class grayscale) (background light)) (:background "DimGray" :weight bold)) |
| @@ -1720,7 +1789,7 @@ like an INI file. You can add this hook to `find-file-hook'." | |||
| 1720 | (((class color)) (:background "yellow")) | 1789 | (((class color)) (:background "yellow")) |
| 1721 | (t (:weight bold))) | 1790 | (t (:weight bold))) |
| 1722 | "Font Lock mode face used to highlight spaces." | 1791 | "Font Lock mode face used to highlight spaces." |
| 1723 | :group 'generic-x) | 1792 | :group 'generic-x-modes) |
| 1724 | 1793 | ||
| 1725 | (define-generic-mode show-tabs-generic-mode | 1794 | (define-generic-mode show-tabs-generic-mode |
| 1726 | nil ;; no comment char | 1795 | nil ;; no comment char |
| @@ -1730,12 +1799,14 @@ like an INI file. You can add this hook to `find-file-hook'." | |||
| 1730 | ;; '(show-tabs-generic-mode-hook-fun) | 1799 | ;; '(show-tabs-generic-mode-hook-fun) |
| 1731 | nil | 1800 | nil |
| 1732 | "Generic mode to show tabs and trailing spaces" | 1801 | "Generic mode to show tabs and trailing spaces" |
| 1733 | :group 'generic-x) | 1802 | :group 'generic-x-modes)) |
| 1734 | 1803 | ||
| 1735 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 1804 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 1736 | ;; DNS modes | 1805 | ;; DNS modes |
| 1737 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 1806 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 1738 | 1807 | ||
| 1808 | (when (memq 'named-boot-generic-mode generic-extras-enable-list) | ||
| 1809 | |||
| 1739 | (define-generic-mode named-boot-generic-mode | 1810 | (define-generic-mode named-boot-generic-mode |
| 1740 | ;; List of comment characters | 1811 | ;; List of comment characters |
| 1741 | '(?\;) | 1812 | '(?\;) |
| @@ -1752,7 +1823,9 @@ like an INI file. You can add this hook to `find-file-hook'." | |||
| 1752 | '("/etc/named.boot\\'") | 1823 | '("/etc/named.boot\\'") |
| 1753 | ;; List of set up functions to call | 1824 | ;; List of set up functions to call |
| 1754 | nil | 1825 | nil |
| 1755 | :group 'generic-x) | 1826 | :group 'generic-x-modes)) |
| 1827 | |||
| 1828 | (when (memq 'named-database-generic-mode generic-extras-enable-list) | ||
| 1756 | 1829 | ||
| 1757 | (define-generic-mode named-database-generic-mode | 1830 | (define-generic-mode named-database-generic-mode |
| 1758 | ;; List of comment characters | 1831 | ;; List of comment characters |
| @@ -1766,7 +1839,7 @@ like an INI file. You can add this hook to `find-file-hook'." | |||
| 1766 | nil | 1839 | nil |
| 1767 | ;; List of set up functions to call | 1840 | ;; List of set up functions to call |
| 1768 | nil | 1841 | nil |
| 1769 | :group 'generic-x) | 1842 | :group 'generic-x-modes) |
| 1770 | 1843 | ||
| 1771 | (defvar named-database-time-string "%Y%m%d%H" | 1844 | (defvar named-database-time-string "%Y%m%d%H" |
| 1772 | "Timestring for named serial numbers.") | 1845 | "Timestring for named serial numbers.") |
| @@ -1774,7 +1847,9 @@ like an INI file. You can add this hook to `find-file-hook'." | |||
| 1774 | (defun named-database-print-serial () | 1847 | (defun named-database-print-serial () |
| 1775 | "Print a serial number based on the current date." | 1848 | "Print a serial number based on the current date." |
| 1776 | (interactive) | 1849 | (interactive) |
| 1777 | (insert (format-time-string named-database-time-string (current-time)))) | 1850 | (insert (format-time-string named-database-time-string (current-time))))) |
| 1851 | |||
| 1852 | (when (memq 'resolve-conf-generic-mode generic-extras-enable-list) | ||
| 1778 | 1853 | ||
| 1779 | (define-generic-mode resolve-conf-generic-mode | 1854 | (define-generic-mode resolve-conf-generic-mode |
| 1780 | ;; List of comment characters | 1855 | ;; List of comment characters |
| @@ -1787,12 +1862,14 @@ like an INI file. You can add this hook to `find-file-hook'." | |||
| 1787 | '("/etc/resolv[e]?.conf\\'") | 1862 | '("/etc/resolv[e]?.conf\\'") |
| 1788 | ;; List of set up functions to call | 1863 | ;; List of set up functions to call |
| 1789 | nil | 1864 | nil |
| 1790 | :group 'generic-x) | 1865 | :group 'generic-x-modes)) |
| 1791 | 1866 | ||
| 1792 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 1867 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 1793 | ;; Modes for spice and common electrical engineering circuit netlist formats | 1868 | ;; Modes for spice and common electrical engineering circuit netlist formats |
| 1794 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 1869 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 1795 | 1870 | ||
| 1871 | (when (memq 'spice-generic-mode generic-extras-enable-list) | ||
| 1872 | |||
| 1796 | (define-generic-mode spice-generic-mode | 1873 | (define-generic-mode spice-generic-mode |
| 1797 | nil | 1874 | nil |
| 1798 | '("and" | 1875 | '("and" |
| @@ -1830,7 +1907,9 @@ like an INI file. You can add this hook to `find-file-hook'." | |||
| 1830 | (lambda() | 1907 | (lambda() |
| 1831 | (setq font-lock-defaults '(generic-font-lock-keywords nil t))))) | 1908 | (setq font-lock-defaults '(generic-font-lock-keywords nil t))))) |
| 1832 | "Generic mode for SPICE circuit netlist files." | 1909 | "Generic mode for SPICE circuit netlist files." |
| 1833 | :group 'generic-x) | 1910 | :group 'generic-x-modes)) |
| 1911 | |||
| 1912 | (when (memq 'ibis-generic-mode generic-extras-enable-list) | ||
| 1834 | 1913 | ||
| 1835 | (define-generic-mode ibis-generic-mode | 1914 | (define-generic-mode ibis-generic-mode |
| 1836 | '(?|) | 1915 | '(?|) |
| @@ -1840,7 +1919,9 @@ like an INI file. You can add this hook to `find-file-hook'." | |||
| 1840 | '("\\.[iI][bB][sS]\\'") | 1919 | '("\\.[iI][bB][sS]\\'") |
| 1841 | '(generic-bracket-support) | 1920 | '(generic-bracket-support) |
| 1842 | "Generic mode for IBIS circuit netlist files." | 1921 | "Generic mode for IBIS circuit netlist files." |
| 1843 | :group 'generic-x) | 1922 | :group 'generic-x-modes)) |
| 1923 | |||
| 1924 | (when (memq 'astap-generic-mode generic-extras-enable-list) | ||
| 1844 | 1925 | ||
| 1845 | (define-generic-mode astap-generic-mode | 1926 | (define-generic-mode astap-generic-mode |
| 1846 | nil | 1927 | nil |
| @@ -1876,7 +1957,9 @@ like an INI file. You can add this hook to `find-file-hook'." | |||
| 1876 | (lambda() | 1957 | (lambda() |
| 1877 | (setq font-lock-defaults '(generic-font-lock-keywords nil t))))) | 1958 | (setq font-lock-defaults '(generic-font-lock-keywords nil t))))) |
| 1878 | "Generic mode for ASTAP circuit netlist files." | 1959 | "Generic mode for ASTAP circuit netlist files." |
| 1879 | :group 'generic-x) | 1960 | :group 'generic-x-modes)) |
| 1961 | |||
| 1962 | (when (memq 'etc-modules-conf-generic-mode generic-extras-enable-list) | ||
| 1880 | 1963 | ||
| 1881 | (define-generic-mode etc-modules-conf-generic-mode | 1964 | (define-generic-mode etc-modules-conf-generic-mode |
| 1882 | ;; List of comment characters | 1965 | ;; List of comment characters |
| @@ -1919,7 +2002,7 @@ like an INI file. You can add this hook to `find-file-hook'." | |||
| 1919 | '("/etc/modules.conf" "/etc/conf.modules") | 2002 | '("/etc/modules.conf" "/etc/conf.modules") |
| 1920 | ;; List of set up functions to call | 2003 | ;; List of set up functions to call |
| 1921 | nil | 2004 | nil |
| 1922 | :group 'generic-x) | 2005 | :group 'generic-x-modes)) |
| 1923 | 2006 | ||
| 1924 | (provide 'generic-x) | 2007 | (provide 'generic-x) |
| 1925 | 2008 | ||
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index f08f21fadb7..a5c403f0d7d 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,24 @@ | |||
| 1 | 2005-04-24 Teodor Zlatanov <tzz@lifelogs.com> | ||
| 2 | |||
| 3 | * spam-report.el (spam-report-unplug-agent) | ||
| 4 | (spam-report-plug-agent, spam-report-deagentize) | ||
| 5 | (spam-report-agentize, spam-report-url-ping-temp-agent-function): | ||
| 6 | support for the Agent in spam-report: when unplugged, report to a | ||
| 7 | file; when plugged, submit all the requests. | ||
| 8 | [Added missing offline functionality from trunk.] | ||
| 9 | |||
| 10 | 2005-04-24 Reiner Steib <Reiner.Steib@gmx.de> | ||
| 11 | |||
| 12 | * spam-report.el (spam-report-url-to-file) | ||
| 13 | (spam-report-requests-file): New function and variable for offline | ||
| 14 | reporting. | ||
| 15 | (spam-report-url-ping-function): Add `spam-report-url-to-file' | ||
| 16 | and user defined function. | ||
| 17 | (spam-report-process-queue): New function. | ||
| 18 | Process requests from `spam-report-requests-file'. | ||
| 19 | (spam-report-url-ping-mm-url): Autoload. | ||
| 20 | [Added missing offline functionality from trunk.] | ||
| 21 | |||
| 1 | 2005-04-18 Katsumi Yamaoka <yamaoka@jpl.org> | 22 | 2005-04-18 Katsumi Yamaoka <yamaoka@jpl.org> |
| 2 | 23 | ||
| 3 | * qp.el (quoted-printable-encode-region): Save excursion. | 24 | * qp.el (quoted-printable-encode-region): Save excursion. |
diff --git a/lisp/gnus/spam-report.el b/lisp/gnus/spam-report.el index 80d422b06ab..b8283ffaaa8 100644 --- a/lisp/gnus/spam-report.el +++ b/lisp/gnus/spam-report.el | |||
| @@ -59,14 +59,32 @@ instead." | |||
| 59 | 59 | ||
| 60 | (defcustom spam-report-url-ping-function | 60 | (defcustom spam-report-url-ping-function |
| 61 | 'spam-report-url-ping-plain | 61 | 'spam-report-url-ping-plain |
| 62 | "Function to use for url ping spam reporting." | 62 | "Function to use for url ping spam reporting. |
| 63 | The function must accept the arguments `host' and `report'." | ||
| 63 | :type '(choice | 64 | :type '(choice |
| 64 | (const :tag "Connect directly" | 65 | (const :tag "Connect directly" |
| 65 | spam-report-url-ping-plain) | 66 | spam-report-url-ping-plain) |
| 66 | (const :tag "Use the external program specified in `mm-url-program'" | 67 | (const :tag "Use the external program specified in `mm-url-program'" |
| 67 | spam-report-url-ping-mm-url)) | 68 | spam-report-url-ping-mm-url) |
| 69 | (const :tag "Store request URLs in `spam-report-requests-file'" | ||
| 70 | spam-report-url-to-file) | ||
| 71 | (function :tag "User defined function" nil)) | ||
| 68 | :group 'spam-report) | 72 | :group 'spam-report) |
| 69 | 73 | ||
| 74 | (defcustom spam-report-requests-file | ||
| 75 | (nnheader-concat gnus-directory "spam/" "spam-report-requests.url") | ||
| 76 | ;; Is there a convention for the extension of such a file? | ||
| 77 | ;; Should we use `spam-directory'? | ||
| 78 | "File where spam report request are stored." | ||
| 79 | :type 'file | ||
| 80 | :group 'spam-report) | ||
| 81 | |||
| 82 | (defvar spam-report-url-ping-temp-agent-function nil | ||
| 83 | "Internal variable for `spam-report-agentize' and `spam-report-deagentize'. | ||
| 84 | This variable will store the value of `spam-report-url-ping-function' from | ||
| 85 | before `spam-report-agentize' was run, so that `spam-report-deagentize' can | ||
| 86 | undo that change.") | ||
| 87 | |||
| 70 | (defun spam-report-gmane (&rest articles) | 88 | (defun spam-report-gmane (&rest articles) |
| 71 | "Report an article as spam through Gmane" | 89 | "Report an article as spam through Gmane" |
| 72 | (dolist (article articles) | 90 | (dolist (article articles) |
| @@ -75,10 +93,11 @@ instead." | |||
| 75 | (string-match spam-report-gmane-regex gnus-newsgroup-name))) | 93 | (string-match spam-report-gmane-regex gnus-newsgroup-name))) |
| 76 | (gnus-message 6 "Reporting spam article %d to spam.gmane.org..." article) | 94 | (gnus-message 6 "Reporting spam article %d to spam.gmane.org..." article) |
| 77 | (if spam-report-gmane-use-article-number | 95 | (if spam-report-gmane-use-article-number |
| 78 | (spam-report-url-ping "spam.gmane.org" | 96 | (spam-report-url-ping |
| 79 | (format "/%s:%d" | 97 | "spam.gmane.org" |
| 80 | (gnus-group-real-name gnus-newsgroup-name) | 98 | (format "/%s:%d" |
| 81 | article)) | 99 | (gnus-group-real-name gnus-newsgroup-name) |
| 100 | article)) | ||
| 82 | (with-current-buffer nntp-server-buffer | 101 | (with-current-buffer nntp-server-buffer |
| 83 | (gnus-request-head article gnus-newsgroup-name) | 102 | (gnus-request-head article gnus-newsgroup-name) |
| 84 | (goto-char (point-min)) | 103 | (goto-char (point-min)) |
| @@ -113,14 +132,113 @@ the function specified by `spam-report-url-ping-function'." | |||
| 113 | (format "GET %s HTTP/1.1\nUser-Agent: %s (spam-report.el)\nHost: %s\n\n" | 132 | (format "GET %s HTTP/1.1\nUser-Agent: %s (spam-report.el)\nHost: %s\n\n" |
| 114 | report (gnus-emacs-version) host))))) | 133 | report (gnus-emacs-version) host))))) |
| 115 | 134 | ||
| 135 | ;;;###autoload | ||
| 136 | (defun spam-report-process-queue (&optional file keep) | ||
| 137 | "Report all queued requests from `spam-report-requests-file'. | ||
| 138 | |||
| 139 | If FILE is given, use it instead of `spam-report-requests-file'. | ||
| 140 | If KEEP is t, leave old requests in the file. If KEEP is the | ||
| 141 | symbol `ask', query before flushing the queue file." | ||
| 142 | (interactive | ||
| 143 | (list (read-file-name | ||
| 144 | "File: " | ||
| 145 | (file-name-directory spam-report-requests-file) | ||
| 146 | spam-report-requests-file | ||
| 147 | nil | ||
| 148 | (file-name-nondirectory spam-report-requests-file)) | ||
| 149 | current-prefix-arg)) | ||
| 150 | (if (eq spam-report-url-ping-function 'spam-report-url-to-file) | ||
| 151 | (error (concat "Cannot process requests when " | ||
| 152 | "`spam-report-url-ping-function' is " | ||
| 153 | "`spam-report-url-to-file'.")) | ||
| 154 | (gnus-message 7 "Processing requests using `%s'." | ||
| 155 | spam-report-url-ping-function)) | ||
| 156 | (or file (setq file spam-report-requests-file)) | ||
| 157 | (save-excursion | ||
| 158 | (set-buffer (find-file-noselect file)) | ||
| 159 | (goto-char (point-min)) | ||
| 160 | (while (and (not (eobp)) | ||
| 161 | (re-search-forward | ||
| 162 | "http://\\([^/]+\\)\\(/.*\\) *$" (point-at-eol) t)) | ||
| 163 | (funcall spam-report-url-ping-function (match-string 1) (match-string 2)) | ||
| 164 | (forward-line 1)) | ||
| 165 | (if (or (eq keep nil) | ||
| 166 | (and (eq keep 'ask) | ||
| 167 | (y-or-n-p | ||
| 168 | (format | ||
| 169 | "Flush requests from `%s'? " (current-buffer))))) | ||
| 170 | (progn | ||
| 171 | (gnus-message 7 "Flushing request file `%s'" | ||
| 172 | spam-report-requests-file) | ||
| 173 | (erase-buffer) | ||
| 174 | (save-buffer) | ||
| 175 | (kill-buffer (current-buffer))) | ||
| 176 | (gnus-message 7 "Keeping requests in `%s'" spam-report-requests-file)))) | ||
| 177 | |||
| 178 | ;;;###autoload | ||
| 116 | (defun spam-report-url-ping-mm-url (host report) | 179 | (defun spam-report-url-ping-mm-url (host report) |
| 117 | "Ping a host through HTTP, addressing a specific GET resource. Use | 180 | "Ping a host through HTTP, addressing a specific GET resource. Use |
| 118 | the external program specified in `mm-url-program' to connect to | 181 | the external program specified in `mm-url-program' to connect to |
| 119 | server." | 182 | server." |
| 120 | (with-temp-buffer | 183 | (with-temp-buffer |
| 121 | (let ((url (concat "http://" host "/" report))) | 184 | (let ((url (concat "http://" host report))) |
| 122 | (mm-url-insert url t)))) | 185 | (mm-url-insert url t)))) |
| 123 | 186 | ||
| 187 | ;;;###autoload | ||
| 188 | (defun spam-report-url-to-file (host report) | ||
| 189 | "Collect spam report requests in `spam-report-requests-file'. | ||
| 190 | Customize `spam-report-url-ping-function' to use this function." | ||
| 191 | (let ((url (concat "http://" host report)) | ||
| 192 | (file spam-report-requests-file)) | ||
| 193 | (gnus-make-directory (file-name-directory file)) | ||
| 194 | (gnus-message 9 "Writing URL `%s' to file `%s'" url file) | ||
| 195 | (with-temp-buffer | ||
| 196 | (insert url) | ||
| 197 | (newline) | ||
| 198 | (append-to-file (point-min) (point-max) file)))) | ||
| 199 | |||
| 200 | ;;;###autoload | ||
| 201 | (defun spam-report-agentize () | ||
| 202 | "Add spam-report support to the Agent. | ||
| 203 | Spam reports will be queued with \\[spam-report-url-to-file] when | ||
| 204 | the Agent is unplugged, and will be submitted in a batch when the | ||
| 205 | Agent is plugged." | ||
| 206 | (interactive) | ||
| 207 | (add-hook 'gnus-agent-plugged-hook 'spam-report-plug-agent) | ||
| 208 | (add-hook 'gnus-agent-unplugged-hook 'spam-report-unplug-agent)) | ||
| 209 | |||
| 210 | ;;;###autoload | ||
| 211 | (defun spam-report-deagentize () | ||
| 212 | "Remove spam-report support from the Agent. | ||
| 213 | Spam reports will be queued with the method used when | ||
| 214 | \\[spam-report-agentize] was run." | ||
| 215 | (interactive) | ||
| 216 | (remove-hook 'gnus-agent-plugged-hook 'spam-report-plug-agent) | ||
| 217 | (remove-hook 'gnus-agent-unplugged-hook 'spam-report-unplug-agent)) | ||
| 218 | |||
| 219 | (defun spam-report-plug-agent () | ||
| 220 | "Adjust spam report settings for plugged state. | ||
| 221 | Process queued spam reports." | ||
| 222 | ;; Process the queue, unless the user only wanted to report to a file | ||
| 223 | ;; anyway. | ||
| 224 | (unless (equal spam-report-url-ping-temp-agent-function | ||
| 225 | 'spam-report-url-to-file) | ||
| 226 | (spam-report-process-queue)) | ||
| 227 | ;; Set the reporting function, if we have memorized something otherwise, | ||
| 228 | ;; stick with plain URL reporting. | ||
| 229 | (setq spam-report-url-ping-function | ||
| 230 | (or spam-report-url-ping-temp-agent-function | ||
| 231 | 'spam-report-url-ping-plain))) | ||
| 232 | |||
| 233 | (defun spam-report-unplug-agent () | ||
| 234 | "Restore spam report settings for unplugged state." | ||
| 235 | ;; save the old value | ||
| 236 | (setq spam-report-url-ping-temp-agent-function | ||
| 237 | spam-report-url-ping-function) | ||
| 238 | ;; store all reports to file | ||
| 239 | (setq spam-report-url-ping-function | ||
| 240 | 'spam-report-url-to-file)) | ||
| 241 | |||
| 124 | (provide 'spam-report) | 242 | (provide 'spam-report) |
| 125 | 243 | ||
| 126 | ;;; arch-tag: f6683295-ec89-4ab5-8803-8cc842293022 | 244 | ;;; arch-tag: f6683295-ec89-4ab5-8803-8cc842293022 |
diff --git a/lisp/help.el b/lisp/help.el index e65982623c1..76fc43d63ef 100644 --- a/lisp/help.el +++ b/lisp/help.el | |||
| @@ -611,6 +611,7 @@ pass a string or a vector. | |||
| 611 | If non-nil UNTRANSLATED is a vector of the untranslated events. | 611 | If non-nil UNTRANSLATED is a vector of the untranslated events. |
| 612 | It can also be a number in which case the untranslated events from | 612 | It can also be a number in which case the untranslated events from |
| 613 | the last key hit are used." | 613 | the last key hit are used." |
| 614 | ;; UP-EVENT is the up-event that was discarded by reading KEY, or nil. | ||
| 614 | (interactive "kDescribe key: \np\nU") | 615 | (interactive "kDescribe key: \np\nU") |
| 615 | (if (numberp untranslated) | 616 | (if (numberp untranslated) |
| 616 | (setq untranslated (this-single-command-raw-keys))) | 617 | (setq untranslated (this-single-command-raw-keys))) |
| @@ -634,7 +635,8 @@ the last key hit are used." | |||
| 634 | ;; Don't bother user with strings from (e.g.) the select-paste menu. | 635 | ;; Don't bother user with strings from (e.g.) the select-paste menu. |
| 635 | (if (stringp (aref key (1- (length key)))) | 636 | (if (stringp (aref key (1- (length key)))) |
| 636 | (aset key (1- (length key)) "(any string)")) | 637 | (aset key (1- (length key)) "(any string)")) |
| 637 | (if (stringp (aref untranslated (1- (length untranslated)))) | 638 | (if (and untranslated |
| 639 | (stringp (aref untranslated (1- (length untranslated))))) | ||
| 638 | (aset untranslated (1- (length untranslated)) | 640 | (aset untranslated (1- (length untranslated)) |
| 639 | "(any string)")) | 641 | "(any string)")) |
| 640 | (with-output-to-temp-buffer (help-buffer) | 642 | (with-output-to-temp-buffer (help-buffer) |
diff --git a/lisp/hexl.el b/lisp/hexl.el index af996940f86..99bbda91c6c 100644 --- a/lisp/hexl.el +++ b/lisp/hexl.el | |||
| @@ -284,7 +284,7 @@ You can use \\[hexl-find-file] to visit a file in Hexl mode. | |||
| 284 | (add-hook 'change-major-mode-hook 'hexl-maybe-dehexlify-buffer nil t) | 284 | (add-hook 'change-major-mode-hook 'hexl-maybe-dehexlify-buffer nil t) |
| 285 | 285 | ||
| 286 | ;; Set a callback function for eldoc. | 286 | ;; Set a callback function for eldoc. |
| 287 | (set (make-local-variable 'eldoc-print-current-symbol-info-function) | 287 | (set (make-local-variable 'eldoc-documentation-function) |
| 288 | 'hexl-print-current-point-info) | 288 | 'hexl-print-current-point-info) |
| 289 | (eldoc-add-command-completions "hexl-") | 289 | (eldoc-add-command-completions "hexl-") |
| 290 | (eldoc-remove-command "hexl-save-buffer" | 290 | (eldoc-remove-command "hexl-save-buffer" |
diff --git a/lisp/hippie-exp.el b/lisp/hippie-exp.el index 91eb01b5193..bd726564da6 100644 --- a/lisp/hippie-exp.el +++ b/lisp/hippie-exp.el | |||
| @@ -634,7 +634,7 @@ for subsequent calls (for further possible completions of the same | |||
| 634 | string). It returns t if a new completion is found, nil otherwise." | 634 | string). It returns t if a new completion is found, nil otherwise." |
| 635 | (let ((expansion ()) | 635 | (let ((expansion ()) |
| 636 | (strip-prompt (and (get-buffer-process (current-buffer)) | 636 | (strip-prompt (and (get-buffer-process (current-buffer)) |
| 637 | comint-use-prompt-regexp-instead-of-fields | 637 | comint-use-prompt-regexp |
| 638 | comint-prompt-regexp))) | 638 | comint-prompt-regexp))) |
| 639 | (if (not old) | 639 | (if (not old) |
| 640 | (progn | 640 | (progn |
| @@ -681,7 +681,7 @@ for subsequent calls (for further possible completions of the same | |||
| 681 | string). It returns t if a new completion is found, nil otherwise." | 681 | string). It returns t if a new completion is found, nil otherwise." |
| 682 | (let ((expansion ()) | 682 | (let ((expansion ()) |
| 683 | (strip-prompt (and (get-buffer-process (current-buffer)) | 683 | (strip-prompt (and (get-buffer-process (current-buffer)) |
| 684 | comint-use-prompt-regexp-instead-of-fields | 684 | comint-use-prompt-regexp |
| 685 | comint-prompt-regexp)) | 685 | comint-prompt-regexp)) |
| 686 | (buf (current-buffer)) | 686 | (buf (current-buffer)) |
| 687 | (orig-case-fold-search case-fold-search)) | 687 | (orig-case-fold-search case-fold-search)) |
| @@ -708,7 +708,7 @@ string). It returns t if a new completion is found, nil otherwise." | |||
| 708 | (widen)) | 708 | (widen)) |
| 709 | (goto-char he-search-loc) | 709 | (goto-char he-search-loc) |
| 710 | (setq strip-prompt (and (get-buffer-process (current-buffer)) | 710 | (setq strip-prompt (and (get-buffer-process (current-buffer)) |
| 711 | comint-use-prompt-regexp-instead-of-fields | 711 | comint-use-prompt-regexp |
| 712 | comint-prompt-regexp)) | 712 | comint-prompt-regexp)) |
| 713 | (setq expansion | 713 | (setq expansion |
| 714 | (let ((case-fold-search orig-case-fold-search)) | 714 | (let ((case-fold-search orig-case-fold-search)) |
diff --git a/lisp/ido.el b/lisp/ido.el index 2e2aca3126e..7ed2d62386c 100644 --- a/lisp/ido.el +++ b/lisp/ido.el | |||
| @@ -56,7 +56,7 @@ | |||
| 56 | ;; so I invented a common "ido-" namespace for the merged packages. | 56 | ;; so I invented a common "ido-" namespace for the merged packages. |
| 57 | ;; | 57 | ;; |
| 58 | ;; This version is based on ido.el version 1.57 released on | 58 | ;; This version is based on ido.el version 1.57 released on |
| 59 | ;; gnu.emacs.sources adapted for emacs 21.5 to use command remapping | 59 | ;; gnu.emacs.sources adapted for emacs 22.1 to use command remapping |
| 60 | ;; and optionally hooking the read-buffer and read-file-name functions. | 60 | ;; and optionally hooking the read-buffer and read-file-name functions. |
| 61 | ;; | 61 | ;; |
| 62 | ;; Prefix matching was added by Klaus Berndl <klaus.berndl@sdm.de> based on | 62 | ;; Prefix matching was added by Klaus Berndl <klaus.berndl@sdm.de> based on |
| @@ -1346,12 +1346,19 @@ This function also adds a hook to the minibuffer." | |||
| 1346 | (setq ido-everywhere (if arg | 1346 | (setq ido-everywhere (if arg |
| 1347 | (> (prefix-numeric-value arg) 0) | 1347 | (> (prefix-numeric-value arg) 0) |
| 1348 | (not ido-everywhere))) | 1348 | (not ido-everywhere))) |
| 1349 | (setq read-file-name-function | 1349 | (when (get 'ido-everywhere 'file) |
| 1350 | (and ido-everywhere (memq ido-mode '(both file)) | 1350 | (setq read-file-name-function (car (get 'ido-everywhere 'file))) |
| 1351 | 'ido-read-file-name)) | 1351 | (put 'ido-everywhere 'file nil)) |
| 1352 | (setq read-buffer-function | 1352 | (when (get 'ido-everywhere 'buffer) |
| 1353 | (and ido-everywhere (memq ido-mode '(both buffer)) | 1353 | (setq read-buffer-function (car (get 'ido-everywhere 'buffer))) |
| 1354 | 'ido-read-buffer))) | 1354 | (put 'ido-everywhere 'buffer nil)) |
| 1355 | (when ido-everywhere | ||
| 1356 | (when (memq ido-mode '(both file)) | ||
| 1357 | (put 'ido-everywhere 'file (cons read-file-name-function nil)) | ||
| 1358 | (setq read-file-name-function 'ido-read-file-name)) | ||
| 1359 | (when (memq ido-mode '(both buffer)) | ||
| 1360 | (put 'ido-everywhere 'buffer (cons read-buffer-function nil)) | ||
| 1361 | (setq read-buffer-function 'ido-read-buffer)))) | ||
| 1355 | 1362 | ||
| 1356 | 1363 | ||
| 1357 | ;;; IDO KEYMAP | 1364 | ;;; IDO KEYMAP |
| @@ -1793,7 +1800,7 @@ If INITIAL is non-nil, it specifies the initial input string." | |||
| 1793 | (ido-name (car ido-matches)))) | 1800 | (ido-name (car ido-matches)))) |
| 1794 | 1801 | ||
| 1795 | (cond | 1802 | (cond |
| 1796 | ((eq item 'buffer) | 1803 | ((memq item '(buffer list)) |
| 1797 | (setq done t)) | 1804 | (setq done t)) |
| 1798 | 1805 | ||
| 1799 | ((string-equal "./" ido-selected) | 1806 | ((string-equal "./" ido-selected) |
diff --git a/lisp/ielm.el b/lisp/ielm.el index 5ef6ff1e1eb..65654ca2c7a 100644 --- a/lisp/ielm.el +++ b/lisp/ielm.el | |||
| @@ -482,6 +482,7 @@ Customized bindings may be defined in `ielm-map', which currently contains: | |||
| 482 | (interactive) | 482 | (interactive) |
| 483 | (comint-mode) | 483 | (comint-mode) |
| 484 | (setq comint-prompt-regexp (concat "^" (regexp-quote ielm-prompt))) | 484 | (setq comint-prompt-regexp (concat "^" (regexp-quote ielm-prompt))) |
| 485 | (set (make-local-variable 'paragraph-separate) "\\'") | ||
| 485 | (make-local-variable 'paragraph-start) | 486 | (make-local-variable 'paragraph-start) |
| 486 | (setq paragraph-start comint-prompt-regexp) | 487 | (setq paragraph-start comint-prompt-regexp) |
| 487 | (setq comint-input-sender 'ielm-input-sender) | 488 | (setq comint-input-sender 'ielm-input-sender) |
| @@ -538,7 +539,7 @@ Customized bindings may be defined in `ielm-map', which currently contains: | |||
| 538 | ;; Add a silly header | 539 | ;; Add a silly header |
| 539 | (insert ielm-header) | 540 | (insert ielm-header) |
| 540 | (ielm-set-pm (point-max)) | 541 | (ielm-set-pm (point-max)) |
| 541 | (unless comint-use-prompt-regexp-instead-of-fields | 542 | (unless comint-use-prompt-regexp |
| 542 | (let ((inhibit-read-only t)) | 543 | (let ((inhibit-read-only t)) |
| 543 | (add-text-properties | 544 | (add-text-properties |
| 544 | (point-min) (point-max) | 545 | (point-min) (point-max) |
diff --git a/lisp/imenu.el b/lisp/imenu.el index 85430bbdbfc..831550bd7a3 100644 --- a/lisp/imenu.el +++ b/lisp/imenu.el | |||
| @@ -777,7 +777,7 @@ They may also be nested index alists like: | |||
| 777 | depending on PATTERNS." | 777 | depending on PATTERNS." |
| 778 | 778 | ||
| 779 | (let ((index-alist (list 'dummy)) | 779 | (let ((index-alist (list 'dummy)) |
| 780 | prev-pos beg | 780 | prev-pos |
| 781 | (case-fold-search (if (or (local-variable-p 'imenu-case-fold-search) | 781 | (case-fold-search (if (or (local-variable-p 'imenu-case-fold-search) |
| 782 | (not (local-variable-p 'font-lock-defaults))) | 782 | (not (local-variable-p 'font-lock-defaults))) |
| 783 | imenu-case-fold-search | 783 | imenu-case-fold-search |
| @@ -807,7 +807,7 @@ depending on PATTERNS." | |||
| 807 | (index (nth 2 pat)) | 807 | (index (nth 2 pat)) |
| 808 | (function (nth 3 pat)) | 808 | (function (nth 3 pat)) |
| 809 | (rest (nthcdr 4 pat)) | 809 | (rest (nthcdr 4 pat)) |
| 810 | start) | 810 | start beg) |
| 811 | ;; Go backwards for convenience of adding items in order. | 811 | ;; Go backwards for convenience of adding items in order. |
| 812 | (goto-char (point-max)) | 812 | (goto-char (point-max)) |
| 813 | (while (and (re-search-backward regexp nil t) | 813 | (while (and (re-search-backward regexp nil t) |
| @@ -815,32 +815,35 @@ depending on PATTERNS." | |||
| 815 | ;; because it means a bad regexp was specified. | 815 | ;; because it means a bad regexp was specified. |
| 816 | (not (= (match-beginning 0) (match-end 0)))) | 816 | (not (= (match-beginning 0) (match-end 0)))) |
| 817 | (setq start (point)) | 817 | (setq start (point)) |
| 818 | (goto-char (match-end index)) | 818 | ;; Record the start of the line in which the match starts. |
| 819 | (setq beg (match-beginning index)) | ||
| 820 | ;; Go to the start of the match. | ||
| 821 | ;; That's the official position of this definition. | 819 | ;; That's the official position of this definition. |
| 822 | (goto-char start) | 820 | (goto-char (match-beginning index)) |
| 821 | (beginning-of-line) | ||
| 822 | (setq beg (point)) | ||
| 823 | (imenu-progress-message prev-pos nil t) | 823 | (imenu-progress-message prev-pos nil t) |
| 824 | ;; Add this sort of submenu only when we've found an | 824 | ;; Add this sort of submenu only when we've found an |
| 825 | ;; item for it, avoiding empty, duff menus. | 825 | ;; item for it, avoiding empty, duff menus. |
| 826 | (unless (assoc menu-title index-alist) | 826 | (unless (assoc menu-title index-alist) |
| 827 | (push (list menu-title) index-alist)) | 827 | (push (list menu-title) index-alist)) |
| 828 | (if imenu-use-markers | 828 | (if imenu-use-markers |
| 829 | (setq start (copy-marker start))) | 829 | (setq beg (copy-marker beg))) |
| 830 | (let ((item | 830 | (let ((item |
| 831 | (if function | 831 | (if function |
| 832 | (nconc (list (match-string-no-properties index) | 832 | (nconc (list (match-string-no-properties index) |
| 833 | start function) | 833 | beg function) |
| 834 | rest) | 834 | rest) |
| 835 | (cons (match-string-no-properties index) | 835 | (cons (match-string-no-properties index) |
| 836 | start))) | 836 | beg))) |
| 837 | ;; This is the desired submenu, | 837 | ;; This is the desired submenu, |
| 838 | ;; starting with its title (or nil). | 838 | ;; starting with its title (or nil). |
| 839 | (menu (assoc menu-title index-alist))) | 839 | (menu (assoc menu-title index-alist))) |
| 840 | ;; Insert the item unless it is already present. | 840 | ;; Insert the item unless it is already present. |
| 841 | (unless (member item (cdr menu)) | 841 | (unless (member item (cdr menu)) |
| 842 | (setcdr menu | 842 | (setcdr menu |
| 843 | (cons item (cdr menu)))))))) | 843 | (cons item (cdr menu))))) |
| 844 | ;; Go to the start of the match, to make sure we | ||
| 845 | ;; keep making progress backwards. | ||
| 846 | (goto-char start)))) | ||
| 844 | (set-syntax-table old-table))) | 847 | (set-syntax-table old-table))) |
| 845 | (imenu-progress-message prev-pos 100 t) | 848 | (imenu-progress-message prev-pos 100 t) |
| 846 | ;; Sort each submenu by position. | 849 | ;; Sort each submenu by position. |
diff --git a/lisp/info.el b/lisp/info.el index 3ded620cb7a..cfb44cb18f1 100644 --- a/lisp/info.el +++ b/lisp/info.el | |||
| @@ -3243,6 +3243,8 @@ Advanced commands: | |||
| 3243 | (make-local-variable 'line-move-ignore-invisible) | 3243 | (make-local-variable 'line-move-ignore-invisible) |
| 3244 | (setq line-move-ignore-invisible t) | 3244 | (setq line-move-ignore-invisible t) |
| 3245 | (make-local-variable 'desktop-save-buffer) | 3245 | (make-local-variable 'desktop-save-buffer) |
| 3246 | (make-local-variable 'widen-automatically) | ||
| 3247 | (setq widen-automatically nil) | ||
| 3246 | (setq desktop-save-buffer 'Info-desktop-buffer-misc-data) | 3248 | (setq desktop-save-buffer 'Info-desktop-buffer-misc-data) |
| 3247 | (add-hook 'kill-buffer-hook 'Info-kill-buffer nil t) | 3249 | (add-hook 'kill-buffer-hook 'Info-kill-buffer nil t) |
| 3248 | (add-hook 'clone-buffer-hook 'Info-clone-buffer-hook nil t) | 3250 | (add-hook 'clone-buffer-hook 'Info-clone-buffer-hook nil t) |
diff --git a/lisp/international/latexenc.el b/lisp/international/latexenc.el new file mode 100644 index 00000000000..1fd04b55919 --- /dev/null +++ b/lisp/international/latexenc.el | |||
| @@ -0,0 +1,171 @@ | |||
| 1 | ;;; latexenc.el --- guess correct coding system in LaTeX files | ||
| 2 | |||
| 3 | ;; Copyright (C) 2005 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; Author: Arne J,Ax(Brgensen <arne@arnested.dk> | ||
| 6 | ;; Keywords: mule, coding system, latex | ||
| 7 | |||
| 8 | ;; This file is part of GNU Emacs. | ||
| 9 | |||
| 10 | ;; GNU Emacs is free software; you can redistribute it and/or modify | ||
| 11 | ;; it under the terms of the GNU General Public License as published by | ||
| 12 | ;; the Free Software Foundation; either version 2, or (at your option) | ||
| 13 | ;; any later version. | ||
| 14 | |||
| 15 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 16 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 18 | ;; GNU General Public License for more details. | ||
| 19 | |||
| 20 | ;; You should have received a copy of the GNU General Public License | ||
| 21 | ;; along with GNU Emacs; see the file COPYING. If not, write to the | ||
| 22 | ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
| 23 | ;; Boston, MA 02111-1307, USA. | ||
| 24 | |||
| 25 | ;;; Commentary: | ||
| 26 | |||
| 27 | ;; This code tries to guess the correct coding system of a LaTeX file. | ||
| 28 | |||
| 29 | ;; First it searches for a \inputencoding{...} or | ||
| 30 | ;; \usepackage[...]{inputenc} line in the file and looks up the ... in | ||
| 31 | ;; `latex-inputenc-coding-alist' to find the corresponding coding | ||
| 32 | ;; system. | ||
| 33 | |||
| 34 | ;; If this fails it will search for AUCTeX's TeX-master or tex-mode's | ||
| 35 | ;; tex-main-file variable in the local variables section and visit | ||
| 36 | ;; that file to get the coding system from the master file. This check | ||
| 37 | ;; can be disabled by setting `latexenc-dont-use-TeX-master-flag' to | ||
| 38 | ;; t. | ||
| 39 | |||
| 40 | ;; If we have still not found a coding system we will try to use the | ||
| 41 | ;; standard tex-mode's `tex-guess-main-file' and get the coding system | ||
| 42 | ;; from the main file. This check can be disabled by setting | ||
| 43 | ;; `latexenc-dont-use-tex-guess-main-file-flag' to t. | ||
| 44 | |||
| 45 | ;; The functionality is enabled by adding the function | ||
| 46 | ;; `latexenc-find-file-coding-system' to `file-coding-system-alist' | ||
| 47 | ;; like this | ||
| 48 | |||
| 49 | ;; (add-to-list 'file-coding-system-alist | ||
| 50 | ;; '("\\.tex\\|\\.ltx\\|\\.dtx\\|\\.drv\\'" . latexenc-find-file-coding-system)) | ||
| 51 | |||
| 52 | ;;; Code: | ||
| 53 | |||
| 54 | ;;;###autoload | ||
| 55 | (defcustom latex-inputenc-coding-alist | ||
| 56 | '(("ansinew" . windows-1252) ; MS Windows ANSI encoding, extension of Latin-1 | ||
| 57 | ("applemac" . mac-roman) | ||
| 58 | ("ascii" . us-ascii) | ||
| 59 | ("cp1250" . windows-1250) ; MS Windows encoding, codepage 1250 | ||
| 60 | ("cp1252" . windows-1252) ; synonym of ansinew | ||
| 61 | ("cp1257" . cp1257) | ||
| 62 | ("cp437de" . cp437) ; IBM code page 437 (German version): 225 is \ss | ||
| 63 | ("cp437" . cp437) ; IBM code page 437: 225 is \beta | ||
| 64 | ("cp850" . cp850) ; IBM code page 850 | ||
| 65 | ("cp852" . cp852) ; IBM code page 852 | ||
| 66 | ;; ("cp858" . undecided) ; IBM code page 850 but with a euro symbol | ||
| 67 | ("cp865" . cp865) ; IBM code page 865 | ||
| 68 | ;; The DECMultinational charaterset used by the OpenVMS system | ||
| 69 | ;; ("decmulti" . undecided) | ||
| 70 | ("latin1" . iso-8859-1) | ||
| 71 | ("latin2" . iso-8859-2) | ||
| 72 | ("latin3" . iso-8859-3) | ||
| 73 | ("latin4" . iso-8859-4) | ||
| 74 | ("latin5" . iso-8859-5) | ||
| 75 | ("latin9" . iso-8859-15) | ||
| 76 | ;; ("latin10" . undecided) | ||
| 77 | ;; ("macce" . undecided) ; Apple Central European | ||
| 78 | ("next" . next) ; The Next encoding | ||
| 79 | ("utf8" . utf-8) | ||
| 80 | ("utf8x" . utf-8)) ; used by the Unicode LaTeX package | ||
| 81 | "Mapping from encoding names used by LaTeX's \"inputenc.sty\" to Emacs coding systems. | ||
| 82 | Used by the function `latexenc-find-file-coding-system'." | ||
| 83 | :group 'files | ||
| 84 | :group 'mule | ||
| 85 | :type '(alist :key-type (string :tag "LaTeX input encoding") | ||
| 86 | :value-type (coding-system :tag "Coding system"))) | ||
| 87 | |||
| 88 | ;;;###autoload | ||
| 89 | (defun latexenc-inputenc-to-coding-system (inputenc) | ||
| 90 | "Return the corresponding coding-system for the specified input encoding. | ||
| 91 | Return nil if no matching coding system can be found." | ||
| 92 | (cdr (assoc inputenc latex-inputenc-coding-alist))) | ||
| 93 | |||
| 94 | ;;;###autoload | ||
| 95 | (defun latexenc-coding-system-to-inputenc (cs) | ||
| 96 | "Return the corresponding input encoding for the specified coding system. | ||
| 97 | Return nil if no matching input encoding can be found." | ||
| 98 | (let (result) | ||
| 99 | (catch 'result | ||
| 100 | (dolist (elem latex-inputenc-coding-alist result) | ||
| 101 | (let ((elem-cs (cdr elem))) | ||
| 102 | (when (and (coding-system-p elem-cs) | ||
| 103 | (coding-system-p cs) | ||
| 104 | (eq (coding-system-base cs) (coding-system-base elem-cs))) | ||
| 105 | (setq result (car elem)) | ||
| 106 | (throw 'result result))))))) | ||
| 107 | |||
| 108 | (defvar latexenc-dont-use-TeX-master-flag nil | ||
| 109 | "Non-nil means don't follow TeX-master to find the coding system.") | ||
| 110 | |||
| 111 | (defvar latexenc-dont-use-tex-guess-main-file-flag nil | ||
| 112 | "Non-nil means don't use tex-guessmain-file to find the coding system.") | ||
| 113 | |||
| 114 | ;;;###autoload | ||
| 115 | (defun latexenc-find-file-coding-system (arg-list) | ||
| 116 | "Determine the coding system of a LaTeX file if it uses \"inputenc.sty\". | ||
| 117 | The mapping from LaTeX's \"inputenc.sty\" encoding names to Emacs | ||
| 118 | coding system names is determined from `latex-inputenc-coding-alist'." | ||
| 119 | (if (eq (car arg-list) 'insert-file-contents) | ||
| 120 | (save-excursion | ||
| 121 | ;; try to find the coding system in this file | ||
| 122 | (goto-char (point-min)) | ||
| 123 | (if (or | ||
| 124 | (re-search-forward "^[^%\n]*\\\\inputencoding{\\(.*\\)}" nil t) | ||
| 125 | (re-search-forward "^[^%\n]*\\\\usepackage\\[\\(.*\\)\\]{inputenc}" nil t)) | ||
| 126 | (let* ((match (match-string 1)) | ||
| 127 | (sym (intern match))) | ||
| 128 | (when (latexenc-inputenc-to-coding-system match) | ||
| 129 | (setq sym (latexenc-inputenc-to-coding-system match)) | ||
| 130 | (when (coding-system-p sym) | ||
| 131 | sym | ||
| 132 | (if (and (require 'code-pages nil t) (coding-system-p sym)) | ||
| 133 | sym | ||
| 134 | 'undecided)))) | ||
| 135 | ;; else try to find it in the master/main file | ||
| 136 | (let (latexenc-main-file) | ||
| 137 | ;; is there a TeX-master or tex-main-file in the local variable section | ||
| 138 | (unless latexenc-dont-use-TeX-master-flag | ||
| 139 | (goto-char (point-max)) | ||
| 140 | (when (re-search-backward "^%+ *\\(TeX-master\\|tex-main-file\\): *\"\\(.+\\)\"" nil t) | ||
| 141 | (let ((file (concat (file-name-directory (nth 1 arg-list)) (match-string 2)))) | ||
| 142 | (if (file-exists-p file) | ||
| 143 | (setq latexenc-main-file file) | ||
| 144 | (if (boundp 'TeX-default-extension) | ||
| 145 | (when (file-exists-p (concat file "." TeX-default-extension)) | ||
| 146 | (setq latexenc-main-file (concat file "." TeX-default-extension))) | ||
| 147 | (dolist (ext '("drv" "dtx" "ltx" "tex")) | ||
| 148 | (if (file-exists-p (concat file "." ext)) | ||
| 149 | (setq latexenc-main-file (concat file "." ext))))))))) | ||
| 150 | ;; try tex-modes tex-guess-main-file | ||
| 151 | (when (and (not latexenc-dont-use-tex-guess-main-file-flag) | ||
| 152 | (not latexenc-main-file)) | ||
| 153 | (when (fboundp 'tex-guess-main-file) | ||
| 154 | (let ((tex-start-of-header "\\\\document\\(style\\|class\\)") | ||
| 155 | (default-directory (file-name-directory (nth 1 arg-list)))) | ||
| 156 | (setq latexenc-main-file (tex-guess-main-file))))) | ||
| 157 | ;; if we found a master/main file get the coding system from it | ||
| 158 | (if (and latexenc-main-file | ||
| 159 | (file-readable-p latexenc-main-file)) | ||
| 160 | (let* ((latexenc-dont-use-tex-guess-main-file-flag t) | ||
| 161 | (latexenc-dont-use-TeX-master-flag t) | ||
| 162 | (latexenc-main-buffer (find-file-noselect latexenc-main-file t))) | ||
| 163 | (or (buffer-local-value 'coding-system-for-write latexenc-main-buffer) | ||
| 164 | (buffer-local-value 'buffer-file-coding-system latexenc-main-buffer))) | ||
| 165 | 'undecided)))) | ||
| 166 | 'undecided)) | ||
| 167 | |||
| 168 | (provide 'latexenc) | ||
| 169 | |||
| 170 | ;; arch-tag: f971bc3e-1fec-4609-8f2f-73dd41ab22e1 | ||
| 171 | ;;; latexenc.el ends here | ||
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index 08827e09f0f..8a2c8da2665 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el | |||
| @@ -354,9 +354,6 @@ This also sets the following values: | |||
| 354 | (setq default-process-coding-system | 354 | (setq default-process-coding-system |
| 355 | (cons output-coding input-coding)))) | 355 | (cons output-coding input-coding)))) |
| 356 | 356 | ||
| 357 | (defalias 'update-iso-coding-systems 'update-coding-systems-internal) | ||
| 358 | (make-obsolete 'update-iso-coding-systems 'update-coding-systems-internal "20.3") | ||
| 359 | |||
| 360 | (defun prefer-coding-system (coding-system) | 357 | (defun prefer-coding-system (coding-system) |
| 361 | "Add CODING-SYSTEM at the front of the priority list for automatic detection. | 358 | "Add CODING-SYSTEM at the front of the priority list for automatic detection. |
| 362 | This also sets the following coding systems: | 359 | This also sets the following coding systems: |
| @@ -905,7 +902,10 @@ and TO is ignored." | |||
| 905 | ;; give when file is re-read. | 902 | ;; give when file is re-read. |
| 906 | ;; But don't do this if we explicitly ignored the cookie | 903 | ;; But don't do this if we explicitly ignored the cookie |
| 907 | ;; by using `find-file-literally'. | 904 | ;; by using `find-file-literally'. |
| 908 | (unless (or (stringp from) find-file-literally) | 905 | (unless (or (stringp from) |
| 906 | find-file-literally | ||
| 907 | (and coding-system | ||
| 908 | (memq (coding-system-type coding-system) '(0 5)))) | ||
| 909 | (let ((auto-cs (save-excursion | 909 | (let ((auto-cs (save-excursion |
| 910 | (save-restriction | 910 | (save-restriction |
| 911 | (widen) | 911 | (widen) |
diff --git a/lisp/international/mule-conf.el b/lisp/international/mule-conf.el index a3a05a72958..79bf4f3432a 100644 --- a/lisp/international/mule-conf.el +++ b/lisp/international/mule-conf.el | |||
| @@ -1443,7 +1443,8 @@ for decoding and encoding files, process I/O, etc." | |||
| 1443 | ;; the beginning of a doc string, work. | 1443 | ;; the beginning of a doc string, work. |
| 1444 | ("\\(\\`\\|/\\)loaddefs.el\\'" . (raw-text . raw-text-unix)) | 1444 | ("\\(\\`\\|/\\)loaddefs.el\\'" . (raw-text . raw-text-unix)) |
| 1445 | ("\\.tar\\'" . (no-conversion . no-conversion)) | 1445 | ("\\.tar\\'" . (no-conversion . no-conversion)) |
| 1446 | ( "\\.po[tx]?\\'\\|\\.po\\." . po-find-file-coding-system) | 1446 | ( "\\.po[tx]?\\'\\|\\.po\\." . po-find-file-coding-system) |
| 1447 | ("\\.\\(tex\\|ltx\\|dtx\\|drv\\)\\'" . latexenc-find-file-coding-system) | ||
| 1447 | ("" . (undecided . nil)))) | 1448 | ("" . (undecided . nil)))) |
| 1448 | 1449 | ||
| 1449 | 1450 | ||
diff --git a/lisp/international/mule-util.el b/lisp/international/mule-util.el index bfaffba230d..b85d98a1787 100644 --- a/lisp/international/mule-util.el +++ b/lisp/international/mule-util.el | |||
| @@ -211,12 +211,6 @@ defaults to \"...\"." | |||
| 211 | ;; (prin1-to-string (cdr ret))) | 211 | ;; (prin1-to-string (cdr ret))) |
| 212 | ;; (prin1-to-string ret)))))) | 212 | ;; (prin1-to-string ret)))))) |
| 213 | 213 | ||
| 214 | ;;; For backward compatibility ... | ||
| 215 | ;;;###autoload | ||
| 216 | (defalias 'truncate-string 'truncate-string-to-width) | ||
| 217 | |||
| 218 | ;;;###autoload | ||
| 219 | (make-obsolete 'truncate-string 'truncate-string-to-width "20.1") | ||
| 220 | 214 | ||
| 221 | ;;; Nested alist handler. Nested alist is alist whose elements are | 215 | ;;; Nested alist handler. Nested alist is alist whose elements are |
| 222 | ;;; also nested alist. | 216 | ;;; also nested alist. |
diff --git a/lisp/international/mule.el b/lisp/international/mule.el index 8d5ca33881a..ca08d020c74 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el | |||
| @@ -843,9 +843,6 @@ like `mime-charset' as well as the current style like `:mime-charset'." | |||
| 843 | (plist-get (coding-system-plist coding-system) | 843 | (plist-get (coding-system-plist coding-system) |
| 844 | (intern (concat ":" (symbol-name prop))))))) | 844 | (intern (concat ":" (symbol-name prop))))))) |
| 845 | 845 | ||
| 846 | (defalias 'coding-system-parent 'coding-system-base) | ||
| 847 | (make-obsolete 'coding-system-parent 'coding-system-base "20.3") | ||
| 848 | |||
| 849 | (defun coding-system-eol-type-mnemonic (coding-system) | 846 | (defun coding-system-eol-type-mnemonic (coding-system) |
| 850 | "Return the string indicating end-of-line format of CODING-SYSTEM." | 847 | "Return the string indicating end-of-line format of CODING-SYSTEM." |
| 851 | (let* ((eol-type (coding-system-eol-type coding-system)) | 848 | (let* ((eol-type (coding-system-eol-type coding-system)) |
diff --git a/lisp/isearch.el b/lisp/isearch.el index 0bcbfbb2b89..94210d3018b 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el | |||
| @@ -527,9 +527,9 @@ Type \\[isearch-quote-char] to quote control character to search for it. | |||
| 527 | starting point. | 527 | starting point. |
| 528 | 528 | ||
| 529 | Type \\[isearch-query-replace] to start `query-replace' with string to\ | 529 | Type \\[isearch-query-replace] to start `query-replace' with string to\ |
| 530 | replace from last search string. | 530 | replace from last search string. |
| 531 | Type \\[isearch-query-replace-regexp] to start `query-replace-regexp'\ | 531 | Type \\[isearch-query-replace-regexp] to start `query-replace-regexp'\ |
| 532 | with string to replace from last search string.. | 532 | with string to replace from last search string.. |
| 533 | 533 | ||
| 534 | Type \\[isearch-toggle-case-fold] to toggle search case-sensitivity. | 534 | Type \\[isearch-toggle-case-fold] to toggle search case-sensitivity. |
| 535 | Type \\[isearch-toggle-regexp] to toggle regular-expression mode. | 535 | Type \\[isearch-toggle-regexp] to toggle regular-expression mode. |
diff --git a/lisp/jit-lock.el b/lisp/jit-lock.el index fe64d871d96..100eb6076db 100644 --- a/lisp/jit-lock.el +++ b/lisp/jit-lock.el | |||
| @@ -69,7 +69,7 @@ Preserves the `buffer-modified-p' state of the current buffer." | |||
| 69 | :group 'jit-lock) | 69 | :group 'jit-lock) |
| 70 | 70 | ||
| 71 | 71 | ||
| 72 | (defcustom jit-lock-stealth-time 3 | 72 | (defcustom jit-lock-stealth-time 16 |
| 73 | "*Time in seconds to wait before beginning stealth fontification. | 73 | "*Time in seconds to wait before beginning stealth fontification. |
| 74 | Stealth fontification occurs if there is no input within this time. | 74 | Stealth fontification occurs if there is no input within this time. |
| 75 | If nil, stealth fontification is never performed. | 75 | If nil, stealth fontification is never performed. |
| @@ -80,7 +80,7 @@ The value of this variable is used when JIT Lock mode is turned on." | |||
| 80 | :group 'jit-lock) | 80 | :group 'jit-lock) |
| 81 | 81 | ||
| 82 | 82 | ||
| 83 | (defcustom jit-lock-stealth-nice 0.125 | 83 | (defcustom jit-lock-stealth-nice 0.5 |
| 84 | "*Time in seconds to pause between chunks of stealth fontification. | 84 | "*Time in seconds to pause between chunks of stealth fontification. |
| 85 | Each iteration of stealth fontification is separated by this amount of time, | 85 | Each iteration of stealth fontification is separated by this amount of time, |
| 86 | thus reducing the demand that stealth fontification makes on the system. | 86 | thus reducing the demand that stealth fontification makes on the system. |
diff --git a/lisp/jka-comp-hook.el b/lisp/jka-comp-hook.el new file mode 100644 index 00000000000..ead50b76343 --- /dev/null +++ b/lisp/jka-comp-hook.el | |||
| @@ -0,0 +1,293 @@ | |||
| 1 | ;;; jka-comp-hook.el --- preloaded code to enable jka-compr.el | ||
| 2 | |||
| 3 | ;; Copyright (C) 1993, 1994, 1995, 1997, 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; Author: jka@ece.cmu.edu (Jay K. Adams) | ||
| 6 | ;; Maintainer: FSF | ||
| 7 | ;; Keywords: data | ||
| 8 | |||
| 9 | ;; This file is part of GNU Emacs. | ||
| 10 | |||
| 11 | ;; GNU Emacs is free software; you can redistribute it and/or modify | ||
| 12 | ;; it under the terms of the GNU General Public License as published by | ||
| 13 | ;; the Free Software Foundation; either version 2, or (at your option) | ||
| 14 | ;; any later version. | ||
| 15 | |||
| 16 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 17 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 19 | ;; GNU General Public License for more details. | ||
| 20 | |||
| 21 | ;; You should have received a copy of the GNU General Public License | ||
| 22 | ;; along with GNU Emacs; see the file COPYING. If not, write to the | ||
| 23 | ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
| 24 | ;; Boston, MA 02111-1307, USA. | ||
| 25 | |||
| 26 | ;;; Commentary: | ||
| 27 | |||
| 28 | ;; This file contains the code to enable and disable Auto-Compression mode. | ||
| 29 | ;; It is preloaded. The guts of this mode are in jka-compr.el, which | ||
| 30 | ;; is loaded only when you really try to uncompress something. | ||
| 31 | |||
| 32 | ;;; Code: | ||
| 33 | |||
| 34 | (defgroup compression nil | ||
| 35 | "Data compression utilities" | ||
| 36 | :group 'data) | ||
| 37 | |||
| 38 | (defgroup jka-compr nil | ||
| 39 | "jka-compr customization" | ||
| 40 | :group 'compression) | ||
| 41 | |||
| 42 | ;;; I have this defined so that .Z files are assumed to be in unix | ||
| 43 | ;;; compress format; and .gz files, in gzip format, and .bz2 files in bzip fmt. | ||
| 44 | (defcustom jka-compr-compression-info-list | ||
| 45 | ;;[regexp | ||
| 46 | ;; compr-message compr-prog compr-args | ||
| 47 | ;; uncomp-message uncomp-prog uncomp-args | ||
| 48 | ;; can-append auto-mode-flag strip-extension-flag file-magic-bytes] | ||
| 49 | '(["\\.Z\\(~\\|\\.~[0-9]+~\\)?\\'" | ||
| 50 | "compressing" "compress" ("-c") | ||
| 51 | "uncompressing" "uncompress" ("-c") | ||
| 52 | nil t "\037\235"] | ||
| 53 | ;; Formerly, these had an additional arg "-c", but that fails with | ||
| 54 | ;; "Version 0.1pl2, 29-Aug-97." (RedHat 5.1 GNU/Linux) and | ||
| 55 | ;; "Version 0.9.0b, 9-Sept-98". | ||
| 56 | ["\\.bz2\\'" | ||
| 57 | "bzip2ing" "bzip2" nil | ||
| 58 | "bunzip2ing" "bzip2" ("-d") | ||
| 59 | nil t "BZh"] | ||
| 60 | ["\\.tbz\\'" | ||
| 61 | "bzip2ing" "bzip2" nil | ||
| 62 | "bunzip2ing" "bzip2" ("-d") | ||
| 63 | nil nil "BZh"] | ||
| 64 | ["\\.tgz\\'" | ||
| 65 | "compressing" "gzip" ("-c" "-q") | ||
| 66 | "uncompressing" "gzip" ("-c" "-q" "-d") | ||
| 67 | t nil "\037\213"] | ||
| 68 | ["\\.g?z\\(~\\|\\.~[0-9]+~\\)?\\'" | ||
| 69 | "compressing" "gzip" ("-c" "-q") | ||
| 70 | "uncompressing" "gzip" ("-c" "-q" "-d") | ||
| 71 | t t "\037\213"] | ||
| 72 | ;; dzip is gzip with random access. Its compression program can't | ||
| 73 | ;; read/write stdin/out, so .dz files can only be viewed without | ||
| 74 | ;; saving, having their contents decompressed with gzip. | ||
| 75 | ["\\.dz\\'" | ||
| 76 | nil nil nil | ||
| 77 | "uncompressing" "gzip" ("-c" "-q" "-d") | ||
| 78 | nil t "\037\213"]) | ||
| 79 | |||
| 80 | "List of vectors that describe available compression techniques. | ||
| 81 | Each element, which describes a compression technique, is a vector of | ||
| 82 | the form [REGEXP COMPRESS-MSG COMPRESS-PROGRAM COMPRESS-ARGS | ||
| 83 | UNCOMPRESS-MSG UNCOMPRESS-PROGRAM UNCOMPRESS-ARGS | ||
| 84 | APPEND-FLAG STRIP-EXTENSION-FLAG FILE-MAGIC-CHARS], where: | ||
| 85 | |||
| 86 | regexp is a regexp that matches filenames that are | ||
| 87 | compressed with this format | ||
| 88 | |||
| 89 | compress-msg is the message to issue to the user when doing this | ||
| 90 | type of compression (nil means no message) | ||
| 91 | |||
| 92 | compress-program is a program that performs this compression | ||
| 93 | (nil means visit file in read-only mode) | ||
| 94 | |||
| 95 | compress-args is a list of args to pass to the compress program | ||
| 96 | |||
| 97 | uncompress-msg is the message to issue to the user when doing this | ||
| 98 | type of uncompression (nil means no message) | ||
| 99 | |||
| 100 | uncompress-program is a program that performs this compression | ||
| 101 | |||
| 102 | uncompress-args is a list of args to pass to the uncompress program | ||
| 103 | |||
| 104 | append-flag is non-nil if this compression technique can be | ||
| 105 | appended | ||
| 106 | |||
| 107 | strip-extension-flag non-nil means strip the regexp from file names | ||
| 108 | before attempting to set the mode. | ||
| 109 | |||
| 110 | file-magic-chars is a string of characters that you would find | ||
| 111 | at the beginning of a file compressed in this way. | ||
| 112 | |||
| 113 | Because of the way `call-process' is defined, discarding the stderr output of | ||
| 114 | a program adds the overhead of starting a shell each time the program is | ||
| 115 | invoked." | ||
| 116 | :type '(repeat (vector regexp | ||
| 117 | (choice :tag "Compress Message" | ||
| 118 | (string :format "%v") | ||
| 119 | (const :tag "No Message" nil)) | ||
| 120 | (choice :tag "Compress Program" | ||
| 121 | (string) | ||
| 122 | (const :tag "None" nil)) | ||
| 123 | (repeat :tag "Compress Arguments" string) | ||
| 124 | (choice :tag "Uncompress Message" | ||
| 125 | (string :format "%v") | ||
| 126 | (const :tag "No Message" nil)) | ||
| 127 | (choice :tag "Uncompress Program" | ||
| 128 | (string) | ||
| 129 | (const :tag "None" nil)) | ||
| 130 | (repeat :tag "Uncompress Arguments" string) | ||
| 131 | (boolean :tag "Append") | ||
| 132 | (boolean :tag "Strip Extension") | ||
| 133 | (string :tag "Magic Bytes"))) | ||
| 134 | :group 'jka-compr) | ||
| 135 | |||
| 136 | (defcustom jka-compr-mode-alist-additions | ||
| 137 | (list (cons "\\.tgz\\'" 'tar-mode) (cons "\\.tbz\\'" 'tar-mode)) | ||
| 138 | "A list of pairs to add to `auto-mode-alist' when jka-compr is installed." | ||
| 139 | :type '(repeat (cons string symbol)) | ||
| 140 | :group 'jka-compr) | ||
| 141 | |||
| 142 | (defcustom jka-compr-load-suffixes '(".gz") | ||
| 143 | "List of suffixes to try when loading files." | ||
| 144 | :type '(repeat string) | ||
| 145 | :group 'jka-compr) | ||
| 146 | |||
| 147 | ;; List of all the elements we actually added to file-coding-system-alist. | ||
| 148 | (defvar jka-compr-added-to-file-coding-system-alist nil) | ||
| 149 | |||
| 150 | (defvar jka-compr-file-name-handler-entry | ||
| 151 | nil | ||
| 152 | "The entry in `file-name-handler-alist' used by the jka-compr I/O functions.") | ||
| 153 | |||
| 154 | (defun jka-compr-build-file-regexp () | ||
| 155 | (mapconcat | ||
| 156 | 'jka-compr-info-regexp | ||
| 157 | jka-compr-compression-info-list | ||
| 158 | "\\|")) | ||
| 159 | |||
| 160 | ;;; Functions for accessing the return value of jka-compr-get-compression-info | ||
| 161 | (defun jka-compr-info-regexp (info) (aref info 0)) | ||
| 162 | (defun jka-compr-info-compress-message (info) (aref info 1)) | ||
| 163 | (defun jka-compr-info-compress-program (info) (aref info 2)) | ||
| 164 | (defun jka-compr-info-compress-args (info) (aref info 3)) | ||
| 165 | (defun jka-compr-info-uncompress-message (info) (aref info 4)) | ||
| 166 | (defun jka-compr-info-uncompress-program (info) (aref info 5)) | ||
| 167 | (defun jka-compr-info-uncompress-args (info) (aref info 6)) | ||
| 168 | (defun jka-compr-info-can-append (info) (aref info 7)) | ||
| 169 | (defun jka-compr-info-strip-extension (info) (aref info 8)) | ||
| 170 | (defun jka-compr-info-file-magic-bytes (info) (aref info 9)) | ||
| 171 | |||
| 172 | |||
| 173 | (defun jka-compr-get-compression-info (filename) | ||
| 174 | "Return information about the compression scheme of FILENAME. | ||
| 175 | The determination as to which compression scheme, if any, to use is | ||
| 176 | based on the filename itself and `jka-compr-compression-info-list'." | ||
| 177 | (catch 'compression-info | ||
| 178 | (let ((case-fold-search nil)) | ||
| 179 | (mapcar | ||
| 180 | (function (lambda (x) | ||
| 181 | (and (string-match (jka-compr-info-regexp x) filename) | ||
| 182 | (throw 'compression-info x)))) | ||
| 183 | jka-compr-compression-info-list) | ||
| 184 | nil))) | ||
| 185 | |||
| 186 | (defun jka-compr-install () | ||
| 187 | "Install jka-compr. | ||
| 188 | This adds entries to `file-name-handler-alist' and `auto-mode-alist' | ||
| 189 | and `inhibit-first-line-modes-suffixes'." | ||
| 190 | |||
| 191 | (setq jka-compr-file-name-handler-entry | ||
| 192 | (cons (jka-compr-build-file-regexp) 'jka-compr-handler)) | ||
| 193 | |||
| 194 | (setq file-name-handler-alist (cons jka-compr-file-name-handler-entry | ||
| 195 | file-name-handler-alist)) | ||
| 196 | |||
| 197 | (setq jka-compr-added-to-file-coding-system-alist nil) | ||
| 198 | |||
| 199 | (mapcar | ||
| 200 | (function (lambda (x) | ||
| 201 | ;; Don't do multibyte encoding on the compressed files. | ||
| 202 | (let ((elt (cons (jka-compr-info-regexp x) | ||
| 203 | '(no-conversion . no-conversion)))) | ||
| 204 | (setq file-coding-system-alist | ||
| 205 | (cons elt file-coding-system-alist)) | ||
| 206 | (setq jka-compr-added-to-file-coding-system-alist | ||
| 207 | (cons elt jka-compr-added-to-file-coding-system-alist))) | ||
| 208 | |||
| 209 | (and (jka-compr-info-strip-extension x) | ||
| 210 | ;; Make entries in auto-mode-alist so that modes | ||
| 211 | ;; are chosen right according to the file names | ||
| 212 | ;; sans `.gz'. | ||
| 213 | (setq auto-mode-alist | ||
| 214 | (cons (list (jka-compr-info-regexp x) | ||
| 215 | nil 'jka-compr) | ||
| 216 | auto-mode-alist)) | ||
| 217 | ;; Also add these regexps to | ||
| 218 | ;; inhibit-first-line-modes-suffixes, so that a | ||
| 219 | ;; -*- line in the first file of a compressed tar | ||
| 220 | ;; file doesn't override tar-mode. | ||
| 221 | (setq inhibit-first-line-modes-suffixes | ||
| 222 | (cons (jka-compr-info-regexp x) | ||
| 223 | inhibit-first-line-modes-suffixes))))) | ||
| 224 | jka-compr-compression-info-list) | ||
| 225 | (setq auto-mode-alist | ||
| 226 | (append auto-mode-alist jka-compr-mode-alist-additions)) | ||
| 227 | |||
| 228 | ;; Make sure that (load "foo") will find /bla/foo.el.gz. | ||
| 229 | (setq load-suffixes | ||
| 230 | (apply 'append | ||
| 231 | (mapcar (lambda (suffix) | ||
| 232 | (cons suffix | ||
| 233 | (mapcar (lambda (ext) (concat suffix ext)) | ||
| 234 | jka-compr-load-suffixes))) | ||
| 235 | load-suffixes)))) | ||
| 236 | |||
| 237 | |||
| 238 | (defun jka-compr-installed-p () | ||
| 239 | "Return non-nil if jka-compr is installed. | ||
| 240 | The return value is the entry in `file-name-handler-alist' for jka-compr." | ||
| 241 | |||
| 242 | (let ((fnha file-name-handler-alist) | ||
| 243 | (installed nil)) | ||
| 244 | |||
| 245 | (while (and fnha (not installed)) | ||
| 246 | (and (eq (cdr (car fnha)) 'jka-compr-handler) | ||
| 247 | (setq installed (car fnha))) | ||
| 248 | (setq fnha (cdr fnha))) | ||
| 249 | |||
| 250 | installed)) | ||
| 251 | |||
| 252 | (define-minor-mode auto-compression-mode | ||
| 253 | "Toggle automatic file compression and uncompression. | ||
| 254 | With prefix argument ARG, turn auto compression on if positive, else off. | ||
| 255 | Returns the new status of auto compression (non-nil means on)." | ||
| 256 | :global t :group 'jka-compr | ||
| 257 | (let* ((installed (jka-compr-installed-p)) | ||
| 258 | (flag auto-compression-mode)) | ||
| 259 | (cond | ||
| 260 | ((and flag installed) t) ; already installed | ||
| 261 | ((and (not flag) (not installed)) nil) ; already not installed | ||
| 262 | (flag (jka-compr-install)) | ||
| 263 | (t (jka-compr-uninstall))))) | ||
| 264 | |||
| 265 | (defmacro with-auto-compression-mode (&rest body) | ||
| 266 | "Evalute BODY with automatic file compression and uncompression enabled." | ||
| 267 | (let ((already-installed (make-symbol "already-installed"))) | ||
| 268 | `(let ((,already-installed (jka-compr-installed-p))) | ||
| 269 | (unwind-protect | ||
| 270 | (progn | ||
| 271 | (unless ,already-installed | ||
| 272 | (jka-compr-install)) | ||
| 273 | ,@body) | ||
| 274 | (unless ,already-installed | ||
| 275 | (jka-compr-uninstall)))))) | ||
| 276 | (put 'with-auto-compression-mode 'lisp-indent-function 0) | ||
| 277 | |||
| 278 | |||
| 279 | ;;; This is what we need to know about jka-compr-handler | ||
| 280 | ;;; in order to decide when to call it. | ||
| 281 | |||
| 282 | (put 'jka-compr-handler 'safe-magic t) | ||
| 283 | (put 'jka-compr-handler 'operations '(jka-compr-byte-compiler-base-file-name | ||
| 284 | write-region insert-file-contents | ||
| 285 | file-local-copy load)) | ||
| 286 | |||
| 287 | ;;; Turn on the mode. | ||
| 288 | (auto-compression-mode 1) | ||
| 289 | |||
| 290 | (provide 'jka-comp-hook) | ||
| 291 | |||
| 292 | ;; arch-tag: 4bd73429-f400-45fe-a065-270a113e31a8 | ||
| 293 | ;;; jka-comp-hook.el ends here \ No newline at end of file | ||
diff --git a/lisp/jka-compr.el b/lisp/jka-compr.el index 5bda4349288..ec2eab463cc 100644 --- a/lisp/jka-compr.el +++ b/lisp/jka-compr.el | |||
| @@ -100,15 +100,6 @@ | |||
| 100 | 100 | ||
| 101 | ;;; Code: | 101 | ;;; Code: |
| 102 | 102 | ||
| 103 | (defgroup compression nil | ||
| 104 | "Data compression utilities" | ||
| 105 | :group 'data) | ||
| 106 | |||
| 107 | (defgroup jka-compr nil | ||
| 108 | "jka-compr customization" | ||
| 109 | :group 'compression) | ||
| 110 | |||
| 111 | |||
| 112 | (defcustom jka-compr-shell "sh" | 103 | (defcustom jka-compr-shell "sh" |
| 113 | "*Shell to be used for calling compression programs. | 104 | "*Shell to be used for calling compression programs. |
| 114 | The value of this variable only matters if you want to discard the | 105 | The value of this variable only matters if you want to discard the |
| @@ -120,118 +111,6 @@ for `jka-compr-compression-info-list')." | |||
| 120 | (defvar jka-compr-use-shell | 111 | (defvar jka-compr-use-shell |
| 121 | (not (memq system-type '(ms-dos windows-nt)))) | 112 | (not (memq system-type '(ms-dos windows-nt)))) |
| 122 | 113 | ||
| 123 | ;;; I have this defined so that .Z files are assumed to be in unix | ||
| 124 | ;;; compress format; and .gz files, in gzip format, and .bz2 files in bzip fmt. | ||
| 125 | (defcustom jka-compr-compression-info-list | ||
| 126 | ;;[regexp | ||
| 127 | ;; compr-message compr-prog compr-args | ||
| 128 | ;; uncomp-message uncomp-prog uncomp-args | ||
| 129 | ;; can-append auto-mode-flag strip-extension-flag file-magic-bytes] | ||
| 130 | '(["\\.Z\\(~\\|\\.~[0-9]+~\\)?\\'" | ||
| 131 | "compressing" "compress" ("-c") | ||
| 132 | "uncompressing" "uncompress" ("-c") | ||
| 133 | nil t "\037\235"] | ||
| 134 | ;; Formerly, these had an additional arg "-c", but that fails with | ||
| 135 | ;; "Version 0.1pl2, 29-Aug-97." (RedHat 5.1 GNU/Linux) and | ||
| 136 | ;; "Version 0.9.0b, 9-Sept-98". | ||
| 137 | ["\\.bz2\\'" | ||
| 138 | "bzip2ing" "bzip2" nil | ||
| 139 | "bunzip2ing" "bzip2" ("-d") | ||
| 140 | nil t "BZh"] | ||
| 141 | ["\\.tbz\\'" | ||
| 142 | "bzip2ing" "bzip2" nil | ||
| 143 | "bunzip2ing" "bzip2" ("-d") | ||
| 144 | nil nil "BZh"] | ||
| 145 | ["\\.tgz\\'" | ||
| 146 | "zipping" "gzip" ("-c" "-q") | ||
| 147 | "unzipping" "gzip" ("-c" "-q" "-d") | ||
| 148 | t nil "\037\213"] | ||
| 149 | ["\\.g?z\\(~\\|\\.~[0-9]+~\\)?\\'" | ||
| 150 | "zipping" "gzip" ("-c" "-q") | ||
| 151 | "unzipping" "gzip" ("-c" "-q" "-d") | ||
| 152 | t t "\037\213"] | ||
| 153 | ;; dzip is gzip with random access. Its compression program can't | ||
| 154 | ;; read/write stdin/out, so .dz files can only be viewed without | ||
| 155 | ;; saving, having their contents decompressed with gzip. | ||
| 156 | ["\\.dz\\'" | ||
| 157 | nil nil nil | ||
| 158 | "unzipping" "gzip" ("-c" "-q" "-d") | ||
| 159 | nil t "\037\213"]) | ||
| 160 | |||
| 161 | "List of vectors that describe available compression techniques. | ||
| 162 | Each element, which describes a compression technique, is a vector of | ||
| 163 | the form [REGEXP COMPRESS-MSG COMPRESS-PROGRAM COMPRESS-ARGS | ||
| 164 | UNCOMPRESS-MSG UNCOMPRESS-PROGRAM UNCOMPRESS-ARGS | ||
| 165 | APPEND-FLAG STRIP-EXTENSION-FLAG FILE-MAGIC-CHARS], where: | ||
| 166 | |||
| 167 | regexp is a regexp that matches filenames that are | ||
| 168 | compressed with this format | ||
| 169 | |||
| 170 | compress-msg is the message to issue to the user when doing this | ||
| 171 | type of compression (nil means no message) | ||
| 172 | |||
| 173 | compress-program is a program that performs this compression | ||
| 174 | (nil means visit file in read-only mode) | ||
| 175 | |||
| 176 | compress-args is a list of args to pass to the compress program | ||
| 177 | |||
| 178 | uncompress-msg is the message to issue to the user when doing this | ||
| 179 | type of uncompression (nil means no message) | ||
| 180 | |||
| 181 | uncompress-program is a program that performs this compression | ||
| 182 | |||
| 183 | uncompress-args is a list of args to pass to the uncompress program | ||
| 184 | |||
| 185 | append-flag is non-nil if this compression technique can be | ||
| 186 | appended | ||
| 187 | |||
| 188 | strip-extension-flag non-nil means strip the regexp from file names | ||
| 189 | before attempting to set the mode. | ||
| 190 | |||
| 191 | file-magic-chars is a string of characters that you would find | ||
| 192 | at the beginning of a file compressed in this way. | ||
| 193 | |||
| 194 | Because of the way `call-process' is defined, discarding the stderr output of | ||
| 195 | a program adds the overhead of starting a shell each time the program is | ||
| 196 | invoked." | ||
| 197 | :type '(repeat (vector regexp | ||
| 198 | (choice :tag "Compress Message" | ||
| 199 | (string :format "%v") | ||
| 200 | (const :tag "No Message" nil)) | ||
| 201 | (choice :tag "Compress Program" | ||
| 202 | (string) | ||
| 203 | (const :tag "None" nil)) | ||
| 204 | (repeat :tag "Compress Arguments" string) | ||
| 205 | (choice :tag "Uncompress Message" | ||
| 206 | (string :format "%v") | ||
| 207 | (const :tag "No Message" nil)) | ||
| 208 | (choice :tag "Uncompress Program" | ||
| 209 | (string) | ||
| 210 | (const :tag "None" nil)) | ||
| 211 | (repeat :tag "Uncompress Arguments" string) | ||
| 212 | (boolean :tag "Append") | ||
| 213 | (boolean :tag "Strip Extension") | ||
| 214 | (string :tag "Magic Bytes"))) | ||
| 215 | :group 'jka-compr) | ||
| 216 | |||
| 217 | (defcustom jka-compr-mode-alist-additions | ||
| 218 | (list (cons "\\.tgz\\'" 'tar-mode) (cons "\\.tbz\\'" 'tar-mode)) | ||
| 219 | "A list of pairs to add to `auto-mode-alist' when jka-compr is installed." | ||
| 220 | :type '(repeat (cons string symbol)) | ||
| 221 | :group 'jka-compr) | ||
| 222 | |||
| 223 | (defcustom jka-compr-load-suffixes '(".gz") | ||
| 224 | "List of suffixes to try when loading files." | ||
| 225 | :type '(repeat string) | ||
| 226 | :group 'jka-compr) | ||
| 227 | |||
| 228 | ;; List of all the elements we actually added to file-coding-system-alist. | ||
| 229 | (defvar jka-compr-added-to-file-coding-system-alist nil) | ||
| 230 | |||
| 231 | (defvar jka-compr-file-name-handler-entry | ||
| 232 | nil | ||
| 233 | "The entry in `file-name-handler-alist' used by the jka-compr I/O functions.") | ||
| 234 | |||
| 235 | (defvar jka-compr-really-do-compress nil | 114 | (defvar jka-compr-really-do-compress nil |
| 236 | "Non-nil in a buffer whose visited file was uncompressed on visiting it. | 115 | "Non-nil in a buffer whose visited file was uncompressed on visiting it. |
| 237 | This means compress the data on writing the file, even if the | 116 | This means compress the data on writing the file, even if the |
| @@ -764,12 +643,13 @@ There should be no more than seven characters after the final `/'." | |||
| 764 | (put 'byte-compiler-base-file-name 'jka-compr | 643 | (put 'byte-compiler-base-file-name 'jka-compr |
| 765 | 'jka-compr-byte-compiler-base-file-name) | 644 | 'jka-compr-byte-compiler-base-file-name) |
| 766 | 645 | ||
| 646 | ;;;###autoload | ||
| 767 | (defvar jka-compr-inhibit nil | 647 | (defvar jka-compr-inhibit nil |
| 768 | "Non-nil means inhibit automatic uncompression temporarily. | 648 | "Non-nil means inhibit automatic uncompression temporarily. |
| 769 | Lisp programs can bind this to t to do that. | 649 | Lisp programs can bind this to t to do that. |
| 770 | It is not recommended to set this variable permanently to anything but nil.") | 650 | It is not recommended to set this variable permanently to anything but nil.") |
| 771 | 651 | ||
| 772 | (put 'jka-compr-handler 'safe-magic t) | 652 | ;;;###autoload |
| 773 | (defun jka-compr-handler (operation &rest args) | 653 | (defun jka-compr-handler (operation &rest args) |
| 774 | (save-match-data | 654 | (save-match-data |
| 775 | (let ((jka-op (get operation 'jka-compr))) | 655 | (let ((jka-op (get operation 'jka-compr))) |
| @@ -790,65 +670,6 @@ It is not recommended to set this variable permanently to anything but nil.") | |||
| 790 | (apply operation args))) | 670 | (apply operation args))) |
| 791 | 671 | ||
| 792 | 672 | ||
| 793 | (defun jka-compr-build-file-regexp () | ||
| 794 | (mapconcat | ||
| 795 | 'jka-compr-info-regexp | ||
| 796 | jka-compr-compression-info-list | ||
| 797 | "\\|")) | ||
| 798 | |||
| 799 | |||
| 800 | (defun jka-compr-install () | ||
| 801 | "Install jka-compr. | ||
| 802 | This adds entries to `file-name-handler-alist' and `auto-mode-alist' | ||
| 803 | and `inhibit-first-line-modes-suffixes'." | ||
| 804 | |||
| 805 | (setq jka-compr-file-name-handler-entry | ||
| 806 | (cons (jka-compr-build-file-regexp) 'jka-compr-handler)) | ||
| 807 | |||
| 808 | (setq file-name-handler-alist (cons jka-compr-file-name-handler-entry | ||
| 809 | file-name-handler-alist)) | ||
| 810 | |||
| 811 | (setq jka-compr-added-to-file-coding-system-alist nil) | ||
| 812 | |||
| 813 | (mapcar | ||
| 814 | (function (lambda (x) | ||
| 815 | ;; Don't do multibyte encoding on the compressed files. | ||
| 816 | (let ((elt (cons (jka-compr-info-regexp x) | ||
| 817 | '(no-conversion . no-conversion)))) | ||
| 818 | (setq file-coding-system-alist | ||
| 819 | (cons elt file-coding-system-alist)) | ||
| 820 | (setq jka-compr-added-to-file-coding-system-alist | ||
| 821 | (cons elt jka-compr-added-to-file-coding-system-alist))) | ||
| 822 | |||
| 823 | (and (jka-compr-info-strip-extension x) | ||
| 824 | ;; Make entries in auto-mode-alist so that modes | ||
| 825 | ;; are chosen right according to the file names | ||
| 826 | ;; sans `.gz'. | ||
| 827 | (setq auto-mode-alist | ||
| 828 | (cons (list (jka-compr-info-regexp x) | ||
| 829 | nil 'jka-compr) | ||
| 830 | auto-mode-alist)) | ||
| 831 | ;; Also add these regexps to | ||
| 832 | ;; inhibit-first-line-modes-suffixes, so that a | ||
| 833 | ;; -*- line in the first file of a compressed tar | ||
| 834 | ;; file doesn't override tar-mode. | ||
| 835 | (setq inhibit-first-line-modes-suffixes | ||
| 836 | (cons (jka-compr-info-regexp x) | ||
| 837 | inhibit-first-line-modes-suffixes))))) | ||
| 838 | jka-compr-compression-info-list) | ||
| 839 | (setq auto-mode-alist | ||
| 840 | (append auto-mode-alist jka-compr-mode-alist-additions)) | ||
| 841 | |||
| 842 | ;; Make sure that (load "foo") will find /bla/foo.el.gz. | ||
| 843 | (setq load-suffixes | ||
| 844 | (apply 'append | ||
| 845 | (mapcar (lambda (suffix) | ||
| 846 | (cons suffix | ||
| 847 | (mapcar (lambda (ext) (concat suffix ext)) | ||
| 848 | jka-compr-load-suffixes))) | ||
| 849 | load-suffixes)))) | ||
| 850 | |||
| 851 | |||
| 852 | (defun jka-compr-uninstall () | 673 | (defun jka-compr-uninstall () |
| 853 | "Uninstall jka-compr. | 674 | "Uninstall jka-compr. |
| 854 | This removes the entries in `file-name-handler-alist' and `auto-mode-alist' | 675 | This removes the entries in `file-name-handler-alist' and `auto-mode-alist' |
| @@ -908,59 +729,6 @@ by `jka-compr-installed'." | |||
| 908 | (push suffix suffixes))) | 729 | (push suffix suffixes))) |
| 909 | (setq load-suffixes (nreverse suffixes)))) | 730 | (setq load-suffixes (nreverse suffixes)))) |
| 910 | 731 | ||
| 911 | |||
| 912 | (defun jka-compr-installed-p () | ||
| 913 | "Return non-nil if jka-compr is installed. | ||
| 914 | The return value is the entry in `file-name-handler-alist' for jka-compr." | ||
| 915 | |||
| 916 | (let ((fnha file-name-handler-alist) | ||
| 917 | (installed nil)) | ||
| 918 | |||
| 919 | (while (and fnha (not installed)) | ||
| 920 | (and (eq (cdr (car fnha)) 'jka-compr-handler) | ||
| 921 | (setq installed (car fnha))) | ||
| 922 | (setq fnha (cdr fnha))) | ||
| 923 | |||
| 924 | installed)) | ||
| 925 | |||
| 926 | |||
| 927 | ;;; Add the file I/O hook if it does not already exist. | ||
| 928 | ;;; Make sure that jka-compr-file-name-handler-entry is eq to the | ||
| 929 | ;;; entry for jka-compr in file-name-handler-alist. | ||
| 930 | (and (jka-compr-installed-p) | ||
| 931 | (jka-compr-uninstall)) | ||
| 932 | |||
| 933 | |||
| 934 | ;;;###autoload | ||
| 935 | (define-minor-mode auto-compression-mode | ||
| 936 | "Toggle automatic file compression and uncompression. | ||
| 937 | With prefix argument ARG, turn auto compression on if positive, else off. | ||
| 938 | Returns the new status of auto compression (non-nil means on)." | ||
| 939 | :global t :group 'jka-compr | ||
| 940 | (let* ((installed (jka-compr-installed-p)) | ||
| 941 | (flag auto-compression-mode)) | ||
| 942 | (cond | ||
| 943 | ((and flag installed) t) ; already installed | ||
| 944 | ((and (not flag) (not installed)) nil) ; already not installed | ||
| 945 | (flag (jka-compr-install)) | ||
| 946 | (t (jka-compr-uninstall))))) | ||
| 947 | |||
| 948 | |||
| 949 | ;;;###autoload | ||
| 950 | (defmacro with-auto-compression-mode (&rest body) | ||
| 951 | "Evalute BODY with automatic file compression and uncompression enabled." | ||
| 952 | (let ((already-installed (make-symbol "already-installed"))) | ||
| 953 | `(let ((,already-installed (jka-compr-installed-p))) | ||
| 954 | (unwind-protect | ||
| 955 | (progn | ||
| 956 | (unless ,already-installed | ||
| 957 | (jka-compr-install)) | ||
| 958 | ,@body) | ||
| 959 | (unless ,already-installed | ||
| 960 | (jka-compr-uninstall)))))) | ||
| 961 | (put 'with-auto-compression-mode 'lisp-indent-function 0) | ||
| 962 | |||
| 963 | |||
| 964 | (provide 'jka-compr) | 732 | (provide 'jka-compr) |
| 965 | 733 | ||
| 966 | ;;; arch-tag: 3f15b630-e9a7-46c4-a22a-94afdde86ebc | 734 | ;;; arch-tag: 3f15b630-e9a7-46c4-a22a-94afdde86ebc |
diff --git a/lisp/kmacro.el b/lisp/kmacro.el index 20816fc7fea..7224786c50d 100644 --- a/lisp/kmacro.el +++ b/lisp/kmacro.el | |||
| @@ -960,9 +960,9 @@ following additional answers: `insert', `insert-1', `replace', `replace-1', | |||
| 960 | (defun kmacro-step-edit-prompt (macro index) | 960 | (defun kmacro-step-edit-prompt (macro index) |
| 961 | ;; Show step-edit prompt | 961 | ;; Show step-edit prompt |
| 962 | (let ((keys (and (not kmacro-step-edit-appending) | 962 | (let ((keys (and (not kmacro-step-edit-appending) |
| 963 | index (substring macro index executing-macro-index))) | 963 | index (substring macro index executing-kbd-macro-index))) |
| 964 | (future (and (not kmacro-step-edit-appending) | 964 | (future (and (not kmacro-step-edit-appending) |
| 965 | (substring macro executing-macro-index))) | 965 | (substring macro executing-kbd-macro-index))) |
| 966 | (message-log-max nil) | 966 | (message-log-max nil) |
| 967 | (curmsg (current-message))) | 967 | (curmsg (current-message))) |
| 968 | 968 | ||
| @@ -1020,12 +1020,12 @@ following additional answers: `insert', `insert-1', `replace', `replace-1', | |||
| 1020 | (not (eq kmacro-step-edit-action t))) | 1020 | (not (eq kmacro-step-edit-action t))) |
| 1021 | ;; Find the actual end of this key sequence. | 1021 | ;; Find the actual end of this key sequence. |
| 1022 | ;; Must be able to backtrack in case we actually execute it. | 1022 | ;; Must be able to backtrack in case we actually execute it. |
| 1023 | (setq restore-index executing-macro-index) | 1023 | (setq restore-index executing-kbd-macro-index) |
| 1024 | (let (unread-command-events) | 1024 | (let (unread-command-events) |
| 1025 | (quoted-insert 0) | 1025 | (quoted-insert 0) |
| 1026 | (when unread-command-events | 1026 | (when unread-command-events |
| 1027 | (setq executing-macro-index (- executing-macro-index (length unread-command-events)) | 1027 | (setq executing-kbd-macro-index (- executing-kbd-macro-index (length unread-command-events)) |
| 1028 | next-index executing-macro-index))))) | 1028 | next-index executing-kbd-macro-index))))) |
| 1029 | 1029 | ||
| 1030 | ;; Query the user; stop macro exection temporarily | 1030 | ;; Query the user; stop macro exection temporarily |
| 1031 | (let ((macro executing-kbd-macro) | 1031 | (let ((macro executing-kbd-macro) |
| @@ -1045,7 +1045,7 @@ following additional answers: `insert', `insert-1', `replace', `replace-1', | |||
| 1045 | (when unread-command-events | 1045 | (when unread-command-events |
| 1046 | (setq kmacro-step-edit-new-macro | 1046 | (setq kmacro-step-edit-new-macro |
| 1047 | (substring kmacro-step-edit-new-macro 0 (- (length unread-command-events))) | 1047 | (substring kmacro-step-edit-new-macro 0 (- (length unread-command-events))) |
| 1048 | executing-macro-index (- executing-macro-index (length unread-command-events))))) | 1048 | executing-kbd-macro-index (- executing-kbd-macro-index (length unread-command-events))))) |
| 1049 | (setq current-prefix-arg nil | 1049 | (setq current-prefix-arg nil |
| 1050 | prefix-arg nil) | 1050 | prefix-arg nil) |
| 1051 | (setq act 'ignore)) | 1051 | (setq act 'ignore)) |
| @@ -1099,24 +1099,24 @@ following additional answers: `insert', `insert-1', `replace', `replace-1', | |||
| 1099 | (setq act t) | 1099 | (setq act t) |
| 1100 | t) | 1100 | t) |
| 1101 | ((member act '(insert-1 insert)) | 1101 | ((member act '(insert-1 insert)) |
| 1102 | (setq executing-macro-index (or kmacro-step-edit-prefix-index kmacro-step-edit-key-index)) | 1102 | (setq executing-kbd-macro-index (or kmacro-step-edit-prefix-index kmacro-step-edit-key-index)) |
| 1103 | (setq kmacro-step-edit-inserting (if (eq act 'insert-1) 1 t)) | 1103 | (setq kmacro-step-edit-inserting (if (eq act 'insert-1) 1 t)) |
| 1104 | nil) | 1104 | nil) |
| 1105 | ((member act '(replace-1 replace)) | 1105 | ((member act '(replace-1 replace)) |
| 1106 | (setq kmacro-step-edit-inserting (if (eq act 'replace-1) 1 t)) | 1106 | (setq kmacro-step-edit-inserting (if (eq act 'replace-1) 1 t)) |
| 1107 | (setq kmacro-step-edit-prefix-index nil) | 1107 | (setq kmacro-step-edit-prefix-index nil) |
| 1108 | (if (= executing-macro-index (length executing-kbd-macro)) | 1108 | (if (= executing-kbd-macro-index (length executing-kbd-macro)) |
| 1109 | (setq executing-kbd-macro (vconcat executing-kbd-macro [nil]) | 1109 | (setq executing-kbd-macro (vconcat executing-kbd-macro [nil]) |
| 1110 | kmacro-step-edit-appending t)) | 1110 | kmacro-step-edit-appending t)) |
| 1111 | nil) | 1111 | nil) |
| 1112 | ((eq act 'append) | 1112 | ((eq act 'append) |
| 1113 | (setq kmacro-step-edit-inserting t) | 1113 | (setq kmacro-step-edit-inserting t) |
| 1114 | (if (= executing-macro-index (length executing-kbd-macro)) | 1114 | (if (= executing-kbd-macro-index (length executing-kbd-macro)) |
| 1115 | (setq executing-kbd-macro (vconcat executing-kbd-macro [nil]) | 1115 | (setq executing-kbd-macro (vconcat executing-kbd-macro [nil]) |
| 1116 | kmacro-step-edit-appending t)) | 1116 | kmacro-step-edit-appending t)) |
| 1117 | t) | 1117 | t) |
| 1118 | ((eq act 'append-end) | 1118 | ((eq act 'append-end) |
| 1119 | (if (= executing-macro-index (length executing-kbd-macro)) | 1119 | (if (= executing-kbd-macro-index (length executing-kbd-macro)) |
| 1120 | (setq executing-kbd-macro (vconcat executing-kbd-macro [nil]) | 1120 | (setq executing-kbd-macro (vconcat executing-kbd-macro [nil]) |
| 1121 | kmacro-step-edit-inserting t | 1121 | kmacro-step-edit-inserting t |
| 1122 | kmacro-step-edit-appending t) | 1122 | kmacro-step-edit-appending t) |
| @@ -1124,21 +1124,21 @@ following additional answers: `insert', `insert-1', `replace', `replace-1', | |||
| 1124 | (setq act t) | 1124 | (setq act t) |
| 1125 | t) | 1125 | t) |
| 1126 | ((eq act 'help) | 1126 | ((eq act 'help) |
| 1127 | (setq executing-macro-index (or kmacro-step-edit-prefix-index kmacro-step-edit-key-index)) | 1127 | (setq executing-kbd-macro-index (or kmacro-step-edit-prefix-index kmacro-step-edit-key-index)) |
| 1128 | (setq kmacro-step-edit-help (not kmacro-step-edit-help)) | 1128 | (setq kmacro-step-edit-help (not kmacro-step-edit-help)) |
| 1129 | nil) | 1129 | nil) |
| 1130 | (t ;; Ignore unknown responses | 1130 | (t ;; Ignore unknown responses |
| 1131 | (setq executing-macro-index (or kmacro-step-edit-prefix-index kmacro-step-edit-key-index)) | 1131 | (setq executing-kbd-macro-index (or kmacro-step-edit-prefix-index kmacro-step-edit-key-index)) |
| 1132 | nil)) | 1132 | nil)) |
| 1133 | (if (> executing-macro-index (or kmacro-step-edit-prefix-index kmacro-step-edit-key-index)) | 1133 | (if (> executing-kbd-macro-index (or kmacro-step-edit-prefix-index kmacro-step-edit-key-index)) |
| 1134 | (setq kmacro-step-edit-new-macro | 1134 | (setq kmacro-step-edit-new-macro |
| 1135 | (vconcat kmacro-step-edit-new-macro | 1135 | (vconcat kmacro-step-edit-new-macro |
| 1136 | (substring executing-kbd-macro | 1136 | (substring executing-kbd-macro |
| 1137 | (or kmacro-step-edit-prefix-index kmacro-step-edit-key-index) | 1137 | (or kmacro-step-edit-prefix-index kmacro-step-edit-key-index) |
| 1138 | (if (eq act t) nil executing-macro-index))) | 1138 | (if (eq act t) nil executing-kbd-macro-index))) |
| 1139 | kmacro-step-edit-prefix-index nil)) | 1139 | kmacro-step-edit-prefix-index nil)) |
| 1140 | (if restore-index | 1140 | (if restore-index |
| 1141 | (setq executing-macro-index restore-index))) | 1141 | (setq executing-kbd-macro-index restore-index))) |
| 1142 | (t | 1142 | (t |
| 1143 | (setq this-command 'ignore))) | 1143 | (setq this-command 'ignore))) |
| 1144 | (setq kmacro-step-edit-key-index next-index))) | 1144 | (setq kmacro-step-edit-key-index next-index))) |
| @@ -1151,7 +1151,7 @@ following additional answers: `insert', `insert-1', `replace', `replace-1', | |||
| 1151 | (executing-kbd-macro nil) | 1151 | (executing-kbd-macro nil) |
| 1152 | (defining-kbd-macro nil) | 1152 | (defining-kbd-macro nil) |
| 1153 | cmd keys next-index) | 1153 | cmd keys next-index) |
| 1154 | (setq executing-macro-index (or kmacro-step-edit-prefix-index kmacro-step-edit-key-index) | 1154 | (setq executing-kbd-macro-index (or kmacro-step-edit-prefix-index kmacro-step-edit-key-index) |
| 1155 | kmacro-step-edit-prefix-index nil) | 1155 | kmacro-step-edit-prefix-index nil) |
| 1156 | (kmacro-step-edit-prompt macro nil) | 1156 | (kmacro-step-edit-prompt macro nil) |
| 1157 | ;; Now, we have read a key sequence from the macro, but we don't want | 1157 | ;; Now, we have read a key sequence from the macro, but we don't want |
| @@ -1172,8 +1172,8 @@ following additional answers: `insert', `insert-1', `replace', `replace-1', | |||
| 1172 | (setq kmacro-step-edit-inserting nil) | 1172 | (setq kmacro-step-edit-inserting nil) |
| 1173 | (when unread-command-events | 1173 | (when unread-command-events |
| 1174 | (setq keys (substring keys 0 (- (length unread-command-events))) | 1174 | (setq keys (substring keys 0 (- (length unread-command-events))) |
| 1175 | executing-macro-index (- executing-macro-index (length unread-command-events)) | 1175 | executing-kbd-macro-index (- executing-kbd-macro-index (length unread-command-events)) |
| 1176 | next-index executing-macro-index | 1176 | next-index executing-kbd-macro-index |
| 1177 | unread-command-events nil))) | 1177 | unread-command-events nil))) |
| 1178 | (setq cmd 'ignore) | 1178 | (setq cmd 'ignore) |
| 1179 | nil) | 1179 | nil) |
| @@ -1217,7 +1217,7 @@ following additional answers: `insert', `insert-1', `replace', `replace-1', | |||
| 1217 | ((eq kmacro-step-edit-active 'ignore) | 1217 | ((eq kmacro-step-edit-active 'ignore) |
| 1218 | (setq this-command 'ignore)) | 1218 | (setq this-command 'ignore)) |
| 1219 | ((eq kmacro-step-edit-active 'append-end) | 1219 | ((eq kmacro-step-edit-active 'append-end) |
| 1220 | (if (= executing-macro-index (length executing-kbd-macro)) | 1220 | (if (= executing-kbd-macro-index (length executing-kbd-macro)) |
| 1221 | (setq executing-kbd-macro (vconcat executing-kbd-macro [nil]) | 1221 | (setq executing-kbd-macro (vconcat executing-kbd-macro [nil]) |
| 1222 | kmacro-step-edit-inserting t | 1222 | kmacro-step-edit-inserting t |
| 1223 | kmacro-step-edit-appending t | 1223 | kmacro-step-edit-appending t |
| @@ -1243,8 +1243,8 @@ following additional answers: `insert', `insert-1', `replace', `replace-1', | |||
| 1243 | (when kmacro-step-edit-active | 1243 | (when kmacro-step-edit-active |
| 1244 | (add-hook 'pre-command-hook 'kmacro-step-edit-pre-command nil nil) | 1244 | (add-hook 'pre-command-hook 'kmacro-step-edit-pre-command nil nil) |
| 1245 | (if kmacro-step-edit-key-index | 1245 | (if kmacro-step-edit-key-index |
| 1246 | (setq executing-macro-index kmacro-step-edit-key-index) | 1246 | (setq executing-kbd-macro-index kmacro-step-edit-key-index) |
| 1247 | (setq kmacro-step-edit-key-index executing-macro-index)))) | 1247 | (setq kmacro-step-edit-key-index executing-kbd-macro-index)))) |
| 1248 | 1248 | ||
| 1249 | 1249 | ||
| 1250 | (defun kmacro-step-edit-macro () | 1250 | (defun kmacro-step-edit-macro () |
diff --git a/lisp/loadhist.el b/lisp/loadhist.el index 1c71cc6cd07..da6fd695da3 100644 --- a/lisp/loadhist.el +++ b/lisp/loadhist.el | |||
| @@ -188,27 +188,34 @@ such as redefining an Emacs function." | |||
| 188 | (string-match "-hooks?\\'" (symbol-name x))) | 188 | (string-match "-hooks?\\'" (symbol-name x))) |
| 189 | (memq x unload-feature-special-hooks))) ; Known abnormal hooks etc. | 189 | (memq x unload-feature-special-hooks))) ; Known abnormal hooks etc. |
| 190 | (dolist (y unload-hook-features-list) | 190 | (dolist (y unload-hook-features-list) |
| 191 | (when (eq (car-safe y) 'defun) | 191 | (when (and (eq (car-safe y) 'defun) |
| 192 | (remove-hook x (cdr y)))))))) | 192 | (not (get (cdr y) 'autoload))) |
| 193 | (remove-hook x (cdr y))))))) | ||
| 194 | ;; Remove any feature-symbols from auto-mode-alist as well. | ||
| 195 | (dolist (y unload-hook-features-list) | ||
| 196 | (when (and (eq (car-safe y) 'defun) | ||
| 197 | (not (get (cdr y) 'autoload))) | ||
| 198 | (setq auto-mode-alist | ||
| 199 | (rassq-delete-all (cdr y) auto-mode-alist))))) | ||
| 193 | (when (fboundp 'elp-restore-function) ; remove ELP stuff first | 200 | (when (fboundp 'elp-restore-function) ; remove ELP stuff first |
| 194 | (dolist (elt unload-hook-features-list) | 201 | (dolist (elt unload-hook-features-list) |
| 195 | (when (symbolp elt) | 202 | (when (symbolp elt) |
| 196 | (elp-restore-function elt)))) | 203 | (elp-restore-function elt)))) |
| 197 | (dolist (x unload-hook-features-list) | 204 | (dolist (x unload-hook-features-list) |
| 198 | (if (consp x) | 205 | (if (consp x) |
| 199 | (progn | 206 | (cond |
| 200 | ;; Remove any feature names that this file provided. | 207 | ;; Remove any feature names that this file provided. |
| 201 | (when (eq (car x) 'provide) | 208 | ((eq (car x) 'provide) |
| 202 | (setq features (delq (cdr x) features))) | 209 | (setq features (delq (cdr x) features))) |
| 203 | (when (eq (car x) 'defun) | 210 | ((eq (car x) 'defun) |
| 204 | (let ((fun (cdr x))) | 211 | (let ((fun (cdr x))) |
| 205 | (when (fboundp fun) | 212 | (when (fboundp fun) |
| 206 | (when (fboundp 'ad-unadvise) | 213 | (when (fboundp 'ad-unadvise) |
| 207 | (ad-unadvise fun)) | 214 | (ad-unadvise fun)) |
| 208 | (fmakunbound fun) | 215 | (fmakunbound fun) |
| 209 | (let ((aload (get fun 'autoload))) | 216 | (let ((aload (get fun 'autoload))) |
| 210 | (when aload | 217 | (when aload |
| 211 | (fset fun (cons 'autoload aload)))))))) | 218 | (fset fun (cons 'autoload aload)))))))) |
| 212 | ;; Kill local values as much as possible. | 219 | ;; Kill local values as much as possible. |
| 213 | (dolist (buf (buffer-list)) | 220 | (dolist (buf (buffer-list)) |
| 214 | (with-current-buffer buf | 221 | (with-current-buffer buf |
| @@ -217,8 +224,7 @@ such as redefining an Emacs function." | |||
| 217 | (unless (local-variable-if-set-p x) | 224 | (unless (local-variable-if-set-p x) |
| 218 | (makunbound x)))) | 225 | (makunbound x)))) |
| 219 | ;; Delete the load-history element for this file. | 226 | ;; Delete the load-history element for this file. |
| 220 | (let ((elt (assoc file load-history))) | 227 | (setq load-history (delq (assoc file load-history) load-history)))) |
| 221 | (setq load-history (delq elt load-history))))) | ||
| 222 | 228 | ||
| 223 | (provide 'loadhist) | 229 | (provide 'loadhist) |
| 224 | 230 | ||
diff --git a/lisp/loadup.el b/lisp/loadup.el index df7134edcc2..4cc6ebbff0f 100644 --- a/lisp/loadup.el +++ b/lisp/loadup.el | |||
| @@ -179,6 +179,7 @@ | |||
| 179 | (message "%s" (garbage-collect)) | 179 | (message "%s" (garbage-collect)) |
| 180 | 180 | ||
| 181 | (load "vc-hooks") | 181 | (load "vc-hooks") |
| 182 | (load "jka-comp-hook") | ||
| 182 | (load "ediff-hook") | 183 | (load "ediff-hook") |
| 183 | (if (fboundp 'x-show-tip) (load "tooltip")) | 184 | (if (fboundp 'x-show-tip) (load "tooltip")) |
| 184 | (message "%s" (garbage-collect)) | 185 | (message "%s" (garbage-collect)) |
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index 377cb0e4d5a..1feaf94317f 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el | |||
| @@ -662,11 +662,12 @@ The first parenthesized expression should match the MIME-charset name.") | |||
| 662 | ;; Use MATCH-ANCHORED to effectively anchor the regexp left side. | 662 | ;; Use MATCH-ANCHORED to effectively anchor the regexp left side. |
| 663 | `(,cite-chars | 663 | `(,cite-chars |
| 664 | (,(concat "\\=[ \t]*" | 664 | (,(concat "\\=[ \t]*" |
| 665 | "\\(\\([" cite-prefix "]+[" cite-suffix "]*\\)?" | 665 | "\\(\\(\\([" cite-prefix "]+[" cite-suffix "]*\\)?" |
| 666 | "\\(" cite-chars "[ \t]*\\)\\)+" | 666 | "\\(" cite-chars "[ \t]*\\)\\)+\\)" |
| 667 | "\\(.*\\)") | 667 | "\\(.*\\)") |
| 668 | (beginning-of-line) (end-of-line) | 668 | (beginning-of-line) (end-of-line) |
| 669 | (3 font-lock-comment-face nil t))) | 669 | (1 font-lock-comment-delimiter-face nil t) |
| 670 | (5 font-lock-comment-face nil t))) | ||
| 670 | '("^\\(X-[a-z0-9-]+\\|In-reply-to\\|Date\\):.*\\(\n[ \t]+.*\\)*$" | 671 | '("^\\(X-[a-z0-9-]+\\|In-reply-to\\|Date\\):.*\\(\n[ \t]+.*\\)*$" |
| 671 | . font-lock-string-face)))) | 672 | . font-lock-string-face)))) |
| 672 | "Additional expressions to highlight in Rmail mode.") | 673 | "Additional expressions to highlight in Rmail mode.") |
diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el index 91e768f7e7b..5667aa85ff1 100644 --- a/lisp/mail/sendmail.el +++ b/lisp/mail/sendmail.el | |||
| @@ -378,11 +378,12 @@ actually occur.") | |||
| 378 | ;; Use MATCH-ANCHORED to effectively anchor the regexp left side. | 378 | ;; Use MATCH-ANCHORED to effectively anchor the regexp left side. |
| 379 | `(,cite-chars | 379 | `(,cite-chars |
| 380 | (,(concat "\\=[ \t]*" | 380 | (,(concat "\\=[ \t]*" |
| 381 | "\\(\\([" cite-prefix "]+[" cite-suffix "]*\\)?" | 381 | "\\(\\(\\([" cite-prefix "]+[" cite-suffix "]*\\)?" |
| 382 | "\\(" cite-chars "[ \t]*\\)\\)+" | 382 | "\\(" cite-chars "[ \t]*\\)\\)+\\)" |
| 383 | "\\(.*\\)") | 383 | "\\(.*\\)") |
| 384 | (beginning-of-line) (end-of-line) | 384 | (beginning-of-line) (end-of-line) |
| 385 | (3 font-lock-comment-face nil t))) | 385 | (1 font-lock-comment-delimiter-face nil t) |
| 386 | (5 font-lock-comment-face nil t))) | ||
| 386 | '("^\\(X-[A-Za-z0-9-]+\\|In-reply-to\\):.*\\(\n[ \t]+.*\\)*$" | 387 | '("^\\(X-[A-Za-z0-9-]+\\|In-reply-to\\):.*\\(\n[ \t]+.*\\)*$" |
| 387 | . font-lock-string-face)))) | 388 | . font-lock-string-face)))) |
| 388 | "Additional expressions to highlight in Mail mode.") | 389 | "Additional expressions to highlight in Mail mode.") |
diff --git a/lisp/man.el b/lisp/man.el index 8c384028e17..712b1f30e7f 100644 --- a/lisp/man.el +++ b/lisp/man.el | |||
| @@ -387,6 +387,7 @@ Otherwise, the value is whatever the function | |||
| 387 | (let ((table (copy-syntax-table (standard-syntax-table)))) | 387 | (let ((table (copy-syntax-table (standard-syntax-table)))) |
| 388 | (modify-syntax-entry ?. "w" table) | 388 | (modify-syntax-entry ?. "w" table) |
| 389 | (modify-syntax-entry ?_ "w" table) | 389 | (modify-syntax-entry ?_ "w" table) |
| 390 | (modify-syntax-entry ?: "w" table) ; for PDL::Primitive in Perl man pages | ||
| 390 | table) | 391 | table) |
| 391 | "Syntax table used in Man mode buffers.") | 392 | "Syntax table used in Man mode buffers.") |
| 392 | 393 | ||
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index d0d42b9666d..ee51e8c349a 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el | |||
| @@ -639,9 +639,9 @@ by \"Save Options\" in Custom buffers.") | |||
| 639 | (let ((need-save nil)) | 639 | (let ((need-save nil)) |
| 640 | ;; These are set with menu-bar-make-mm-toggle, which does not | 640 | ;; These are set with menu-bar-make-mm-toggle, which does not |
| 641 | ;; put on a customized-value property. | 641 | ;; put on a customized-value property. |
| 642 | (dolist (elt '(line-number-mode column-number-mode cua-mode show-paren-mode | 642 | (dolist (elt '(line-number-mode column-number-mode size-indication-mode |
| 643 | transient-mark-mode global-font-lock-mode | 643 | cua-mode show-paren-mode transient-mark-mode |
| 644 | blink-cursor-mode)) | 644 | global-font-lock-mode blink-cursor-mode)) |
| 645 | (and (customize-mark-to-save elt) | 645 | (and (customize-mark-to-save elt) |
| 646 | (setq need-save t))) | 646 | (setq need-save t))) |
| 647 | ;; These are set with `customize-set-variable'. | 647 | ;; These are set with `customize-set-variable'. |
| @@ -692,6 +692,11 @@ by \"Save Options\" in Custom buffers.") | |||
| 692 | "Line Numbers" | 692 | "Line Numbers" |
| 693 | "Show the current line number in the mode line")) | 693 | "Show the current line number in the mode line")) |
| 694 | 694 | ||
| 695 | (define-key menu-bar-showhide-menu [size-indication-mode] | ||
| 696 | (menu-bar-make-mm-toggle size-indication-mode | ||
| 697 | "Size Indication" | ||
| 698 | "Show the size of the buffer in the mode line")) | ||
| 699 | |||
| 695 | (define-key menu-bar-showhide-menu [linecolumn-separator] | 700 | (define-key menu-bar-showhide-menu [linecolumn-separator] |
| 696 | '("--")) | 701 | '("--")) |
| 697 | 702 | ||
diff --git a/lisp/midnight.el b/lisp/midnight.el index a81ce37856a..83b21dda7e4 100644 --- a/lisp/midnight.el +++ b/lisp/midnight.el | |||
| @@ -48,6 +48,11 @@ | |||
| 48 | :group 'calendar | 48 | :group 'calendar |
| 49 | :version "20.3") | 49 | :version "20.3") |
| 50 | 50 | ||
| 51 | (defvar midnight-timer nil | ||
| 52 | "Timer running the `midnight-hook' `midnight-delay' seconds after midnight. | ||
| 53 | Use `cancel-timer' to stop it and `midnight-delay-set' to change | ||
| 54 | the time when it is run.") | ||
| 55 | |||
| 51 | (defcustom midnight-mode nil | 56 | (defcustom midnight-mode nil |
| 52 | "*Non-nil means run `midnight-hook' at midnight. | 57 | "*Non-nil means run `midnight-hook' at midnight. |
| 53 | Setting this variable outside customize has no effect; | 58 | Setting this variable outside customize has no effect; |
| @@ -204,11 +209,6 @@ The default value is `clean-buffer-list'." | |||
| 204 | (multiple-value-bind (sec min hrs) (decode-time) | 209 | (multiple-value-bind (sec min hrs) (decode-time) |
| 205 | (- (* 24 60 60) (* 60 60 hrs) (* 60 min) sec))) | 210 | (- (* 24 60 60) (* 60 60 hrs) (* 60 min) sec))) |
| 206 | 211 | ||
| 207 | (defvar midnight-timer nil | ||
| 208 | "Timer running the `midnight-hook' `midnight-delay' seconds after midnight. | ||
| 209 | Use `cancel-timer' to stop it and `midnight-delay-set' to change | ||
| 210 | the time when it is run.") | ||
| 211 | |||
| 212 | ;;;###autoload | 212 | ;;;###autoload |
| 213 | (defun midnight-delay-set (symb tm) | 213 | (defun midnight-delay-set (symb tm) |
| 214 | "Modify `midnight-timer' according to `midnight-delay'. | 214 | "Modify `midnight-timer' according to `midnight-delay'. |
diff --git a/lisp/mouse.el b/lisp/mouse.el index a527b040d8a..f4f531959b7 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el | |||
| @@ -908,7 +908,6 @@ at the same position." | |||
| 908 | (track-mouse | 908 | (track-mouse |
| 909 | (while (progn | 909 | (while (progn |
| 910 | (setq event (read-event)) | 910 | (setq event (read-event)) |
| 911 | (setq mve (cons event (and (boundp 'mve) mve))) | ||
| 912 | (or (mouse-movement-p event) | 911 | (or (mouse-movement-p event) |
| 913 | (memq (car-safe event) '(switch-frame select-window)))) | 912 | (memq (car-safe event) '(switch-frame select-window)))) |
| 914 | (if (memq (car-safe event) '(switch-frame select-window)) | 913 | (if (memq (car-safe event) '(switch-frame select-window)) |
diff --git a/lisp/net/net-utils.el b/lisp/net/net-utils.el index 581a070134d..4a54702643a 100644 --- a/lisp/net/net-utils.el +++ b/lisp/net/net-utils.el | |||
| @@ -160,7 +160,7 @@ These options can be used to limit how many ICMP packets are emitted." | |||
| 160 | "Regexp to match the nslookup prompt. | 160 | "Regexp to match the nslookup prompt. |
| 161 | 161 | ||
| 162 | This variable is only used if the variable | 162 | This variable is only used if the variable |
| 163 | `comint-use-prompt-regexp-instead-of-fields' is non-nil." | 163 | `comint-use-prompt-regexp' is non-nil." |
| 164 | :group 'net-utils | 164 | :group 'net-utils |
| 165 | :type 'regexp) | 165 | :type 'regexp) |
| 166 | 166 | ||
| @@ -183,7 +183,7 @@ This variable is only used if the variable | |||
| 183 | "Regexp which matches the FTP program's prompt. | 183 | "Regexp which matches the FTP program's prompt. |
| 184 | 184 | ||
| 185 | This variable is only used if the variable | 185 | This variable is only used if the variable |
| 186 | `comint-use-prompt-regexp-instead-of-fields' is non-nil." | 186 | `comint-use-prompt-regexp' is non-nil." |
| 187 | :group 'net-utils | 187 | :group 'net-utils |
| 188 | :type 'regexp) | 188 | :type 'regexp) |
| 189 | 189 | ||
| @@ -201,7 +201,7 @@ This variable is only used if the variable | |||
| 201 | "Regexp which matches the smbclient program's prompt. | 201 | "Regexp which matches the smbclient program's prompt. |
| 202 | 202 | ||
| 203 | This variable is only used if the variable | 203 | This variable is only used if the variable |
| 204 | `comint-use-prompt-regexp-instead-of-fields' is non-nil." | 204 | `comint-use-prompt-regexp' is non-nil." |
| 205 | :group 'net-utils | 205 | :group 'net-utils |
| 206 | :type 'regexp) | 206 | :type 'regexp) |
| 207 | 207 | ||
diff --git a/lisp/net/rlogin.el b/lisp/net/rlogin.el index fa7e0d1950e..67521ca2e73 100644 --- a/lisp/net/rlogin.el +++ b/lisp/net/rlogin.el | |||
| @@ -179,10 +179,15 @@ variable." | |||
| 179 | 179 | ||
| 180 | (let* ((process-connection-type rlogin-process-connection-type) | 180 | (let* ((process-connection-type rlogin-process-connection-type) |
| 181 | (args (if rlogin-explicit-args | 181 | (args (if rlogin-explicit-args |
| 182 | (append (rlogin-parse-words input-args) | 182 | (append (split-string input-args) |
| 183 | rlogin-explicit-args) | 183 | rlogin-explicit-args) |
| 184 | (rlogin-parse-words input-args))) | 184 | (split-string input-args))) |
| 185 | (host (car args)) | 185 | (host (let ((tail args)) |
| 186 | ;; Find first arg that doesn't look like an option. | ||
| 187 | ;; This still loses for args that take values, feh. | ||
| 188 | (while (and tail (= ?- (aref (car tail) 0))) | ||
| 189 | (setq tail (cdr tail))) | ||
| 190 | (car tail))) | ||
| 186 | (user (or (car (cdr (member "-l" args))) | 191 | (user (or (car (cdr (member "-l" args))) |
| 187 | (user-login-name))) | 192 | (user-login-name))) |
| 188 | (buffer-name (if (string= user (user-login-name)) | 193 | (buffer-name (if (string= user (user-login-name)) |
| @@ -281,19 +286,6 @@ local one share the same directories (through NFS)." | |||
| 281 | (goto-char orig-point))))))) | 286 | (goto-char orig-point))))))) |
| 282 | 287 | ||
| 283 | 288 | ||
| 284 | ;; Parse a line into its constituent parts (words separated by | ||
| 285 | ;; whitespace). Return a list of the words. | ||
| 286 | (defun rlogin-parse-words (line) | ||
| 287 | (let ((list nil) | ||
| 288 | (posn 0) | ||
| 289 | (match-data (match-data))) | ||
| 290 | (while (string-match "[^ \t\n]+" line posn) | ||
| 291 | (setq list (cons (substring line (match-beginning 0) (match-end 0)) | ||
| 292 | list)) | ||
| 293 | (setq posn (match-end 0))) | ||
| 294 | (set-match-data (match-data)) | ||
| 295 | (nreverse list))) | ||
| 296 | |||
| 297 | (defun rlogin-send-Ctrl-C () | 289 | (defun rlogin-send-Ctrl-C () |
| 298 | (interactive) | 290 | (interactive) |
| 299 | (process-send-string nil "\C-c")) | 291 | (process-send-string nil "\C-c")) |
diff --git a/lisp/novice.el b/lisp/novice.el index 3e63f0a7bc6..171285ca3f1 100644 --- a/lisp/novice.el +++ b/lisp/novice.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; novice.el --- handling of disabled commands ("novice mode") for Emacs | 1 | ;;; novice.el --- handling of disabled commands ("novice mode") for Emacs |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1985, 1986, 1987, 1994, 2002, 2004 | 3 | ;; Copyright (C) 1985, 1986, 1987, 1994, 2002, 2004, 2005 |
| 4 | ;; Free Software Foundation, Inc. | 4 | ;; Free Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | ;; Maintainer: FSF | 6 | ;; Maintainer: FSF |
| @@ -182,9 +182,10 @@ to future sessions." | |||
| 182 | (if (search-forward (concat "(put '" (symbol-name command) " ") nil t) | 182 | (if (search-forward (concat "(put '" (symbol-name command) " ") nil t) |
| 183 | (delete-region | 183 | (delete-region |
| 184 | (progn (beginning-of-line) (point)) | 184 | (progn (beginning-of-line) (point)) |
| 185 | (progn (forward-line 1) (point)))) | 185 | (progn (forward-line 1) (point))) |
| 186 | (goto-char (point-max)) | 186 | (goto-char (point-max)) |
| 187 | (insert "\n(put '" (symbol-name command) " 'disabled t)\n") | 187 | (insert ?\n)) |
| 188 | (insert "(put '" (symbol-name command) " 'disabled t)\n") | ||
| 188 | (save-buffer)))) | 189 | (save-buffer)))) |
| 189 | 190 | ||
| 190 | (provide 'novice) | 191 | (provide 'novice) |
diff --git a/lisp/pcvs-info.el b/lisp/pcvs-info.el index 0f66099c46f..cf367072838 100644 --- a/lisp/pcvs-info.el +++ b/lisp/pcvs-info.el | |||
| @@ -41,11 +41,13 @@ | |||
| 41 | ;;;; config variables | 41 | ;;;; config variables |
| 42 | ;;;; | 42 | ;;;; |
| 43 | 43 | ||
| 44 | (defcustom cvs-display-full-path t | 44 | (defcustom cvs-display-full-name t |
| 45 | "*Specifies how the filenames should look like in the listing. | 45 | "*Specifies how the filenames should be displayed in the listing. |
| 46 | If t, their full path name will be displayed, else only the filename." | 46 | If non-nil, their full filename name will be displayed, else only the |
| 47 | non-directory part." | ||
| 47 | :group 'pcl-cvs | 48 | :group 'pcl-cvs |
| 48 | :type '(boolean)) | 49 | :type '(boolean)) |
| 50 | (define-obsolete-variable-alias 'cvs-display-full-path 'cvs-display-full-name) | ||
| 49 | 51 | ||
| 50 | (defcustom cvs-allow-dir-commit nil | 52 | (defcustom cvs-allow-dir-commit nil |
| 51 | "*Allow `cvs-mode-commit' on directories. | 53 | "*Allow `cvs-mode-commit' on directories. |
| @@ -165,7 +167,7 @@ to confuse some users sometimes." | |||
| 165 | ;; In addition to the above, the following values can be extracted: | 167 | ;; In addition to the above, the following values can be extracted: |
| 166 | 168 | ||
| 167 | ;; handled ;; t if this file doesn't require further action. | 169 | ;; handled ;; t if this file doesn't require further action. |
| 168 | ;; full-path ;; The complete relative filename. | 170 | ;; full-name ;; The complete relative filename. |
| 169 | ;; pp-name ;; The printed file name | 171 | ;; pp-name ;; The printed file name |
| 170 | ;; backup-file;; For MERGED and CONFLICT files after a \"cvs update\", | 172 | ;; backup-file;; For MERGED and CONFLICT files after a \"cvs update\", |
| 171 | ;; this is a full path to the backup file where the | 173 | ;; this is a full path to the backup file where the |
| @@ -201,7 +203,7 @@ to confuse some users sometimes." | |||
| 201 | 203 | ||
| 202 | ;; Fake selectors: | 204 | ;; Fake selectors: |
| 203 | 205 | ||
| 204 | (defun cvs-fileinfo->full-path (fileinfo) | 206 | (defun cvs-fileinfo->full-name (fileinfo) |
| 205 | "Return the full path for the file that is described in FILEINFO." | 207 | "Return the full path for the file that is described in FILEINFO." |
| 206 | (let ((dir (cvs-fileinfo->dir fileinfo))) | 208 | (let ((dir (cvs-fileinfo->dir fileinfo))) |
| 207 | (if (eq (cvs-fileinfo->type fileinfo) 'DIRCHANGE) | 209 | (if (eq (cvs-fileinfo->type fileinfo) 'DIRCHANGE) |
| @@ -209,11 +211,12 @@ to confuse some users sometimes." | |||
| 209 | ;; Here, I use `concat' rather than `expand-file-name' because I want | 211 | ;; Here, I use `concat' rather than `expand-file-name' because I want |
| 210 | ;; the resulting path to stay relative if `dir' is relative. | 212 | ;; the resulting path to stay relative if `dir' is relative. |
| 211 | (concat dir (cvs-fileinfo->file fileinfo))))) | 213 | (concat dir (cvs-fileinfo->file fileinfo))))) |
| 214 | (define-obsolete-function-alias 'cvs-fileinfo->full-path 'cvs-fileinfo->full-name) | ||
| 212 | 215 | ||
| 213 | (defun cvs-fileinfo->pp-name (fi) | 216 | (defun cvs-fileinfo->pp-name (fi) |
| 214 | "Return the filename of FI as it should be displayed." | 217 | "Return the filename of FI as it should be displayed." |
| 215 | (if cvs-display-full-path | 218 | (if cvs-display-full-name |
| 216 | (cvs-fileinfo->full-path fi) | 219 | (cvs-fileinfo->full-name fi) |
| 217 | (cvs-fileinfo->file fi))) | 220 | (cvs-fileinfo->file fi))) |
| 218 | 221 | ||
| 219 | (defun cvs-fileinfo->backup-file (fileinfo) | 222 | (defun cvs-fileinfo->backup-file (fileinfo) |
| @@ -225,10 +228,11 @@ to confuse some users sometimes." | |||
| 225 | (concat "\\`" (regexp-quote cvs-bakprefix) | 228 | (concat "\\`" (regexp-quote cvs-bakprefix) |
| 226 | (regexp-quote file) "\\(\\.[0-9]+\\.[0-9]+\\)+\\'"))) | 229 | (regexp-quote file) "\\(\\.[0-9]+\\.[0-9]+\\)+\\'"))) |
| 227 | bf) | 230 | bf) |
| 228 | (dolist (f files bf) | 231 | (dolist (f files) |
| 229 | (when (and (file-readable-p f) | 232 | (when (and (file-readable-p f) |
| 230 | (or (null bf) (file-newer-than-file-p f bf))) | 233 | (or (null bf) (file-newer-than-file-p f bf))) |
| 231 | (setq bf (concat dir f)))))) | 234 | (setq bf f))) |
| 235 | (concat dir bf))) | ||
| 232 | 236 | ||
| 233 | ;; (defun cvs-fileinfo->handled (fileinfo) | 237 | ;; (defun cvs-fileinfo->handled (fileinfo) |
| 234 | ;; "Tell if this requires further action" | 238 | ;; "Tell if this requires further action" |
| @@ -327,7 +331,7 @@ For use by the cookie package." | |||
| 327 | (insert | 331 | (insert |
| 328 | (case type | 332 | (case type |
| 329 | (DIRCHANGE (concat "In directory " | 333 | (DIRCHANGE (concat "In directory " |
| 330 | (cvs-add-face (cvs-fileinfo->full-path fileinfo) | 334 | (cvs-add-face (cvs-fileinfo->full-name fileinfo) |
| 331 | 'cvs-header-face t | 335 | 'cvs-header-face t |
| 332 | 'cvs-goal-column t) | 336 | 'cvs-goal-column t) |
| 333 | ":")) | 337 | ":")) |
diff --git a/lisp/pcvs.el b/lisp/pcvs.el index e7139d9cfba..6382705139e 100644 --- a/lisp/pcvs.el +++ b/lisp/pcvs.el | |||
| @@ -233,7 +233,7 @@ | |||
| 233 | nil ;don't update display while running | 233 | nil ;don't update display while running |
| 234 | "status" | 234 | "status" |
| 235 | "-v" | 235 | "-v" |
| 236 | (cvs-fileinfo->full-path (car marked))) | 236 | (cvs-fileinfo->full-name (car marked))) |
| 237 | (goto-char (point-min)) | 237 | (goto-char (point-min)) |
| 238 | (let ((tags (cvs-status-get-tags))) | 238 | (let ((tags (cvs-status-get-tags))) |
| 239 | (when (listp tags) tags))))))) | 239 | (when (listp tags) tags))))))) |
| @@ -512,7 +512,7 @@ If non-nil, NEW means to create a new buffer no matter what." | |||
| 512 | (let* ((dir+files+rest | 512 | (let* ((dir+files+rest |
| 513 | (if (or (null fis) (not single-dir)) | 513 | (if (or (null fis) (not single-dir)) |
| 514 | ;; not single-dir mode: just process the whole thing | 514 | ;; not single-dir mode: just process the whole thing |
| 515 | (list "" (mapcar 'cvs-fileinfo->full-path fis) nil) | 515 | (list "" (mapcar 'cvs-fileinfo->full-name fis) nil) |
| 516 | ;; single-dir mode: extract the same-dir-elements | 516 | ;; single-dir mode: extract the same-dir-elements |
| 517 | (let ((dir (cvs-fileinfo->dir (car fis)))) | 517 | (let ((dir (cvs-fileinfo->dir (car fis)))) |
| 518 | ;; output the concerned dir so the parser can translate paths | 518 | ;; output the concerned dir so the parser can translate paths |
| @@ -611,7 +611,7 @@ If non-nil, NEW means to create a new buffer no matter what." | |||
| 611 | (append (cvs-flags-query 'cvs-cvs-flags nil 'noquery) | 611 | (append (cvs-flags-query 'cvs-cvs-flags nil 'noquery) |
| 612 | (if cvs-cvsroot (list "-d" cvs-cvsroot)) | 612 | (if cvs-cvsroot (list "-d" cvs-cvsroot)) |
| 613 | args | 613 | args |
| 614 | (mapcar 'cvs-fileinfo->full-path fis)))))) | 614 | (mapcar 'cvs-fileinfo->full-name fis)))))) |
| 615 | 615 | ||
| 616 | (defun cvs-update-header (cmd add) | 616 | (defun cvs-update-header (cmd add) |
| 617 | (let* ((hf (ewoc-get-hf cvs-cookies)) | 617 | (let* ((hf (ewoc-get-hf cvs-cookies)) |
| @@ -831,7 +831,7 @@ the problem." | |||
| 831 | (and (or (eq (cvs-fileinfo->type fi) 'REMOVED) | 831 | (and (or (eq (cvs-fileinfo->type fi) 'REMOVED) |
| 832 | (and (eq (cvs-fileinfo->type fi) 'CONFLICT) | 832 | (and (eq (cvs-fileinfo->type fi) 'CONFLICT) |
| 833 | (eq (cvs-fileinfo->subtype fi) 'REMOVED))) | 833 | (eq (cvs-fileinfo->subtype fi) 'REMOVED))) |
| 834 | (file-exists-p (cvs-fileinfo->full-path fi)))) | 834 | (file-exists-p (cvs-fileinfo->full-name fi)))) |
| 835 | 835 | ||
| 836 | ;; called at the following times: | 836 | ;; called at the following times: |
| 837 | ;; - postparse ((eq cvs-auto-remove-handled t) cvs-auto-remove-directories nil) | 837 | ;; - postparse ((eq cvs-auto-remove-handled t) cvs-auto-remove-directories nil) |
| @@ -1406,7 +1406,7 @@ If FILE is non-nil, directory entries won't be selected." | |||
| 1406 | (defun cvs-mode-files (&rest -cvs-mode-files-args) | 1406 | (defun cvs-mode-files (&rest -cvs-mode-files-args) |
| 1407 | (cvs-mode! | 1407 | (cvs-mode! |
| 1408 | (lambda () | 1408 | (lambda () |
| 1409 | (mapcar 'cvs-fileinfo->full-path | 1409 | (mapcar 'cvs-fileinfo->full-name |
| 1410 | (apply 'cvs-mode-marked -cvs-mode-files-args))))) | 1410 | (apply 'cvs-mode-marked -cvs-mode-files-args))))) |
| 1411 | 1411 | ||
| 1412 | ;; | 1412 | ;; |
| @@ -1564,7 +1564,7 @@ With prefix argument, prompt for cvs flags." | |||
| 1564 | ;; find directories and look for fis needing a description | 1564 | ;; find directories and look for fis needing a description |
| 1565 | (dolist (fi fis) | 1565 | (dolist (fi fis) |
| 1566 | (cond | 1566 | (cond |
| 1567 | ((file-directory-p (cvs-fileinfo->full-path fi)) (push fi dirs)) | 1567 | ((file-directory-p (cvs-fileinfo->full-name fi)) (push fi dirs)) |
| 1568 | ((eq (cvs-fileinfo->type fi) 'UNKNOWN) (setq needdesc t)))) | 1568 | ((eq (cvs-fileinfo->type fi) 'UNKNOWN) (setq needdesc t)))) |
| 1569 | ;; prompt for description if necessary | 1569 | ;; prompt for description if necessary |
| 1570 | (let* ((msg (if (and needdesc | 1570 | (let* ((msg (if (and needdesc |
| @@ -1642,8 +1642,8 @@ or \"Conflict\" in the *cvs* buffer." | |||
| 1642 | Signal an error if there is no backup file." | 1642 | Signal an error if there is no backup file." |
| 1643 | (let ((backup-file (cvs-fileinfo->backup-file fileinfo))) | 1643 | (let ((backup-file (cvs-fileinfo->backup-file fileinfo))) |
| 1644 | (unless backup-file | 1644 | (unless backup-file |
| 1645 | (error "%s has no backup file" (cvs-fileinfo->full-path fileinfo))) | 1645 | (error "%s has no backup file" (cvs-fileinfo->full-name fileinfo))) |
| 1646 | (list backup-file (cvs-fileinfo->full-path fileinfo)))) | 1646 | (list backup-file (cvs-fileinfo->full-name fileinfo)))) |
| 1647 | 1647 | ||
| 1648 | ;; | 1648 | ;; |
| 1649 | ;; Emerge support | 1649 | ;; Emerge support |
| @@ -1697,7 +1697,7 @@ Signal an error if there is no backup file." | |||
| 1697 | 1697 | ||
| 1698 | (defun cvs-retrieve-revision (fileinfo rev) | 1698 | (defun cvs-retrieve-revision (fileinfo rev) |
| 1699 | "Retrieve the given REVision of the file in FILEINFO into a new buffer." | 1699 | "Retrieve the given REVision of the file in FILEINFO into a new buffer." |
| 1700 | (let* ((file (cvs-fileinfo->full-path fileinfo)) | 1700 | (let* ((file (cvs-fileinfo->full-name fileinfo)) |
| 1701 | (buffile (concat file "." rev))) | 1701 | (buffile (concat file "." rev))) |
| 1702 | (or (find-buffer-visiting buffile) | 1702 | (or (find-buffer-visiting buffile) |
| 1703 | (with-current-buffer (create-file-buffer buffile) | 1703 | (with-current-buffer (create-file-buffer buffile) |
| @@ -1729,7 +1729,7 @@ Signal an error if there is no backup file." | |||
| 1729 | (interactive) | 1729 | (interactive) |
| 1730 | (let ((fi (cvs-mode-marked 'merge nil :one t :file t))) | 1730 | (let ((fi (cvs-mode-marked 'merge nil :one t :file t))) |
| 1731 | (let ((merge (cvs-fileinfo->merge fi)) | 1731 | (let ((merge (cvs-fileinfo->merge fi)) |
| 1732 | (file (cvs-fileinfo->full-path fi)) | 1732 | (file (cvs-fileinfo->full-name fi)) |
| 1733 | (backup-file (cvs-fileinfo->backup-file fi))) | 1733 | (backup-file (cvs-fileinfo->backup-file fi))) |
| 1734 | (if (not (and merge backup-file)) | 1734 | (if (not (and merge backup-file)) |
| 1735 | (let ((buf (find-file-noselect file))) | 1735 | (let ((buf (find-file-noselect file))) |
| @@ -1760,7 +1760,7 @@ Signal an error if there is no backup file." | |||
| 1760 | (list (or rev1 (cvs-flags-query 'cvs-idiff-version)) | 1760 | (list (or rev1 (cvs-flags-query 'cvs-idiff-version)) |
| 1761 | rev2))) | 1761 | rev2))) |
| 1762 | (let ((fi (cvs-mode-marked 'diff "idiff" :one t :file t))) | 1762 | (let ((fi (cvs-mode-marked 'diff "idiff" :one t :file t))) |
| 1763 | (let* ((file (cvs-fileinfo->full-path fi)) | 1763 | (let* ((file (cvs-fileinfo->full-name fi)) |
| 1764 | (rev1-buf (cvs-retrieve-revision fi (or rev1 "BASE"))) | 1764 | (rev1-buf (cvs-retrieve-revision fi (or rev1 "BASE"))) |
| 1765 | (rev2-buf (if rev2 (cvs-retrieve-revision fi rev2))) | 1765 | (rev2-buf (if rev2 (cvs-retrieve-revision fi rev2))) |
| 1766 | ;; this binding is used by cvs-ediff-startup-hook | 1766 | ;; this binding is used by cvs-ediff-startup-hook |
| @@ -1778,13 +1778,13 @@ Signal an error if there is no backup file." | |||
| 1778 | (error "idiff-other cannot be applied to more than 2 files at a time")) | 1778 | (error "idiff-other cannot be applied to more than 2 files at a time")) |
| 1779 | (let* ((fi1 (car fis)) | 1779 | (let* ((fi1 (car fis)) |
| 1780 | (rev1-buf (if rev1 (cvs-retrieve-revision fi1 rev1) | 1780 | (rev1-buf (if rev1 (cvs-retrieve-revision fi1 rev1) |
| 1781 | (find-file-noselect (cvs-fileinfo->full-path fi1)))) | 1781 | (find-file-noselect (cvs-fileinfo->full-name fi1)))) |
| 1782 | rev2-buf) | 1782 | rev2-buf) |
| 1783 | (if (cdr fis) | 1783 | (if (cdr fis) |
| 1784 | (let ((fi2 (nth 1 fis))) | 1784 | (let ((fi2 (nth 1 fis))) |
| 1785 | (setq rev2-buf | 1785 | (setq rev2-buf |
| 1786 | (if rev2 (cvs-retrieve-revision fi2 rev2) | 1786 | (if rev2 (cvs-retrieve-revision fi2 rev2) |
| 1787 | (find-file-noselect (cvs-fileinfo->full-path fi2))))) | 1787 | (find-file-noselect (cvs-fileinfo->full-name fi2))))) |
| 1788 | (error "idiff-other doesn't know what other file/buffer to use")) | 1788 | (error "idiff-other doesn't know what other file/buffer to use")) |
| 1789 | (let* (;; this binding is used by cvs-ediff-startup-hook | 1789 | (let* (;; this binding is used by cvs-ediff-startup-hook |
| 1790 | (cvs-transient-buffers (list rev1-buf rev2-buf))) | 1790 | (cvs-transient-buffers (list rev1-buf rev2-buf))) |
| @@ -1799,7 +1799,7 @@ Signal an error if there is no backup file." | |||
| 1799 | (let (ret) | 1799 | (let (ret) |
| 1800 | (dolist (fi (or fis (list (cvs-create-fileinfo 'DIRCHANGE "" "." "")))) | 1800 | (dolist (fi (or fis (list (cvs-create-fileinfo 'DIRCHANGE "" "." "")))) |
| 1801 | (when (cvs-string-prefix-p | 1801 | (when (cvs-string-prefix-p |
| 1802 | (expand-file-name (cvs-fileinfo->full-path fi) dir) | 1802 | (expand-file-name (cvs-fileinfo->full-name fi) dir) |
| 1803 | buffer-file-name) | 1803 | buffer-file-name) |
| 1804 | (setq ret t))) | 1804 | (setq ret t))) |
| 1805 | ret))) | 1805 | ret))) |
| @@ -2002,7 +2002,7 @@ With a prefix, opens the buffer in an OTHER window." | |||
| 2002 | (set-buffer cvs-buf) | 2002 | (set-buffer cvs-buf) |
| 2003 | (setq default-directory odir)) | 2003 | (setq default-directory odir)) |
| 2004 | (let ((buf (if rev (cvs-retrieve-revision fi rev) | 2004 | (let ((buf (if rev (cvs-retrieve-revision fi rev) |
| 2005 | (find-file-noselect (cvs-fileinfo->full-path fi))))) | 2005 | (find-file-noselect (cvs-fileinfo->full-name fi))))) |
| 2006 | (funcall (cond ((eq other 'dont-select) 'display-buffer) | 2006 | (funcall (cond ((eq other 'dont-select) 'display-buffer) |
| 2007 | (other | 2007 | (other |
| 2008 | (if view 'view-buffer-other-window | 2008 | (if view 'view-buffer-other-window |
| @@ -2093,14 +2093,14 @@ Returns a list of FIS that should be `cvs remove'd." | |||
| 2093 | (silent (or (not cvs-confirm-removals) | 2093 | (silent (or (not cvs-confirm-removals) |
| 2094 | (cvs-every (lambda (fi) | 2094 | (cvs-every (lambda (fi) |
| 2095 | (or (not (file-exists-p | 2095 | (or (not (file-exists-p |
| 2096 | (cvs-fileinfo->full-path fi))) | 2096 | (cvs-fileinfo->full-name fi))) |
| 2097 | (cvs-applicable-p fi 'safe-rm))) | 2097 | (cvs-applicable-p fi 'safe-rm))) |
| 2098 | files))) | 2098 | files))) |
| 2099 | (tmpbuf (cvs-temp-buffer))) | 2099 | (tmpbuf (cvs-temp-buffer))) |
| 2100 | (when (and (not silent) (equal cvs-confirm-removals 'list)) | 2100 | (when (and (not silent) (equal cvs-confirm-removals 'list)) |
| 2101 | (with-current-buffer tmpbuf | 2101 | (with-current-buffer tmpbuf |
| 2102 | (let ((inhibit-read-only t)) | 2102 | (let ((inhibit-read-only t)) |
| 2103 | (cvs-insert-strings (mapcar 'cvs-fileinfo->full-path fis)) | 2103 | (cvs-insert-strings (mapcar 'cvs-fileinfo->full-name fis)) |
| 2104 | (cvs-pop-to-buffer-same-frame (current-buffer)) | 2104 | (cvs-pop-to-buffer-same-frame (current-buffer)) |
| 2105 | (shrink-window-if-larger-than-buffer)))) | 2105 | (shrink-window-if-larger-than-buffer)))) |
| 2106 | (if (not (or silent | 2106 | (if (not (or silent |
| @@ -2119,7 +2119,7 @@ Returns a list of FIS that should be `cvs remove'd." | |||
| 2119 | (progn (message "Aborting") nil) | 2119 | (progn (message "Aborting") nil) |
| 2120 | (dolist (fi files) | 2120 | (dolist (fi files) |
| 2121 | (let* ((type (cvs-fileinfo->type fi)) | 2121 | (let* ((type (cvs-fileinfo->type fi)) |
| 2122 | (file (cvs-fileinfo->full-path fi))) | 2122 | (file (cvs-fileinfo->full-name fi))) |
| 2123 | (when (or all (eq type 'UNKNOWN)) | 2123 | (when (or all (eq type 'UNKNOWN)) |
| 2124 | (when (file-exists-p file) (delete-file file)) | 2124 | (when (file-exists-p file) (delete-file file)) |
| 2125 | (unless all (setf (cvs-fileinfo->type fi) 'DEAD) t)))) | 2125 | (unless all (setf (cvs-fileinfo->type fi) 'DEAD) t)))) |
| @@ -2166,7 +2166,7 @@ With prefix argument, prompt for cvs flags." | |||
| 2166 | (interactive) | 2166 | (interactive) |
| 2167 | (let ((marked (cvs-get-marked (cvs-ignore-marks-p "byte-compile")))) | 2167 | (let ((marked (cvs-get-marked (cvs-ignore-marks-p "byte-compile")))) |
| 2168 | (dolist (fi marked) | 2168 | (dolist (fi marked) |
| 2169 | (let ((filename (cvs-fileinfo->full-path fi))) | 2169 | (let ((filename (cvs-fileinfo->full-name fi))) |
| 2170 | (when (string-match "\\.el\\'" filename) | 2170 | (when (string-match "\\.el\\'" filename) |
| 2171 | (byte-compile-file filename)))))) | 2171 | (byte-compile-file filename)))))) |
| 2172 | 2172 | ||
| @@ -2237,7 +2237,7 @@ this file, or a list of arguments to send to the program." | |||
| 2237 | 2237 | ||
| 2238 | (defun cvs-revert-if-needed (fis) | 2238 | (defun cvs-revert-if-needed (fis) |
| 2239 | (dolist (fileinfo fis) | 2239 | (dolist (fileinfo fis) |
| 2240 | (let* ((file (cvs-fileinfo->full-path fileinfo)) | 2240 | (let* ((file (cvs-fileinfo->full-name fileinfo)) |
| 2241 | (buffer (find-buffer-visiting file))) | 2241 | (buffer (find-buffer-visiting file))) |
| 2242 | ;; For a revert to happen the user must be editing the file... | 2242 | ;; For a revert to happen the user must be editing the file... |
| 2243 | (unless (or (null buffer) | 2243 | (unless (or (null buffer) |
diff --git a/lisp/progmodes/cmacexp.el b/lisp/progmodes/cmacexp.el index 27fe81e451d..28d988961a6 100644 --- a/lisp/progmodes/cmacexp.el +++ b/lisp/progmodes/cmacexp.el | |||
| @@ -118,6 +118,7 @@ | |||
| 118 | (file-exists-p "/opt/SUNWspro/SC3.0.1/bin/acomp")) | 118 | (file-exists-p "/opt/SUNWspro/SC3.0.1/bin/acomp")) |
| 119 | "/opt/SUNWspro/SC3.0.1/bin/acomp -C -E") | 119 | "/opt/SUNWspro/SC3.0.1/bin/acomp -C -E") |
| 120 | ((file-exists-p "/usr/ccs/lib/cpp") "/usr/ccs/lib/cpp -C") | 120 | ((file-exists-p "/usr/ccs/lib/cpp") "/usr/ccs/lib/cpp -C") |
| 121 | ((memq system-type '(darwin berkeley-unix)) "gcc -E -C -") | ||
| 121 | (t "/lib/cpp -C")) | 122 | (t "/lib/cpp -C")) |
| 122 | "The preprocessor used by the cmacexp package. | 123 | "The preprocessor used by the cmacexp package. |
| 123 | 124 | ||
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 129a01f5498..0cc70386be8 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el | |||
| @@ -710,7 +710,7 @@ FILE should be (ABSOLUTE-FILENAME) or (RELATIVE-FILENAME . DIRNAME) or nil." | |||
| 710 | `(,(car elt) | 710 | `(,(car elt) |
| 711 | (compilation-directory-properties | 711 | (compilation-directory-properties |
| 712 | ,(car elt) ,(cdr elt)) | 712 | ,(car elt) ,(cdr elt)) |
| 713 | t)) | 713 | t t)) |
| 714 | (cdr compilation-directory-matcher))))) | 714 | (cdr compilation-directory-matcher))))) |
| 715 | 715 | ||
| 716 | ;; Compiler warning/error lines. | 716 | ;; Compiler warning/error lines. |
| @@ -733,11 +733,12 @@ FILE should be (ABSOLUTE-FILENAME) or (RELATIVE-FILENAME . DIRNAME) or nil." | |||
| 733 | ;; allowed `line' to be a function that computed the actual | 733 | ;; allowed `line' to be a function that computed the actual |
| 734 | ;; error location. Let's do our best. | 734 | ;; error location. Let's do our best. |
| 735 | `(,(car item) | 735 | `(,(car item) |
| 736 | (0 (compilation-compat-error-properties | 736 | (0 (save-match-data |
| 737 | (funcall ',line (cons (match-string ,file) | 737 | (compilation-compat-error-properties |
| 738 | (cons default-directory | 738 | (funcall ',line (cons (match-string ,file) |
| 739 | ',(nthcdr 4 item))) | 739 | (cons default-directory |
| 740 | ,(if col `(match-string ,col))))) | 740 | ',(nthcdr 4 item))) |
| 741 | ,(if col `(match-string ,col)))))) | ||
| 741 | (,file compilation-error-face t)) | 742 | (,file compilation-error-face t)) |
| 742 | 743 | ||
| 743 | (unless (or (null (nth 5 item)) (integerp (nth 5 item))) | 744 | (unless (or (null (nth 5 item)) (integerp (nth 5 item))) |
| @@ -1589,6 +1590,8 @@ If nil, don't scroll the compilation output window." | |||
| 1589 | (point)))) | 1590 | (point)))) |
| 1590 | (set-window-point w mk)) | 1591 | (set-window-point w mk)) |
| 1591 | 1592 | ||
| 1593 | (defvar next-error-highlight-timer) | ||
| 1594 | |||
| 1592 | (defun compilation-goto-locus (msg mk end-mk) | 1595 | (defun compilation-goto-locus (msg mk end-mk) |
| 1593 | "Jump to an error corresponding to MSG at MK. | 1596 | "Jump to an error corresponding to MSG at MK. |
| 1594 | All arguments are markers. If END-MK is non-nil, mark is set there | 1597 | All arguments are markers. If END-MK is non-nil, mark is set there |
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index 700fa1c9efe..4a701edcca2 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el | |||
| @@ -1514,14 +1514,14 @@ or as help on variables `cperl-tips', `cperl-problems', | |||
| 1514 | (set 'font-lock-unfontify-region-function ; not present with old Emacs | 1514 | (set 'font-lock-unfontify-region-function ; not present with old Emacs |
| 1515 | 'cperl-font-lock-unfontify-region-function) | 1515 | 'cperl-font-lock-unfontify-region-function) |
| 1516 | (make-local-variable 'cperl-syntax-done-to) | 1516 | (make-local-variable 'cperl-syntax-done-to) |
| 1517 | ;; Another bug: unless font-lock-syntactic-keywords, font-lock | ||
| 1518 | ;; ignores syntax-table text-property. (t) is a hack | ||
| 1519 | ;; to make font-lock think that font-lock-syntactic-keywords | ||
| 1520 | ;; are defined | ||
| 1521 | (make-local-variable 'font-lock-syntactic-keywords) | 1517 | (make-local-variable 'font-lock-syntactic-keywords) |
| 1522 | (setq font-lock-syntactic-keywords | 1518 | (setq font-lock-syntactic-keywords |
| 1523 | (if cperl-syntaxify-by-font-lock | 1519 | (if cperl-syntaxify-by-font-lock |
| 1524 | '(t (cperl-fontify-syntaxically)) | 1520 | '((cperl-fontify-syntaxically)) |
| 1521 | ;; unless font-lock-syntactic-keywords, font-lock (pre-22.1) | ||
| 1522 | ;; used to ignore syntax-table text-properties. (t) is a hack | ||
| 1523 | ;; to make font-lock think that font-lock-syntactic-keywords | ||
| 1524 | ;; are defined. | ||
| 1525 | '(t))))) | 1525 | '(t))))) |
| 1526 | (make-local-variable 'cperl-old-style) | 1526 | (make-local-variable 'cperl-old-style) |
| 1527 | (if (boundp 'normal-auto-fill-function) ; 19.33 and later | 1527 | (if (boundp 'normal-auto-fill-function) ; 19.33 and later |
diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el index 14363e4dccf..eb6db05c159 100644 --- a/lisp/progmodes/f90.el +++ b/lisp/progmodes/f90.el | |||
| @@ -1109,9 +1109,15 @@ Does not check type and subprogram indentation." | |||
| 1109 | (let (icol cont (case-fold-search t) (pnt (point))) | 1109 | (let (icol cont (case-fold-search t) (pnt (point))) |
| 1110 | (save-excursion | 1110 | (save-excursion |
| 1111 | (if (not (f90-previous-statement)) | 1111 | (if (not (f90-previous-statement)) |
| 1112 | ;; First statement in buffer. | 1112 | ;; If f90-previous-statement returns nil, we must have been |
| 1113 | ;; called from on or before the first line of the first statement. | ||
| 1113 | (setq icol (if (save-excursion | 1114 | (setq icol (if (save-excursion |
| 1114 | (f90-next-statement) | 1115 | ;; f90-previous-statement has moved us over |
| 1116 | ;; comment/blank lines, so we need to get | ||
| 1117 | ;; back to the first code statement. | ||
| 1118 | (when (looking-at "[ \t]*\\([!#]\\|$\\)") | ||
| 1119 | (f90-next-statement)) | ||
| 1120 | (skip-chars-forward " \t0-9") | ||
| 1115 | (f90-looking-at-program-block-start)) | 1121 | (f90-looking-at-program-block-start)) |
| 1116 | 0 | 1122 | 0 |
| 1117 | ;; No explicit PROGRAM start statement. | 1123 | ;; No explicit PROGRAM start statement. |
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 73d77affdc4..a2fa660bff0 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el | |||
| @@ -62,7 +62,8 @@ | |||
| 62 | (replace-in-string str regexp rep))) | 62 | (replace-in-string str regexp rep))) |
| 63 | 63 | ||
| 64 | (defun flymake-split-string (str pattern) | 64 | (defun flymake-split-string (str pattern) |
| 65 | "Split, then remove first and/or last in case it's empty." | 65 | "Split STR into a list of substrings bounded by PATTERN. |
| 66 | Zero-length substrings at the beginning and end of the list are omitted." | ||
| 66 | (let* ((splitted (split-string str pattern))) | 67 | (let* ((splitted (split-string str pattern))) |
| 67 | (if (and (> (length splitted) 0) (= 0 (length (elt splitted 0)))) | 68 | (if (and (> (length splitted) 0) (= 0 (length (elt splitted 0)))) |
| 68 | (setq splitted (cdr splitted))) | 69 | (setq splitted (cdr splitted))) |
| @@ -86,7 +87,12 @@ | |||
| 86 | (lambda (&optional arg) (save-excursion (end-of-line arg) (point))))) | 87 | (lambda (&optional arg) (save-excursion (end-of-line arg) (point))))) |
| 87 | 88 | ||
| 88 | (defun flymake-popup-menu (pos menu-data) | 89 | (defun flymake-popup-menu (pos menu-data) |
| 89 | (if (and (fboundp 'popup-menu) (fboundp 'make-event)) | 90 | "Pop up the flymake menu at position POS, using the data MENU-DATA. |
| 91 | POS is a list of the form ((X Y) WINDOW), where X and Y are | ||
| 92 | pixels positions from the top left corner of WINDOW's frame. | ||
| 93 | MENU-DATA is a list of error and warning messages returned by | ||
| 94 | `flymake-make-err-menu-data'." | ||
| 95 | (if (featurep 'xemacs) | ||
| 90 | (let* ((x-pos (nth 0 (nth 0 pos))) | 96 | (let* ((x-pos (nth 0 (nth 0 pos))) |
| 91 | (y-pos (nth 1 (nth 0 pos))) | 97 | (y-pos (nth 1 (nth 0 pos))) |
| 92 | (fake-event-props '(button 1 x 1 y 1))) | 98 | (fake-event-props '(button 1 x 1 y 1))) |
| @@ -96,6 +102,10 @@ | |||
| 96 | (x-popup-menu pos (flymake-make-emacs-menu menu-data)))) | 102 | (x-popup-menu pos (flymake-make-emacs-menu menu-data)))) |
| 97 | 103 | ||
| 98 | (defun flymake-make-emacs-menu (menu-data) | 104 | (defun flymake-make-emacs-menu (menu-data) |
| 105 | "Return a menu specifier using MENU-DATA. | ||
| 106 | MENU-DATA is a list of error and warning messages returned by | ||
| 107 | `flymake-make-err-menu-data'. | ||
| 108 | See `x-popup-menu' for the menu specifier format." | ||
| 99 | (let* ((menu-title (nth 0 menu-data)) | 109 | (let* ((menu-title (nth 0 menu-data)) |
| 100 | (menu-items (nth 1 menu-data)) | 110 | (menu-items (nth 1 menu-data)) |
| 101 | (menu-commands nil)) | 111 | (menu-commands nil)) |
| @@ -109,6 +119,7 @@ | |||
| 109 | (defun flymake-nop ()) | 119 | (defun flymake-nop ()) |
| 110 | 120 | ||
| 111 | (defun flymake-make-xemacs-menu (menu-data) | 121 | (defun flymake-make-xemacs-menu (menu-data) |
| 122 | "Return a menu specifier using MENU-DATA." | ||
| 112 | (let* ((menu-title (nth 0 menu-data)) | 123 | (let* ((menu-title (nth 0 menu-data)) |
| 113 | (menu-items (nth 1 menu-data)) | 124 | (menu-items (nth 1 menu-data)) |
| 114 | (menu-commands nil)) | 125 | (menu-commands nil)) |
| @@ -152,7 +163,11 @@ | |||
| 152 | :type 'integer) | 163 | :type 'integer) |
| 153 | 164 | ||
| 154 | (defun flymake-log (level text &rest args) | 165 | (defun flymake-log (level text &rest args) |
| 155 | "Log a message with optional arguments." | 166 | "Log a message at level LEVEL. |
| 167 | If LEVEL is higher than `flymake-log-level', the message is | ||
| 168 | ignored. Otherwise, it is printed using `message'. | ||
| 169 | TEXT is a format control string, and the remaining arguments ARGS | ||
| 170 | are the string substitutions (see `format')." | ||
| 156 | (if (<= level flymake-log-level) | 171 | (if (<= level flymake-log-level) |
| 157 | (let* ((msg (apply 'format text args))) | 172 | (let* ((msg (apply 'format text args))) |
| 158 | (message msg) | 173 | (message msg) |
| @@ -176,69 +191,37 @@ | |||
| 176 | tmp)) | 191 | tmp)) |
| 177 | 192 | ||
| 178 | (defvar flymake-pid-to-names (flymake-makehash) | 193 | (defvar flymake-pid-to-names (flymake-makehash) |
| 179 | "pid -> source buffer name, output file name mapping.") | 194 | "Hash table mapping PIDs to source buffer names and output files.") |
| 180 | 195 | ||
| 181 | (defun flymake-reg-names (pid source-buffer-name) | 196 | (defun flymake-reg-names (pid source-buffer-name) |
| 182 | "Save into in PID map." | 197 | "Associate PID with SOURCE-BUFFER-NAME in `flymake-pid-to-names'." |
| 183 | (unless (stringp source-buffer-name) | 198 | (unless (stringp source-buffer-name) |
| 184 | (error "Invalid buffer name")) | 199 | (error "Invalid buffer name")) |
| 185 | (puthash pid (list source-buffer-name) flymake-pid-to-names)) | 200 | (puthash pid (list source-buffer-name) flymake-pid-to-names)) |
| 186 | 201 | ||
| 187 | (defun flymake-get-source-buffer-name (pid) | 202 | (defun flymake-get-source-buffer-name (pid) |
| 188 | "Return buffer name stored in PID map." | 203 | "Return buffer name associated with PID in `flymake-pid-to-names'." |
| 189 | (nth 0 (gethash pid flymake-pid-to-names))) | 204 | (nth 0 (gethash pid flymake-pid-to-names))) |
| 190 | 205 | ||
| 191 | (defun flymake-unreg-names (pid) | 206 | (defun flymake-unreg-names (pid) |
| 192 | "Delete PID->buffer name mapping." | 207 | "Remove the entry associated with PID from `flymake-pid-to-names'." |
| 193 | (remhash pid flymake-pid-to-names)) | 208 | (remhash pid flymake-pid-to-names)) |
| 194 | 209 | ||
| 195 | (defun flymake-get-buffer-var (buffer var-name) | ||
| 196 | "Switch to BUFFER if necessary and return local variable VAR-NAME." | ||
| 197 | (unless (bufferp buffer) | ||
| 198 | (error "Invalid buffer")) | ||
| 199 | |||
| 200 | (if (eq buffer (current-buffer)) | ||
| 201 | (symbol-value var-name) | ||
| 202 | (with-current-buffer buffer | ||
| 203 | (symbol-value var-name)))) | ||
| 204 | |||
| 205 | (defun flymake-set-buffer-var (buffer var-name var-value) | ||
| 206 | "Switch to BUFFER if necessary and set local variable VAR-NAME to VAR-VALUE." | ||
| 207 | (unless (bufferp buffer) | ||
| 208 | (error "Invalid buffer")) | ||
| 209 | |||
| 210 | (if (eq buffer (current-buffer)) | ||
| 211 | (set var-name var-value) | ||
| 212 | (with-current-buffer buffer | ||
| 213 | (set var-name var-value)))) | ||
| 214 | |||
| 215 | (defvar flymake-buffer-data (flymake-makehash) | 210 | (defvar flymake-buffer-data (flymake-makehash) |
| 216 | "Data specific to syntax check tool, in name-value pairs.") | 211 | "Data specific to syntax check tool, in name-value pairs.") |
| 217 | 212 | ||
| 218 | (make-variable-buffer-local 'flymake-buffer-data) | 213 | (make-variable-buffer-local 'flymake-buffer-data) |
| 219 | 214 | ||
| 220 | (defun flymake-get-buffer-data (buffer) | ||
| 221 | (flymake-get-buffer-var buffer 'flymake-buffer-data)) | ||
| 222 | |||
| 223 | (defun flymake-set-buffer-data (buffer data) | ||
| 224 | (flymake-set-buffer-var buffer 'flymake-buffer-data data)) | ||
| 225 | |||
| 226 | (defun flymake-get-buffer-value (buffer name) | 215 | (defun flymake-get-buffer-value (buffer name) |
| 227 | (gethash name (flymake-get-buffer-data buffer))) | 216 | (gethash name (with-current-buffer buffer flymake-buffer-data))) |
| 228 | 217 | ||
| 229 | (defun flymake-set-buffer-value (buffer name value) | 218 | (defun flymake-set-buffer-value (buffer name value) |
| 230 | (puthash name value (flymake-get-buffer-data buffer))) | 219 | (puthash name value (with-current-buffer buffer flymake-buffer-data))) |
| 231 | 220 | ||
| 232 | (defvar flymake-output-residual nil) | 221 | (defvar flymake-output-residual nil) |
| 233 | 222 | ||
| 234 | (make-variable-buffer-local 'flymake-output-residual) | 223 | (make-variable-buffer-local 'flymake-output-residual) |
| 235 | 224 | ||
| 236 | (defun flymake-get-buffer-output-residual (buffer) | ||
| 237 | (flymake-get-buffer-var buffer 'flymake-output-residual)) | ||
| 238 | |||
| 239 | (defun flymake-set-buffer-output-residual (buffer residual) | ||
| 240 | (flymake-set-buffer-var buffer 'flymake-output-residual residual)) | ||
| 241 | |||
| 242 | (defcustom flymake-allowed-file-name-masks | 225 | (defcustom flymake-allowed-file-name-masks |
| 243 | '((".+\\.c$" flymake-simple-make-init flymake-simple-cleanup flymake-get-real-file-name) | 226 | '((".+\\.c$" flymake-simple-make-init flymake-simple-cleanup flymake-get-real-file-name) |
| 244 | (".+\\.cpp$" flymake-simple-make-init flymake-simple-cleanup flymake-get-real-file-name) | 227 | (".+\\.cpp$" flymake-simple-make-init flymake-simple-cleanup flymake-get-real-file-name) |
| @@ -642,35 +625,38 @@ It's flymake process filter." | |||
| 642 | 625 | ||
| 643 | (flymake-parse-residual source-buffer) | 626 | (flymake-parse-residual source-buffer) |
| 644 | (flymake-post-syntax-check source-buffer exit-status command) | 627 | (flymake-post-syntax-check source-buffer exit-status command) |
| 645 | (flymake-set-buffer-is-running source-buffer nil)))) | 628 | (setq flymake-is-running nil)))) |
| 646 | (error | 629 | (error |
| 647 | (let ((err-str (format "Error in process sentinel for buffer %s: %s" | 630 | (let ((err-str (format "Error in process sentinel for buffer %s: %s" |
| 648 | source-buffer (error-message-string err)))) | 631 | source-buffer (error-message-string err)))) |
| 649 | (flymake-log 0 err-str) | 632 | (flymake-log 0 err-str) |
| 650 | (flymake-set-buffer-is-running source-buffer nil))))))) | 633 | (with-current-buffer source-buffer |
| 634 | (setq flymake-is-running nil)))))))) | ||
| 651 | 635 | ||
| 652 | (defun flymake-post-syntax-check (source-buffer exit-status command) | 636 | (defun flymake-post-syntax-check (source-buffer exit-status command) |
| 653 | (flymake-set-buffer-err-info source-buffer (flymake-get-buffer-new-err-info source-buffer)) | 637 | (with-current-buffer source-buffer |
| 654 | (flymake-set-buffer-new-err-info source-buffer nil) | 638 | (setq flymake-err-info flymake-new-err-info) |
| 655 | 639 | (setq flymake-new-err-info nil) | |
| 656 | (flymake-set-buffer-err-info source-buffer (flymake-fix-line-numbers | 640 | (setq flymake-err-info |
| 657 | (flymake-get-buffer-err-info source-buffer) | 641 | (flymake-fix-line-numbers |
| 658 | 1 | 642 | flymake-err-info 1 (flymake-count-lines source-buffer)))) |
| 659 | (flymake-count-lines source-buffer))) | ||
| 660 | (flymake-delete-own-overlays source-buffer) | 643 | (flymake-delete-own-overlays source-buffer) |
| 661 | (flymake-highlight-err-lines source-buffer (flymake-get-buffer-err-info source-buffer)) | 644 | (flymake-highlight-err-lines |
| 662 | 645 | source-buffer (with-current-buffer source-buffer flymake-err-info)) | |
| 663 | (let ((err-count (flymake-get-err-count (flymake-get-buffer-err-info source-buffer) "e")) | 646 | (let (err-count warn-count) |
| 664 | (warn-count (flymake-get-err-count (flymake-get-buffer-err-info source-buffer) "w"))) | 647 | (with-current-buffer source-buffer |
| 665 | 648 | (setq err-count (flymake-get-err-count flymake-err-info "e")) | |
| 666 | (flymake-log 2 "%s: %d error(s), %d warning(s) in %.2f second(s)" | 649 | (setq warn-count (flymake-get-err-count flymake-err-info "w")) |
| 650 | (flymake-log 2 "%s: %d error(s), %d warning(s) in %.2f second(s)" | ||
| 667 | (buffer-name source-buffer) err-count warn-count | 651 | (buffer-name source-buffer) err-count warn-count |
| 668 | (- (flymake-float-time) (flymake-get-buffer-check-start-time source-buffer))) | 652 | (- (flymake-float-time) flymake-check-start-time)) |
| 669 | (flymake-set-buffer-check-start-time source-buffer nil) | 653 | (setq flymake-check-start-time nil)) |
| 654 | |||
| 670 | (if (and (equal 0 err-count) (equal 0 warn-count)) | 655 | (if (and (equal 0 err-count) (equal 0 warn-count)) |
| 671 | (if (equal 0 exit-status) | 656 | (if (equal 0 exit-status) |
| 672 | (flymake-report-status source-buffer "" "") ; PASSED | 657 | (flymake-report-status source-buffer "" "") ; PASSED |
| 673 | (if (not (flymake-get-buffer-check-was-interrupted source-buffer)) | 658 | (if (not (with-current-buffer source-buffer |
| 659 | flymake-check-was-interrupted)) | ||
| 674 | (flymake-report-fatal-status (current-buffer) "CFGERR" | 660 | (flymake-report-fatal-status (current-buffer) "CFGERR" |
| 675 | (format "Configuration error has occured while running %s" command)) | 661 | (format "Configuration error has occured while running %s" command)) |
| 676 | (flymake-report-status source-buffer nil ""))) ; "STOPPED" | 662 | (flymake-report-status source-buffer nil ""))) ; "STOPPED" |
| @@ -679,38 +665,34 @@ It's flymake process filter." | |||
| 679 | (defun flymake-parse-output-and-residual (source-buffer output) | 665 | (defun flymake-parse-output-and-residual (source-buffer output) |
| 680 | "Split OUTPUT into lines, merge in residual if necessary." | 666 | "Split OUTPUT into lines, merge in residual if necessary." |
| 681 | (with-current-buffer source-buffer | 667 | (with-current-buffer source-buffer |
| 682 | (let* ((buffer-residual (flymake-get-buffer-output-residual source-buffer)) | 668 | (let* ((buffer-residual flymake-output-residual) |
| 683 | (total-output (if buffer-residual (concat buffer-residual output) output)) | 669 | (total-output (if buffer-residual (concat buffer-residual output) output)) |
| 684 | (lines-and-residual (flymake-split-output total-output)) | 670 | (lines-and-residual (flymake-split-output total-output)) |
| 685 | (lines (nth 0 lines-and-residual)) | 671 | (lines (nth 0 lines-and-residual)) |
| 686 | (new-residual (nth 1 lines-and-residual))) | 672 | (new-residual (nth 1 lines-and-residual))) |
| 687 | 673 | (with-current-buffer source-buffer | |
| 688 | (flymake-set-buffer-output-residual source-buffer new-residual) | 674 | (setq flymake-output-residual new-residual) |
| 689 | (flymake-set-buffer-new-err-info source-buffer (flymake-parse-err-lines | 675 | (setq flymake-new-err-info |
| 690 | (flymake-get-buffer-new-err-info source-buffer) | 676 | (flymake-parse-err-lines |
| 691 | source-buffer lines))))) | 677 | flymake-new-err-info |
| 678 | source-buffer lines)))))) | ||
| 692 | 679 | ||
| 693 | (defun flymake-parse-residual (source-buffer) | 680 | (defun flymake-parse-residual (source-buffer) |
| 694 | "Parse residual if it's non empty." | 681 | "Parse residual if it's non empty." |
| 695 | (with-current-buffer source-buffer | 682 | (with-current-buffer source-buffer |
| 696 | (when (flymake-get-buffer-output-residual source-buffer) | 683 | (when flymake-output-residual |
| 697 | (flymake-set-buffer-new-err-info source-buffer (flymake-parse-err-lines | 684 | (setq flymake-new-err-info |
| 698 | (flymake-get-buffer-new-err-info source-buffer) | 685 | (flymake-parse-err-lines |
| 699 | source-buffer | 686 | flymake-new-err-info |
| 700 | (list (flymake-get-buffer-output-residual source-buffer)))) | 687 | source-buffer |
| 701 | (flymake-set-buffer-output-residual source-buffer nil)))) | 688 | (list flymake-output-residual))) |
| 689 | (setq flymake-output-residual nil)))) | ||
| 702 | 690 | ||
| 703 | (defvar flymake-err-info nil | 691 | (defvar flymake-err-info nil |
| 704 | "Sorted list of line numbers and lists of err info in the form (file, err-text).") | 692 | "Sorted list of line numbers and lists of err info in the form (file, err-text).") |
| 705 | 693 | ||
| 706 | (make-variable-buffer-local 'flymake-err-info) | 694 | (make-variable-buffer-local 'flymake-err-info) |
| 707 | 695 | ||
| 708 | (defun flymake-get-buffer-err-info (buffer) | ||
| 709 | (flymake-get-buffer-var buffer 'flymake-err-info)) | ||
| 710 | |||
| 711 | (defun flymake-set-buffer-err-info (buffer err-info) | ||
| 712 | (flymake-set-buffer-var buffer 'flymake-err-info err-info)) | ||
| 713 | |||
| 714 | (defun flymake-er-make-er (line-no line-err-info-list) | 696 | (defun flymake-er-make-er (line-no line-err-info-list) |
| 715 | (list line-no line-err-info-list)) | 697 | (list line-no line-err-info-list)) |
| 716 | 698 | ||
| @@ -725,12 +707,6 @@ It's flymake process filter." | |||
| 725 | 707 | ||
| 726 | (make-variable-buffer-local 'flymake-new-err-info) | 708 | (make-variable-buffer-local 'flymake-new-err-info) |
| 727 | 709 | ||
| 728 | (defun flymake-get-buffer-new-err-info (buffer) | ||
| 729 | (flymake-get-buffer-var buffer 'flymake-new-err-info)) | ||
| 730 | |||
| 731 | (defun flymake-set-buffer-new-err-info (buffer new-err-info) | ||
| 732 | (flymake-set-buffer-var buffer 'flymake-new-err-info new-err-info)) | ||
| 733 | |||
| 734 | ;; getters/setters for line-err-info: (file, line, type, text). | 710 | ;; getters/setters for line-err-info: (file, line, type, text). |
| 735 | (defun flymake-ler-make-ler (file line type text &optional full-file) | 711 | (defun flymake-ler-make-ler (file line type text &optional full-file) |
| 736 | (list file line type text full-file)) | 712 | (list file line type text full-file)) |
| @@ -1067,7 +1043,11 @@ Return its components if so, nil if no." | |||
| 1067 | (and (not (flymake-ler-get-file line-one)) (not (flymake-ler-get-file line-two))))))) | 1043 | (and (not (flymake-ler-get-file line-one)) (not (flymake-ler-get-file line-two))))))) |
| 1068 | 1044 | ||
| 1069 | (defun flymake-add-line-err-info (line-err-info-list line-err-info) | 1045 | (defun flymake-add-line-err-info (line-err-info-list line-err-info) |
| 1070 | "Insert new err info favoring sorting: err-type e/w, filename nil/non-nil." | 1046 | "Update LINE-ERR-INFO-LIST with the error LINE-ERR-INFO. |
| 1047 | For the format of LINE-ERR-INFO, see `flymake-ler-make-ler'. | ||
| 1048 | The new element is inserted in the proper position, according to | ||
| 1049 | the predicate `flymake-line-err-info-is-less-or-equal'. | ||
| 1050 | The updated value of LINE-ERR-INFO-LIST is returned." | ||
| 1071 | (if (not line-err-info-list) | 1051 | (if (not line-err-info-list) |
| 1072 | (list line-err-info) | 1052 | (list line-err-info) |
| 1073 | (let* ((count (length line-err-info-list)) | 1053 | (let* ((count (length line-err-info-list)) |
| @@ -1079,7 +1059,10 @@ Return its components if so, nil if no." | |||
| 1079 | line-err-info-list))) | 1059 | line-err-info-list))) |
| 1080 | 1060 | ||
| 1081 | (defun flymake-add-err-info (err-info-list line-err-info) | 1061 | (defun flymake-add-err-info (err-info-list line-err-info) |
| 1082 | "Add error info (file line type text) to err info list preserving sort order." | 1062 | "Update ERR-INFO-LIST with the error LINE-ERR-INFO, preserving sort order. |
| 1063 | Returns the updated value of ERR-INFO-LIST. | ||
| 1064 | For the format of ERR-INFO-LIST, see `flymake-err-info'. | ||
| 1065 | For the format of LINE-ERR-INFO, see `flymake-ler-make-ler'." | ||
| 1083 | (let* ((line-no (if (flymake-ler-get-file line-err-info) 1 (flymake-ler-get-line line-err-info))) | 1066 | (let* ((line-no (if (flymake-ler-get-file line-err-info) 1 (flymake-ler-get-line line-err-info))) |
| 1084 | (info-and-pos (flymake-find-err-info err-info-list line-no)) | 1067 | (info-and-pos (flymake-find-err-info err-info-list line-no)) |
| 1085 | (exists (car info-and-pos)) | 1068 | (exists (car info-and-pos)) |
| @@ -1202,16 +1185,16 @@ Return first 'INCLUDE-DIRS/REL-FILE-NAME' that exists, or just REL-FILE-NAME if | |||
| 1202 | (unless (bufferp buffer) | 1185 | (unless (bufferp buffer) |
| 1203 | (error "Expected a buffer")) | 1186 | (error "Expected a buffer")) |
| 1204 | (with-current-buffer buffer | 1187 | (with-current-buffer buffer |
| 1205 | (flymake-log 3 "flymake is running: %s" (flymake-get-buffer-is-running buffer)) | 1188 | (flymake-log 3 "flymake is running: %s" flymake-is-running) |
| 1206 | (when (and (not (flymake-get-buffer-is-running buffer)) | 1189 | (when (and (not flymake-is-running) |
| 1207 | (flymake-can-syntax-check-file (buffer-file-name buffer))) | 1190 | (flymake-can-syntax-check-file (buffer-file-name buffer))) |
| 1208 | (when (or (not flymake-compilation-prevents-syntax-check) | 1191 | (when (or (not flymake-compilation-prevents-syntax-check) |
| 1209 | (not (flymake-compilation-is-running))) ;+ (flymake-rep-ort-status buffer "COMP") | 1192 | (not (flymake-compilation-is-running))) ;+ (flymake-rep-ort-status buffer "COMP") |
| 1210 | (flymake-clear-buildfile-cache) | 1193 | (flymake-clear-buildfile-cache) |
| 1211 | (flymake-clear-project-include-dirs-cache) | 1194 | (flymake-clear-project-include-dirs-cache) |
| 1212 | 1195 | ||
| 1213 | (flymake-set-buffer-check-was-interrupted buffer nil) | 1196 | (setq flymake-check-was-interrupted nil) |
| 1214 | (flymake-set-buffer-data buffer (flymake-makehash 'equal)) | 1197 | (setq flymake-buffer-data (flymake-makehash 'equal)) |
| 1215 | 1198 | ||
| 1216 | (let* ((source-file-name (buffer-file-name buffer)) | 1199 | (let* ((source-file-name (buffer-file-name buffer)) |
| 1217 | (init-f (flymake-get-init-function source-file-name)) | 1200 | (init-f (flymake-get-init-function source-file-name)) |
| @@ -1225,7 +1208,7 @@ Return first 'INCLUDE-DIRS/REL-FILE-NAME' that exists, or just REL-FILE-NAME if | |||
| 1225 | (flymake-log 0 "init function %s for %s failed, cleaning up" init-f source-file-name) | 1208 | (flymake-log 0 "init function %s for %s failed, cleaning up" init-f source-file-name) |
| 1226 | (funcall cleanup-f buffer)) | 1209 | (funcall cleanup-f buffer)) |
| 1227 | (progn | 1210 | (progn |
| 1228 | (flymake-set-buffer-last-change-time buffer nil) | 1211 | (setq flymake-last-change-time nil) |
| 1229 | (flymake-start-syntax-check-process buffer cmd args dir)))))))) | 1212 | (flymake-start-syntax-check-process buffer cmd args dir)))))))) |
| 1230 | 1213 | ||
| 1231 | (defun flymake-start-syntax-check-process (buffer cmd args dir) | 1214 | (defun flymake-start-syntax-check-process (buffer cmd args dir) |
| @@ -1242,9 +1225,10 @@ Return first 'INCLUDE-DIRS/REL-FILE-NAME' that exists, or just REL-FILE-NAME if | |||
| 1242 | 1225 | ||
| 1243 | (flymake-reg-names (process-id process) (buffer-name buffer)) | 1226 | (flymake-reg-names (process-id process) (buffer-name buffer)) |
| 1244 | 1227 | ||
| 1245 | (flymake-set-buffer-is-running buffer t) | 1228 | (with-current-buffer buffer |
| 1246 | (flymake-set-buffer-last-change-time buffer nil) | 1229 | (setq flymake-is-running t) |
| 1247 | (flymake-set-buffer-check-start-time buffer (flymake-float-time)) | 1230 | (setq flymake-last-change-time nil) |
| 1231 | (setq flymake-check-start-time (flymake-float-time))) | ||
| 1248 | 1232 | ||
| 1249 | (flymake-report-status buffer nil "*") | 1233 | (flymake-report-status buffer nil "*") |
| 1250 | (flymake-log 2 "started process %d, command=%s, dir=%s" | 1234 | (flymake-log 2 "started process %d, command=%s, dir=%s" |
| @@ -1264,7 +1248,8 @@ Return first 'INCLUDE-DIRS/REL-FILE-NAME' that exists, or just REL-FILE-NAME if | |||
| 1264 | (signal-process pid 9) | 1248 | (signal-process pid 9) |
| 1265 | (let* ((buffer-name (flymake-get-source-buffer-name pid))) | 1249 | (let* ((buffer-name (flymake-get-source-buffer-name pid))) |
| 1266 | (when (and buffer-name (get-buffer buffer-name)) | 1250 | (when (and buffer-name (get-buffer buffer-name)) |
| 1267 | (flymake-set-buffer-check-was-interrupted (get-buffer buffer-name) t))) | 1251 | (with-current-buffer (get-buffer buffer-name) |
| 1252 | (setq flymake-check-was-interrupted t)))) | ||
| 1268 | (flymake-log 1 "killed process %d" pid)) | 1253 | (flymake-log 1 "killed process %d" pid)) |
| 1269 | 1254 | ||
| 1270 | (defun flymake-stop-all-syntax-checks () | 1255 | (defun flymake-stop-all-syntax-checks () |
| @@ -1288,56 +1273,26 @@ Return first 'INCLUDE-DIRS/REL-FILE-NAME' that exists, or just REL-FILE-NAME if | |||
| 1288 | 1273 | ||
| 1289 | (make-variable-buffer-local 'flymake-is-running) | 1274 | (make-variable-buffer-local 'flymake-is-running) |
| 1290 | 1275 | ||
| 1291 | (defun flymake-get-buffer-is-running (buffer) | ||
| 1292 | (flymake-get-buffer-var buffer 'flymake-is-running)) | ||
| 1293 | |||
| 1294 | (defun flymake-set-buffer-is-running (buffer is-running) | ||
| 1295 | (flymake-set-buffer-var buffer 'flymake-is-running is-running)) | ||
| 1296 | |||
| 1297 | (defvar flymake-timer nil | 1276 | (defvar flymake-timer nil |
| 1298 | "Timer for starting syntax check.") | 1277 | "Timer for starting syntax check.") |
| 1299 | 1278 | ||
| 1300 | (make-variable-buffer-local 'flymake-timer) | 1279 | (make-variable-buffer-local 'flymake-timer) |
| 1301 | 1280 | ||
| 1302 | (defun flymake-get-buffer-timer (buffer) | ||
| 1303 | (flymake-get-buffer-var buffer 'flymake-timer)) | ||
| 1304 | |||
| 1305 | (defun flymake-set-buffer-timer (buffer timer) | ||
| 1306 | (flymake-set-buffer-var buffer 'flymake-timer timer)) | ||
| 1307 | |||
| 1308 | (defvar flymake-last-change-time nil | 1281 | (defvar flymake-last-change-time nil |
| 1309 | "Time of last buffer change.") | 1282 | "Time of last buffer change.") |
| 1310 | 1283 | ||
| 1311 | (make-variable-buffer-local 'flymake-last-change-time) | 1284 | (make-variable-buffer-local 'flymake-last-change-time) |
| 1312 | 1285 | ||
| 1313 | (defun flymake-get-buffer-last-change-time (buffer) | ||
| 1314 | (flymake-get-buffer-var buffer 'flymake-last-change-time)) | ||
| 1315 | |||
| 1316 | (defun flymake-set-buffer-last-change-time (buffer change-time) | ||
| 1317 | (flymake-set-buffer-var buffer 'flymake-last-change-time change-time)) | ||
| 1318 | |||
| 1319 | (defvar flymake-check-start-time nil | 1286 | (defvar flymake-check-start-time nil |
| 1320 | "Time at which syntax check was started.") | 1287 | "Time at which syntax check was started.") |
| 1321 | 1288 | ||
| 1322 | (make-variable-buffer-local 'flymake-check-start-time) | 1289 | (make-variable-buffer-local 'flymake-check-start-time) |
| 1323 | 1290 | ||
| 1324 | (defun flymake-get-buffer-check-start-time (buffer) | ||
| 1325 | (flymake-get-buffer-var buffer 'flymake-check-start-time)) | ||
| 1326 | |||
| 1327 | (defun flymake-set-buffer-check-start-time (buffer check-start-time) | ||
| 1328 | (flymake-set-buffer-var buffer 'flymake-check-start-time check-start-time)) | ||
| 1329 | |||
| 1330 | (defvar flymake-check-was-interrupted nil | 1291 | (defvar flymake-check-was-interrupted nil |
| 1331 | "Non-nil if syntax check was killed by `flymake-compile'.") | 1292 | "Non-nil if syntax check was killed by `flymake-compile'.") |
| 1332 | 1293 | ||
| 1333 | (make-variable-buffer-local 'flymake-check-was-interrupted) | 1294 | (make-variable-buffer-local 'flymake-check-was-interrupted) |
| 1334 | 1295 | ||
| 1335 | (defun flymake-get-buffer-check-was-interrupted (buffer) | ||
| 1336 | (flymake-get-buffer-var buffer 'flymake-check-was-interrupted)) | ||
| 1337 | |||
| 1338 | (defun flymake-set-buffer-check-was-interrupted (buffer interrupted) | ||
| 1339 | (flymake-set-buffer-var buffer 'flymake-check-was-interrupted interrupted)) | ||
| 1340 | |||
| 1341 | (defcustom flymake-no-changes-timeout 0.5 | 1296 | (defcustom flymake-no-changes-timeout 0.5 |
| 1342 | "Time to wait after last change before starting compilation." | 1297 | "Time to wait after last change before starting compilation." |
| 1343 | :group 'flymake | 1298 | :group 'flymake |
| @@ -1345,12 +1300,13 @@ Return first 'INCLUDE-DIRS/REL-FILE-NAME' that exists, or just REL-FILE-NAME if | |||
| 1345 | 1300 | ||
| 1346 | (defun flymake-on-timer-event (buffer) | 1301 | (defun flymake-on-timer-event (buffer) |
| 1347 | "Start a syntax check for buffer BUFFER if necessary." | 1302 | "Start a syntax check for buffer BUFFER if necessary." |
| 1348 | ;;+(flymake-log 3 "timer: running=%s, time=%s, cur-time=%s" (flymake-get-buffer-is-running buffer) (flymake-get-buffer-last-change-time buffer) (flymake-float-time)) | 1303 | (when (bufferp buffer) |
| 1349 | (when (and (bufferp buffer) (not (flymake-get-buffer-is-running buffer))) | ||
| 1350 | (with-current-buffer buffer | 1304 | (with-current-buffer buffer |
| 1351 | (when (and (flymake-get-buffer-last-change-time buffer) | 1305 | (when (and (not flymake-is-running) |
| 1352 | (> (flymake-float-time) (+ flymake-no-changes-timeout (flymake-get-buffer-last-change-time buffer)))) | 1306 | flymake-last-change-time |
| 1353 | (flymake-set-buffer-last-change-time buffer nil) | 1307 | (> (flymake-float-time) (+ flymake-no-changes-timeout flymake-last-change-time))) |
| 1308 | |||
| 1309 | (setq flymake-last-change-time nil) | ||
| 1354 | (flymake-log 3 "starting syntax check as more than 1 second passed since last change") | 1310 | (flymake-log 3 "starting syntax check as more than 1 second passed since last change") |
| 1355 | (flymake-start-syntax-check buffer))))) | 1311 | (flymake-start-syntax-check buffer))))) |
| 1356 | 1312 | ||
| @@ -1391,7 +1347,7 @@ Return first 'INCLUDE-DIRS/REL-FILE-NAME' that exists, or just REL-FILE-NAME if | |||
| 1391 | "Display a menu with errors/warnings for current line if it has errors and/or warnings." | 1347 | "Display a menu with errors/warnings for current line if it has errors and/or warnings." |
| 1392 | (interactive) | 1348 | (interactive) |
| 1393 | (let* ((line-no (flymake-current-line-no)) | 1349 | (let* ((line-no (flymake-current-line-no)) |
| 1394 | (line-err-info-list (nth 0 (flymake-find-err-info (flymake-get-buffer-err-info (current-buffer)) line-no))) | 1350 | (line-err-info-list (nth 0 (flymake-find-err-info flymake-err-info line-no))) |
| 1395 | (menu-data (flymake-make-err-menu-data line-no line-err-info-list)) | 1351 | (menu-data (flymake-make-err-menu-data line-no line-err-info-list)) |
| 1396 | (choice nil) | 1352 | (choice nil) |
| 1397 | (mouse-pos (flymake-get-point-pixel-pos)) | 1353 | (mouse-pos (flymake-get-point-pixel-pos)) |
| @@ -1442,46 +1398,27 @@ Return first 'INCLUDE-DIRS/REL-FILE-NAME' that exists, or just REL-FILE-NAME if | |||
| 1442 | 1398 | ||
| 1443 | (make-variable-buffer-local 'flymake-mode-line) | 1399 | (make-variable-buffer-local 'flymake-mode-line) |
| 1444 | 1400 | ||
| 1445 | (defun flymake-get-buffer-mode-line (buffer) | ||
| 1446 | (flymake-get-buffer-var buffer 'flymake-mode-line)) | ||
| 1447 | |||
| 1448 | (defun flymake-set-buffer-mode-line (buffer mode-line-string) | ||
| 1449 | (flymake-set-buffer-var buffer 'flymake-mode-line mode-line-string)) | ||
| 1450 | |||
| 1451 | (defvar flymake-mode-line-e-w nil) | 1401 | (defvar flymake-mode-line-e-w nil) |
| 1452 | 1402 | ||
| 1453 | (make-variable-buffer-local 'flymake-mode-line-e-w) | 1403 | (make-variable-buffer-local 'flymake-mode-line-e-w) |
| 1454 | 1404 | ||
| 1455 | (defun flymake-get-buffer-mode-line-e-w (buffer) | ||
| 1456 | (flymake-get-buffer-var buffer 'flymake-mode-line-e-w)) | ||
| 1457 | |||
| 1458 | (defun flymake-set-buffer-mode-line-e-w (buffer e-w) | ||
| 1459 | (flymake-set-buffer-var buffer 'flymake-mode-line-e-w e-w)) | ||
| 1460 | |||
| 1461 | (defvar flymake-mode-line-status nil) | 1405 | (defvar flymake-mode-line-status nil) |
| 1462 | 1406 | ||
| 1463 | (make-variable-buffer-local 'flymake-mode-line-status) | 1407 | (make-variable-buffer-local 'flymake-mode-line-status) |
| 1464 | 1408 | ||
| 1465 | (defun flymake-get-buffer-mode-line-status (buffer) | ||
| 1466 | (flymake-get-buffer-var buffer 'flymake-mode-line-status)) | ||
| 1467 | |||
| 1468 | (defun flymake-set-buffer-mode-line-status (buffer status) | ||
| 1469 | (flymake-set-buffer-var buffer 'flymake-mode-line-status status)) | ||
| 1470 | |||
| 1471 | (defun flymake-report-status (buffer e-w &optional status) | 1409 | (defun flymake-report-status (buffer e-w &optional status) |
| 1472 | "Show status in mode line." | 1410 | "Show status in mode line." |
| 1473 | (when (bufferp buffer) | 1411 | (when (bufferp buffer) |
| 1474 | (with-current-buffer buffer | 1412 | (with-current-buffer buffer |
| 1475 | (when e-w | 1413 | (when e-w |
| 1476 | (flymake-set-buffer-mode-line-e-w buffer e-w) | 1414 | (setq flymake-mode-line-e-w e-w)) |
| 1477 | ) | ||
| 1478 | (when status | 1415 | (when status |
| 1479 | (flymake-set-buffer-mode-line-status buffer status)) | 1416 | (setq flymake-mode-line-status status)) |
| 1480 | (let* ((mode-line " Flymake")) | 1417 | (let* ((mode-line " Flymake")) |
| 1481 | (when (> (length (flymake-get-buffer-mode-line-e-w buffer)) 0) | 1418 | (when (> (length flymake-mode-line-e-w) 0) |
| 1482 | (setq mode-line (concat mode-line ":" (flymake-get-buffer-mode-line-e-w buffer)))) | 1419 | (setq mode-line (concat mode-line ":" flymake-mode-line-e-w))) |
| 1483 | (setq mode-line (concat mode-line (flymake-get-buffer-mode-line-status buffer))) | 1420 | (setq mode-line (concat mode-line flymake-mode-line-status)) |
| 1484 | (flymake-set-buffer-mode-line buffer mode-line) | 1421 | (setq flymake-mode-line mode-line) |
| 1485 | (force-mode-line-update))))) | 1422 | (force-mode-line-update))))) |
| 1486 | 1423 | ||
| 1487 | (defun flymake-display-warning (warning) | 1424 | (defun flymake-display-warning (warning) |
| @@ -1532,7 +1469,8 @@ With arg, turn Flymake mode on if and only if arg is positive." | |||
| 1532 | 1469 | ||
| 1533 | (flymake-report-status (current-buffer) "" "") | 1470 | (flymake-report-status (current-buffer) "" "") |
| 1534 | 1471 | ||
| 1535 | (flymake-set-buffer-timer (current-buffer) (run-at-time nil 1 'flymake-on-timer-event (current-buffer))) | 1472 | (setq flymake-timer |
| 1473 | (run-at-time nil 1 'flymake-on-timer-event (current-buffer))) | ||
| 1536 | 1474 | ||
| 1537 | (setq flymake-mode t) | 1475 | (setq flymake-mode t) |
| 1538 | (flymake-log 1 "flymake mode turned ON for buffer %s" (buffer-name (current-buffer))) | 1476 | (flymake-log 1 "flymake mode turned ON for buffer %s" (buffer-name (current-buffer))) |
| @@ -1550,12 +1488,11 @@ With arg, turn Flymake mode on if and only if arg is positive." | |||
| 1550 | 1488 | ||
| 1551 | (flymake-delete-own-overlays (current-buffer)) | 1489 | (flymake-delete-own-overlays (current-buffer)) |
| 1552 | 1490 | ||
| 1553 | (when (flymake-get-buffer-timer (current-buffer)) | 1491 | (when flymake-timer |
| 1554 | (cancel-timer (flymake-get-buffer-timer (current-buffer))) | 1492 | (cancel-timer flymake-timer) |
| 1555 | (flymake-set-buffer-timer (current-buffer) nil)) | 1493 | (setq flymake-timer nil)) |
| 1556 | |||
| 1557 | (flymake-set-buffer-is-running (current-buffer) nil) | ||
| 1558 | 1494 | ||
| 1495 | (setq flymake-is-running nil) | ||
| 1559 | (setq flymake-mode nil) | 1496 | (setq flymake-mode nil) |
| 1560 | (flymake-log 1 "flymake mode turned OFF for buffer %s" (buffer-name (current-buffer))))) | 1497 | (flymake-log 1 "flymake mode turned OFF for buffer %s" (buffer-name (current-buffer))))) |
| 1561 | 1498 | ||
| @@ -1571,7 +1508,7 @@ With arg, turn Flymake mode on if and only if arg is positive." | |||
| 1571 | (when (and flymake-start-syntax-check-on-newline (equal new-text "\n")) | 1508 | (when (and flymake-start-syntax-check-on-newline (equal new-text "\n")) |
| 1572 | (flymake-log 3 "starting syntax check as new-line has been seen") | 1509 | (flymake-log 3 "starting syntax check as new-line has been seen") |
| 1573 | (flymake-start-syntax-check-for-current-buffer)) | 1510 | (flymake-start-syntax-check-for-current-buffer)) |
| 1574 | (flymake-set-buffer-last-change-time (current-buffer) (flymake-float-time)))) | 1511 | (setq flymake-last-change-time (flymake-float-time)))) |
| 1575 | 1512 | ||
| 1576 | (defun flymake-after-save-hook () | 1513 | (defun flymake-after-save-hook () |
| 1577 | (if (local-variable-p 'flymake-mode (current-buffer)) ; (???) other way to determine whether flymake is active in buffer being saved? | 1514 | (if (local-variable-p 'flymake-mode (current-buffer)) ; (???) other way to determine whether flymake is active in buffer being saved? |
| @@ -1580,9 +1517,9 @@ With arg, turn Flymake mode on if and only if arg is positive." | |||
| 1580 | (flymake-start-syntax-check-for-current-buffer)))) ; no more mode 3. cannot start check if mode 3 (to temp copies) is active - (???) | 1517 | (flymake-start-syntax-check-for-current-buffer)))) ; no more mode 3. cannot start check if mode 3 (to temp copies) is active - (???) |
| 1581 | 1518 | ||
| 1582 | (defun flymake-kill-buffer-hook () | 1519 | (defun flymake-kill-buffer-hook () |
| 1583 | (when (flymake-get-buffer-timer (current-buffer)) | 1520 | (when flymake-timer |
| 1584 | (cancel-timer (flymake-get-buffer-timer (current-buffer))) | 1521 | (cancel-timer flymake-timer) |
| 1585 | (flymake-set-buffer-timer (current-buffer) nil))) | 1522 | (setq flymake-timer nil))) |
| 1586 | 1523 | ||
| 1587 | (defun flymake-find-file-hook () | 1524 | (defun flymake-find-file-hook () |
| 1588 | ;;+(when flymake-start-syntax-check-on-find-file | 1525 | ;;+(when flymake-start-syntax-check-on-find-file |
| @@ -1636,9 +1573,9 @@ With arg, turn Flymake mode on if and only if arg is positive." | |||
| 1636 | (defun flymake-goto-next-error () | 1573 | (defun flymake-goto-next-error () |
| 1637 | "Go to next error in err ring." | 1574 | "Go to next error in err ring." |
| 1638 | (interactive) | 1575 | (interactive) |
| 1639 | (let ((line-no (flymake-get-next-err-line-no (flymake-get-buffer-err-info (current-buffer)) (flymake-current-line-no)))) | 1576 | (let ((line-no (flymake-get-next-err-line-no flymake-err-info (flymake-current-line-no)))) |
| 1640 | (when (not line-no) | 1577 | (when (not line-no) |
| 1641 | (setq line-no (flymake-get-first-err-line-no (flymake-get-buffer-err-info (current-buffer)))) | 1578 | (setq line-no (flymake-get-first-err-line-no flymake-err-info)) |
| 1642 | (flymake-log 1 "passed end of file")) | 1579 | (flymake-log 1 "passed end of file")) |
| 1643 | (if line-no | 1580 | (if line-no |
| 1644 | (flymake-goto-line line-no) | 1581 | (flymake-goto-line line-no) |
| @@ -1647,9 +1584,9 @@ With arg, turn Flymake mode on if and only if arg is positive." | |||
| 1647 | (defun flymake-goto-prev-error () | 1584 | (defun flymake-goto-prev-error () |
| 1648 | "Go to prev error in err ring." | 1585 | "Go to prev error in err ring." |
| 1649 | (interactive) | 1586 | (interactive) |
| 1650 | (let ((line-no (flymake-get-prev-err-line-no (flymake-get-buffer-err-info (current-buffer)) (flymake-current-line-no)))) | 1587 | (let ((line-no (flymake-get-prev-err-line-no flymake-err-info (flymake-current-line-no)))) |
| 1651 | (when (not line-no) | 1588 | (when (not line-no) |
| 1652 | (setq line-no (flymake-get-last-err-line-no (flymake-get-buffer-err-info (current-buffer)))) | 1589 | (setq line-no (flymake-get-last-err-line-no flymake-err-info)) |
| 1653 | (flymake-log 1 "passed beginning of file")) | 1590 | (flymake-log 1 "passed beginning of file")) |
| 1654 | (if line-no | 1591 | (if line-no |
| 1655 | (flymake-goto-line line-no) | 1592 | (flymake-goto-line line-no) |
| @@ -1721,7 +1658,8 @@ With arg, turn Flymake mode on if and only if arg is positive." | |||
| 1721 | Delete temp file." | 1658 | Delete temp file." |
| 1722 | (let* ((temp-source-file-name (flymake-get-buffer-value buffer "temp-source-file-name"))) | 1659 | (let* ((temp-source-file-name (flymake-get-buffer-value buffer "temp-source-file-name"))) |
| 1723 | (flymake-safe-delete-file temp-source-file-name) | 1660 | (flymake-safe-delete-file temp-source-file-name) |
| 1724 | (flymake-set-buffer-last-change-time buffer nil))) | 1661 | (with-current-buffer buffer |
| 1662 | (setq flymake-last-change-time nil)))) | ||
| 1725 | 1663 | ||
| 1726 | (defun flymake-get-real-file-name (buffer file-name-from-err-msg) | 1664 | (defun flymake-get-real-file-name (buffer file-name-from-err-msg) |
| 1727 | "Translate file name from error message to \"real\" file name. | 1665 | "Translate file name from error message to \"real\" file name. |
diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el index 95920ff9f02..56344a67e5c 100644 --- a/lisp/progmodes/gdb-ui.el +++ b/lisp/progmodes/gdb-ui.el | |||
| @@ -79,8 +79,11 @@ | |||
| 79 | (defvar gdb-overlay-arrow-position nil) | 79 | (defvar gdb-overlay-arrow-position nil) |
| 80 | (defvar gdb-server-prefix nil) | 80 | (defvar gdb-server-prefix nil) |
| 81 | (defvar gdb-flush-pending-output nil) | 81 | (defvar gdb-flush-pending-output nil) |
| 82 | (defvar gdb-location-list nil "Alist of breakpoint numbers and full filenames.") | 82 | (defvar gdb-location-alist nil |
| 83 | "Alist of breakpoint numbers and full filenames.") | ||
| 83 | (defvar gdb-find-file-unhook nil) | 84 | (defvar gdb-find-file-unhook nil) |
| 85 | (defvar gdb-active-process nil "GUD tooltips display variable values when t, \ | ||
| 86 | and #define directives otherwise.") | ||
| 84 | 87 | ||
| 85 | (defvar gdb-buffer-type nil | 88 | (defvar gdb-buffer-type nil |
| 86 | "One of the symbols bound in `gdb-buffer-rules'.") | 89 | "One of the symbols bound in `gdb-buffer-rules'.") |
| @@ -193,6 +196,43 @@ detailed description of this mode. | |||
| 193 | :group 'gud | 196 | :group 'gud |
| 194 | :version "22.1") | 197 | :version "22.1") |
| 195 | 198 | ||
| 199 | (defcustom gdb-cpp-define-alist-program | ||
| 200 | (cond ((eq system-type 'ms-dos) "gcc -E -dM -o - -") | ||
| 201 | (t "gcc -E -dM -")) | ||
| 202 | "The program name for generating an alist of #define directives. | ||
| 203 | This list is used to display the #define directive associated | ||
| 204 | with an identifier as a tooltip. It works in a debug session with | ||
| 205 | GDB, when tooltip-gud-tips-p is t." | ||
| 206 | :type 'string | ||
| 207 | :group 'gud | ||
| 208 | :version "22.1") | ||
| 209 | |||
| 210 | (defcustom gdb-cpp-define-alist-flags "" | ||
| 211 | "*Preprocessor flags used by `gdb-create-define-alist'." | ||
| 212 | :type 'string | ||
| 213 | :group 'gud | ||
| 214 | :version "22.1") | ||
| 215 | |||
| 216 | (defvar gdb-define-alist nil "Alist of #define directives for GUD tooltips.") | ||
| 217 | |||
| 218 | (defun gdb-create-define-alist () | ||
| 219 | "Create an alist of #define directives for GUD tooltips." | ||
| 220 | (let* ((file (buffer-file-name)) | ||
| 221 | (output | ||
| 222 | (with-output-to-string | ||
| 223 | (with-current-buffer standard-output | ||
| 224 | (call-process shell-file-name | ||
| 225 | (if (file-exists-p file) file nil) | ||
| 226 | (list t nil) nil "-c" | ||
| 227 | (concat gdb-cpp-define-alist-program " " | ||
| 228 | gdb-cpp-define-alist-flags))))) | ||
| 229 | (define-list (split-string output "\n" t)) | ||
| 230 | (name)) | ||
| 231 | (setq gdb-define-alist nil) | ||
| 232 | (dolist (define define-list) | ||
| 233 | (setq name (nth 1 (split-string define "[( ]"))) | ||
| 234 | (push (cons name define) gdb-define-alist)))) | ||
| 235 | |||
| 196 | (defun gdb-set-gud-minor-mode (buffer) | 236 | (defun gdb-set-gud-minor-mode (buffer) |
| 197 | "Set gud-minor-mode from find-file if appropriate." | 237 | "Set gud-minor-mode from find-file if appropriate." |
| 198 | (goto-char (point-min)) | 238 | (goto-char (point-min)) |
| @@ -205,13 +245,16 @@ detailed description of this mode. | |||
| 205 | 245 | ||
| 206 | (defun gdb-set-gud-minor-mode-1 (buffer) | 246 | (defun gdb-set-gud-minor-mode-1 (buffer) |
| 207 | (goto-char (point-min)) | 247 | (goto-char (point-min)) |
| 208 | (if (and (search-forward "Located in " nil t) | 248 | (when (and (search-forward "Located in " nil t) |
| 209 | (looking-at "\\S-*") | 249 | (looking-at "\\S-*") |
| 210 | (string-equal (buffer-file-name buffer) | 250 | (string-equal (buffer-file-name buffer) |
| 211 | (match-string 0))) | 251 | (match-string 0))) |
| 212 | (with-current-buffer buffer | 252 | (with-current-buffer buffer |
| 213 | (set (make-local-variable 'gud-minor-mode) 'gdba) | 253 | (set (make-local-variable 'gud-minor-mode) 'gdba) |
| 214 | (set (make-local-variable 'tool-bar-map) gud-tool-bar-map)))) | 254 | (set (make-local-variable 'tool-bar-map) gud-tool-bar-map) |
| 255 | (make-local-variable 'gdb-define-alist) | ||
| 256 | (gdb-create-define-alist) | ||
| 257 | (add-hook 'after-save-hook 'gdb-create-define-alist nil t)))) | ||
| 215 | 258 | ||
| 216 | (defun gdb-set-gud-minor-mode-existing-buffers () | 259 | (defun gdb-set-gud-minor-mode-existing-buffers () |
| 217 | (dolist (buffer (buffer-list)) | 260 | (dolist (buffer (buffer-list)) |
| @@ -281,7 +324,7 @@ detailed description of this mode. | |||
| 281 | (setq gdb-output-sink 'user) | 324 | (setq gdb-output-sink 'user) |
| 282 | (setq gdb-server-prefix "server ") | 325 | (setq gdb-server-prefix "server ") |
| 283 | (setq gdb-flush-pending-output nil) | 326 | (setq gdb-flush-pending-output nil) |
| 284 | (setq gdb-location-list nil) | 327 | (setq gdb-location-alist nil) |
| 285 | (setq gdb-find-file-unhook nil) | 328 | (setq gdb-find-file-unhook nil) |
| 286 | ;; | 329 | ;; |
| 287 | (setq gdb-buffer-type 'gdba) | 330 | (setq gdb-buffer-type 'gdba) |
| @@ -301,7 +344,7 @@ detailed description of this mode. | |||
| 301 | (run-hooks 'gdba-mode-hook)) | 344 | (run-hooks 'gdba-mode-hook)) |
| 302 | 345 | ||
| 303 | (defcustom gdb-use-colon-colon-notation nil | 346 | (defcustom gdb-use-colon-colon-notation nil |
| 304 | "If non-nil use FUN::VAR format to display variables in the speedbar." ; | 347 | "If non-nil use FUN::VAR format to display variables in the speedbar." |
| 305 | :type 'boolean | 348 | :type 'boolean |
| 306 | :group 'gud | 349 | :group 'gud |
| 307 | :version "22.1") | 350 | :version "22.1") |
| @@ -430,7 +473,8 @@ detailed description of this mode. | |||
| 430 | (let ((varnum (match-string 1))) | 473 | (let ((varnum (match-string 1))) |
| 431 | (gdb-enqueue-input | 474 | (gdb-enqueue-input |
| 432 | (list | 475 | (list |
| 433 | (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)) | 476 | (if (with-current-buffer gud-comint-buffer |
| 477 | (eq gud-minor-mode 'gdba)) | ||
| 434 | (concat "server interpreter mi \"-var-evaluate-expression " | 478 | (concat "server interpreter mi \"-var-evaluate-expression " |
| 435 | varnum "\"\n") | 479 | varnum "\"\n") |
| 436 | (concat "-var-evaluate-expression " varnum "\n")) | 480 | (concat "-var-evaluate-expression " varnum "\n")) |
| @@ -482,7 +526,8 @@ detailed description of this mode. | |||
| 482 | (list | 526 | (list |
| 483 | (if (with-current-buffer gud-comint-buffer | 527 | (if (with-current-buffer gud-comint-buffer |
| 484 | (eq gud-minor-mode 'gdba)) | 528 | (eq gud-minor-mode 'gdba)) |
| 485 | (concat "server interpreter mi \"-var-assign " varnum " " value "\"\n") | 529 | (concat "server interpreter mi \"-var-assign " |
| 530 | varnum " " value "\"\n") | ||
| 486 | (concat "-var-assign " varnum " " value "\n")) | 531 | (concat "-var-assign " varnum " " value "\n")) |
| 487 | 'ignore)))) | 532 | 'ignore)))) |
| 488 | 533 | ||
| @@ -773,8 +818,8 @@ This filter may simply queue input for a later time." | |||
| 773 | ("post-prompt" gdb-post-prompt) | 818 | ("post-prompt" gdb-post-prompt) |
| 774 | ("source" gdb-source) | 819 | ("source" gdb-source) |
| 775 | ("starting" gdb-starting) | 820 | ("starting" gdb-starting) |
| 776 | ("exited" gdb-stopping) | 821 | ("exited" gdb-exited) |
| 777 | ("signalled" gdb-stopping) | 822 | ("signalled" gdb-exited) |
| 778 | ("signal" gdb-stopping) | 823 | ("signal" gdb-stopping) |
| 779 | ("breakpoint" gdb-stopping) | 824 | ("breakpoint" gdb-stopping) |
| 780 | ("watchpoint" gdb-stopping) | 825 | ("watchpoint" gdb-stopping) |
| @@ -800,7 +845,7 @@ This filter may simply queue input for a later time." | |||
| 800 | (setq gud-last-frame | 845 | (setq gud-last-frame |
| 801 | (cons | 846 | (cons |
| 802 | (match-string 1 args) | 847 | (match-string 1 args) |
| 803 | (string-to-int (match-string 2 args)))) | 848 | (string-to-number (match-string 2 args)))) |
| 804 | (setq gdb-current-address (match-string 3 args)) | 849 | (setq gdb-current-address (match-string 3 args)) |
| 805 | ;; cover for auto-display output which comes *before* | 850 | ;; cover for auto-display output which comes *before* |
| 806 | ;; stopped annotation | 851 | ;; stopped annotation |
| @@ -850,6 +895,7 @@ This sends the next command (if any) to gdb." | |||
| 850 | "An annotation handler for `starting'. | 895 | "An annotation handler for `starting'. |
| 851 | This says that I/O for the subprocess is now the program being debugged, | 896 | This says that I/O for the subprocess is now the program being debugged, |
| 852 | not GDB." | 897 | not GDB." |
| 898 | (setq gdb-active-process t) | ||
| 853 | (let ((sink gdb-output-sink)) | 899 | (let ((sink gdb-output-sink)) |
| 854 | (cond | 900 | (cond |
| 855 | ((eq sink 'user) | 901 | ((eq sink 'user) |
| @@ -862,7 +908,7 @@ not GDB." | |||
| 862 | (error "Unexpected `starting' annotation"))))) | 908 | (error "Unexpected `starting' annotation"))))) |
| 863 | 909 | ||
| 864 | (defun gdb-stopping (ignored) | 910 | (defun gdb-stopping (ignored) |
| 865 | "An annotation handler for `exited' and other annotations. | 911 | "An annotation handler for `breakpoint' and other annotations. |
| 866 | They say that I/O for the subprocess is now GDB, not the program | 912 | They say that I/O for the subprocess is now GDB, not the program |
| 867 | being debugged." | 913 | being debugged." |
| 868 | (if gdb-use-inferior-io-buffer | 914 | (if gdb-use-inferior-io-buffer |
| @@ -874,6 +920,15 @@ being debugged." | |||
| 874 | (gdb-resync) | 920 | (gdb-resync) |
| 875 | (error "Unexpected stopping annotation")))))) | 921 | (error "Unexpected stopping annotation")))))) |
| 876 | 922 | ||
| 923 | (defun gdb-exited (ignored) | ||
| 924 | "An annotation handler for `exited' and `signalled'. | ||
| 925 | They say that I/O for the subprocess is now GDB, not the program | ||
| 926 | being debugged and that the program is no longer running. This | ||
| 927 | function is used to change the focus of GUD tooltips to #define | ||
| 928 | directives." | ||
| 929 | (setq gdb-active-process nil) | ||
| 930 | (gdb-stopping ignored)) | ||
| 931 | |||
| 877 | (defun gdb-frame-begin (ignored) | 932 | (defun gdb-frame-begin (ignored) |
| 878 | (let ((sink gdb-output-sink)) | 933 | (let ((sink gdb-output-sink)) |
| 879 | (cond | 934 | (cond |
| @@ -981,7 +1036,8 @@ happens to be appropriate." | |||
| 981 | (match-beginning 0)))) | 1036 | (match-beginning 0)))) |
| 982 | ;; | 1037 | ;; |
| 983 | ;; Everything after, we save, to combine with later input. | 1038 | ;; Everything after, we save, to combine with later input. |
| 984 | (setq gud-marker-acc (substring gud-marker-acc (match-beginning 0)))) | 1039 | (setq gud-marker-acc (substring gud-marker-acc |
| 1040 | (match-beginning 0)))) | ||
| 985 | ;; | 1041 | ;; |
| 986 | ;; In case we know the gud-marker-acc contains no partial annotations: | 1042 | ;; In case we know the gud-marker-acc contains no partial annotations: |
| 987 | (progn | 1043 | (progn |
| @@ -1045,7 +1101,7 @@ happens to be appropriate." | |||
| 1045 | ;; annotation rule binding of whatever gdb sends to tell us this command | 1101 | ;; annotation rule binding of whatever gdb sends to tell us this command |
| 1046 | ;; might have changed it's output. | 1102 | ;; might have changed it's output. |
| 1047 | ;; | 1103 | ;; |
| 1048 | ;; NAME is the function name. DEMAND-PREDICATE tests if output is really needed. | 1104 | ;; NAME is the function name. DEMAND-PREDICATE tests if output is really needed. |
| 1049 | ;; GDB-COMMAND is a string of such. OUTPUT-HANDLER is the function bound to the | 1105 | ;; GDB-COMMAND is a string of such. OUTPUT-HANDLER is the function bound to the |
| 1050 | ;; input in the input queue (see comment about ``gdb communications'' above). | 1106 | ;; input in the input queue (see comment about ``gdb communications'' above). |
| 1051 | 1107 | ||
| @@ -1077,8 +1133,9 @@ happens to be appropriate." | |||
| 1077 | ;; put customisation here | 1133 | ;; put customisation here |
| 1078 | (,custom-defun))) | 1134 | (,custom-defun))) |
| 1079 | 1135 | ||
| 1080 | (defmacro def-gdb-auto-updated-buffer (buffer-key trigger-name gdb-command | 1136 | (defmacro def-gdb-auto-updated-buffer (buffer-key |
| 1081 | output-handler-name custom-defun) | 1137 | trigger-name gdb-command |
| 1138 | output-handler-name custom-defun) | ||
| 1082 | `(progn | 1139 | `(progn |
| 1083 | (def-gdb-auto-update-trigger ,trigger-name | 1140 | (def-gdb-auto-update-trigger ,trigger-name |
| 1084 | ;; The demand predicate: | 1141 | ;; The demand predicate: |
| @@ -1225,7 +1282,7 @@ static char *magick[] = { | |||
| 1225 | '(mouse-face highlight | 1282 | '(mouse-face highlight |
| 1226 | help-echo "mouse-2, RET: visit breakpoint")) | 1283 | help-echo "mouse-2, RET: visit breakpoint")) |
| 1227 | (unless (file-exists-p file) | 1284 | (unless (file-exists-p file) |
| 1228 | (setq file (cdr (assoc bptno gdb-location-list)))) | 1285 | (setq file (cdr (assoc bptno gdb-location-alist)))) |
| 1229 | (unless (string-equal file "File not found") | 1286 | (unless (string-equal file "File not found") |
| 1230 | (if file | 1287 | (if file |
| 1231 | (with-current-buffer (find-file-noselect file) | 1288 | (with-current-buffer (find-file-noselect file) |
| @@ -1233,13 +1290,15 @@ static char *magick[] = { | |||
| 1233 | 'gdba) | 1290 | 'gdba) |
| 1234 | (set (make-local-variable 'tool-bar-map) | 1291 | (set (make-local-variable 'tool-bar-map) |
| 1235 | gud-tool-bar-map) | 1292 | gud-tool-bar-map) |
| 1236 | ;; only want one breakpoint icon at each location | 1293 | ;; only want one breakpoint icon at each |
| 1294 | ;; location | ||
| 1237 | (save-excursion | 1295 | (save-excursion |
| 1238 | (goto-line (string-to-number line)) | 1296 | (goto-line (string-to-number line)) |
| 1239 | (gdb-put-breakpoint-icon (eq flag ?y) bptno))) | 1297 | (gdb-put-breakpoint-icon (eq flag ?y) bptno))) |
| 1240 | (gdb-enqueue-input | 1298 | (gdb-enqueue-input |
| 1241 | (list (concat "list " | 1299 | (list |
| 1242 | (match-string-no-properties 1) ":1\n") | 1300 | (concat "list " |
| 1301 | (match-string-no-properties 1) ":1\n") | ||
| 1243 | 'ignore)) | 1302 | 'ignore)) |
| 1244 | (gdb-enqueue-input | 1303 | (gdb-enqueue-input |
| 1245 | (list "info source\n" | 1304 | (list "info source\n" |
| @@ -1351,7 +1410,7 @@ static char *magick[] = { | |||
| 1351 | (if (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)) | 1410 | (if (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)) |
| 1352 | (looking-at "\\([0-9]+\\).*point\\s-*\\S-*\\s-*\\(.\\)") | 1411 | (looking-at "\\([0-9]+\\).*point\\s-*\\S-*\\s-*\\(.\\)") |
| 1353 | (looking-at | 1412 | (looking-at |
| 1354 | "\\([0-9]+\\)\\s-*\\S-*\\s-*\\S-*\\s-*\\(.\\)\\s-*\\S-*\\s-*\\S-*:[0-9]+")) | 1413 | "\\([0-9]+\\)\\s-*\\S-*\\s-*\\S-*\\s-*\\(.\\)\\s-*\\S-*\\s-*\\S-*:[0-9]+")) |
| 1355 | (gdb-enqueue-input | 1414 | (gdb-enqueue-input |
| 1356 | (list | 1415 | (list |
| 1357 | (concat gdb-server-prefix | 1416 | (concat gdb-server-prefix |
| @@ -1383,14 +1442,15 @@ static char *magick[] = { | |||
| 1383 | (if (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)) | 1442 | (if (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)) |
| 1384 | (looking-at "\\([0-9]+\\) .* in .* at\\s-+\\(\\S-*\\):\\([0-9]+\\)") | 1443 | (looking-at "\\([0-9]+\\) .* in .* at\\s-+\\(\\S-*\\):\\([0-9]+\\)") |
| 1385 | (looking-at | 1444 | (looking-at |
| 1386 | "\\([0-9]+\\)\\s-*\\S-*\\s-*\\S-*\\s-*.\\s-*\\S-*\\s-*\\(\\S-*\\):\\([0-9]+\\)")) | 1445 | "\\([0-9]+\\)\\s-*\\S-*\\s-*\\S-*\\s-*.\\s-*\\S-*\\s-*\ |
| 1446 | \\(\\S-*\\):\\([0-9]+\\)")) | ||
| 1387 | (let ((bptno (match-string 1)) | 1447 | (let ((bptno (match-string 1)) |
| 1388 | (file (match-string 2)) | 1448 | (file (match-string 2)) |
| 1389 | (line (match-string 3))) | 1449 | (line (match-string 3))) |
| 1390 | (save-selected-window | 1450 | (save-selected-window |
| 1391 | (let* ((buf (find-file-noselect | 1451 | (let* ((buf (find-file-noselect |
| 1392 | (if (file-exists-p file) file | 1452 | (if (file-exists-p file) file |
| 1393 | (cdr (assoc bptno gdb-location-list))))) | 1453 | (cdr (assoc bptno gdb-location-alist))))) |
| 1394 | (window (display-buffer buf))) | 1454 | (window (display-buffer buf))) |
| 1395 | (with-current-buffer buf | 1455 | (with-current-buffer buf |
| 1396 | (goto-line (string-to-number line)) | 1456 | (goto-line (string-to-number line)) |
| @@ -1481,7 +1541,8 @@ static char *magick[] = { | |||
| 1481 | (interactive (list last-input-event)) | 1541 | (interactive (list last-input-event)) |
| 1482 | (if event (mouse-set-point event)) | 1542 | (if event (mouse-set-point event)) |
| 1483 | (gdb-enqueue-input | 1543 | (gdb-enqueue-input |
| 1484 | (list (concat gdb-server-prefix "frame " (gdb-get-frame-number) "\n") 'ignore)) | 1544 | (list (concat gdb-server-prefix "frame " |
| 1545 | (gdb-get-frame-number) "\n") 'ignore)) | ||
| 1485 | (gud-display-frame)) | 1546 | (gud-display-frame)) |
| 1486 | 1547 | ||
| 1487 | 1548 | ||
| @@ -1668,7 +1729,7 @@ static char *magick[] = { | |||
| 1668 | (save-selected-window | 1729 | (save-selected-window |
| 1669 | (select-window (posn-window (event-start event))) | 1730 | (select-window (posn-window (event-start event))) |
| 1670 | (let* ((arg (read-from-minibuffer "Repeat count: ")) | 1731 | (let* ((arg (read-from-minibuffer "Repeat count: ")) |
| 1671 | (count (string-to-int arg))) | 1732 | (count (string-to-number arg))) |
| 1672 | (if (< count 0) | 1733 | (if (< count 0) |
| 1673 | (error "Non-negative numbers only") | 1734 | (error "Non-negative numbers only") |
| 1674 | (customize-set-variable 'gdb-memory-repeat-count count) | 1735 | (customize-set-variable 'gdb-memory-repeat-count count) |
| @@ -1976,7 +2037,8 @@ corresponding to the mode line clicked." | |||
| 1976 | 2037 | ||
| 1977 | (let ((menu (make-sparse-keymap "GDB-Windows"))) | 2038 | (let ((menu (make-sparse-keymap "GDB-Windows"))) |
| 1978 | (define-key gud-menu-map [displays] | 2039 | (define-key gud-menu-map [displays] |
| 1979 | `(menu-item "GDB-Windows" ,menu :visible (eq gud-minor-mode 'gdba))) | 2040 | `(menu-item "GDB-Windows" ,menu |
| 2041 | :visible (memq gud-minor-mode '(gdbmi gdba)))) | ||
| 1980 | (define-key menu [gdb] '("Gdb" . gdb-display-gdb-buffer)) | 2042 | (define-key menu [gdb] '("Gdb" . gdb-display-gdb-buffer)) |
| 1981 | (define-key menu [threads] '("Threads" . gdb-display-threads-buffer)) | 2043 | (define-key menu [threads] '("Threads" . gdb-display-threads-buffer)) |
| 1982 | (define-key menu [memory] '("Memory" . gdb-display-memory-buffer)) | 2044 | (define-key menu [memory] '("Memory" . gdb-display-memory-buffer)) |
| @@ -1987,11 +2049,13 @@ corresponding to the mode line clicked." | |||
| 1987 | :enable gdb-use-inferior-io-buffer)) | 2049 | :enable gdb-use-inferior-io-buffer)) |
| 1988 | (define-key menu [locals] '("Locals" . gdb-display-locals-buffer)) | 2050 | (define-key menu [locals] '("Locals" . gdb-display-locals-buffer)) |
| 1989 | (define-key menu [frames] '("Stack" . gdb-display-stack-buffer)) | 2051 | (define-key menu [frames] '("Stack" . gdb-display-stack-buffer)) |
| 1990 | (define-key menu [breakpoints] '("Breakpoints" . gdb-display-breakpoints-buffer))) | 2052 | (define-key menu [breakpoints] |
| 2053 | '("Breakpoints" . gdb-display-breakpoints-buffer))) | ||
| 1991 | 2054 | ||
| 1992 | (let ((menu (make-sparse-keymap "GDB-Frames"))) | 2055 | (let ((menu (make-sparse-keymap "GDB-Frames"))) |
| 1993 | (define-key gud-menu-map [frames] | 2056 | (define-key gud-menu-map [frames] |
| 1994 | `(menu-item "GDB-Frames" ,menu :visible (eq gud-minor-mode 'gdba))) | 2057 | `(menu-item "GDB-Frames" ,menu |
| 2058 | :visible (memq gud-minor-mode '(gdbmi gdba)))) | ||
| 1995 | (define-key menu [gdb] '("Gdb" . gdb-frame-gdb-buffer)) | 2059 | (define-key menu [gdb] '("Gdb" . gdb-frame-gdb-buffer)) |
| 1996 | (define-key menu [threads] '("Threads" . gdb-frame-threads-buffer)) | 2060 | (define-key menu [threads] '("Threads" . gdb-frame-threads-buffer)) |
| 1997 | (define-key menu [memory] '("Memory" . gdb-frame-memory-buffer)) | 2061 | (define-key menu [memory] '("Memory" . gdb-frame-memory-buffer)) |
| @@ -2002,7 +2066,8 @@ corresponding to the mode line clicked." | |||
| 2002 | :enable gdb-use-inferior-io-buffer)) | 2066 | :enable gdb-use-inferior-io-buffer)) |
| 2003 | (define-key menu [locals] '("Locals" . gdb-frame-locals-buffer)) | 2067 | (define-key menu [locals] '("Locals" . gdb-frame-locals-buffer)) |
| 2004 | (define-key menu [frames] '("Stack" . gdb-frame-stack-buffer)) | 2068 | (define-key menu [frames] '("Stack" . gdb-frame-stack-buffer)) |
| 2005 | (define-key menu [breakpoints] '("Breakpoints" . gdb-frame-breakpoints-buffer))) | 2069 | (define-key menu [breakpoints] |
| 2070 | '("Breakpoints" . gdb-frame-breakpoints-buffer))) | ||
| 2006 | 2071 | ||
| 2007 | (let ((menu (make-sparse-keymap "GDB-UI"))) | 2072 | (let ((menu (make-sparse-keymap "GDB-UI"))) |
| 2008 | (define-key gud-menu-map [ui] | 2073 | (define-key gud-menu-map [ui] |
| @@ -2129,12 +2194,15 @@ Kills the gdb buffers and resets the source buffers." | |||
| 2129 | (gdb-remove-breakpoint-icons (point-min) (point-max) t) | 2194 | (gdb-remove-breakpoint-icons (point-min) (point-max) t) |
| 2130 | (setq gud-minor-mode nil) | 2195 | (setq gud-minor-mode nil) |
| 2131 | (kill-local-variable 'tool-bar-map) | 2196 | (kill-local-variable 'tool-bar-map) |
| 2132 | (setq gud-running nil)))))) | 2197 | (kill-local-variable 'gdb-define-alist)))))) |
| 2133 | (when (markerp gdb-overlay-arrow-position) | 2198 | (when (markerp gdb-overlay-arrow-position) |
| 2134 | (move-marker gdb-overlay-arrow-position nil) | 2199 | (move-marker gdb-overlay-arrow-position nil) |
| 2135 | (setq gdb-overlay-arrow-position nil)) | 2200 | (setq gdb-overlay-arrow-position nil)) |
| 2136 | (setq overlay-arrow-variable-list | 2201 | (setq overlay-arrow-variable-list |
| 2137 | (delq 'gdb-overlay-arrow-position overlay-arrow-variable-list))) | 2202 | (delq 'gdb-overlay-arrow-position overlay-arrow-variable-list)) |
| 2203 | (setq gud-running nil) | ||
| 2204 | (setq gdb-active-process nil) | ||
| 2205 | (remove-hook 'after-save-hook 'gdb-create-define-alist t)) | ||
| 2138 | 2206 | ||
| 2139 | (defun gdb-source-info () | 2207 | (defun gdb-source-info () |
| 2140 | "Find the source file where the program starts and displays it with related | 2208 | "Find the source file where the program starts and displays it with related |
| @@ -2157,9 +2225,9 @@ Put in buffer and place breakpoint icon." | |||
| 2157 | (catch 'file-not-found | 2225 | (catch 'file-not-found |
| 2158 | (if (search-forward "Located in " nil t) | 2226 | (if (search-forward "Located in " nil t) |
| 2159 | (if (looking-at "\\S-*") | 2227 | (if (looking-at "\\S-*") |
| 2160 | (push (cons bptno (match-string 0)) gdb-location-list)) | 2228 | (push (cons bptno (match-string 0)) gdb-location-alist)) |
| 2161 | (gdb-resync) | 2229 | (gdb-resync) |
| 2162 | (push (cons bptno "File not found") gdb-location-list) | 2230 | (push (cons bptno "File not found") gdb-location-alist) |
| 2163 | (message-box "Cannot find source file for breakpoint location.\n\ | 2231 | (message-box "Cannot find source file for breakpoint location.\n\ |
| 2164 | Add directory to search path for source files using the GDB command, dir.") | 2232 | Add directory to search path for source files using the GDB command, dir.") |
| 2165 | (throw 'file-not-found nil)) | 2233 | (throw 'file-not-found nil)) |
| @@ -2214,7 +2282,7 @@ BUFFER nil or omitted means use the current buffer." | |||
| 2214 | (unless buffer | 2282 | (unless buffer |
| 2215 | (setq buffer (current-buffer))) | 2283 | (setq buffer (current-buffer))) |
| 2216 | (dolist (overlay (overlays-in start end)) | 2284 | (dolist (overlay (overlays-in start end)) |
| 2217 | (when (overlay-get overlay 'put-break) | 2285 | (when (overlay-get overlay 'put-break) |
| 2218 | (delete-overlay overlay)))) | 2286 | (delete-overlay overlay)))) |
| 2219 | 2287 | ||
| 2220 | (defun gdb-put-breakpoint-icon (enabled bptno) | 2288 | (defun gdb-put-breakpoint-icon (enabled bptno) |
| @@ -2416,7 +2484,8 @@ BUFFER nil or omitted means use the current buffer." | |||
| 2416 | (setq gdb-input-queue | 2484 | (setq gdb-input-queue |
| 2417 | (delete item gdb-input-queue)))))) | 2485 | (delete item gdb-input-queue)))))) |
| 2418 | (gdb-enqueue-input | 2486 | (gdb-enqueue-input |
| 2419 | (list (concat gdb-server-prefix "disassemble " gdb-current-address "\n") | 2487 | (list (concat gdb-server-prefix "disassemble " |
| 2488 | gdb-current-address "\n") | ||
| 2420 | 'gdb-assembler-handler)) | 2489 | 'gdb-assembler-handler)) |
| 2421 | (push 'gdb-invalidate-assembler gdb-pending-triggers) | 2490 | (push 'gdb-invalidate-assembler gdb-pending-triggers) |
| 2422 | (setq gdb-previous-address gdb-current-address) | 2491 | (setq gdb-previous-address gdb-current-address) |
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index ab705212397..4f5ffe0d23b 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | ;;; grep.el --- run compiler as inferior of Emacs, parse error messages | 1 | ;;; grep.el --- run compiler as inferior of Emacs, parse error messages |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1996, 1997, 1998, 1999, | 3 | ;; Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1996, 1997, 1998, 1999, |
| 4 | ;; 2001, 2002, 2004 Free Software Foundation, Inc. | 4 | ;; 2001, 2002, 2004, 2005 Free Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | ;; Author: Roland McGrath <roland@gnu.org> | 6 | ;; Author: Roland McGrath <roland@gnu.org> |
| 7 | ;; Maintainer: FSF | 7 | ;; Maintainer: FSF |
| @@ -294,7 +294,10 @@ Notice that using \\[next-error] or \\[compile-goto-error] modifies | |||
| 294 | (2 compilation-line-face)) | 294 | (2 compilation-line-face)) |
| 295 | ;; Highlight grep matches and delete markers | 295 | ;; Highlight grep matches and delete markers |
| 296 | ("\\(\033\\[01;41m\\)\\(.*?\\)\\(\033\\[00m\\(\033\\[K\\)?\\)" | 296 | ("\\(\033\\[01;41m\\)\\(.*?\\)\\(\033\\[00m\\(\033\\[K\\)?\\)" |
| 297 | (2 grep-match-face) | 297 | ;; Refontification does not work after the markers have been |
| 298 | ;; deleted. So we use the font-lock-face property here as Font | ||
| 299 | ;; Lock does not clear that. | ||
| 300 | (2 (list 'face nil 'font-lock-face grep-match-face)) | ||
| 298 | ((lambda (p)) | 301 | ((lambda (p)) |
| 299 | (progn | 302 | (progn |
| 300 | ;; Delete markers with `replace-match' because it updates | 303 | ;; Delete markers with `replace-match' because it updates |
diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el index 9a5d609c523..e98cb9eee58 100644 --- a/lisp/progmodes/gud.el +++ b/lisp/progmodes/gud.el | |||
| @@ -228,6 +228,10 @@ Uses `gud-<MINOR-MODE>-directories' to find the source files." | |||
| 228 | (with-current-buffer buf | 228 | (with-current-buffer buf |
| 229 | (set (make-local-variable 'gud-minor-mode) minor-mode) | 229 | (set (make-local-variable 'gud-minor-mode) minor-mode) |
| 230 | (set (make-local-variable 'tool-bar-map) gud-tool-bar-map) | 230 | (set (make-local-variable 'tool-bar-map) gud-tool-bar-map) |
| 231 | (when (memq gud-minor-mode '(gdbmi gdba)) | ||
| 232 | (make-local-variable 'gdb-define-alist) | ||
| 233 | (unless gdb-define-alist (gdb-create-define-alist)) | ||
| 234 | (add-hook 'after-save-hook 'gdb-create-define-alist nil t)) | ||
| 231 | (make-local-variable 'gud-keep-buffer)) | 235 | (make-local-variable 'gud-keep-buffer)) |
| 232 | buf))) | 236 | buf))) |
| 233 | 237 | ||
| @@ -474,7 +478,7 @@ off the specialized speedbar mode." | |||
| 474 | 478 | ||
| 475 | ;; Extract the frame position from the marker. | 479 | ;; Extract the frame position from the marker. |
| 476 | gud-last-frame (cons (match-string 1 gud-marker-acc) | 480 | gud-last-frame (cons (match-string 1 gud-marker-acc) |
| 477 | (string-to-int (match-string 2 gud-marker-acc))) | 481 | (string-to-number (match-string 2 gud-marker-acc))) |
| 478 | 482 | ||
| 479 | ;; Append any text before the marker to the output we're going | 483 | ;; Append any text before the marker to the output we're going |
| 480 | ;; to return - we don't include the marker in this text. | 484 | ;; to return - we don't include the marker in this text. |
| @@ -775,14 +779,14 @@ SKIP is the number of chars to skip on each lines, it defaults to 0." | |||
| 775 | gud-marker-acc start) | 779 | gud-marker-acc start) |
| 776 | (setq gud-last-frame | 780 | (setq gud-last-frame |
| 777 | (cons (match-string 3 gud-marker-acc) | 781 | (cons (match-string 3 gud-marker-acc) |
| 778 | (string-to-int (match-string 4 gud-marker-acc))))) | 782 | (string-to-number (match-string 4 gud-marker-acc))))) |
| 779 | ;; System V Release 4.0 quite often clumps two lines together | 783 | ;; System V Release 4.0 quite often clumps two lines together |
| 780 | ((string-match "^\\(BREAKPOINT\\|STEPPED\\) process [0-9]+ function [^ ]+ in \\(.+\\)\n\\([0-9]+\\):" | 784 | ((string-match "^\\(BREAKPOINT\\|STEPPED\\) process [0-9]+ function [^ ]+ in \\(.+\\)\n\\([0-9]+\\):" |
| 781 | gud-marker-acc start) | 785 | gud-marker-acc start) |
| 782 | (setq gud-sdb-lastfile (match-string 2 gud-marker-acc)) | 786 | (setq gud-sdb-lastfile (match-string 2 gud-marker-acc)) |
| 783 | (setq gud-last-frame | 787 | (setq gud-last-frame |
| 784 | (cons gud-sdb-lastfile | 788 | (cons gud-sdb-lastfile |
| 785 | (string-to-int (match-string 3 gud-marker-acc))))) | 789 | (string-to-number (match-string 3 gud-marker-acc))))) |
| 786 | ;; System V Release 4.0 | 790 | ;; System V Release 4.0 |
| 787 | ((string-match "^\\(BREAKPOINT\\|STEPPED\\) process [0-9]+ function [^ ]+ in \\(.+\\)\n" | 791 | ((string-match "^\\(BREAKPOINT\\|STEPPED\\) process [0-9]+ function [^ ]+ in \\(.+\\)\n" |
| 788 | gud-marker-acc start) | 792 | gud-marker-acc start) |
| @@ -791,7 +795,7 @@ SKIP is the number of chars to skip on each lines, it defaults to 0." | |||
| 791 | gud-marker-acc start)) | 795 | gud-marker-acc start)) |
| 792 | (setq gud-last-frame | 796 | (setq gud-last-frame |
| 793 | (cons gud-sdb-lastfile | 797 | (cons gud-sdb-lastfile |
| 794 | (string-to-int (match-string 1 gud-marker-acc))))) | 798 | (string-to-number (match-string 1 gud-marker-acc))))) |
| 795 | (t | 799 | (t |
| 796 | (setq gud-sdb-lastfile nil))) | 800 | (setq gud-sdb-lastfile nil))) |
| 797 | (setq start (match-end 0))) | 801 | (setq start (match-end 0))) |
| @@ -877,7 +881,7 @@ containing the executable being debugged." | |||
| 877 | gud-marker-acc start)) | 881 | gud-marker-acc start)) |
| 878 | (setq gud-last-frame | 882 | (setq gud-last-frame |
| 879 | (cons (match-string 2 gud-marker-acc) | 883 | (cons (match-string 2 gud-marker-acc) |
| 880 | (string-to-int (match-string 1 gud-marker-acc))) | 884 | (string-to-number (match-string 1 gud-marker-acc))) |
| 881 | start (match-end 0))) | 885 | start (match-end 0))) |
| 882 | 886 | ||
| 883 | ;; Search for the last incomplete line in this chunk | 887 | ;; Search for the last incomplete line in this chunk |
| @@ -924,7 +928,7 @@ containing the executable being debugged." | |||
| 924 | ;; Extract the frame position from the marker. | 928 | ;; Extract the frame position from the marker. |
| 925 | gud-last-frame | 929 | gud-last-frame |
| 926 | (cons (match-string 1 gud-marker-acc) | 930 | (cons (match-string 1 gud-marker-acc) |
| 927 | (string-to-int (match-string 2 gud-marker-acc))) | 931 | (string-to-number (match-string 2 gud-marker-acc))) |
| 928 | 932 | ||
| 929 | ;; Append any text before the marker to the output we're going | 933 | ;; Append any text before the marker to the output we're going |
| 930 | ;; to return - we don't include the marker in this text. | 934 | ;; to return - we don't include the marker in this text. |
| @@ -1032,7 +1036,7 @@ a better solution in 6.1 upwards.") | |||
| 1032 | (if (file-exists-p file) | 1036 | (if (file-exists-p file) |
| 1033 | (setq gud-last-frame | 1037 | (setq gud-last-frame |
| 1034 | (cons (match-string 1 result) | 1038 | (cons (match-string 1 result) |
| 1035 | (string-to-int (match-string 2 result)))))) | 1039 | (string-to-number (match-string 2 result)))))) |
| 1036 | result) | 1040 | result) |
| 1037 | ((string-match ; kluged-up marker as above | 1041 | ((string-match ; kluged-up marker as above |
| 1038 | "\032\032\\([0-9]*\\):\\(.*\\)\n" result) | 1042 | "\032\032\\([0-9]*\\):\\(.*\\)\n" result) |
| @@ -1040,7 +1044,7 @@ a better solution in 6.1 upwards.") | |||
| 1040 | (if (and file (file-exists-p file)) | 1044 | (if (and file (file-exists-p file)) |
| 1041 | (setq gud-last-frame | 1045 | (setq gud-last-frame |
| 1042 | (cons file | 1046 | (cons file |
| 1043 | (string-to-int (match-string 1 result)))))) | 1047 | (string-to-number (match-string 1 result)))))) |
| 1044 | (setq result (substring result 0 (match-beginning 0)))))) | 1048 | (setq result (substring result 0 (match-beginning 0)))))) |
| 1045 | (or result ""))) | 1049 | (or result ""))) |
| 1046 | 1050 | ||
| @@ -1077,7 +1081,7 @@ This was tested using R4.11.") | |||
| 1077 | (while (string-match re gud-marker-acc start) | 1081 | (while (string-match re gud-marker-acc start) |
| 1078 | (setq gud-last-frame | 1082 | (setq gud-last-frame |
| 1079 | (cons (match-string 4 gud-marker-acc) | 1083 | (cons (match-string 4 gud-marker-acc) |
| 1080 | (string-to-int (match-string 3 gud-marker-acc))) | 1084 | (string-to-number (match-string 3 gud-marker-acc))) |
| 1081 | start (match-end 0))) | 1085 | start (match-end 0))) |
| 1082 | 1086 | ||
| 1083 | ;; Search for the last incomplete line in this chunk | 1087 | ;; Search for the last incomplete line in this chunk |
| @@ -1196,7 +1200,7 @@ containing the executable being debugged." | |||
| 1196 | result) | 1200 | result) |
| 1197 | (string-match "[^: \t]+:[ \t]+\\([^:]+\\): [^:]+: \\([0-9]+\\):" | 1201 | (string-match "[^: \t]+:[ \t]+\\([^:]+\\): [^:]+: \\([0-9]+\\):" |
| 1198 | result)) | 1202 | result)) |
| 1199 | (let ((line (string-to-int (match-string 2 result))) | 1203 | (let ((line (string-to-number (match-string 2 result))) |
| 1200 | (file (gud-file-name (match-string 1 result)))) | 1204 | (file (gud-file-name (match-string 1 result)))) |
| 1201 | (if file | 1205 | (if file |
| 1202 | (setq gud-last-frame (cons file line)))))) | 1206 | (setq gud-last-frame (cons file line)))))) |
| @@ -1298,7 +1302,7 @@ into one that invokes an Emacs-enabled debugging session. | |||
| 1298 | ;; Extract the frame position from the marker. | 1302 | ;; Extract the frame position from the marker. |
| 1299 | gud-last-frame | 1303 | gud-last-frame |
| 1300 | (cons (match-string 1 gud-marker-acc) | 1304 | (cons (match-string 1 gud-marker-acc) |
| 1301 | (string-to-int (match-string 3 gud-marker-acc))) | 1305 | (string-to-number (match-string 3 gud-marker-acc))) |
| 1302 | 1306 | ||
| 1303 | ;; Append any text before the marker to the output we're going | 1307 | ;; Append any text before the marker to the output we're going |
| 1304 | ;; to return - we don't include the marker in this text. | 1308 | ;; to return - we don't include the marker in this text. |
| @@ -1396,7 +1400,7 @@ and source-file directory for your debugger." | |||
| 1396 | gud-last-frame | 1400 | gud-last-frame |
| 1397 | (let ((file (match-string gud-pdb-marker-regexp-file-group | 1401 | (let ((file (match-string gud-pdb-marker-regexp-file-group |
| 1398 | gud-marker-acc)) | 1402 | gud-marker-acc)) |
| 1399 | (line (string-to-int | 1403 | (line (string-to-number |
| 1400 | (match-string gud-pdb-marker-regexp-line-group | 1404 | (match-string gud-pdb-marker-regexp-line-group |
| 1401 | gud-marker-acc)))) | 1405 | gud-marker-acc)))) |
| 1402 | (if (string-equal file "<string>") | 1406 | (if (string-equal file "<string>") |
| @@ -2028,7 +2032,7 @@ nil) | |||
| 2028 | ;; (<file-name> . <line-number>) . | 2032 | ;; (<file-name> . <line-number>) . |
| 2029 | (if (if (match-beginning 1) | 2033 | (if (if (match-beginning 1) |
| 2030 | (let (n) | 2034 | (let (n) |
| 2031 | (setq n (string-to-int (substring | 2035 | (setq n (string-to-number (substring |
| 2032 | gud-marker-acc | 2036 | gud-marker-acc |
| 2033 | (1+ (match-beginning 1)) | 2037 | (1+ (match-beginning 1)) |
| 2034 | (- (match-end 1) 2)))) | 2038 | (- (match-end 1) 2)))) |
| @@ -2039,7 +2043,7 @@ nil) | |||
| 2039 | (gud-jdb-find-source (match-string 2 gud-marker-acc))) | 2043 | (gud-jdb-find-source (match-string 2 gud-marker-acc))) |
| 2040 | (setq gud-last-frame | 2044 | (setq gud-last-frame |
| 2041 | (cons file-found | 2045 | (cons file-found |
| 2042 | (string-to-int | 2046 | (string-to-number |
| 2043 | (let | 2047 | (let |
| 2044 | ((numstr (match-string 4 gud-marker-acc))) | 2048 | ((numstr (match-string 4 gud-marker-acc))) |
| 2045 | (if (string-match "[.,]" numstr) | 2049 | (if (string-match "[.,]" numstr) |
| @@ -2187,7 +2191,7 @@ gud, see `gud-mode'." | |||
| 2187 | ;; Extract the frame position from the marker. | 2191 | ;; Extract the frame position from the marker. |
| 2188 | gud-last-frame | 2192 | gud-last-frame |
| 2189 | (cons (match-string 2 gud-marker-acc) | 2193 | (cons (match-string 2 gud-marker-acc) |
| 2190 | (string-to-int (match-string 4 gud-marker-acc))) | 2194 | (string-to-number (match-string 4 gud-marker-acc))) |
| 2191 | 2195 | ||
| 2192 | ;; Append any text before the marker to the output we're going | 2196 | ;; Append any text before the marker to the output we're going |
| 2193 | ;; to return - we don't include the marker in this text. | 2197 | ;; to return - we don't include the marker in this text. |
| @@ -2977,6 +2981,7 @@ class of the file (using s to separate nested class ids)." | |||
| 2977 | (message "gud-find-class: class for file %s not found in gud-jdb-class-source-alist!" f) | 2981 | (message "gud-find-class: class for file %s not found in gud-jdb-class-source-alist!" f) |
| 2978 | nil)))) | 2982 | nil)))) |
| 2979 | 2983 | ||
| 2984 | |||
| 2980 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 2985 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 2981 | ;;; GDB script mode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 2986 | ;;; GDB script mode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 2982 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 2987 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
diff --git a/lisp/progmodes/inf-lisp.el b/lisp/progmodes/inf-lisp.el index 06ad2d591ad..083d87f581c 100644 --- a/lisp/progmodes/inf-lisp.el +++ b/lisp/progmodes/inf-lisp.el | |||
| @@ -167,7 +167,7 @@ and franz. This variable is used to initialize `comint-prompt-regexp' in the | |||
| 167 | Inferior Lisp buffer. | 167 | Inferior Lisp buffer. |
| 168 | 168 | ||
| 169 | This variable is only used if the variable | 169 | This variable is only used if the variable |
| 170 | `comint-use-prompt-regexp-instead-of-fields' is non-nil. | 170 | `comint-use-prompt-regexp' is non-nil. |
| 171 | 171 | ||
| 172 | More precise choices: | 172 | More precise choices: |
| 173 | Lucid Common Lisp: \"^\\\\(>\\\\|\\\\(->\\\\)+\\\\) *\" | 173 | Lucid Common Lisp: \"^\\\\(>\\\\|\\\\(->\\\\)+\\\\) *\" |
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 5073f2bc23a..3f556bdb695 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -1680,7 +1680,7 @@ Repeating the command scrolls the completion window." | |||
| 1680 | ;;;; Modes. | 1680 | ;;;; Modes. |
| 1681 | 1681 | ||
| 1682 | (defvar outline-heading-end-regexp) | 1682 | (defvar outline-heading-end-regexp) |
| 1683 | (defvar eldoc-print-current-symbol-info-function) | 1683 | (defvar eldoc-documentation-function) |
| 1684 | 1684 | ||
| 1685 | ;;;###autoload | 1685 | ;;;###autoload |
| 1686 | (define-derived-mode python-mode fundamental-mode "Python" | 1686 | (define-derived-mode python-mode fundamental-mode "Python" |
| @@ -1740,7 +1740,7 @@ lines count as headers. | |||
| 1740 | 'python-beginning-of-defun) | 1740 | 'python-beginning-of-defun) |
| 1741 | (set (make-local-variable 'end-of-defun-function) 'python-end-of-defun) | 1741 | (set (make-local-variable 'end-of-defun-function) 'python-end-of-defun) |
| 1742 | (setq imenu-create-index-function #'python-imenu-create-index) | 1742 | (setq imenu-create-index-function #'python-imenu-create-index) |
| 1743 | (set (make-local-variable 'eldoc-print-current-symbol-info-function) | 1743 | (set (make-local-variable 'eldoc-documentation-function) |
| 1744 | #'python-eldoc-function) | 1744 | #'python-eldoc-function) |
| 1745 | (add-hook 'eldoc-mode-hook | 1745 | (add-hook 'eldoc-mode-hook |
| 1746 | '(lambda () (run-python 0 t)) nil t) ; need it running | 1746 | '(lambda () (run-python 0 t)) nil t) ; need it running |
diff --git a/lisp/recentf.el b/lisp/recentf.el index 40a9204267e..cf61b688eb5 100644 --- a/lisp/recentf.el +++ b/lisp/recentf.el | |||
| @@ -1137,6 +1137,12 @@ default." | |||
| 1137 | ";;; Automatically generated by `recentf' on %s.\n" | 1137 | ";;; Automatically generated by `recentf' on %s.\n" |
| 1138 | "Header to be written into the `recentf-save-file'.") | 1138 | "Header to be written into the `recentf-save-file'.") |
| 1139 | 1139 | ||
| 1140 | (defconst recentf-save-file-coding-system | ||
| 1141 | (if (coding-system-p 'utf-8-emacs) | ||
| 1142 | 'utf-8-emacs | ||
| 1143 | 'emacs-mule) | ||
| 1144 | "Coding system of the file `recentf-save-file'.") | ||
| 1145 | |||
| 1140 | (defun recentf-save-list () | 1146 | (defun recentf-save-list () |
| 1141 | "Save the recent list. | 1147 | "Save the recent list. |
| 1142 | Write data into the file specified by `recentf-save-file'." | 1148 | Write data into the file specified by `recentf-save-file'." |
| @@ -1144,9 +1150,13 @@ Write data into the file specified by `recentf-save-file'." | |||
| 1144 | (condition-case error | 1150 | (condition-case error |
| 1145 | (with-temp-buffer | 1151 | (with-temp-buffer |
| 1146 | (erase-buffer) | 1152 | (erase-buffer) |
| 1153 | (set-buffer-file-coding-system recentf-save-file-coding-system) | ||
| 1147 | (insert (format recentf-save-file-header (current-time-string))) | 1154 | (insert (format recentf-save-file-header (current-time-string))) |
| 1148 | (recentf-dump-variable 'recentf-list recentf-max-saved-items) | 1155 | (recentf-dump-variable 'recentf-list recentf-max-saved-items) |
| 1149 | (recentf-dump-variable 'recentf-filter-changer-state) | 1156 | (recentf-dump-variable 'recentf-filter-changer-state) |
| 1157 | (insert "\n\n;;; Local Variables:\n" | ||
| 1158 | (format ";;; coding: %s\n" recentf-save-file-coding-system) | ||
| 1159 | ";;; End:\n") | ||
| 1150 | (write-file (expand-file-name recentf-save-file)) | 1160 | (write-file (expand-file-name recentf-save-file)) |
| 1151 | nil) | 1161 | nil) |
| 1152 | (error | 1162 | (error |
| @@ -1207,6 +1217,6 @@ that were operated on recently." | |||
| 1207 | (provide 'recentf) | 1217 | (provide 'recentf) |
| 1208 | 1218 | ||
| 1209 | (run-hooks 'recentf-load-hook) | 1219 | (run-hooks 'recentf-load-hook) |
| 1210 | 1220 | ||
| 1211 | ;;; arch-tag: 78f1eec9-0d16-4d19-a4eb-2e4529edb62a | 1221 | ;;; arch-tag: 78f1eec9-0d16-4d19-a4eb-2e4529edb62a |
| 1212 | ;;; recentf.el ends here | 1222 | ;;; recentf.el ends here |
diff --git a/lisp/saveplace.el b/lisp/saveplace.el index cb61c8383b5..9dc7b858e37 100644 --- a/lisp/saveplace.el +++ b/lisp/saveplace.el | |||
| @@ -166,7 +166,8 @@ To save places automatically in all files, put this in your `.emacs' file: | |||
| 166 | (let ((cell (assoc buffer-file-name save-place-alist)) | 166 | (let ((cell (assoc buffer-file-name save-place-alist)) |
| 167 | (position (if (not (eq major-mode 'hexl-mode)) | 167 | (position (if (not (eq major-mode 'hexl-mode)) |
| 168 | (point) | 168 | (point) |
| 169 | (1+ (hexl-current-address))))) | 169 | (with-no-warnings |
| 170 | (1+ (hexl-current-address)))))) | ||
| 170 | (if cell | 171 | (if cell |
| 171 | (setq save-place-alist (delq cell save-place-alist))) | 172 | (setq save-place-alist (delq cell save-place-alist))) |
| 172 | (if (and save-place | 173 | (if (and save-place |
diff --git a/lisp/shell.el b/lisp/shell.el index 1817a1fd3b4..354ed88f80f 100644 --- a/lisp/shell.el +++ b/lisp/shell.el | |||
| @@ -136,8 +136,9 @@ Defaults to \"^[^#$%>\\n]*[#$%>] *\", which works pretty well. | |||
| 136 | This variable is used to initialise `comint-prompt-regexp' in the | 136 | This variable is used to initialise `comint-prompt-regexp' in the |
| 137 | shell buffer. | 137 | shell buffer. |
| 138 | 138 | ||
| 139 | This variable is only used if the variable | 139 | If `comint-use-prompt-regexp' is nil, then this variable is only used |
| 140 | `comint-use-prompt-regexp-instead-of-fields' is non-nil. | 140 | to determine paragraph boundaries. See Info node `Shell Prompts' for |
| 141 | how Shell mode treats paragraphs. | ||
| 141 | 142 | ||
| 142 | The pattern should probably not match more than one line. If it does, | 143 | The pattern should probably not match more than one line. If it does, |
| 143 | Shell mode may become confused trying to distinguish prompt from input | 144 | Shell mode may become confused trying to distinguish prompt from input |
| @@ -422,6 +423,7 @@ buffer." | |||
| 422 | (setq comint-file-name-chars shell-file-name-chars) | 423 | (setq comint-file-name-chars shell-file-name-chars) |
| 423 | (setq comint-file-name-quote-list shell-file-name-quote-list) | 424 | (setq comint-file-name-quote-list shell-file-name-quote-list) |
| 424 | (setq comint-dynamic-complete-functions shell-dynamic-complete-functions) | 425 | (setq comint-dynamic-complete-functions shell-dynamic-complete-functions) |
| 426 | (set (make-local-variable 'paragraph-separate) "\\'") | ||
| 425 | (make-local-variable 'paragraph-start) | 427 | (make-local-variable 'paragraph-start) |
| 426 | (setq paragraph-start comint-prompt-regexp) | 428 | (setq paragraph-start comint-prompt-regexp) |
| 427 | (make-local-variable 'font-lock-defaults) | 429 | (make-local-variable 'font-lock-defaults) |
diff --git a/lisp/simple.el b/lisp/simple.el index 2d10e68f6b9..011c1970f82 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -113,7 +113,9 @@ If `fringe-arrow', indicate the locus by the fringe arrow." | |||
| 113 | (defvar next-error-highlight-timer nil) | 113 | (defvar next-error-highlight-timer nil) |
| 114 | 114 | ||
| 115 | (defvar next-error-overlay-arrow-position nil) | 115 | (defvar next-error-overlay-arrow-position nil) |
| 116 | (put 'next-error-overlay-arrow-position 'overlay-arrow-string "=>") | 116 | ;; This is nil so as not to really display anything on text |
| 117 | ;; terminals. On text terminals, it would hide part of the file name. | ||
| 118 | (put 'next-error-overlay-arrow-position 'overlay-arrow-string "") | ||
| 117 | (add-to-list 'overlay-arrow-variable-list 'next-error-overlay-arrow-position) | 119 | (add-to-list 'overlay-arrow-variable-list 'next-error-overlay-arrow-position) |
| 118 | 120 | ||
| 119 | (defvar next-error-last-buffer nil | 121 | (defvar next-error-last-buffer nil |
| @@ -3199,6 +3201,14 @@ Invoke \\[apropos-documentation] and type \"transient\" or | |||
| 3199 | commands which are sensitive to the Transient Mark mode." | 3201 | commands which are sensitive to the Transient Mark mode." |
| 3200 | :global t :group 'editing-basics :require nil) | 3202 | :global t :group 'editing-basics :require nil) |
| 3201 | 3203 | ||
| 3204 | (defvar widen-automatically t | ||
| 3205 | "Non-nil means it is ok for commands to call `widen' when they want to. | ||
| 3206 | Some commands will do this in order to go to positions outside | ||
| 3207 | the current accessible part of the buffer. | ||
| 3208 | |||
| 3209 | If `widen-automatically' is nil, these commands will do something else | ||
| 3210 | as a fallback, and won't change the buffer bounds.") | ||
| 3211 | |||
| 3202 | (defun pop-global-mark () | 3212 | (defun pop-global-mark () |
| 3203 | "Pop off global mark ring and jump to the top location." | 3213 | "Pop off global mark ring and jump to the top location." |
| 3204 | (interactive) | 3214 | (interactive) |
| @@ -3215,7 +3225,9 @@ commands which are sensitive to the Transient Mark mode." | |||
| 3215 | (set-buffer buffer) | 3225 | (set-buffer buffer) |
| 3216 | (or (and (>= position (point-min)) | 3226 | (or (and (>= position (point-min)) |
| 3217 | (<= position (point-max))) | 3227 | (<= position (point-max))) |
| 3218 | (widen)) | 3228 | (if widen-automatically |
| 3229 | (error "Global mark position is outside accessible part of buffer") | ||
| 3230 | (widen))) | ||
| 3219 | (goto-char position) | 3231 | (goto-char position) |
| 3220 | (switch-to-buffer buffer))) | 3232 | (switch-to-buffer buffer))) |
| 3221 | 3233 | ||
| @@ -3403,19 +3415,37 @@ Outline mode sets this." | |||
| 3403 | (goto-char (next-char-property-change (point)))) | 3415 | (goto-char (next-char-property-change (point)))) |
| 3404 | ;; Now move a line. | 3416 | ;; Now move a line. |
| 3405 | (end-of-line) | 3417 | (end-of-line) |
| 3406 | (and (zerop (vertical-motion 1)) | 3418 | ;; If there's no invisibility here, move over the newline. |
| 3407 | (if (not noerror) | 3419 | (if (not (line-move-invisible-p (point))) |
| 3408 | (signal 'end-of-buffer nil) | 3420 | ;; We avoid vertical-motion when possible |
| 3409 | (setq done t))) | 3421 | ;; because that has to fontify. |
| 3422 | (if (eobp) | ||
| 3423 | (if (not noerror) | ||
| 3424 | (signal 'end-of-buffer nil) | ||
| 3425 | (setq done t)) | ||
| 3426 | (forward-line 1)) | ||
| 3427 | ;; Otherwise move a more sophisticated way. | ||
| 3428 | ;; (What's the logic behind this code?) | ||
| 3429 | (and (zerop (vertical-motion 1)) | ||
| 3430 | (if (not noerror) | ||
| 3431 | (signal 'end-of-buffer nil) | ||
| 3432 | (setq done t)))) | ||
| 3410 | (unless done | 3433 | (unless done |
| 3411 | (setq arg (1- arg)))) | 3434 | (setq arg (1- arg)))) |
| 3435 | ;; The logic of this is the same as the loop above, | ||
| 3436 | ;; it just goes in the other direction. | ||
| 3412 | (while (and (< arg 0) (not done)) | 3437 | (while (and (< arg 0) (not done)) |
| 3413 | (beginning-of-line) | 3438 | (beginning-of-line) |
| 3414 | 3439 | (if (or (bobp) (not (line-move-invisible-p (1- (point))))) | |
| 3415 | (if (zerop (vertical-motion -1)) | 3440 | (if (bobp) |
| 3416 | (if (not noerror) | 3441 | (if (not noerror) |
| 3417 | (signal 'beginning-of-buffer nil) | 3442 | (signal 'beginning-of-buffer nil) |
| 3418 | (setq done t))) | 3443 | (setq done t)) |
| 3444 | (forward-line -1)) | ||
| 3445 | (if (zerop (vertical-motion -1)) | ||
| 3446 | (if (not noerror) | ||
| 3447 | (signal 'beginning-of-buffer nil) | ||
| 3448 | (setq done t)))) | ||
| 3419 | (unless done | 3449 | (unless done |
| 3420 | (setq arg (1+ arg)) | 3450 | (setq arg (1+ arg)) |
| 3421 | (while (and ;; Don't move over previous invis lines | 3451 | (while (and ;; Don't move over previous invis lines |
diff --git a/lisp/startup.el b/lisp/startup.el index 46c44acbe23..2d1b27f4bd1 100644 --- a/lisp/startup.el +++ b/lisp/startup.el | |||
| @@ -995,7 +995,8 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'." | |||
| 995 | ;; the session manager and we have a session manager connection. | 995 | ;; the session manager and we have a session manager connection. |
| 996 | (if (and (boundp 'x-session-previous-id) | 996 | (if (and (boundp 'x-session-previous-id) |
| 997 | (stringp x-session-previous-id)) | 997 | (stringp x-session-previous-id)) |
| 998 | (emacs-session-restore x-session-previous-id))) | 998 | (with-no-warnings |
| 999 | (emacs-session-restore x-session-previous-id)))) | ||
| 999 | 1000 | ||
| 1000 | (defcustom initial-scratch-message (purecopy "\ | 1001 | (defcustom initial-scratch-message (purecopy "\ |
| 1001 | ;; This buffer is for notes you don't want to save, and for Lisp evaluation. | 1002 | ;; This buffer is for notes you don't want to save, and for Lisp evaluation. |
diff --git a/lisp/subr.el b/lisp/subr.el index b9ea857715c..1c2c01e6b16 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -753,35 +753,16 @@ and `event-end' functions." | |||
| 753 | 753 | ||
| 754 | ;;;; Obsolescent names for functions. | 754 | ;;;; Obsolescent names for functions. |
| 755 | 755 | ||
| 756 | (defalias 'dot 'point) | ||
| 757 | (defalias 'dot-marker 'point-marker) | ||
| 758 | (defalias 'dot-min 'point-min) | ||
| 759 | (defalias 'dot-max 'point-max) | ||
| 760 | (defalias 'window-dot 'window-point) | 756 | (defalias 'window-dot 'window-point) |
| 761 | (defalias 'set-window-dot 'set-window-point) | 757 | (defalias 'set-window-dot 'set-window-point) |
| 762 | (defalias 'read-input 'read-string) | 758 | (defalias 'read-input 'read-string) |
| 763 | (defalias 'send-string 'process-send-string) | 759 | (defalias 'send-string 'process-send-string) |
| 764 | (defalias 'send-region 'process-send-region) | 760 | (defalias 'send-region 'process-send-region) |
| 765 | (defalias 'show-buffer 'set-window-buffer) | 761 | (defalias 'show-buffer 'set-window-buffer) |
| 766 | (defalias 'buffer-flush-undo 'buffer-disable-undo) | ||
| 767 | (defalias 'eval-current-buffer 'eval-buffer) | 762 | (defalias 'eval-current-buffer 'eval-buffer) |
| 768 | (defalias 'compiled-function-p 'byte-code-function-p) | ||
| 769 | (defalias 'define-function 'defalias) | ||
| 770 | 763 | ||
| 771 | (defalias 'sref 'aref) | ||
| 772 | (make-obsolete 'sref 'aref "20.4") | ||
| 773 | (make-obsolete 'char-bytes "now always returns 1." "20.4") | 764 | (make-obsolete 'char-bytes "now always returns 1." "20.4") |
| 774 | (make-obsolete 'chars-in-region "use (abs (- BEG END))." "20.3") | ||
| 775 | (make-obsolete 'dot 'point "before 19.15") | ||
| 776 | (make-obsolete 'dot-max 'point-max "before 19.15") | ||
| 777 | (make-obsolete 'dot-min 'point-min "before 19.15") | ||
| 778 | (make-obsolete 'dot-marker 'point-marker "before 19.15") | ||
| 779 | (make-obsolete 'buffer-flush-undo 'buffer-disable-undo "before 19.15") | ||
| 780 | (make-obsolete 'baud-rate "use the `baud-rate' variable instead." "before 19.15") | 765 | (make-obsolete 'baud-rate "use the `baud-rate' variable instead." "before 19.15") |
| 781 | (make-obsolete 'compiled-function-p 'byte-code-function-p "before 19.15") | ||
| 782 | (make-obsolete 'define-function 'defalias "20.1") | ||
| 783 | (make-obsolete 'focus-frame "it does nothing." "19.32") | ||
| 784 | (make-obsolete 'unfocus-frame "it does nothing." "19.32") | ||
| 785 | 766 | ||
| 786 | (defun insert-string (&rest args) | 767 | (defun insert-string (&rest args) |
| 787 | "Mocklisp-compatibility insert function. | 768 | "Mocklisp-compatibility insert function. |
| @@ -798,9 +779,6 @@ is converted into a string by expressing it in decimal." | |||
| 798 | "Return the value of the `baud-rate' variable." | 779 | "Return the value of the `baud-rate' variable." |
| 799 | baud-rate) | 780 | baud-rate) |
| 800 | 781 | ||
| 801 | (defalias 'focus-frame 'ignore "") | ||
| 802 | (defalias 'unfocus-frame 'ignore "") | ||
| 803 | |||
| 804 | 782 | ||
| 805 | ;;;; Obsolescence declarations for variables, and aliases. | 783 | ;;;; Obsolescence declarations for variables, and aliases. |
| 806 | 784 | ||
| @@ -809,12 +787,15 @@ is converted into a string by expressing it in decimal." | |||
| 809 | (make-obsolete-variable 'unread-command-char | 787 | (make-obsolete-variable 'unread-command-char |
| 810 | "use `unread-command-events' instead. That variable is a list of events to reread, so it now uses nil to mean `no event', instead of -1." | 788 | "use `unread-command-events' instead. That variable is a list of events to reread, so it now uses nil to mean `no event', instead of -1." |
| 811 | "before 19.15") | 789 | "before 19.15") |
| 812 | (make-obsolete-variable 'executing-macro 'executing-kbd-macro "before 19.34") | ||
| 813 | (make-obsolete-variable 'post-command-idle-hook | 790 | (make-obsolete-variable 'post-command-idle-hook |
| 814 | "use timers instead, with `run-with-idle-timer'." "before 19.34") | 791 | "use timers instead, with `run-with-idle-timer'." "before 19.34") |
| 815 | (make-obsolete-variable 'post-command-idle-delay | 792 | (make-obsolete-variable 'post-command-idle-delay |
| 816 | "use timers instead, with `run-with-idle-timer'." "before 19.34") | 793 | "use timers instead, with `run-with-idle-timer'." "before 19.34") |
| 817 | 794 | ||
| 795 | ;; Lisp manual only updated in 22.1. | ||
| 796 | (define-obsolete-variable-alias 'executing-macro 'executing-kbd-macro | ||
| 797 | "before 19.34") | ||
| 798 | |||
| 818 | (defvaralias 'x-lost-selection-hooks 'x-lost-selection-functions) | 799 | (defvaralias 'x-lost-selection-hooks 'x-lost-selection-functions) |
| 819 | (make-obsolete-variable 'x-lost-selection-hooks 'x-lost-selection-functions "22.1") | 800 | (make-obsolete-variable 'x-lost-selection-hooks 'x-lost-selection-functions "22.1") |
| 820 | (defvaralias 'x-sent-selection-hooks 'x-sent-selection-functions) | 801 | (defvaralias 'x-sent-selection-hooks 'x-sent-selection-functions) |
| @@ -843,7 +824,7 @@ is converted into a string by expressing it in decimal." | |||
| 843 | 824 | ||
| 844 | ;;; Should this be an obsolete name? If you decide it should, you get | 825 | ;;; Should this be an obsolete name? If you decide it should, you get |
| 845 | ;;; to go through all the sources and change them. | 826 | ;;; to go through all the sources and change them. |
| 846 | (defalias 'string-to-int 'string-to-number) | 827 | (define-obsolete-function-alias 'string-to-int 'string-to-number) |
| 847 | 828 | ||
| 848 | ;;;; Hook manipulation functions. | 829 | ;;;; Hook manipulation functions. |
| 849 | 830 | ||
| @@ -2279,7 +2260,8 @@ from `standard-syntax-table' otherwise." | |||
| 2279 | table)) | 2260 | table)) |
| 2280 | 2261 | ||
| 2281 | (defun syntax-after (pos) | 2262 | (defun syntax-after (pos) |
| 2282 | "Return the raw syntax of the char after POS." | 2263 | "Return the raw syntax of the char after POS. |
| 2264 | If POS is outside the buffer's accessible portion, return nil." | ||
| 2283 | (unless (or (< pos (point-min)) (>= pos (point-max))) | 2265 | (unless (or (< pos (point-min)) (>= pos (point-max))) |
| 2284 | (let ((st (if parse-sexp-lookup-properties | 2266 | (let ((st (if parse-sexp-lookup-properties |
| 2285 | (get-char-property pos 'syntax-table)))) | 2267 | (get-char-property pos 'syntax-table)))) |
| @@ -2287,22 +2269,23 @@ from `standard-syntax-table' otherwise." | |||
| 2287 | (aref (or st (syntax-table)) (char-after pos)))))) | 2269 | (aref (or st (syntax-table)) (char-after pos)))))) |
| 2288 | 2270 | ||
| 2289 | (defun syntax-class (syntax) | 2271 | (defun syntax-class (syntax) |
| 2290 | "Return the syntax class part of the syntax descriptor SYNTAX." | 2272 | "Return the syntax class part of the syntax descriptor SYNTAX. |
| 2291 | (logand (car syntax) 255)) | 2273 | If SYNTAX is nil, return nil." |
| 2274 | (and syntax (logand (car syntax) 65535))) | ||
| 2292 | 2275 | ||
| 2293 | (defun add-to-invisibility-spec (arg) | 2276 | (defun add-to-invisibility-spec (element) |
| 2294 | "Add elements to `buffer-invisibility-spec'. | 2277 | "Add ELEMENT to `buffer-invisibility-spec'. |
| 2295 | See documentation for `buffer-invisibility-spec' for the kind of elements | 2278 | See documentation for `buffer-invisibility-spec' for the kind of elements |
| 2296 | that can be added." | 2279 | that can be added." |
| 2297 | (if (eq buffer-invisibility-spec t) | 2280 | (if (eq buffer-invisibility-spec t) |
| 2298 | (setq buffer-invisibility-spec (list t))) | 2281 | (setq buffer-invisibility-spec (list t))) |
| 2299 | (setq buffer-invisibility-spec | 2282 | (setq buffer-invisibility-spec |
| 2300 | (cons arg buffer-invisibility-spec))) | 2283 | (cons element buffer-invisibility-spec))) |
| 2301 | 2284 | ||
| 2302 | (defun remove-from-invisibility-spec (arg) | 2285 | (defun remove-from-invisibility-spec (element) |
| 2303 | "Remove elements from `buffer-invisibility-spec'." | 2286 | "Remove ELEMENT from `buffer-invisibility-spec'." |
| 2304 | (if (consp buffer-invisibility-spec) | 2287 | (if (consp buffer-invisibility-spec) |
| 2305 | (setq buffer-invisibility-spec (delete arg buffer-invisibility-spec)))) | 2288 | (setq buffer-invisibility-spec (delete element buffer-invisibility-spec)))) |
| 2306 | 2289 | ||
| 2307 | (defun global-set-key (key command) | 2290 | (defun global-set-key (key command) |
| 2308 | "Give KEY a global binding as COMMAND. | 2291 | "Give KEY a global binding as COMMAND. |
| @@ -2376,15 +2359,34 @@ macros." | |||
| 2376 | (eq (car-safe object) 'lambda))) | 2359 | (eq (car-safe object) 'lambda))) |
| 2377 | 2360 | ||
| 2378 | (defun assq-delete-all (key alist) | 2361 | (defun assq-delete-all (key alist) |
| 2379 | "Delete from ALIST all elements whose car is KEY. | 2362 | "Delete from ALIST all elements whose car is `eq' to KEY. |
| 2380 | Return the modified alist. | 2363 | Return the modified alist. |
| 2381 | Elements of ALIST that are not conses are ignored." | 2364 | Elements of ALIST that are not conses are ignored." |
| 2382 | (let ((tail alist)) | 2365 | (while (and (consp (car alist)) |
| 2383 | (while tail | 2366 | (eq (car (car alist)) key)) |
| 2384 | (if (and (consp (car tail)) (eq (car (car tail)) key)) | 2367 | (setq alist (cdr alist))) |
| 2385 | (setq alist (delq (car tail) alist))) | 2368 | (let ((tail alist) tail-cdr) |
| 2386 | (setq tail (cdr tail))) | 2369 | (while (setq tail-cdr (cdr tail)) |
| 2387 | alist)) | 2370 | (if (and (consp (car tail-cdr)) |
| 2371 | (eq (car (car tail-cdr)) key)) | ||
| 2372 | (setcdr tail (cdr tail-cdr)) | ||
| 2373 | (setq tail tail-cdr)))) | ||
| 2374 | alist) | ||
| 2375 | |||
| 2376 | (defun rassq-delete-all (value alist) | ||
| 2377 | "Delete from ALIST all elements whose cdr is `eq' to VALUE. | ||
| 2378 | Return the modified alist. | ||
| 2379 | Elements of ALIST that are not conses are ignored." | ||
| 2380 | (while (and (consp (car alist)) | ||
| 2381 | (eq (cdr (car alist)) value)) | ||
| 2382 | (setq alist (cdr alist))) | ||
| 2383 | (let ((tail alist) tail-cdr) | ||
| 2384 | (while (setq tail-cdr (cdr tail)) | ||
| 2385 | (if (and (consp (car tail-cdr)) | ||
| 2386 | (eq (cdr (car tail-cdr)) value)) | ||
| 2387 | (setcdr tail (cdr tail-cdr)) | ||
| 2388 | (setq tail tail-cdr)))) | ||
| 2389 | alist) | ||
| 2388 | 2390 | ||
| 2389 | (defun make-temp-file (prefix &optional dir-flag suffix) | 2391 | (defun make-temp-file (prefix &optional dir-flag suffix) |
| 2390 | "Create a temporary file. | 2392 | "Create a temporary file. |
diff --git a/lisp/term.el b/lisp/term.el index 8cfc11f3dba..1e04f7ac015 100644 --- a/lisp/term.el +++ b/lisp/term.el | |||
| @@ -711,9 +711,10 @@ Buffer local variable.") | |||
| 711 | :group 'term | 711 | :group 'term |
| 712 | :type 'string) | 712 | :type 'string) |
| 713 | 713 | ||
| 714 | ;;; Use the same colors that xterm uses, see `xterm-standard-colors'. | ||
| 714 | (defvar ansi-term-color-vector | 715 | (defvar ansi-term-color-vector |
| 715 | [unspecified "black" "red" "green" "yellow" "blue" | 716 | [unspecified "black" "red3" "green3" "yellow3" "blue2" |
| 716 | "magenta" "cyan" "white"]) | 717 | "magenta3" "cyan3" "white"]) |
| 717 | 718 | ||
| 718 | ;;; Inspiration came from comint.el -mm | 719 | ;;; Inspiration came from comint.el -mm |
| 719 | (defvar term-buffer-maximum-size 2048 | 720 | (defvar term-buffer-maximum-size 2048 |
| @@ -886,7 +887,9 @@ is buffer-local.") | |||
| 886 | (i 0)) | 887 | (i 0)) |
| 887 | (while (< i 128) | 888 | (while (< i 128) |
| 888 | (define-key map (make-string 1 i) 'term-send-raw) | 889 | (define-key map (make-string 1 i) 'term-send-raw) |
| 889 | (define-key esc-map (make-string 1 i) 'term-send-raw-meta) | 890 | ;; Avoid O and [. They are used in escape sequences for various keys. |
| 891 | (unless (or (eq i ?O) (eq i 91)) | ||
| 892 | (define-key esc-map (make-string 1 i) 'term-send-raw-meta)) | ||
| 890 | (setq i (1+ i))) | 893 | (setq i (1+ i))) |
| 891 | (define-key map "\e" esc-map) | 894 | (define-key map "\e" esc-map) |
| 892 | (setq term-raw-map map) | 895 | (setq term-raw-map map) |
| @@ -907,6 +910,7 @@ is buffer-local.") | |||
| 907 | (define-key term-raw-map [right] 'term-send-right) | 910 | (define-key term-raw-map [right] 'term-send-right) |
| 908 | (define-key term-raw-map [left] 'term-send-left) | 911 | (define-key term-raw-map [left] 'term-send-left) |
| 909 | (define-key term-raw-map [delete] 'term-send-del) | 912 | (define-key term-raw-map [delete] 'term-send-del) |
| 913 | (define-key term-raw-map [deletechar] 'term-send-del) | ||
| 910 | (define-key term-raw-map [backspace] 'term-send-backspace) | 914 | (define-key term-raw-map [backspace] 'term-send-backspace) |
| 911 | (define-key term-raw-map [home] 'term-send-home) | 915 | (define-key term-raw-map [home] 'term-send-home) |
| 912 | (define-key term-raw-map [end] 'term-send-end) | 916 | (define-key term-raw-map [end] 'term-send-end) |
diff --git a/lisp/term/mac-win.el b/lisp/term/mac-win.el index d5f1e273988..2c5684091ad 100644 --- a/lisp/term/mac-win.el +++ b/lisp/term/mac-win.el | |||
| @@ -74,7 +74,7 @@ | |||
| 74 | (require 'mouse) | 74 | (require 'mouse) |
| 75 | (require 'scroll-bar) | 75 | (require 'scroll-bar) |
| 76 | (require 'faces) | 76 | (require 'faces) |
| 77 | ;;(require 'select) | 77 | (require 'select) |
| 78 | (require 'menu-bar) | 78 | (require 'menu-bar) |
| 79 | (require 'fontset) | 79 | (require 'fontset) |
| 80 | (require 'dnd) | 80 | (require 'dnd) |
| @@ -1143,23 +1143,232 @@ correspoinding TextEncodingBase value." | |||
| 1143 | 1143 | ||
| 1144 | (define-key special-event-map [language-change] 'mac-handle-language-change) | 1144 | (define-key special-event-map [language-change] 'mac-handle-language-change) |
| 1145 | 1145 | ||
| 1146 | ;;;; Selections and cut buffers | 1146 | ;;;; Selections and Services menu |
| 1147 | 1147 | ||
| 1148 | ;; Setup to use the Mac clipboard. The functions mac-cut-function and | 1148 | ;; Setup to use the Mac clipboard. |
| 1149 | ;; mac-paste-function are defined in mac.c. | 1149 | (set-selection-coding-system mac-system-coding-system) |
| 1150 | (set-selection-coding-system 'compound-text-mac) | 1150 | |
| 1151 | 1151 | ;;; We keep track of the last text selected here, so we can check the | |
| 1152 | (setq interprogram-cut-function | 1152 | ;;; current selection against it, and avoid passing back our own text |
| 1153 | '(lambda (str push) | 1153 | ;;; from x-get-selection-value. |
| 1154 | (mac-cut-function | 1154 | (defvar x-last-selected-text-clipboard nil |
| 1155 | (encode-coding-string str selection-coding-system t) push))) | 1155 | "The value of the CLIPBOARD selection last time we selected or |
| 1156 | 1156 | pasted text.") | |
| 1157 | (setq interprogram-paste-function | 1157 | (defvar x-last-selected-text-primary nil |
| 1158 | '(lambda () | 1158 | "The value of the PRIMARY X selection last time we selected or |
| 1159 | (let ((clipboard (mac-paste-function))) | 1159 | pasted text.") |
| 1160 | (if clipboard | 1160 | |
| 1161 | (decode-coding-string clipboard selection-coding-system t))))) | 1161 | (defcustom x-select-enable-clipboard t |
| 1162 | 1162 | "*Non-nil means cutting and pasting uses the clipboard. | |
| 1163 | This is in addition to the primary selection." | ||
| 1164 | :type 'boolean | ||
| 1165 | :group 'killing) | ||
| 1166 | |||
| 1167 | ;;; Make TEXT, a string, the primary X selection. | ||
| 1168 | (defun x-select-text (text &optional push) | ||
| 1169 | (x-set-selection 'PRIMARY text) | ||
| 1170 | (setq x-last-selected-text-primary text) | ||
| 1171 | (when x-select-enable-clipboard | ||
| 1172 | (x-set-selection 'CLIPBOARD text) | ||
| 1173 | (setq x-last-selected-text-clipboard text)) | ||
| 1174 | ) | ||
| 1175 | |||
| 1176 | (defun x-get-selection (&optional type data-type) | ||
| 1177 | "Return the value of a selection. | ||
| 1178 | The argument TYPE (default `PRIMARY') says which selection, | ||
| 1179 | and the argument DATA-TYPE (default `STRING') says | ||
| 1180 | how to convert the data. | ||
| 1181 | |||
| 1182 | TYPE may be any symbol \(but nil stands for `PRIMARY'). However, | ||
| 1183 | only a few symbols are commonly used. They conventionally have | ||
| 1184 | all upper-case names. The most often used ones, in addition to | ||
| 1185 | `PRIMARY', are `SECONDARY' and `CLIPBOARD'. | ||
| 1186 | |||
| 1187 | DATA-TYPE is usually `STRING', but can also be one of the symbols | ||
| 1188 | in `selection-converter-alist', which see." | ||
| 1189 | (let ((data (x-get-selection-internal (or type 'PRIMARY) | ||
| 1190 | (or data-type 'STRING))) | ||
| 1191 | (coding (or next-selection-coding-system | ||
| 1192 | selection-coding-system))) | ||
| 1193 | (when (and (stringp data) | ||
| 1194 | (setq data-type (get-text-property 0 'foreign-selection data))) | ||
| 1195 | (cond ((eq data-type 'public.utf16-plain-text) | ||
| 1196 | (let ((encoded (and (fboundp 'mac-code-convert-string) | ||
| 1197 | (mac-code-convert-string data | ||
| 1198 | 'utf-16 coding)))) | ||
| 1199 | (if encoded | ||
| 1200 | (let ((coding-save last-coding-system-used)) | ||
| 1201 | (setq data (decode-coding-string encoded coding)) | ||
| 1202 | (setq last-coding-system-used coding-save)) | ||
| 1203 | (setq data | ||
| 1204 | (decode-coding-string data 'utf-16))))) | ||
| 1205 | ((eq data-type 'com.apple.traditional-mac-plain-text) | ||
| 1206 | (setq data (decode-coding-string data coding)))) | ||
| 1207 | (put-text-property 0 (length data) 'foreign-selection data-type data)) | ||
| 1208 | data)) | ||
| 1209 | |||
| 1210 | (defun x-selection-value (type) | ||
| 1211 | (let (text tiff-image) | ||
| 1212 | (setq text (condition-case nil | ||
| 1213 | (x-get-selection type 'public.utf16-plain-text) | ||
| 1214 | (error nil))) | ||
| 1215 | (if (not text) | ||
| 1216 | (setq text (condition-case nil | ||
| 1217 | (x-get-selection type | ||
| 1218 | 'com.apple.traditional-mac-plain-text) | ||
| 1219 | (error nil)))) | ||
| 1220 | (if text | ||
| 1221 | (remove-text-properties 0 (length text) '(foreign-selection nil) text)) | ||
| 1222 | (setq tiff-image (condition-case nil | ||
| 1223 | (x-get-selection type 'public.tiff) | ||
| 1224 | (error nil))) | ||
| 1225 | (when tiff-image | ||
| 1226 | (remove-text-properties 0 (length tiff-image) | ||
| 1227 | '(foreign-selection nil) tiff-image) | ||
| 1228 | (setq tiff-image (create-image tiff-image 'tiff t)) | ||
| 1229 | (or text (setq text " ")) | ||
| 1230 | (put-text-property 0 (length text) 'display tiff-image text)) | ||
| 1231 | text)) | ||
| 1232 | |||
| 1233 | ;;; Return the value of the current selection. | ||
| 1234 | ;;; Treat empty strings as if they were unset. | ||
| 1235 | ;;; If this function is called twice and finds the same text, | ||
| 1236 | ;;; it returns nil the second time. This is so that a single | ||
| 1237 | ;;; selection won't be added to the kill ring over and over. | ||
| 1238 | (defun x-get-selection-value () | ||
| 1239 | (let (clip-text primary-text) | ||
| 1240 | (when x-select-enable-clipboard | ||
| 1241 | (setq clip-text (x-selection-value 'CLIPBOARD)) | ||
| 1242 | (if (string= clip-text "") (setq clip-text nil)) | ||
| 1243 | |||
| 1244 | ;; Check the CLIPBOARD selection for 'newness', is it different | ||
| 1245 | ;; from what we remebered them to be last time we did a | ||
| 1246 | ;; cut/paste operation. | ||
| 1247 | (setq clip-text | ||
| 1248 | (cond;; check clipboard | ||
| 1249 | ((or (not clip-text) (string= clip-text "")) | ||
| 1250 | (setq x-last-selected-text-clipboard nil)) | ||
| 1251 | ((eq clip-text x-last-selected-text-clipboard) nil) | ||
| 1252 | ((string= clip-text x-last-selected-text-clipboard) | ||
| 1253 | ;; Record the newer string, | ||
| 1254 | ;; so subsequent calls can use the `eq' test. | ||
| 1255 | (setq x-last-selected-text-clipboard clip-text) | ||
| 1256 | nil) | ||
| 1257 | (t | ||
| 1258 | (setq x-last-selected-text-clipboard clip-text)))) | ||
| 1259 | ) | ||
| 1260 | |||
| 1261 | (setq primary-text (x-selection-value 'PRIMARY)) | ||
| 1262 | ;; Check the PRIMARY selection for 'newness', is it different | ||
| 1263 | ;; from what we remebered them to be last time we did a | ||
| 1264 | ;; cut/paste operation. | ||
| 1265 | (setq primary-text | ||
| 1266 | (cond;; check primary selection | ||
| 1267 | ((or (not primary-text) (string= primary-text "")) | ||
| 1268 | (setq x-last-selected-text-primary nil)) | ||
| 1269 | ((eq primary-text x-last-selected-text-primary) nil) | ||
| 1270 | ((string= primary-text x-last-selected-text-primary) | ||
| 1271 | ;; Record the newer string, | ||
| 1272 | ;; so subsequent calls can use the `eq' test. | ||
| 1273 | (setq x-last-selected-text-primary primary-text) | ||
| 1274 | nil) | ||
| 1275 | (t | ||
| 1276 | (setq x-last-selected-text-primary primary-text)))) | ||
| 1277 | |||
| 1278 | ;; As we have done one selection, clear this now. | ||
| 1279 | (setq next-selection-coding-system nil) | ||
| 1280 | |||
| 1281 | ;; At this point we have recorded the current values for the | ||
| 1282 | ;; selection from clipboard (if we are supposed to) and primary, | ||
| 1283 | ;; So return the first one that has changed (which is the first | ||
| 1284 | ;; non-null one). | ||
| 1285 | (or clip-text primary-text) | ||
| 1286 | )) | ||
| 1287 | |||
| 1288 | (put 'CLIPBOARD 'mac-scrap-name "com.apple.scrap.clipboard") | ||
| 1289 | (if (eq system-type 'darwin) | ||
| 1290 | (put 'FIND 'mac-scrap-name "com.apple.scrap.find")) | ||
| 1291 | (put 'com.apple.traditional-mac-plain-text 'mac-ostype "TEXT") | ||
| 1292 | (put 'public.utf16-plain-text 'mac-ostype "utxt") | ||
| 1293 | (put 'public.tiff 'mac-ostype "TIFF") | ||
| 1294 | |||
| 1295 | (defun mac-select-convert-to-string (selection type value) | ||
| 1296 | (let ((str (cdr (xselect-convert-to-string selection nil value))) | ||
| 1297 | coding) | ||
| 1298 | (setq coding (or next-selection-coding-system selection-coding-system)) | ||
| 1299 | (if coding | ||
| 1300 | (setq coding (coding-system-base coding)) | ||
| 1301 | (setq coding 'raw-text)) | ||
| 1302 | (when str | ||
| 1303 | ;; If TYPE is nil, this is a local request, thus return STR as | ||
| 1304 | ;; is. Otherwise, encode STR. | ||
| 1305 | (if (not type) | ||
| 1306 | str | ||
| 1307 | (let ((inhibit-read-only t)) | ||
| 1308 | (remove-text-properties 0 (length str) '(composition nil) str) | ||
| 1309 | (cond | ||
| 1310 | ((eq type 'public.utf16-plain-text) | ||
| 1311 | (let (s) | ||
| 1312 | (when (and (fboundp 'mac-code-convert-string) | ||
| 1313 | (memq coding (find-coding-systems-string str))) | ||
| 1314 | (setq coding (coding-system-change-eol-conversion coding 'mac)) | ||
| 1315 | (setq s (mac-code-convert-string | ||
| 1316 | (encode-coding-string str coding) | ||
| 1317 | coding 'utf-16))) | ||
| 1318 | (setq str (or s (encode-coding-string str 'utf-16-mac))))) | ||
| 1319 | ((eq type 'com.apple.traditional-mac-plain-text) | ||
| 1320 | (setq coding (coding-system-change-eol-conversion coding 'mac)) | ||
| 1321 | (setq str (encode-coding-string str coding))) | ||
| 1322 | (t | ||
| 1323 | (error "Unknown selection type: %S" type)) | ||
| 1324 | ))) | ||
| 1325 | |||
| 1326 | (setq next-selection-coding-system nil) | ||
| 1327 | (cons type str)))) | ||
| 1328 | |||
| 1329 | (setq selection-converter-alist | ||
| 1330 | (nconc | ||
| 1331 | '((public.utf16-plain-text . mac-select-convert-to-string) | ||
| 1332 | (com.apple.traditional-mac-plain-text . mac-select-convert-to-string) | ||
| 1333 | ;; This is not enabled by default because the `Import Image' | ||
| 1334 | ;; menu makes Emacs crash or hang for unknown reasons. | ||
| 1335 | ;; (public.tiff . nil) | ||
| 1336 | ) | ||
| 1337 | selection-converter-alist)) | ||
| 1338 | |||
| 1339 | (defun mac-services-open-file () | ||
| 1340 | (interactive) | ||
| 1341 | (find-file-existing (x-selection-value mac-services-selection))) | ||
| 1342 | |||
| 1343 | (defun mac-services-open-selection () | ||
| 1344 | (interactive) | ||
| 1345 | (switch-to-buffer (generate-new-buffer "*untitled*")) | ||
| 1346 | (insert (x-selection-value mac-services-selection)) | ||
| 1347 | (sit-for 0) | ||
| 1348 | (save-buffer) ; It pops up the save dialog. | ||
| 1349 | ) | ||
| 1350 | |||
| 1351 | (defun mac-services-insert-text () | ||
| 1352 | (interactive) | ||
| 1353 | (let ((text (x-selection-value mac-services-selection))) | ||
| 1354 | (if (not buffer-read-only) | ||
| 1355 | (insert text) | ||
| 1356 | (kill-new text) | ||
| 1357 | (message | ||
| 1358 | (substitute-command-keys | ||
| 1359 | "The text from the Services menu can be accessed with \\[yank]"))))) | ||
| 1360 | |||
| 1361 | (defvar mac-application-menu-map (make-sparse-keymap)) | ||
| 1362 | (define-key mac-application-menu-map [quit] 'save-buffers-kill-emacs) | ||
| 1363 | (define-key mac-application-menu-map [services perform open-file] | ||
| 1364 | 'mac-services-open-file) | ||
| 1365 | (define-key mac-application-menu-map [services perform open-selection] | ||
| 1366 | 'mac-services-open-selection) | ||
| 1367 | (define-key mac-application-menu-map [services paste] | ||
| 1368 | 'mac-services-insert-text) | ||
| 1369 | (define-key mac-application-menu-map [preferences] 'customize) | ||
| 1370 | (define-key mac-application-menu-map [about] 'display-splash-screen) | ||
| 1371 | (global-set-key [menu-bar application] mac-application-menu-map) | ||
| 1163 | 1372 | ||
| 1164 | ;;; Do the actual Windows setup here; the above code just defines | 1373 | ;;; Do the actual Windows setup here; the above code just defines |
| 1165 | ;;; functions and variables that we use now. | 1374 | ;;; functions and variables that we use now. |
| @@ -1444,12 +1653,25 @@ It returns a name of the created fontset." | |||
| 1444 | (error "Suspending an Emacs running under Mac makes no sense")) | 1653 | (error "Suspending an Emacs running under Mac makes no sense")) |
| 1445 | (add-hook 'suspend-hook 'x-win-suspend-error) | 1654 | (add-hook 'suspend-hook 'x-win-suspend-error) |
| 1446 | 1655 | ||
| 1656 | ;;; Arrange for the kill and yank functions to set and check the clipboard. | ||
| 1657 | (setq interprogram-cut-function 'x-select-text) | ||
| 1658 | (setq interprogram-paste-function 'x-get-selection-value) | ||
| 1659 | |||
| 1660 | |||
| 1661 | ;;; Turn off window-splitting optimization; Mac is usually fast enough | ||
| 1662 | ;;; that this is only annoying. | ||
| 1663 | (setq split-window-keep-point t) | ||
| 1664 | |||
| 1447 | ;; Don't show the frame name; that's redundant. | 1665 | ;; Don't show the frame name; that's redundant. |
| 1448 | (setq-default mode-line-frame-identification " ") | 1666 | (setq-default mode-line-frame-identification " ") |
| 1449 | 1667 | ||
| 1450 | ;; Turn on support for mouse wheels. | 1668 | ;; Turn on support for mouse wheels. |
| 1451 | (mouse-wheel-mode 1) | 1669 | (mouse-wheel-mode 1) |
| 1452 | 1670 | ||
| 1671 | |||
| 1672 | ;; Enable CLIPBOARD copy/paste through menu bar commands. | ||
| 1673 | (menu-bar-enable-clipboard) | ||
| 1674 | |||
| 1453 | (defun mac-drag-n-drop (event) | 1675 | (defun mac-drag-n-drop (event) |
| 1454 | "Edit the files listed in the drag-n-drop EVENT. | 1676 | "Edit the files listed in the drag-n-drop EVENT. |
| 1455 | Switch to a buffer editing the last file dropped." | 1677 | Switch to a buffer editing the last file dropped." |
diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el index 23a25dee827..d4fe99f1f6a 100644 --- a/lisp/term/xterm.el +++ b/lisp/term/xterm.el | |||
| @@ -26,6 +26,66 @@ | |||
| 26 | 26 | ||
| 27 | ;;; Code: | 27 | ;;; Code: |
| 28 | 28 | ||
| 29 | ;;; The terminal intialization C code file might have initialized | ||
| 30 | ;;; function keys F13->F60 from the termcap/terminfo information. On | ||
| 31 | ;;; a PC-style keyboard these keys correspond to | ||
| 32 | ;;; MODIFIER-FUNCTION_KEY, where modifier is S-, C, A-, C-S-. The | ||
| 33 | ;;; code here subsitutes the corresponding defintions in | ||
| 34 | ;;; function-key-map. This substitution is needed because if a key | ||
| 35 | ;;; definition if found in function-key-map, there are no further | ||
| 36 | ;;; lookups in other keymaps. | ||
| 37 | (substitute-key-definition [f13] [S-f1] function-key-map) | ||
| 38 | (substitute-key-definition [f14] [S-f2] function-key-map) | ||
| 39 | (substitute-key-definition [f15] [S-f3] function-key-map) | ||
| 40 | (substitute-key-definition [f16] [S-f4] function-key-map) | ||
| 41 | (substitute-key-definition [f17] [S-f5] function-key-map) | ||
| 42 | (substitute-key-definition [f18] [S-f6] function-key-map) | ||
| 43 | (substitute-key-definition [f19] [S-f7] function-key-map) | ||
| 44 | (substitute-key-definition [f20] [S-f8] function-key-map) | ||
| 45 | (substitute-key-definition [f21] [S-f9] function-key-map) | ||
| 46 | (substitute-key-definition [f22] [S-f10] function-key-map) | ||
| 47 | (substitute-key-definition [f23] [S-f11] function-key-map) | ||
| 48 | (substitute-key-definition [f24] [S-f12] function-key-map) | ||
| 49 | |||
| 50 | (substitute-key-definition [f25] [C-f1] function-key-map) | ||
| 51 | (substitute-key-definition [f26] [C-f2] function-key-map) | ||
| 52 | (substitute-key-definition [f27] [C-f3] function-key-map) | ||
| 53 | (substitute-key-definition [f28] [C-f4] function-key-map) | ||
| 54 | (substitute-key-definition [f29] [C-f5] function-key-map) | ||
| 55 | (substitute-key-definition [f30] [C-f6] function-key-map) | ||
| 56 | (substitute-key-definition [f31] [C-f7] function-key-map) | ||
| 57 | (substitute-key-definition [f32] [C-f8] function-key-map) | ||
| 58 | (substitute-key-definition [f33] [C-f9] function-key-map) | ||
| 59 | (substitute-key-definition [f34] [C-f10] function-key-map) | ||
| 60 | (substitute-key-definition [f35] [C-f11] function-key-map) | ||
| 61 | (substitute-key-definition [f36] [C-f12] function-key-map) | ||
| 62 | |||
| 63 | (substitute-key-definition [f37] [C-S-f1] function-key-map) | ||
| 64 | (substitute-key-definition [f38] [C-S-f2] function-key-map) | ||
| 65 | (substitute-key-definition [f39] [C-S-f3] function-key-map) | ||
| 66 | (substitute-key-definition [f40] [C-S-f4] function-key-map) | ||
| 67 | (substitute-key-definition [f41] [C-S-f5] function-key-map) | ||
| 68 | (substitute-key-definition [f42] [C-S-f6] function-key-map) | ||
| 69 | (substitute-key-definition [f43] [C-S-f7] function-key-map) | ||
| 70 | (substitute-key-definition [f44] [C-S-f8] function-key-map) | ||
| 71 | (substitute-key-definition [f45] [C-S-f9] function-key-map) | ||
| 72 | (substitute-key-definition [f46] [C-S-f10] function-key-map) | ||
| 73 | (substitute-key-definition [f47] [C-S-f11] function-key-map) | ||
| 74 | (substitute-key-definition [f48] [C-S-f12] function-key-map) | ||
| 75 | |||
| 76 | (substitute-key-definition [f49] [A-f1] function-key-map) | ||
| 77 | (substitute-key-definition [f50] [A-f2] function-key-map) | ||
| 78 | (substitute-key-definition [f51] [A-f3] function-key-map) | ||
| 79 | (substitute-key-definition [f52] [A-f4] function-key-map) | ||
| 80 | (substitute-key-definition [f53] [A-f5] function-key-map) | ||
| 81 | (substitute-key-definition [f54] [A-f6] function-key-map) | ||
| 82 | (substitute-key-definition [f55] [A-f7] function-key-map) | ||
| 83 | (substitute-key-definition [f56] [A-f8] function-key-map) | ||
| 84 | (substitute-key-definition [f57] [A-f9] function-key-map) | ||
| 85 | (substitute-key-definition [f58] [A-f10] function-key-map) | ||
| 86 | (substitute-key-definition [f59] [A-f11] function-key-map) | ||
| 87 | (substitute-key-definition [f60] [A-f12] function-key-map) | ||
| 88 | |||
| 29 | (let ((map (make-sparse-keymap))) | 89 | (let ((map (make-sparse-keymap))) |
| 30 | (define-key map "\e[A" [up]) | 90 | (define-key map "\e[A" [up]) |
| 31 | (define-key map "\e[B" [down]) | 91 | (define-key map "\e[B" [down]) |
| @@ -51,10 +111,15 @@ | |||
| 51 | (define-key map "\e[24~" [f12]) | 111 | (define-key map "\e[24~" [f12]) |
| 52 | (define-key map "\e[29~" [print]) | 112 | (define-key map "\e[29~" [print]) |
| 53 | 113 | ||
| 54 | (define-key map "\e[11;2~" [S-f1]) | 114 | (define-key map "\eOP" [f1]) |
| 55 | (define-key map "\e[12;2~" [S-f2]) | 115 | (define-key map "\eOQ" [f2]) |
| 56 | (define-key map "\e[13;2~" [S-f3]) | 116 | (define-key map "\eOR" [f3]) |
| 57 | (define-key map "\e[14;2~" [S-f4]) | 117 | (define-key map "\eOS" [f4]) |
| 118 | |||
| 119 | (define-key map "\eO2P" [S-f1]) | ||
| 120 | (define-key map "\eO2Q" [S-f2]) | ||
| 121 | (define-key map "\eO2R" [S-f3]) | ||
| 122 | (define-key map "\eO2S" [S-f4]) | ||
| 58 | (define-key map "\e[15;2~" [S-f5]) | 123 | (define-key map "\e[15;2~" [S-f5]) |
| 59 | (define-key map "\e[17;2~" [S-f6]) | 124 | (define-key map "\e[17;2~" [S-f6]) |
| 60 | (define-key map "\e[18;2~" [S-f7]) | 125 | (define-key map "\e[18;2~" [S-f7]) |
| @@ -64,10 +129,10 @@ | |||
| 64 | (define-key map "\e[23;2~" [S-f11]) | 129 | (define-key map "\e[23;2~" [S-f11]) |
| 65 | (define-key map "\e[24;2~" [S-f12]) | 130 | (define-key map "\e[24;2~" [S-f12]) |
| 66 | 131 | ||
| 67 | (define-key map "\e[11;5~" [C-f1]) | 132 | (define-key map "\eO5P" [C-f1]) |
| 68 | (define-key map "\e[12;5~" [C-f2]) | 133 | (define-key map "\eO5Q" [C-f2]) |
| 69 | (define-key map "\e[13;5~" [C-f3]) | 134 | (define-key map "\eO5R" [C-f3]) |
| 70 | (define-key map "\e[14;5~" [C-f4]) | 135 | (define-key map "\eO5S" [C-f4]) |
| 71 | (define-key map "\e[15;5~" [C-f5]) | 136 | (define-key map "\e[15;5~" [C-f5]) |
| 72 | (define-key map "\e[17;5~" [C-f6]) | 137 | (define-key map "\e[17;5~" [C-f6]) |
| 73 | (define-key map "\e[18;5~" [C-f7]) | 138 | (define-key map "\e[18;5~" [C-f7]) |
| @@ -77,10 +142,10 @@ | |||
| 77 | (define-key map "\e[23;5~" [C-f11]) | 142 | (define-key map "\e[23;5~" [C-f11]) |
| 78 | (define-key map "\e[24;5~" [C-f12]) | 143 | (define-key map "\e[24;5~" [C-f12]) |
| 79 | 144 | ||
| 80 | (define-key map "\e[11;6~" [C-S-f1]) | 145 | (define-key map "\eO6P" [C-S-f1]) |
| 81 | (define-key map "\e[12;6~" [C-S-f2]) | 146 | (define-key map "\eO6Q" [C-S-f2]) |
| 82 | (define-key map "\e[13;6~" [C-S-f3]) | 147 | (define-key map "\eO6R" [C-S-f3]) |
| 83 | (define-key map "\e[14;6~" [C-S-f4]) | 148 | (define-key map "\eO6S" [C-S-f4]) |
| 84 | (define-key map "\e[15;6~" [C-S-f5]) | 149 | (define-key map "\e[15;6~" [C-S-f5]) |
| 85 | (define-key map "\e[17;6~" [C-S-f6]) | 150 | (define-key map "\e[17;6~" [C-S-f6]) |
| 86 | (define-key map "\e[18;6~" [C-S-f7]) | 151 | (define-key map "\e[18;6~" [C-S-f7]) |
| @@ -90,10 +155,10 @@ | |||
| 90 | (define-key map "\e[23;6~" [C-S-f11]) | 155 | (define-key map "\e[23;6~" [C-S-f11]) |
| 91 | (define-key map "\e[24;6~" [C-S-f12]) | 156 | (define-key map "\e[24;6~" [C-S-f12]) |
| 92 | 157 | ||
| 93 | (define-key map "\e[11;3~" [A-f1]) | 158 | (define-key map "\eO3P" [A-f1]) |
| 94 | (define-key map "\e[12;3~" [A-f2]) | 159 | (define-key map "\eO3Q" [A-f2]) |
| 95 | (define-key map "\e[13;3~" [A-f3]) | 160 | (define-key map "\eO3R" [A-f3]) |
| 96 | (define-key map "\e[14;3~" [A-f4]) | 161 | (define-key map "\eO3S" [A-f4]) |
| 97 | (define-key map "\e[15;3~" [A-f5]) | 162 | (define-key map "\e[15;3~" [A-f5]) |
| 98 | (define-key map "\e[17;3~" [A-f6]) | 163 | (define-key map "\e[17;3~" [A-f6]) |
| 99 | (define-key map "\e[18;3~" [A-f7]) | 164 | (define-key map "\e[18;3~" [A-f7]) |
diff --git a/lisp/textmodes/org.el b/lisp/textmodes/org.el index c162160397e..2c0d1bea77c 100644 --- a/lisp/textmodes/org.el +++ b/lisp/textmodes/org.el | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ;; Author: Carsten Dominik <dominik at science dot uva dot nl> | 5 | ;; Author: Carsten Dominik <dominik at science dot uva dot nl> |
| 6 | ;; Keywords: outlines, hypermedia, calendar | 6 | ;; Keywords: outlines, hypermedia, calendar |
| 7 | ;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/ | 7 | ;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/ |
| 8 | ;; Version: 3.06 | 8 | ;; Version: 3.08 |
| 9 | ;; | 9 | ;; |
| 10 | ;; This file is part of GNU Emacs. | 10 | ;; This file is part of GNU Emacs. |
| 11 | ;; | 11 | ;; |
| @@ -79,6 +79,16 @@ | |||
| 79 | ;; | 79 | ;; |
| 80 | ;; Changes: | 80 | ;; Changes: |
| 81 | ;; ------- | 81 | ;; ------- |
| 82 | ;; Version 3.08 | ||
| 83 | ;; - "|" no longer allowed as part of a link, to allow links in tables. | ||
| 84 | ;; - The prefix of items in the agenda buffer can be configured. | ||
| 85 | ;; - Cleanup. | ||
| 86 | ;; | ||
| 87 | ;; Version 3.07 | ||
| 88 | ;; - Some folding incinsistencies removed. | ||
| 89 | ;; - BBDB links to company-only entries. | ||
| 90 | ;; - Bug fixes and global cleanup. | ||
| 91 | ;; | ||
| 82 | ;; Version 3.06 | 92 | ;; Version 3.06 |
| 83 | ;; - M-S-RET inserts a new TODO heading. | 93 | ;; - M-S-RET inserts a new TODO heading. |
| 84 | ;; - New startup option `content'. | 94 | ;; - New startup option `content'. |
| @@ -131,14 +141,14 @@ | |||
| 131 | 141 | ||
| 132 | ;;; Code: | 142 | ;;; Code: |
| 133 | 143 | ||
| 134 | (eval-when-compile (require 'cl)) | 144 | (eval-when-compile (require 'cl) (require 'calendar)) |
| 135 | (require 'outline) | 145 | (require 'outline) |
| 136 | (require 'time-date) | 146 | (require 'time-date) |
| 137 | (require 'easymenu) | 147 | (require 'easymenu) |
| 138 | 148 | ||
| 139 | ;;; Customization variables | 149 | ;;; Customization variables |
| 140 | 150 | ||
| 141 | (defvar org-version "3.06" | 151 | (defvar org-version "3.08" |
| 142 | "The version number of the file org.el.") | 152 | "The version number of the file org.el.") |
| 143 | (defun org-version () | 153 | (defun org-version () |
| 144 | (interactive) | 154 | (interactive) |
| @@ -194,8 +204,7 @@ This can also be configured on a per-file basis by adding one of | |||
| 194 | the following lines anywhere in the buffer: | 204 | the following lines anywhere in the buffer: |
| 195 | 205 | ||
| 196 | #+STARTUP: dlcheck | 206 | #+STARTUP: dlcheck |
| 197 | #+STARTUP: nodlcheck | 207 | #+STARTUP: nodlcheck" |
| 198 | " | ||
| 199 | :group 'org-startup | 208 | :group 'org-startup |
| 200 | :type 'boolean) | 209 | :type 'boolean) |
| 201 | 210 | ||
| @@ -215,8 +224,8 @@ has been set." | |||
| 215 | :group 'org) | 224 | :group 'org) |
| 216 | 225 | ||
| 217 | (defcustom org-todo-keywords '("TODO" "DONE") | 226 | (defcustom org-todo-keywords '("TODO" "DONE") |
| 218 | "List of TODO entry keywords.\\<org-mode-map> | 227 | "List of TODO entry keywords. |
| 219 | By default, this is '(\"TODO\" \"DONE\"). The last entry in the list is | 228 | \\<org-mode-map>By default, this is '(\"TODO\" \"DONE\"). The last entry in the list is |
| 220 | considered to mean that the entry is \"done\". All the other mean that | 229 | considered to mean that the entry is \"done\". All the other mean that |
| 221 | action is required, and will make the entry show up in todo lists, diaries | 230 | action is required, and will make the entry show up in todo lists, diaries |
| 222 | etc. | 231 | etc. |
| @@ -228,8 +237,8 @@ Changes become only effective after restarting Emacs." | |||
| 228 | :type '(repeat (string :tag "Keyword"))) | 237 | :type '(repeat (string :tag "Keyword"))) |
| 229 | 238 | ||
| 230 | (defcustom org-todo-interpretation 'sequence | 239 | (defcustom org-todo-interpretation 'sequence |
| 231 | "Controls how TODO keywords are interpreted.\\<org-mode-map> | 240 | "Controls how TODO keywords are interpreted. |
| 232 | Possible values are `sequence' and `type'. | 241 | \\<org-mode-map>Possible values are `sequence' and `type'. |
| 233 | This variable is only relevant if `org-todo-keywords' contains more than two | 242 | This variable is only relevant if `org-todo-keywords' contains more than two |
| 234 | states. There are two ways how these keywords can be used: | 243 | states. There are two ways how these keywords can be used: |
| 235 | 244 | ||
| @@ -256,7 +265,7 @@ RELAXED. If you later return to this entry and press \\[org-todo] again, | |||
| 256 | RELAXED will not be changed REMIND, but directly to DONE. | 265 | RELAXED will not be changed REMIND, but directly to DONE. |
| 257 | 266 | ||
| 258 | You can create a large number of types. To initially select a | 267 | You can create a large number of types. To initially select a |
| 259 | type, it is then best to use C-u \\[org-todo] in order to specify the | 268 | type, it is then best to use \\[universal-argument] \\[org-todo] in order to specify the |
| 260 | type with completion. Of course, you can also type the keyword | 269 | type with completion. Of course, you can also type the keyword |
| 261 | directly into the buffer. M-TAB completes TODO keywords at the | 270 | directly into the buffer. M-TAB completes TODO keywords at the |
| 262 | beginning of a headline." | 271 | beginning of a headline." |
| @@ -304,7 +313,7 @@ Changes become only effective after restarting Emacs." | |||
| 304 | (defcustom org-after-todo-state-change-hook nil | 313 | (defcustom org-after-todo-state-change-hook nil |
| 305 | "Hook which is run after the state of a TODO item was changed. | 314 | "Hook which is run after the state of a TODO item was changed. |
| 306 | The new state (a string with a todo keyword, or nil) is available in the | 315 | The new state (a string with a todo keyword, or nil) is available in the |
| 307 | lisp variable `state'." | 316 | Lisp variable `state'." |
| 308 | :group 'org-keywords | 317 | :group 'org-keywords |
| 309 | :type 'hook) | 318 | :type 'hook) |
| 310 | 319 | ||
| @@ -313,7 +322,7 @@ lisp variable `state'." | |||
| 313 | "Do TODO items have priorities?") | 322 | "Do TODO items have priorities?") |
| 314 | (make-variable-buffer-local 'org-todo-kwd-priority-p) | 323 | (make-variable-buffer-local 'org-todo-kwd-priority-p) |
| 315 | (defvar org-todo-kwd-max-priority nil | 324 | (defvar org-todo-kwd-max-priority nil |
| 316 | "Maximum priority of TODO items") | 325 | "Maximum priority of TODO items.") |
| 317 | (make-variable-buffer-local 'org-todo-kwd-max-priority) | 326 | (make-variable-buffer-local 'org-todo-kwd-max-priority) |
| 318 | (defvar org-ds-keyword-length 12 | 327 | (defvar org-ds-keyword-length 12 |
| 319 | "Maximum length of the Deadline and SCHEDULED keywords.") | 328 | "Maximum length of the Deadline and SCHEDULED keywords.") |
| @@ -352,6 +361,15 @@ lisp variable `state'." | |||
| 352 | "Matches the SCHEDULED keyword together with a time stamp.") | 361 | "Matches the SCHEDULED keyword together with a time stamp.") |
| 353 | (make-variable-buffer-local 'org-scheduled-time-regexp) | 362 | (make-variable-buffer-local 'org-scheduled-time-regexp) |
| 354 | 363 | ||
| 364 | (defvar org-category nil | ||
| 365 | "Variable used by org files to set a category for agenda display. | ||
| 366 | Such files should use a file variable to set it, for example | ||
| 367 | |||
| 368 | -*- mode: org; org-category: \"ELisp\" | ||
| 369 | |||
| 370 | If the file does not specify a category, the file's base name | ||
| 371 | is used instead.") | ||
| 372 | |||
| 355 | (defun org-set-regexps-and-options () | 373 | (defun org-set-regexps-and-options () |
| 356 | "Precompute regular expressions for current buffer." | 374 | "Precompute regular expressions for current buffer." |
| 357 | (when (eq major-mode 'org-mode) | 375 | (when (eq major-mode 'org-mode) |
| @@ -359,8 +377,8 @@ lisp variable `state'." | |||
| 359 | '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO" "STARTUP"))) | 377 | '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO" "STARTUP"))) |
| 360 | (splitre "[ \t]+") | 378 | (splitre "[ \t]+") |
| 361 | kwds int key value cat) | 379 | kwds int key value cat) |
| 362 | (save-restriction | 380 | (save-excursion |
| 363 | (save-excursion | 381 | (save-restriction |
| 364 | (widen) | 382 | (widen) |
| 365 | (goto-char (point-min)) | 383 | (goto-char (point-min)) |
| 366 | (while (re-search-forward re nil t) | 384 | (while (re-search-forward re nil t) |
| @@ -383,7 +401,7 @@ lisp variable `state'." | |||
| 383 | (let ((opts (org-split-string value splitre)) | 401 | (let ((opts (org-split-string value splitre)) |
| 384 | (set '(("fold" org-startup-folded t) | 402 | (set '(("fold" org-startup-folded t) |
| 385 | ("nofold" org-startup-folded nil) | 403 | ("nofold" org-startup-folded nil) |
| 386 | ("content" org-startup-folded 'content) | 404 | ("content" org-startup-folded content) |
| 387 | ("dlcheck" org-startup-with-deadline-check t) | 405 | ("dlcheck" org-startup-with-deadline-check t) |
| 388 | ("nodlcheck" org-startup-with-deadline-check nil))) | 406 | ("nodlcheck" org-startup-with-deadline-check nil))) |
| 389 | l var val) | 407 | l var val) |
| @@ -515,8 +533,7 @@ the entries for specific days." | |||
| 515 | :type 'boolean) | 533 | :type 'boolean) |
| 516 | 534 | ||
| 517 | (defcustom org-agenda-include-diary nil | 535 | (defcustom org-agenda-include-diary nil |
| 518 | "Non-nil means, when preparing the agenda, also get the | 536 | "If non-nil, include in the agenda entries from the Emacs Calendar's diary." |
| 519 | entries from the emacs calendars diary." | ||
| 520 | :group 'org-agenda | 537 | :group 'org-agenda |
| 521 | :type 'boolean) | 538 | :type 'boolean) |
| 522 | 539 | ||
| @@ -566,6 +583,43 @@ categories by priority." | |||
| 566 | (const priority-up) | 583 | (const priority-up) |
| 567 | (const priority-down)))) | 584 | (const priority-down)))) |
| 568 | 585 | ||
| 586 | (defcustom org-agenda-prefix-format " %-12:c% s" | ||
| 587 | "Format specification for the prefix of items in the agenda buffer. | ||
| 588 | This format works similar to a printf format, with the following meaning: | ||
| 589 | |||
| 590 | %c the category of the item, \"Diary\" for entries from the diary, or | ||
| 591 | as given by the CATEGORY keyword or derived from the file name. | ||
| 592 | %t the time-of-day specification if one applies to the entry, in the | ||
| 593 | format HH:MM | ||
| 594 | %s Scheduling/Deadline information, a short string | ||
| 595 | |||
| 596 | In addition to the normal printf field modifiers like field width and | ||
| 597 | padding instructions, in this format you can also add an additional | ||
| 598 | punctuation or whitespace character just before the final format letter. | ||
| 599 | This character will be appended to the field value if the value is not | ||
| 600 | empty. For example, the format \"%-12:c\" leads to \"Diary: \" if | ||
| 601 | the category is \"Diary\". If the category were be empty, no additional | ||
| 602 | colon would be interted. | ||
| 603 | |||
| 604 | Including `%t' in the format string leads to a double time specification | ||
| 605 | because the headline/diary item will contain the time specification as | ||
| 606 | well. However, using `%t' in the format will result in a canonical 24 | ||
| 607 | hour time specification at a consistent position in the prefix, while the | ||
| 608 | time specification in the headline/diary item may be at any position and in | ||
| 609 | various formats. | ||
| 610 | Example: | ||
| 611 | (setq org-agenda-prefix-format \" %-12:c% t% s\")" | ||
| 612 | :type 'string | ||
| 613 | :group 'org-agenda) | ||
| 614 | |||
| 615 | (defcustom org-timeline-prefix-format " % s" | ||
| 616 | "Like `org-agenda-prefix-format', but for the timeline of a single file." | ||
| 617 | :type 'string | ||
| 618 | :group 'org-agenda) | ||
| 619 | |||
| 620 | (defvar org-prefix-format-compiled nil | ||
| 621 | "The compiled version of `org-???-prefix-format'.") | ||
| 622 | |||
| 569 | (defcustom org-sort-agenda-notime-is-late t | 623 | (defcustom org-sort-agenda-notime-is-late t |
| 570 | "Non-nil means, items without time are considered late. | 624 | "Non-nil means, items without time are considered late. |
| 571 | This is only relevant for sorting. When t, items which have no explicit | 625 | This is only relevant for sorting. When t, items which have no explicit |
| @@ -574,15 +628,6 @@ do have a time. When nil, the default time is before 0:00." | |||
| 574 | :group 'org-agenda | 628 | :group 'org-agenda |
| 575 | :type 'boolean) | 629 | :type 'boolean) |
| 576 | 630 | ||
| 577 | (defvar org-category nil | ||
| 578 | "Variable used by org files to set a category for agenda display. | ||
| 579 | Such files should use a file variable to set it, for example | ||
| 580 | |||
| 581 | -*- mode: org; org-category: \"ELisp\" | ||
| 582 | |||
| 583 | If the file does not specify a category, the file's base name | ||
| 584 | is used instead.") | ||
| 585 | |||
| 586 | (defgroup org-structure nil | 631 | (defgroup org-structure nil |
| 587 | "Options concerning structure editing in Org-mode." | 632 | "Options concerning structure editing in Org-mode." |
| 588 | :tag "Org Structure" | 633 | :tag "Org Structure" |
| @@ -647,7 +692,10 @@ unnecessary clutter." | |||
| 647 | 692 | ||
| 648 | (defcustom org-allow-space-in-links t | 693 | (defcustom org-allow-space-in-links t |
| 649 | "Non-nil means, file names in links may contain space characters. | 694 | "Non-nil means, file names in links may contain space characters. |
| 650 | When nil, it becomes possible to put several links into a line." | 695 | When nil, it becomes possible to put several links into a line. |
| 696 | Note that in tables, a link never extends accross fields, so in a table | ||
| 697 | it is always possible to put several links into a line. | ||
| 698 | Changing this varable requires a re-launch of Emacs of become effective." | ||
| 651 | :group 'org-link | 699 | :group 'org-link |
| 652 | :type 'boolean) | 700 | :type 'boolean) |
| 653 | 701 | ||
| @@ -667,7 +715,7 @@ The command `org-store-link' adds a link pointing to the current | |||
| 667 | location to an internal list. These links accumulate during a session. | 715 | location to an internal list. These links accumulate during a session. |
| 668 | The command `org-insert-link' can be used to insert links into any | 716 | The command `org-insert-link' can be used to insert links into any |
| 669 | Org-mode file (offering completion for all stored links). When this | 717 | Org-mode file (offering completion for all stored links). When this |
| 670 | option is nil, every link which has been inserted once using `C-c C-l' | 718 | option is nil, every link which has been inserted once using \\[org-insert-link] |
| 671 | will be removed from the list, to make completing the unused links | 719 | will be removed from the list, to make completing the unused links |
| 672 | more efficient." | 720 | more efficient." |
| 673 | :group 'org-link | 721 | :group 'org-link |
| @@ -682,15 +730,15 @@ When following a link with Emacs, it may often be useful to display | |||
| 682 | this link in another window or frame. This variable can be used to | 730 | this link in another window or frame. This variable can be used to |
| 683 | set this up for the different types of links. | 731 | set this up for the different types of links. |
| 684 | For VM, use any of | 732 | For VM, use any of |
| 685 | vm-visit-folder | 733 | `vm-visit-folder' |
| 686 | vm-visit-folder-other-frame | 734 | `vm-visit-folder-other-frame' |
| 687 | For Gnus, use any of | 735 | For Gnus, use any of |
| 688 | gnus | 736 | `gnus' |
| 689 | gnus-other-frame | 737 | `gnus-other-frame' |
| 690 | For FILE, use any of | 738 | For FILE, use any of |
| 691 | find-file | 739 | `find-file' |
| 692 | find-file-other-window | 740 | `find-file-other-window' |
| 693 | find-file-other-frame | 741 | `find-file-other-frame' |
| 694 | For the calendar, use the variable `calendar-setup'. | 742 | For the calendar, use the variable `calendar-setup'. |
| 695 | For BBDB, it is currently only possible to display the matches in | 743 | For BBDB, it is currently only possible to display the matches in |
| 696 | another window." | 744 | another window." |
| @@ -792,10 +840,10 @@ extension. The entries in this list are cons cells with a file extension | |||
| 792 | and the corresponding command. Possible values for the command are: | 840 | and the corresponding command. Possible values for the command are: |
| 793 | `emacs' The file will be visited by the current Emacs process. | 841 | `emacs' The file will be visited by the current Emacs process. |
| 794 | `default' Use the default application for this file type. | 842 | `default' Use the default application for this file type. |
| 795 | string A command to be executed by a shell. %s will be replaced | 843 | string A command to be executed by a shell; %s will be replaced |
| 796 | by the path to the file. | 844 | by the path to the file. |
| 797 | sexp A lisp form which will be evaluated. The file path will | 845 | sexp A Lisp form which will be evaluated. The file path will |
| 798 | be available in the lisp variable `file'. | 846 | be available in the Lisp variable `file'. |
| 799 | For more examples, see the system specific constants | 847 | For more examples, see the system specific constants |
| 800 | `org-file-apps-defaults-macosx' | 848 | `org-file-apps-defaults-macosx' |
| 801 | `org-file-apps-defaults-windowsnt' | 849 | `org-file-apps-defaults-windowsnt' |
| @@ -1076,7 +1124,7 @@ This option can also be set with the +OPTIONS line, e.g. \"::nil\"." | |||
| 1076 | :type 'boolean) | 1124 | :type 'boolean) |
| 1077 | 1125 | ||
| 1078 | (defcustom org-export-with-tables t | 1126 | (defcustom org-export-with-tables t |
| 1079 | "Non-nil means, lines starting with \"|\" define a table | 1127 | "If non-nil, lines starting with \"|\" define a table |
| 1080 | For example: | 1128 | For example: |
| 1081 | 1129 | ||
| 1082 | | Name | Address | Birthday | | 1130 | | Name | Address | Birthday | |
| @@ -1150,7 +1198,7 @@ This option can also be set with the +OPTIONS line, e.g. \"TeX:nil\"." | |||
| 1150 | :type 'boolean) | 1198 | :type 'boolean) |
| 1151 | 1199 | ||
| 1152 | (defcustom org-export-html-with-timestamp nil | 1200 | (defcustom org-export-html-with-timestamp nil |
| 1153 | "Non-nil means, write `org-export-html-html-helper-timestamp' | 1201 | "If non-nil, write `org-export-html-html-helper-timestamp' |
| 1154 | into the exported html text. Otherwise, the buffer will just be saved | 1202 | into the exported html text. Otherwise, the buffer will just be saved |
| 1155 | to a file." | 1203 | to a file." |
| 1156 | :group 'org-export | 1204 | :group 'org-export |
| @@ -1348,6 +1396,7 @@ When this is non-nil, the headline after the keyword is set to the | |||
| 1348 | (defvar org-cursor-color) | 1396 | (defvar org-cursor-color) |
| 1349 | (defvar org-time-was-given) | 1397 | (defvar org-time-was-given) |
| 1350 | (defvar org-ts-what) | 1398 | (defvar org-ts-what) |
| 1399 | (defvar mark-active) | ||
| 1351 | (defvar timecnt) | 1400 | (defvar timecnt) |
| 1352 | (defvar levels-open) | 1401 | (defvar levels-open) |
| 1353 | (defvar title) | 1402 | (defvar title) |
| @@ -1383,6 +1432,17 @@ When this is non-nil, the headline after the keyword is set to the | |||
| 1383 | (defvar org-struct-menu) | 1432 | (defvar org-struct-menu) |
| 1384 | (defvar org-org-menu) | 1433 | (defvar org-org-menu) |
| 1385 | 1434 | ||
| 1435 | ;; We use a before-change function to check if a table might need | ||
| 1436 | ;; an update. | ||
| 1437 | (defvar org-table-may-need-update t | ||
| 1438 | "Indicates of a table might need an update. | ||
| 1439 | This variable is set by `org-before-change-function'. `org-table-align' | ||
| 1440 | sets it back to nil.") | ||
| 1441 | |||
| 1442 | (defvar org-mode-hook nil) | ||
| 1443 | (defvar org-inhibit-startup nil) ; Dynamically-scoped param. | ||
| 1444 | |||
| 1445 | |||
| 1386 | ;;;###autoload | 1446 | ;;;###autoload |
| 1387 | (defun org-mode (&optional arg) | 1447 | (defun org-mode (&optional arg) |
| 1388 | "Outline-based notes management and organizer, alias | 1448 | "Outline-based notes management and organizer, alias |
| @@ -1437,14 +1497,15 @@ The following commands are available: | |||
| 1437 | (goto-char (point-min)) | 1497 | (goto-char (point-min)) |
| 1438 | (insert " -*- mode: org -*-\n\n"))) | 1498 | (insert " -*- mode: org -*-\n\n"))) |
| 1439 | (run-hooks 'org-mode-hook) | 1499 | (run-hooks 'org-mode-hook) |
| 1440 | (unless (boundp 'org-inhibit-startup) | 1500 | (unless org-inhibit-startup |
| 1441 | (if org-startup-with-deadline-check | 1501 | (if org-startup-with-deadline-check |
| 1442 | (call-interactively 'org-check-deadlines) | 1502 | (call-interactively 'org-check-deadlines) |
| 1443 | (cond | 1503 | (cond |
| 1444 | ((eq org-startup-folded t) | 1504 | ((eq org-startup-folded t) |
| 1445 | (org-cycle)) | 1505 | (org-cycle '(4))) |
| 1446 | ((eq org-startup-folded 'contents) | 1506 | ((eq org-startup-folded 'content) |
| 1447 | (org-cycle) (org-cycle)))))) | 1507 | (let ((this-command 'org-cycle) (last-command 'org-cycle)) |
| 1508 | (org-cycle '(4)) (org-cycle '(4)))))))) | ||
| 1448 | 1509 | ||
| 1449 | ;;; Font-Lock stuff | 1510 | ;;; Font-Lock stuff |
| 1450 | 1511 | ||
| @@ -1456,10 +1517,13 @@ The following commands are available: | |||
| 1456 | 1517 | ||
| 1457 | (require 'font-lock) | 1518 | (require 'font-lock) |
| 1458 | 1519 | ||
| 1520 | (defconst org-non-link-chars "\t\n\r|") | ||
| 1459 | (defconst org-link-regexp | 1521 | (defconst org-link-regexp |
| 1460 | (if org-allow-space-in-links | 1522 | (if org-allow-space-in-links |
| 1461 | "\\(https?\\|ftp\\|mailto\\|file\\|news\\|bbdb\\|vm\\|wl\\|rmail\\|gnus\\|shell\\):\\([^\t\n\r]+[^ \t\n\r]\\)" | 1523 | (concat |
| 1462 | "\\(https?\\|ftp\\|mailto\\|file\\|news\\|bbdb\\|vm\\|wl\\|rmail\\|gnus\\|shell\\):\\([^ \t\n\r]+\\)" | 1524 | "\\(https?\\|ftp\\|mailto|\\|file\\|news\\|bbdb\\|vm\\|wl\\|rmail\\|gnus\\|shell\\):\\([^" org-non-link-chars "]+[^ " org-non-link-chars "]\\)") |
| 1525 | (concat | ||
| 1526 | "\\(https?\\|ftp\\|mailto\\|file\\|news\\|bbdb\\|vm\\|wl\\|rmail\\|gnus\\|shell\\):\\([^ " org-non-link-chars "]+\\)") | ||
| 1463 | ) | 1527 | ) |
| 1464 | "Regular expression for matching links.") | 1528 | "Regular expression for matching links.") |
| 1465 | (defconst org-ts-lengths | 1529 | (defconst org-ts-lengths |
| @@ -1502,6 +1566,8 @@ The following commands are available: | |||
| 1502 | (org-back-to-heading t) | 1566 | (org-back-to-heading t) |
| 1503 | (- (match-end 0) (match-beginning 0)))) | 1567 | (- (match-end 0) (match-beginning 0)))) |
| 1504 | 1568 | ||
| 1569 | (defvar org-font-lock-keywords nil) | ||
| 1570 | |||
| 1505 | (defun org-set-font-lock-defaults () | 1571 | (defun org-set-font-lock-defaults () |
| 1506 | (let ((org-font-lock-extra-keywords | 1572 | (let ((org-font-lock-extra-keywords |
| 1507 | (list | 1573 | (list |
| @@ -1550,13 +1616,10 @@ The following commands are available: | |||
| 1550 | '(org-font-lock-keywords t nil nil backward-paragraph)) | 1616 | '(org-font-lock-keywords t nil nil backward-paragraph)) |
| 1551 | (kill-local-variable 'font-lock-keywords) nil)) | 1617 | (kill-local-variable 'font-lock-keywords) nil)) |
| 1552 | 1618 | ||
| 1553 | (defvar org-font-lock-keywords nil) | ||
| 1554 | |||
| 1555 | (defun org-unfontify-region (beg end &optional maybe_loudly) | 1619 | (defun org-unfontify-region (beg end &optional maybe_loudly) |
| 1556 | "Remove fontification and activation overlays from links." | 1620 | "Remove fontification and activation overlays from links." |
| 1557 | (font-lock-default-unfontify-region beg end) | 1621 | (font-lock-default-unfontify-region beg end) |
| 1558 | (let* ((modified (buffer-modified-p)) ;; FIXME: Why did I add this??? | 1622 | (let* ((buffer-undo-list t) |
| 1559 | (buffer-undo-list t) | ||
| 1560 | (inhibit-read-only t) (inhibit-point-motion-hooks t) | 1623 | (inhibit-read-only t) (inhibit-point-motion-hooks t) |
| 1561 | (inhibit-modification-hooks t) | 1624 | (inhibit-modification-hooks t) |
| 1562 | deactivate-mark buffer-file-name buffer-file-truename) | 1625 | deactivate-mark buffer-file-name buffer-file-truename) |
| @@ -1651,15 +1714,15 @@ The following commands are available: | |||
| 1651 | (save-excursion | 1714 | (save-excursion |
| 1652 | (org-back-to-heading) | 1715 | (org-back-to-heading) |
| 1653 | (outline-up-heading arg) | 1716 | (outline-up-heading arg) |
| 1654 | (show-subtree))) | 1717 | (org-show-subtree))) |
| 1655 | 1718 | ||
| 1656 | ((save-excursion (beginning-of-line 1) (looking-at outline-regexp)) | 1719 | ((save-excursion (beginning-of-line 1) (looking-at outline-regexp)) |
| 1657 | ;; At a heading: rotate between three different views | 1720 | ;; At a heading: rotate between three different views |
| 1658 | (org-back-to-heading) | 1721 | (org-back-to-heading) |
| 1659 | (let ((goal-column 0) beg eoh eol eos nxh) | 1722 | (let ((goal-column 0) eoh eol eos) |
| 1660 | ;; First, some boundaries | 1723 | ;; First, some boundaries |
| 1661 | (save-excursion | 1724 | (save-excursion |
| 1662 | (org-back-to-heading) (setq beg (point)) | 1725 | (org-back-to-heading) |
| 1663 | (save-excursion | 1726 | (save-excursion |
| 1664 | (beginning-of-line 2) | 1727 | (beginning-of-line 2) |
| 1665 | (while (and (not (eobp)) ;; this is like `next-line' | 1728 | (while (and (not (eobp)) ;; this is like `next-line' |
| @@ -1667,7 +1730,7 @@ The following commands are available: | |||
| 1667 | (beginning-of-line 2)) (setq eol (point))) | 1730 | (beginning-of-line 2)) (setq eol (point))) |
| 1668 | (outline-end-of-heading) (setq eoh (point)) | 1731 | (outline-end-of-heading) (setq eoh (point)) |
| 1669 | (outline-end-of-subtree) (setq eos (point)) | 1732 | (outline-end-of-subtree) (setq eos (point)) |
| 1670 | (outline-next-heading) (setq nxh (point))) | 1733 | (outline-next-heading)) |
| 1671 | ;; Find out what to do next and set `this-command' | 1734 | ;; Find out what to do next and set `this-command' |
| 1672 | (cond | 1735 | (cond |
| 1673 | ((= eos eoh) | 1736 | ((= eos eoh) |
| @@ -1676,7 +1739,7 @@ The following commands are available: | |||
| 1676 | (setq org-cycle-subtree-status nil)) | 1739 | (setq org-cycle-subtree-status nil)) |
| 1677 | ((>= eol eos) | 1740 | ((>= eol eos) |
| 1678 | ;; Entire subtree is hidden in one line: open it | 1741 | ;; Entire subtree is hidden in one line: open it |
| 1679 | (show-entry) | 1742 | (org-show-entry) |
| 1680 | (show-children) | 1743 | (show-children) |
| 1681 | (message "CHILDREN") | 1744 | (message "CHILDREN") |
| 1682 | (setq org-cycle-subtree-status 'children) | 1745 | (setq org-cycle-subtree-status 'children) |
| @@ -1684,7 +1747,7 @@ The following commands are available: | |||
| 1684 | ((and (eq last-command this-command) | 1747 | ((and (eq last-command this-command) |
| 1685 | (eq org-cycle-subtree-status 'children)) | 1748 | (eq org-cycle-subtree-status 'children)) |
| 1686 | ;; We just showed the children, now show everything. | 1749 | ;; We just showed the children, now show everything. |
| 1687 | (show-subtree) | 1750 | (org-show-subtree) |
| 1688 | (message "SUBTREE") | 1751 | (message "SUBTREE") |
| 1689 | (setq org-cycle-subtree-status 'subtree) | 1752 | (setq org-cycle-subtree-status 'subtree) |
| 1690 | (run-hook-with-args 'org-cycle-hook 'subtree)) | 1753 | (run-hook-with-args 'org-cycle-hook 'subtree)) |
| @@ -1733,9 +1796,9 @@ This function is the default value of the hook `org-cycle-hook'." | |||
| 1733 | "Move cursor to the first headline and recenter the headline. | 1796 | "Move cursor to the first headline and recenter the headline. |
| 1734 | Optional argument N means, put the headline into the Nth line of the window." | 1797 | Optional argument N means, put the headline into the Nth line of the window." |
| 1735 | (goto-char (point-min)) | 1798 | (goto-char (point-min)) |
| 1736 | (re-search-forward (concat "^" outline-regexp)) | 1799 | (when (re-search-forward (concat "^" outline-regexp) nil t) |
| 1737 | (beginning-of-line) | 1800 | (beginning-of-line) |
| 1738 | (recenter (prefix-numeric-value N))) | 1801 | (recenter (prefix-numeric-value N)))) |
| 1739 | 1802 | ||
| 1740 | (defvar org-goto-window-configuration nil) | 1803 | (defvar org-goto-window-configuration nil) |
| 1741 | (defvar org-goto-marker nil) | 1804 | (defvar org-goto-marker nil) |
| @@ -1836,9 +1899,9 @@ or nil." | |||
| 1836 | current-prefix-arg arg) | 1899 | current-prefix-arg arg) |
| 1837 | (throw 'exit nil)) | 1900 | (throw 'exit nil)) |
| 1838 | 1901 | ||
| 1839 | (defun org-goto-left (&optional arg) | 1902 | (defun org-goto-left () |
| 1840 | "Finish org-goto by going to the new location." | 1903 | "Finish org-goto by going to the new location." |
| 1841 | (interactive "P") | 1904 | (interactive) |
| 1842 | (if (org-on-heading-p) | 1905 | (if (org-on-heading-p) |
| 1843 | (progn | 1906 | (progn |
| 1844 | (beginning-of-line 1) | 1907 | (beginning-of-line 1) |
| @@ -1847,9 +1910,9 @@ or nil." | |||
| 1847 | (throw 'exit nil)) | 1910 | (throw 'exit nil)) |
| 1848 | (error "Not on a heading"))) | 1911 | (error "Not on a heading"))) |
| 1849 | 1912 | ||
| 1850 | (defun org-goto-right (&optional arg) | 1913 | (defun org-goto-right () |
| 1851 | "Finish org-goto by going to the new location." | 1914 | "Finish org-goto by going to the new location." |
| 1852 | (interactive "P") | 1915 | (interactive) |
| 1853 | (if (org-on-heading-p) | 1916 | (if (org-on-heading-p) |
| 1854 | (progn | 1917 | (progn |
| 1855 | (outline-end-of-subtree) | 1918 | (outline-end-of-subtree) |
| @@ -1870,9 +1933,9 @@ or nil." | |||
| 1870 | (defvar org-ignore-region nil | 1933 | (defvar org-ignore-region nil |
| 1871 | "To temporarily disable the active region.") | 1934 | "To temporarily disable the active region.") |
| 1872 | 1935 | ||
| 1873 | (defun org-insert-heading (&optional arg) | 1936 | (defun org-insert-heading () |
| 1874 | "Insert a new heading with same depth at point." | 1937 | "Insert a new heading with same depth at point." |
| 1875 | (interactive "P") | 1938 | (interactive) |
| 1876 | (let* ((head (save-excursion | 1939 | (let* ((head (save-excursion |
| 1877 | (condition-case nil | 1940 | (condition-case nil |
| 1878 | (org-back-to-heading) | 1941 | (org-back-to-heading) |
| @@ -1903,34 +1966,36 @@ state (TODO by default). Also with prefix arg, force first state." | |||
| 1903 | (insert (car org-todo-keywords) " ") | 1966 | (insert (car org-todo-keywords) " ") |
| 1904 | (insert (match-string 2) " "))) | 1967 | (insert (match-string 2) " "))) |
| 1905 | 1968 | ||
| 1906 | (defun org-promote-subtree (&optional arg) | 1969 | (defun org-promote-subtree () |
| 1907 | "Promote the entire subtree. | 1970 | "Promote the entire subtree. |
| 1908 | See also `org-promote'." | 1971 | See also `org-promote'." |
| 1909 | (interactive "P") | 1972 | (interactive) |
| 1910 | (org-map-tree 'org-promote)) | 1973 | (save-excursion |
| 1974 | (org-map-tree 'org-promote))) | ||
| 1911 | 1975 | ||
| 1912 | (defun org-demote-subtree (&optional arg) | 1976 | (defun org-demote-subtree () |
| 1913 | "Demote the entire subtree. See `org-demote'. | 1977 | "Demote the entire subtree. See `org-demote'. |
| 1914 | See also `org-promote'." | 1978 | See also `org-promote'." |
| 1915 | (interactive "P") | 1979 | (interactive) |
| 1916 | (org-map-tree 'org-demote)) | 1980 | (save-excursion |
| 1981 | (org-map-tree 'org-demote))) | ||
| 1917 | 1982 | ||
| 1918 | (defun org-do-promote (&optional arg) | 1983 | (defun org-do-promote () |
| 1919 | "Promote the current heading higher up the tree. | 1984 | "Promote the current heading higher up the tree. |
| 1920 | If the region is active in transient-mark-mode, promote all headings | 1985 | If the region is active in t`ransient-mark-mode', promote all headings |
| 1921 | in the region." | 1986 | in the region." |
| 1922 | (interactive "P") | 1987 | (interactive) |
| 1923 | (save-excursion | 1988 | (save-excursion |
| 1924 | (if (org-region-active-p) | 1989 | (if (org-region-active-p) |
| 1925 | (org-map-region 'org-promote (region-beginning) (region-end)) | 1990 | (org-map-region 'org-promote (region-beginning) (region-end)) |
| 1926 | (org-promote))) | 1991 | (org-promote))) |
| 1927 | (org-fix-position-after-promote)) | 1992 | (org-fix-position-after-promote)) |
| 1928 | 1993 | ||
| 1929 | (defun org-do-demote (&optional arg) | 1994 | (defun org-do-demote () |
| 1930 | "Demote the current heading lower down the tree. | 1995 | "Demote the current heading lower down the tree. |
| 1931 | If the region is active in transient-mark-mode, demote all headings | 1996 | If the region is active in `transient-mark-mode', demote all headings |
| 1932 | in the region." | 1997 | in the region." |
| 1933 | (interactive "P") | 1998 | (interactive) |
| 1934 | (save-excursion | 1999 | (save-excursion |
| 1935 | (if (org-region-active-p) | 2000 | (if (org-region-active-p) |
| 1936 | (org-map-region 'org-demote (region-beginning) (region-end)) | 2001 | (org-map-region 'org-demote (region-beginning) (region-end)) |
| @@ -1945,7 +2010,7 @@ in the region." | |||
| 1945 | 2010 | ||
| 1946 | (defun org-promote () | 2011 | (defun org-promote () |
| 1947 | "Promote the current heading higher up the tree. | 2012 | "Promote the current heading higher up the tree. |
| 1948 | If the region is active in transient-mark-mode, promote all headings | 2013 | If the region is active in `transient-mark-mode', promote all headings |
| 1949 | in the region." | 2014 | in the region." |
| 1950 | (org-back-to-heading t) | 2015 | (org-back-to-heading t) |
| 1951 | (let* ((level (save-match-data (funcall outline-level))) | 2016 | (let* ((level (save-match-data (funcall outline-level))) |
| @@ -1957,7 +2022,7 @@ in the region." | |||
| 1957 | 2022 | ||
| 1958 | (defun org-demote () | 2023 | (defun org-demote () |
| 1959 | "Demote the current heading lower down the tree. | 2024 | "Demote the current heading lower down the tree. |
| 1960 | If the region is active in transient-mark-mode, demote all headings | 2025 | If the region is active in `transient-mark-mode', demote all headings |
| 1961 | in the region." | 2026 | in the region." |
| 1962 | (org-back-to-heading t) | 2027 | (org-back-to-heading t) |
| 1963 | (let* ((level (save-match-data (funcall outline-level))) | 2028 | (let* ((level (save-match-data (funcall outline-level))) |
| @@ -2066,17 +2131,17 @@ ring. We need it to check if the kill was created by `org-copy-subtree'.") | |||
| 2066 | "Was the last copied subtree folded? | 2131 | "Was the last copied subtree folded? |
| 2067 | This is used to fold the tree back after pasting.") | 2132 | This is used to fold the tree back after pasting.") |
| 2068 | 2133 | ||
| 2069 | (defun org-cut-subtree (&optional arg) | 2134 | (defun org-cut-subtree () |
| 2070 | "Cut the current subtree into the clipboard. | 2135 | "Cut the current subtree into the clipboard. |
| 2071 | This is a short-hand for marking the subtree and then cutting it." | 2136 | This is a short-hand for marking the subtree and then cutting it." |
| 2072 | (interactive "p") | 2137 | (interactive) |
| 2073 | (org-copy-subtree arg 'cut)) | 2138 | (org-copy-subtree 'cut)) |
| 2074 | 2139 | ||
| 2075 | (defun org-copy-subtree (&optional arg cut) | 2140 | (defun org-copy-subtree (&optional cut) |
| 2076 | "Cut the current subtree into the clipboard. | 2141 | "Cut the current subtree into the clipboard. |
| 2077 | This is a short-hand for marking the subtree and then copying it. | 2142 | This is a short-hand for marking the subtree and then copying it. |
| 2078 | If CUT is non nil, actually cut the subtree." | 2143 | If CUT is non nil, actually cut the subtree." |
| 2079 | (interactive "p") | 2144 | (interactive) |
| 2080 | (let (beg end folded) | 2145 | (let (beg end folded) |
| 2081 | (org-back-to-heading) | 2146 | (org-back-to-heading) |
| 2082 | (setq beg (point)) | 2147 | (setq beg (point)) |
| @@ -2338,7 +2403,7 @@ prefix arg, switch to that state." | |||
| 2338 | ;; Fixup cursor location if close to the keyword | 2403 | ;; Fixup cursor location if close to the keyword |
| 2339 | (if (and (outline-on-heading-p) | 2404 | (if (and (outline-on-heading-p) |
| 2340 | (not (bolp)) | 2405 | (not (bolp)) |
| 2341 | (save-excursion (goto-char (point-at-bol)) | 2406 | (save-excursion (beginning-of-line 1) |
| 2342 | (looking-at org-todo-line-regexp)) | 2407 | (looking-at org-todo-line-regexp)) |
| 2343 | (< (point) (+ 2 (or (match-end 2) (match-end 1))))) | 2408 | (< (point) (+ 2 (or (match-end 2) (match-end 1))))) |
| 2344 | (progn | 2409 | (progn |
| @@ -2681,7 +2746,7 @@ This is used by `org-read-date' in a temporary keymap for the calendar buffer." | |||
| 2681 | A deadline is considered due if it happens within `org-deadline-warning-days' | 2746 | A deadline is considered due if it happens within `org-deadline-warning-days' |
| 2682 | days from today's date. If the deadline appears in an entry marked DONE, | 2747 | days from today's date. If the deadline appears in an entry marked DONE, |
| 2683 | it is not shown. The prefix arg NDAYS can be used to test that many | 2748 | it is not shown. The prefix arg NDAYS can be used to test that many |
| 2684 | days. If the prefix is a raw C-u prefix, all deadlines are shown." | 2749 | days. If the prefix is a raw \\[universal-argument] prefix, all deadlines are shown." |
| 2685 | (interactive "P") | 2750 | (interactive "P") |
| 2686 | (let* ((org-warn-days | 2751 | (let* ((org-warn-days |
| 2687 | (cond | 2752 | (cond |
| @@ -2718,6 +2783,7 @@ days in order to avoid rounding problems." | |||
| 2718 | (error "Not at a time-stamp range, and none found in current line."))) | 2783 | (error "Not at a time-stamp range, and none found in current line."))) |
| 2719 | (let* ((ts1 (match-string 1)) | 2784 | (let* ((ts1 (match-string 1)) |
| 2720 | (ts2 (match-string 2)) | 2785 | (ts2 (match-string 2)) |
| 2786 | (havetime (or (> (length ts1) 15) (> (length ts2) 15))) | ||
| 2721 | (match-end (match-end 0)) | 2787 | (match-end (match-end 0)) |
| 2722 | (time1 (org-time-string-to-time ts1)) | 2788 | (time1 (org-time-string-to-time ts1)) |
| 2723 | (time2 (org-time-string-to-time ts2)) | 2789 | (time2 (org-time-string-to-time ts2)) |
| @@ -2725,17 +2791,27 @@ days in order to avoid rounding problems." | |||
| 2725 | (t2 (time-to-seconds time2)) | 2791 | (t2 (time-to-seconds time2)) |
| 2726 | (diff (abs (- t2 t1))) | 2792 | (diff (abs (- t2 t1))) |
| 2727 | (negative (< (- t2 t1) 0)) | 2793 | (negative (< (- t2 t1) 0)) |
| 2728 | (ys (floor (* 365 24 60 60))) | 2794 | ;; (ys (floor (* 365 24 60 60))) |
| 2729 | (ds (* 24 60 60)) | 2795 | (ds (* 24 60 60)) |
| 2730 | (hs (* 60 60)) | 2796 | (hs (* 60 60)) |
| 2731 | (fy "%dy %dd %02d:%02d") | 2797 | (fy "%dy %dd %02d:%02d") |
| 2798 | (fy1 "%dy %dd") | ||
| 2732 | (fd "%dd %02d:%02d") | 2799 | (fd "%dd %02d:%02d") |
| 2800 | (fd1 "%dd") | ||
| 2733 | (fh "%02d:%02d") | 2801 | (fh "%02d:%02d") |
| 2734 | y d h m align) | 2802 | y d h m align) |
| 2735 | (setq y (floor (/ diff ys)) diff (mod diff ys) | 2803 | ;; FIXME: Should I re-introduce years, make year refer to same date? |
| 2736 | d (floor (/ diff ds)) diff (mod diff ds) | 2804 | ;; This would be the only useful way to have years, actually. |
| 2737 | h (floor (/ diff hs)) diff (mod diff hs) | 2805 | (if havetime |
| 2738 | m (floor (/ diff 60))) | 2806 | (setq ; y (floor (/ diff ys)) diff (mod diff ys) |
| 2807 | y 0 | ||
| 2808 | d (floor (/ diff ds)) diff (mod diff ds) | ||
| 2809 | h (floor (/ diff hs)) diff (mod diff hs) | ||
| 2810 | m (floor (/ diff 60))) | ||
| 2811 | (setq ; y (floor (/ diff ys)) diff (mod diff ys) | ||
| 2812 | y 0 | ||
| 2813 | d (floor (+ (/ diff ds) 0.5)) | ||
| 2814 | h 0 m 0)) | ||
| 2739 | (if (not to-buffer) | 2815 | (if (not to-buffer) |
| 2740 | (message (org-make-tdiff-string y d h m)) | 2816 | (message (org-make-tdiff-string y d h m)) |
| 2741 | (when (org-at-table-p) | 2817 | (when (org-at-table-p) |
| @@ -2746,8 +2822,8 @@ days in order to avoid rounding problems." | |||
| 2746 | "\\( *-? *[0-9]+y\\)?\\( *[0-9]+d\\)? *[0-9][0-9]:[0-9][0-9]") | 2822 | "\\( *-? *[0-9]+y\\)?\\( *[0-9]+d\\)? *[0-9][0-9]:[0-9][0-9]") |
| 2747 | (replace-match "")) | 2823 | (replace-match "")) |
| 2748 | (if negative (insert " -")) | 2824 | (if negative (insert " -")) |
| 2749 | (if (> y 0) (insert " " (format fy y d h m)) | 2825 | (if (> y 0) (insert " " (format (if havetime fy fy1) y d h m)) |
| 2750 | (if (> d 0) (insert " " (format fd d h m)) | 2826 | (if (> d 0) (insert " " (format (if havetime fd fd1) d h m)) |
| 2751 | (insert " " (format fh h m)))) | 2827 | (insert " " (format fh h m)))) |
| 2752 | (if align (org-table-align)) | 2828 | (if align (org-table-align)) |
| 2753 | (message "Time difference inserted")))) | 2829 | (message "Time difference inserted")))) |
| @@ -2770,7 +2846,7 @@ days in order to avoid rounding problems." | |||
| 2770 | 2846 | ||
| 2771 | (defun org-parse-time-string (s) | 2847 | (defun org-parse-time-string (s) |
| 2772 | "Parse the standard Org-mode time string. | 2848 | "Parse the standard Org-mode time string. |
| 2773 | This should be a lot faster than the normal parse-time-string." | 2849 | This should be a lot faster than the normal `parse-time-string'." |
| 2774 | (if (string-match org-ts-regexp1 s) | 2850 | (if (string-match org-ts-regexp1 s) |
| 2775 | (list 0 | 2851 | (list 0 |
| 2776 | (string-to-number (or (match-string 8 s) "0")) | 2852 | (string-to-number (or (match-string 8 s) "0")) |
| @@ -2927,7 +3003,7 @@ If there is already a time stamp at the cursor position, update it." | |||
| 2927 | ;;; Define the mode | 3003 | ;;; Define the mode |
| 2928 | 3004 | ||
| 2929 | (defvar org-agenda-mode-map (make-sparse-keymap) | 3005 | (defvar org-agenda-mode-map (make-sparse-keymap) |
| 2930 | "Keymap for org-agenda-mode.") | 3006 | "Keymap for `org-agenda-mode'.") |
| 2931 | 3007 | ||
| 2932 | (defvar org-agenda-menu) | 3008 | (defvar org-agenda-menu) |
| 2933 | (defvar org-agenda-follow-mode nil) | 3009 | (defvar org-agenda-follow-mode nil) |
| @@ -2949,6 +3025,7 @@ The following commands are available: | |||
| 2949 | (easy-menu-add org-agenda-menu) | 3025 | (easy-menu-add org-agenda-menu) |
| 2950 | (if org-startup-truncated (setq truncate-lines t)) | 3026 | (if org-startup-truncated (setq truncate-lines t)) |
| 2951 | (add-hook 'post-command-hook 'org-agenda-post-command-hook nil 'local) | 3027 | (add-hook 'post-command-hook 'org-agenda-post-command-hook nil 'local) |
| 3028 | (add-hook 'pre-command-hook 'org-unhighlight nil 'local) | ||
| 2952 | (setq org-agenda-follow-mode nil) | 3029 | (setq org-agenda-follow-mode nil) |
| 2953 | (easy-menu-change | 3030 | (easy-menu-change |
| 2954 | '("Agenda") "Agenda Files" | 3031 | '("Agenda") "Agenda Files" |
| @@ -2968,7 +3045,7 @@ The following commands are available: | |||
| 2968 | (define-key org-agenda-mode-map "l" 'org-agenda-recenter) | 3045 | (define-key org-agenda-mode-map "l" 'org-agenda-recenter) |
| 2969 | (define-key org-agenda-mode-map "t" 'org-agenda-todo) | 3046 | (define-key org-agenda-mode-map "t" 'org-agenda-todo) |
| 2970 | (define-key org-agenda-mode-map "." 'org-agenda-goto-today) | 3047 | (define-key org-agenda-mode-map "." 'org-agenda-goto-today) |
| 2971 | (define-key org-agenda-mode-map "w" 'org-agenda-week-view) | 3048 | (define-key org-agenda-mode-map "w" 'org-agenda-toggle-week-view) |
| 2972 | (define-key org-agenda-mode-map [(shift right)] 'org-agenda-date-later) | 3049 | (define-key org-agenda-mode-map [(shift right)] 'org-agenda-date-later) |
| 2973 | (define-key org-agenda-mode-map [(shift left)] 'org-agenda-date-earlier) | 3050 | (define-key org-agenda-mode-map [(shift left)] 'org-agenda-date-earlier) |
| 2974 | 3051 | ||
| @@ -3043,7 +3120,8 @@ The following commands are available: | |||
| 3043 | ["Next Dates" org-agenda-later (local-variable-p 'starting-day)] | 3120 | ["Next Dates" org-agenda-later (local-variable-p 'starting-day)] |
| 3044 | ["Previous Dates" org-agenda-earlier (local-variable-p 'starting-day)] | 3121 | ["Previous Dates" org-agenda-earlier (local-variable-p 'starting-day)] |
| 3045 | "--" | 3122 | "--" |
| 3046 | ["Week/Day View" org-agenda-week-view (local-variable-p 'starting-day)] | 3123 | ["Week/Day View" org-agenda-toggle-week-view |
| 3124 | (local-variable-p 'starting-day)] | ||
| 3047 | ["Include Diary" org-agenda-toggle-diary | 3125 | ["Include Diary" org-agenda-toggle-diary |
| 3048 | :style toggle :selected org-agenda-include-diary :active t] | 3126 | :style toggle :selected org-agenda-include-diary :active t] |
| 3049 | "--" | 3127 | "--" |
| @@ -3060,7 +3138,7 @@ The following commands are available: | |||
| 3060 | )) | 3138 | )) |
| 3061 | 3139 | ||
| 3062 | (defvar org-agenda-markers nil | 3140 | (defvar org-agenda-markers nil |
| 3063 | "List of all currently active markers created by org-agenda") | 3141 | "List of all currently active markers created by `org-agenda'.") |
| 3064 | (defvar org-agenda-last-marker-time (time-to-seconds (current-time)) | 3142 | (defvar org-agenda-last-marker-time (time-to-seconds (current-time)) |
| 3065 | "Creation time of the last agenda marker.") | 3143 | "Creation time of the last agenda marker.") |
| 3066 | 3144 | ||
| @@ -3074,7 +3152,7 @@ no longer in use." | |||
| 3074 | m)) | 3152 | m)) |
| 3075 | 3153 | ||
| 3076 | (defun org-agenda-maybe-reset-markers (&optional force) | 3154 | (defun org-agenda-maybe-reset-markers (&optional force) |
| 3077 | "Reset markers created by org-agenda. But only if they are old enough." | 3155 | "Reset markers created by `org-agenda'. But only if they are old enough." |
| 3078 | (if (or force | 3156 | (if (or force |
| 3079 | (> (- (time-to-seconds (current-time)) | 3157 | (> (- (time-to-seconds (current-time)) |
| 3080 | org-agenda-last-marker-time) | 3158 | org-agenda-last-marker-time) |
| @@ -3106,21 +3184,23 @@ When a buffer is unmodified, it is just killed. When modified, it is saved | |||
| 3106 | (when (and (buffer-modified-p buf) | 3184 | (when (and (buffer-modified-p buf) |
| 3107 | file | 3185 | file |
| 3108 | (y-or-n-p (format "Save file %s? " file))) | 3186 | (y-or-n-p (format "Save file %s? " file))) |
| 3109 | (save-excursion | 3187 | (with-current-buffer buf (save-buffer))) |
| 3110 | (set-buffer buf) (save-buffer))) | ||
| 3111 | (kill-buffer buf)))) | 3188 | (kill-buffer buf)))) |
| 3112 | 3189 | ||
| 3190 | (defvar org-respect-restriction nil) ; Dynamically-scoped param. | ||
| 3191 | |||
| 3113 | (defun org-timeline (&optional include-all) | 3192 | (defun org-timeline (&optional include-all) |
| 3114 | "Show a time-sorted view of the entries in the current org file. | 3193 | "Show a time-sorted view of the entries in the current org file. |
| 3115 | Only entries with a time stamp of today or later will be listed. With | 3194 | Only entries with a time stamp of today or later will be listed. With |
| 3116 | one C-u prefix argument, past entries will also be listed. | 3195 | one \\[universal-argument] prefix argument, past entries will also be listed. |
| 3117 | With two C-u prefixes, all unfinished TODO items will also be shown, | 3196 | With two \\[universal-argument] prefixes, all unfinished TODO items will also be shown, |
| 3118 | under the current date. | 3197 | under the current date. |
| 3119 | If the buffer contains an active region, only check the region for | 3198 | If the buffer contains an active region, only check the region for |
| 3120 | dates." | 3199 | dates." |
| 3121 | (interactive "P") | 3200 | (interactive "P") |
| 3122 | (require 'calendar) | 3201 | (require 'calendar) |
| 3123 | (org-agenda-maybe-reset-markers 'force) | 3202 | (org-agenda-maybe-reset-markers 'force) |
| 3203 | (org-compile-prefix-format org-timeline-prefix-format) | ||
| 3124 | (let* ((dopast include-all) | 3204 | (let* ((dopast include-all) |
| 3125 | (dotodo (equal include-all '(16))) | 3205 | (dotodo (equal include-all '(16))) |
| 3126 | (entry (buffer-file-name)) | 3206 | (entry (buffer-file-name)) |
| @@ -3135,7 +3215,7 @@ dates." | |||
| 3135 | (today (time-to-days (current-time))) | 3215 | (today (time-to-days (current-time))) |
| 3136 | (org-respect-restriction t) | 3216 | (org-respect-restriction t) |
| 3137 | (past t) | 3217 | (past t) |
| 3138 | s e rtn d pos) | 3218 | s e rtn d) |
| 3139 | (setq org-agenda-redo-command | 3219 | (setq org-agenda-redo-command |
| 3140 | (list 'progn | 3220 | (list 'progn |
| 3141 | (list 'switch-to-buffer-other-window (current-buffer)) | 3221 | (list 'switch-to-buffer-other-window (current-buffer)) |
| @@ -3188,13 +3268,14 @@ dates." | |||
| 3188 | "Produce a weekly view from all files in variable `org-agenda-files'. | 3268 | "Produce a weekly view from all files in variable `org-agenda-files'. |
| 3189 | The view will be for the current week, but from the overview buffer you | 3269 | The view will be for the current week, but from the overview buffer you |
| 3190 | will be able to go to other weeks. | 3270 | will be able to go to other weeks. |
| 3191 | With one C-u prefix argument INCLUDE-ALL, all unfinished TODO items will | 3271 | With one \\[universal-argument] prefix argument INCLUDE-ALL, all unfinished TODO items will |
| 3192 | also be shown, under the current date. | 3272 | also be shown, under the current date. |
| 3193 | START-DAY defaults to TODAY, or to the most recent match for the weekday | 3273 | START-DAY defaults to TODAY, or to the most recent match for the weekday |
| 3194 | given in `org-agenda-start-on-weekday'. | 3274 | given in `org-agenda-start-on-weekday'. |
| 3195 | NDAYS defaults to `org-agenda-ndays'." | 3275 | NDAYS defaults to `org-agenda-ndays'." |
| 3196 | (interactive "P") | 3276 | (interactive "P") |
| 3197 | (org-agenda-maybe-reset-markers 'force) | 3277 | (org-agenda-maybe-reset-markers 'force) |
| 3278 | (org-compile-prefix-format org-agenda-prefix-format) | ||
| 3198 | (require 'calendar) | 3279 | (require 'calendar) |
| 3199 | (let* ((org-agenda-start-on-weekday | 3280 | (let* ((org-agenda-start-on-weekday |
| 3200 | (if (or (equal ndays 1) | 3281 | (if (or (equal ndays 1) |
| @@ -3306,31 +3387,31 @@ NDAYS defaults to `org-agenda-ndays'." | |||
| 3306 | (throw 'nextfile t)) | 3387 | (throw 'nextfile t)) |
| 3307 | (t (error "Abort")))))) | 3388 | (t (error "Abort")))))) |
| 3308 | 3389 | ||
| 3309 | (defun org-agenda-quit (arg) | 3390 | (defun org-agenda-quit () |
| 3310 | "Exit agenda by removing the window or the buffer." | 3391 | "Exit agenda by removing the window or the buffer." |
| 3311 | (interactive "P") | 3392 | (interactive) |
| 3312 | (let ((buf (current-buffer))) | 3393 | (let ((buf (current-buffer))) |
| 3313 | (if (not (one-window-p)) (delete-window)) | 3394 | (if (not (one-window-p)) (delete-window)) |
| 3314 | (kill-buffer buf) | 3395 | (kill-buffer buf) |
| 3315 | (org-agenda-maybe-reset-markers 'force))) | 3396 | (org-agenda-maybe-reset-markers 'force))) |
| 3316 | 3397 | ||
| 3317 | (defun org-agenda-exit (arg) | 3398 | (defun org-agenda-exit () |
| 3318 | "Exit agenda by removing the window or the buffer. | 3399 | "Exit agenda by removing the window or the buffer. |
| 3319 | Also kill all Org-mode buffers which have been loaded by `org-agenda'. | 3400 | Also kill all Org-mode buffers which have been loaded by `org-agenda'. |
| 3320 | Org-mode buffers visited directly by the user will not be touched." | 3401 | Org-mode buffers visited directly by the user will not be touched." |
| 3321 | (interactive "P") | 3402 | (interactive) |
| 3322 | (org-release-buffers org-agenda-new-buffers) | 3403 | (org-release-buffers org-agenda-new-buffers) |
| 3323 | (setq org-agenda-new-buffers nil) | 3404 | (setq org-agenda-new-buffers nil) |
| 3324 | (org-agenda-quit arg)) | 3405 | (org-agenda-quit)) |
| 3325 | 3406 | ||
| 3326 | (defun org-agenda-redo (&optional arg) | 3407 | (defun org-agenda-redo () |
| 3327 | "Rebuild Agenda" | 3408 | "Rebuild Agenda." |
| 3328 | (interactive "P") | 3409 | (interactive) |
| 3329 | (eval org-agenda-redo-command)) | 3410 | (eval org-agenda-redo-command)) |
| 3330 | 3411 | ||
| 3331 | (defun org-agenda-goto-today (arg) | 3412 | (defun org-agenda-goto-today () |
| 3332 | "Go to today." | 3413 | "Go to today." |
| 3333 | (interactive "P") | 3414 | (interactive) |
| 3334 | (if (boundp 'starting-day) | 3415 | (if (boundp 'starting-day) |
| 3335 | (let ((cmd (car org-agenda-redo-command)) | 3416 | (let ((cmd (car org-agenda-redo-command)) |
| 3336 | (iall (nth 1 org-agenda-redo-command)) | 3417 | (iall (nth 1 org-agenda-redo-command)) |
| @@ -3357,17 +3438,9 @@ With prefix ARG, go back that many times `org-agenda-ndays'." | |||
| 3357 | (org-agenda (if (boundp 'include-all-loc) include-all-loc nil) | 3438 | (org-agenda (if (boundp 'include-all-loc) include-all-loc nil) |
| 3358 | (- starting-day (* arg org-agenda-ndays)))) | 3439 | (- starting-day (* arg org-agenda-ndays)))) |
| 3359 | 3440 | ||
| 3360 | (defun org-agenda-day-view (arg) | 3441 | (defun org-agenda-toggle-week-view () |
| 3361 | "Switch agenda to single day view." | 3442 | "Toggle weekly/daily view for aagenda." |
| 3362 | (interactive "P") | 3443 | (interactive) |
| 3363 | (unless (boundp 'starting-day) | ||
| 3364 | (error "Not allowed")) | ||
| 3365 | (setq org-agenda-ndays 1) | ||
| 3366 | (org-agenda include-all-loc starting-day 1)) | ||
| 3367 | |||
| 3368 | (defun org-agenda-week-view (arg) | ||
| 3369 | "Switch agenda to week view." | ||
| 3370 | (interactive "P") | ||
| 3371 | (unless (boundp 'starting-day) | 3444 | (unless (boundp 'starting-day) |
| 3372 | (error "Not allowed")) | 3445 | (error "Not allowed")) |
| 3373 | (setq org-agenda-ndays | 3446 | (setq org-agenda-ndays |
| @@ -3397,6 +3470,21 @@ With prefix ARG, go back that many times `org-agenda-ndays'." | |||
| 3397 | (if (not (re-search-backward "^\\S-" nil t arg)) | 3470 | (if (not (re-search-backward "^\\S-" nil t arg)) |
| 3398 | (error "No previous date before this line in this buffer."))) | 3471 | (error "No previous date before this line in this buffer."))) |
| 3399 | 3472 | ||
| 3473 | ;; Initialize the highlight | ||
| 3474 | (defvar org-hl (funcall (if org-xemacs-p 'make-extent 'make-overlay) 1 1)) | ||
| 3475 | (funcall (if org-xemacs-p 'set-extent-property 'overlay-put) org-hl | ||
| 3476 | 'face 'highlight) | ||
| 3477 | |||
| 3478 | (defun org-highlight (begin end &optional buffer) | ||
| 3479 | "Highlight a region with overlay." | ||
| 3480 | (funcall (if org-xemacs-p 'set-extent-endpoints 'move-overlay) | ||
| 3481 | org-hl begin end (or buffer (current-buffer)))) | ||
| 3482 | |||
| 3483 | (defun org-unhighlight () | ||
| 3484 | "Detach overlay INDEX." | ||
| 3485 | (funcall (if org-xemacs-p 'detach-extent 'delete-overlay) org-hl)) | ||
| 3486 | |||
| 3487 | |||
| 3400 | (defun org-agenda-follow-mode () | 3488 | (defun org-agenda-follow-mode () |
| 3401 | "Toggle follow mode in an agenda buffer." | 3489 | "Toggle follow mode in an agenda buffer." |
| 3402 | (interactive) | 3490 | (interactive) |
| @@ -3430,21 +3518,22 @@ With prefix ARG, go back that many times `org-agenda-ndays'." | |||
| 3430 | (get-text-property (point) 'org-marker)) | 3518 | (get-text-property (point) 'org-marker)) |
| 3431 | (org-agenda-show))) | 3519 | (org-agenda-show))) |
| 3432 | 3520 | ||
| 3521 | (defvar org-disable-diary nil) ;Dynamically-scoped param. | ||
| 3522 | |||
| 3433 | (defun org-get-entries-from-diary (date) | 3523 | (defun org-get-entries-from-diary (date) |
| 3434 | "Get the (emacs calendar) diary entries for DATE." | 3524 | "Get the (Emacs Calendar) diary entries for DATE." |
| 3435 | (let* ((fancy-diary-buffer "*temporary-fancy-diary-buffer*") | 3525 | (let* ((fancy-diary-buffer "*temporary-fancy-diary-buffer*") |
| 3436 | (diary-display-hook '(fancy-diary-display)) | 3526 | (diary-display-hook '(fancy-diary-display)) |
| 3437 | (list-diary-entries-hook | 3527 | (list-diary-entries-hook |
| 3438 | (cons 'org-diary-default-entry list-diary-entries-hook)) | 3528 | (cons 'org-diary-default-entry list-diary-entries-hook)) |
| 3439 | entries | 3529 | entries tod tods |
| 3440 | (disable-org-diary t)) | 3530 | (org-disable-diary t)) |
| 3441 | (save-excursion | 3531 | (save-excursion |
| 3442 | (save-window-excursion | 3532 | (save-window-excursion |
| 3443 | (list-diary-entries date 1))) | 3533 | (list-diary-entries date 1))) |
| 3444 | (if (not (get-buffer fancy-diary-buffer)) | 3534 | (if (not (get-buffer fancy-diary-buffer)) |
| 3445 | (setq entries nil) | 3535 | (setq entries nil) |
| 3446 | (save-excursion | 3536 | (with-current-buffer fancy-diary-buffer |
| 3447 | (switch-to-buffer fancy-diary-buffer) | ||
| 3448 | (setq buffer-read-only nil) | 3537 | (setq buffer-read-only nil) |
| 3449 | (if (= (point-max) 1) | 3538 | (if (= (point-max) 1) |
| 3450 | ;; No entries | 3539 | ;; No entries |
| @@ -3452,11 +3541,6 @@ With prefix ARG, go back that many times `org-agenda-ndays'." | |||
| 3452 | ;; Omit the date and other unnecessary stuff | 3541 | ;; Omit the date and other unnecessary stuff |
| 3453 | (org-agenda-cleanup-fancy-diary) | 3542 | (org-agenda-cleanup-fancy-diary) |
| 3454 | ;; Add prefix to each line and extend the text properties | 3543 | ;; Add prefix to each line and extend the text properties |
| 3455 | (goto-char (point-min)) | ||
| 3456 | (while (and (re-search-forward "^" nil t) (not (eobp))) | ||
| 3457 | (replace-match " Diary: ") | ||
| 3458 | (add-text-properties (point-at-bol) (point) | ||
| 3459 | (text-properties-at (point)))) | ||
| 3460 | (if (= (point-max) 1) | 3544 | (if (= (point-max) 1) |
| 3461 | (setq entries nil) | 3545 | (setq entries nil) |
| 3462 | (setq entries (buffer-substring (point-min) (- (point-max) 1))))) | 3546 | (setq entries (buffer-substring (point-min) (- (point-max) 1))))) |
| @@ -3467,31 +3551,33 @@ With prefix ARG, go back that many times `org-agenda-ndays'." | |||
| 3467 | (setq entries | 3551 | (setq entries |
| 3468 | (mapcar | 3552 | (mapcar |
| 3469 | (lambda (x) | 3553 | (lambda (x) |
| 3470 | (if (string-match "\\<\\([012][0-9]\\):\\([0-6][0-9]\\)" x) | 3554 | (setq x (org-format-agenda-item "" x "Diary")) |
| 3471 | (add-text-properties | 3555 | ;; Extend the text properties to the beginning of the line |
| 3472 | 1 (length x) | 3556 | (add-text-properties |
| 3473 | (list 'time-of-day | 3557 | 0 (length x) |
| 3474 | (+ (* 100 (string-to-number | 3558 | (text-properties-at (1- (length x)) x) |
| 3475 | (match-string 1 x))) | 3559 | x) |
| 3476 | (string-to-number (match-string 2 x)))) | ||
| 3477 | x)) | ||
| 3478 | x) | 3560 | x) |
| 3479 | entries))))) | 3561 | entries))))) |
| 3480 | 3562 | ||
| 3481 | (defun org-agenda-cleanup-fancy-diary () | 3563 | (defun org-agenda-cleanup-fancy-diary () |
| 3482 | "Remove unwanted stuff in buffer created by fancy-diary-display. | 3564 | "Remove unwanted stuff in buffer created by fancy-diary-display. |
| 3483 | This gets rid of the date, the underline under the date, and | 3565 | This gets rid of the date, the underline under the date, and |
| 3484 | the dummy entry installed by org-mode to ensure non-empty diary for each | 3566 | the dummy entry installed by `org-mode' to ensure non-empty diary for each |
| 3485 | date." | 3567 | date. Itt also removes lines that contain only whitespace." |
| 3486 | (goto-char (point-min)) | 3568 | (goto-char (point-min)) |
| 3487 | (if (looking-at ".*?:[ \t]*") | 3569 | (if (looking-at ".*?:[ \t]*") |
| 3488 | (progn | 3570 | (progn |
| 3489 | (replace-match "") | 3571 | (replace-match "") |
| 3490 | (re-search-forward "\n=+$" nil t) | 3572 | (re-search-forward "\n=+$" nil t) |
| 3491 | (replace-match "") | 3573 | (replace-match "") |
| 3492 | (while (re-search-backward "^ +" nil t) (replace-match ""))) | 3574 | (while (re-search-backward "^ +\n?" nil t) (replace-match ""))) |
| 3493 | (re-search-forward "\n=+$" nil t) | 3575 | (re-search-forward "\n=+$" nil t) |
| 3494 | (delete-region (point-min) (min (point-max) (1+ (match-end 0))))) | 3576 | (delete-region (point-min) (min (point-max) (1+ (match-end 0))))) |
| 3577 | (goto-char (point-min)) | ||
| 3578 | (while (re-search-forward "^ +\n" nil t) | ||
| 3579 | (replace-match "")) | ||
| 3580 | (goto-char (point-min)) | ||
| 3495 | (if (re-search-forward "^Org-mode dummy\n?" nil t) | 3581 | (if (re-search-forward "^Org-mode dummy\n?" nil t) |
| 3496 | (replace-match ""))) | 3582 | (replace-match ""))) |
| 3497 | 3583 | ||
| @@ -3501,7 +3587,7 @@ date." | |||
| 3501 | (eval-after-load "diary-lib" | 3587 | (eval-after-load "diary-lib" |
| 3502 | '(defadvice add-to-diary-list (before org-mark-diary-entry activate) | 3588 | '(defadvice add-to-diary-list (before org-mark-diary-entry activate) |
| 3503 | "Make the position visible." | 3589 | "Make the position visible." |
| 3504 | (if (and (boundp 'disable-org-diary) ;; called from org-agenda | 3590 | (if (and org-disable-diary ;; called from org-agenda |
| 3505 | (stringp string) | 3591 | (stringp string) |
| 3506 | (buffer-file-name)) | 3592 | (buffer-file-name)) |
| 3507 | (add-text-properties | 3593 | (add-text-properties |
| @@ -3606,7 +3692,7 @@ sure that TODAY is included in the list." | |||
| 3606 | 3692 | ||
| 3607 | ;;;###autoload | 3693 | ;;;###autoload |
| 3608 | (defun org-diary (&rest args) | 3694 | (defun org-diary (&rest args) |
| 3609 | "Returns diary information from org-files. | 3695 | "Return diary information from org-files. |
| 3610 | This function can be used in a \"sexp\" diary entry in the Emacs calendar. | 3696 | This function can be used in a \"sexp\" diary entry in the Emacs calendar. |
| 3611 | It accesses org files and extracts information from those files to be | 3697 | It accesses org files and extracts information from those files to be |
| 3612 | listed in the diary. The function accepts arguments specifying what | 3698 | listed in the diary. The function accepts arguments specifying what |
| @@ -3649,6 +3735,7 @@ The function expects the lisp variables `entry' and `date' to be provided | |||
| 3649 | by the caller, because this is how the calendar works. Don't use this | 3735 | by the caller, because this is how the calendar works. Don't use this |
| 3650 | function from a program - use `org-agenda-get-day-entries' instead." | 3736 | function from a program - use `org-agenda-get-day-entries' instead." |
| 3651 | (org-agenda-maybe-reset-markers) | 3737 | (org-agenda-maybe-reset-markers) |
| 3738 | (org-compile-agenda-prefix-format org-agenda-prefix-format) | ||
| 3652 | (setq args (or args '(:deadline :scheduled :timestamp))) | 3739 | (setq args (or args '(:deadline :scheduled :timestamp))) |
| 3653 | (let* ((files (if (and entry (stringp entry) (string-match "\\S-" entry)) | 3740 | (let* ((files (if (and entry (stringp entry) (string-match "\\S-" entry)) |
| 3654 | (list entry) | 3741 | (list entry) |
| @@ -3656,14 +3743,14 @@ function from a program - use `org-agenda-get-day-entries' instead." | |||
| 3656 | file rtn results) | 3743 | file rtn results) |
| 3657 | ;; If this is called during org-agenda, don't return any entries to | 3744 | ;; If this is called during org-agenda, don't return any entries to |
| 3658 | ;; the calendar. Org Agenda will list these entries itself. | 3745 | ;; the calendar. Org Agenda will list these entries itself. |
| 3659 | (if (boundp 'disable-org-diary) (setq files nil)) | 3746 | (if org-disable-diary (setq files nil)) |
| 3660 | (while (setq file (pop files)) | 3747 | (while (setq file (pop files)) |
| 3661 | (setq rtn (apply 'org-agenda-get-day-entries file date args)) | 3748 | (setq rtn (apply 'org-agenda-get-day-entries file date args)) |
| 3662 | (setq results (append results rtn))) | 3749 | (setq results (append results rtn))) |
| 3663 | (concat (org-finalize-agenda-entries results) "\n"))) | 3750 | (concat (org-finalize-agenda-entries results) "\n"))) |
| 3664 | 3751 | ||
| 3665 | (defun org-agenda-get-day-entries (file date &rest args) | 3752 | (defun org-agenda-get-day-entries (file date &rest args) |
| 3666 | "Does the work for `org-diary' and `org-agenda' | 3753 | "Does the work for `org-diary' and `org-agenda'. |
| 3667 | FILE is the path to a file to be checked for entries. DATE is date like | 3754 | FILE is the path to a file to be checked for entries. DATE is date like |
| 3668 | the one returned by `calendar-current-date'. ARGS are symbols indicating | 3755 | the one returned by `calendar-current-date'. ARGS are symbols indicating |
| 3669 | which kind of entries should be extracted. For details about these, see | 3756 | which kind of entries should be extracted. For details about these, see |
| @@ -3672,26 +3759,26 @@ the documentation of `org-diary'." | |||
| 3672 | (let* ((org-startup-with-deadline-check nil) | 3759 | (let* ((org-startup-with-deadline-check nil) |
| 3673 | (org-startup-folded nil) | 3760 | (org-startup-folded nil) |
| 3674 | (buffer (if (file-exists-p file) | 3761 | (buffer (if (file-exists-p file) |
| 3675 | ; (find-file-noselect file) | ||
| 3676 | (org-get-agenda-file-buffer file) | 3762 | (org-get-agenda-file-buffer file) |
| 3677 | (error "No such file %s" file))) | 3763 | (error "No such file %s" file))) |
| 3678 | (respect-narrow-p (boundp 'org-respect-restriction)) | ||
| 3679 | arg results rtn) | 3764 | arg results rtn) |
| 3680 | (if (not buffer) | 3765 | (if (not buffer) |
| 3681 | ;; If file does not exist, make sure an error message ends up in diary | 3766 | ;; If file does not exist, make sure an error message ends up in diary |
| 3682 | (format "ORG-AGENDA-ERROR: No such org-file %s" file) | 3767 | (format "ORG-AGENDA-ERROR: No such org-file %s" file) |
| 3683 | (save-excursion | 3768 | (with-current-buffer buffer |
| 3684 | (set-buffer buffer) | 3769 | (unless (eq major-mode 'org-mode) |
| 3770 | (error "Agenda file %s is not in `org-mode'" file)) | ||
| 3685 | (let ((case-fold-search nil)) | 3771 | (let ((case-fold-search nil)) |
| 3686 | (save-excursion | 3772 | (save-excursion |
| 3687 | (save-restriction | 3773 | (save-restriction |
| 3688 | (if respect-narrow-p | 3774 | (if org-respect-restriction |
| 3689 | (if (org-region-active-p) | 3775 | (if (org-region-active-p) |
| 3690 | ;; Respect a region to restrict search | 3776 | ;; Respect a region to restrict search |
| 3691 | (narrow-to-region (region-beginning) (region-end))) | 3777 | (narrow-to-region (region-beginning) (region-end))) |
| 3692 | ;; If we work for the calendar or many files, | 3778 | ;; If we work for the calendar or many files, |
| 3693 | ;; get rid of any restriction | 3779 | ;; get rid of any restriction |
| 3694 | (widen)) | 3780 | (widen)) |
| 3781 | ;; The way we repeatedly append to `results' makes it O(n^2) :-( | ||
| 3695 | (while (setq arg (pop args)) | 3782 | (while (setq arg (pop args)) |
| 3696 | (cond | 3783 | (cond |
| 3697 | ((and (eq arg :todo) | 3784 | ((and (eq arg :todo) |
| @@ -3748,7 +3835,7 @@ the documentation of `org-diary'." | |||
| 3748 | (regexp (concat "[\n\r]\\*+ *\\(" org-not-done-regexp | 3835 | (regexp (concat "[\n\r]\\*+ *\\(" org-not-done-regexp |
| 3749 | "[^\n\r]*\\)")) | 3836 | "[^\n\r]*\\)")) |
| 3750 | marker priority | 3837 | marker priority |
| 3751 | ee txt pl) | 3838 | ee txt) |
| 3752 | (goto-char (point-min)) | 3839 | (goto-char (point-min)) |
| 3753 | (while (re-search-forward regexp nil t) | 3840 | (while (re-search-forward regexp nil t) |
| 3754 | (goto-char (match-beginning 1)) | 3841 | (goto-char (match-beginning 1)) |
| @@ -3855,7 +3942,7 @@ the documentation of `org-diary'." | |||
| 3855 | (todayp (equal date (calendar-current-date))) ; DATE bound by calendar | 3942 | (todayp (equal date (calendar-current-date))) ; DATE bound by calendar |
| 3856 | (d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar | 3943 | (d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar |
| 3857 | d2 diff pos pos1 | 3944 | d2 diff pos pos1 |
| 3858 | ee txt head hdmarker) | 3945 | ee txt head) |
| 3859 | (goto-char (point-min)) | 3946 | (goto-char (point-min)) |
| 3860 | (while (re-search-forward regexp nil t) | 3947 | (while (re-search-forward regexp nil t) |
| 3861 | (setq pos (1- (match-beginning 1)) | 3948 | (setq pos (1- (match-beginning 1)) |
| @@ -3913,7 +4000,7 @@ the documentation of `org-diary'." | |||
| 3913 | (regexp org-scheduled-time-regexp) | 4000 | (regexp org-scheduled-time-regexp) |
| 3914 | (todayp (equal date (calendar-current-date))) ; DATE bound by calendar | 4001 | (todayp (equal date (calendar-current-date))) ; DATE bound by calendar |
| 3915 | (d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar | 4002 | (d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar |
| 3916 | d2 diff marker hdmarker pos pos1 | 4003 | d2 diff pos pos1 |
| 3917 | ee txt head) | 4004 | ee txt head) |
| 3918 | (goto-char (point-min)) | 4005 | (goto-char (point-min)) |
| 3919 | (while (re-search-forward regexp nil t) | 4006 | (while (re-search-forward regexp nil t) |
| @@ -3990,38 +4077,66 @@ the documentation of `org-diary'." | |||
| 3990 | ;; Sort the entries by expiration date. | 4077 | ;; Sort the entries by expiration date. |
| 3991 | (nreverse ee))) | 4078 | (nreverse ee))) |
| 3992 | 4079 | ||
| 3993 | 4080 | (defun org-format-agenda-item (prefix txt &optional category) | |
| 3994 | (defun org-format-agenda-item (prefix txt) | ||
| 3995 | "Format TXT to be inserted into the agenda buffer. | 4081 | "Format TXT to be inserted into the agenda buffer. |
| 3996 | In particular, this indents the line and adds a category." | 4082 | In particular, this indents the line and adds a category." |
| 3997 | (let ((cat (or org-category | 4083 | (let* ((category (or category |
| 3998 | (file-name-sans-extension | 4084 | org-category |
| 3999 | (file-name-nondirectory (buffer-file-name))))) | 4085 | (file-name-sans-extension |
| 4000 | time rtn) | 4086 | (file-name-nondirectory (buffer-file-name))))) |
| 4001 | (if (symbolp cat) (setq cat (symbol-name cat))) | 4087 | (extra prefix) |
| 4002 | (setq rtn (format " %-10s %s%s" (concat cat ":") prefix txt)) | 4088 | (time-of-day (org-get-time-of-day txt)) |
| 4003 | (add-text-properties | 4089 | (t1 (if time-of-day (concat "0" (int-to-string time-of-day)) "0000")) |
| 4004 | 0 2 (list 'category (downcase cat) | 4090 | (time (if time-of-day |
| 4005 | 'prefix-length (- (length rtn) (length txt)) | 4091 | (concat (substring t1 -4 -2) |
| 4006 | 'time-of-day (org-get-time-of-day rtn)) | 4092 | ":" (substring t1 -2)) |
| 4093 | "")) | ||
| 4094 | rtn) | ||
| 4095 | (if (symbolp category) (setq category (symbol-name category))) | ||
| 4096 | (setq rtn (concat (eval org-prefix-format-compiled) txt)) | ||
| 4097 | (add-text-properties | ||
| 4098 | 0 (length rtn) (list 'category (downcase category) | ||
| 4099 | 'prefix-length (- (length rtn) (length txt)) | ||
| 4100 | 'time-of-day time-of-day) | ||
| 4007 | rtn) | 4101 | rtn) |
| 4008 | rtn)) | 4102 | rtn)) |
| 4009 | 4103 | ||
| 4010 | ;; FIXME: Should this be restricted to beginning of string? | 4104 | (defun org-compile-prefix-format (format) |
| 4105 | "Compile the prefix format into a Lisp form that can be evaluated. | ||
| 4106 | The resulting form is returned and stored in the variable | ||
| 4107 | `org-prefix-format-compiled'." | ||
| 4108 | (let ((start 0) varform vars (s format) c) | ||
| 4109 | (while (string-match "%\\([-+]?[0-9.]*\\)\\([ .;,:!?=|/<>]?\\)\\([cts]\\)" | ||
| 4110 | s start) | ||
| 4111 | (setq var (cdr (assoc (match-string 3 s) | ||
| 4112 | '(("c" . category) ("t" . time) ("s" . extra)))) | ||
| 4113 | c (match-string 2 s) | ||
| 4114 | start (1+ (match-beginning 0))) | ||
| 4115 | (if (= (length c) 1) | ||
| 4116 | (setq varform `(if (equal "" ,var) "" (concat ,var ,c))) | ||
| 4117 | (setq varform var)) | ||
| 4118 | (setq s (replace-match "%\\1s" t nil s)) | ||
| 4119 | (push varform vars)) | ||
| 4120 | (setq vars (nreverse vars)) | ||
| 4121 | (setq org-prefix-format-compiled `(format ,s ,@vars)))) | ||
| 4122 | |||
| 4011 | (defun org-get-time-of-day (s) | 4123 | (defun org-get-time-of-day (s) |
| 4012 | "Check string S for a time of day." | 4124 | "Check string S for a time of day. |
| 4125 | If found, return it as a military time number between 0 and 2400. | ||
| 4126 | If not found, return nil." | ||
| 4013 | (save-match-data | 4127 | (save-match-data |
| 4014 | (when (and | 4128 | (when (or |
| 4015 | (string-match | 4129 | (string-match |
| 4016 | "\\<\\([012][0-9]\\)\\(:\\([0-6][0-9]\\)\\)?\\([AaPp][Mm]\\)?\\>" s) | 4130 | "\\<\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)\\([AaPp][Mm]\\)?\\>" s) |
| 4017 | (or (match-beginning 2) (match-beginning 4))) | 4131 | (string-match |
| 4018 | (+ (* 100 (+ (string-to-number (match-string 1 s)) | 4132 | "\\<\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)?\\([AaPp][Mm]\\)\\>" s)) |
| 4019 | (if (and (match-beginning 4) | 4133 | (+ (* 100 (+ (string-to-number (match-string 1 s)) |
| 4020 | (equal (downcase (match-string 4 s)) "pm")) | 4134 | (if (and (match-beginning 4) |
| 4021 | 12 0))) | 4135 | (equal (downcase (match-string 4 s)) "pm")) |
| 4022 | (if (match-beginning 3) | 4136 | 12 0))) |
| 4023 | (string-to-number (match-string 3 s)) | 4137 | (if (match-beginning 3) |
| 4024 | 0))))) | 4138 | (string-to-number (match-string 3 s)) |
| 4139 | 0))))) | ||
| 4025 | 4140 | ||
| 4026 | (defun org-finalize-agenda-entries (list) | 4141 | (defun org-finalize-agenda-entries (list) |
| 4027 | "Sort and concatenate the agenda items." | 4142 | "Sort and concatenate the agenda items." |
| @@ -4073,7 +4188,7 @@ and by additional input from the age of a schedules or deadline entry." | |||
| 4073 | (let* ((pri (get-text-property (point-at-bol) 'priority))) | 4188 | (let* ((pri (get-text-property (point-at-bol) 'priority))) |
| 4074 | (message "Priority is %d" (if pri pri -1000)))) | 4189 | (message "Priority is %d" (if pri pri -1000)))) |
| 4075 | 4190 | ||
| 4076 | (defun org-agenda-goto () | 4191 | (defun org-agenda-goto (&optional highlight) |
| 4077 | "Go to the Org-mode file which contains the item at point." | 4192 | "Go to the Org-mode file which contains the item at point." |
| 4078 | (interactive) | 4193 | (interactive) |
| 4079 | (let* ((marker (or (get-text-property (point) 'org-marker) | 4194 | (let* ((marker (or (get-text-property (point) 'org-marker) |
| @@ -4087,7 +4202,8 @@ and by additional input from the age of a schedules or deadline entry." | |||
| 4087 | (org-show-hidden-entry) | 4202 | (org-show-hidden-entry) |
| 4088 | (save-excursion | 4203 | (save-excursion |
| 4089 | (and (outline-next-heading) | 4204 | (and (outline-next-heading) |
| 4090 | (org-flag-heading nil)))))) ; show the next heading | 4205 | (org-flag-heading nil)))) ; show the next heading |
| 4206 | (and highlight (org-highlight (point-at-bol) (point-at-eol))))) | ||
| 4091 | 4207 | ||
| 4092 | (defun org-agenda-switch-to () | 4208 | (defun org-agenda-switch-to () |
| 4093 | "Go to the Org-mode file which contains the item at point." | 4209 | "Go to the Org-mode file which contains the item at point." |
| @@ -4116,14 +4232,14 @@ and by additional input from the age of a schedules or deadline entry." | |||
| 4116 | "Display the Org-mode file which contains the item at point." | 4232 | "Display the Org-mode file which contains the item at point." |
| 4117 | (interactive) | 4233 | (interactive) |
| 4118 | (let ((win (selected-window))) | 4234 | (let ((win (selected-window))) |
| 4119 | (org-agenda-goto) | 4235 | (org-agenda-goto t) |
| 4120 | (select-window win))) | 4236 | (select-window win))) |
| 4121 | 4237 | ||
| 4122 | (defun org-agenda-recenter (arg) | 4238 | (defun org-agenda-recenter (arg) |
| 4123 | "Display the Org-mode file which contains the item at point and recenter." | 4239 | "Display the Org-mode file which contains the item at point and recenter." |
| 4124 | (interactive "P") | 4240 | (interactive "P") |
| 4125 | (let ((win (selected-window))) | 4241 | (let ((win (selected-window))) |
| 4126 | (org-agenda-goto) | 4242 | (org-agenda-goto t) |
| 4127 | (recenter arg) | 4243 | (recenter arg) |
| 4128 | (select-window win))) | 4244 | (select-window win))) |
| 4129 | 4245 | ||
| @@ -4159,8 +4275,7 @@ the same tree node, and the headline of the tree node in the Org-mode file." | |||
| 4159 | (hdmarker (get-text-property (point) 'org-hd-marker)) | 4275 | (hdmarker (get-text-property (point) 'org-hd-marker)) |
| 4160 | (buffer-read-only nil) | 4276 | (buffer-read-only nil) |
| 4161 | newhead) | 4277 | newhead) |
| 4162 | (save-excursion | 4278 | (with-current-buffer buffer |
| 4163 | (set-buffer buffer) | ||
| 4164 | (widen) | 4279 | (widen) |
| 4165 | (goto-char pos) | 4280 | (goto-char pos) |
| 4166 | (org-show-hidden-entry) | 4281 | (org-show-hidden-entry) |
| @@ -4225,18 +4340,14 @@ This changes the line at point, all other lines in the agenda referring to | |||
| 4225 | the same tree node, and the headline of the tree node in the Org-mode file." | 4340 | the same tree node, and the headline of the tree node in the Org-mode file." |
| 4226 | (interactive) | 4341 | (interactive) |
| 4227 | (org-agenda-check-no-diary) | 4342 | (org-agenda-check-no-diary) |
| 4228 | (let* ((props (text-properties-at (point))) | 4343 | (let* ((marker (or (get-text-property (point) 'org-marker) |
| 4229 | (col (current-column)) | ||
| 4230 | (marker (or (get-text-property (point) 'org-marker) | ||
| 4231 | (org-agenda-error))) | 4344 | (org-agenda-error))) |
| 4232 | (pl (get-text-property (point-at-bol) 'prefix-length)) | ||
| 4233 | (buffer (marker-buffer marker)) | 4345 | (buffer (marker-buffer marker)) |
| 4234 | (pos (marker-position marker)) | 4346 | (pos (marker-position marker)) |
| 4235 | (hdmarker (get-text-property (point) 'org-hd-marker)) | 4347 | (hdmarker (get-text-property (point) 'org-hd-marker)) |
| 4236 | (buffer-read-only nil) | 4348 | (buffer-read-only nil) |
| 4237 | newhead) | 4349 | newhead) |
| 4238 | (save-excursion | 4350 | (with-current-buffer buffer |
| 4239 | (set-buffer buffer) | ||
| 4240 | (widen) | 4351 | (widen) |
| 4241 | (goto-char pos) | 4352 | (goto-char pos) |
| 4242 | (org-show-hidden-entry) | 4353 | (org-show-hidden-entry) |
| @@ -4271,20 +4382,21 @@ the same tree node, and the headline of the tree node in the Org-mode file." | |||
| 4271 | (org-agenda-date-later (- arg) what)) | 4382 | (org-agenda-date-later (- arg) what)) |
| 4272 | 4383 | ||
| 4273 | (defun org-agenda-date-prompt (arg) | 4384 | (defun org-agenda-date-prompt (arg) |
| 4274 | "Change the date of this item. Date is prompted for, with default today." | 4385 | "Change the date of this item. Date is prompted for, with default today. |
| 4275 | (interactive "p") | 4386 | The prefix ARG is passed to the `org-time-stamp' command and can therefore |
| 4387 | be used to request time specification in the time stamp." | ||
| 4388 | (interactive "P") | ||
| 4276 | (org-agenda-check-no-diary) | 4389 | (org-agenda-check-no-diary) |
| 4277 | (let* ((marker (or (get-text-property (point) 'org-marker) | 4390 | (let* ((marker (or (get-text-property (point) 'org-marker) |
| 4278 | (org-agenda-error))) | 4391 | (org-agenda-error))) |
| 4279 | (buffer (marker-buffer marker)) | 4392 | (buffer (marker-buffer marker)) |
| 4280 | (pos (marker-position marker))) | 4393 | (pos (marker-position marker))) |
| 4281 | (save-excursion | 4394 | (with-current-buffer buffer |
| 4282 | (set-buffer buffer) | ||
| 4283 | (widen) | 4395 | (widen) |
| 4284 | (goto-char pos) | 4396 | (goto-char pos) |
| 4285 | (if (not (org-at-timestamp-p)) | 4397 | (if (not (org-at-timestamp-p)) |
| 4286 | (error "Cannot find time stamp")) | 4398 | (error "Cannot find time stamp")) |
| 4287 | (org-time-stamp nil) | 4399 | (org-time-stamp arg) |
| 4288 | (message "Time stamp changed to %s" org-last-changed-timestamp)))) | 4400 | (message "Time stamp changed to %s" org-last-changed-timestamp)))) |
| 4289 | 4401 | ||
| 4290 | (defun org-get-heading () | 4402 | (defun org-get-heading () |
| @@ -4295,10 +4407,10 @@ the same tree node, and the headline of the tree node in the Org-mode file." | |||
| 4295 | (match-string 1) | 4407 | (match-string 1) |
| 4296 | ""))) | 4408 | ""))) |
| 4297 | 4409 | ||
| 4298 | (defun org-agenda-diary-entry (arg) | 4410 | (defun org-agenda-diary-entry () |
| 4299 | "Make a diary entry, like the `i' command from the calendar. | 4411 | "Make a diary entry, like the `i' command from the calendar. |
| 4300 | All the standard commands work: block, weekly etc" | 4412 | All the standard commands work: block, weekly etc" |
| 4301 | (interactive "P") | 4413 | (interactive) |
| 4302 | (require 'diary-lib) | 4414 | (require 'diary-lib) |
| 4303 | (let* ((char (progn | 4415 | (let* ((char (progn |
| 4304 | (message "Diary entry: [d]ay [w]eekly [m]onthly [y]early [a]nniversary [b]lock [c]yclic") | 4416 | (message "Diary entry: [d]ay [w]eekly [m]onthly [y]early [a]nniversary [b]lock [c]yclic") |
| @@ -4344,7 +4456,6 @@ the cursor position." | |||
| 4344 | (error "Don't know which date to use for calendar command")) | 4456 | (error "Don't know which date to use for calendar command")) |
| 4345 | (let* ((oldf (symbol-function 'calendar-cursor-to-date)) | 4457 | (let* ((oldf (symbol-function 'calendar-cursor-to-date)) |
| 4346 | (point (point)) | 4458 | (point (point)) |
| 4347 | (mark (or (mark t) (point))) | ||
| 4348 | (date (calendar-gregorian-from-absolute | 4459 | (date (calendar-gregorian-from-absolute |
| 4349 | (get-text-property point 'day))) | 4460 | (get-text-property point 'day))) |
| 4350 | (displayed-day (extract-calendar-day date)) | 4461 | (displayed-day (extract-calendar-day date)) |
| @@ -4527,11 +4638,25 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file." | |||
| 4527 | (defun org-follow-bbdb-link (name) | 4638 | (defun org-follow-bbdb-link (name) |
| 4528 | "Follow a BBDB link to NAME." | 4639 | "Follow a BBDB link to NAME." |
| 4529 | (require 'bbdb) | 4640 | (require 'bbdb) |
| 4530 | ;; First try an exact match | 4641 | (let ((inhibit-redisplay t)) |
| 4531 | (bbdb-name (concat "\\`" name "\\'") nil) | 4642 | (catch 'exit |
| 4532 | (if (= 0 (buffer-size (get-buffer "*BBDB*"))) | 4643 | ;; Exact match on name |
| 4533 | ;; No exact match - try partial match | 4644 | (bbdb-name (concat "\\`" name "\\'") nil) |
| 4534 | (bbdb-name name nil))) | 4645 | (if (< 0 (buffer-size (get-buffer "*BBDB*"))) (throw 'exit nil)) |
| 4646 | ;; Exact match on name | ||
| 4647 | (bbdb-company (concat "\\`" name "\\'") nil) | ||
| 4648 | (if (< 0 (buffer-size (get-buffer "*BBDB*"))) (throw 'exit nil)) | ||
| 4649 | ;; Partial match on name | ||
| 4650 | (bbdb-name name nil) | ||
| 4651 | (if (< 0 (buffer-size (get-buffer "*BBDB*"))) (throw 'exit nil)) | ||
| 4652 | ;; Partial match on company | ||
| 4653 | (bbdb-company name nil) | ||
| 4654 | (if (< 0 (buffer-size (get-buffer "*BBDB*"))) (throw 'exit nil)) | ||
| 4655 | ;; General match including network address and notes | ||
| 4656 | (bbdb name nil) | ||
| 4657 | (when (= 0 (buffer-size (get-buffer "*BBDB*"))) | ||
| 4658 | (delete-window (get-buffer-window "*BBDB*")) | ||
| 4659 | (error "No matching BBDB record"))))) | ||
| 4535 | 4660 | ||
| 4536 | (defun org-follow-gnus-link (&optional group article) | 4661 | (defun org-follow-gnus-link (&optional group article) |
| 4537 | "Follow a Gnus link to GROUP and ARTICLE." | 4662 | "Follow a Gnus link to GROUP and ARTICLE." |
| @@ -4545,7 +4670,6 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file." | |||
| 4545 | (gnus-summary-insert-cached-articles) | 4670 | (gnus-summary-insert-cached-articles) |
| 4546 | (gnus-summary-goto-article article nil 'force)) | 4671 | (gnus-summary-goto-article article nil 'force)) |
| 4547 | (message "Message could not be found."))))) | 4672 | (message "Message could not be found."))))) |
| 4548 | ;; (if article (gnus-summary-goto-article article nil 'force))) | ||
| 4549 | 4673 | ||
| 4550 | (defun org-follow-vm-link (&optional folder article readonly) | 4674 | (defun org-follow-vm-link (&optional folder article readonly) |
| 4551 | "Follow a VM link to FOLDER and ARTICLE." | 4675 | "Follow a VM link to FOLDER and ARTICLE." |
| @@ -4681,8 +4805,9 @@ For file links, arg negates `org-line-numbers-in-file-links'." | |||
| 4681 | 4805 | ||
| 4682 | ((eq major-mode 'bbdb-mode) | 4806 | ((eq major-mode 'bbdb-mode) |
| 4683 | (setq link (concat "bbdb:" | 4807 | (setq link (concat "bbdb:" |
| 4684 | (bbdb-record-name (bbdb-current-record))))) | 4808 | (or (bbdb-record-name (bbdb-current-record)) |
| 4685 | 4809 | (bbdb-record-company (bbdb-current-record)))))) | |
| 4810 | |||
| 4686 | ((eq major-mode 'calendar-mode) | 4811 | ((eq major-mode 'calendar-mode) |
| 4687 | (let ((cd (calendar-cursor-to-date))) | 4812 | (let ((cd (calendar-cursor-to-date))) |
| 4688 | (setq link | 4813 | (setq link |
| @@ -4702,7 +4827,6 @@ For file links, arg negates `org-line-numbers-in-file-links'." | |||
| 4702 | (folder (buffer-file-name)) | 4827 | (folder (buffer-file-name)) |
| 4703 | (subject (vm-su-subject message)) | 4828 | (subject (vm-su-subject message)) |
| 4704 | (author (vm-su-full-name message)) | 4829 | (author (vm-su-full-name message)) |
| 4705 | (address (vm-su-from message)) | ||
| 4706 | (message-id (vm-su-message-id message))) | 4830 | (message-id (vm-su-message-id message))) |
| 4707 | (setq folder (abbreviate-file-name folder)) | 4831 | (setq folder (abbreviate-file-name folder)) |
| 4708 | (if (string-match (concat "^" (regexp-quote vm-folder-directory)) | 4832 | (if (string-match (concat "^" (regexp-quote vm-folder-directory)) |
| @@ -4747,9 +4871,8 @@ For file links, arg negates `org-line-numbers-in-file-links'." | |||
| 4747 | group)) | 4871 | group)) |
| 4748 | (setq link (concat "gnus:" group))))) | 4872 | (setq link (concat "gnus:" group))))) |
| 4749 | 4873 | ||
| 4750 | ((or (eq major-mode 'gnus-summary-mode) | 4874 | ((memq major-mode '(gnus-summary-mode gnus-article-mode)) |
| 4751 | (eq major-mode 'gnus-article-mode)) | 4875 | (and (eq major-mode 'gnus-article-mode) (gnus-article-show-summary)) |
| 4752 | (gnus-article-show-summary) | ||
| 4753 | (gnus-summary-beginning-of-article) | 4876 | (gnus-summary-beginning-of-article) |
| 4754 | (let* ((group (car gnus-article-current)) | 4877 | (let* ((group (car gnus-article-current)) |
| 4755 | (article (cdr gnus-article-current)) | 4878 | (article (cdr gnus-article-current)) |
| @@ -4825,8 +4948,7 @@ For file links, arg negates `org-line-numbers-in-file-links'." | |||
| 4825 | 4948 | ||
| 4826 | 4949 | ||
| 4827 | (defun org-fixup-message-id-for-http (s) | 4950 | (defun org-fixup-message-id-for-http (s) |
| 4828 | "Replace special characters in a message id, so that it can be used | 4951 | "Replace special characters in a message id, so it can be used in an http query." |
| 4829 | in an http query." | ||
| 4830 | (while (string-match "<" s) | 4952 | (while (string-match "<" s) |
| 4831 | (setq s (replace-match "%3C" t t s))) | 4953 | (setq s (replace-match "%3C" t t s))) |
| 4832 | (while (string-match ">" s) | 4954 | (while (string-match ">" s) |
| @@ -4843,13 +4965,13 @@ Completion can be used to select a link previously stored with | |||
| 4843 | press RET at the prompt), the link defaults to the most recently | 4965 | press RET at the prompt), the link defaults to the most recently |
| 4844 | stored link. | 4966 | stored link. |
| 4845 | 4967 | ||
| 4846 | With a C-u prefix, prompts for a file to link to. The file name can be | 4968 | With a \\[universal-argument] prefix, prompts for a file to link to. The file name can be |
| 4847 | selected using completion. The path to the file will be relative to | 4969 | selected using completion. The path to the file will be relative to |
| 4848 | the current directory if the file is in the current directory or a | 4970 | the current directory if the file is in the current directory or a |
| 4849 | subdirectory. Otherwise, the link will be the absolute path as | 4971 | subdirectory. Otherwise, the link will be the absolute path as |
| 4850 | completed in the minibuffer (i.e. normally ~/path/to/file). | 4972 | completed in the minibuffer (i.e. normally ~/path/to/file). |
| 4851 | 4973 | ||
| 4852 | With two C-u prefixes, enforce an absolute path even if the file | 4974 | With two \\[universal-argument] prefixes, enforce an absolute path even if the file |
| 4853 | is in the current directory or below." | 4975 | is in the current directory or below." |
| 4854 | (interactive "P") | 4976 | (interactive "P") |
| 4855 | (let ((link (if complete-file | 4977 | (let ((link (if complete-file |
| @@ -4970,11 +5092,10 @@ See also the variable `org-reverse-note-order'." | |||
| 4970 | ;; Find the file | 5092 | ;; Find the file |
| 4971 | (if (not visiting) | 5093 | (if (not visiting) |
| 4972 | (find-file-noselect file)) | 5094 | (find-file-noselect file)) |
| 4973 | (save-excursion | 5095 | (with-current-buffer (get-file-buffer file) |
| 4974 | (set-buffer (get-file-buffer file)) | ||
| 4975 | (setq reversed (org-notes-order-reversed-p)) | 5096 | (setq reversed (org-notes-order-reversed-p)) |
| 4976 | (save-restriction | 5097 | (save-excursion |
| 4977 | (save-excursion | 5098 | (save-restriction |
| 4978 | (widen) | 5099 | (widen) |
| 4979 | ;; Ask the User for a location | 5100 | ;; Ask the User for a location |
| 4980 | (setq spos (if fastp 1 (org-get-location | 5101 | (setq spos (if fastp 1 (org-get-location |
| @@ -5038,12 +5159,6 @@ See also the variable `org-reverse-note-order'." | |||
| 5038 | ;; Emacs package. We call the former org-type tables, and the latter | 5159 | ;; Emacs package. We call the former org-type tables, and the latter |
| 5039 | ;; table.el-type tables. | 5160 | ;; table.el-type tables. |
| 5040 | 5161 | ||
| 5041 | ;; We use a before-change function to check if a table might need | ||
| 5042 | ;; an update. | ||
| 5043 | (defvar org-table-may-need-update t | ||
| 5044 | "Indicates of a table might need an update. | ||
| 5045 | This variable is set by `org-before-change-function'. `org-table-align' | ||
| 5046 | sets it back to nil.") | ||
| 5047 | 5162 | ||
| 5048 | (defun org-before-change-function (beg end) | 5163 | (defun org-before-change-function (beg end) |
| 5049 | "Every change indicates that a table might need an update." | 5164 | "Every change indicates that a table might need an update." |
| @@ -5058,7 +5173,7 @@ sets it back to nil.") | |||
| 5058 | (defconst org-table1-hline-regexp "^[ \t]*\\+-[-+]" | 5173 | (defconst org-table1-hline-regexp "^[ \t]*\\+-[-+]" |
| 5059 | "Detects a table-type table hline.") | 5174 | "Detects a table-type table hline.") |
| 5060 | (defconst org-table-any-line-regexp "^[ \t]*\\(|\\|\\+-[-+]\\)" | 5175 | (defconst org-table-any-line-regexp "^[ \t]*\\(|\\|\\+-[-+]\\)" |
| 5061 | "Detects an org-type or table-type table") | 5176 | "Detects an org-type or table-type table.") |
| 5062 | (defconst org-table-border-regexp "^[ \t]*[^| \t]" | 5177 | (defconst org-table-border-regexp "^[ \t]*[^| \t]" |
| 5063 | "Searching from within a table (any type) this finds the first line | 5178 | "Searching from within a table (any type) this finds the first line |
| 5064 | outside the table.") | 5179 | outside the table.") |
| @@ -5210,9 +5325,9 @@ This is being used to correctly align a single field after TAB or RET.") | |||
| 5210 | This is being used to correctly align a single field after TAB or RET.") | 5325 | This is being used to correctly align a single field after TAB or RET.") |
| 5211 | 5326 | ||
| 5212 | 5327 | ||
| 5213 | (defun org-table-align (&optional arg) | 5328 | (defun org-table-align () |
| 5214 | "Align the table at point by aligning all vertical bars." | 5329 | "Align the table at point by aligning all vertical bars." |
| 5215 | (interactive "P") | 5330 | (interactive) |
| 5216 | (let* ( | 5331 | (let* ( |
| 5217 | ;; Limits of table | 5332 | ;; Limits of table |
| 5218 | (beg (org-table-begin)) | 5333 | (beg (org-table-begin)) |
| @@ -5366,10 +5481,10 @@ With argument TABLE-TYPE, go to the end of a table.el-type table." | |||
| 5366 | (setq org-table-may-need-update t)) | 5481 | (setq org-table-may-need-update t)) |
| 5367 | (goto-char pos)))))) | 5482 | (goto-char pos)))))) |
| 5368 | 5483 | ||
| 5369 | (defun org-table-next-field (&optional arg) | 5484 | (defun org-table-next-field () |
| 5370 | "Go to the next field in the current table. | 5485 | "Go to the next field in the current table. |
| 5371 | Before doing so, re-align the table if necessary." | 5486 | Before doing so, re-align the table if necessary." |
| 5372 | (interactive "P") | 5487 | (interactive) |
| 5373 | (if (and org-table-automatic-realign | 5488 | (if (and org-table-automatic-realign |
| 5374 | org-table-may-need-update) | 5489 | org-table-may-need-update) |
| 5375 | (org-table-align)) | 5490 | (org-table-align)) |
| @@ -5388,10 +5503,10 @@ Before doing so, re-align the table if necessary." | |||
| 5388 | (error | 5503 | (error |
| 5389 | (org-table-insert-row 'below)))) | 5504 | (org-table-insert-row 'below)))) |
| 5390 | 5505 | ||
| 5391 | (defun org-table-previous-field (&optional arg) | 5506 | (defun org-table-previous-field () |
| 5392 | "Go to the previous field in the table. | 5507 | "Go to the previous field in the table. |
| 5393 | Before doing so, re-align the table if necessary." | 5508 | Before doing so, re-align the table if necessary." |
| 5394 | (interactive "P") | 5509 | (interactive) |
| 5395 | (if (and org-table-automatic-realign | 5510 | (if (and org-table-automatic-realign |
| 5396 | org-table-may-need-update) | 5511 | org-table-may-need-update) |
| 5397 | (org-table-align)) | 5512 | (org-table-align)) |
| @@ -5404,10 +5519,10 @@ Before doing so, re-align the table if necessary." | |||
| 5404 | (if (looking-at "| ?") | 5519 | (if (looking-at "| ?") |
| 5405 | (goto-char (match-end 0)))) | 5520 | (goto-char (match-end 0)))) |
| 5406 | 5521 | ||
| 5407 | (defun org-table-next-row (&optional arg) | 5522 | (defun org-table-next-row () |
| 5408 | "Go to the next row (same column) in the current table. | 5523 | "Go to the next row (same column) in the current table. |
| 5409 | Before doing so, re-align the table if necessary." | 5524 | Before doing so, re-align the table if necessary." |
| 5410 | (interactive "P") | 5525 | (interactive) |
| 5411 | (if (or (looking-at "[ \t]*$") | 5526 | (if (or (looking-at "[ \t]*$") |
| 5412 | (save-excursion (skip-chars-backward " \t") (bolp))) | 5527 | (save-excursion (skip-chars-backward " \t") (bolp))) |
| 5413 | (newline) | 5528 | (newline) |
| @@ -5470,6 +5585,9 @@ I.e. not on a hline or before the first or after the last column?" | |||
| 5470 | (looking-at "[ \t]*$")) | 5585 | (looking-at "[ \t]*$")) |
| 5471 | (error "Not in table data field"))) | 5586 | (error "Not in table data field"))) |
| 5472 | 5587 | ||
| 5588 | (defvar org-table-clip nil | ||
| 5589 | "Clipboard for table regions") | ||
| 5590 | |||
| 5473 | (defun org-table-blank-field () | 5591 | (defun org-table-blank-field () |
| 5474 | "Blank the current table field or active region." | 5592 | "Blank the current table field or active region." |
| 5475 | (interactive) | 5593 | (interactive) |
| @@ -5497,7 +5615,6 @@ is always the old value." | |||
| 5497 | (backward-char 1) | 5615 | (backward-char 1) |
| 5498 | (if (looking-at "|[^|\r\n]*") | 5616 | (if (looking-at "|[^|\r\n]*") |
| 5499 | (let* ((pos (match-beginning 0)) | 5617 | (let* ((pos (match-beginning 0)) |
| 5500 | (len (length (match-string 0))) | ||
| 5501 | (val (buffer-substring (1+ pos) (match-end 0)))) | 5618 | (val (buffer-substring (1+ pos) (match-end 0)))) |
| 5502 | (if replace | 5619 | (if replace |
| 5503 | (replace-match (concat "|" replace))) | 5620 | (replace-match (concat "|" replace))) |
| @@ -5591,9 +5708,9 @@ However, when FORCE is non-nil, create new columns if necessary." | |||
| 5591 | (looking-at org-table-hline-regexp)) | 5708 | (looking-at org-table-hline-regexp)) |
| 5592 | nil)) | 5709 | nil)) |
| 5593 | 5710 | ||
| 5594 | (defun org-table-insert-column (&optional arg) | 5711 | (defun org-table-insert-column () |
| 5595 | "Insert a new column into the table." | 5712 | "Insert a new column into the table." |
| 5596 | (interactive "P") | 5713 | (interactive) |
| 5597 | (if (not (org-at-table-p)) | 5714 | (if (not (org-at-table-p)) |
| 5598 | (error "Not at a table")) | 5715 | (error "Not at a table")) |
| 5599 | (org-table-find-dataline) | 5716 | (org-table-find-dataline) |
| @@ -5634,9 +5751,9 @@ However, when FORCE is non-nil, create new columns if necessary." | |||
| 5634 | (error | 5751 | (error |
| 5635 | "Please position cursor in a data line for column operations"))))) | 5752 | "Please position cursor in a data line for column operations"))))) |
| 5636 | 5753 | ||
| 5637 | (defun org-table-delete-column (&optional arg) | 5754 | (defun org-table-delete-column () |
| 5638 | "Delete a column into the table." | 5755 | "Delete a column into the table." |
| 5639 | (interactive "P") | 5756 | (interactive) |
| 5640 | (if (not (org-at-table-p)) | 5757 | (if (not (org-at-table-p)) |
| 5641 | (error "Not at a table")) | 5758 | (error "Not at a table")) |
| 5642 | (org-table-find-dataline) | 5759 | (org-table-find-dataline) |
| @@ -5777,9 +5894,9 @@ With prefix ARG, insert above the current line." | |||
| 5777 | (beginning-of-line 0) | 5894 | (beginning-of-line 0) |
| 5778 | (move-to-column col))) | 5895 | (move-to-column col))) |
| 5779 | 5896 | ||
| 5780 | (defun org-table-kill-row (&optional arg) | 5897 | (defun org-table-kill-row () |
| 5781 | "Delete the current row or horizontal line from the table." | 5898 | "Delete the current row or horizontal line from the table." |
| 5782 | (interactive "P") | 5899 | (interactive) |
| 5783 | (if (not (org-at-table-p)) | 5900 | (if (not (org-at-table-p)) |
| 5784 | (error "Not at a table")) | 5901 | (error "Not at a table")) |
| 5785 | (let ((col (current-column))) | 5902 | (let ((col (current-column))) |
| @@ -5788,14 +5905,11 @@ With prefix ARG, insert above the current line." | |||
| 5788 | (move-to-column col))) | 5905 | (move-to-column col))) |
| 5789 | 5906 | ||
| 5790 | 5907 | ||
| 5791 | (defun org-table-cut-region (&optional arg) | 5908 | (defun org-table-cut-region () |
| 5792 | "Copy region in table to the clipboard and blank all relevant fields." | 5909 | "Copy region in table to the clipboard and blank all relevant fields." |
| 5793 | (interactive "P") | 5910 | (interactive) |
| 5794 | (org-table-copy-region 'cut)) | 5911 | (org-table-copy-region 'cut)) |
| 5795 | 5912 | ||
| 5796 | (defvar org-table-clip nil | ||
| 5797 | "Clipboard for table regions") | ||
| 5798 | |||
| 5799 | (defun org-table-copy-region (&optional cut) | 5913 | (defun org-table-copy-region (&optional cut) |
| 5800 | "Copy rectangular region in table to clipboard. | 5914 | "Copy rectangular region in table to clipboard. |
| 5801 | A special clipboard is used which can only be accessed | 5915 | A special clipboard is used which can only be accessed |
| @@ -5832,20 +5946,19 @@ with `org-table-paste-rectangle'" | |||
| 5832 | (setq org-table-clip (nreverse region)) | 5946 | (setq org-table-clip (nreverse region)) |
| 5833 | (if cut (org-table-align)))) | 5947 | (if cut (org-table-align)))) |
| 5834 | 5948 | ||
| 5835 | (defun org-table-paste-rectangle (&optional arg) | 5949 | (defun org-table-paste-rectangle () |
| 5836 | "Paste a rectangular region into a table. | 5950 | "Paste a rectangular region into a table. |
| 5837 | The upper right corner ends up in the current field. All involved fields | 5951 | The upper right corner ends up in the current field. All involved fields |
| 5838 | will be overwritten. If the rectangle does not fit into the present table, | 5952 | will be overwritten. If the rectangle does not fit into the present table, |
| 5839 | the table is enlarged as needed. The process ignores horizontal separator | 5953 | the table is enlarged as needed. The process ignores horizontal separator |
| 5840 | lines." | 5954 | lines." |
| 5841 | (interactive "P") | 5955 | (interactive) |
| 5842 | (unless (and org-table-clip (listp org-table-clip)) | 5956 | (unless (and org-table-clip (listp org-table-clip)) |
| 5843 | (error "First cut/copy a region to paste!")) | 5957 | (error "First cut/copy a region to paste!")) |
| 5844 | (org-table-check-inside-data-field) | 5958 | (org-table-check-inside-data-field) |
| 5845 | (let* ((clip org-table-clip) | 5959 | (let* ((clip org-table-clip) |
| 5846 | (line (count-lines (point-min) (point))) | 5960 | (line (count-lines (point-min) (point))) |
| 5847 | (col (org-table-current-column)) | 5961 | (col (org-table-current-column)) |
| 5848 | (l line) | ||
| 5849 | (org-enable-table-editor t) | 5962 | (org-enable-table-editor t) |
| 5850 | (org-table-automatic-realign nil) | 5963 | (org-table-automatic-realign nil) |
| 5851 | c cols field) | 5964 | c cols field) |
| @@ -5864,7 +5977,7 @@ lines." | |||
| 5864 | (org-table-align))) | 5977 | (org-table-align))) |
| 5865 | 5978 | ||
| 5866 | (defun org-table-convert () | 5979 | (defun org-table-convert () |
| 5867 | "Convert from org-mode table to table.el and back. | 5980 | "Convert from `org-mode' table to table.el and back. |
| 5868 | Obviously, this only works within limits. When an Org-mode table is | 5981 | Obviously, this only works within limits. When an Org-mode table is |
| 5869 | converted to table.el, all horizontal separator lines get lost, because | 5982 | converted to table.el, all horizontal separator lines get lost, because |
| 5870 | table.el uses these as cell boundaries and has no notion of horizontal lines. | 5983 | table.el uses these as cell boundaries and has no notion of horizontal lines. |
| @@ -5915,7 +6028,7 @@ lines, in order to keep the table compact. | |||
| 5915 | If there is an active region, and both point and mark are in the same column, | 6028 | If there is an active region, and both point and mark are in the same column, |
| 5916 | the text in the column is wrapped to minimum width for the given number of | 6029 | the text in the column is wrapped to minimum width for the given number of |
| 5917 | lines. Generally, this makes the table more compact. A prefix ARG may be | 6030 | lines. Generally, this makes the table more compact. A prefix ARG may be |
| 5918 | used to change the number of desired lines. For example, `C-2 C-c C-q' | 6031 | used to change the number of desired lines. For example, `C-2 \\[org-table-wrap]' |
| 5919 | formats the selected text to two lines. If the region was longer than 2 | 6032 | formats the selected text to two lines. If the region was longer than 2 |
| 5920 | lines, the remaining lines remain empty. A negative prefix argument reduces | 6033 | lines, the remaining lines remain empty. A negative prefix argument reduces |
| 5921 | the current number of lines by that amount. The wrapped text is pasted back | 6034 | the current number of lines by that amount. The wrapped text is pasted back |
| @@ -5984,8 +6097,6 @@ many lines, whatever width that takes. | |||
| 5984 | The return value is a list of lines, without newlines at the end." | 6097 | The return value is a list of lines, without newlines at the end." |
| 5985 | (let* ((words (org-split-string string "[ \t\n]+")) | 6098 | (let* ((words (org-split-string string "[ \t\n]+")) |
| 5986 | (maxword (apply 'max (mapcar 'length words))) | 6099 | (maxword (apply 'max (mapcar 'length words))) |
| 5987 | (black (apply '+ (mapcar 'length words))) | ||
| 5988 | (total (+ black (length words))) | ||
| 5989 | w ll) | 6100 | w ll) |
| 5990 | (cond (width | 6101 | (cond (width |
| 5991 | (org-do-wrap words (max maxword width))) | 6102 | (org-do-wrap words (max maxword width))) |
| @@ -6003,7 +6114,7 @@ The return value is a list of lines, without newlines at the end." | |||
| 6003 | 6114 | ||
| 6004 | 6115 | ||
| 6005 | (defun org-do-wrap (words width) | 6116 | (defun org-do-wrap (words width) |
| 6006 | "Creates lines of maximum width WIDTH (in characters) from word list WORDS." | 6117 | "Create lines of maximum width WIDTH (in characters) from word list WORDS." |
| 6007 | (let (lines line) | 6118 | (let (lines line) |
| 6008 | (while words | 6119 | (while words |
| 6009 | (setq line (pop words)) | 6120 | (setq line (pop words)) |
| @@ -6222,10 +6333,10 @@ A few examples for formulae: | |||
| 6222 | $;%.1f Reformat current cell to 1 digit after dec.point | 6333 | $;%.1f Reformat current cell to 1 digit after dec.point |
| 6223 | ($3-32)*5/9 degrees F -> C conversion | 6334 | ($3-32)*5/9 degrees F -> C conversion |
| 6224 | 6335 | ||
| 6225 | When called with a raw C-u prefix, the formula is applied to the current | 6336 | When called with a raw \\[universal-argument] prefix, the formula is applied to the current |
| 6226 | field, and to the same same column in all following rows, until reaching a | 6337 | field, and to the same same column in all following rows, until reaching a |
| 6227 | horizontal line or the end of the table. When the command is called with a | 6338 | horizontal line or the end of the table. When the command is called with a |
| 6228 | numeric prefix argument (like M-3 or C-7 or C-u 24), the formula is applied | 6339 | numeric prefix argument (like M-3 or C-7 or \\[universal-argument] 24), the formula is applied |
| 6229 | to the current row, and to the following n-1 rows (but not beyond a | 6340 | to the current row, and to the following n-1 rows (but not beyond a |
| 6230 | separator line)." | 6341 | separator line)." |
| 6231 | (interactive "P") | 6342 | (interactive "P") |
| @@ -6297,7 +6408,7 @@ separator line)." | |||
| 6297 | ;; modified self-insert. | 6408 | ;; modified self-insert. |
| 6298 | 6409 | ||
| 6299 | (defcustom orgtbl-optimized (eq org-enable-table-editor 'optimized) | 6410 | (defcustom orgtbl-optimized (eq org-enable-table-editor 'optimized) |
| 6300 | "Non-nil means, use the optimized table editor version for orgtbl-mode. | 6411 | "Non-nil means, use the optimized table editor version for `orgtbl-mode'. |
| 6301 | In the optimized version, the table editor takes over all simple keys that | 6412 | In the optimized version, the table editor takes over all simple keys that |
| 6302 | normally just insert a character. In tables, the characters are inserted | 6413 | normally just insert a character. In tables, the characters are inserted |
| 6303 | in a way to minimize disturbing the table structure (i.e. in overwrite mode | 6414 | in a way to minimize disturbing the table structure (i.e. in overwrite mode |
| @@ -6311,21 +6422,21 @@ this variable requires a restart of Emacs to become effective." | |||
| 6311 | :type 'boolean) | 6422 | :type 'boolean) |
| 6312 | 6423 | ||
| 6313 | (defvar orgtbl-mode nil | 6424 | (defvar orgtbl-mode nil |
| 6314 | "Variable controlling orgtbl-mode, a minor mode enabling the org-mode | 6425 | "Variable controlling `orgtbl-mode', a minor mode enabling the `org-mode' |
| 6315 | table editor in arbitrary modes.") | 6426 | table editor in arbitrary modes.") |
| 6316 | (make-variable-buffer-local 'orgtbl-mode) | 6427 | (make-variable-buffer-local 'orgtbl-mode) |
| 6317 | 6428 | ||
| 6318 | (defvar orgtbl-mode-map (make-sparse-keymap) | 6429 | (defvar orgtbl-mode-map (make-sparse-keymap) |
| 6319 | "Keymap for orgtbl-mode.") | 6430 | "Keymap for `orgtbl-mode'.") |
| 6320 | 6431 | ||
| 6321 | ;;;###autoload | 6432 | ;;;###autoload |
| 6322 | (defun turn-on-orgtbl () | 6433 | (defun turn-on-orgtbl () |
| 6323 | "Unconditionally turn on orgtbl-mode." | 6434 | "Unconditionally turn on `orgtbl-mode'." |
| 6324 | (orgtbl-mode 1)) | 6435 | (orgtbl-mode 1)) |
| 6325 | 6436 | ||
| 6326 | ;;;###autoload | 6437 | ;;;###autoload |
| 6327 | (defun orgtbl-mode (&optional arg) | 6438 | (defun orgtbl-mode (&optional arg) |
| 6328 | "The org-mode table editor as a minor mode for use in other modes." | 6439 | "The `org-mode' table editor as a minor mode for use in other modes." |
| 6329 | (interactive) | 6440 | (interactive) |
| 6330 | (setq orgtbl-mode | 6441 | (setq orgtbl-mode |
| 6331 | (if arg (> (prefix-numeric-value arg) 0) (not orgtbl-mode))) | 6442 | (if arg (> (prefix-numeric-value arg) 0) (not orgtbl-mode))) |
| @@ -6435,13 +6546,13 @@ table editor in arbitrary modes.") | |||
| 6435 | (define-key org-mode-map "|" 'self-insert-command)) | 6546 | (define-key org-mode-map "|" 'self-insert-command)) |
| 6436 | 6547 | ||
| 6437 | (defun orgtbl-tab () | 6548 | (defun orgtbl-tab () |
| 6438 | "Justification and field motion for orgtbl-mode." | 6549 | "Justification and field motion for `orgtbl-mode'." |
| 6439 | (interactive) | 6550 | (interactive) |
| 6440 | (org-table-justify-field-maybe) | 6551 | (org-table-justify-field-maybe) |
| 6441 | (org-table-next-field)) | 6552 | (org-table-next-field)) |
| 6442 | 6553 | ||
| 6443 | (defun orgtbl-ret () | 6554 | (defun orgtbl-ret () |
| 6444 | "Justification and field motion for orgtbl-mode." | 6555 | "Justification and field motion for `orgtbl-mode'." |
| 6445 | (interactive) | 6556 | (interactive) |
| 6446 | (org-table-justify-field-maybe) | 6557 | (org-table-justify-field-maybe) |
| 6447 | (org-table-next-row)) | 6558 | (org-table-next-row)) |
| @@ -6454,7 +6565,7 @@ overwritten, and the table is not marked as requiring realignment." | |||
| 6454 | (if (and (org-at-table-p) | 6565 | (if (and (org-at-table-p) |
| 6455 | (eq N 1) | 6566 | (eq N 1) |
| 6456 | (looking-at "[^|\n]* +|")) | 6567 | (looking-at "[^|\n]* +|")) |
| 6457 | (let (org-table-may-need-update (pos (point))) | 6568 | (let (org-table-may-need-update) |
| 6458 | (goto-char (1- (match-end 0))) | 6569 | (goto-char (1- (match-end 0))) |
| 6459 | (delete-backward-char 1) | 6570 | (delete-backward-char 1) |
| 6460 | (goto-char (match-beginning 0)) | 6571 | (goto-char (match-beginning 0)) |
| @@ -6869,6 +6980,8 @@ The list contains HTML entities for Latin-1, Greek and other symbols. | |||
| 6869 | It is supplemented by a number of commonly used TeX macros with appropriate | 6980 | It is supplemented by a number of commonly used TeX macros with appropriate |
| 6870 | translations.") | 6981 | translations.") |
| 6871 | 6982 | ||
| 6983 | (defvar org-last-level nil) ; dynamically scoped variable | ||
| 6984 | |||
| 6872 | (defun org-export-as-ascii (arg) | 6985 | (defun org-export-as-ascii (arg) |
| 6873 | "Export the outline as a pretty ASCII file. | 6986 | "Export the outline as a pretty ASCII file. |
| 6874 | If there is an active region, export only the region. | 6987 | If there is an active region, export only the region. |
| @@ -6898,10 +7011,10 @@ underlined headlines. The default is 3." | |||
| 6898 | (email user-mail-address) | 7011 | (email user-mail-address) |
| 6899 | (language org-export-default-language) | 7012 | (language org-export-default-language) |
| 6900 | (text nil) | 7013 | (text nil) |
| 6901 | (last-level 1) | ||
| 6902 | (todo nil) | 7014 | (todo nil) |
| 6903 | (lang-words nil)) | 7015 | (lang-words nil)) |
| 6904 | 7016 | ||
| 7017 | (setq org-last-level 1) | ||
| 6905 | (org-init-section-numbers) | 7018 | (org-init-section-numbers) |
| 6906 | 7019 | ||
| 6907 | (find-file-noselect filename) | 7020 | (find-file-noselect filename) |
| @@ -6962,7 +7075,7 @@ underlined headlines. The default is 3." | |||
| 6962 | (insert | 7075 | (insert |
| 6963 | (make-string (* (1- level) 4) ?\ ) | 7076 | (make-string (* (1- level) 4) ?\ ) |
| 6964 | (format (if todo "%s (*)\n" "%s\n") txt)) | 7077 | (format (if todo "%s (*)\n" "%s\n") txt)) |
| 6965 | (setq last-level level)) | 7078 | (setq org-last-level level)) |
| 6966 | )))) | 7079 | )))) |
| 6967 | lines))) | 7080 | lines))) |
| 6968 | 7081 | ||
| @@ -7030,11 +7143,11 @@ underlined headlines. The default is 3." | |||
| 7030 | (setq title (concat (org-section-number level) " " title))) | 7143 | (setq title (concat (org-section-number level) " " title))) |
| 7031 | (insert title "\n" (make-string (string-width title) char) "\n")))) | 7144 | (insert title "\n" (make-string (string-width title) char) "\n")))) |
| 7032 | 7145 | ||
| 7033 | (defun org-export-copy-visible (&optional arg) | 7146 | (defun org-export-copy-visible () |
| 7034 | "Copy the visible part of the buffer to another buffer, for printing. | 7147 | "Copy the visible part of the buffer to another buffer, for printing. |
| 7035 | Also removes the first line of the buffer if it specifies a mode, | 7148 | Also removes the first line of the buffer if it specifies a mode, |
| 7036 | and all options lines." | 7149 | and all options lines." |
| 7037 | (interactive "P") | 7150 | (interactive) |
| 7038 | (let* ((filename (concat (file-name-sans-extension (buffer-file-name)) | 7151 | (let* ((filename (concat (file-name-sans-extension (buffer-file-name)) |
| 7039 | ".txt")) | 7152 | ".txt")) |
| 7040 | (buffer (find-file-noselect filename)) | 7153 | (buffer (find-file-noselect filename)) |
| @@ -7044,8 +7157,7 @@ and all options lines." | |||
| 7044 | "TITLE" "AUTHOR" "EMAIL" "TEXT" "OPTIONS" "LANGUAGE")) | 7157 | "TITLE" "AUTHOR" "EMAIL" "TEXT" "OPTIONS" "LANGUAGE")) |
| 7045 | (if org-noutline-p "\\(\n\\|$\\)" ""))) | 7158 | (if org-noutline-p "\\(\n\\|$\\)" ""))) |
| 7046 | s e) | 7159 | s e) |
| 7047 | (save-excursion | 7160 | (with-current-buffer buffer |
| 7048 | (set-buffer buffer) | ||
| 7049 | (erase-buffer) | 7161 | (erase-buffer) |
| 7050 | (text-mode)) | 7162 | (text-mode)) |
| 7051 | (save-excursion | 7163 | (save-excursion |
| @@ -7174,7 +7286,7 @@ headlines. The default is 3. Lower levels will become bulleted lists." | |||
| 7174 | (org-open-file (buffer-file-name))) | 7286 | (org-open-file (buffer-file-name))) |
| 7175 | 7287 | ||
| 7176 | (defun org-export-as-html-batch () | 7288 | (defun org-export-as-html-batch () |
| 7177 | "Call org-export-as-html, may be used in batch processing as | 7289 | "Call `org-export-as-html', may be used in batch processing as |
| 7178 | emacs --batch | 7290 | emacs --batch |
| 7179 | --load=$HOME/lib/emacs/org.el | 7291 | --load=$HOME/lib/emacs/org.el |
| 7180 | --eval \"(setq org-export-headline-levels 2)\" | 7292 | --eval \"(setq org-export-headline-levels 2)\" |
| @@ -7199,7 +7311,6 @@ headlines. The default is 3. Lower levels will become bulleted lists." | |||
| 7199 | (org-skip-comments (org-split-string region "[\r\n]"))) | 7311 | (org-skip-comments (org-split-string region "[\r\n]"))) |
| 7200 | (lines (org-export-find-first-heading-line all_lines)) | 7312 | (lines (org-export-find-first-heading-line all_lines)) |
| 7201 | (level 0) (line "") (origline "") txt todo | 7313 | (level 0) (line "") (origline "") txt todo |
| 7202 | (last-level 1) | ||
| 7203 | (umax nil) | 7314 | (umax nil) |
| 7204 | (filename (concat (file-name-sans-extension (buffer-file-name)) | 7315 | (filename (concat (file-name-sans-extension (buffer-file-name)) |
| 7205 | ".html")) | 7316 | ".html")) |
| @@ -7220,6 +7331,7 @@ headlines. The default is 3. Lower levels will become bulleted lists." | |||
| 7220 | ) | 7331 | ) |
| 7221 | (message "Exporting...") | 7332 | (message "Exporting...") |
| 7222 | 7333 | ||
| 7334 | (setq org-last-level 1) | ||
| 7223 | (org-init-section-numbers) | 7335 | (org-init-section-numbers) |
| 7224 | 7336 | ||
| 7225 | ;; Search for the export key lines | 7337 | ;; Search for the export key lines |
| @@ -7284,15 +7396,15 @@ headlines. The default is 3. Lower levels will become bulleted lists." | |||
| 7284 | (if (<= level umax) | 7396 | (if (<= level umax) |
| 7285 | (progn | 7397 | (progn |
| 7286 | (setq head-count (+ head-count 1)) | 7398 | (setq head-count (+ head-count 1)) |
| 7287 | (if (> level last-level) | 7399 | (if (> level org-last-level) |
| 7288 | (progn | 7400 | (progn |
| 7289 | (setq cnt (- level last-level)) | 7401 | (setq cnt (- level org-last-level)) |
| 7290 | (while (>= (setq cnt (1- cnt)) 0) | 7402 | (while (>= (setq cnt (1- cnt)) 0) |
| 7291 | (insert "<ul>")) | 7403 | (insert "<ul>")) |
| 7292 | (insert "\n"))) | 7404 | (insert "\n"))) |
| 7293 | (if (< level last-level) | 7405 | (if (< level org-last-level) |
| 7294 | (progn | 7406 | (progn |
| 7295 | (setq cnt (- last-level level)) | 7407 | (setq cnt (- org-last-level level)) |
| 7296 | (while (>= (setq cnt (1- cnt)) 0) | 7408 | (while (>= (setq cnt (1- cnt)) 0) |
| 7297 | (insert "</ul>")) | 7409 | (insert "</ul>")) |
| 7298 | (insert "\n"))) | 7410 | (insert "\n"))) |
| @@ -7302,11 +7414,11 @@ headlines. The default is 3. Lower levels will become bulleted lists." | |||
| 7302 | "<li><a href=\"#sec-%d\"><span style='color:red'>%s</span></a></li>\n" | 7414 | "<li><a href=\"#sec-%d\"><span style='color:red'>%s</span></a></li>\n" |
| 7303 | "<li><a href=\"#sec-%d\">%s</a></li>\n") | 7415 | "<li><a href=\"#sec-%d\">%s</a></li>\n") |
| 7304 | head-count txt)) | 7416 | head-count txt)) |
| 7305 | (setq last-level level)) | 7417 | (setq org-last-level level)) |
| 7306 | )))) | 7418 | )))) |
| 7307 | lines) | 7419 | lines) |
| 7308 | (while (> last-level 0) | 7420 | (while (> org-last-level 0) |
| 7309 | (setq last-level (1- last-level)) | 7421 | (setq org-last-level (1- org-last-level)) |
| 7310 | (insert "</ul>\n")) | 7422 | (insert "</ul>\n")) |
| 7311 | )) | 7423 | )) |
| 7312 | (setq head-count 0) | 7424 | (setq head-count 0) |
| @@ -7537,17 +7649,14 @@ But it has the disadvantage, that no cell- or row-spanning is allowed." | |||
| 7537 | This has the advantage that cell- or row-spanning is allowed. | 7649 | This has the advantage that cell- or row-spanning is allowed. |
| 7538 | But it has the disadvantage, that Org-mode's HTML conversions cannot be used." | 7650 | But it has the disadvantage, that Org-mode's HTML conversions cannot be used." |
| 7539 | (require 'table) | 7651 | (require 'table) |
| 7540 | (save-excursion | 7652 | (with-current-buffer (get-buffer-create " org-tmp1 ") |
| 7541 | (set-buffer (get-buffer-create " org-tmp1 ")) | ||
| 7542 | (erase-buffer) | 7653 | (erase-buffer) |
| 7543 | (insert (mapconcat 'identity lines "\n")) | 7654 | (insert (mapconcat 'identity lines "\n")) |
| 7544 | (goto-char (point-min)) | 7655 | (goto-char (point-min)) |
| 7545 | (if (not (re-search-forward "|[^+]" nil t)) | 7656 | (if (not (re-search-forward "|[^+]" nil t)) |
| 7546 | (error "Error processing table.")) | 7657 | (error "Error processing table.")) |
| 7547 | (table-recognize-table) | 7658 | (table-recognize-table) |
| 7548 | (save-excursion | 7659 | (with-current-buffer (get-buffer-create " org-tmp2 ") (erase-buffer)) |
| 7549 | (set-buffer (get-buffer-create " org-tmp2 ")) | ||
| 7550 | (erase-buffer)) | ||
| 7551 | (table-generate-source 'html " org-tmp2 ") | 7660 | (table-generate-source 'html " org-tmp2 ") |
| 7552 | (set-buffer " org-tmp2 ") | 7661 | (set-buffer " org-tmp2 ") |
| 7553 | (buffer-substring (point-min) (point-max)))) | 7662 | (buffer-substring (point-min) (point-max)))) |
| @@ -7711,7 +7820,7 @@ stacked delimiters is N. Escaping delimiters is not possible." | |||
| 7711 | level head-count title level)) | 7820 | level head-count title level)) |
| 7712 | (insert (format "\n<H%d>%s</H%d>\n" level title level)))))) | 7821 | (insert (format "\n<H%d>%s</H%d>\n" level title level)))))) |
| 7713 | 7822 | ||
| 7714 | (defun org-html-level-close (level) | 7823 | (defun org-html-level-close (&rest args) |
| 7715 | "Terminate one level in HTML export." | 7824 | "Terminate one level in HTML export." |
| 7716 | (insert "</ul>")) | 7825 | (insert "</ul>")) |
| 7717 | 7826 | ||
| @@ -7800,6 +7909,7 @@ When LEVEL is non-nil, increase section numbers on that level." | |||
| 7800 | (define-key org-mode-map "\C-c/" 'org-occur) ; Minor-mode reserved | 7909 | (define-key org-mode-map "\C-c/" 'org-occur) ; Minor-mode reserved |
| 7801 | (define-key org-mode-map "\C-c\C-m" 'org-insert-heading) | 7910 | (define-key org-mode-map "\C-c\C-m" 'org-insert-heading) |
| 7802 | (define-key org-mode-map "\M-\C-m" 'org-insert-heading) | 7911 | (define-key org-mode-map "\M-\C-m" 'org-insert-heading) |
| 7912 | (define-key org-mode-map [(meta shift return)] 'org-insert-todo-heading) | ||
| 7803 | (define-key org-mode-map "\C-c\C-l" 'org-insert-link) | 7913 | (define-key org-mode-map "\C-c\C-l" 'org-insert-link) |
| 7804 | (define-key org-mode-map "\C-c\C-o" 'org-open-at-point) | 7914 | (define-key org-mode-map "\C-c\C-o" 'org-open-at-point) |
| 7805 | (define-key org-mode-map "\C-c\C-z" 'org-time-stamp) ; Alternative binding | 7915 | (define-key org-mode-map "\C-c\C-z" 'org-time-stamp) ; Alternative binding |
| @@ -7811,8 +7921,6 @@ When LEVEL is non-nil, increase section numbers on that level." | |||
| 7811 | (define-key org-mode-map "\C-c[" 'org-add-file) | 7921 | (define-key org-mode-map "\C-c[" 'org-add-file) |
| 7812 | (define-key org-mode-map "\C-c]" 'org-remove-file) | 7922 | (define-key org-mode-map "\C-c]" 'org-remove-file) |
| 7813 | (define-key org-mode-map "\C-c\C-r" 'org-timeline) | 7923 | (define-key org-mode-map "\C-c\C-r" 'org-timeline) |
| 7814 | ;(define-key org-mode-map [(shift up)] 'org-timestamp-up) | ||
| 7815 | ;(define-key org-mode-map [(shift down)] 'org-timestamp-down) | ||
| 7816 | (define-key org-mode-map [(shift up)] 'org-shiftup) | 7924 | (define-key org-mode-map [(shift up)] 'org-shiftup) |
| 7817 | (define-key org-mode-map [(shift down)] 'org-shiftdown) | 7925 | (define-key org-mode-map [(shift down)] 'org-shiftdown) |
| 7818 | (define-key org-mode-map [(shift left)] 'org-timestamp-down-day) | 7926 | (define-key org-mode-map [(shift left)] 'org-timestamp-down-day) |
| @@ -7864,7 +7972,7 @@ overwritten, and the table is not marked as requiring realignment." | |||
| 7864 | (if (and (org-table-p) | 7972 | (if (and (org-table-p) |
| 7865 | (eq N 1) | 7973 | (eq N 1) |
| 7866 | (looking-at "[^|\n]* +|")) | 7974 | (looking-at "[^|\n]* +|")) |
| 7867 | (let (org-table-may-need-update (pos (point))) | 7975 | (let (org-table-may-need-update) |
| 7868 | (goto-char (1- (match-end 0))) | 7976 | (goto-char (1- (match-end 0))) |
| 7869 | (delete-backward-char 1) | 7977 | (delete-backward-char 1) |
| 7870 | (goto-char (match-beginning 0)) | 7978 | (goto-char (match-beginning 0)) |
| @@ -7935,25 +8043,27 @@ a reduced column width." | |||
| 7935 | ((org-at-table-p) (org-table-previous-field)) | 8043 | ((org-at-table-p) (org-table-previous-field)) |
| 7936 | (t (org-cycle '(4))))) | 8044 | (t (org-cycle '(4))))) |
| 7937 | 8045 | ||
| 7938 | (defun org-shiftmetaleft (&optional arg) | 8046 | (defun org-shiftmetaleft () |
| 7939 | "Call `org-promote-subtree' or `org-table-delete-column'." | 8047 | "Call `org-promote-subtree' or `org-table-delete-column'." |
| 7940 | (interactive "P") | 8048 | (interactive) |
| 7941 | (cond | 8049 | (cond |
| 7942 | ((org-at-table-p) (org-table-delete-column arg)) | 8050 | ((org-at-table-p) (org-table-delete-column)) |
| 7943 | ((org-on-heading-p) (org-promote-subtree arg)) | 8051 | ((org-on-heading-p) (org-promote-subtree)) |
| 7944 | (t (org-shiftcursor-error)))) | 8052 | (t (org-shiftcursor-error)))) |
| 7945 | (defun org-shiftmetaright (&optional arg) | 8053 | |
| 8054 | (defun org-shiftmetaright () | ||
| 7946 | "Call `org-demote-subtree' or `org-table-insert-column'." | 8055 | "Call `org-demote-subtree' or `org-table-insert-column'." |
| 7947 | (interactive "P") | 8056 | (interactive) |
| 7948 | (cond | 8057 | (cond |
| 7949 | ((org-at-table-p) (org-table-insert-column arg)) | 8058 | ((org-at-table-p) (org-table-insert-column)) |
| 7950 | ((org-on-heading-p) (org-demote-subtree arg)) | 8059 | ((org-on-heading-p) (org-demote-subtree)) |
| 7951 | (t (org-shiftcursor-error)))) | 8060 | (t (org-shiftcursor-error)))) |
| 8061 | |||
| 7952 | (defun org-shiftmetaup (&optional arg) | 8062 | (defun org-shiftmetaup (&optional arg) |
| 7953 | "Call `org-move-subtree-up' or `org-table-kill-row'." | 8063 | "Call `org-move-subtree-up' or `org-table-kill-row'." |
| 7954 | (interactive "P") | 8064 | (interactive "P") |
| 7955 | (cond | 8065 | (cond |
| 7956 | ((org-at-table-p) (org-table-kill-row arg)) | 8066 | ((org-at-table-p) (org-table-kill-row)) |
| 7957 | ((org-on-heading-p) (org-move-subtree-up arg)) | 8067 | ((org-on-heading-p) (org-move-subtree-up arg)) |
| 7958 | (t (org-shiftcursor-error)))) | 8068 | (t (org-shiftcursor-error)))) |
| 7959 | (defun org-shiftmetadown (&optional arg) | 8069 | (defun org-shiftmetadown (&optional arg) |
| @@ -7969,15 +8079,17 @@ a reduced column width." | |||
| 7969 | (interactive "P") | 8079 | (interactive "P") |
| 7970 | (cond | 8080 | (cond |
| 7971 | ((org-at-table-p) (org-table-move-column 'left)) | 8081 | ((org-at-table-p) (org-table-move-column 'left)) |
| 7972 | ((or (org-on-heading-p) (org-region-active-p)) (org-do-promote arg)) | 8082 | ((or (org-on-heading-p) (org-region-active-p)) (org-do-promote)) |
| 7973 | (t (backward-word (prefix-numeric-value arg))))) | 8083 | (t (backward-word (prefix-numeric-value arg))))) |
| 8084 | |||
| 7974 | (defun org-metaright (&optional arg) | 8085 | (defun org-metaright (&optional arg) |
| 7975 | "Call `org-do-demote' or `org-table-move-column' to right." | 8086 | "Call `org-do-demote' or `org-table-move-column' to right." |
| 7976 | (interactive "P") | 8087 | (interactive "P") |
| 7977 | (cond | 8088 | (cond |
| 7978 | ((org-at-table-p) (org-table-move-column nil)) | 8089 | ((org-at-table-p) (org-table-move-column nil)) |
| 7979 | ((or (org-on-heading-p) (org-region-active-p)) (org-do-demote arg)) | 8090 | ((or (org-on-heading-p) (org-region-active-p)) (org-do-demote)) |
| 7980 | (t (forward-word (prefix-numeric-value arg))))) | 8091 | (t (forward-word (prefix-numeric-value arg))))) |
| 8092 | |||
| 7981 | (defun org-metaup (&optional arg) | 8093 | (defun org-metaup (&optional arg) |
| 7982 | "Call `org-move-subtree-up' or `org-table-move-row' up." | 8094 | "Call `org-move-subtree-up' or `org-table-move-row' up." |
| 7983 | (interactive "P") | 8095 | (interactive "P") |
| @@ -7985,6 +8097,7 @@ a reduced column width." | |||
| 7985 | ((org-at-table-p) (org-table-move-row 'up)) | 8097 | ((org-at-table-p) (org-table-move-row 'up)) |
| 7986 | ((org-on-heading-p) (org-move-subtree-up arg)) | 8098 | ((org-on-heading-p) (org-move-subtree-up arg)) |
| 7987 | (t (org-shiftcursor-error)))) | 8099 | (t (org-shiftcursor-error)))) |
| 8100 | |||
| 7988 | (defun org-metadown (&optional arg) | 8101 | (defun org-metadown (&optional arg) |
| 7989 | "Call `org-move-subtree-down' or `org-table-move-row' down." | 8102 | "Call `org-move-subtree-down' or `org-table-move-row' down." |
| 7990 | (interactive "P") | 8103 | (interactive "P") |
| @@ -8007,25 +8120,25 @@ a reduced column width." | |||
| 8007 | ((org-at-timestamp-p) (org-timestamp-down arg)) | 8120 | ((org-at-timestamp-p) (org-timestamp-down arg)) |
| 8008 | (t (org-priority-down)))) | 8121 | (t (org-priority-down)))) |
| 8009 | 8122 | ||
| 8010 | (defun org-copy-special (arg) | 8123 | (defun org-copy-special () |
| 8011 | "Call either `org-table-copy' or `org-copy-subtree'." | 8124 | "Call either `org-table-copy' or `org-copy-subtree'." |
| 8012 | (interactive "P") | 8125 | (interactive) |
| 8013 | (if (org-at-table-p) | 8126 | (if (org-at-table-p) |
| 8014 | (org-table-copy-region arg) | 8127 | (org-table-copy-region) |
| 8015 | (org-copy-subtree arg))) | 8128 | (org-copy-subtree))) |
| 8016 | 8129 | ||
| 8017 | (defun org-cut-special (arg) | 8130 | (defun org-cut-special () |
| 8018 | "Call either `org-table-copy' or `org-copy-subtree'." | 8131 | "Call either `org-table-copy' or `org-cut-subtree'." |
| 8019 | (interactive "P") | 8132 | (interactive) |
| 8020 | (if (org-at-table-p) | 8133 | (if (org-at-table-p) |
| 8021 | (org-table-cut-region arg) | 8134 | (org-table-cut-region) |
| 8022 | (org-cut-subtree arg))) | 8135 | (org-cut-subtree))) |
| 8023 | 8136 | ||
| 8024 | (defun org-paste-special (arg) | 8137 | (defun org-paste-special (arg) |
| 8025 | "Call either `org-table-paste-rectangle' or `org-paste-subtree'." | 8138 | "Call either `org-table-paste-rectangle' or `org-paste-subtree'." |
| 8026 | (interactive "P") | 8139 | (interactive "P") |
| 8027 | (if (org-at-table-p) | 8140 | (if (org-at-table-p) |
| 8028 | (org-table-paste-rectangle arg) | 8141 | (org-table-paste-rectangle) |
| 8029 | (org-paste-subtree arg))) | 8142 | (org-paste-subtree arg))) |
| 8030 | 8143 | ||
| 8031 | (defun org-ctrl-c-ctrl-c (&optional arg) | 8144 | (defun org-ctrl-c-ctrl-c (&optional arg) |
| @@ -8040,12 +8153,12 @@ the automatic table editor has been turned off." | |||
| 8040 | ((org-at-table.el-p) | 8153 | ((org-at-table.el-p) |
| 8041 | (require 'table) | 8154 | (require 'table) |
| 8042 | (beginning-of-line 1) | 8155 | (beginning-of-line 1) |
| 8043 | (re-search-forward "|" (save-excursion (end-of-line 2) (point))) | 8156 | (re-search-forward "|" (save-excursion (end-of-line 2) (point))) ;FIXME: line-end-position? |
| 8044 | (table-recognize-table)) | 8157 | (table-recognize-table)) |
| 8045 | ((org-at-table-p) | 8158 | ((org-at-table-p) |
| 8046 | (org-table-align)) | 8159 | (org-table-align)) |
| 8047 | ((save-excursion (beginning-of-line 1) (looking-at "#\\+[A-Z]+")) | 8160 | ((save-excursion (beginning-of-line 1) (looking-at "#\\+[A-Z]+")) |
| 8048 | (let (org-inhibit-startup) (org-mode))) | 8161 | (let ((org-inhibit-startup t)) (org-mode))) |
| 8049 | ((org-region-active-p) | 8162 | ((org-region-active-p) |
| 8050 | (org-table-convert-region (region-beginning) (region-end) arg)) | 8163 | (org-table-convert-region (region-beginning) (region-end) arg)) |
| 8051 | ((and (region-beginning) (region-end)) | 8164 | ((and (region-beginning) (region-end)) |
| @@ -8054,9 +8167,9 @@ the automatic table editor has been turned off." | |||
| 8054 | (error "Abort"))) | 8167 | (error "Abort"))) |
| 8055 | (t (error "No table at point, and no region to make one."))))) | 8168 | (t (error "No table at point, and no region to make one."))))) |
| 8056 | 8169 | ||
| 8057 | (defun org-return (&optional arg) | 8170 | (defun org-return () |
| 8058 | "Call `org-table-next-row' or `newline'." | 8171 | "Call `org-table-next-row' or `newline'." |
| 8059 | (interactive "P") | 8172 | (interactive) |
| 8060 | (cond | 8173 | (cond |
| 8061 | ((org-at-table-p) | 8174 | ((org-at-table-p) |
| 8062 | (org-table-justify-field-maybe) | 8175 | (org-table-justify-field-maybe) |
| @@ -8069,7 +8182,7 @@ the automatic table editor has been turned off." | |||
| 8069 | (cond | 8182 | (cond |
| 8070 | ((org-at-table-p) | 8183 | ((org-at-table-p) |
| 8071 | (org-table-wrap-region arg)) | 8184 | (org-table-wrap-region arg)) |
| 8072 | (t (org-insert-heading arg)))) | 8185 | (t (org-insert-heading)))) |
| 8073 | 8186 | ||
| 8074 | ;;; Menu entries | 8187 | ;;; Menu entries |
| 8075 | 8188 | ||
| @@ -8256,7 +8369,7 @@ With optional NODE, go directly to that node." | |||
| 8256 | ;;; Miscellaneous stuff | 8369 | ;;; Miscellaneous stuff |
| 8257 | 8370 | ||
| 8258 | (defun org-move-line-down (arg) | 8371 | (defun org-move-line-down (arg) |
| 8259 | "Move the current line up." | 8372 | "Move the current line down. With prefix argument, move it past ARG lines." |
| 8260 | (interactive "p") | 8373 | (interactive "p") |
| 8261 | (let ((col (current-column)) | 8374 | (let ((col (current-column)) |
| 8262 | beg end pos) | 8375 | beg end pos) |
| @@ -8269,13 +8382,13 @@ With optional NODE, go directly to that node." | |||
| 8269 | (move-to-column col))) | 8382 | (move-to-column col))) |
| 8270 | 8383 | ||
| 8271 | (defun org-move-line-up (arg) | 8384 | (defun org-move-line-up (arg) |
| 8272 | "Move the current line up." | 8385 | "Move the current line up. With prefix argument, move it past ARG lines." |
| 8273 | (interactive "p") | 8386 | (interactive "p") |
| 8274 | (let ((col (current-column)) | 8387 | (let ((col (current-column)) |
| 8275 | beg end pos) | 8388 | beg end pos) |
| 8276 | (beginning-of-line 1) (setq beg (point)) | 8389 | (beginning-of-line 1) (setq beg (point)) |
| 8277 | (beginning-of-line 2) (setq end (point)) | 8390 | (beginning-of-line 2) (setq end (point)) |
| 8278 | (beginning-of-line (+ -2 arg)) | 8391 | (beginning-of-line (- arg)) |
| 8279 | (setq pos (move-marker (make-marker) (point))) | 8392 | (setq pos (move-marker (make-marker) (point))) |
| 8280 | (insert (delete-and-extract-region beg end)) | 8393 | (insert (delete-and-extract-region beg end)) |
| 8281 | (goto-char pos) | 8394 | (goto-char pos) |
| @@ -8284,7 +8397,7 @@ With optional NODE, go directly to that node." | |||
| 8284 | ;; Functions needed for Emacs/XEmacs region compatibility | 8397 | ;; Functions needed for Emacs/XEmacs region compatibility |
| 8285 | 8398 | ||
| 8286 | (defun org-region-active-p () | 8399 | (defun org-region-active-p () |
| 8287 | "Is transient-mark-mode on and the region active? | 8400 | "Is `transient-mark-mode' on and the region active? |
| 8288 | Works on both Emacs and XEmacs." | 8401 | Works on both Emacs and XEmacs." |
| 8289 | (if org-ignore-region | 8402 | (if org-ignore-region |
| 8290 | nil | 8403 | nil |
| @@ -8403,7 +8516,9 @@ If INVISIBLE-OK is non-nil, an invisible heading line is ok too." | |||
| 8403 | This function considers both visible and invisible heading lines. | 8516 | This function considers both visible and invisible heading lines. |
| 8404 | With argument, move up ARG levels." | 8517 | With argument, move up ARG levels." |
| 8405 | (if org-noutline-p | 8518 | (if org-noutline-p |
| 8406 | (outline-up-heading arg t) | 8519 | (if (fboundp 'outline-up-heading-all) |
| 8520 | (outline-up-heading-all arg) ; emacs 21 version of outline.el | ||
| 8521 | (outline-up-heading arg t)) ; emacs 22 version of outline.el | ||
| 8407 | (org-back-to-heading t) | 8522 | (org-back-to-heading t) |
| 8408 | (looking-at outline-regexp) | 8523 | (looking-at outline-regexp) |
| 8409 | (if (<= (- (match-end 0) (match-beginning 0)) arg) | 8524 | (if (<= (- (match-end 0) (match-beginning 0)) arg) |
| @@ -8422,7 +8537,7 @@ With argument, move up ARG levels." | |||
| 8422 | (progn | 8537 | (progn |
| 8423 | (org-back-to-heading t) | 8538 | (org-back-to-heading t) |
| 8424 | (org-flag-heading nil))) | 8539 | (org-flag-heading nil))) |
| 8425 | (show-entry))) | 8540 | (org-show-entry))) |
| 8426 | 8541 | ||
| 8427 | (defun org-check-occur-regexp (regexp) | 8542 | (defun org-check-occur-regexp (regexp) |
| 8428 | "If REGEXP starts with \"^\", modify it to check for \\r as well. | 8543 | "If REGEXP starts with \"^\", modify it to check for \\r as well. |
| @@ -8444,7 +8559,7 @@ When ENTRY is non-nil, show the entire entry." | |||
| 8444 | ;; Check if we should show the entire entry | 8559 | ;; Check if we should show the entire entry |
| 8445 | (if entry | 8560 | (if entry |
| 8446 | (progn | 8561 | (progn |
| 8447 | (show-entry) | 8562 | (org-show-entry) |
| 8448 | (save-excursion ;; FIXME: Is this the fix for points in the -| | 8563 | (save-excursion ;; FIXME: Is this the fix for points in the -| |
| 8449 | ;; middle of text? | | 8564 | ;; middle of text? | |
| 8450 | (and (outline-next-heading) ;; | | 8565 | (and (outline-next-heading) ;; | |
| @@ -8455,6 +8570,28 @@ When ENTRY is non-nil, show the entire entry." | |||
| 8455 | flag | 8570 | flag |
| 8456 | (if flag ?\r ?\n)))))) | 8571 | (if flag ?\r ?\n)))))) |
| 8457 | 8572 | ||
| 8573 | (defun org-show-subtree () | ||
| 8574 | "Show everything after this heading at deeper levels." | ||
| 8575 | (outline-flag-region | ||
| 8576 | (point) | ||
| 8577 | (save-excursion | ||
| 8578 | (outline-end-of-subtree) (outline-next-heading) (point)) | ||
| 8579 | (if org-noutline-p nil ?\n))) | ||
| 8580 | |||
| 8581 | (defun org-show-entry () | ||
| 8582 | "Show the body directly following this heading. | ||
| 8583 | Show the heading too, if it is currently invisible." | ||
| 8584 | (interactive) | ||
| 8585 | (save-excursion | ||
| 8586 | (org-back-to-heading t) | ||
| 8587 | (outline-flag-region | ||
| 8588 | (1- (point)) | ||
| 8589 | (save-excursion | ||
| 8590 | (re-search-forward (concat "[\r\n]\\(" outline-regexp "\\)") nil 'move) | ||
| 8591 | (or (match-beginning 1) (point-max))) | ||
| 8592 | (if org-noutline-p nil ?\n)))) | ||
| 8593 | |||
| 8594 | |||
| 8458 | (defun org-make-options-regexp (kwds) | 8595 | (defun org-make-options-regexp (kwds) |
| 8459 | "Make a regular expression for keyword lines." | 8596 | "Make a regular expression for keyword lines." |
| 8460 | (concat | 8597 | (concat |
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 1b3f06eb34b..04507fbc5e4 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el | |||
| @@ -828,6 +828,14 @@ says which mode to use." | |||
| 828 | (tex-mode-internal) | 828 | (tex-mode-internal) |
| 829 | (tex-guess-mode))) | 829 | (tex-guess-mode))) |
| 830 | 830 | ||
| 831 | ;; The following three autoloaded aliases appear to conflict with | ||
| 832 | ;; AUCTeX. However, even though AUCTeX uses the mixed case variants | ||
| 833 | ;; for all mode relevant variables and hooks, the invocation function | ||
| 834 | ;; and setting of `major-mode' themselves need to be lowercase for | ||
| 835 | ;; AUCTeX to provide a fully functional user-level replacement. So | ||
| 836 | ;; these aliases should remain as they are, in particular since AUCTeX | ||
| 837 | ;; users are likely to use them. | ||
| 838 | |||
| 831 | ;;;###autoload | 839 | ;;;###autoload |
| 832 | (defalias 'TeX-mode 'tex-mode) | 840 | (defalias 'TeX-mode 'tex-mode) |
| 833 | ;;;###autoload | 841 | ;;;###autoload |
diff --git a/lisp/tooltip.el b/lisp/tooltip.el index 840aa3c2006..9bd35f05d11 100644 --- a/lisp/tooltip.el +++ b/lisp/tooltip.el | |||
| @@ -119,8 +119,10 @@ position to pop up the tooltip." | |||
| 119 | (defcustom tooltip-gud-tips-p nil | 119 | (defcustom tooltip-gud-tips-p nil |
| 120 | "*Non-nil means show tooltips in GUD sessions. | 120 | "*Non-nil means show tooltips in GUD sessions. |
| 121 | 121 | ||
| 122 | This allows you to display a variable's value in a tooltip simply by | 122 | This allows you to display a variable's value in a tooltip simply |
| 123 | pointing at it with the mouse." | 123 | by pointing at it with the mouse. In the case of a C program |
| 124 | controlled by GDB, it shows the associated #define directives | ||
| 125 | when program is not executing." | ||
| 124 | :type 'boolean | 126 | :type 'boolean |
| 125 | :tag "GUD" | 127 | :tag "GUD" |
| 126 | :group 'tooltip) | 128 | :group 'tooltip) |
| @@ -453,29 +455,45 @@ If TOOLTIP-GUD-DEREFERENCE is t, also prepend a `*' to EXPR." | |||
| 453 | "Show tip for identifier or selection under the mouse. | 455 | "Show tip for identifier or selection under the mouse. |
| 454 | The mouse must either point at an identifier or inside a selected | 456 | The mouse must either point at an identifier or inside a selected |
| 455 | region for the tip window to be shown. If tooltip-gud-dereference is t, | 457 | region for the tip window to be shown. If tooltip-gud-dereference is t, |
| 456 | add a `*' in front of the printed expression. | 458 | add a `*' in front of the printed expression. In the case of a C program |
| 459 | controlled by GDB, show the associated #define directives when program is | ||
| 460 | not executing. | ||
| 457 | 461 | ||
| 458 | This function must return nil if it doesn't handle EVENT." | 462 | This function must return nil if it doesn't handle EVENT." |
| 459 | (let (process) | 463 | (let (process) |
| 460 | (when (and (eventp event) | 464 | (when (and (eventp event) |
| 461 | tooltip-gud-tips-p | 465 | tooltip-gud-tips-p |
| 462 | (boundp 'gud-comint-buffer) | 466 | (boundp 'gud-comint-buffer) |
| 467 | gud-comint-buffer | ||
| 468 | (buffer-name gud-comint-buffer); gud-comint-buffer might be killed | ||
| 463 | (setq process (get-buffer-process gud-comint-buffer)) | 469 | (setq process (get-buffer-process gud-comint-buffer)) |
| 464 | (posn-point (event-end event)) | 470 | (posn-point (event-end event)) |
| 465 | (progn (setq tooltip-gud-event event) | 471 | (or (eq gud-minor-mode 'gdba) |
| 466 | (eval (cons 'and tooltip-gud-display)))) | 472 | (progn (setq tooltip-gud-event event) |
| 473 | (eval (cons 'and tooltip-gud-display))))) | ||
| 467 | (let ((expr (tooltip-expr-to-print event))) | 474 | (let ((expr (tooltip-expr-to-print event))) |
| 468 | (when expr | 475 | (when expr |
| 469 | (let ((cmd (tooltip-gud-print-command expr))) | 476 | (if (and (eq gud-minor-mode 'gdba) |
| 470 | (unless (null cmd) ; CMD can be nil if unknown debugger | 477 | (not gdb-active-process)) |
| 471 | (case gud-minor-mode | 478 | (progn |
| 472 | (gdba (gdb-enqueue-input | 479 | (with-current-buffer |
| 473 | (list (concat cmd "\n") 'gdb-tooltip-print))) | 480 | (window-buffer (let ((mouse (mouse-position))) |
| 474 | (t | 481 | (window-at (cadr mouse) |
| 475 | (setq tooltip-gud-original-filter (process-filter process)) | 482 | (cddr mouse)))) |
| 476 | (set-process-filter process 'tooltip-gud-process-output) | 483 | (let ((define-elt (assoc expr gdb-define-alist))) |
| 477 | (gud-basic-call cmd))) | 484 | (unless (null define-elt) |
| 478 | expr))))))) | 485 | (tooltip-show (cdr define-elt)) |
| 486 | expr)))) | ||
| 487 | (let ((cmd (tooltip-gud-print-command expr))) | ||
| 488 | (unless (null cmd) ; CMD can be nil if unknown debugger | ||
| 489 | (case gud-minor-mode | ||
| 490 | (gdba (gdb-enqueue-input | ||
| 491 | (list (concat cmd "\n") 'gdb-tooltip-print))) | ||
| 492 | (t | ||
| 493 | (setq tooltip-gud-original-filter (process-filter process)) | ||
| 494 | (set-process-filter process 'tooltip-gud-process-output) | ||
| 495 | (gud-basic-call cmd))) | ||
| 496 | expr)))))))) | ||
| 479 | 497 | ||
| 480 | (defun gdb-tooltip-print () | 498 | (defun gdb-tooltip-print () |
| 481 | (tooltip-show | 499 | (tooltip-show |
diff --git a/lisp/window.el b/lisp/window.el index b4fd664a43c..8c46addf444 100644 --- a/lisp/window.el +++ b/lisp/window.el | |||
| @@ -29,6 +29,15 @@ | |||
| 29 | 29 | ||
| 30 | ;;; Code: | 30 | ;;; Code: |
| 31 | 31 | ||
| 32 | (defvar window-size-fixed nil | ||
| 33 | "*Non-nil in a buffer means windows displaying the buffer are fixed-size. | ||
| 34 | If the value is`height', then only the window's height is fixed. | ||
| 35 | If the value is `width', then only the window's width is fixed. | ||
| 36 | Any other non-nil value fixes both the width and the height. | ||
| 37 | Emacs won't change the size of any window displaying that buffer, | ||
| 38 | unless you explicitly change the size, or Emacs has no other choice.") | ||
| 39 | (make-variable-buffer-local 'window-size-fixed) | ||
| 40 | |||
| 32 | (defmacro save-selected-window (&rest body) | 41 | (defmacro save-selected-window (&rest body) |
| 33 | "Execute BODY, then select the window that was selected before BODY. | 42 | "Execute BODY, then select the window that was selected before BODY. |
| 34 | Also restore the selected window of each frame as it was at the start | 43 | Also restore the selected window of each frame as it was at the start |