diff options
| author | Karoly Lorentey | 2006-06-12 07:27:12 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2006-06-12 07:27:12 +0000 |
| commit | 476e9367ec1f440aa23904b7bc482ea4a3b8041c (patch) | |
| tree | 4f7f5a5e9a6668f908834bb6e216c8fa3727d4b3 /lisp | |
| parent | a13f8f50d4cc544d3bbfa78568e82ce09e68bded (diff) | |
| parent | 6b519504c3297595101628e823e72c91e562ab45 (diff) | |
| download | emacs-476e9367ec1f440aa23904b7bc482ea4a3b8041c.tar.gz emacs-476e9367ec1f440aa23904b7bc482ea4a3b8041c.zip | |
Merged from emacs@sv.gnu.org.
Patches applied:
* emacs@sv.gnu.org/emacs--devo--0--patch-294
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-295
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-296
Update from CVS: admin/FOR-RELEASE: Update refcard section.
* emacs@sv.gnu.org/emacs--devo--0--patch-297
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-298
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-299
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-300
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-301
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-302
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-303
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-304
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-103
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-104
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-570
Diffstat (limited to 'lisp')
73 files changed, 5930 insertions, 2692 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index fa03faa1833..2a3aef6eb37 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,738 @@ | |||
| 1 | 2006-06-11 Chong Yidong <cyd@stupidchicken.com> | ||
| 2 | |||
| 3 | * server.el (server-edit): No-op if no server buffers exist. | ||
| 4 | |||
| 5 | 2006-06-11 Robert J. Chassell <bob@rattlesnake.com> | ||
| 6 | |||
| 7 | * textmodes/page-ext.el (pages-directory-for-addresses): | ||
| 8 | Including `pages-directory-address-mode' in the function results | ||
| 9 | in the message "Buffer in which pages were found is deleted". | ||
| 10 | |||
| 11 | 2006-06-10 Carsten Dominik <dominik@science.uva.nl> | ||
| 12 | |||
| 13 | * textmodes/org.el: (org-agenda-mode-map): Add bindings for | ||
| 14 | clocking functions. | ||
| 15 | |||
| 16 | (org-agenda-clock-in, org-check-running-clock) | ||
| 17 | (org-clock-out-if-current, org-remove-clock-overlays) | ||
| 18 | (org-put-clock-overlay): New functions. | ||
| 19 | (org-clock-marker, org-clock-file-total-minutes) | ||
| 20 | (org-clock-overlays): New variables. | ||
| 21 | (org-clock-display, org-clock-sum, org-clock-cancel) | ||
| 22 | (org-clock-out, org-clock-in): New commands. | ||
| 23 | (org-export): New function. | ||
| 24 | (org-emph-re): New constant. | ||
| 25 | (org-set-emph-re, org-do-emphasis-faces): New functions. | ||
| 26 | (org-emphasis-regexp-components, org-emphasis-alist): New options. | ||
| 27 | (org-set-font-lock-defaults): Call `org-do-emphasis-faces'. | ||
| 28 | (org-export-html-convert-emphasize): Use the configurable emphasis. | ||
| 29 | (org-cleaned-string-for-export): Make multiline emphasis visible | ||
| 30 | to the exporter. New optional argument PARAMETERS. | ||
| 31 | (org-export-as-html): Specify :emph-multiline parameter to | ||
| 32 | `org-cleaned-string-for-export'. | ||
| 33 | |||
| 34 | 2006-06-10 Richard Stallman <rms@gnu.org> | ||
| 35 | |||
| 36 | * help.el (help-for-help-internal): Clean up help text. | ||
| 37 | |||
| 38 | 2006-06-10 Andreas Schwab <schwab@suse.de> | ||
| 39 | |||
| 40 | * language/ethio-util.el (ethio-fidel-to-java-buffer): Fix quoting | ||
| 41 | in doc string. | ||
| 42 | |||
| 43 | * progmodes/cperl-mode.el (cperl-short-docs): Likewise. | ||
| 44 | |||
| 45 | 2006-06-09 Karl Chen <quarl@cs.berkeley.edu> | ||
| 46 | |||
| 47 | * progmodes/make-mode.el (makefile-fill-paragraph): Don't remove | ||
| 48 | spaces after the comment start. | ||
| 49 | |||
| 50 | 2006-06-09 Micha,Ak(Bl Cadilhac <michael.cadilhac@lrde.org> | ||
| 51 | |||
| 52 | * play/pong.el (pong-init-buffer): | ||
| 53 | Fill buffer with spaces instead of ^A. | ||
| 54 | |||
| 55 | * textmodes/ispell.el (ispell-kill-ispell): If ispell has been | ||
| 56 | launched asynchronously, delete its process instead of being cool. | ||
| 57 | (ispell-async-processp): Check for `delete-process' existence | ||
| 58 | instead of `kill-process' one for consistency. | ||
| 59 | |||
| 60 | 2006-06-09 Nick Roberts <nickrob@snap.net.nz> | ||
| 61 | |||
| 62 | * progmodes/gdb-ui.el (gdb-set-gud-minor-mode-existing-buffers-1) | ||
| 63 | (gdb-prompt, gdb-set-gud-minor-mode-existing-buffers): Show status | ||
| 64 | in mode line at startup. | ||
| 65 | |||
| 66 | 2006-06-08 Kim F. Storm <storm@cua.dk> | ||
| 67 | |||
| 68 | * ido.el (ido-take-first-match, ido-push-dir-first): New commands. | ||
| 69 | (ido-init-completion-maps): Bind them to M-SPC and M-v. | ||
| 70 | (ido-copy-current-file-name): Repeating C-w inserts whole file name. | ||
| 71 | (ido-file-internal): Pass full file name to write-file. | ||
| 72 | (ido-read-internal): Only pop stack elements automatically if they | ||
| 73 | actually match an existing directory or file name. | ||
| 74 | |||
| 75 | 2006-06-07 Kenichi Handa <handa@m17n.org> | ||
| 76 | |||
| 77 | * international/mule.el (find-auto-coding): Don't handle the short | ||
| 78 | name `char-trans'. | ||
| 79 | |||
| 80 | * files.el (hack-local-variables-prop-line) | ||
| 81 | (hack-local-variables): Cancel the previous change. | ||
| 82 | |||
| 83 | 2006-06-06 Jesper Harder <harder@phys.au.dk> | ||
| 84 | |||
| 85 | * ediff-diff.el (ediff-test-utility): Protect against | ||
| 86 | file-error. | ||
| 87 | |||
| 88 | 2006-06-06 Chong Yidong <cyd@stupidchicken.com> | ||
| 89 | |||
| 90 | * diff-mode.el (diff-mode): Set buffer-read-only to t when | ||
| 91 | diff-default-read-only is non-nill. | ||
| 92 | (diff-hunk-kill, diff-file-kill, diff-split-hunk) | ||
| 93 | (diff-refine-hunk): Set inhibit-read-only to t. | ||
| 94 | |||
| 95 | * diff.el (diff-sentinel, diff): Set inhibit-read-only to t when | ||
| 96 | modifying the *Diff* buffer. | ||
| 97 | (diff-process-filter): New filter function for diff process that | ||
| 98 | sets inhibit-read-only to t when modifying the *Diff* buffer. | ||
| 99 | |||
| 100 | 2006-06-06 Carsten Dominik <dominik@science.uva.nl> | ||
| 101 | |||
| 102 | * textmodes/org.el: (org-archive-subtree): Use end-of-subtree as | ||
| 103 | insertion point and control the number of empty lines. | ||
| 104 | (org-paste-subtree): Limit the number of empty lines at the end of | ||
| 105 | the inserted tree. | ||
| 106 | (org-agenda): Use buffer name of current file for narrowing. | ||
| 107 | (org-export-as-xml): Command removed. | ||
| 108 | (org-export-xml-type): Option removed. | ||
| 109 | (org-mode-map): Call `org-export-as-xoxo' directly. | ||
| 110 | (org-get-indentation): New optional argument LINE. | ||
| 111 | (org-fix-indentation, org-remove-tabs): New functions. | ||
| 112 | (org-export-as-ascii, org-ascii-level-start): Determine and apply | ||
| 113 | correct indentation for headlines that are converted it items. | ||
| 114 | (org-skip-comments): Remove table lines that contain narrowing | ||
| 115 | cookies but no other non-empty fields. | ||
| 116 | (org-set-tags): Allow groups of mutually exclusive tags. | ||
| 117 | (org-cmp-time): Sort 24:21 before items without time. | ||
| 118 | (org-get-time-of-day): Fixed the interpretation of 12pm and 12am. | ||
| 119 | (org-open-at-point): Require double colon also for numbers. | ||
| 120 | |||
| 121 | 2006-06-06 Kim F. Storm <storm@cua.dk> | ||
| 122 | |||
| 123 | * ido.el (ido-default-file-method, ido-default-buffer-method): | ||
| 124 | Make choice values consistent with corresponding command names. | ||
| 125 | (ido-visit-buffer): Update accordingly. Default to selected-window. | ||
| 126 | |||
| 127 | 2006-06-06 Nick Roberts <nickrob@snap.net.nz> | ||
| 128 | |||
| 129 | * progmodes/gud.el (gud-running): Fix doc string. | ||
| 130 | (gud-menu-map): Use :visible instead fo :enable for debugger test. | ||
| 131 | (gud-tooltip-modes): Add python-mode. | ||
| 132 | (gud-tooltip-print-command): Add pdb. Remove perldb. | ||
| 133 | |||
| 134 | 2006-06-05 Eli Zaretskii <eliz@gnu.org> | ||
| 135 | |||
| 136 | * makefile.w32-in (bootstrap, $(lisp)/mh-e/mh-loaddefs.el): | ||
| 137 | Quote $(EMACS). | ||
| 138 | |||
| 139 | 2006-06-05 Richard Stallman <rms@gnu.org> | ||
| 140 | |||
| 141 | * faces.el (defined-colors): Doc fix. | ||
| 142 | |||
| 143 | 2006-06-05 Thien-Thi Nguyen <ttn@gnu.org> | ||
| 144 | |||
| 145 | * vc.el (vc-process-filter): Inhibit undo info collection around | ||
| 146 | call to insert. | ||
| 147 | (vc-setup-buffer): Likewise for call to erase-buffer. | ||
| 148 | (vc-do-command): Likewise for call to process-file. | ||
| 149 | |||
| 150 | 2006-06-05 Nick Roberts <nickrob@snap.net.nz> | ||
| 151 | |||
| 152 | * progmodes/gud.el (gud-menu-map): Use a conditional help echo | ||
| 153 | for gud-go. | ||
| 154 | (gud-common-init): Other debuggers may trigger error. | ||
| 155 | |||
| 156 | 2006-06-05 Kenichi Handa <handa@m17n.org> | ||
| 157 | |||
| 158 | * international/mule.el (find-auto-coding): Handle | ||
| 159 | enable-character-translation in file header. | ||
| 160 | |||
| 161 | 2006-06-04 Kim F. Storm <storm@cua.dk> | ||
| 162 | |||
| 163 | * emacs-lisp/authors.el (authors-aliases): Add mode aliases. | ||
| 164 | (authors-fixed-entries): Fix spelling. | ||
| 165 | (authors-canonical-file-name): Don't report error for wildcards. | ||
| 166 | |||
| 167 | * help.el (view-emacs-news): Rewrite to support new NEWS, | ||
| 168 | NEWS.major, and NEWS.1-17 file naming. Add more intelligense, | ||
| 169 | e.g. version 10 matches 1.10, and don't be confused by version 1.1 | ||
| 170 | begin a prefix of 1.12 (etc). A numeric prefix arg also works. | ||
| 171 | |||
| 172 | 2006-06-03 Vivek Dasmohapatra <vivek@etla.org> | ||
| 173 | |||
| 174 | * progmodes/sh-script.el (sh-quoted-exec): New face for quoted | ||
| 175 | exec constructs like `foo bar`. | ||
| 176 | (sh-quoted-subshell): New helper function to search for a possibly | ||
| 177 | nested subshell (like `` or $()) within a "" quoted string. | ||
| 178 | (sh-font-lock-keywords-var): Add sh-quoted-exec for Bash. | ||
| 179 | (sh-apply-quoted-subshell): Flag quote characters inside a | ||
| 180 | subshell, which is itself already in a quoted region, as | ||
| 181 | punctuation, since this is the closest to what they actually are. | ||
| 182 | (sh-font-lock-syntactic-keywords): Add sh-quoted-subshell and | ||
| 183 | sh-apply-quoted-subshell. | ||
| 184 | (sh-font-lock-syntactic-face-function): Apply the new face for | ||
| 185 | text inside `` instead of the old font-lock-string-face. | ||
| 186 | |||
| 187 | 2006-06-03 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 188 | |||
| 189 | * term/mac-win.el (mac-ts-active-input-overlay): Add defvar. | ||
| 190 | (mac-ae-number, mac-ae-frame, mac-ae-script-language) | ||
| 191 | (mac-bytes-to-text-range, mac-ae-text-range-array) | ||
| 192 | (mac-ts-update-active-input-buf, mac-split-string-by-property-change) | ||
| 193 | (mac-replace-untranslated-utf-8-chars, mac-ts-update-active-input-area) | ||
| 194 | (mac-ts-unicode-for-key-event): New functions. | ||
| 195 | (mac-handle-toolbar-switch-mode): Use mac-ae-frame. | ||
| 196 | (mac-handle-font-selection): Use mac-ae-number. | ||
| 197 | (mac-ts-active-input-buf, mac-ts-update-active-input-area-seqno): | ||
| 198 | New variables. | ||
| 199 | (mac-ts-caret-position, mac-ts-raw-text, mac-ts-selected-raw-text) | ||
| 200 | (mac-ts-converted-text, mac-ts-selected-converted-text) | ||
| 201 | (mac-ts-block-fill-text, mac-ts-outline-text) | ||
| 202 | (mac-ts-selected-text, mac-ts-no-hilite): New faces. | ||
| 203 | (mac-ts-hilite-style-faces): New constant. | ||
| 204 | (mac-apple-event-map): Bind text input events. | ||
| 205 | (mac-dispatch-apple-event): Use command-execute instead of | ||
| 206 | call-interactively. | ||
| 207 | (global-map): Don't bind mac-apple-event. | ||
| 208 | (special-event-map): Bind mac-apple-event. | ||
| 209 | |||
| 210 | 2006-06-02 Eli Zaretskii <eliz@gnu.org> | ||
| 211 | |||
| 212 | * makefile.w32-in (EMACS): Remove quotes from the Emacs executable | ||
| 213 | file name. | ||
| 214 | (emacs): Enclose the value of $(EMACS) in quotes. | ||
| 215 | |||
| 216 | 2006-06-02 Juri Linkov <juri@jurta.org> | ||
| 217 | |||
| 218 | * international/mule.el (sgml-html-meta-auto-coding-function): | ||
| 219 | Remove the condition `(search-forward "<html" size t)'. | ||
| 220 | Replace `\"' with `[\"']?' in `re-search-forward'. | ||
| 221 | |||
| 222 | 2006-06-02 Kenichi Handa <handa@m17n.org> | ||
| 223 | |||
| 224 | * files.el (hack-local-variables-prop-line): Ignore `char-trans' | ||
| 225 | as well as `coding'. | ||
| 226 | (hack-local-variables): Likewise. | ||
| 227 | |||
| 228 | * international/mule.el (enable-character-translation): Put | ||
| 229 | permanent-local and safe-local-variable properties. | ||
| 230 | (find-auto-coding): Handle char-trans: tag. | ||
| 231 | |||
| 232 | 2006-06-02 Juri Linkov <juri@jurta.org> | ||
| 233 | |||
| 234 | * international/mule.el (sgml-html-meta-auto-coding-function): | ||
| 235 | Limit the search by the end of the HTML header (if any). | ||
| 236 | |||
| 237 | 2006-06-01 Richard Stallman <rms@gnu.org> | ||
| 238 | |||
| 239 | * subr.el (with-current-buffer): Doc fix. | ||
| 240 | |||
| 241 | 2006-06-02 Masatake YAMATO <jet@gyve.org> | ||
| 242 | |||
| 243 | * progmodes/compile.el (compilation-error-regexp-alist-alist::gcov-*): | ||
| 244 | Almost rewrite. Underlines over all lines of gcov output are too | ||
| 245 | uncomfortable to read. Suggested by Dan Nicolaescu. | ||
| 246 | |||
| 247 | 2006-06-01 Luc Teirlinck <teirllm@auburn.edu> | ||
| 248 | |||
| 249 | * progmodes/inf-lisp.el (inferior-lisp-mode): Doc fixes. | ||
| 250 | |||
| 251 | * shell.el (shell-mode): Use shell-mode-map in docstring. | ||
| 252 | |||
| 253 | * comint.el (comint-send-input): Do not add help-echo and | ||
| 254 | mouse-face to input if `comint-use-prompt-regexp' is non-nil. | ||
| 255 | |||
| 256 | 2006-06-01 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 257 | |||
| 258 | * term/x-win.el: Change x-menu-bar-start to menu-bar-open. | ||
| 259 | |||
| 260 | 2006-06-01 Nick Roberts <nickrob@snap.net.nz> | ||
| 261 | |||
| 262 | * progmodes/gdb-ui.el (gdb-look-up-stack): New variable. | ||
| 263 | (gdb-stopped, gdb-info-stack-custom): If there is no source info | ||
| 264 | look up the stack and pop up GUD buffer if necessary. | ||
| 265 | (gdb-frames-select): Remove redundant call to gud-display-frame. | ||
| 266 | (gdb-info-threads-custom): Keep point at start of buffer. | ||
| 267 | (gdb-find-file-hook): Make it work for pre-GDB 6.4. | ||
| 268 | |||
| 269 | 2006-05-31 Juri Linkov <juri@jurta.org> | ||
| 270 | |||
| 271 | * replace.el (query-replace-read-from, query-replace-read-to): | ||
| 272 | Bind `history-add-new-input' to nil. Call `add-to-history'. | ||
| 273 | |||
| 274 | 2006-05-31 Takaaki Ota <Takaaki.Ota@am.sony.com> | ||
| 275 | |||
| 276 | * textmodes/table.el: Convert all HTML tags to lower case for | ||
| 277 | XHTML compatibility. | ||
| 278 | |||
| 279 | 2006-05-31 Masatake YAMATO <jet@gyve.org> | ||
| 280 | |||
| 281 | * progmodes/compile.el: | ||
| 282 | (compilation-error-regexp-alist-alist::gcov-called-line): | ||
| 283 | Don't put face on `-' lines in gcov file. Suggested by Dan Nicolaescu. | ||
| 284 | |||
| 285 | 2006-05-31 Nick Roberts <nickrob@snap.net.nz> | ||
| 286 | |||
| 287 | * progmodes/gud.el (gud-query-cmdline, gud-common-init): | ||
| 288 | Revert inadvertant changes made with last commit. | ||
| 289 | |||
| 290 | 2006-05-30 Reiner Steib <Reiner.Steib@gmx.de> | ||
| 291 | |||
| 292 | * textmodes/flyspell.el (turn-on-flyspell, turn-off-flyspell): | ||
| 293 | New functions. | ||
| 294 | |||
| 295 | * textmodes/text-mode.el (text-mode-hook): Use turn-on-flyspell. | ||
| 296 | |||
| 297 | 2006-05-30 Carsten Dominik <dominik@science.uva.nl> | ||
| 298 | |||
| 299 | * textmodes/org.el: (org-agenda-highlight-todo): Make sure regexp | ||
| 300 | only matches in the right place. | ||
| 301 | (org-upcoming-deadline): New face. | ||
| 302 | (org-agenda-get-deadlines): Use new face `org-upcoming-deadline'. | ||
| 303 | (org-export-ascii-underline): Rename constant `org-ascii-underline' | ||
| 304 | and make it an option. | ||
| 305 | (org-export-ascii-bullets): New option. | ||
| 306 | (org-export-as-html): Many changes to emit valid XHTML. | ||
| 307 | (org-par-open): New variable. | ||
| 308 | (org-open-par, org-close-par-maybe, org-close-li-maybe): New functions. | ||
| 309 | (org-html-do-expand, org-section-number): Fixedcase in `replace-match'. | ||
| 310 | (org-timeline): Pass `org-timeline-show-empty-dates' to | ||
| 311 | `org-get-all-dates'. Interpret empty dates returned by `org-get-all-dates'. | ||
| 312 | (org-get-all-dates): New argument EMPTY. Add dates without | ||
| 313 | entries to the list, mark large ranges of empty dates. | ||
| 314 | (org-point-in-group, org-context): New functions. | ||
| 315 | |||
| 316 | 2006-05-30 Nick Roberts <nickrob@snap.net.nz> | ||
| 317 | |||
| 318 | * progmodes/gud.el (gud-stop-subjob): Make it work in all buffers. | ||
| 319 | |||
| 320 | * progmodes/gdb-ui.el: Move gdb-mouse-toggle-breakpoint-* to | ||
| 321 | C-mouse-1. Move gdb-mouse-until to mouse-3, gdb-mouse-jump | ||
| 322 | to C-mouse-3 (for 2 button mice). | ||
| 323 | (gdb-send): Do the right thing for C-d. | ||
| 324 | |||
| 325 | * speedbar.el (speedbar-detach): Delete. | ||
| 326 | (speedbar-easymenu-definition-trailer): Remove speedbar-detach as | ||
| 327 | it breaks things. | ||
| 328 | (speedbar-reconfigure-keymaps): Always add extra items to pop up menu. | ||
| 329 | |||
| 330 | 2006-05-30 Daniel Pfeiffer <occitan@esperanto.org> | ||
| 331 | |||
| 332 | * files.el (auto-mode-alist): Add makepp suffix and optional mk on | ||
| 333 | Makeppfile. | ||
| 334 | |||
| 335 | * progmodes/compile.el (compilation-error-regexp-alist-alist): | ||
| 336 | Add makepp diagnostic. | ||
| 337 | |||
| 338 | 2006-05-29 Richard Stallman <rms@gnu.org> | ||
| 339 | |||
| 340 | * window.el (fit-window-to-buffer): Doc fix. | ||
| 341 | |||
| 342 | * help.el (temp-buffer-max-height): Doc fix. | ||
| 343 | |||
| 344 | * subr.el (with-current-buffer): Doc fix. | ||
| 345 | |||
| 346 | 2006-05-29 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 347 | |||
| 348 | * term/x-win.el: Bind F10 to menu-bar-start if available. | ||
| 349 | |||
| 350 | 2006-05-28 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 351 | |||
| 352 | * term.el (term-if-xemacs, term-ifnot-xemacs): Delete, replace | ||
| 353 | uses with a simple test. | ||
| 354 | (term-set-escape-char, term-mode, term-check-kill-echo-list) | ||
| 355 | (term-send-raw-string, term-send-raw, term-mouse-paste) | ||
| 356 | (term-char-mode, term-line-mode, term-exec, term-sentinel) | ||
| 357 | (term-handle-exit, term-read-input-ring) | ||
| 358 | (term-previous-matching-input-string) | ||
| 359 | (term-previous-matching-input-string-position) | ||
| 360 | (term-previous-matching-input-from-input) | ||
| 361 | (term-replace-by-expanded-history, term-send-input) | ||
| 362 | (term-skip-prompt, term-bol, term-send-invisible) | ||
| 363 | (term-kill-input, term-delchar-or-maybe-eof) | ||
| 364 | (term-backward-matching-input, term-check-source) | ||
| 365 | (term-proc-query, term-emulate-terminal) | ||
| 366 | (term-handle-colors-array, term-process-pager, term-pager-line) | ||
| 367 | (term-pager-bob, term-unwrap-line, term-word) | ||
| 368 | (term-dynamic-complete-filename) | ||
| 369 | (term-dynamic-complete-as-filename) | ||
| 370 | (term-dynamic-simple-complete): Replace one arm ifs with whens or | ||
| 371 | unlesses. | ||
| 372 | |||
| 373 | 2006-05-29 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 374 | |||
| 375 | * files.el (hack-one-local-variable-eval-safep): Don't burp if used | ||
| 376 | during bootstrapping. | ||
| 377 | |||
| 378 | * emacs-lisp/ewoc.el (ewoc--current-dll): Remove. | ||
| 379 | Basically undo the change of 2006-05-26: use extra arguments instead of | ||
| 380 | dynamic scoping. | ||
| 381 | (ewoc-locate): Remove unused var `footer'. | ||
| 382 | |||
| 383 | 2006-05-28 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 384 | |||
| 385 | * emacs-lisp/ewoc.el (ewoc--insert-new-node): Use ewoc--refresh-node. | ||
| 386 | |||
| 387 | * emacs-lisp/autoload.el (no-update-autoloads): Declare. | ||
| 388 | (generate-file-autoloads): Obey it. Return whether autoloads were | ||
| 389 | added at point or not. | ||
| 390 | (update-file-autoloads): Use this new return value. | ||
| 391 | Remove redundant test for the presence of an autoload cookie. | ||
| 392 | |||
| 393 | * emacs-lisp/autoload.el (autoload-find-file): New fun. | ||
| 394 | This one calls hack-local-variables. | ||
| 395 | (generate-file-autoloads, update-file-autoloads): Use it. | ||
| 396 | |||
| 397 | * textmodes/bibtex.el (bibtex-autokey-name-case-convert-function) | ||
| 398 | (bibtex-sort-entry-class): Add safe-local-variable predicate. | ||
| 399 | (bibtex-sort-entry-class-alist): Don't set the global value. | ||
| 400 | (bibtex-init-sort-entry-class-alist): New fun. | ||
| 401 | (bibtex-sort-buffer, bibtex-prepare-new-entry): Call it to compute | ||
| 402 | bibtex-init-sort-entry-class-alist from the buffer-local value (if any) | ||
| 403 | of bibtex-init-sort-entry-class. | ||
| 404 | |||
| 405 | 2006-05-28 Richard Stallman <rms@gnu.org> | ||
| 406 | |||
| 407 | * subr.el (load-history-regexp): If FILE is relative, insist | ||
| 408 | entire last name component must match it. | ||
| 409 | (load-history-filename-element, load-history-regexp): Doc fixes. | ||
| 410 | |||
| 411 | 2006-05-29 Kim F. Storm <storm@cua.dk> | ||
| 412 | |||
| 413 | * emacs-lisp/bindat.el (bindat-idx, bindat-raw): Rename dynamic vars | ||
| 414 | `pos' and `raw-data' for clarity, as eval forms may access these. | ||
| 415 | |||
| 416 | 2006-05-28 Kim F. Storm <storm@cua.dk> | ||
| 417 | |||
| 418 | * emacs-lisp/bindat.el (bindat--unpack-u8): Use aref also for strings. | ||
| 419 | |||
| 420 | 2006-05-28 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 421 | |||
| 422 | * progmodes/make-mode.el (makefile-browser-map) | ||
| 423 | (makefile-mode-syntax-table): Move initialization inside declaration. | ||
| 424 | (makefile-fill-paragraph): Use the default comment-filling code. | ||
| 425 | |||
| 426 | 2006-05-28 Chong Yidong <cyd@stupidchicken.com> | ||
| 427 | |||
| 428 | * replace.el (query-replace-defaults): New variable. | ||
| 429 | (query-replace-read-from): Use `query-replace-defaults' for | ||
| 430 | default value, instead of history list. | ||
| 431 | (query-replace-read-to): Update `query-replace-defaults'. | ||
| 432 | |||
| 433 | 2006-05-27 Chong Yidong <cyd@stupidchicken.com> | ||
| 434 | |||
| 435 | * msb.el (mouse-select-buffer): Minor fix to make popup menu work | ||
| 436 | with no X toolkit. | ||
| 437 | |||
| 438 | 2006-05-28 Nick Roberts <nickrob@snap.net.nz> | ||
| 439 | |||
| 440 | * tumme.el (tumme-show-all-from-dir-max-files): Fix typo. | ||
| 441 | (tumme-show-all-from-dir): Add autoload. | ||
| 442 | |||
| 443 | 2006-05-27 Mathias Dahl <mathias.dahl@gmail.com> | ||
| 444 | |||
| 445 | * tumme.el: Change a lot of `(if .. (progn ..)' to `(when ..)'. | ||
| 446 | (tumme-remove-tag): Fix bug. | ||
| 447 | |||
| 448 | 2006-05-27 Thien-Thi Nguyen <ttn@gnu.org> | ||
| 449 | |||
| 450 | * emacs-lisp/ewoc.el (ewoc--create): No longer take HEADER and | ||
| 451 | FOOTER args. Update unique caller. | ||
| 452 | (ewoc-delete): Compute last node once before looping. | ||
| 453 | (ewoc--node-branch): Merge into unique caller. | ||
| 454 | (ewoc--node): Don't define constructor make-ewoc--node for this | ||
| 455 | structure. | ||
| 456 | (ewoc): Add member `hf-pp' to this structure. | ||
| 457 | (ewoc--wrap): New func. | ||
| 458 | (ewoc-create): Take additional arg NOSEP. If nil, wrap node and | ||
| 459 | header/footer pretty-printers. Save header/footer pretty-printer. | ||
| 460 | (ewoc-set-hf): Use ewoc's header/footer pretty-printer. * | ||
| 461 | |||
| 462 | * pcvs.el (cvs-make-cvs-buffer): Specify NOSEP to `ewoc-create'. | ||
| 463 | |||
| 464 | 2006-05-27 Mathias Dahl <mathias.dahl@gmail.com> | ||
| 465 | |||
| 466 | * dired.el (dired-mode-map): Change `tumme-tag-remove' to | ||
| 467 | `tumme-delete-tag'. Rename `Remove Image Tag' to `Delete Image | ||
| 468 | Tag'. Change "Compare directories..." to "Change Directories...". | ||
| 469 | Move tumme commands to Operate, Regexp and Immediate menus. | ||
| 470 | Change "Add Comment" to "Add Image Comment". Change "Add Image | ||
| 471 | Tag" to "Add Image Tags". | ||
| 472 | |||
| 473 | * tumme.el (tumme-delete-tag): Rename from `tumme-tag-remove'. | ||
| 474 | (tumme-setup-dired-keybindings): Change `tumme-add-remove' to | ||
| 475 | `tumme-delete-tag'. | ||
| 476 | |||
| 477 | 2006-05-26 Luc Teirlinck <teirllm@auburn.edu> | ||
| 478 | |||
| 479 | * shell.el (shell-mode): Call shell-dirtrack-mode after | ||
| 480 | list-buffers-directory is made a local variable, to avoid setting | ||
| 481 | the default value. | ||
| 482 | |||
| 483 | 2006-05-26 Kevin Ryde <user42@zip.com.au> | ||
| 484 | |||
| 485 | * info.el (Info-index-next): Use where-is-internal to report | ||
| 486 | actual binding of Info-index-next, rather than hard-coded `,'. | ||
| 487 | |||
| 488 | 2006-05-26 Eli Zaretskii <eliz@gnu.org> | ||
| 489 | |||
| 490 | * menu-bar.el (menu-bar-apropos-menu): Move "Find Key in Manual" | ||
| 491 | and "Find Command in Manual" to here. | ||
| 492 | |||
| 493 | * buff-menu.el (list-buffers-noselect): For Info buffers, use | ||
| 494 | Info-current-file as the file name. | ||
| 495 | |||
| 496 | 2006-05-26 Jonathan Yavner <jyavner@member.fsf.org> | ||
| 497 | |||
| 498 | * ses.el (defadvice undo-more): Delete this defadvice. The undo | ||
| 499 | overrides will now be done a different way. | ||
| 500 | (ses-set-parameter): Reapply this function for undo. | ||
| 501 | (ses-set-header-row): Reconstruct header row during undo. | ||
| 502 | (ses-widen): New function. | ||
| 503 | (ses-goto-data, ses-reconstruct-all): Use new function. | ||
| 504 | (ses-command-hook): Widen buffer during undo, before unupdating | ||
| 505 | the cells. | ||
| 506 | (ses-insert-row, ses-delete-row): Widen buffer during undo. | ||
| 507 | (ses-load, ses-header-row): Permit empty (zero-row) spreadsheets. | ||
| 508 | (ses-read-cell): Avoid stupid warning for RET RET on a cell whose | ||
| 509 | formula hasn't been executed yet. | ||
| 510 | |||
| 511 | 2006-05-26 Reiner Steib <Reiner.Steib@gmx.de> | ||
| 512 | |||
| 513 | * comint.el (comint-kill-whole-line): Rename arg to count. | ||
| 514 | Fix doc string. | ||
| 515 | |||
| 516 | 2006-05-26 Chong Yidong <cyd@stupidchicken.com> | ||
| 517 | |||
| 518 | * files.el (backup-buffer-copy): Remove deleted MUSTBENEW argument | ||
| 519 | to copy-file. | ||
| 520 | |||
| 521 | 2006-05-26 Reiner Steib <Reiner.Steib@gmx.de> | ||
| 522 | |||
| 523 | * simple.el (toggle-truncate-lines): Make arg optional for | ||
| 524 | backward compatibility. | ||
| 525 | |||
| 526 | 2006-05-26 Thien-Thi Nguyen <ttn@gnu.org> | ||
| 527 | |||
| 528 | * emacs-lisp/ewoc.el (ewoc--current-dll): New var. | ||
| 529 | (ewoc--node-next, ewoc--node-prev, ewoc--node-nth): Don't take | ||
| 530 | DLL arg. Instead, use ewoc--current-dll. Update all callers. | ||
| 531 | (ewoc--set-buffer-bind-dll-let*): Bind ewoc--current-dll, not `dll'. | ||
| 532 | (ewoc--adjust): Use ewoc--current-dll. | ||
| 533 | (ewoc-next, ewoc-prev, ewoc-nth): Bind ewoc--current-dll. | ||
| 534 | |||
| 535 | 2006-05-26 Carsten Dominik <dominik@science.uva.nl> | ||
| 536 | |||
| 537 | * textmodes/org.el: (org-next-item, org-previous-item): Emit more | ||
| 538 | compact error message. | ||
| 539 | (org-tags-view): Refresh category table in each file. | ||
| 540 | (org-table-justify-field-maybe): Remove superfluous arguments to | ||
| 541 | `format'. | ||
| 542 | (org-export-as-html): Insert "<p>" before postamble. | ||
| 543 | (org-paste-subtree, org-kill-is-subtree-p): Check for empty kill ring. | ||
| 544 | |||
| 545 | 2006-05-26 Kenichi Handa <handa@m17n.org> | ||
| 546 | |||
| 547 | * textmodes/po.el (po-find-charset): Pay attention to the case | ||
| 548 | FILENAME is a cons (NAME . BUFFER). | ||
| 549 | (po-find-file-coding-system-guts): Likewise. | ||
| 550 | |||
| 551 | * arc-mode.el (archive-set-buffer-as-visiting-file): | ||
| 552 | Call find-operation-coding-system with (FILENAME . BUFFER). | ||
| 553 | |||
| 554 | * tar-mode.el (tar-extract): Call find-operation-coding-system | ||
| 555 | with (FILENAME . BUFFER). | ||
| 556 | |||
| 557 | * international/mule.el (decode-coding-inserted-region): | ||
| 558 | Call find-operation-coding-system with (FILENAME . BUFFER). | ||
| 559 | |||
| 560 | 2006-05-25 Chong Yidong <cyd@stupidchicken.com> | ||
| 561 | |||
| 562 | * image-mode.el (image-toggle-display): Use buffer contents to | ||
| 563 | generate image for a remote file. | ||
| 564 | |||
| 565 | 2006-05-25 Juri Linkov <juri@jurta.org> | ||
| 566 | |||
| 567 | * replace.el (query-replace-read-from, query-replace-read-to): | ||
| 568 | Remove 8th arg KEEP-ALL in read-from-minibuffer. | ||
| 569 | |||
| 570 | 2006-05-25 Rajesh Vaidheeswarran <rv@gnu.org> | ||
| 571 | |||
| 572 | * whitespace.el (whitespace-cleanup): Change to cleanup | ||
| 573 | region if one is active. | ||
| 574 | * whitespace.el (whitespace-cleanup-internal): New internal method. | ||
| 575 | |||
| 576 | 2006-05-25 Mathias Dahl <mathias.dahl@gmail.com> | ||
| 577 | |||
| 578 | * dired.el (dired-mode-map): Add help-echo strings to tumme | ||
| 579 | commands. Bind `tumme-dired-display-image' to C-t i. | ||
| 580 | |||
| 581 | * tumme.el (tumme-display-image): Change documentation string slightly. | ||
| 582 | (tumme-dired-display-image): Add call to `display-buffer'. | ||
| 583 | |||
| 584 | 2006-05-25 Thien-Thi Nguyen <ttn@gnu.org> | ||
| 585 | |||
| 586 | * emacs-lisp/bindat.el (bindat-unpack, bindat-pack): | ||
| 587 | Signal error if RAW-DATA is a multibyte string. | ||
| 588 | |||
| 589 | 2006-05-24 Richard Stallman <rms@gnu.org> | ||
| 590 | |||
| 591 | * subr.el (with-local-quit): When handling `quit' signal, | ||
| 592 | make a chance for quit-flag to cause a quit. | ||
| 593 | |||
| 594 | * emacs-lisp/advice.el (ad-enable-advice, ad-activate) | ||
| 595 | (ad-disable-advice): Add autoloads. | ||
| 596 | |||
| 597 | * subr.el (read-passwd): Copy PROMPT before changing its properties. | ||
| 598 | |||
| 599 | 2006-05-25 Mathias Dahl <mathias.dahl@gmail.com> | ||
| 600 | |||
| 601 | * dired.el (dired-mode-map): Change menu items for tumme as per | ||
| 602 | suggestions in emacs-devel. | ||
| 603 | |||
| 604 | 2006-05-25 Nick Roberts <nickrob@snap.net.nz> | ||
| 605 | |||
| 606 | * dired.el (dired-mode-map): Fix breakage. | ||
| 607 | |||
| 608 | 2006-05-25 Mathias Dahl <mathias.dahl@gmail.com> | ||
| 609 | |||
| 610 | * tumme.el (tumme-display-dired-image): Rename to... | ||
| 611 | (tumme-dired-display-image): ...this. | ||
| 612 | (tumme-track-movement): Change default value to t. | ||
| 613 | (tumme-display-thumbs): Add new optional parameter DO-NOT-POP, | ||
| 614 | used from `tumme-next-line-and-display' and similar commands. | ||
| 615 | |||
| 616 | * dired.el (dired-mode-map): Add Thumbnail submenu under the | ||
| 617 | Immediate menu. Add some tumme commands there. | ||
| 618 | |||
| 619 | 2006-05-24 Luc Teirlinck <teirllm@auburn.edu> | ||
| 620 | |||
| 621 | * loadup.el ("jka-cmpr-hook"): Load it before it is needed. | ||
| 622 | |||
| 623 | 2006-05-24 Chong Yidong <cyd@mit.edu> | ||
| 624 | |||
| 625 | * menu-bar.el, international/mule-cmds.el: Remove tooltips for | ||
| 626 | menu entries that open submenus. | ||
| 627 | |||
| 628 | 2006-05-24 Alan Mackenzie <acm@muc.de> | ||
| 629 | |||
| 630 | * startup.el (command-line): For names of preloaded files, don't | ||
| 631 | append ".elc" (now done in Fload), and call file-truename on the | ||
| 632 | lisp directory. | ||
| 633 | |||
| 634 | * subr.el (eval-after-load): Fix the doc-string. Allow FILE to | ||
| 635 | match ANY loaded file with the right name, not just those in | ||
| 636 | load-path. Put a regexp matching the file name into | ||
| 637 | after-load-alist, rather than the name itself. | ||
| 638 | |||
| 639 | * subr.el: New functions load-history-regexp, | ||
| 640 | load-history-filename-element, do-after-load-evaluation. | ||
| 641 | |||
| 642 | * international/mule.el (load-with-code-conversion): Do the | ||
| 643 | eval-after-load stuff by calling do-after-load-evaluation. | ||
| 644 | |||
| 645 | 2006-05-25 Nick Roberts <nickrob@snap.net.nz> | ||
| 646 | |||
| 647 | * progmodes/gud.el (gud-sentinel): Condition on GUD buffer if it | ||
| 648 | has not been killed. | ||
| 649 | |||
| 650 | 2006-05-24 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 651 | |||
| 652 | * term/mac-win.el: Set idle timer to clean up expired Apple events. | ||
| 653 | (mac-ae-get-url): Redispatch Apple event on unknown scheme. | ||
| 654 | (mac-dispatch-apple-event): Resume Apple event if it is suspended. | ||
| 655 | Optionally set error message in reply. | ||
| 656 | |||
| 657 | 2006-05-24 Carsten Dominik <dominik@science.uva.nl> | ||
| 658 | |||
| 659 | * textmodes/org.el: (org-open-at-point): Use renamed variable | ||
| 660 | `org-confirm-shell-link-function'. | ||
| 661 | (org-confirm-shell-link-function): Rename from | ||
| 662 | `org-confirm-shell-links'. | ||
| 663 | (org-export-directory): New function. | ||
| 664 | (org-export-as-ascii, org-export-as-html, org-export-as-xoxo) | ||
| 665 | (org-export-icalendar): Use `org-export-directory'. | ||
| 666 | (org-indent-item): Keep cursor position. | ||
| 667 | (org-link-file-path-type): New option. | ||
| 668 | (org-export-as-html): Fix bug with plain lists starting in | ||
| 669 | column 0. | ||
| 670 | (org-export-as-html): Remove deadline formatting, this happens | ||
| 671 | now already in `org-html-handle-time-stamps'. | ||
| 672 | (org-export-html-style): Deadline class removed. | ||
| 673 | (org-insert-labeled-timestamps-at-point): New option. | ||
| 674 | (org-cycle, org-occur, org-scan-tags): Use `org-overview' instead | ||
| 675 | of `hide-sublevels 1', in case the first headline is not level 1. | ||
| 676 | (org-overview, org-content): New fuction. | ||
| 677 | (org-cycle-global-status, org-cycle-subtree-status): Make these | ||
| 678 | variables buffer-local. | ||
| 679 | (org-global-cycle): New command. | ||
| 680 | (org-shifttab): Use `org-global-cycle'. | ||
| 681 | (org-insert-heading, org-insert-item): Go to end of new | ||
| 682 | headline/item after creating it. | ||
| 683 | (org-export-visible): Rename from `org-export-copy-visible'. | ||
| 684 | Now creates a temporary org-file and applies an exporting command | ||
| 685 | to it. | ||
| 686 | (org-table-eval-formula): Support for lisp forms. | ||
| 687 | (org-agenda-todo-ignore-scheduled): New option. | ||
| 688 | (org-agenda-get-todos): Use new option | ||
| 689 | `org-agenda-todo-ignore-scheduled'. | ||
| 690 | (org-export-html-inline-images): New value `maybe'. | ||
| 691 | (org-export-as-html): Inlining of images dependent on link description. | ||
| 692 | (org-archive-subtree): Check for end-of-buffer before trying | ||
| 693 | `kill-line'. | ||
| 694 | (org-agenda-follow-mode): New option. | ||
| 695 | (org-export-with-tags, org-export-with-timestamps): New options. | ||
| 696 | (org-html-handle-time-stamps): New function. | ||
| 697 | (org-keyword-time-regexp): New variable. | ||
| 698 | (org-agenda-get-todos): Use `org-agenda-todo-list-sublevels'. | ||
| 699 | (org-agenda-todo-list-sublevels): New option. | ||
| 700 | (org-html-level-start): When TITLE is nil, just close all levels. | ||
| 701 | (org-parse-key-lines, org-parse-export-options): Remove functions, | ||
| 702 | replaced by `org-infile-export-plist'. | ||
| 703 | (org-combine-plists, org-infile-export-plist) | ||
| 704 | (org-default-export-plist): New functions. | ||
| 705 | (org-export-html-preamble, org-export-html-postamble) | ||
| 706 | (org-export-html-auto-preamble, org-export-html-auto-postamble): | ||
| 707 | New variables. | ||
| 708 | (org-export-publishing-directory): New option. | ||
| 709 | (org-export-as-html, org-export-as-ascii): Use the new property | ||
| 710 | lists for settings. | ||
| 711 | (org-export-copy-visible, org-export-as-xoxo): | ||
| 712 | Respect `org-export-publishing-directory'. | ||
| 713 | (org-link-search, org-store-link, org-file-apps): Support for | ||
| 714 | links to BibTeX database entries.. | ||
| 715 | (org-get-current-options, org-set-regexps-and-options): | ||
| 716 | Implement logging as a startup option. | ||
| 717 | (org-store-link): Make sure context string is never empty | ||
| 718 | (org-insert-link): Use relative path when possible. | ||
| 719 | (org-at-item-checklet-p): New function. | ||
| 720 | (org-shifttab, org-shiftmetaleft, org-shiftmetaright) | ||
| 721 | (org-shiftmetaup, org-shiftmetadown, org-metaleft) | ||
| 722 | (org-metaright, org-metaup, org-metadown, org-shiftup) | ||
| 723 | (org-shiftdown, org-shiftright, org-shiftleft) | ||
| 724 | (org-ctrl-c-ctrl-c, org-cycle, org-return, org-meta-return): | ||
| 725 | Dispatch using `call-interactively'. | ||
| 726 | (org-call-with-arg): New defsubst. | ||
| 727 | (org-tag-alist, org-use-fast-tag-selection): New options. | ||
| 728 | (org-complete): Use `org-tag-alist'. | ||
| 729 | (org-fast-tag-insert, org-fast-tag-selection): New functions. | ||
| 730 | (org-next-item, org-previous-item): New commands. | ||
| 731 | (org-beginning-of-item, org-end-of-item): Add (interactive) to | ||
| 732 | make command. | ||
| 733 | (org-shiftup, org-shiftdown): Accommodate the item-navigation commands. | ||
| 734 | |||
| 735 | |||
| 1 | 2006-05-23 Thien-Thi Nguyen <ttn@gnu.org> | 736 | 2006-05-23 Thien-Thi Nguyen <ttn@gnu.org> |
| 2 | 737 | ||
| 3 | * emacs-lisp/ewoc.el (ewoc-delete): New function. | 738 | * emacs-lisp/ewoc.el (ewoc-delete): New function. |
| @@ -94,7 +829,7 @@ | |||
| 94 | have non-nil values. Speed up by using add-to-list instead of | 829 | have non-nil values. Speed up by using add-to-list instead of |
| 95 | manual consing. | 830 | manual consing. |
| 96 | 831 | ||
| 97 | 2006-05-20 Micha,Ak(Bl Cadilhac <michael.cadilhac@lrde.org> (tiny change) | 832 | 2006-05-20 Micha,Ak(Bl Cadilhac <michael.cadilhac@lrde.org> |
| 98 | 833 | ||
| 99 | * progmodes/make-mode.el (makefile-mode): Doc fix. | 834 | * progmodes/make-mode.el (makefile-mode): Doc fix. |
| 100 | 835 | ||
| @@ -391,8 +1126,7 @@ | |||
| 391 | Move `safe-local-variable' declarations to the respective files. | 1126 | Move `safe-local-variable' declarations to the respective files. |
| 392 | 1127 | ||
| 393 | * help-fns.el (describe-variable): Don't print safe-var if it is | 1128 | * help-fns.el (describe-variable): Don't print safe-var if it is |
| 394 | byte-code. Improve wording as suggested by Luc Teirlinck | 1129 | byte-code. Improve wording as suggested by Luc Teirlinck. |
| 395 | <teirllm@auburn.edu>. | ||
| 396 | 1130 | ||
| 397 | 2006-05-11 Nick Roberts <nickrob@snap.net.nz> | 1131 | 2006-05-11 Nick Roberts <nickrob@snap.net.nz> |
| 398 | 1132 | ||
| @@ -659,7 +1393,7 @@ | |||
| 659 | reference to the Lisp manual to the warning about pure space | 1393 | reference to the Lisp manual to the warning about pure space |
| 660 | overflow. | 1394 | overflow. |
| 661 | 1395 | ||
| 662 | 2006-05-05 Micha,Ak(Bl Cadilhac <michael.cadilhac@lrde.org> (tiny change) | 1396 | 2006-05-05 Micha,Ak(Bl Cadilhac <michael.cadilhac@lrde.org> |
| 663 | 1397 | ||
| 664 | * textmodes/ispell.el (ispell-buffer-local-dict): Add a `no-reload' | 1398 | * textmodes/ispell.el (ispell-buffer-local-dict): Add a `no-reload' |
| 665 | argument to avoid the call to `ispell-internal-change-dictionary' | 1399 | argument to avoid the call to `ispell-internal-change-dictionary' |
| @@ -1519,7 +2253,7 @@ | |||
| 1519 | * files.el (hack-local-variables-confirm) <offer-save>: | 2253 | * files.el (hack-local-variables-confirm) <offer-save>: |
| 1520 | Clarify message text. Suggested by Ralf Angeli. | 2254 | Clarify message text. Suggested by Ralf Angeli. |
| 1521 | 2255 | ||
| 1522 | 2006-04-08 Michael Cadilhac <michael.cadilhac@lrde.org> (tiny change) | 2256 | 2006-04-08 Michael Cadilhac <michael.cadilhac@lrde.org> |
| 1523 | 2257 | ||
| 1524 | * rect.el (kill-rectangle): Don't barf if `kill-read-only-ok' is set. | 2258 | * rect.el (kill-rectangle): Don't barf if `kill-read-only-ok' is set. |
| 1525 | (delete-extract-rectangle-line): Use `filter-buffer-substring' | 2259 | (delete-extract-rectangle-line): Use `filter-buffer-substring' |
| @@ -8347,7 +9081,7 @@ | |||
| 8347 | since the last ping. | 9081 | since the last ping. |
| 8348 | (rcirc-mode): Give rcirc-topic a local binding here. | 9082 | (rcirc-mode): Give rcirc-topic a local binding here. |
| 8349 | 9083 | ||
| 8350 | 2005-11-19 Michael Cadilhac <michael.cadilhac@lrde.org> (tiny change) | 9084 | 2005-11-19 Michael Cadilhac <michael.cadilhac@lrde.org> |
| 8351 | 9085 | ||
| 8352 | * subr.el (read-passwd): Fontify the prompt as we do with other | 9086 | * subr.el (read-passwd): Fontify the prompt as we do with other |
| 8353 | prompts. | 9087 | prompts. |
| @@ -9958,7 +10692,7 @@ | |||
| 9958 | 10692 | ||
| 9959 | * dired-x.el (dired-virtual): Don't use `dired-insert-headerline'. | 10693 | * dired-x.el (dired-virtual): Don't use `dired-insert-headerline'. |
| 9960 | 10694 | ||
| 9961 | 2005-10-25 Michael Cadilhac <michael.cadilhac-@t-lrde.epita.fr> (tiny change) | 10695 | 2005-10-25 Michael Cadilhac <michael.cadilhac-@t-lrde.epita.fr> |
| 9962 | 10696 | ||
| 9963 | * play/blackbox.el (blackbox-redefine-key): New function. | 10697 | * play/blackbox.el (blackbox-redefine-key): New function. |
| 9964 | (blackbox-mode-map): Use it to remap existing bindings for cursor | 10698 | (blackbox-mode-map): Use it to remap existing bindings for cursor |
| @@ -11222,7 +11956,7 @@ | |||
| 11222 | * progmodes/gdb-ui.el (gdb-fringe-width -> gdb-buffer-fringe-width): | 11956 | * progmodes/gdb-ui.el (gdb-fringe-width -> gdb-buffer-fringe-width): |
| 11223 | Typo. | 11957 | Typo. |
| 11224 | 11958 | ||
| 11225 | 2005-10-06 Michael Cadilhac <michael.cadilhac-@t-lrde.epita.fr> (tiny change) | 11959 | 2005-10-06 Michael Cadilhac <michael.cadilhac-@t-lrde.epita.fr> |
| 11226 | 11960 | ||
| 11227 | * play/zone.el (zone): Wrap body with save-window-excursion. | 11961 | * play/zone.el (zone): Wrap body with save-window-excursion. |
| 11228 | 11962 | ||
| @@ -12017,7 +12751,7 @@ | |||
| 12017 | * calendar/diary-lib.el (mark-diary-entries): Rearrange to wrap | 12751 | * calendar/diary-lib.el (mark-diary-entries): Rearrange to wrap |
| 12018 | with-current-buffer form in save-excursion. | 12752 | with-current-buffer form in save-excursion. |
| 12019 | 12753 | ||
| 12020 | 2005-09-18 D Goel <deego@gnufans.org> | 12754 | 2005-09-18 Deepak Goel <deego@gnufans.org> |
| 12021 | 12755 | ||
| 12022 | * apropos.el (apropos-command): Fix `message' call: first arg | 12756 | * apropos.el (apropos-command): Fix `message' call: first arg |
| 12023 | should be a format spec. In this and all other cases that appear | 12757 | should be a format spec. In this and all other cases that appear |
| @@ -21459,7 +22193,7 @@ | |||
| 21459 | 22193 | ||
| 21460 | * simple.el (goto-line): Doc fix. | 22194 | * simple.el (goto-line): Doc fix. |
| 21461 | 22195 | ||
| 21462 | 2005-03-19 Aaron Hawley <Aaron.Hawley@uvm.edu> (tiny change) | 22196 | 2005-03-19 Aaron S. Hawley <Aaron.Hawley@uvm.edu> |
| 21463 | 22197 | ||
| 21464 | * files.el (save-buffer): Doc fix. | 22198 | * files.el (save-buffer): Doc fix. |
| 21465 | 22199 | ||
diff --git a/lisp/ChangeLog.5 b/lisp/ChangeLog.5 index dad524ed851..5aedc76efed 100644 --- a/lisp/ChangeLog.5 +++ b/lisp/ChangeLog.5 | |||
| @@ -2779,7 +2779,7 @@ | |||
| 2779 | continuations, don't go to line beg; | 2779 | continuations, don't go to line beg; |
| 2780 | perl-backward-to-start-of-continued-exp gives the right place. | 2780 | perl-backward-to-start-of-continued-exp gives the right place. |
| 2781 | 2781 | ||
| 2782 | 1995-03-07 Enami Tsugutomo <enami@sys.ptg.sony.co.jp> | 2782 | 1995-03-07 Tsugutomo ENAMI <enami@sys.ptg.sony.co.jp> |
| 2783 | 2783 | ||
| 2784 | * simple.el (indent-new-comment-line): Clean up handling | 2784 | * simple.el (indent-new-comment-line): Clean up handling |
| 2785 | of \(...\) in comment-start-skip. | 2785 | of \(...\) in comment-start-skip. |
diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el index 0b016b981e2..500ad5ff5fa 100644 --- a/lisp/arc-mode.el +++ b/lisp/arc-mode.el | |||
| @@ -876,8 +876,9 @@ using `make-temp-file', and the generated name is returned." | |||
| 876 | ;; extracted file existed. | 876 | ;; extracted file existed. |
| 877 | (let ((file-name-handler-alist | 877 | (let ((file-name-handler-alist |
| 878 | '(("" . archive-file-name-handler)))) | 878 | '(("" . archive-file-name-handler)))) |
| 879 | (car (find-operation-coding-system 'insert-file-contents | 879 | (car (find-operation-coding-system |
| 880 | filename t)))))) | 880 | 'insert-file-contents |
| 881 | (cons filename (current-buffer)) t)))))) | ||
| 881 | (if (and (not coding-system-for-read) | 882 | (if (and (not coding-system-for-read) |
| 882 | (not enable-multibyte-characters)) | 883 | (not enable-multibyte-characters)) |
| 883 | (setq coding | 884 | (setq coding |
diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el index 3094da3bfe8..4998c1edf07 100644 --- a/lisp/buff-menu.el +++ b/lisp/buff-menu.el | |||
| @@ -116,6 +116,8 @@ This variable determines whether reverting the buffer lists only | |||
| 116 | file buffers. It affects both manual reverting and reverting by | 116 | file buffers. It affects both manual reverting and reverting by |
| 117 | Auto Revert Mode.") | 117 | Auto Revert Mode.") |
| 118 | 118 | ||
| 119 | (defvar Info-current-file) ;; from info.el | ||
| 120 | |||
| 119 | (make-variable-buffer-local 'Buffer-menu-files-only) | 121 | (make-variable-buffer-local 'Buffer-menu-files-only) |
| 120 | 122 | ||
| 121 | (if Buffer-menu-mode-map | 123 | (if Buffer-menu-mode-map |
| @@ -767,10 +769,24 @@ For more information, see the function `buffer-menu'." | |||
| 767 | ?\s))) | 769 | ?\s))) |
| 768 | (unless file | 770 | (unless file |
| 769 | ;; No visited file. Check local value of | 771 | ;; No visited file. Check local value of |
| 770 | ;; list-buffers-directory. | 772 | ;; list-buffers-directory and, for Info buffers, |
| 771 | (when (and (boundp 'list-buffers-directory) | 773 | ;; Info-current-file. |
| 772 | list-buffers-directory) | 774 | (cond ((and (boundp 'list-buffers-directory) |
| 773 | (setq file list-buffers-directory))) | 775 | list-buffers-directory) |
| 776 | (setq file list-buffers-directory)) | ||
| 777 | ((eq major-mode 'Info-mode) | ||
| 778 | (setq file Info-current-file) | ||
| 779 | (cond | ||
| 780 | ((eq file t) | ||
| 781 | (setq file "*Info Directory*")) | ||
| 782 | ((eq file 'apropos) | ||
| 783 | (setq file "*Info Apropos*")) | ||
| 784 | ((eq file 'history) | ||
| 785 | (setq file "*Info History*")) | ||
| 786 | ((eq file 'toc) | ||
| 787 | (setq file "*Info TOC*")) | ||
| 788 | ((not (stringp file)) ;; avoid errors | ||
| 789 | (setq file nil)))))) | ||
| 774 | (push (list buffer bits name (buffer-size) mode file) | 790 | (push (list buffer bits name (buffer-size) mode file) |
| 775 | list)))))) | 791 | list)))))) |
| 776 | ;; Preserve the original buffer-list ordering, just in case. | 792 | ;; Preserve the original buffer-list ordering, just in case. |
diff --git a/lisp/comint.el b/lisp/comint.el index 1b9d8df738f..eb5c9f28a4e 100644 --- a/lisp/comint.el +++ b/lisp/comint.el | |||
| @@ -1047,12 +1047,12 @@ Moves relative to `comint-input-ring-index'." | |||
| 1047 | (defun comint-previous-input (arg) | 1047 | (defun comint-previous-input (arg) |
| 1048 | "Cycle backwards through input history, saving input." | 1048 | "Cycle backwards through input history, saving input." |
| 1049 | (interactive "*p") | 1049 | (interactive "*p") |
| 1050 | (if (and comint-input-ring-index | 1050 | (if (and comint-input-ring-index |
| 1051 | (or ;; leaving the "end" of the ring | 1051 | (or ;; leaving the "end" of the ring |
| 1052 | (and (< arg 0) ; going down | 1052 | (and (< arg 0) ; going down |
| 1053 | (eq comint-input-ring-index 0)) | 1053 | (eq comint-input-ring-index 0)) |
| 1054 | (and (> arg 0) ; going up | 1054 | (and (> arg 0) ; going up |
| 1055 | (eq comint-input-ring-index | 1055 | (eq comint-input-ring-index |
| 1056 | (1- (ring-length comint-input-ring))))) | 1056 | (1- (ring-length comint-input-ring))))) |
| 1057 | comint-stored-incomplete-input) | 1057 | comint-stored-incomplete-input) |
| 1058 | (comint-restore-input) | 1058 | (comint-restore-input) |
| @@ -1510,23 +1510,23 @@ Similarly for Soar, Scheme, etc." | |||
| 1510 | (concat input "\n"))) | 1510 | (concat input "\n"))) |
| 1511 | 1511 | ||
| 1512 | (let ((beg (marker-position pmark)) | 1512 | (let ((beg (marker-position pmark)) |
| 1513 | (end (if no-newline (point) (1- (point)))) | 1513 | (end (if no-newline (point) (1- (point)))) |
| 1514 | (inhibit-modification-hooks t)) | 1514 | (inhibit-modification-hooks t)) |
| 1515 | (when (> end beg) | 1515 | (when (> end beg) |
| 1516 | ;; Set text-properties for the input field | 1516 | (add-text-properties beg end |
| 1517 | (add-text-properties | 1517 | '(front-sticky t |
| 1518 | beg end | 1518 | font-lock-face comint-highlight-input)) |
| 1519 | '(front-sticky t | ||
| 1520 | font-lock-face comint-highlight-input | ||
| 1521 | mouse-face highlight | ||
| 1522 | help-echo "mouse-2: insert after prompt as new input")) | ||
| 1523 | (unless comint-use-prompt-regexp | 1519 | (unless comint-use-prompt-regexp |
| 1524 | ;; Give old user input a field property of `input', to | 1520 | ;; Give old user input a field property of `input', to |
| 1525 | ;; distinguish it from both process output and unsent | 1521 | ;; distinguish it from both process output and unsent |
| 1526 | ;; input. The terminating newline is put into a special | 1522 | ;; input. The terminating newline is put into a special |
| 1527 | ;; `boundary' field to make cursor movement between input | 1523 | ;; `boundary' field to make cursor movement between input |
| 1528 | ;; and output fields smoother. | 1524 | ;; and output fields smoother. |
| 1529 | (put-text-property beg end 'field 'input))) | 1525 | (add-text-properties |
| 1526 | beg end | ||
| 1527 | '(mouse-face highlight | ||
| 1528 | help-echo "mouse-2: insert after prompt as new input" | ||
| 1529 | field input)))) | ||
| 1530 | (unless (or no-newline comint-use-prompt-regexp) | 1530 | (unless (or no-newline comint-use-prompt-regexp) |
| 1531 | ;; Cover the terminating newline | 1531 | ;; Cover the terminating newline |
| 1532 | (add-text-properties end (1+ end) | 1532 | (add-text-properties end (1+ end) |
| @@ -2357,19 +2357,19 @@ preceding newline is removed." | |||
| 2357 | (when (eq (get-text-property (1- pt) 'read-only) 'fence) | 2357 | (when (eq (get-text-property (1- pt) 'read-only) 'fence) |
| 2358 | (remove-list-of-text-properties (1- pt) pt '(read-only))))))) | 2358 | (remove-list-of-text-properties (1- pt) pt '(read-only))))))) |
| 2359 | 2359 | ||
| 2360 | (defun comint-kill-whole-line (&optional arg) | 2360 | (defun comint-kill-whole-line (&optional count) |
| 2361 | "Kill current line, ignoring read-only and field properties. | 2361 | "Kill current line, ignoring read-only and field properties. |
| 2362 | With prefix arg, kill that many lines starting from the current line. | 2362 | With prefix arg COUNT, kill that many lines starting from the current line. |
| 2363 | If arg is negative, kill backward. Also kill the preceding newline, | 2363 | If COUNT is negative, kill backward. Also kill the preceding newline, |
| 2364 | instead of the trailing one. \(This is meant to make \\[repeat] work well | 2364 | instead of the trailing one. \(This is meant to make \\[repeat] work well |
| 2365 | with negative arguments.) | 2365 | with negative arguments.) |
| 2366 | If arg is zero, kill current line but exclude the trailing newline. | 2366 | If COUNT is zero, kill current line but exclude the trailing newline. |
| 2367 | The read-only status of newlines is updated with `comint-update-fence', | 2367 | The read-only status of newlines is updated with `comint-update-fence', |
| 2368 | if necessary." | 2368 | if necessary." |
| 2369 | (interactive "p") | 2369 | (interactive "p") |
| 2370 | (let ((inhibit-read-only t) (inhibit-field-text-motion t)) | 2370 | (let ((inhibit-read-only t) (inhibit-field-text-motion t)) |
| 2371 | (kill-whole-line arg) | 2371 | (kill-whole-line count) |
| 2372 | (when (>= arg 0) (comint-update-fence)))) | 2372 | (when (>= count 0) (comint-update-fence)))) |
| 2373 | 2373 | ||
| 2374 | (defun comint-kill-region (beg end &optional yank-handler) | 2374 | (defun comint-kill-region (beg end &optional yank-handler) |
| 2375 | "Like `kill-region', but ignores read-only properties, if safe. | 2375 | "Like `kill-region', but ignores read-only properties, if safe. |
diff --git a/lisp/diff-mode.el b/lisp/diff-mode.el index 1a8402e06c4..7ea02352b0b 100644 --- a/lisp/diff-mode.el +++ b/lisp/diff-mode.el | |||
| @@ -438,7 +438,8 @@ If the prefix ARG is given, restrict the view to the current file instead." | |||
| 438 | (firsthunk (ignore-errors | 438 | (firsthunk (ignore-errors |
| 439 | (goto-char start) | 439 | (goto-char start) |
| 440 | (diff-beginning-of-file) (diff-hunk-next) (point))) | 440 | (diff-beginning-of-file) (diff-hunk-next) (point))) |
| 441 | (nextfile (ignore-errors (diff-file-next) (point)))) | 441 | (nextfile (ignore-errors (diff-file-next) (point))) |
| 442 | (inhibit-read-only t)) | ||
| 442 | (goto-char start) | 443 | (goto-char start) |
| 443 | (if (and firsthunk (= firsthunk start) | 444 | (if (and firsthunk (= firsthunk start) |
| 444 | (or (null nexthunk) | 445 | (or (null nexthunk) |
| @@ -457,7 +458,8 @@ If the prefix ARG is given, restrict the view to the current file instead." | |||
| 457 | (ignore-errors | 458 | (ignore-errors |
| 458 | (diff-hunk-prev) (point)))) | 459 | (diff-hunk-prev) (point)))) |
| 459 | (index (save-excursion | 460 | (index (save-excursion |
| 460 | (re-search-backward "^Index: " prevhunk t)))) | 461 | (re-search-backward "^Index: " prevhunk t))) |
| 462 | (inhibit-read-only t)) | ||
| 461 | (when index (setq start index)) | 463 | (when index (setq start index)) |
| 462 | (diff-end-of-file) | 464 | (diff-end-of-file) |
| 463 | (if (looking-at "^\n") (forward-char 1)) ;`tla' generates such diffs. | 465 | (if (looking-at "^\n") (forward-char 1)) ;`tla' generates such diffs. |
| @@ -497,7 +499,8 @@ If the prefix ARG is given, restrict the view to the current file instead." | |||
| 497 | (let* ((start1 (string-to-number (match-string 1))) | 499 | (let* ((start1 (string-to-number (match-string 1))) |
| 498 | (start2 (string-to-number (match-string 2))) | 500 | (start2 (string-to-number (match-string 2))) |
| 499 | (newstart1 (+ start1 (diff-count-matches "^[- \t]" (point) pos))) | 501 | (newstart1 (+ start1 (diff-count-matches "^[- \t]" (point) pos))) |
| 500 | (newstart2 (+ start2 (diff-count-matches "^[+ \t]" (point) pos)))) | 502 | (newstart2 (+ start2 (diff-count-matches "^[+ \t]" (point) pos))) |
| 503 | (inhibit-read-only t)) | ||
| 501 | (goto-char pos) | 504 | (goto-char pos) |
| 502 | ;; Hopefully the after-change-function will not screw us over. | 505 | ;; Hopefully the after-change-function will not screw us over. |
| 503 | (insert "@@ -" (number-to-string newstart1) ",1 +" | 506 | (insert "@@ -" (number-to-string newstart1) ",1 +" |
| @@ -993,8 +996,7 @@ a diff with \\[diff-reverse-direction]." | |||
| 993 | ;; compile support | 996 | ;; compile support |
| 994 | (set (make-local-variable 'next-error-function) 'diff-next-error) | 997 | (set (make-local-variable 'next-error-function) 'diff-next-error) |
| 995 | 998 | ||
| 996 | (when (and (> (point-max) (point-min)) diff-default-read-only) | 999 | (setq buffer-read-only diff-default-read-only) |
| 997 | (toggle-read-only t)) | ||
| 998 | ;; setup change hooks | 1000 | ;; setup change hooks |
| 999 | (if (not diff-update-on-the-fly) | 1001 | (if (not diff-update-on-the-fly) |
| 1000 | (add-hook 'write-contents-functions 'diff-write-contents-hooks nil t) | 1002 | (add-hook 'write-contents-functions 'diff-write-contents-hooks nil t) |
| @@ -1355,6 +1357,7 @@ For use in `add-log-current-defun-function'." | |||
| 1355 | (file1 (make-temp-file "diff1")) | 1357 | (file1 (make-temp-file "diff1")) |
| 1356 | (file2 (make-temp-file "diff2")) | 1358 | (file2 (make-temp-file "diff2")) |
| 1357 | (coding-system-for-read buffer-file-coding-system) | 1359 | (coding-system-for-read buffer-file-coding-system) |
| 1360 | (inhibit-read-only t) | ||
| 1358 | old new) | 1361 | old new) |
| 1359 | (unwind-protect | 1362 | (unwind-protect |
| 1360 | (save-excursion | 1363 | (save-excursion |
diff --git a/lisp/diff.el b/lisp/diff.el index 221d7b2e363..534a84d4317 100644 --- a/lisp/diff.el +++ b/lisp/diff.el | |||
| @@ -67,9 +67,10 @@ CODE is the exit code of the process. It should be 0 iff no diffs were found." | |||
| 67 | (if diff-new-temp-file (delete-file diff-new-temp-file)) | 67 | (if diff-new-temp-file (delete-file diff-new-temp-file)) |
| 68 | (save-excursion | 68 | (save-excursion |
| 69 | (goto-char (point-max)) | 69 | (goto-char (point-max)) |
| 70 | (insert (format "\nDiff finished%s. %s\n" | 70 | (let ((inhibit-read-only t)) |
| 71 | (if (equal 0 code) " (no differences)" "") | 71 | (insert (format "\nDiff finished%s. %s\n" |
| 72 | (current-time-string))))) | 72 | (if (equal 0 code) " (no differences)" "") |
| 73 | (current-time-string)))))) | ||
| 73 | 74 | ||
| 74 | ;;;###autoload | 75 | ;;;###autoload |
| 75 | (defun diff (old new &optional switches no-async) | 76 | (defun diff (old new &optional switches no-async) |
| @@ -119,7 +120,8 @@ With prefix arg, prompt for diff switches." | |||
| 119 | (set-buffer buf) | 120 | (set-buffer buf) |
| 120 | (setq buffer-read-only nil) | 121 | (setq buffer-read-only nil) |
| 121 | (buffer-disable-undo (current-buffer)) | 122 | (buffer-disable-undo (current-buffer)) |
| 122 | (erase-buffer) | 123 | (let ((inhibit-read-only t)) |
| 124 | (erase-buffer)) | ||
| 123 | (buffer-enable-undo (current-buffer)) | 125 | (buffer-enable-undo (current-buffer)) |
| 124 | (diff-mode) | 126 | (diff-mode) |
| 125 | (set (make-local-variable 'revert-buffer-function) | 127 | (set (make-local-variable 'revert-buffer-function) |
| @@ -128,21 +130,35 @@ With prefix arg, prompt for diff switches." | |||
| 128 | (set (make-local-variable 'diff-old-temp-file) old-alt) | 130 | (set (make-local-variable 'diff-old-temp-file) old-alt) |
| 129 | (set (make-local-variable 'diff-new-temp-file) new-alt) | 131 | (set (make-local-variable 'diff-new-temp-file) new-alt) |
| 130 | (setq default-directory thisdir) | 132 | (setq default-directory thisdir) |
| 131 | (insert command "\n") | 133 | (let ((inhibit-read-only t)) |
| 134 | (insert command "\n")) | ||
| 132 | (if (and (not no-async) (fboundp 'start-process)) | 135 | (if (and (not no-async) (fboundp 'start-process)) |
| 133 | (progn | 136 | (progn |
| 134 | (setq proc (start-process "Diff" buf shell-file-name | 137 | (setq proc (start-process "Diff" buf shell-file-name |
| 135 | shell-command-switch command)) | 138 | shell-command-switch command)) |
| 139 | (set-process-filter proc 'diff-process-filter) | ||
| 136 | (set-process-sentinel | 140 | (set-process-sentinel |
| 137 | proc (lambda (proc msg) | 141 | proc (lambda (proc msg) |
| 138 | (with-current-buffer (process-buffer proc) | 142 | (with-current-buffer (process-buffer proc) |
| 139 | (diff-sentinel (process-exit-status proc)))))) | 143 | (diff-sentinel (process-exit-status proc)))))) |
| 140 | ;; Async processes aren't available. | 144 | ;; Async processes aren't available. |
| 141 | (diff-sentinel | 145 | (let ((inhibit-read-only t)) |
| 142 | (call-process shell-file-name nil buf nil | 146 | (diff-sentinel |
| 143 | shell-command-switch command)))) | 147 | (call-process shell-file-name nil buf nil |
| 148 | shell-command-switch command))))) | ||
| 144 | buf)) | 149 | buf)) |
| 145 | 150 | ||
| 151 | (defun diff-process-filter (proc string) | ||
| 152 | (with-current-buffer (process-buffer proc) | ||
| 153 | (let ((moving (= (point) (process-mark proc)))) | ||
| 154 | (save-excursion | ||
| 155 | ;; Insert the text, advancing the process marker. | ||
| 156 | (goto-char (process-mark proc)) | ||
| 157 | (let ((inhibit-read-only t)) | ||
| 158 | (insert string)) | ||
| 159 | (set-marker (process-mark proc) (point))) | ||
| 160 | (if moving (goto-char (process-mark proc)))))) | ||
| 161 | |||
| 146 | ;;;###autoload | 162 | ;;;###autoload |
| 147 | (defun diff-backup (file &optional switches) | 163 | (defun diff-backup (file &optional switches) |
| 148 | "Diff this file with its backup file or vice versa. | 164 | "Diff this file with its backup file or vice versa. |
diff --git a/lisp/dired.el b/lisp/dired.el index ca50e3b5767..64b73184397 100644 --- a/lisp/dired.el +++ b/lisp/dired.el | |||
| @@ -1251,9 +1251,9 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST." | |||
| 1251 | ;; thumbnail manipulation (tumme) | 1251 | ;; thumbnail manipulation (tumme) |
| 1252 | (define-key map "\C-td" 'tumme-display-thumbs) | 1252 | (define-key map "\C-td" 'tumme-display-thumbs) |
| 1253 | (define-key map "\C-tt" 'tumme-tag-files) | 1253 | (define-key map "\C-tt" 'tumme-tag-files) |
| 1254 | (define-key map "\C-tr" 'tumme-tag-remove) | 1254 | (define-key map "\C-tr" 'tumme-delete-tag) |
| 1255 | (define-key map "\C-tj" 'tumme-jump-thumbnail-buffer) | 1255 | (define-key map "\C-tj" 'tumme-jump-thumbnail-buffer) |
| 1256 | (define-key map "\C-ti" 'tumme-display-dired-image) | 1256 | (define-key map "\C-ti" 'tumme-dired-display-image) |
| 1257 | (define-key map "\C-tx" 'tumme-dired-display-external) | 1257 | (define-key map "\C-tx" 'tumme-dired-display-external) |
| 1258 | (define-key map "\C-ta" 'tumme-display-thumbs-append) | 1258 | (define-key map "\C-ta" 'tumme-display-thumbs-append) |
| 1259 | (define-key map "\C-t." 'tumme-display-thumb) | 1259 | (define-key map "\C-t." 'tumme-display-thumb) |
| @@ -1305,6 +1305,18 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST." | |||
| 1305 | (define-key map [menu-bar immediate] | 1305 | (define-key map [menu-bar immediate] |
| 1306 | (cons "Immediate" (make-sparse-keymap "Immediate"))) | 1306 | (cons "Immediate" (make-sparse-keymap "Immediate"))) |
| 1307 | 1307 | ||
| 1308 | (define-key map | ||
| 1309 | [menu-bar immediate tumme-dired-display-external] | ||
| 1310 | '(menu-item "Display Image Externally" tumme-dired-display-external | ||
| 1311 | :help "Display image in external viewer")) | ||
| 1312 | (define-key map | ||
| 1313 | [menu-bar immediate tumme-dired-display-image] | ||
| 1314 | '(menu-item "Display Image" tumme-dired-display-image | ||
| 1315 | :help "Display sized image in a separate window")) | ||
| 1316 | |||
| 1317 | (define-key map [menu-bar immediate dashes-4] | ||
| 1318 | '("--")) | ||
| 1319 | |||
| 1308 | (define-key map [menu-bar immediate revert-buffer] | 1320 | (define-key map [menu-bar immediate revert-buffer] |
| 1309 | '(menu-item "Refresh" revert-buffer | 1321 | '(menu-item "Refresh" revert-buffer |
| 1310 | :help "Update contents of shown directories")) | 1322 | :help "Update contents of shown directories")) |
| @@ -1313,7 +1325,7 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST." | |||
| 1313 | '("--")) | 1325 | '("--")) |
| 1314 | 1326 | ||
| 1315 | (define-key map [menu-bar immediate compare-directories] | 1327 | (define-key map [menu-bar immediate compare-directories] |
| 1316 | '(menu-item "Compare directories..." dired-compare-directories | 1328 | '(menu-item "Compare Directories..." dired-compare-directories |
| 1317 | :help "Mark files with different attributes in two dired buffers")) | 1329 | :help "Mark files with different attributes in two dired buffers")) |
| 1318 | (define-key map [menu-bar immediate backup-diff] | 1330 | (define-key map [menu-bar immediate backup-diff] |
| 1319 | '(menu-item "Compare with Backup" dired-backup-diff | 1331 | '(menu-item "Compare with Backup" dired-backup-diff |
| @@ -1341,6 +1353,14 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST." | |||
| 1341 | (define-key map [menu-bar regexp] | 1353 | (define-key map [menu-bar regexp] |
| 1342 | (cons "Regexp" (make-sparse-keymap "Regexp"))) | 1354 | (cons "Regexp" (make-sparse-keymap "Regexp"))) |
| 1343 | 1355 | ||
| 1356 | (define-key map | ||
| 1357 | [menu-bar regexp tumme-mark-tagged-files] | ||
| 1358 | '(menu-item "Mark From Image Tag..." tumme-mark-tagged-files | ||
| 1359 | :help "Mark files whose image tags matches regexp")) | ||
| 1360 | |||
| 1361 | (define-key map [menu-bar regexp dashes-1] | ||
| 1362 | '("--")) | ||
| 1363 | |||
| 1344 | (define-key map [menu-bar regexp downcase] | 1364 | (define-key map [menu-bar regexp downcase] |
| 1345 | '(menu-item "Downcase" dired-downcase | 1365 | '(menu-item "Downcase" dired-downcase |
| 1346 | ;; When running on plain MS-DOS, there's only one | 1366 | ;; When running on plain MS-DOS, there's only one |
| @@ -1428,6 +1448,29 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST." | |||
| 1428 | (define-key map [menu-bar operate] | 1448 | (define-key map [menu-bar operate] |
| 1429 | (cons "Operate" (make-sparse-keymap "Operate"))) | 1449 | (cons "Operate" (make-sparse-keymap "Operate"))) |
| 1430 | 1450 | ||
| 1451 | (define-key map [menu-bar operate dashes-2] | ||
| 1452 | '("--")) | ||
| 1453 | |||
| 1454 | (define-key map | ||
| 1455 | [menu-bar operate tumme-delete-tag] | ||
| 1456 | '(menu-item "Delete Image Tag..." tumme-delete-tag | ||
| 1457 | :help "Delete image tag from current or marked files")) | ||
| 1458 | (define-key map | ||
| 1459 | [menu-bar operate tumme-tag-files] | ||
| 1460 | '(menu-item "Add Image Tags..." tumme-tag-files | ||
| 1461 | :help "Add image tags to current or marked files")) | ||
| 1462 | (define-key map | ||
| 1463 | [menu-bar operate tumme-dired-comment-files] | ||
| 1464 | '(menu-item "Add Image Comment..." tumme-dired-comment-files | ||
| 1465 | :help "Add image comment to current or marked files")) | ||
| 1466 | (define-key map | ||
| 1467 | [menu-bar operate tumme-display-thumbs] | ||
| 1468 | '(menu-item "Display Thumbnails" tumme-display-thumbs | ||
| 1469 | :help "Display thumbnails for current or marked image files")) | ||
| 1470 | |||
| 1471 | (define-key map [menu-bar operate dashes-3] | ||
| 1472 | '("--")) | ||
| 1473 | |||
| 1431 | (define-key map [menu-bar operate query-replace] | 1474 | (define-key map [menu-bar operate query-replace] |
| 1432 | '(menu-item "Query Replace in Files..." dired-do-query-replace-regexp | 1475 | '(menu-item "Query Replace in Files..." dired-do-query-replace-regexp |
| 1433 | :help "Replace regexp in marked files")) | 1476 | :help "Replace regexp in marked files")) |
diff --git a/lisp/ediff-diff.el b/lisp/ediff-diff.el index 013ed9073db..7746954292d 100644 --- a/lisp/ediff-diff.el +++ b/lisp/ediff-diff.el | |||
| @@ -65,8 +65,10 @@ Must produce output compatible with Unix's diff3 program." | |||
| 65 | ;; The following functions needed for setting diff/diff3 options | 65 | ;; The following functions needed for setting diff/diff3 options |
| 66 | ;; test if diff supports the --binary option | 66 | ;; test if diff supports the --binary option |
| 67 | (defsubst ediff-test-utility (diff-util option &optional files) | 67 | (defsubst ediff-test-utility (diff-util option &optional files) |
| 68 | (eq 0 (apply 'call-process | 68 | (condition-case () |
| 69 | (append (list diff-util nil nil nil option) files)))) | 69 | (eq 0 (apply 'call-process |
| 70 | (append (list diff-util nil nil nil option) files))) | ||
| 71 | (file-error nil))) | ||
| 70 | 72 | ||
| 71 | (defun ediff-diff-mandatory-option (diff-util) | 73 | (defun ediff-diff-mandatory-option (diff-util) |
| 72 | (let ((file (if (boundp 'null-device) null-device "/dev/null"))) | 74 | (let ((file (if (boundp 'null-device) null-device "/dev/null"))) |
| @@ -128,10 +130,10 @@ are `-I REGEXP', to ignore changes whose lines match the REGEXP." | |||
| 128 | 130 | ||
| 129 | (defcustom ediff-diff-options "" | 131 | (defcustom ediff-diff-options "" |
| 130 | "*Options to pass to `ediff-diff-program'. | 132 | "*Options to pass to `ediff-diff-program'. |
| 131 | If Unix diff is used as `ediff-diff-program', then a useful option is | 133 | If Unix diff is used as `ediff-diff-program', |
| 132 | `-w', to ignore space, and `-i', to ignore case of letters. | 134 | then a useful option is `-w', to ignore space. |
| 133 | Options `-c' and `-i' are not allowed. Case sensitivity can be toggled | 135 | Options `-c' and `-i' are not allowed. Case sensitivity can be |
| 134 | interactively using [ediff-toggle-ignore-case]" | 136 | toggled interactively using \\[ediff-toggle-ignore-case]." |
| 135 | :set 'ediff-reset-diff-options | 137 | :set 'ediff-reset-diff-options |
| 136 | :type 'string | 138 | :type 'string |
| 137 | :group 'ediff-diff) | 139 | :group 'ediff-diff) |
| @@ -399,7 +401,7 @@ one optional arguments, diff-number to refine.") | |||
| 399 | (c-prev-pt nil) | 401 | (c-prev-pt nil) |
| 400 | diff-list shift-A shift-B | 402 | diff-list shift-A shift-B |
| 401 | ) | 403 | ) |
| 402 | 404 | ||
| 403 | ;; diff list contains word numbers, unless changed later | 405 | ;; diff list contains word numbers, unless changed later |
| 404 | (setq diff-list (cons (if word-mode 'words 'points) | 406 | (setq diff-list (cons (if word-mode 'words 'points) |
| 405 | diff-list)) | 407 | diff-list)) |
| @@ -411,7 +413,7 @@ one optional arguments, diff-number to refine.") | |||
| 411 | shift-B | 413 | shift-B |
| 412 | (ediff-overlay-start | 414 | (ediff-overlay-start |
| 413 | (ediff-get-value-according-to-buffer-type 'B bounds)))) | 415 | (ediff-get-value-according-to-buffer-type 'B bounds)))) |
| 414 | 416 | ||
| 415 | ;; reset point in buffers A/B/C | 417 | ;; reset point in buffers A/B/C |
| 416 | (ediff-with-current-buffer A-buffer | 418 | (ediff-with-current-buffer A-buffer |
| 417 | (goto-char (if shift-A shift-A (point-min)))) | 419 | (goto-char (if shift-A shift-A (point-min)))) |
| @@ -1525,7 +1527,7 @@ affects only files whose names match the expression." | |||
| 1525 | (ediff-barf-if-not-control-buffer) | 1527 | (ediff-barf-if-not-control-buffer) |
| 1526 | (setq ediff-ignore-case (not ediff-ignore-case)) | 1528 | (setq ediff-ignore-case (not ediff-ignore-case)) |
| 1527 | (cond (ediff-ignore-case | 1529 | (cond (ediff-ignore-case |
| 1528 | (setq ediff-actual-diff-options | 1530 | (setq ediff-actual-diff-options |
| 1529 | (concat ediff-diff-options " " ediff-ignore-case-option) | 1531 | (concat ediff-diff-options " " ediff-ignore-case-option) |
| 1530 | ediff-actual-diff3-options | 1532 | ediff-actual-diff3-options |
| 1531 | (concat ediff-diff3-options " " ediff-ignore-case-option3)) | 1533 | (concat ediff-diff3-options " " ediff-ignore-case-option3)) |
diff --git a/lisp/emacs-lisp/advice.el b/lisp/emacs-lisp/advice.el index 486a3b049ae..d03245bf452 100644 --- a/lisp/emacs-lisp/advice.el +++ b/lisp/emacs-lisp/advice.el | |||
| @@ -2350,6 +2350,7 @@ FUNCTION was not advised)." | |||
| 2350 | (ad-advice-set-enabled advice flag)))))) | 2350 | (ad-advice-set-enabled advice flag)))))) |
| 2351 | matched-advices))) | 2351 | matched-advices))) |
| 2352 | 2352 | ||
| 2353 | ;;;###autoload | ||
| 2353 | (defun ad-enable-advice (function class name) | 2354 | (defun ad-enable-advice (function class name) |
| 2354 | "Enables the advice of FUNCTION with CLASS and NAME." | 2355 | "Enables the advice of FUNCTION with CLASS and NAME." |
| 2355 | (interactive (ad-read-advice-specification "Enable advice of")) | 2356 | (interactive (ad-read-advice-specification "Enable advice of")) |
| @@ -2359,6 +2360,7 @@ FUNCTION was not advised)." | |||
| 2359 | function class name)) | 2360 | function class name)) |
| 2360 | (error "ad-enable-advice: `%s' is not advised" function))) | 2361 | (error "ad-enable-advice: `%s' is not advised" function))) |
| 2361 | 2362 | ||
| 2363 | ;;;###autoload | ||
| 2362 | (defun ad-disable-advice (function class name) | 2364 | (defun ad-disable-advice (function class name) |
| 2363 | "Disable the advice of FUNCTION with CLASS and NAME." | 2365 | "Disable the advice of FUNCTION with CLASS and NAME." |
| 2364 | (interactive (ad-read-advice-specification "Disable advice of")) | 2366 | (interactive (ad-read-advice-specification "Disable advice of")) |
| @@ -3585,6 +3587,7 @@ the value of `ad-redefinition-action' and de/activate again." | |||
| 3585 | ;; @@ The top-level advice interface: | 3587 | ;; @@ The top-level advice interface: |
| 3586 | ;; ================================== | 3588 | ;; ================================== |
| 3587 | 3589 | ||
| 3590 | ;;;###autoload | ||
| 3588 | (defun ad-activate (function &optional compile) | 3591 | (defun ad-activate (function &optional compile) |
| 3589 | "Activate all the advice information of an advised FUNCTION. | 3592 | "Activate all the advice information of an advised FUNCTION. |
| 3590 | If FUNCTION has a proper original definition then an advised | 3593 | If FUNCTION has a proper original definition then an advised |
diff --git a/lisp/emacs-lisp/authors.el b/lisp/emacs-lisp/authors.el index 0d38ba03241..7ab0101b2a5 100644 --- a/lisp/emacs-lisp/authors.el +++ b/lisp/emacs-lisp/authors.el | |||
| @@ -42,6 +42,7 @@ files.") | |||
| 42 | 42 | ||
| 43 | (defconst authors-aliases | 43 | (defconst authors-aliases |
| 44 | '( | 44 | '( |
| 45 | ("Andrew Csillag" "Drew Csillag") | ||
| 45 | ("Barry A. Warsaw" "Barry A. Warsaw, Century Computing, Inc." | 46 | ("Barry A. Warsaw" "Barry A. Warsaw, Century Computing, Inc." |
| 46 | "Barry A. Warsaw, ITB" "Barry Warsaw") | 47 | "Barry A. Warsaw, ITB" "Barry Warsaw") |
| 47 | ("Bj,Av(Brn Torkelsson" "Bjorn Torkelsson") | 48 | ("Bj,Av(Brn Torkelsson" "Bjorn Torkelsson") |
| @@ -118,6 +119,7 @@ files.") | |||
| 118 | ("Roland B. Roberts" "Roland B Roberts" "Roland Roberts") | 119 | ("Roland B. Roberts" "Roland B Roberts" "Roland Roberts") |
| 119 | ("Rui-Tao Dong" "Rui-Tao Dong ~{6-Hpln~}") | 120 | ("Rui-Tao Dong" "Rui-Tao Dong ~{6-Hpln~}") |
| 120 | ("Sam Steingold" "Sam Shteingold") | 121 | ("Sam Steingold" "Sam Shteingold") |
| 122 | ("Satyaki Das" "Indexed search by Satyaki Das") | ||
| 121 | ("Stefan Monnier" "Stefan") | 123 | ("Stefan Monnier" "Stefan") |
| 122 | ("Stephen A. Wood" "(saw@cebaf.gov)") | 124 | ("Stephen A. Wood" "(saw@cebaf.gov)") |
| 123 | ("Steven L. Baur" "SL Baur" "Steven L Baur") | 125 | ("Steven L. Baur" "SL Baur" "Steven L Baur") |
| @@ -128,6 +130,7 @@ files.") | |||
| 128 | ("Torbj,Av(Brn Einarsson" "Torbj.*rn Einarsson") | 130 | ("Torbj,Av(Brn Einarsson" "Torbj.*rn Einarsson") |
| 129 | ("Toru Tomabechi" "Toru Tomabechi,") | 131 | ("Toru Tomabechi" "Toru Tomabechi,") |
| 130 | ("Vincent Del Vecchio" "Vince Del Vecchio") | 132 | ("Vincent Del Vecchio" "Vince Del Vecchio") |
| 133 | ("William M. Perry" "Bill Perry") | ||
| 131 | ("Wlodzimierz Bzyl" "W.*dek Bzyl") | 134 | ("Wlodzimierz Bzyl" "W.*dek Bzyl") |
| 132 | ("Yutaka NIIBE" "NIIBE Yutaka") | 135 | ("Yutaka NIIBE" "NIIBE Yutaka") |
| 133 | ) | 136 | ) |
| @@ -269,7 +272,7 @@ Changes to files in this list are not listed.") | |||
| 269 | ("Morten Welinder" :wrote "dosfns.c" "[many MSDOS files]" "msdos.h") | 272 | ("Morten Welinder" :wrote "dosfns.c" "[many MSDOS files]" "msdos.h") |
| 270 | ("Pace Willisson" :wrote "ispell.el") | 273 | ("Pace Willisson" :wrote "ispell.el") |
| 271 | ("Garrett Wollman" :changed "sendmail.el") | 274 | ("Garrett Wollman" :changed "sendmail.el") |
| 272 | ("Dale Worley" :changed "mail-extr.el") | 275 | ("Dale R. Worley" :changed "mail-extr.el") |
| 273 | ("Jamie Zawinski" :changed "bytecode.c" :wrote "disass.el" "tar-mode.el")) | 276 | ("Jamie Zawinski" :changed "bytecode.c" :wrote "disass.el" "tar-mode.el")) |
| 274 | "Actions taken from the original, manually (un)maintained AUTHORS file.") | 277 | "Actions taken from the original, manually (un)maintained AUTHORS file.") |
| 275 | 278 | ||
| @@ -355,7 +358,9 @@ the file name." | |||
| 355 | (setq rules (cdr rules)))))) | 358 | (setq rules (cdr rules)))))) |
| 356 | (setq authors-checked-files-alist | 359 | (setq authors-checked-files-alist |
| 357 | (cons (cons file valid) authors-checked-files-alist)) | 360 | (cons (cons file valid) authors-checked-files-alist)) |
| 358 | (unless valid | 361 | (unless (or valid |
| 362 | (string-match "[*]" file) | ||
| 363 | (string-match "^[0-9.]+$" file)) | ||
| 359 | (setq authors-invalid-file-names | 364 | (setq authors-invalid-file-names |
| 360 | (cons (format "%s:%d: unrecognized `%s' for %s" | 365 | (cons (format "%s:%d: unrecognized `%s' for %s" |
| 361 | log-file | 366 | log-file |
diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el index ee2d74c5646..76699f10df8 100644 --- a/lisp/emacs-lisp/autoload.el +++ b/lisp/emacs-lisp/autoload.el | |||
| @@ -273,12 +273,30 @@ which lists the file name and which functions are in it, etc." | |||
| 273 | (or (eolp) | 273 | (or (eolp) |
| 274 | (insert "\n" generate-autoload-section-continuation)))))) | 274 | (insert "\n" generate-autoload-section-continuation)))))) |
| 275 | 275 | ||
| 276 | (defun autoload-find-file (file) | ||
| 277 | "Fetch file and put it in a temp buffer. Return the buffer." | ||
| 278 | ;; It is faster to avoid visiting the file. | ||
| 279 | (with-current-buffer (get-buffer-create " *autoload-file*") | ||
| 280 | (kill-all-local-variables) | ||
| 281 | (erase-buffer) | ||
| 282 | (setq buffer-undo-list t | ||
| 283 | buffer-read-only nil) | ||
| 284 | (emacs-lisp-mode) | ||
| 285 | (insert-file-contents file nil) | ||
| 286 | (let ((enable-local-variables :safe)) | ||
| 287 | (hack-local-variables)) | ||
| 288 | (current-buffer))) | ||
| 289 | |||
| 290 | (defvar no-update-autoloads nil | ||
| 291 | "File local variable to prevent scanning this file for autoload cookies.") | ||
| 292 | |||
| 276 | (defun generate-file-autoloads (file) | 293 | (defun generate-file-autoloads (file) |
| 277 | "Insert at point a loaddefs autoload section for FILE. | 294 | "Insert at point a loaddefs autoload section for FILE. |
| 278 | autoloads are generated for defuns and defmacros in FILE | 295 | Autoloads are generated for defuns and defmacros in FILE |
| 279 | marked by `generate-autoload-cookie' (which see). | 296 | marked by `generate-autoload-cookie' (which see). |
| 280 | If FILE is being visited in a buffer, the contents of the buffer | 297 | If FILE is being visited in a buffer, the contents of the buffer |
| 281 | are used." | 298 | are used. |
| 299 | Return non-nil in the case where no autoloads were added at point." | ||
| 282 | (interactive "fGenerate autoloads for file: ") | 300 | (interactive "fGenerate autoloads for file: ") |
| 283 | (let ((outbuf (current-buffer)) | 301 | (let ((outbuf (current-buffer)) |
| 284 | (autoloads-done '()) | 302 | (autoloads-done '()) |
| @@ -291,7 +309,7 @@ are used." | |||
| 291 | (float-output-format nil) | 309 | (float-output-format nil) |
| 292 | (done-any nil) | 310 | (done-any nil) |
| 293 | (visited (get-file-buffer file)) | 311 | (visited (get-file-buffer file)) |
| 294 | output-end) | 312 | output-start) |
| 295 | 313 | ||
| 296 | ;; If the autoload section we create here uses an absolute | 314 | ;; If the autoload section we create here uses an absolute |
| 297 | ;; file name for FILE in its header, and then Emacs is installed | 315 | ;; file name for FILE in its header, and then Emacs is installed |
| @@ -309,76 +327,70 @@ are used." | |||
| 309 | (string= dir-truename (substring source-truename 0 len))) | 327 | (string= dir-truename (substring source-truename 0 len))) |
| 310 | (setq file (substring source-truename len)))) | 328 | (setq file (substring source-truename len)))) |
| 311 | 329 | ||
| 312 | (message "Generating autoloads for %s..." file) | 330 | (with-current-buffer (or visited |
| 313 | (save-excursion | 331 | ;; It is faster to avoid visiting the file. |
| 314 | (unwind-protect | 332 | (autoload-find-file file)) |
| 315 | (progn | 333 | ;; Obey the no-update-autoloads file local variable. |
| 316 | (if visited | 334 | (unless no-update-autoloads |
| 317 | (set-buffer visited) | 335 | (message "Generating autoloads for %s..." file) |
| 318 | ;; It is faster to avoid visiting the file. | 336 | (setq output-start (with-current-buffer outbuf (point))) |
| 319 | (set-buffer (get-buffer-create " *generate-autoload-file*")) | 337 | (save-excursion |
| 320 | (kill-all-local-variables) | 338 | (save-restriction |
| 321 | (erase-buffer) | 339 | (widen) |
| 322 | (setq buffer-undo-list t | 340 | (goto-char (point-min)) |
| 323 | buffer-read-only nil) | 341 | (while (not (eobp)) |
| 324 | (emacs-lisp-mode) | 342 | (skip-chars-forward " \t\n\f") |
| 325 | (insert-file-contents file nil)) | 343 | (cond |
| 326 | (save-excursion | 344 | ((looking-at (regexp-quote generate-autoload-cookie)) |
| 327 | (save-restriction | 345 | (search-forward generate-autoload-cookie) |
| 328 | (widen) | 346 | (skip-chars-forward " \t") |
| 329 | (goto-char (point-min)) | 347 | (setq done-any t) |
| 330 | (while (not (eobp)) | 348 | (if (eolp) |
| 331 | (skip-chars-forward " \t\n\f") | 349 | ;; Read the next form and make an autoload. |
| 332 | (cond | 350 | (let* ((form (prog1 (read (current-buffer)) |
| 333 | ((looking-at (regexp-quote generate-autoload-cookie)) | 351 | (or (bolp) (forward-line 1)))) |
| 334 | (search-forward generate-autoload-cookie) | 352 | (autoload (make-autoload form load-name))) |
| 335 | (skip-chars-forward " \t") | 353 | (if autoload |
| 336 | (setq done-any t) | 354 | (push (nth 1 form) autoloads-done) |
| 337 | (if (eolp) | 355 | (setq autoload form)) |
| 338 | ;; Read the next form and make an autoload. | 356 | (let ((autoload-print-form-outbuf outbuf)) |
| 339 | (let* ((form (prog1 (read (current-buffer)) | 357 | (autoload-print-form autoload))) |
| 340 | (or (bolp) (forward-line 1)))) | 358 | |
| 341 | (autoload (make-autoload form load-name))) | 359 | ;; Copy the rest of the line to the output. |
| 342 | (if autoload | 360 | (princ (buffer-substring |
| 343 | (setq autoloads-done (cons (nth 1 form) | 361 | (progn |
| 344 | autoloads-done)) | 362 | ;; Back up over whitespace, to preserve it. |
| 345 | (setq autoload form)) | 363 | (skip-chars-backward " \f\t") |
| 346 | (let ((autoload-print-form-outbuf outbuf)) | 364 | (if (= (char-after (1+ (point))) ? ) |
| 347 | (autoload-print-form autoload))) | 365 | ;; Eat one space. |
| 348 | 366 | (forward-char 1)) | |
| 349 | ;; Copy the rest of the line to the output. | 367 | (point)) |
| 350 | (princ (buffer-substring | 368 | (progn (forward-line 1) (point))) |
| 351 | (progn | 369 | outbuf))) |
| 352 | ;; Back up over whitespace, to preserve it. | 370 | ((looking-at ";") |
| 353 | (skip-chars-backward " \f\t") | 371 | ;; Don't read the comment. |
| 354 | (if (= (char-after (1+ (point))) ? ) | 372 | (forward-line 1)) |
| 355 | ;; Eat one space. | 373 | (t |
| 356 | (forward-char 1)) | 374 | (forward-sexp 1) |
| 357 | (point)) | 375 | (forward-line 1)))))) |
| 358 | (progn (forward-line 1) (point))) | 376 | |
| 359 | outbuf))) | 377 | (when done-any |
| 360 | ((looking-at ";") | 378 | (with-current-buffer outbuf |
| 361 | ;; Don't read the comment. | 379 | (save-excursion |
| 362 | (forward-line 1)) | 380 | ;; Insert the section-header line which lists the file name |
| 363 | (t | 381 | ;; and which functions are in it, etc. |
| 364 | (forward-sexp 1) | 382 | (goto-char output-start) |
| 365 | (forward-line 1))))))) | 383 | (autoload-insert-section-header |
| 366 | (or visited | 384 | outbuf autoloads-done load-name file |
| 367 | ;; We created this buffer, so we should kill it. | 385 | (nth 5 (file-attributes file))) |
| 368 | (kill-buffer (current-buffer))) | 386 | (insert ";;; Generated autoloads from " |
| 369 | (set-buffer outbuf) | 387 | (autoload-trim-file-name file) "\n")) |
| 370 | (setq output-end (point-marker)))) | 388 | (insert generate-autoload-section-trailer))) |
| 371 | (if done-any | 389 | (message "Generating autoloads for %s...done" file)) |
| 372 | (progn | 390 | (or visited |
| 373 | ;; Insert the section-header line | 391 | ;; We created this buffer, so we should kill it. |
| 374 | ;; which lists the file name and which functions are in it, etc. | 392 | (kill-buffer (current-buffer)))) |
| 375 | (autoload-insert-section-header outbuf autoloads-done load-name file | 393 | (not done-any))) |
| 376 | (nth 5 (file-attributes file))) | ||
| 377 | (insert ";;; Generated autoloads from " | ||
| 378 | (autoload-trim-file-name file) "\n") | ||
| 379 | (goto-char output-end) | ||
| 380 | (insert generate-autoload-section-trailer))) | ||
| 381 | (message "Generating autoloads for %s...done" file))) | ||
| 382 | 394 | ||
| 383 | ;;;###autoload | 395 | ;;;###autoload |
| 384 | (defun update-file-autoloads (file &optional save-after) | 396 | (defun update-file-autoloads (file &optional save-after) |
| @@ -457,37 +469,7 @@ Autoload section for %s is up to date." | |||
| 457 | (goto-char (point-max)) | 469 | (goto-char (point-max)) |
| 458 | (search-backward "\f" nil t))) | 470 | (search-backward "\f" nil t))) |
| 459 | (or (eq found 'up-to-date) | 471 | (or (eq found 'up-to-date) |
| 460 | (and (eq found 'new) | 472 | (setq no-autoloads (generate-file-autoloads file))))) |
| 461 | ;; Check that FILE has any cookies before generating a | ||
| 462 | ;; new section for it. | ||
| 463 | (save-excursion | ||
| 464 | (if existing-buffer | ||
| 465 | (set-buffer existing-buffer) | ||
| 466 | ;; It is faster to avoid visiting the file. | ||
| 467 | (set-buffer (get-buffer-create " *autoload-file*")) | ||
| 468 | (kill-all-local-variables) | ||
| 469 | (erase-buffer) | ||
| 470 | (setq buffer-undo-list t | ||
| 471 | buffer-read-only nil) | ||
| 472 | (emacs-lisp-mode) | ||
| 473 | (insert-file-contents file nil)) | ||
| 474 | (save-excursion | ||
| 475 | (save-restriction | ||
| 476 | (widen) | ||
| 477 | (goto-char (point-min)) | ||
| 478 | (prog1 | ||
| 479 | (if (re-search-forward | ||
| 480 | (concat "^" (regexp-quote | ||
| 481 | generate-autoload-cookie)) | ||
| 482 | nil t) | ||
| 483 | nil | ||
| 484 | (if (interactive-p) | ||
| 485 | (message "%s has no autoloads" file)) | ||
| 486 | (setq no-autoloads t) | ||
| 487 | t) | ||
| 488 | (or existing-buffer | ||
| 489 | (kill-buffer (current-buffer)))))))) | ||
| 490 | (generate-file-autoloads file)))) | ||
| 491 | (and save-after | 473 | (and save-after |
| 492 | (buffer-modified-p) | 474 | (buffer-modified-p) |
| 493 | (save-buffer)) | 475 | (save-buffer)) |
diff --git a/lisp/emacs-lisp/bindat.el b/lisp/emacs-lisp/bindat.el index 823fcf869b6..d05eed2c4a2 100644 --- a/lisp/emacs-lisp/bindat.el +++ b/lisp/emacs-lisp/bindat.el | |||
| @@ -188,23 +188,20 @@ | |||
| 188 | ;; ([FIELD] eval FORM) | 188 | ;; ([FIELD] eval FORM) |
| 189 | ;; is interpreted by evalling FORM for its side effects only. | 189 | ;; is interpreted by evalling FORM for its side effects only. |
| 190 | ;; If FIELD is specified, the value is bound to that field. | 190 | ;; If FIELD is specified, the value is bound to that field. |
| 191 | ;; The FORM may access and update `raw-data' and `pos' (see `bindat-unpack'), | 191 | ;; The FORM may access and update `bindat-raw' and `bindat-idx' (see `bindat-unpack'). |
| 192 | ;; as well as the lisp data structure in `struct'. | ||
| 193 | 192 | ||
| 194 | ;;; Code: | 193 | ;;; Code: |
| 195 | 194 | ||
| 196 | ;; Helper functions for structure unpacking. | 195 | ;; Helper functions for structure unpacking. |
| 197 | ;; Relies on dynamic binding of RAW-DATA and POS | 196 | ;; Relies on dynamic binding of BINDAT-RAW and BINDAT-IDX |
| 198 | 197 | ||
| 199 | (defvar raw-data) | 198 | (defvar bindat-raw) |
| 200 | (defvar pos) | 199 | (defvar bindat-idx) |
| 201 | 200 | ||
| 202 | (defun bindat--unpack-u8 () | 201 | (defun bindat--unpack-u8 () |
| 203 | (prog1 | 202 | (prog1 |
| 204 | (if (stringp raw-data) | 203 | (aref bindat-raw bindat-idx) |
| 205 | (string-to-char (substring raw-data pos (1+ pos))) | 204 | (setq bindat-idx (1+ bindat-idx)))) |
| 206 | (aref raw-data pos)) | ||
| 207 | (setq pos (1+ pos)))) | ||
| 208 | 205 | ||
| 209 | (defun bindat--unpack-u16 () | 206 | (defun bindat--unpack-u16 () |
| 210 | (let* ((a (bindat--unpack-u8)) (b (bindat--unpack-u8))) | 207 | (let* ((a (bindat--unpack-u8)) (b (bindat--unpack-u8))) |
| @@ -261,16 +258,16 @@ | |||
| 261 | j (lsh j -1))))) | 258 | j (lsh j -1))))) |
| 262 | bits)) | 259 | bits)) |
| 263 | ((eq type 'str) | 260 | ((eq type 'str) |
| 264 | (let ((s (substring raw-data pos (+ pos len)))) | 261 | (let ((s (substring bindat-raw bindat-idx (+ bindat-idx len)))) |
| 265 | (setq pos (+ pos len)) | 262 | (setq bindat-idx (+ bindat-idx len)) |
| 266 | (if (stringp s) s | 263 | (if (stringp s) s |
| 267 | (string-make-unibyte (concat s))))) | 264 | (string-make-unibyte (concat s))))) |
| 268 | ((eq type 'strz) | 265 | ((eq type 'strz) |
| 269 | (let ((i 0) s) | 266 | (let ((i 0) s) |
| 270 | (while (and (< i len) (/= (aref raw-data (+ pos i)) 0)) | 267 | (while (and (< i len) (/= (aref bindat-raw (+ bindat-idx i)) 0)) |
| 271 | (setq i (1+ i))) | 268 | (setq i (1+ i))) |
| 272 | (setq s (substring raw-data pos (+ pos i))) | 269 | (setq s (substring bindat-raw bindat-idx (+ bindat-idx i))) |
| 273 | (setq pos (+ pos len)) | 270 | (setq bindat-idx (+ bindat-idx len)) |
| 274 | (if (stringp s) s | 271 | (if (stringp s) s |
| 275 | (string-make-unibyte (concat s))))) | 272 | (string-make-unibyte (concat s))))) |
| 276 | ((eq type 'vec) | 273 | ((eq type 'vec) |
| @@ -312,10 +309,10 @@ | |||
| 312 | (setq data (eval len)) | 309 | (setq data (eval len)) |
| 313 | (eval len))) | 310 | (eval len))) |
| 314 | ((eq type 'fill) | 311 | ((eq type 'fill) |
| 315 | (setq pos (+ pos len))) | 312 | (setq bindat-idx (+ bindat-idx len))) |
| 316 | ((eq type 'align) | 313 | ((eq type 'align) |
| 317 | (while (/= (% pos len) 0) | 314 | (while (/= (% bindat-idx len) 0) |
| 318 | (setq pos (1+ pos)))) | 315 | (setq bindat-idx (1+ bindat-idx)))) |
| 319 | ((eq type 'struct) | 316 | ((eq type 'struct) |
| 320 | (setq data (bindat--unpack-group (eval len)))) | 317 | (setq data (bindat--unpack-group (eval len)))) |
| 321 | ((eq type 'repeat) | 318 | ((eq type 'repeat) |
| @@ -343,11 +340,13 @@ | |||
| 343 | (setq struct (append data struct)))))) | 340 | (setq struct (append data struct)))))) |
| 344 | struct)) | 341 | struct)) |
| 345 | 342 | ||
| 346 | (defun bindat-unpack (spec raw-data &optional pos) | 343 | (defun bindat-unpack (spec bindat-raw &optional bindat-idx) |
| 347 | "Return structured data according to SPEC for binary data in RAW-DATA. | 344 | "Return structured data according to SPEC for binary data in BINDAT-RAW. |
| 348 | RAW-DATA is a string or vector. Optional third arg POS specifies the | 345 | BINDAT-RAW is a unibyte string or vector. Optional third arg BINDAT-IDX specifies |
| 349 | starting offset in RAW-DATA." | 346 | the starting offset in BINDAT-RAW." |
| 350 | (unless pos (setq pos 0)) | 347 | (when (multibyte-string-p bindat-raw) |
| 348 | (error "String is multibyte")) | ||
| 349 | (unless bindat-idx (setq bindat-idx 0)) | ||
| 351 | (bindat--unpack-group spec)) | 350 | (bindat--unpack-group spec)) |
| 352 | 351 | ||
| 353 | (defun bindat-get-field (struct &rest field) | 352 | (defun bindat-get-field (struct &rest field) |
| @@ -366,7 +365,7 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..." | |||
| 366 | struct) | 365 | struct) |
| 367 | 366 | ||
| 368 | 367 | ||
| 369 | ;; Calculate raw-data length of structured data | 368 | ;; Calculate bindat-raw length of structured data |
| 370 | 369 | ||
| 371 | (defvar bindat--fixed-length-alist | 370 | (defvar bindat--fixed-length-alist |
| 372 | '((u8 . 1) (byte . 1) | 371 | '((u8 . 1) (byte . 1) |
| @@ -405,10 +404,10 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..." | |||
| 405 | (setq struct (cons (cons field (eval len)) struct)) | 404 | (setq struct (cons (cons field (eval len)) struct)) |
| 406 | (eval len))) | 405 | (eval len))) |
| 407 | ((eq type 'fill) | 406 | ((eq type 'fill) |
| 408 | (setq pos (+ pos len))) | 407 | (setq bindat-idx (+ bindat-idx len))) |
| 409 | ((eq type 'align) | 408 | ((eq type 'align) |
| 410 | (while (/= (% pos len) 0) | 409 | (while (/= (% bindat-idx len) 0) |
| 411 | (setq pos (1+ pos)))) | 410 | (setq bindat-idx (1+ bindat-idx)))) |
| 412 | ((eq type 'struct) | 411 | ((eq type 'struct) |
| 413 | (bindat--length-group | 412 | (bindat--length-group |
| 414 | (if field (bindat-get-field struct field) struct) (eval len))) | 413 | (if field (bindat-get-field struct field) struct) (eval len))) |
| @@ -435,25 +434,25 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..." | |||
| 435 | (setq len (cdr type))) | 434 | (setq len (cdr type))) |
| 436 | (if field | 435 | (if field |
| 437 | (setq last (bindat-get-field struct field))) | 436 | (setq last (bindat-get-field struct field))) |
| 438 | (setq pos (+ pos len)))))))) | 437 | (setq bindat-idx (+ bindat-idx len)))))))) |
| 439 | 438 | ||
| 440 | (defun bindat-length (spec struct) | 439 | (defun bindat-length (spec struct) |
| 441 | "Calculate raw-data length for STRUCT according to bindat SPEC." | 440 | "Calculate bindat-raw length for STRUCT according to bindat SPEC." |
| 442 | (let ((pos 0)) | 441 | (let ((bindat-idx 0)) |
| 443 | (bindat--length-group struct spec) | 442 | (bindat--length-group struct spec) |
| 444 | pos)) | 443 | bindat-idx)) |
| 445 | 444 | ||
| 446 | 445 | ||
| 447 | ;; Pack structured data into raw-data | 446 | ;; Pack structured data into bindat-raw |
| 448 | 447 | ||
| 449 | (defun bindat--pack-u8 (v) | 448 | (defun bindat--pack-u8 (v) |
| 450 | (aset raw-data pos (logand v 255)) | 449 | (aset bindat-raw bindat-idx (logand v 255)) |
| 451 | (setq pos (1+ pos))) | 450 | (setq bindat-idx (1+ bindat-idx))) |
| 452 | 451 | ||
| 453 | (defun bindat--pack-u16 (v) | 452 | (defun bindat--pack-u16 (v) |
| 454 | (aset raw-data pos (logand (lsh v -8) 255)) | 453 | (aset bindat-raw bindat-idx (logand (lsh v -8) 255)) |
| 455 | (aset raw-data (1+ pos) (logand v 255)) | 454 | (aset bindat-raw (1+ bindat-idx) (logand v 255)) |
| 456 | (setq pos (+ pos 2))) | 455 | (setq bindat-idx (+ bindat-idx 2))) |
| 457 | 456 | ||
| 458 | (defun bindat--pack-u24 (v) | 457 | (defun bindat--pack-u24 (v) |
| 459 | (bindat--pack-u8 (lsh v -16)) | 458 | (bindat--pack-u8 (lsh v -16)) |
| @@ -464,9 +463,9 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..." | |||
| 464 | (bindat--pack-u16 v)) | 463 | (bindat--pack-u16 v)) |
| 465 | 464 | ||
| 466 | (defun bindat--pack-u16r (v) | 465 | (defun bindat--pack-u16r (v) |
| 467 | (aset raw-data (1+ pos) (logand (lsh v -8) 255)) | 466 | (aset bindat-raw (1+ bindat-idx) (logand (lsh v -8) 255)) |
| 468 | (aset raw-data pos (logand v 255)) | 467 | (aset bindat-raw bindat-idx (logand v 255)) |
| 469 | (setq pos (+ pos 2))) | 468 | (setq bindat-idx (+ bindat-idx 2))) |
| 470 | 469 | ||
| 471 | (defun bindat--pack-u24r (v) | 470 | (defun bindat--pack-u24r (v) |
| 472 | (bindat--pack-u16r v) | 471 | (bindat--pack-u16r v) |
| @@ -481,7 +480,7 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..." | |||
| 481 | (setq type 'vec len 4)) | 480 | (setq type 'vec len 4)) |
| 482 | (cond | 481 | (cond |
| 483 | ((null v) | 482 | ((null v) |
| 484 | (setq pos (+ pos len))) | 483 | (setq bindat-idx (+ bindat-idx len))) |
| 485 | ((memq type '(u8 byte)) | 484 | ((memq type '(u8 byte)) |
| 486 | (bindat--pack-u8 v)) | 485 | (bindat--pack-u8 v)) |
| 487 | ((memq type '(u16 word short)) | 486 | ((memq type '(u16 word short)) |
| @@ -513,11 +512,11 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..." | |||
| 513 | (let ((l (length v)) (i 0)) | 512 | (let ((l (length v)) (i 0)) |
| 514 | (if (> l len) (setq l len)) | 513 | (if (> l len) (setq l len)) |
| 515 | (while (< i l) | 514 | (while (< i l) |
| 516 | (aset raw-data (+ pos i) (aref v i)) | 515 | (aset bindat-raw (+ bindat-idx i) (aref v i)) |
| 517 | (setq i (1+ i))) | 516 | (setq i (1+ i))) |
| 518 | (setq pos (+ pos len)))) | 517 | (setq bindat-idx (+ bindat-idx len)))) |
| 519 | (t | 518 | (t |
| 520 | (setq pos (+ pos len))))) | 519 | (setq bindat-idx (+ bindat-idx len))))) |
| 521 | 520 | ||
| 522 | (defun bindat--pack-group (struct spec) | 521 | (defun bindat--pack-group (struct spec) |
| 523 | (let (last) | 522 | (let (last) |
| @@ -549,10 +548,10 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..." | |||
| 549 | (setq struct (cons (cons field (eval len)) struct)) | 548 | (setq struct (cons (cons field (eval len)) struct)) |
| 550 | (eval len))) | 549 | (eval len))) |
| 551 | ((eq type 'fill) | 550 | ((eq type 'fill) |
| 552 | (setq pos (+ pos len))) | 551 | (setq bindat-idx (+ bindat-idx len))) |
| 553 | ((eq type 'align) | 552 | ((eq type 'align) |
| 554 | (while (/= (% pos len) 0) | 553 | (while (/= (% bindat-idx len) 0) |
| 555 | (setq pos (1+ pos)))) | 554 | (setq bindat-idx (1+ bindat-idx)))) |
| 556 | ((eq type 'struct) | 555 | ((eq type 'struct) |
| 557 | (bindat--pack-group | 556 | (bindat--pack-group |
| 558 | (if field (bindat-get-field struct field) struct) (eval len))) | 557 | (if field (bindat-get-field struct field) struct) (eval len))) |
| @@ -579,18 +578,19 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..." | |||
| 579 | (bindat--pack-item last type len) | 578 | (bindat--pack-item last type len) |
| 580 | )))))) | 579 | )))))) |
| 581 | 580 | ||
| 582 | (defun bindat-pack (spec struct &optional raw-data pos) | 581 | (defun bindat-pack (spec struct &optional bindat-raw bindat-idx) |
| 583 | "Return binary data packed according to SPEC for structured data STRUCT. | 582 | "Return binary data packed according to SPEC for structured data STRUCT. |
| 584 | Optional third arg RAW-DATA is a pre-allocated string or vector to pack into. | 583 | Optional third arg BINDAT-RAW is a pre-allocated unibyte string or vector to |
| 585 | Optional fourth arg POS is the starting offset into RAW-DATA. | 584 | pack into. |
| 586 | Note: The result is a multibyte string; use `string-make-unibyte' on it | 585 | Optional fourth arg BINDAT-IDX is the starting offset into BINDAT-RAW." |
| 587 | to make it unibyte if necessary." | 586 | (when (multibyte-string-p bindat-raw) |
| 588 | (let ((no-return raw-data)) | 587 | (error "Pre-allocated string is multibyte")) |
| 589 | (unless pos (setq pos 0)) | 588 | (let ((no-return bindat-raw)) |
| 590 | (unless raw-data | 589 | (unless bindat-idx (setq bindat-idx 0)) |
| 591 | (setq raw-data (make-vector (+ pos (bindat-length spec struct)) 0))) | 590 | (unless bindat-raw |
| 591 | (setq bindat-raw (make-vector (+ bindat-idx (bindat-length spec struct)) 0))) | ||
| 592 | (bindat--pack-group struct spec) | 592 | (bindat--pack-group struct spec) |
| 593 | (if no-return nil (concat raw-data)))) | 593 | (if no-return nil (concat bindat-raw)))) |
| 594 | 594 | ||
| 595 | 595 | ||
| 596 | ;; Misc. format conversions | 596 | ;; Misc. format conversions |
diff --git a/lisp/emacs-lisp/ewoc.el b/lisp/emacs-lisp/ewoc.el index 2cb90738072..b4857f4310d 100644 --- a/lisp/emacs-lisp/ewoc.el +++ b/lisp/emacs-lisp/ewoc.el | |||
| @@ -88,36 +88,7 @@ | |||
| 88 | ;; limit! It is even possible to have another ewoc as an | 88 | ;; limit! It is even possible to have another ewoc as an |
| 89 | ;; element. In that way some kind of tree hierarchy can be created. | 89 | ;; element. In that way some kind of tree hierarchy can be created. |
| 90 | ;; | 90 | ;; |
| 91 | ;; Full documentation will, God willing, soon be available in a | 91 | ;; The Emacs Lisp Reference Manual documents ewoc.el's "public interface". |
| 92 | ;; Texinfo manual. | ||
| 93 | |||
| 94 | ;; In the mean time `grep '^(.*ewoc-[^-]' emacs-lisp/ewoc.el' can help | ||
| 95 | ;; you find all the exported functions: | ||
| 96 | ;; | ||
| 97 | ;; (defun ewoc-create (pretty-printer &optional header footer) | ||
| 98 | ;; (defalias 'ewoc-data 'ewoc--node-data) | ||
| 99 | ;; (defun ewoc-set-data (node data) | ||
| 100 | ;; (defun ewoc-location (node) | ||
| 101 | ;; (defun ewoc-enter-first (ewoc data) | ||
| 102 | ;; (defun ewoc-enter-last (ewoc data) | ||
| 103 | ;; (defun ewoc-enter-after (ewoc node data) | ||
| 104 | ;; (defun ewoc-enter-before (ewoc node data) | ||
| 105 | ;; (defun ewoc-next (ewoc node) | ||
| 106 | ;; (defun ewoc-prev (ewoc node) | ||
| 107 | ;; (defun ewoc-nth (ewoc n) | ||
| 108 | ;; (defun ewoc-map (map-function ewoc &rest args) | ||
| 109 | ;; (defun ewoc-filter (ewoc predicate &rest args) | ||
| 110 | ;; (defun ewoc-delete (ewoc &rest nodes) | ||
| 111 | ;; (defun ewoc-locate (ewoc &optional pos guess) | ||
| 112 | ;; (defun ewoc-invalidate (ewoc &rest nodes) | ||
| 113 | ;; (defun ewoc-goto-prev (ewoc arg) | ||
| 114 | ;; (defun ewoc-goto-next (ewoc arg) | ||
| 115 | ;; (defun ewoc-goto-node (ewoc node) | ||
| 116 | ;; (defun ewoc-refresh (ewoc) | ||
| 117 | ;; (defun ewoc-collect (ewoc predicate &rest args) | ||
| 118 | ;; (defun ewoc-buffer (ewoc) | ||
| 119 | ;; (defun ewoc-get-hf (ewoc) | ||
| 120 | ;; (defun ewoc-set-hf (ewoc header footer) | ||
| 121 | 92 | ||
| 122 | ;; Coding conventions | 93 | ;; Coding conventions |
| 123 | ;; ================== | 94 | ;; ================== |
| @@ -125,48 +96,43 @@ | |||
| 125 | ;; All functions of course start with `ewoc'. Functions and macros | 96 | ;; All functions of course start with `ewoc'. Functions and macros |
| 126 | ;; starting with the prefix `ewoc--' are meant for internal use, | 97 | ;; starting with the prefix `ewoc--' are meant for internal use, |
| 127 | ;; while those starting with `ewoc-' are exported for public use. | 98 | ;; while those starting with `ewoc-' are exported for public use. |
| 128 | ;; There are currently no global or buffer-local variables used. | ||
| 129 | |||
| 130 | 99 | ||
| 131 | ;;; Code: | 100 | ;;; Code: |
| 132 | 101 | ||
| 133 | (eval-when-compile (require 'cl)) ;because of CL compiler macros | 102 | (eval-when-compile (require 'cl)) |
| 134 | |||
| 135 | ;; The doubly linked list is implemented as a circular list | ||
| 136 | ;; with a dummy node first and last. The dummy node is used as | ||
| 137 | ;; "the dll" (or rather is the dll handle passed around). | ||
| 138 | 103 | ||
| 104 | ;; The doubly linked list is implemented as a circular list with a dummy | ||
| 105 | ;; node first and last. The dummy node is used as "the dll". | ||
| 139 | (defstruct (ewoc--node | 106 | (defstruct (ewoc--node |
| 140 | (:type vector) ;required for ewoc--node-branch hack | 107 | (:type vector) ;ewoc--node-nth needs this |
| 108 | (:constructor nil) | ||
| 141 | (:constructor ewoc--node-create (start-marker data))) | 109 | (:constructor ewoc--node-create (start-marker data))) |
| 142 | left right data start-marker) | 110 | left right data start-marker) |
| 143 | 111 | ||
| 144 | (defalias 'ewoc--node-branch 'aref | ||
| 145 | "Get the left (CHILD=0) or right (CHILD=1) child of the NODE. | ||
| 146 | |||
| 147 | \(fn NODE CHILD)") | ||
| 148 | |||
| 149 | (defun ewoc--node-next (dll node) | 112 | (defun ewoc--node-next (dll node) |
| 150 | "Return the node after NODE, or nil if NODE is the last node." | 113 | "Return the node after NODE, or nil if NODE is the last node." |
| 151 | (unless (eq (ewoc--node-right node) dll) (ewoc--node-right node))) | 114 | (let ((R (ewoc--node-right node))) |
| 115 | (unless (eq dll R) R))) | ||
| 152 | 116 | ||
| 153 | (defun ewoc--node-prev (dll node) | 117 | (defun ewoc--node-prev (dll node) |
| 154 | "Return the node before NODE, or nil if NODE is the first node." | 118 | "Return the node before NODE, or nil if NODE is the first node." |
| 155 | (unless (eq (ewoc--node-left node) dll) (ewoc--node-left node))) | 119 | (let ((L (ewoc--node-left node))) |
| 120 | (unless (eq dll L) L))) | ||
| 156 | 121 | ||
| 157 | (defun ewoc--node-nth (dll n) | 122 | (defun ewoc--node-nth (dll n) |
| 158 | "Return the Nth node from the doubly linked list DLL. | 123 | "Return the Nth node from the doubly linked list `dll'. |
| 159 | N counts from zero. If DLL is not that long, nil is returned. | 124 | N counts from zero. If N is negative, return the -(N+1)th last element. |
| 160 | If N is negative, return the -(N+1)th last element. | 125 | If N is out of range, return nil. |
| 161 | Thus, (ewoc--node-nth dll 0) returns the first node, | 126 | Thus, (ewoc--node-nth dll 0) returns the first node, |
| 162 | and (ewoc--node-nth dll -1) returns the last node." | 127 | and (ewoc--node-nth dll -1) returns the last node." |
| 128 | ;; Presuming a node is ":type vector", starting with `left' and `right': | ||
| 163 | ;; Branch 0 ("follow left pointer") is used when n is negative. | 129 | ;; Branch 0 ("follow left pointer") is used when n is negative. |
| 164 | ;; Branch 1 ("follow right pointer") is used otherwise. | 130 | ;; Branch 1 ("follow right pointer") is used otherwise. |
| 165 | (let* ((branch (if (< n 0) 0 1)) | 131 | (let* ((branch (if (< n 0) 0 1)) |
| 166 | (node (ewoc--node-branch dll branch))) | 132 | (node (aref dll branch))) |
| 167 | (if (< n 0) (setq n (- -1 n))) | 133 | (if (< n 0) (setq n (- -1 n))) |
| 168 | (while (and (not (eq dll node)) (> n 0)) | 134 | (while (and (not (eq dll node)) (> n 0)) |
| 169 | (setq node (ewoc--node-branch node branch)) | 135 | (setq node (aref node branch)) |
| 170 | (setq n (1- n))) | 136 | (setq n (1- n))) |
| 171 | (unless (eq dll node) node))) | 137 | (unless (eq dll node) node))) |
| 172 | 138 | ||
| @@ -179,16 +145,15 @@ and (ewoc--node-nth dll -1) returns the last node." | |||
| 179 | 145 | ||
| 180 | (defstruct (ewoc | 146 | (defstruct (ewoc |
| 181 | (:constructor nil) | 147 | (:constructor nil) |
| 182 | (:constructor ewoc--create | 148 | (:constructor ewoc--create (buffer pretty-printer dll)) |
| 183 | (buffer pretty-printer header footer dll)) | ||
| 184 | (:conc-name ewoc--)) | 149 | (:conc-name ewoc--)) |
| 185 | buffer pretty-printer header footer dll last-node) | 150 | buffer pretty-printer header footer dll last-node hf-pp) |
| 186 | 151 | ||
| 187 | (defmacro ewoc--set-buffer-bind-dll-let* (ewoc varlist &rest forms) | 152 | (defmacro ewoc--set-buffer-bind-dll-let* (ewoc varlist &rest forms) |
| 188 | "Execute FORMS with ewoc--buffer selected as current buffer, | 153 | "Execute FORMS with ewoc--buffer selected as current buffer, |
| 189 | dll bound to ewoc--dll, and VARLIST bound as in a let*. | 154 | `dll' bound to the dll, and VARLIST bound as in a let*. |
| 190 | dll will be bound when VARLIST is initialized, but the current | 155 | `dll' will be bound when VARLIST is initialized, but |
| 191 | buffer will *not* have been changed. | 156 | the current buffer will *not* have been changed. |
| 192 | Return value of last form in FORMS." | 157 | Return value of last form in FORMS." |
| 193 | (let ((hnd (make-symbol "ewoc"))) | 158 | (let ((hnd (make-symbol "ewoc"))) |
| 194 | `(let* ((,hnd ,ewoc) | 159 | `(let* ((,hnd ,ewoc) |
| @@ -207,17 +172,20 @@ BUT if it is the header or the footer in EWOC return nil instead." | |||
| 207 | (eq node (ewoc--footer ewoc))) | 172 | (eq node (ewoc--footer ewoc))) |
| 208 | node)) | 173 | node)) |
| 209 | 174 | ||
| 210 | (defun ewoc--adjust (beg end node) | 175 | (defun ewoc--adjust (beg end node dll) |
| 211 | ;; "Manually reseat" markers for NODE and its successors (including footer | 176 | ;; "Manually reseat" markers for NODE and its successors (including footer |
| 212 | ;; and dll), in the case where they originally shared start position with | 177 | ;; and dll), in the case where they originally shared start position with |
| 213 | ;; BEG, to END. BEG and END are buffer positions describing NODE's left | 178 | ;; BEG, to END. BEG and END are buffer positions describing NODE's left |
| 214 | ;; neighbor. This operation is functionally equivalent to temporarily | 179 | ;; neighbor. This operation is functionally equivalent to temporarily |
| 215 | ;; setting these nodes' markers' insertion type to t around the pretty-print | 180 | ;; setting these nodes' markers' insertion type to t around the pretty-print |
| 216 | ;; call that precedes the call to `ewoc-adjust', and then changing them back | 181 | ;; call that precedes the call to `ewoc--adjust', and then changing them back |
| 217 | ;; to nil. | 182 | ;; to nil. |
| 218 | (when (< beg end) | 183 | (when (< beg end) |
| 219 | (let (m) | 184 | (let (m) |
| 220 | (while (and (= beg (setq m (ewoc--node-start-marker node))) | 185 | (while (and (= beg (setq m (ewoc--node-start-marker node))) |
| 186 | ;; The "dummy" node `dll' actually holds the marker that | ||
| 187 | ;; points to the end of the footer, so we check `dll' | ||
| 188 | ;; *after* reseating the marker. | ||
| 221 | (progn | 189 | (progn |
| 222 | (set-marker m end) | 190 | (set-marker m end) |
| 223 | (not (eq dll node)))) | 191 | (not (eq dll node)))) |
| @@ -228,21 +196,16 @@ BUT if it is the header or the footer in EWOC return nil instead." | |||
| 228 | Call PRETTY-PRINTER with point at NODE's start, thus pushing back | 196 | Call PRETTY-PRINTER with point at NODE's start, thus pushing back |
| 229 | NODE and leaving the new node's start there. Return the new node." | 197 | NODE and leaving the new node's start there. Return the new node." |
| 230 | (save-excursion | 198 | (save-excursion |
| 231 | (let* ((inhibit-read-only t) | 199 | (let ((elemnode (ewoc--node-create |
| 232 | (m (copy-marker (ewoc--node-start-marker node))) | 200 | (copy-marker (ewoc--node-start-marker node)) data))) |
| 233 | (pos (marker-position m)) | 201 | (setf (ewoc--node-left elemnode) (ewoc--node-left node) |
| 234 | (elemnode (ewoc--node-create m data))) | ||
| 235 | (goto-char pos) | ||
| 236 | (funcall pretty-printer data) | ||
| 237 | (setf (marker-position m) pos | ||
| 238 | (ewoc--node-left elemnode) (ewoc--node-left node) | ||
| 239 | (ewoc--node-right elemnode) node | 202 | (ewoc--node-right elemnode) node |
| 240 | (ewoc--node-right (ewoc--node-left node)) elemnode | 203 | (ewoc--node-right (ewoc--node-left node)) elemnode |
| 241 | (ewoc--node-left node) elemnode) | 204 | (ewoc--node-left node) elemnode) |
| 242 | (ewoc--adjust pos (point) node) | 205 | (ewoc--refresh-node pretty-printer elemnode dll) |
| 243 | elemnode))) | 206 | elemnode))) |
| 244 | 207 | ||
| 245 | (defun ewoc--refresh-node (pp node) | 208 | (defun ewoc--refresh-node (pp node dll) |
| 246 | "Redisplay the element represented by NODE using the pretty-printer PP." | 209 | "Redisplay the element represented by NODE using the pretty-printer PP." |
| 247 | (let ((inhibit-read-only t) | 210 | (let ((inhibit-read-only t) |
| 248 | (m (ewoc--node-start-marker node)) | 211 | (m (ewoc--node-start-marker node)) |
| @@ -252,13 +215,20 @@ NODE and leaving the new node's start there. Return the new node." | |||
| 252 | ;; Calculate and insert the string. | 215 | ;; Calculate and insert the string. |
| 253 | (goto-char m) | 216 | (goto-char m) |
| 254 | (funcall pp (ewoc--node-data node)) | 217 | (funcall pp (ewoc--node-data node)) |
| 255 | (ewoc--adjust m (point) R))) | 218 | (ewoc--adjust m (point) R dll))) |
| 219 | |||
| 220 | (defun ewoc--wrap (func) | ||
| 221 | (lexical-let ((ewoc--user-pp func)) | ||
| 222 | (lambda (data) | ||
| 223 | (funcall ewoc--user-pp data) | ||
| 224 | (insert "\n")))) | ||
| 225 | |||
| 256 | 226 | ||
| 257 | ;;; =========================================================================== | 227 | ;;; =========================================================================== |
| 258 | ;;; Public members of the Ewoc package | 228 | ;;; Public members of the Ewoc package |
| 259 | 229 | ||
| 260 | ;;;###autoload | 230 | ;;;###autoload |
| 261 | (defun ewoc-create (pretty-printer &optional header footer) | 231 | (defun ewoc-create (pretty-printer &optional header footer nosep) |
| 262 | "Create an empty ewoc. | 232 | "Create an empty ewoc. |
| 263 | 233 | ||
| 264 | The ewoc will be inserted in the current buffer at the current position. | 234 | The ewoc will be inserted in the current buffer at the current position. |
| @@ -271,14 +241,20 @@ several lines. The PRETTY-PRINTER should use `insert', and not | |||
| 271 | 241 | ||
| 272 | Optional second and third arguments HEADER and FOOTER are strings, | 242 | Optional second and third arguments HEADER and FOOTER are strings, |
| 273 | possibly empty, that will always be present at the top and bottom, | 243 | possibly empty, that will always be present at the top and bottom, |
| 274 | respectively, of the ewoc." | 244 | respectively, of the ewoc. |
| 245 | |||
| 246 | Normally, a newline is automatically inserted after the header, | ||
| 247 | the footer and every node's printed representation. Optional | ||
| 248 | fourth arg NOSEP non-nil inhibits this." | ||
| 275 | (let* ((dummy-node (ewoc--node-create 'DL-LIST 'DL-LIST)) | 249 | (let* ((dummy-node (ewoc--node-create 'DL-LIST 'DL-LIST)) |
| 276 | (dll (progn (setf (ewoc--node-right dummy-node) dummy-node) | 250 | (dll (progn (setf (ewoc--node-right dummy-node) dummy-node) |
| 277 | (setf (ewoc--node-left dummy-node) dummy-node) | 251 | (setf (ewoc--node-left dummy-node) dummy-node) |
| 278 | dummy-node)) | 252 | dummy-node)) |
| 279 | (new-ewoc | 253 | (wrap (if nosep 'identity 'ewoc--wrap)) |
| 280 | (ewoc--create (current-buffer) | 254 | (new-ewoc (ewoc--create (current-buffer) |
| 281 | pretty-printer nil nil dll)) | 255 | (funcall wrap pretty-printer) |
| 256 | dll)) | ||
| 257 | (hf-pp (funcall wrap 'insert)) | ||
| 282 | (pos (point)) | 258 | (pos (point)) |
| 283 | head foot) | 259 | head foot) |
| 284 | (ewoc--set-buffer-bind-dll new-ewoc | 260 | (ewoc--set-buffer-bind-dll new-ewoc |
| @@ -286,8 +262,9 @@ respectively, of the ewoc." | |||
| 286 | (unless header (setq header "")) | 262 | (unless header (setq header "")) |
| 287 | (unless footer (setq footer "")) | 263 | (unless footer (setq footer "")) |
| 288 | (setf (ewoc--node-start-marker dll) (copy-marker pos) | 264 | (setf (ewoc--node-start-marker dll) (copy-marker pos) |
| 289 | foot (ewoc--insert-new-node dll footer 'insert) | 265 | foot (ewoc--insert-new-node dll footer hf-pp) |
| 290 | head (ewoc--insert-new-node foot header 'insert) | 266 | head (ewoc--insert-new-node foot header hf-pp) |
| 267 | (ewoc--hf-pp new-ewoc) hf-pp | ||
| 291 | (ewoc--footer new-ewoc) foot | 268 | (ewoc--footer new-ewoc) foot |
| 292 | (ewoc--header new-ewoc) head)) | 269 | (ewoc--header new-ewoc) head)) |
| 293 | ;; Return the ewoc | 270 | ;; Return the ewoc |
| @@ -314,7 +291,6 @@ Return the new node." | |||
| 314 | (ewoc--set-buffer-bind-dll ewoc | 291 | (ewoc--set-buffer-bind-dll ewoc |
| 315 | (ewoc-enter-before ewoc (ewoc--node-nth dll -1) data))) | 292 | (ewoc-enter-before ewoc (ewoc--node-nth dll -1) data))) |
| 316 | 293 | ||
| 317 | |||
| 318 | (defun ewoc-enter-after (ewoc node data) | 294 | (defun ewoc-enter-after (ewoc node data) |
| 319 | "Enter a new element DATA after NODE in EWOC. | 295 | "Enter a new element DATA after NODE in EWOC. |
| 320 | Return the new node." | 296 | Return the new node." |
| @@ -339,21 +315,19 @@ Return nil if NODE is nil or the last element." | |||
| 339 | Return nil if NODE is nil or the first element." | 315 | Return nil if NODE is nil or the first element." |
| 340 | (when node | 316 | (when node |
| 341 | (ewoc--filter-hf-nodes | 317 | (ewoc--filter-hf-nodes |
| 342 | ewoc | 318 | ewoc (ewoc--node-prev (ewoc--dll ewoc) node)))) |
| 343 | (ewoc--node-prev (ewoc--dll ewoc) node)))) | ||
| 344 | |||
| 345 | 319 | ||
| 346 | (defun ewoc-nth (ewoc n) | 320 | (defun ewoc-nth (ewoc n) |
| 347 | "Return the Nth node. | 321 | "Return the Nth node. |
| 348 | N counts from zero. Return nil if there is less than N elements. | 322 | N counts from zero. Return nil if there is less than N elements. |
| 349 | If N is negative, return the -(N+1)th last element. | 323 | If N is negative, return the -(N+1)th last element. |
| 350 | Thus, (ewoc-nth dll 0) returns the first node, | 324 | Thus, (ewoc-nth ewoc 0) returns the first node, |
| 351 | and (ewoc-nth dll -1) returns the last node. | 325 | and (ewoc-nth ewoc -1) returns the last node. |
| 352 | Use `ewoc-data' to extract the data from the node." | 326 | Use `ewoc-data' to extract the data from the node." |
| 353 | ;; Skip the header (or footer, if n is negative). | 327 | ;; Skip the header (or footer, if n is negative). |
| 354 | (setq n (if (< n 0) (1- n) (1+ n))) | 328 | (setq n (if (< n 0) (1- n) (1+ n))) |
| 355 | (ewoc--filter-hf-nodes ewoc | 329 | (ewoc--filter-hf-nodes ewoc |
| 356 | (ewoc--node-nth (ewoc--dll ewoc) n))) | 330 | (ewoc--node-nth (ewoc--dll ewoc) n))) |
| 357 | 331 | ||
| 358 | (defun ewoc-map (map-function ewoc &rest args) | 332 | (defun ewoc-map (map-function ewoc &rest args) |
| 359 | "Apply MAP-FUNCTION to all elements in EWOC. | 333 | "Apply MAP-FUNCTION to all elements in EWOC. |
| @@ -374,18 +348,18 @@ arguments will be passed to MAP-FUNCTION." | |||
| 374 | (save-excursion | 348 | (save-excursion |
| 375 | (while (not (eq node footer)) | 349 | (while (not (eq node footer)) |
| 376 | (if (apply map-function (ewoc--node-data node) args) | 350 | (if (apply map-function (ewoc--node-data node) args) |
| 377 | (ewoc--refresh-node pp node)) | 351 | (ewoc--refresh-node pp node dll)) |
| 378 | (setq node (ewoc--node-next dll node)))))) | 352 | (setq node (ewoc--node-next dll node)))))) |
| 379 | 353 | ||
| 380 | (defun ewoc-delete (ewoc &rest nodes) | 354 | (defun ewoc-delete (ewoc &rest nodes) |
| 381 | "Delete NODES from EWOC." | 355 | "Delete NODES from EWOC." |
| 382 | (ewoc--set-buffer-bind-dll-let* ewoc | 356 | (ewoc--set-buffer-bind-dll-let* ewoc |
| 383 | ((L nil) (R nil)) | 357 | ((L nil) (R nil) (last (ewoc--last-node ewoc))) |
| 384 | (dolist (node nodes) | 358 | (dolist (node nodes) |
| 385 | ;; If we are about to delete the node pointed at by last-node, | 359 | ;; If we are about to delete the node pointed at by last-node, |
| 386 | ;; set last-node to nil. | 360 | ;; set last-node to nil. |
| 387 | (if (eq (ewoc--last-node ewoc) node) | 361 | (when (eq last node) |
| 388 | (setf (ewoc--last-node ewoc) nil)) | 362 | (setf last nil (ewoc--last-node ewoc) nil)) |
| 389 | (delete-region (ewoc--node-start-marker node) | 363 | (delete-region (ewoc--node-start-marker node) |
| 390 | (ewoc--node-start-marker (ewoc--node-next dll node))) | 364 | (ewoc--node-start-marker (ewoc--node-next dll node))) |
| 391 | (set-marker (ewoc--node-start-marker node) nil) | 365 | (set-marker (ewoc--node-start-marker node) nil) |
| @@ -425,8 +399,7 @@ If POS points before the first element, the first node is returned. | |||
| 425 | If POS points after the last element, the last node is returned. | 399 | If POS points after the last element, the last node is returned. |
| 426 | If the EWOC is empty, nil is returned." | 400 | If the EWOC is empty, nil is returned." |
| 427 | (unless pos (setq pos (point))) | 401 | (unless pos (setq pos (point))) |
| 428 | (ewoc--set-buffer-bind-dll-let* ewoc | 402 | (ewoc--set-buffer-bind-dll ewoc |
| 429 | ((footer (ewoc--footer ewoc))) | ||
| 430 | 403 | ||
| 431 | (cond | 404 | (cond |
| 432 | ;; Nothing present? | 405 | ;; Nothing present? |
| @@ -459,7 +432,7 @@ If the EWOC is empty, nil is returned." | |||
| 459 | (setq distance d) | 432 | (setq distance d) |
| 460 | (setq best-guess g))) | 433 | (setq best-guess g))) |
| 461 | 434 | ||
| 462 | (when (ewoc--last-node ewoc) ;Check "previous". | 435 | (when (ewoc--last-node ewoc) ;Check "previous". |
| 463 | (let* ((g (ewoc--last-node ewoc)) | 436 | (let* ((g (ewoc--last-node ewoc)) |
| 464 | (d (abs (- pos (ewoc--node-start-marker g))))) | 437 | (d (abs (- pos (ewoc--node-start-marker g))))) |
| 465 | (when (< d distance) | 438 | (when (< d distance) |
| @@ -493,7 +466,7 @@ Delete current text first, thus effecting a \"refresh\"." | |||
| 493 | ((pp (ewoc--pretty-printer ewoc))) | 466 | ((pp (ewoc--pretty-printer ewoc))) |
| 494 | (save-excursion | 467 | (save-excursion |
| 495 | (dolist (node nodes) | 468 | (dolist (node nodes) |
| 496 | (ewoc--refresh-node pp node))))) | 469 | (ewoc--refresh-node pp node dll))))) |
| 497 | 470 | ||
| 498 | (defun ewoc-goto-prev (ewoc arg) | 471 | (defun ewoc-goto-prev (ewoc arg) |
| 499 | "Move point to the ARGth previous element in EWOC. | 472 | "Move point to the ARGth previous element in EWOC. |
| @@ -590,20 +563,21 @@ Return nil if the buffer has been deleted." | |||
| 590 | "Set the HEADER and FOOTER of EWOC." | 563 | "Set the HEADER and FOOTER of EWOC." |
| 591 | (ewoc--set-buffer-bind-dll-let* ewoc | 564 | (ewoc--set-buffer-bind-dll-let* ewoc |
| 592 | ((head (ewoc--header ewoc)) | 565 | ((head (ewoc--header ewoc)) |
| 593 | (foot (ewoc--footer ewoc))) | 566 | (foot (ewoc--footer ewoc)) |
| 567 | (hf-pp (ewoc--hf-pp ewoc))) | ||
| 594 | (setf (ewoc--node-data head) header | 568 | (setf (ewoc--node-data head) header |
| 595 | (ewoc--node-data foot) footer) | 569 | (ewoc--node-data foot) footer) |
| 596 | (save-excursion | 570 | (save-excursion |
| 597 | (ewoc--refresh-node 'insert head) | 571 | (ewoc--refresh-node hf-pp head dll) |
| 598 | (ewoc--refresh-node 'insert foot)))) | 572 | (ewoc--refresh-node hf-pp foot dll)))) |
| 599 | 573 | ||
| 600 | 574 | ||
| 601 | (provide 'ewoc) | 575 | (provide 'ewoc) |
| 602 | 576 | ||
| 603 | ;;; Local Variables: | 577 | ;; Local Variables: |
| 604 | ;;; eval: (put 'ewoc--set-buffer-bind-dll 'lisp-indent-hook 1) | 578 | ;; eval: (put 'ewoc--set-buffer-bind-dll 'lisp-indent-hook 1) |
| 605 | ;;; eval: (put 'ewoc--set-buffer-bind-dll-let* 'lisp-indent-hook 2) | 579 | ;; eval: (put 'ewoc--set-buffer-bind-dll-let* 'lisp-indent-hook 2) |
| 606 | ;;; End: | 580 | ;; End: |
| 607 | 581 | ||
| 608 | ;;; arch-tag: d78915b9-9a07-44bf-aac6-04a1fc1bd6d4 | 582 | ;; arch-tag: d78915b9-9a07-44bf-aac6-04a1fc1bd6d4 |
| 609 | ;;; ewoc.el ends here | 583 | ;;; ewoc.el ends here |
diff --git a/lisp/faces.el b/lisp/faces.el index 69af786ee84..9c6cff294b9 100644 --- a/lisp/faces.el +++ b/lisp/faces.el | |||
| @@ -1517,7 +1517,8 @@ If there is neither a user setting nor a default for FACE, return nil." | |||
| 1517 | "Return a list of colors supported for a particular frame. | 1517 | "Return a list of colors supported for a particular frame. |
| 1518 | The argument FRAME specifies which frame to try. | 1518 | The argument FRAME specifies which frame to try. |
| 1519 | The value may be different for frames on different display types. | 1519 | The value may be different for frames on different display types. |
| 1520 | If FRAME doesn't support colors, the value is nil." | 1520 | If FRAME doesn't support colors, the value is nil. |
| 1521 | If FRAME is nil, that stands for the selected frame." | ||
| 1521 | (if (memq (framep (or frame (selected-frame))) '(x w32 mac)) | 1522 | (if (memq (framep (or frame (selected-frame))) '(x w32 mac)) |
| 1522 | (xw-defined-colors frame) | 1523 | (xw-defined-colors frame) |
| 1523 | (mapcar 'car (tty-color-alist frame)))) | 1524 | (mapcar 'car (tty-color-alist frame)))) |
diff --git a/lisp/files.el b/lisp/files.el index 4e8c5623183..7f8b78b2933 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -1847,13 +1847,14 @@ in that case, this function acts as if `enable-local-variables' were t." | |||
| 1847 | ("\\.ad[bs].dg\\'" . ada-mode) | 1847 | ("\\.ad[bs].dg\\'" . ada-mode) |
| 1848 | ("\\.\\([pP]\\([Llm]\\|erl\\|od\\)\\|al\\)\\'" . perl-mode) | 1848 | ("\\.\\([pP]\\([Llm]\\|erl\\|od\\)\\|al\\)\\'" . perl-mode) |
| 1849 | ("Imakefile\\'" . makefile-imake-mode) | 1849 | ("Imakefile\\'" . makefile-imake-mode) |
| 1850 | ("Makeppfile\\(?:\\.mk\\)?\\'" . makefile-makepp-mode) ; Put this before .mk | ||
| 1851 | ("\\.makepp\\'" . makefile-makepp-mode) | ||
| 1850 | ,@(if (memq system-type '(berkeley-unix next-mach darwin)) | 1852 | ,@(if (memq system-type '(berkeley-unix next-mach darwin)) |
| 1851 | '(("\\.mk\\'" . makefile-bsdmake-mode) | 1853 | '(("\\.mk\\'" . makefile-bsdmake-mode) |
| 1852 | ("GNUmakefile\\'" . makefile-gmake-mode) | 1854 | ("GNUmakefile\\'" . makefile-gmake-mode) |
| 1853 | ("[Mm]akefile\\'" . makefile-bsdmake-mode)) | 1855 | ("[Mm]akefile\\'" . makefile-bsdmake-mode)) |
| 1854 | '(("\\.mk\\'" . makefile-gmake-mode) ; Might be any make, give Gnu the host advantage | 1856 | '(("\\.mk\\'" . makefile-gmake-mode) ; Might be any make, give Gnu the host advantage |
| 1855 | ("[Mm]akefile\\'" . makefile-gmake-mode))) | 1857 | ("[Mm]akefile\\'" . makefile-gmake-mode))) |
| 1856 | ("Makeppfile\\'" . makefile-makepp-mode) | ||
| 1857 | ("\\.am\\'" . makefile-automake-mode) | 1858 | ("\\.am\\'" . makefile-automake-mode) |
| 1858 | ;; Less common extensions come here | 1859 | ;; Less common extensions come here |
| 1859 | ;; so more common ones above are found faster. | 1860 | ;; so more common ones above are found faster. |
| @@ -2690,7 +2691,10 @@ It is dangerous if either of these conditions are met: | |||
| 2690 | (or (numberp val) (equal val ''defun))) | 2691 | (or (numberp val) (equal val ''defun))) |
| 2691 | ((eq prop 'edebug-form-spec) | 2692 | ((eq prop 'edebug-form-spec) |
| 2692 | ;; Only allow indirect form specs. | 2693 | ;; Only allow indirect form specs. |
| 2693 | (edebug-basic-spec val))))) | 2694 | ;; During bootstrapping, edebug-basic-spec might not be |
| 2695 | ;; defined yet. | ||
| 2696 | (and (fboundp 'edebug-basic-spec) | ||
| 2697 | (edebug-basic-spec val)))))) | ||
| 2694 | ;; Allow expressions that the user requested. | 2698 | ;; Allow expressions that the user requested. |
| 2695 | (member exp safe-local-eval-forms) | 2699 | (member exp safe-local-eval-forms) |
| 2696 | ;; Certain functions can be allowed with safe arguments | 2700 | ;; Certain functions can be allowed with safe arguments |
| @@ -2995,7 +2999,7 @@ BACKUPNAME is the backup file name, which is the old file renamed." | |||
| 2995 | (condition-case nil | 2999 | (condition-case nil |
| 2996 | (delete-file to-name) | 3000 | (delete-file to-name) |
| 2997 | (file-error nil)) | 3001 | (file-error nil)) |
| 2998 | (copy-file from-name to-name t t 'excl) | 3002 | (copy-file from-name to-name nil t) |
| 2999 | nil) | 3003 | nil) |
| 3000 | (file-already-exists t)) | 3004 | (file-already-exists t)) |
| 3001 | ;; The file was somehow created by someone else between | 3005 | ;; The file was somehow created by someone else between |
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 1e5bfa23ed3..71aa3654da6 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,86 @@ | |||
| 1 | 2006-06-06 Katsumi Yamaoka <yamaoka@jpl.org> | ||
| 2 | |||
| 3 | * mm-util.el (mm-mime-mule-charset-alist): Use unicode-precedence-list | ||
| 4 | to fill the utf-8 entry. | ||
| 5 | |||
| 6 | 2006-06-05 Dan Christensen <jdc@uwo.ca> | ||
| 7 | |||
| 8 | * gnus-sum.el (gnus-summary-read-group-1): When summary is unthreaded, | ||
| 9 | respect display group parameter and gnus-summary-expunge-below. | ||
| 10 | (gnus-articles-to-read): Remove unused reference to display group | ||
| 11 | parameter. | ||
| 12 | [ Merge 2004-07-06 change from the trunk. ] | ||
| 13 | |||
| 14 | 2006-05-29 Reiner Steib <Reiner.Steib@gmx.de> | ||
| 15 | |||
| 16 | * gnus-ml.el (gnus-mailing-list-subscribe) | ||
| 17 | (gnus-mailing-list-unsubscribe, gnus-mailing-list-owner) | ||
| 18 | (gnus-mailing-list-message): Fix doc strings. | ||
| 19 | |||
| 20 | 2006-05-29 Andreas Seltenreich <uwi7@rz.uni-karlsruhe.de> | ||
| 21 | |||
| 22 | * gnus-ml.el (gnus-mailing-list-message): Use gnus-url-mailto instead | ||
| 23 | of doing it manually. | ||
| 24 | |||
| 25 | 2006-05-29 Kevin Greiner <kevin.greiner@compsol.cc> | ||
| 26 | |||
| 27 | * gnus-agent.el (gnus-agent-possibly-synchronize-flags): A server | ||
| 28 | must be explicitly online rather than "not explicitly offline" for | ||
| 29 | its flags to be synchronized. | ||
| 30 | (gnus-agent-read-local): All symbols allocated in my-obarray | ||
| 31 | (gnus-agent-set-local): Skip invalid entries (min and/or max is nil). | ||
| 32 | (gnus-agent-regenerate-group): Check numeric names to see if they are | ||
| 33 | messages or groups. | ||
| 34 | |||
| 35 | 2006-05-29 Katsumi Yamaoka <yamaoka@jpl.org> | ||
| 36 | |||
| 37 | * gnus-art.el (gnus-save-all-headers): Mention it might be overridden. | ||
| 38 | (gnus-saved-headers): Ditto. | ||
| 39 | (gnus-default-article-saver): Doc fix; add | ||
| 40 | gnus-summary-write-body-to-file; mention functions may have properties. | ||
| 41 | (gnus-article-save-coding-system): New variable. | ||
| 42 | (gnus-article-save): Override gnus-save-all-headers and | ||
| 43 | gnus-saved-headers by :headers property which saver function may have. | ||
| 44 | (gnus-read-save-file-name): Add optional `dir-var' argument which | ||
| 45 | specifies directory in which files are saved; work even if optional | ||
| 46 | `variable' argument is not specified. | ||
| 47 | (gnus-summary-save-in-file): Add properties :decode and :headers. | ||
| 48 | (gnus-summary-write-to-file): Add properties :decode, :function, and | ||
| 49 | :headers; read file name. | ||
| 50 | (gnus-summary-save-body-in-file): Add :decode property; add optional | ||
| 51 | `overwrite' argument. | ||
| 52 | (gnus-summary-write-body-to-file): New function; add properties | ||
| 53 | :decode and :function. | ||
| 54 | (gnus-output-to-file): Add coding cookie and encode text according | ||
| 55 | to gnus-article-save-coding-system; don't use mm-append-to-file. | ||
| 56 | |||
| 57 | * gnus-sum.el (gnus-newsgroup-last-directory): New variable. | ||
| 58 | (gnus-summary-local-variables): Add it. | ||
| 59 | (gnus-summary-save-map): Add gnus-summary-write-article-body-file. | ||
| 60 | (gnus-summary-save-article): Require gnus-art; save decoded articles | ||
| 61 | if function that gnus-default-article-saver specifies has `:decode' | ||
| 62 | property; bind gnus-prompt-before-saving to t when saving many | ||
| 63 | articles in a file; move point to article which will be saved. | ||
| 64 | (gnus-summary-write-article-body-file): New function. | ||
| 65 | |||
| 66 | 2006-05-26 Reiner Steib <Reiner.Steib@gmx.de> | ||
| 67 | |||
| 68 | * uudecode.el (uudecode-decode-region-external): Fix previous commit. | ||
| 69 | |||
| 70 | 2006-05-26 Katsumi Yamaoka <yamaoka@jpl.org> | ||
| 71 | |||
| 72 | * mm-util.el (mm-enrich-utf-8-by-mule-ucs): Don't edit | ||
| 73 | after-load-alist. | ||
| 74 | |||
| 75 | 2006-05-22 Reiner Steib <Reiner.Steib@gmx.de> | ||
| 76 | |||
| 77 | * uudecode.el (uudecode-decode-region-external): nil isn't a valid | ||
| 78 | coding system in XEmacs, use binary. | ||
| 79 | |||
| 80 | * mail-source.el (mail-sources): Fix custom type. | ||
| 81 | |||
| 82 | * imap.el (Commentary): Fix typo. | ||
| 83 | |||
| 1 | 2006-05-18 Reiner Steib <Reiner.Steib@gmx.de> | 84 | 2006-05-18 Reiner Steib <Reiner.Steib@gmx.de> |
| 2 | 85 | ||
| 3 | * gnus-sum.el (gnus-summary-save-article-mail): Clarify doc string. | 86 | * gnus-sum.el (gnus-summary-save-article-mail): Clarify doc string. |
| @@ -2875,7 +2958,7 @@ | |||
| 2875 | article buffer with a draft file. This is a temporary measure | 2958 | article buffer with a draft file. This is a temporary measure |
| 2876 | against the 2004-08-22 change to gnus-article-edit-mode. | 2959 | against the 2004-08-22 change to gnus-article-edit-mode. |
| 2877 | 2960 | ||
| 2878 | 2004-11-02 From Ilya N. Golubev <gin@mo.msk.ru>. | 2961 | 2004-11-02 Ilya N. Golubev <gin@mo.msk.ru>. |
| 2879 | 2962 | ||
| 2880 | * mm-util.el (mm-mime-mule-charset-alist): Add the windows-1251 | 2963 | * mm-util.el (mm-mime-mule-charset-alist): Add the windows-1251 |
| 2881 | entry. | 2964 | entry. |
| @@ -3735,7 +3818,7 @@ | |||
| 3735 | * flow-fill.el (fill-flowed-display-column) | 3818 | * flow-fill.el (fill-flowed-display-column) |
| 3736 | (fill-flowed-encode-column): Ditto. | 3819 | (fill-flowed-encode-column): Ditto. |
| 3737 | 3820 | ||
| 3738 | 2004-09-06 Stefan <monnier@iro.umontreal.ca> | 3821 | 2004-09-06 Stefan Monnier <monnier@iro.umontreal.ca> |
| 3739 | 3822 | ||
| 3740 | * message.el (message-tokenize-header, message-send-mail-with-qmail): | 3823 | * message.el (message-tokenize-header, message-send-mail-with-qmail): |
| 3741 | Use point-min rather than 1. | 3824 | Use point-min rather than 1. |
diff --git a/lisp/gnus/ChangeLog.1 b/lisp/gnus/ChangeLog.1 index bb4da4dbcad..f917d0cbf73 100644 --- a/lisp/gnus/ChangeLog.1 +++ b/lisp/gnus/ChangeLog.1 | |||
| @@ -2437,7 +2437,7 @@ | |||
| 2437 | * gnus-topic.el (gnus-topic-rename): Check whether the new name | 2437 | * gnus-topic.el (gnus-topic-rename): Check whether the new name |
| 2438 | exists. | 2438 | exists. |
| 2439 | 2439 | ||
| 2440 | 1998-02-10 dave edmondson <dme@sco.com> | 2440 | 1998-02-10 David Edmondson <dme@sco.com> |
| 2441 | 2441 | ||
| 2442 | * message.el (message-font-lock-keywords): Allow : as a citation | 2442 | * message.el (message-font-lock-keywords): Allow : as a citation |
| 2443 | ending. | 2443 | ending. |
diff --git a/lisp/gnus/gnus-agent.el b/lisp/gnus/gnus-agent.el index 123ad340ae1..f4e9f2e3dc9 100644 --- a/lisp/gnus/gnus-agent.el +++ b/lisp/gnus/gnus-agent.el | |||
| @@ -825,7 +825,7 @@ be a select method." | |||
| 825 | (save-excursion | 825 | (save-excursion |
| 826 | (dolist (gnus-command-method (gnus-agent-covered-methods)) | 826 | (dolist (gnus-command-method (gnus-agent-covered-methods)) |
| 827 | (when (and (file-exists-p (gnus-agent-lib-file "flags")) | 827 | (when (and (file-exists-p (gnus-agent-lib-file "flags")) |
| 828 | (not (eq (gnus-server-status gnus-command-method) 'offline))) | 828 | (eq (gnus-server-status gnus-command-method) 'ok)) |
| 829 | (gnus-agent-possibly-synchronize-flags-server gnus-command-method))))) | 829 | (gnus-agent-possibly-synchronize-flags-server gnus-command-method))))) |
| 830 | 830 | ||
| 831 | (defun gnus-agent-synchronize-flags-server (method) | 831 | (defun gnus-agent-synchronize-flags-server (method) |
| @@ -2133,7 +2133,8 @@ modified) original contents, they are first saved to their own file." | |||
| 2133 | (let (group | 2133 | (let (group |
| 2134 | min | 2134 | min |
| 2135 | max | 2135 | max |
| 2136 | (cur (current-buffer))) | 2136 | (cur (current-buffer)) |
| 2137 | (obarray my-obarray)) | ||
| 2137 | (setq group (read cur) | 2138 | (setq group (read cur) |
| 2138 | min (read cur) | 2139 | min (read cur) |
| 2139 | max (read cur)) | 2140 | max (read cur)) |
| @@ -2214,7 +2215,9 @@ modified) original contents, they are first saved to their own file." | |||
| 2214 | 2215 | ||
| 2215 | (if (cond ((and minmax | 2216 | (if (cond ((and minmax |
| 2216 | (or (not (eq min (car minmax))) | 2217 | (or (not (eq min (car minmax))) |
| 2217 | (not (eq max (cdr minmax))))) | 2218 | (not (eq max (cdr minmax)))) |
| 2219 | min | ||
| 2220 | max) | ||
| 2218 | (setcar minmax min) | 2221 | (setcar minmax min) |
| 2219 | (setcdr minmax max) | 2222 | (setcdr minmax max) |
| 2220 | t) | 2223 | t) |
| @@ -3743,8 +3746,10 @@ If REREAD is not nil, downloaded articles are marked as unread." | |||
| 3743 | (dir (file-name-directory file)) | 3746 | (dir (file-name-directory file)) |
| 3744 | point | 3747 | point |
| 3745 | (downloaded (if (file-exists-p dir) | 3748 | (downloaded (if (file-exists-p dir) |
| 3746 | (sort (mapcar (lambda (name) (string-to-number name)) | 3749 | (sort (delq nil (mapcar (lambda (name) |
| 3747 | (directory-files dir nil "^[0-9]+$" t)) | 3750 | (and (not (file-directory-p (nnheader-concat dir name))) |
| 3751 | (string-to-number name))) | ||
| 3752 | (directory-files dir nil "^[0-9]+$" t))) | ||
| 3748 | '>) | 3753 | '>) |
| 3749 | (progn (gnus-make-directory dir) nil))) | 3754 | (progn (gnus-make-directory dir) nil))) |
| 3750 | dl nov-arts | 3755 | dl nov-arts |
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index 208103f805d..4722e98ef19 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el | |||
| @@ -492,7 +492,10 @@ be fed to `format-time-string'." | |||
| 492 | :group 'gnus-article-washing) | 492 | :group 'gnus-article-washing) |
| 493 | 493 | ||
| 494 | (defcustom gnus-save-all-headers t | 494 | (defcustom gnus-save-all-headers t |
| 495 | "*If non-nil, don't remove any headers before saving." | 495 | "*If non-nil, don't remove any headers before saving. |
| 496 | This will be overridden by the `:headers' property that the symbol of | ||
| 497 | the saver function, which is specified by `gnus-default-article-saver', | ||
| 498 | might have." | ||
| 496 | :group 'gnus-article-saving | 499 | :group 'gnus-article-saving |
| 497 | :type 'boolean) | 500 | :type 'boolean) |
| 498 | 501 | ||
| @@ -513,14 +516,17 @@ each invocation of the saving commands." | |||
| 513 | "Headers to keep if `gnus-save-all-headers' is nil. | 516 | "Headers to keep if `gnus-save-all-headers' is nil. |
| 514 | If `gnus-save-all-headers' is non-nil, this variable will be ignored. | 517 | If `gnus-save-all-headers' is non-nil, this variable will be ignored. |
| 515 | If that variable is nil, however, all headers that match this regexp | 518 | If that variable is nil, however, all headers that match this regexp |
| 516 | will be kept while the rest will be deleted before saving." | 519 | will be kept while the rest will be deleted before saving. This and |
| 520 | `gnus-save-all-headers' will be overridden by the `:headers' property | ||
| 521 | that the symbol of the saver function, which is specified by | ||
| 522 | `gnus-default-article-saver', might have." | ||
| 517 | :group 'gnus-article-saving | 523 | :group 'gnus-article-saving |
| 518 | :type 'regexp) | 524 | :type 'regexp) |
| 519 | 525 | ||
| 520 | (defcustom gnus-default-article-saver 'gnus-summary-save-in-rmail | 526 | (defcustom gnus-default-article-saver 'gnus-summary-save-in-rmail |
| 521 | "A function to save articles in your favourite format. | 527 | "A function to save articles in your favourite format. |
| 522 | The function must be interactively callable (in other words, it must | 528 | The function will be called by way of the `gnus-summary-save-article' |
| 523 | be an Emacs command). | 529 | command, and friends such as `gnus-summary-save-article-rmail'. |
| 524 | 530 | ||
| 525 | Gnus provides the following functions: | 531 | Gnus provides the following functions: |
| 526 | 532 | ||
| @@ -530,7 +536,28 @@ Gnus provides the following functions: | |||
| 530 | * gnus-summary-save-in-file (article format) | 536 | * gnus-summary-save-in-file (article format) |
| 531 | * gnus-summary-save-body-in-file (article body) | 537 | * gnus-summary-save-body-in-file (article body) |
| 532 | * gnus-summary-save-in-vm (use VM's folder format) | 538 | * gnus-summary-save-in-vm (use VM's folder format) |
| 533 | * gnus-summary-write-to-file (article format -- overwrite)." | 539 | * gnus-summary-write-to-file (article format -- overwrite) |
| 540 | * gnus-summary-write-body-to-file (article body -- overwrite) | ||
| 541 | |||
| 542 | The symbol of each function may have the following properties: | ||
| 543 | |||
| 544 | * :decode | ||
| 545 | The value non-nil means save decoded articles. This is meaningful | ||
| 546 | only with `gnus-summary-save-in-file', `gnus-summary-save-body-in-file', | ||
| 547 | `gnus-summary-write-to-file', and `gnus-summary-write-body-to-file'. | ||
| 548 | |||
| 549 | * :function | ||
| 550 | The value specifies an alternative function which appends, not | ||
| 551 | overwrites, articles to a file. This implies that when saving many | ||
| 552 | articles at a time, `gnus-prompt-before-saving' is bound to t and all | ||
| 553 | articles are saved in a single file. This is meaningful only with | ||
| 554 | `gnus-summary-write-to-file' and `gnus-summary-write-body-to-file'. | ||
| 555 | |||
| 556 | * :headers | ||
| 557 | The value specifies the symbol of a variable of which the value | ||
| 558 | specifies headers to be saved. If it is omitted, | ||
| 559 | `gnus-save-all-headers' and `gnus-saved-headers' control what | ||
| 560 | headers should be saved." | ||
| 534 | :group 'gnus-article-saving | 561 | :group 'gnus-article-saving |
| 535 | :type '(radio (function-item gnus-summary-save-in-rmail) | 562 | :type '(radio (function-item gnus-summary-save-in-rmail) |
| 536 | (function-item gnus-summary-save-in-mail) | 563 | (function-item gnus-summary-save-in-mail) |
| @@ -539,8 +566,49 @@ Gnus provides the following functions: | |||
| 539 | (function-item gnus-summary-save-body-in-file) | 566 | (function-item gnus-summary-save-body-in-file) |
| 540 | (function-item gnus-summary-save-in-vm) | 567 | (function-item gnus-summary-save-in-vm) |
| 541 | (function-item gnus-summary-write-to-file) | 568 | (function-item gnus-summary-write-to-file) |
| 569 | (function-item gnus-summary-write-body-to-file) | ||
| 542 | (function))) | 570 | (function))) |
| 543 | 571 | ||
| 572 | (defcustom gnus-article-save-coding-system | ||
| 573 | (or (and (mm-coding-system-p 'utf-8) 'utf-8) | ||
| 574 | (and (mm-coding-system-p 'iso-2022-7bit) 'iso-2022-7bit) | ||
| 575 | (and (mm-coding-system-p 'emacs-mule) 'emacs-mule) | ||
| 576 | (and (mm-coding-system-p 'escape-quoted) 'escape-quoted)) | ||
| 577 | "Coding system used to save decoded articles to a file. | ||
| 578 | |||
| 579 | The recommended coding systems are `utf-8', `iso-2022-7bit' and so on, | ||
| 580 | which can safely encode any characters in text. This is used by the | ||
| 581 | commands including: | ||
| 582 | |||
| 583 | * gnus-summary-save-article-file | ||
| 584 | * gnus-summary-save-article-body-file | ||
| 585 | * gnus-summary-write-article-file | ||
| 586 | * gnus-summary-write-article-body-file | ||
| 587 | |||
| 588 | and the functions to which you may set `gnus-default-article-saver': | ||
| 589 | |||
| 590 | * gnus-summary-save-in-file | ||
| 591 | * gnus-summary-save-body-in-file | ||
| 592 | * gnus-summary-write-to-file | ||
| 593 | * gnus-summary-write-body-to-file | ||
| 594 | |||
| 595 | Those commands and functions save just text displayed in the article | ||
| 596 | buffer to a file if the value of this variable is non-nil. Note that | ||
| 597 | buttonized MIME parts will be lost in a saved file in that case. | ||
| 598 | Otherwise, raw articles will be saved." | ||
| 599 | :group 'gnus-article-saving | ||
| 600 | :type `(choice | ||
| 601 | :format "%{%t%}:\n %[Value Menu%] %v" | ||
| 602 | (const :tag "Save raw articles" nil) | ||
| 603 | ,@(delq nil | ||
| 604 | (mapcar | ||
| 605 | (lambda (arg) (if (mm-coding-system-p (nth 3 arg)) arg)) | ||
| 606 | '((const :tag "UTF-8" utf-8) | ||
| 607 | (const :tag "iso-2022-7bit" iso-2022-7bit) | ||
| 608 | (const :tag "Emacs internal" emacs-mule) | ||
| 609 | (const :tag "escape-quoted" escape-quoted)))) | ||
| 610 | (symbol :tag "Coding system"))) | ||
| 611 | |||
| 544 | (defcustom gnus-rmail-save-name 'gnus-plain-save-name | 612 | (defcustom gnus-rmail-save-name 'gnus-plain-save-name |
| 545 | "A function generating a file name to save articles in Rmail format. | 613 | "A function generating a file name to save articles in Rmail format. |
| 546 | The function is called with NEWSGROUP, HEADERS, and optional LAST-FILE." | 614 | The function is called with NEWSGROUP, HEADERS, and optional LAST-FILE." |
| @@ -3249,10 +3317,13 @@ This format is defined by the `gnus-article-time-format' variable." | |||
| 3249 | 3317 | ||
| 3250 | (defun gnus-article-save (save-buffer file &optional num) | 3318 | (defun gnus-article-save (save-buffer file &optional num) |
| 3251 | "Save the currently selected article." | 3319 | "Save the currently selected article." |
| 3252 | (unless gnus-save-all-headers | 3320 | (when (or (get gnus-default-article-saver :headers) |
| 3253 | ;; Remove headers according to `gnus-saved-headers'. | 3321 | (not gnus-save-all-headers)) |
| 3322 | ;; Remove headers according to `gnus-saved-headers' or the value | ||
| 3323 | ;; of the `:headers' property that the saver function might have. | ||
| 3254 | (let ((gnus-visible-headers | 3324 | (let ((gnus-visible-headers |
| 3255 | (or gnus-saved-headers gnus-visible-headers)) | 3325 | (or (symbol-value (get gnus-default-article-saver :headers)) |
| 3326 | gnus-saved-headers gnus-visible-headers)) | ||
| 3256 | (gnus-article-buffer save-buffer)) | 3327 | (gnus-article-buffer save-buffer)) |
| 3257 | (save-excursion | 3328 | (save-excursion |
| 3258 | (set-buffer save-buffer) | 3329 | (set-buffer save-buffer) |
| @@ -3277,7 +3348,8 @@ This format is defined by the `gnus-article-time-format' variable." | |||
| 3277 | (funcall gnus-default-article-saver filename))))) | 3348 | (funcall gnus-default-article-saver filename))))) |
| 3278 | 3349 | ||
| 3279 | (defun gnus-read-save-file-name (prompt &optional filename | 3350 | (defun gnus-read-save-file-name (prompt &optional filename |
| 3280 | function group headers variable) | 3351 | function group headers variable |
| 3352 | dir-var) | ||
| 3281 | (let ((default-name | 3353 | (let ((default-name |
| 3282 | (funcall function group headers (symbol-value variable))) | 3354 | (funcall function group headers (symbol-value variable))) |
| 3283 | result) | 3355 | result) |
| @@ -3290,6 +3362,10 @@ This format is defined by the `gnus-article-time-format' variable." | |||
| 3290 | default-name) | 3362 | default-name) |
| 3291 | (filename filename) | 3363 | (filename filename) |
| 3292 | (t | 3364 | (t |
| 3365 | (when (symbol-value dir-var) | ||
| 3366 | (setq default-name (expand-file-name | ||
| 3367 | (file-name-nondirectory default-name) | ||
| 3368 | (symbol-value dir-var)))) | ||
| 3293 | (let* ((split-name (gnus-get-split-value gnus-split-methods)) | 3369 | (let* ((split-name (gnus-get-split-value gnus-split-methods)) |
| 3294 | (prompt | 3370 | (prompt |
| 3295 | (format prompt | 3371 | (format prompt |
| @@ -3354,7 +3430,11 @@ This format is defined by the `gnus-article-time-format' variable." | |||
| 3354 | ;; Possibly translate some characters. | 3430 | ;; Possibly translate some characters. |
| 3355 | (nnheader-translate-file-chars file)))))) | 3431 | (nnheader-translate-file-chars file)))))) |
| 3356 | (gnus-make-directory (file-name-directory result)) | 3432 | (gnus-make-directory (file-name-directory result)) |
| 3357 | (set variable result))) | 3433 | (when variable |
| 3434 | (set variable result)) | ||
| 3435 | (when dir-var | ||
| 3436 | (set dir-var (file-name-directory result))) | ||
| 3437 | result)) | ||
| 3358 | 3438 | ||
| 3359 | (defun gnus-article-archive-name (group) | 3439 | (defun gnus-article-archive-name (group) |
| 3360 | "Return the first instance of an \"Archive-name\" in the current buffer." | 3440 | "Return the first instance of an \"Archive-name\" in the current buffer." |
| @@ -3402,6 +3482,8 @@ Directory to save to is default to `gnus-article-save-directory'." | |||
| 3402 | (gnus-output-to-mail filename))))) | 3482 | (gnus-output-to-mail filename))))) |
| 3403 | filename) | 3483 | filename) |
| 3404 | 3484 | ||
| 3485 | (put 'gnus-summary-save-in-file :decode t) | ||
| 3486 | (put 'gnus-summary-save-in-file :headers 'gnus-saved-headers) | ||
| 3405 | (defun gnus-summary-save-in-file (&optional filename overwrite) | 3487 | (defun gnus-summary-save-in-file (&optional filename overwrite) |
| 3406 | "Append this article to file. | 3488 | "Append this article to file. |
| 3407 | Optional argument FILENAME specifies file name. | 3489 | Optional argument FILENAME specifies file name. |
| @@ -3420,13 +3502,21 @@ Directory to save to is default to `gnus-article-save-directory'." | |||
| 3420 | (gnus-output-to-file filename)))) | 3502 | (gnus-output-to-file filename)))) |
| 3421 | filename) | 3503 | filename) |
| 3422 | 3504 | ||
| 3505 | (put 'gnus-summary-write-to-file :decode t) | ||
| 3506 | (put 'gnus-summary-write-to-file :function 'gnus-summary-save-in-file) | ||
| 3507 | (put 'gnus-summary-write-to-file :headers 'gnus-saved-headers) | ||
| 3423 | (defun gnus-summary-write-to-file (&optional filename) | 3508 | (defun gnus-summary-write-to-file (&optional filename) |
| 3424 | "Write this article to a file, overwriting it if the file exists. | 3509 | "Write this article to a file, overwriting it if the file exists. |
| 3425 | Optional argument FILENAME specifies file name. | 3510 | Optional argument FILENAME specifies file name. |
| 3426 | The directory to save in defaults to `gnus-article-save-directory'." | 3511 | The directory to save in defaults to `gnus-article-save-directory'." |
| 3427 | (gnus-summary-save-in-file nil t)) | 3512 | (setq filename (gnus-read-save-file-name |
| 3513 | "Save %s in file" filename | ||
| 3514 | gnus-file-save-name gnus-newsgroup-name | ||
| 3515 | gnus-current-headers nil 'gnus-newsgroup-last-directory)) | ||
| 3516 | (gnus-summary-save-in-file filename t)) | ||
| 3428 | 3517 | ||
| 3429 | (defun gnus-summary-save-body-in-file (&optional filename) | 3518 | (put 'gnus-summary-save-body-in-file :decode t) |
| 3519 | (defun gnus-summary-save-body-in-file (&optional filename overwrite) | ||
| 3430 | "Append this article body to a file. | 3520 | "Append this article body to a file. |
| 3431 | Optional argument FILENAME specifies file name. | 3521 | Optional argument FILENAME specifies file name. |
| 3432 | The directory to save in defaults to `gnus-article-save-directory'." | 3522 | The directory to save in defaults to `gnus-article-save-directory'." |
| @@ -3440,9 +3530,25 @@ The directory to save in defaults to `gnus-article-save-directory'." | |||
| 3440 | (widen) | 3530 | (widen) |
| 3441 | (when (article-goto-body) | 3531 | (when (article-goto-body) |
| 3442 | (narrow-to-region (point) (point-max))) | 3532 | (narrow-to-region (point) (point-max))) |
| 3533 | (when (and overwrite | ||
| 3534 | (file-exists-p filename)) | ||
| 3535 | (delete-file filename)) | ||
| 3443 | (gnus-output-to-file filename)))) | 3536 | (gnus-output-to-file filename)))) |
| 3444 | filename) | 3537 | filename) |
| 3445 | 3538 | ||
| 3539 | (put 'gnus-summary-write-body-to-file :decode t) | ||
| 3540 | (put 'gnus-summary-write-body-to-file | ||
| 3541 | :function 'gnus-summary-save-body-in-file) | ||
| 3542 | (defun gnus-summary-write-body-to-file (&optional filename) | ||
| 3543 | "Write this article body to a file, overwriting it if the file exists. | ||
| 3544 | Optional argument FILENAME specifies file name. | ||
| 3545 | The directory to save in defaults to `gnus-article-save-directory'." | ||
| 3546 | (setq filename (gnus-read-save-file-name | ||
| 3547 | "Save %s body in file" filename | ||
| 3548 | gnus-file-save-name gnus-newsgroup-name | ||
| 3549 | gnus-current-headers nil 'gnus-newsgroup-last-directory)) | ||
| 3550 | (gnus-summary-save-body-in-file filename t)) | ||
| 3551 | |||
| 3446 | (defun gnus-summary-save-in-pipe (&optional command) | 3552 | (defun gnus-summary-save-in-pipe (&optional command) |
| 3447 | "Pipe this article to subprocess." | 3553 | "Pipe this article to subprocess." |
| 3448 | (setq command | 3554 | (setq command |
| @@ -5182,17 +5288,55 @@ Provided for backwards compatibility." | |||
| 5182 | ;;; Article savers. | 5288 | ;;; Article savers. |
| 5183 | 5289 | ||
| 5184 | (defun gnus-output-to-file (file-name) | 5290 | (defun gnus-output-to-file (file-name) |
| 5185 | "Append the current article to a file named FILE-NAME." | 5291 | "Append the current article to a file named FILE-NAME. |
| 5186 | (let ((artbuf (current-buffer))) | 5292 | If `gnus-article-save-coding-system' is non-nil, it is used to encode |
| 5293 | text and used as the value of the coding cookie which is added to the | ||
| 5294 | top of a file. Otherwise, this function saves a raw article without | ||
| 5295 | the coding cookie." | ||
| 5296 | (let* ((artbuf (current-buffer)) | ||
| 5297 | (file-name-coding-system nnmail-pathname-coding-system) | ||
| 5298 | (coding gnus-article-save-coding-system) | ||
| 5299 | (coding-system-for-read (if coding | ||
| 5300 | nil ;; Rely on the coding cookie. | ||
| 5301 | mm-text-coding-system)) | ||
| 5302 | (coding-system-for-write (or coding | ||
| 5303 | mm-text-coding-system-for-write | ||
| 5304 | mm-text-coding-system)) | ||
| 5305 | (exists (file-exists-p file-name))) | ||
| 5187 | (with-temp-buffer | 5306 | (with-temp-buffer |
| 5307 | (when exists | ||
| 5308 | (insert-file-contents file-name) | ||
| 5309 | (goto-char (point-min)) | ||
| 5310 | ;; Remove the existing coding cookie. | ||
| 5311 | (when (looking-at "X-Gnus-Coding-System: .+\n\n") | ||
| 5312 | (delete-region (match-beginning 0) (match-end 0)))) | ||
| 5313 | (goto-char (point-max)) | ||
| 5188 | (insert-buffer-substring artbuf) | 5314 | (insert-buffer-substring artbuf) |
| 5189 | ;; Append newline at end of the buffer as separator, and then | 5315 | ;; Append newline at end of the buffer as separator, and then |
| 5190 | ;; save it to file. | 5316 | ;; save it to file. |
| 5191 | (goto-char (point-max)) | 5317 | (goto-char (point-max)) |
| 5192 | (insert "\n") | 5318 | (insert "\n") |
| 5193 | (let ((file-name-coding-system nnmail-pathname-coding-system)) | 5319 | (when coding |
| 5194 | (mm-append-to-file (point-min) (point-max) file-name)) | 5320 | ;; If the coding system is not suitable to encode the text, |
| 5195 | t))) | 5321 | ;; ask a user for a proper one. |
| 5322 | (when (fboundp 'select-safe-coding-system) | ||
| 5323 | (setq coding (coding-system-base | ||
| 5324 | (save-window-excursion | ||
| 5325 | (select-safe-coding-system (point-min) (point-max) | ||
| 5326 | coding)))) | ||
| 5327 | (setq coding-system-for-write | ||
| 5328 | (or (cdr (assq coding '((mule-utf-8 . utf-8)))) | ||
| 5329 | coding))) | ||
| 5330 | (goto-char (point-min)) | ||
| 5331 | ;; Add the coding cookie. | ||
| 5332 | (insert (format "X-Gnus-Coding-System: -*- coding: %s; -*-\n\n" | ||
| 5333 | coding-system-for-write))) | ||
| 5334 | (if exists | ||
| 5335 | (progn | ||
| 5336 | (write-region (point-min) (point-max) file-name nil 'no-message) | ||
| 5337 | (message "Appended to %s" file-name)) | ||
| 5338 | (write-region (point-min) (point-max) file-name)))) | ||
| 5339 | t) | ||
| 5196 | 5340 | ||
| 5197 | (defun gnus-narrow-to-page (&optional arg) | 5341 | (defun gnus-narrow-to-page (&optional arg) |
| 5198 | "Narrow the article buffer to a page. | 5342 | "Narrow the article buffer to a page. |
diff --git a/lisp/gnus/gnus-ml.el b/lisp/gnus/gnus-ml.el index cde039d03c0..8d475f968d7 100644 --- a/lisp/gnus/gnus-ml.el +++ b/lisp/gnus/gnus-ml.el | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | ;; 2005, 2006 Free Software Foundation, Inc. | 4 | ;; 2005, 2006 Free Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | ;; Author: Julien Gilles <jgilles@free.fr> | 6 | ;; Author: Julien Gilles <jgilles@free.fr> |
| 7 | ;; Keywords: news | 7 | ;; Keywords: news, mail |
| 8 | 8 | ||
| 9 | ;; This file is part of GNU Emacs. | 9 | ;; This file is part of GNU Emacs. |
| 10 | 10 | ||
| @@ -51,8 +51,7 @@ | |||
| 51 | "\C-c\C-nu" gnus-mailing-list-unsubscribe | 51 | "\C-c\C-nu" gnus-mailing-list-unsubscribe |
| 52 | "\C-c\C-np" gnus-mailing-list-post | 52 | "\C-c\C-np" gnus-mailing-list-post |
| 53 | "\C-c\C-no" gnus-mailing-list-owner | 53 | "\C-c\C-no" gnus-mailing-list-owner |
| 54 | "\C-c\C-na" gnus-mailing-list-archive | 54 | "\C-c\C-na" gnus-mailing-list-archive)) |
| 55 | )) | ||
| 56 | 55 | ||
| 57 | (defun gnus-mailing-list-make-menu-bar () | 56 | (defun gnus-mailing-list-make-menu-bar () |
| 58 | (unless (boundp 'gnus-mailing-list-menu) | 57 | (unless (boundp 'gnus-mailing-list-menu) |
| @@ -103,7 +102,8 @@ If FORCE is non-nil, replace the old ones." | |||
| 103 | ;; Set up the menu. | 102 | ;; Set up the menu. |
| 104 | (when (gnus-visual-p 'mailing-list-menu 'menu) | 103 | (when (gnus-visual-p 'mailing-list-menu 'menu) |
| 105 | (gnus-mailing-list-make-menu-bar)) | 104 | (gnus-mailing-list-make-menu-bar)) |
| 106 | (gnus-add-minor-mode 'gnus-mailing-list-mode " Mailing-List" gnus-mailing-list-mode-map) | 105 | (gnus-add-minor-mode 'gnus-mailing-list-mode " Mailing-List" |
| 106 | gnus-mailing-list-mode-map) | ||
| 107 | (gnus-run-hooks 'gnus-mailing-list-mode-hook)))) | 107 | (gnus-run-hooks 'gnus-mailing-list-mode-hook)))) |
| 108 | 108 | ||
| 109 | ;;; Commands | 109 | ;;; Commands |
| @@ -118,7 +118,7 @@ If FORCE is non-nil, replace the old ones." | |||
| 118 | (t (gnus-message 1 "no list-help in this group"))))) | 118 | (t (gnus-message 1 "no list-help in this group"))))) |
| 119 | 119 | ||
| 120 | (defun gnus-mailing-list-subscribe () | 120 | (defun gnus-mailing-list-subscribe () |
| 121 | "Subscribe" | 121 | "Subscribe to mailing list." |
| 122 | (interactive) | 122 | (interactive) |
| 123 | (let ((list-subscribe | 123 | (let ((list-subscribe |
| 124 | (with-current-buffer gnus-original-article-buffer | 124 | (with-current-buffer gnus-original-article-buffer |
| @@ -127,7 +127,7 @@ If FORCE is non-nil, replace the old ones." | |||
| 127 | (t (gnus-message 1 "no list-subscribe in this group"))))) | 127 | (t (gnus-message 1 "no list-subscribe in this group"))))) |
| 128 | 128 | ||
| 129 | (defun gnus-mailing-list-unsubscribe () | 129 | (defun gnus-mailing-list-unsubscribe () |
| 130 | "Unsubscribe" | 130 | "Unsubscribe from mailing list." |
| 131 | (interactive) | 131 | (interactive) |
| 132 | (let ((list-unsubscribe | 132 | (let ((list-unsubscribe |
| 133 | (with-current-buffer gnus-original-article-buffer | 133 | (with-current-buffer gnus-original-article-buffer |
| @@ -145,7 +145,7 @@ If FORCE is non-nil, replace the old ones." | |||
| 145 | (t (gnus-message 1 "no list-post in this group"))))) | 145 | (t (gnus-message 1 "no list-post in this group"))))) |
| 146 | 146 | ||
| 147 | (defun gnus-mailing-list-owner () | 147 | (defun gnus-mailing-list-owner () |
| 148 | "Mail to the owner" | 148 | "Mail to the mailing list owner." |
| 149 | (interactive) | 149 | (interactive) |
| 150 | (let ((list-owner | 150 | (let ((list-owner |
| 151 | (with-current-buffer gnus-original-article-buffer | 151 | (with-current-buffer gnus-original-article-buffer |
| @@ -154,7 +154,7 @@ If FORCE is non-nil, replace the old ones." | |||
| 154 | (t (gnus-message 1 "no list-owner in this group"))))) | 154 | (t (gnus-message 1 "no list-owner in this group"))))) |
| 155 | 155 | ||
| 156 | (defun gnus-mailing-list-archive () | 156 | (defun gnus-mailing-list-archive () |
| 157 | "Browse archive" | 157 | "Browse archive." |
| 158 | (interactive) | 158 | (interactive) |
| 159 | (require 'browse-url) | 159 | (require 'browse-url) |
| 160 | (let ((list-archive | 160 | (let ((list-archive |
| @@ -169,33 +169,14 @@ If FORCE is non-nil, replace the old ones." | |||
| 169 | ;;; Utility functions | 169 | ;;; Utility functions |
| 170 | 170 | ||
| 171 | (defun gnus-mailing-list-message (address) | 171 | (defun gnus-mailing-list-message (address) |
| 172 | "" | 172 | "Send message to ADDRESS. |
| 173 | (let ((mailto "") | 173 | ADDRESS is specified by a \"mailto:\" URL." |
| 174 | (to ()) | 174 | (cond |
| 175 | (subject "None") | 175 | ((string-match "<\\(mailto:[^>]*\\)>" address) |
| 176 | (body "") | 176 | (require 'gnus-art) |
| 177 | ) | 177 | (gnus-url-mailto (match-string 1 address))) |
| 178 | (cond | 178 | ;; other case <http://...> to be done. |
| 179 | ((string-match "<mailto:\\([^>]*\\)>" address) | 179 | (t nil))) |
| 180 | (let ((args (match-string 1 address))) | ||
| 181 | (cond ; with param | ||
| 182 | ((string-match "\\(.*\\)\\?\\(.*\\)" args) | ||
| 183 | (setq mailto (match-string 1 args)) | ||
| 184 | (let ((param (match-string 2 args))) | ||
| 185 | (if (string-match "subject=\\([^&]*\\)" param) | ||
| 186 | (setq subject (match-string 1 param))) | ||
| 187 | (if (string-match "body=\\([^&]*\\)" param) | ||
| 188 | (setq body (match-string 1 param))) | ||
| 189 | (if (string-match "to=\\([^&]*\\)" param) | ||
| 190 | (push (match-string 1 param) to)) | ||
| 191 | )) | ||
| 192 | (t (setq mailto args))))) ; without param | ||
| 193 | |||
| 194 | ; other case <http://... to be done. | ||
| 195 | (t nil)) | ||
| 196 | (gnus-setup-message 'message (message-mail mailto subject)) | ||
| 197 | (insert body) | ||
| 198 | )) | ||
| 199 | 180 | ||
| 200 | (provide 'gnus-ml) | 181 | (provide 'gnus-ml) |
| 201 | 182 | ||
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 5208ae27eb9..66ab41950d1 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el | |||
| @@ -1249,6 +1249,7 @@ the type of the variable (string, integer, character, etc).") | |||
| 1249 | (defvar gnus-newsgroup-last-mail nil) | 1249 | (defvar gnus-newsgroup-last-mail nil) |
| 1250 | (defvar gnus-newsgroup-last-folder nil) | 1250 | (defvar gnus-newsgroup-last-folder nil) |
| 1251 | (defvar gnus-newsgroup-last-file nil) | 1251 | (defvar gnus-newsgroup-last-file nil) |
| 1252 | (defvar gnus-newsgroup-last-directory nil) | ||
| 1252 | (defvar gnus-newsgroup-auto-expire nil) | 1253 | (defvar gnus-newsgroup-auto-expire nil) |
| 1253 | (defvar gnus-newsgroup-active nil) | 1254 | (defvar gnus-newsgroup-active nil) |
| 1254 | 1255 | ||
| @@ -1364,6 +1365,7 @@ This list will always be a subset of gnus-newsgroup-undownloaded.") | |||
| 1364 | gnus-newsgroup-begin gnus-newsgroup-end | 1365 | gnus-newsgroup-begin gnus-newsgroup-end |
| 1365 | gnus-newsgroup-last-rmail gnus-newsgroup-last-mail | 1366 | gnus-newsgroup-last-rmail gnus-newsgroup-last-mail |
| 1366 | gnus-newsgroup-last-folder gnus-newsgroup-last-file | 1367 | gnus-newsgroup-last-folder gnus-newsgroup-last-file |
| 1368 | gnus-newsgroup-last-directory | ||
| 1367 | gnus-newsgroup-auto-expire gnus-newsgroup-unreads | 1369 | gnus-newsgroup-auto-expire gnus-newsgroup-unreads |
| 1368 | gnus-newsgroup-unselected gnus-newsgroup-marked | 1370 | gnus-newsgroup-unselected gnus-newsgroup-marked |
| 1369 | gnus-newsgroup-spam-marked | 1371 | gnus-newsgroup-spam-marked |
| @@ -1991,6 +1993,7 @@ increase the score of each group you read." | |||
| 1991 | "r" gnus-summary-save-article-rmail | 1993 | "r" gnus-summary-save-article-rmail |
| 1992 | "f" gnus-summary-save-article-file | 1994 | "f" gnus-summary-save-article-file |
| 1993 | "b" gnus-summary-save-article-body-file | 1995 | "b" gnus-summary-save-article-body-file |
| 1996 | "B" gnus-summary-write-article-body-file | ||
| 1994 | "h" gnus-summary-save-article-folder | 1997 | "h" gnus-summary-save-article-folder |
| 1995 | "v" gnus-summary-save-article-vm | 1998 | "v" gnus-summary-save-article-vm |
| 1996 | "p" gnus-summary-pipe-output | 1999 | "p" gnus-summary-pipe-output |
| @@ -3709,16 +3712,10 @@ If NO-DISPLAY, don't generate a summary buffer." | |||
| 3709 | (when gnus-build-sparse-threads | 3712 | (when gnus-build-sparse-threads |
| 3710 | (gnus-build-sparse-threads)) | 3713 | (gnus-build-sparse-threads)) |
| 3711 | ;; Find the initial limit. | 3714 | ;; Find the initial limit. |
| 3712 | (if gnus-show-threads | 3715 | (if show-all |
| 3713 | (if show-all | 3716 | (let ((gnus-newsgroup-dormant nil)) |
| 3714 | (let ((gnus-newsgroup-dormant nil)) | ||
| 3715 | (gnus-summary-initial-limit show-all)) | ||
| 3716 | (gnus-summary-initial-limit show-all)) | 3717 | (gnus-summary-initial-limit show-all)) |
| 3717 | ;; When unthreaded, all articles are always shown. | 3718 | (gnus-summary-initial-limit show-all)) |
| 3718 | (setq gnus-newsgroup-limit | ||
| 3719 | (mapcar | ||
| 3720 | (lambda (header) (mail-header-number header)) | ||
| 3721 | gnus-newsgroup-headers))) | ||
| 3722 | ;; Generate the summary buffer. | 3719 | ;; Generate the summary buffer. |
| 3723 | (unless no-display | 3720 | (unless no-display |
| 3724 | (gnus-summary-prepare)) | 3721 | (gnus-summary-prepare)) |
| @@ -5419,8 +5416,7 @@ If SELECT-ARTICLES, only select those articles from GROUP." | |||
| 5419 | 5416 | ||
| 5420 | (defun gnus-articles-to-read (group &optional read-all) | 5417 | (defun gnus-articles-to-read (group &optional read-all) |
| 5421 | "Find out what articles the user wants to read." | 5418 | "Find out what articles the user wants to read." |
| 5422 | (let* ((display (gnus-group-find-parameter group 'display)) | 5419 | (let* ((articles |
| 5423 | (articles | ||
| 5424 | ;; Select all articles if `read-all' is non-nil, or if there | 5420 | ;; Select all articles if `read-all' is non-nil, or if there |
| 5425 | ;; are no unread articles. | 5421 | ;; are no unread articles. |
| 5426 | (if (or read-all | 5422 | (if (or read-all |
| @@ -10993,12 +10989,26 @@ If N is a positive number, save the N next articles. | |||
| 10993 | If N is a negative number, save the N previous articles. | 10989 | If N is a negative number, save the N previous articles. |
| 10994 | If N is nil and any articles have been marked with the process mark, | 10990 | If N is nil and any articles have been marked with the process mark, |
| 10995 | save those articles instead. | 10991 | save those articles instead. |
| 10996 | The variable `gnus-default-article-saver' specifies the saver function." | 10992 | The variable `gnus-default-article-saver' specifies the saver function. |
| 10993 | |||
| 10994 | If the optional second argument NOT-SAVED is non-nil, articles saved | ||
| 10995 | will not be marked as saved." | ||
| 10997 | (interactive "P") | 10996 | (interactive "P") |
| 10997 | (require 'gnus-art) | ||
| 10998 | (let* ((articles (gnus-summary-work-articles n)) | 10998 | (let* ((articles (gnus-summary-work-articles n)) |
| 10999 | (save-buffer (save-excursion | 10999 | (save-buffer (save-excursion |
| 11000 | (nnheader-set-temp-buffer " *Gnus Save*"))) | 11000 | (nnheader-set-temp-buffer " *Gnus Save*"))) |
| 11001 | (num (length articles)) | 11001 | (num (length articles)) |
| 11002 | ;; Whether to save decoded articles or raw articles. | ||
| 11003 | (decode (when gnus-article-save-coding-system | ||
| 11004 | (get gnus-default-article-saver :decode))) | ||
| 11005 | ;; When saving many articles in a single file, use the other | ||
| 11006 | ;; function to save articles other than the first one. | ||
| 11007 | (saver2 (get gnus-default-article-saver :function)) | ||
| 11008 | (gnus-prompt-before-saving (if saver2 | ||
| 11009 | t | ||
| 11010 | gnus-prompt-before-saving)) | ||
| 11011 | (gnus-default-article-saver gnus-default-article-saver) | ||
| 11002 | header file) | 11012 | header file) |
| 11003 | (dolist (article articles) | 11013 | (dolist (article articles) |
| 11004 | (setq header (gnus-summary-article-header article)) | 11014 | (setq header (gnus-summary-article-header article)) |
| @@ -11009,17 +11019,25 @@ The variable `gnus-default-article-saver' specifies the saver function." | |||
| 11009 | (gnus-message 1 "Article %d is unsaveable" article)) | 11019 | (gnus-message 1 "Article %d is unsaveable" article)) |
| 11010 | ;; This is a real article. | 11020 | ;; This is a real article. |
| 11011 | (save-window-excursion | 11021 | (save-window-excursion |
| 11012 | (let ((gnus-display-mime-function nil) | 11022 | (let ((gnus-display-mime-function (when decode |
| 11013 | (gnus-article-prepare-hook nil)) | 11023 | gnus-display-mime-function)) |
| 11014 | (gnus-summary-select-article t nil nil article))) | 11024 | (gnus-article-prepare-hook (when decode |
| 11025 | gnus-article-prepare-hook))) | ||
| 11026 | (gnus-summary-select-article t nil nil article) | ||
| 11027 | (gnus-summary-goto-subject article))) | ||
| 11015 | (save-excursion | 11028 | (save-excursion |
| 11016 | (set-buffer save-buffer) | 11029 | (set-buffer save-buffer) |
| 11017 | (erase-buffer) | 11030 | (erase-buffer) |
| 11018 | (insert-buffer-substring gnus-original-article-buffer)) | 11031 | (insert-buffer-substring (if decode |
| 11032 | gnus-article-buffer | ||
| 11033 | gnus-original-article-buffer))) | ||
| 11019 | (setq file (gnus-article-save save-buffer file num)) | 11034 | (setq file (gnus-article-save save-buffer file num)) |
| 11020 | (gnus-summary-remove-process-mark article) | 11035 | (gnus-summary-remove-process-mark article) |
| 11021 | (unless not-saved | 11036 | (unless not-saved |
| 11022 | (gnus-summary-set-saved-mark article)))) | 11037 | (gnus-summary-set-saved-mark article))) |
| 11038 | (when saver2 | ||
| 11039 | (setq gnus-default-article-saver saver2 | ||
| 11040 | saver2 nil))) | ||
| 11023 | (gnus-kill-buffer save-buffer) | 11041 | (gnus-kill-buffer save-buffer) |
| 11024 | (gnus-summary-position-point) | 11042 | (gnus-summary-position-point) |
| 11025 | (gnus-set-mode-line 'summary) | 11043 | (gnus-set-mode-line 'summary) |
| @@ -11097,6 +11115,17 @@ save those articles instead." | |||
| 11097 | (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file)) | 11115 | (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file)) |
| 11098 | (gnus-summary-save-article arg))) | 11116 | (gnus-summary-save-article arg))) |
| 11099 | 11117 | ||
| 11118 | (defun gnus-summary-write-article-body-file (&optional arg) | ||
| 11119 | "Write the current article body to a file, deleting the previous file. | ||
| 11120 | If N is a positive number, save the N next articles. | ||
| 11121 | If N is a negative number, save the N previous articles. | ||
| 11122 | If N is nil and any articles have been marked with the process mark, | ||
| 11123 | save those articles instead." | ||
| 11124 | (interactive "P") | ||
| 11125 | (require 'gnus-art) | ||
| 11126 | (let ((gnus-default-article-saver 'gnus-summary-write-body-to-file)) | ||
| 11127 | (gnus-summary-save-article arg))) | ||
| 11128 | |||
| 11100 | (defun gnus-summary-muttprint (&optional arg) | 11129 | (defun gnus-summary-muttprint (&optional arg) |
| 11101 | "Print the current article using Muttprint. | 11130 | "Print the current article using Muttprint. |
| 11102 | If N is a positive number, save the N next articles. | 11131 | If N is a positive number, save the N next articles. |
diff --git a/lisp/gnus/imap.el b/lisp/gnus/imap.el index 7b40773ca06..16fce1843db 100644 --- a/lisp/gnus/imap.el +++ b/lisp/gnus/imap.el | |||
| @@ -79,7 +79,7 @@ | |||
| 79 | ;; (NAMESPACE), RFC2359 (UIDPLUS), the IMAP-part of RFC2595 (STARTTLS, | 79 | ;; (NAMESPACE), RFC2359 (UIDPLUS), the IMAP-part of RFC2595 (STARTTLS, |
| 80 | ;; LOGINDISABLED) (with use of external library starttls.el and | 80 | ;; LOGINDISABLED) (with use of external library starttls.el and |
| 81 | ;; program starttls) and the GSSAPI / kerberos V4 sections of RFC1731 | 81 | ;; program starttls) and the GSSAPI / kerberos V4 sections of RFC1731 |
| 82 | ;; (with use of external program `imtest'). It also take advantage | 82 | ;; (with use of external program `imtest'). It also takes advantage of |
| 83 | ;; the UNSELECT extension in Cyrus IMAPD. | 83 | ;; the UNSELECT extension in Cyrus IMAPD. |
| 84 | ;; | 84 | ;; |
| 85 | ;; Without the work of John McClary Prevost and Jim Radford this library | 85 | ;; Without the work of John McClary Prevost and Jim Radford this library |
diff --git a/lisp/gnus/mail-source.el b/lisp/gnus/mail-source.el index 9683f28154b..e350468bea4 100644 --- a/lisp/gnus/mail-source.el +++ b/lisp/gnus/mail-source.el | |||
| @@ -63,175 +63,177 @@ This variable is a list of mail source specifiers. | |||
| 63 | See Info node `(gnus)Mail Source Specifiers'." | 63 | See Info node `(gnus)Mail Source Specifiers'." |
| 64 | :group 'mail-source | 64 | :group 'mail-source |
| 65 | :link '(custom-manual "(gnus)Mail Source Specifiers") | 65 | :link '(custom-manual "(gnus)Mail Source Specifiers") |
| 66 | :type `(repeat | 66 | :type `(choice |
| 67 | (choice :format "%[Value Menu%] %v" | 67 | (const nil) |
| 68 | :value (file) | 68 | (repeat |
| 69 | (cons :tag "Spool file" | 69 | (choice :format "%[Value Menu%] %v" |
| 70 | (const :format "" file) | 70 | :value (file) |
| 71 | (checklist :tag "Options" :greedy t | 71 | (cons :tag "Spool file" |
| 72 | (group :inline t | 72 | (const :format "" file) |
| 73 | (const :format "" :value :path) | 73 | (checklist :tag "Options" :greedy t |
| 74 | file))) | 74 | (group :inline t |
| 75 | (cons :tag "Several files in a directory" | 75 | (const :format "" :value :path) |
| 76 | (const :format "" directory) | 76 | file))) |
| 77 | (checklist :tag "Options" :greedy t | 77 | (cons :tag "Several files in a directory" |
| 78 | (group :inline t | 78 | (const :format "" directory) |
| 79 | (const :format "" :value :path) | 79 | (checklist :tag "Options" :greedy t |
| 80 | (directory :tag "Path")) | 80 | (group :inline t |
| 81 | (group :inline t | 81 | (const :format "" :value :path) |
| 82 | (const :format "" :value :suffix) | 82 | (directory :tag "Path")) |
| 83 | (string :tag "Suffix")) | 83 | (group :inline t |
| 84 | (group :inline t | 84 | (const :format "" :value :suffix) |
| 85 | (const :format "" :value :predicate) | 85 | (string :tag "Suffix")) |
| 86 | (function :tag "Predicate")) | 86 | (group :inline t |
| 87 | (group :inline t | 87 | (const :format "" :value :predicate) |
| 88 | (const :format "" :value :prescript) | 88 | (function :tag "Predicate")) |
| 89 | (choice :tag "Prescript" | 89 | (group :inline t |
| 90 | :value nil | 90 | (const :format "" :value :prescript) |
| 91 | (string :format "%v") | 91 | (choice :tag "Prescript" |
| 92 | (function :format "%v"))) | 92 | :value nil |
| 93 | (group :inline t | 93 | (string :format "%v") |
| 94 | (const :format "" :value :postscript) | 94 | (function :format "%v"))) |
| 95 | (choice :tag "Postscript" | 95 | (group :inline t |
| 96 | :value nil | 96 | (const :format "" :value :postscript) |
| 97 | (string :format "%v") | 97 | (choice :tag "Postscript" |
| 98 | (function :format "%v"))) | 98 | :value nil |
| 99 | (group :inline t | 99 | (string :format "%v") |
| 100 | (const :format "" :value :plugged) | 100 | (function :format "%v"))) |
| 101 | (boolean :tag "Plugged")))) | 101 | (group :inline t |
| 102 | (cons :tag "POP3 server" | 102 | (const :format "" :value :plugged) |
| 103 | (const :format "" pop) | 103 | (boolean :tag "Plugged")))) |
| 104 | (checklist :tag "Options" :greedy t | 104 | (cons :tag "POP3 server" |
| 105 | (group :inline t | 105 | (const :format "" pop) |
| 106 | (const :format "" :value :server) | 106 | (checklist :tag "Options" :greedy t |
| 107 | (string :tag "Server")) | 107 | (group :inline t |
| 108 | (group :inline t | 108 | (const :format "" :value :server) |
| 109 | (const :format "" :value :port) | 109 | (string :tag "Server")) |
| 110 | (choice :tag "Port" | 110 | (group :inline t |
| 111 | :value "pop3" | 111 | (const :format "" :value :port) |
| 112 | (number :format "%v") | 112 | (choice :tag "Port" |
| 113 | (string :format "%v"))) | 113 | :value "pop3" |
| 114 | (group :inline t | 114 | (number :format "%v") |
| 115 | (const :format "" :value :user) | 115 | (string :format "%v"))) |
| 116 | (string :tag "User")) | 116 | (group :inline t |
| 117 | (group :inline t | 117 | (const :format "" :value :user) |
| 118 | (const :format "" :value :password) | 118 | (string :tag "User")) |
| 119 | (string :tag "Password")) | 119 | (group :inline t |
| 120 | (group :inline t | 120 | (const :format "" :value :password) |
| 121 | (const :format "" :value :program) | 121 | (string :tag "Password")) |
| 122 | (string :tag "Program")) | 122 | (group :inline t |
| 123 | (group :inline t | 123 | (const :format "" :value :program) |
| 124 | (const :format "" :value :prescript) | 124 | (string :tag "Program")) |
| 125 | (choice :tag "Prescript" | 125 | (group :inline t |
| 126 | :value nil | 126 | (const :format "" :value :prescript) |
| 127 | (string :format "%v") | 127 | (choice :tag "Prescript" |
| 128 | (function :format "%v"))) | 128 | :value nil |
| 129 | (group :inline t | 129 | (string :format "%v") |
| 130 | (const :format "" :value :postscript) | 130 | (function :format "%v"))) |
| 131 | (choice :tag "Postscript" | 131 | (group :inline t |
| 132 | :value nil | 132 | (const :format "" :value :postscript) |
| 133 | (string :format "%v") | 133 | (choice :tag "Postscript" |
| 134 | (function :format "%v"))) | 134 | :value nil |
| 135 | (group :inline t | 135 | (string :format "%v") |
| 136 | (const :format "" :value :function) | 136 | (function :format "%v"))) |
| 137 | (function :tag "Function")) | 137 | (group :inline t |
| 138 | (group :inline t | 138 | (const :format "" :value :function) |
| 139 | (const :format "" | 139 | (function :tag "Function")) |
| 140 | :value :authentication) | 140 | (group :inline t |
| 141 | (choice :tag "Authentication" | 141 | (const :format "" |
| 142 | :value apop | 142 | :value :authentication) |
| 143 | (const password) | 143 | (choice :tag "Authentication" |
| 144 | (const apop))) | 144 | :value apop |
| 145 | (group :inline t | 145 | (const password) |
| 146 | (const :format "" :value :plugged) | 146 | (const apop))) |
| 147 | (boolean :tag "Plugged")))) | 147 | (group :inline t |
| 148 | (cons :tag "Maildir (qmail, postfix...)" | 148 | (const :format "" :value :plugged) |
| 149 | (const :format "" maildir) | 149 | (boolean :tag "Plugged")))) |
| 150 | (checklist :tag "Options" :greedy t | 150 | (cons :tag "Maildir (qmail, postfix...)" |
| 151 | (group :inline t | 151 | (const :format "" maildir) |
| 152 | (const :format "" :value :path) | 152 | (checklist :tag "Options" :greedy t |
| 153 | (directory :tag "Path")) | 153 | (group :inline t |
| 154 | (group :inline t | 154 | (const :format "" :value :path) |
| 155 | (const :format "" :value :plugged) | 155 | (directory :tag "Path")) |
| 156 | (boolean :tag "Plugged")))) | 156 | (group :inline t |
| 157 | (cons :tag "IMAP server" | 157 | (const :format "" :value :plugged) |
| 158 | (const :format "" imap) | 158 | (boolean :tag "Plugged")))) |
| 159 | (checklist :tag "Options" :greedy t | 159 | (cons :tag "IMAP server" |
| 160 | (group :inline t | 160 | (const :format "" imap) |
| 161 | (const :format "" :value :server) | 161 | (checklist :tag "Options" :greedy t |
| 162 | (string :tag "Server")) | 162 | (group :inline t |
| 163 | (group :inline t | 163 | (const :format "" :value :server) |
| 164 | (const :format "" :value :port) | 164 | (string :tag "Server")) |
| 165 | (choice :tag "Port" | 165 | (group :inline t |
| 166 | :value 143 | 166 | (const :format "" :value :port) |
| 167 | number string)) | 167 | (choice :tag "Port" |
| 168 | (group :inline t | 168 | :value 143 |
| 169 | (const :format "" :value :user) | 169 | number string)) |
| 170 | (string :tag "User")) | 170 | (group :inline t |
| 171 | (group :inline t | 171 | (const :format "" :value :user) |
| 172 | (const :format "" :value :password) | 172 | (string :tag "User")) |
| 173 | (string :tag "Password")) | 173 | (group :inline t |
| 174 | (group :inline t | 174 | (const :format "" :value :password) |
| 175 | (const :format "" :value :stream) | 175 | (string :tag "Password")) |
| 176 | (choice :tag "Stream" | 176 | (group :inline t |
| 177 | :value network | 177 | (const :format "" :value :stream) |
| 178 | ,@mail-source-imap-streams)) | 178 | (choice :tag "Stream" |
| 179 | (group :inline t | 179 | :value network |
| 180 | (const :format "" :value :program) | 180 | ,@mail-source-imap-streams)) |
| 181 | (string :tag "Program")) | 181 | (group :inline t |
| 182 | (group :inline t | 182 | (const :format "" :value :program) |
| 183 | (const :format "" | 183 | (string :tag "Program")) |
| 184 | :value :authenticator) | 184 | (group :inline t |
| 185 | (choice :tag "Authenticator" | 185 | (const :format "" |
| 186 | :value login | 186 | :value :authenticator) |
| 187 | ,@mail-source-imap-authenticators)) | 187 | (choice :tag "Authenticator" |
| 188 | (group :inline t | 188 | :value login |
| 189 | (const :format "" :value :mailbox) | 189 | ,@mail-source-imap-authenticators)) |
| 190 | (string :tag "Mailbox" | 190 | (group :inline t |
| 191 | :value "INBOX")) | 191 | (const :format "" :value :mailbox) |
| 192 | (group :inline t | 192 | (string :tag "Mailbox" |
| 193 | (const :format "" :value :predicate) | 193 | :value "INBOX")) |
| 194 | (string :tag "Predicate" | 194 | (group :inline t |
| 195 | :value "UNSEEN UNDELETED")) | 195 | (const :format "" :value :predicate) |
| 196 | (group :inline t | 196 | (string :tag "Predicate" |
| 197 | (const :format "" :value :fetchflag) | 197 | :value "UNSEEN UNDELETED")) |
| 198 | (string :tag "Fetchflag" | 198 | (group :inline t |
| 199 | :value "\\Deleted")) | 199 | (const :format "" :value :fetchflag) |
| 200 | (group :inline t | 200 | (string :tag "Fetchflag" |
| 201 | (const :format "" | 201 | :value "\\Deleted")) |
| 202 | :value :dontexpunge) | 202 | (group :inline t |
| 203 | (boolean :tag "Dontexpunge")) | 203 | (const :format "" |
| 204 | (group :inline t | 204 | :value :dontexpunge) |
| 205 | (const :format "" :value :plugged) | 205 | (boolean :tag "Dontexpunge")) |
| 206 | (boolean :tag "Plugged")))) | 206 | (group :inline t |
| 207 | (cons :tag "Webmail server" | 207 | (const :format "" :value :plugged) |
| 208 | (const :format "" webmail) | 208 | (boolean :tag "Plugged")))) |
| 209 | (checklist :tag "Options" :greedy t | 209 | (cons :tag "Webmail server" |
| 210 | (group :inline t | 210 | (const :format "" webmail) |
| 211 | (const :format "" :value :subtype) | 211 | (checklist :tag "Options" :greedy t |
| 212 | ;; Should be generated from | 212 | (group :inline t |
| 213 | ;; `webmail-type-definition', but we | 213 | (const :format "" :value :subtype) |
| 214 | ;; can't require webmail without W3. | 214 | ;; Should be generated from |
| 215 | (choice :tag "Subtype" | 215 | ;; `webmail-type-definition', but we |
| 216 | :value hotmail | 216 | ;; can't require webmail without W3. |
| 217 | (const hotmail) | 217 | (choice :tag "Subtype" |
| 218 | (const yahoo) | 218 | :value hotmail |
| 219 | (const netaddress) | 219 | (const hotmail) |
| 220 | (const netscape) | 220 | (const yahoo) |
| 221 | (const my-deja))) | 221 | (const netaddress) |
| 222 | (group :inline t | 222 | (const netscape) |
| 223 | (const :format "" :value :user) | 223 | (const my-deja))) |
| 224 | (string :tag "User")) | 224 | (group :inline t |
| 225 | (group :inline t | 225 | (const :format "" :value :user) |
| 226 | (const :format "" :value :password) | 226 | (string :tag "User")) |
| 227 | (string :tag "Password")) | 227 | (group :inline t |
| 228 | (group :inline t | 228 | (const :format "" :value :password) |
| 229 | (const :format "" | 229 | (string :tag "Password")) |
| 230 | :value :dontexpunge) | 230 | (group :inline t |
| 231 | (boolean :tag "Dontexpunge")) | 231 | (const :format "" |
| 232 | (group :inline t | 232 | :value :dontexpunge) |
| 233 | (const :format "" :value :plugged) | 233 | (boolean :tag "Dontexpunge")) |
| 234 | (boolean :tag "Plugged"))))))) | 234 | (group :inline t |
| 235 | (const :format "" :value :plugged) | ||
| 236 | (boolean :tag "Plugged")))))))) | ||
| 235 | 237 | ||
| 236 | (defcustom mail-source-ignore-errors nil | 238 | (defcustom mail-source-ignore-errors nil |
| 237 | "*Ignore errors when querying mail sources. | 239 | "*Ignore errors when querying mail sources. |
diff --git a/lisp/gnus/mm-util.el b/lisp/gnus/mm-util.el index e16750cfcf6..634d1f66675 100644 --- a/lisp/gnus/mm-util.el +++ b/lisp/gnus/mm-util.el | |||
| @@ -364,14 +364,17 @@ could use `autoload-coding-system' here." | |||
| 364 | (iso-2022-jp-3 latin-jisx0201 japanese-jisx0208-1978 japanese-jisx0208 | 364 | (iso-2022-jp-3 latin-jisx0201 japanese-jisx0208-1978 japanese-jisx0208 |
| 365 | japanese-jisx0213-1 japanese-jisx0213-2) | 365 | japanese-jisx0213-1 japanese-jisx0213-2) |
| 366 | (shift_jis latin-jisx0201 katakana-jisx0201 japanese-jisx0208) | 366 | (shift_jis latin-jisx0201 katakana-jisx0201 japanese-jisx0208) |
| 367 | ,(if (or (not (fboundp 'charsetp)) ;; non-Mule case | 367 | ,(cond ((fboundp 'unicode-precedence-list) |
| 368 | (charsetp 'unicode-a) | 368 | (cons 'utf-8 (delq 'ascii (mapcar 'charset-name |
| 369 | (not (mm-coding-system-p 'mule-utf-8))) | 369 | (unicode-precedence-list))))) |
| 370 | '(utf-8 unicode-a unicode-b unicode-c unicode-d unicode-e) | 370 | ((or (not (fboundp 'charsetp)) ;; non-Mule case |
| 371 | ;; If we have utf-8 we're in Mule 5+. | 371 | (charsetp 'unicode-a) |
| 372 | (append '(utf-8) | 372 | (not (mm-coding-system-p 'mule-utf-8))) |
| 373 | (delete 'ascii | 373 | '(utf-8 unicode-a unicode-b unicode-c unicode-d unicode-e)) |
| 374 | (coding-system-get 'mule-utf-8 'safe-charsets))))) | 374 | (t ;; If we have utf-8 we're in Mule 5+. |
| 375 | (append '(utf-8) | ||
| 376 | (delete 'ascii | ||
| 377 | (coding-system-get 'mule-utf-8 'safe-charsets)))))) | ||
| 375 | "Alist of MIME-charset/MULE-charsets.") | 378 | "Alist of MIME-charset/MULE-charsets.") |
| 376 | 379 | ||
| 377 | (defun mm-enrich-utf-8-by-mule-ucs () | 380 | (defun mm-enrich-utf-8-by-mule-ucs () |
| @@ -379,10 +382,6 @@ could use `autoload-coding-system' here." | |||
| 379 | This function will run when the `un-define' module is loaded under | 382 | This function will run when the `un-define' module is loaded under |
| 380 | XEmacs, and fill the `utf-8' entry in `mm-mime-mule-charset-alist' | 383 | XEmacs, and fill the `utf-8' entry in `mm-mime-mule-charset-alist' |
| 381 | with Mule charsets. It is completely useless for Emacs." | 384 | with Mule charsets. It is completely useless for Emacs." |
| 382 | (unless (cdr (delete '(mm-enrich-utf-8-by-mule-ucs) | ||
| 383 | (assoc "un-define" after-load-alist))) | ||
| 384 | (setq after-load-alist | ||
| 385 | (delete '("un-define") after-load-alist))) | ||
| 386 | (when (boundp 'unicode-basic-translation-charset-order-list) | 385 | (when (boundp 'unicode-basic-translation-charset-order-list) |
| 387 | (condition-case nil | 386 | (condition-case nil |
| 388 | (let ((val (delq | 387 | (let ((val (delq |
diff --git a/lisp/gnus/uudecode.el b/lisp/gnus/uudecode.el index f47a8e90c3a..616348e899f 100644 --- a/lisp/gnus/uudecode.el +++ b/lisp/gnus/uudecode.el | |||
| @@ -100,7 +100,11 @@ used is specified by `uudecode-decoder-program'." | |||
| 100 | (make-temp-name "uu") | 100 | (make-temp-name "uu") |
| 101 | uudecode-temporary-file-directory)))) | 101 | uudecode-temporary-file-directory)))) |
| 102 | (let ((cdir default-directory) | 102 | (let ((cdir default-directory) |
| 103 | default-process-coding-system) | 103 | (default-process-coding-system |
| 104 | (if (featurep 'xemacs) | ||
| 105 | ;; In XEmacs, `nil' is not a valid coding system. | ||
| 106 | '(binary . binary) | ||
| 107 | nil))) | ||
| 104 | (unwind-protect | 108 | (unwind-protect |
| 105 | (with-temp-buffer | 109 | (with-temp-buffer |
| 106 | (insert "begin 600 " (file-name-nondirectory tempfile) "\n") | 110 | (insert "begin 600 " (file-name-nondirectory tempfile) "\n") |
diff --git a/lisp/help.el b/lisp/help.el index 1661779ca74..0caf018c2e9 100644 --- a/lisp/help.el +++ b/lisp/help.el | |||
| @@ -182,31 +182,28 @@ specifies what to do when the user exits the help buffer." | |||
| 182 | "You have typed %THIS-KEY%, the help character. Type a Help option: | 182 | "You have typed %THIS-KEY%, the help character. Type a Help option: |
| 183 | \(Use SPC or DEL to scroll through this text. Type \\<help-map>\\[help-quit] to exit the Help command.) | 183 | \(Use SPC or DEL to scroll through this text. Type \\<help-map>\\[help-quit] to exit the Help command.) |
| 184 | 184 | ||
| 185 | a command-apropos. Give a list of words or a regexp, to get a list of | 185 | a command-apropos. Type a list of words or a regexp; it shows a list of |
| 186 | commands whose names match. See also the apropos command. | 186 | commands whose names match. See also the apropos command. |
| 187 | b describe-bindings. Display table of all key bindings. | 187 | b describe-bindings. Display a table of all key bindings. |
| 188 | c describe-key-briefly. Type a command key sequence; | 188 | c describe-key-briefly. Type a key sequence; |
| 189 | it prints the function name that sequence runs. | 189 | it displays the command name run by that key sequence. |
| 190 | C describe-coding-system. This describes either a specific coding system | 190 | C describe-coding-system. Type the name of the coding system to describe, |
| 191 | (if you type its name) or the coding systems currently in use | 191 | or just RET to describe the ones currently in use. |
| 192 | (if you type just RET). | 192 | d apropos-documentation. Type a pattern (a list of words or a regexp), and |
| 193 | d apropos-documentation. Give a pattern (a list or words or a regexp), and | 193 | it shows a list of functions, variables, and other items whose |
| 194 | see a list of functions, variables, and other items whose built-in | 194 | documentation matches that pattern. See also the apropos command. |
| 195 | doucmentation string matches that pattern. See also the apropos command. | 195 | e view-echo-area-messages. Go to the buffer that logs echo-area messages. |
| 196 | e view-echo-area-messages. Show the buffer where the echo-area messages | 196 | f describe-function. Type a function name and you see its documentation. |
| 197 | are stored. | 197 | F Info-goto-emacs-command-node. Type a command name; |
| 198 | f describe-function. Type a function name and get its documentation. | 198 | it goes to the on-line manual's section that describes the command. |
| 199 | F Info-goto-emacs-command-node. Type a function name; | ||
| 200 | it takes you to the on-line manual's section that describes | ||
| 201 | the command. | ||
| 202 | h Display the HELLO file which illustrates various scripts. | 199 | h Display the HELLO file which illustrates various scripts. |
| 203 | i info. The Info documentation reader: read on-line manuals. | 200 | i info. The Info documentation reader: read on-line manuals. |
| 204 | I describe-input-method. Describe a specific input method (if you type | 201 | I describe-input-method. Describe a specific input method (if you type |
| 205 | its name) or the current input method (if you type just RET). | 202 | its name) or the current input method (if you type just RET). |
| 206 | k describe-key. Type a command key sequence; | 203 | k describe-key. Type a key sequence; |
| 207 | it displays the full documentation for that key sequence. | 204 | it displays the full documentation for that key sequence. |
| 208 | K Info-goto-emacs-key-command-node. Type a command key sequence; | 205 | K Info-goto-emacs-key-command-node. Type a key sequence; |
| 209 | it takes you to the on-line manual's section that describes | 206 | it goes to the on-line manual's section that describes |
| 210 | the command bound to that key. | 207 | the command bound to that key. |
| 211 | l view-lossage. Show last 100 characters you typed. | 208 | l view-lossage. Show last 100 characters you typed. |
| 212 | L describe-language-environment. This describes either a | 209 | L describe-language-environment. This describes either a |
| @@ -218,12 +215,12 @@ n view-emacs-news. Display news of recent Emacs changes. | |||
| 218 | p finder-by-keyword. Find packages matching a given topic keyword. | 215 | p finder-by-keyword. Find packages matching a given topic keyword. |
| 219 | r info-emacs-manual. Display the Emacs manual in Info mode. | 216 | r info-emacs-manual. Display the Emacs manual in Info mode. |
| 220 | s describe-syntax. Display contents of syntax table, plus explanations. | 217 | s describe-syntax. Display contents of syntax table, plus explanations. |
| 221 | S info-lookup-symbol. Display the definition of a specific symbol | 218 | S info-lookup-symbol. Type a symbol; it goes to that symbol in the |
| 222 | as found in the manual for the language this buffer is written in. | 219 | on-line manual for the programming language used in this buffer. |
| 223 | t help-with-tutorial. Select the Emacs learn-by-doing tutorial. | 220 | t help-with-tutorial. Select the Emacs learn-by-doing tutorial. |
| 224 | v describe-variable. Type name of a variable; | 221 | v describe-variable. Type name of a variable; |
| 225 | it displays the variable's documentation and value. | 222 | it displays the variable's documentation and value. |
| 226 | w where-is. Type command name; it prints which keystrokes | 223 | w where-is. Type a command name; it displays which keystrokes |
| 227 | invoke that command. | 224 | invoke that command. |
| 228 | . display-local-help. Display any available local help at point | 225 | . display-local-help. Display any available local help at point |
| 229 | in the echo area. | 226 | in the echo area. |
| @@ -326,63 +323,76 @@ of the key sequence that ran this command." | |||
| 326 | ;; run describe-prefix-bindings. | 323 | ;; run describe-prefix-bindings. |
| 327 | (setq prefix-help-command 'describe-prefix-bindings) | 324 | (setq prefix-help-command 'describe-prefix-bindings) |
| 328 | 325 | ||
| 329 | (defun view-emacs-news (&optional arg) | 326 | (defun view-emacs-news (&optional version) |
| 330 | "Display info on recent changes to Emacs. | 327 | "Display info on recent changes to Emacs. |
| 331 | With argument, display info only for the selected version." | 328 | With argument, display info only for the selected version." |
| 332 | (interactive "P") | 329 | (interactive "P") |
| 333 | (if (not arg) | 330 | (unless version |
| 334 | (view-file (expand-file-name "NEWS" data-directory)) | 331 | (setq version emacs-major-version)) |
| 335 | (let* ((map (sort | 332 | (when (consp version) |
| 336 | (delete-dups | 333 | (let* ((all-versions |
| 337 | (apply | 334 | (let (res) |
| 338 | 'nconc | 335 | (mapcar |
| 339 | (mapcar | 336 | (lambda (file) |
| 340 | (lambda (file) | 337 | (with-temp-buffer |
| 341 | (with-temp-buffer | 338 | (insert-file-contents |
| 342 | (insert-file-contents | 339 | (expand-file-name file data-directory)) |
| 343 | (expand-file-name file data-directory)) | 340 | (while (re-search-forward |
| 344 | (let (res) | 341 | (if (member file '("NEWS.18" "NEWS.1-17")) |
| 345 | (while (re-search-forward | 342 | "Changes in \\(?:Emacs\\|version\\)?[ \t]*\\([0-9]+\\(?:\\.[0-9]+\\)?\\)" |
| 346 | (if (string-match "^ONEWS\\.[0-9]+$" file) | 343 | "^\* [^0-9\n]*\\([0-9]+\\.[0-9]+\\)") nil t) |
| 347 | "Changes in \\(?:Emacs\\|version\\)?[ \t]*\\([0-9]+\\(?:\\.[0-9]+\\)?\\)" | 344 | (setq res (cons (match-string-no-properties 1) res))))) |
| 348 | "^\* [^0-9\n]*\\([0-9]+\\.[0-9]+\\)") nil t) | 345 | (cons "NEWS" |
| 349 | (setq res (cons (list (match-string-no-properties 1) | 346 | (directory-files data-directory nil |
| 350 | file) res))) | 347 | "^NEWS\\.[0-9][-0-9]*$" nil))) |
| 351 | res))) | 348 | (sort (delete-dups res) (lambda (a b) (string< b a))))) |
| 352 | (append '("NEWS" "ONEWS") | 349 | (current (car all-versions)) |
| 353 | (directory-files data-directory nil | 350 | res) |
| 354 | "^ONEWS\\.[0-9]+$" nil))))) | 351 | (setq version (completing-read |
| 355 | (lambda (a b) | 352 | (format "Read NEWS for the version (default %s): " current) |
| 356 | (string< (car b) (car a))))) | 353 | all-versions nil nil nil nil current)) |
| 357 | (current (caar map)) | 354 | (if (integerp (string-to-number version)) |
| 358 | (version (completing-read | 355 | (setq version (string-to-number version)) |
| 359 | (format "Read NEWS for the version (default %s): " current) | 356 | (unless (or (member version all-versions) |
| 360 | (mapcar 'car map) nil nil nil nil current)) | 357 | (<= (string-to-number version) (string-to-number current))) |
| 361 | (file (cadr (assoc version map))) | 358 | (error "No news about version %s" version))))) |
| 362 | res) | 359 | (when (integerp version) |
| 363 | (if (not file) | 360 | (cond ((<= version 12) |
| 364 | (error "No news is good news") | 361 | (setq version (format "1.%d" version))) |
| 365 | (view-file (expand-file-name file data-directory)) | 362 | ((<= version 18) |
| 366 | (widen) | 363 | (setq version (format "%d" version))) |
| 367 | (goto-char (point-min)) | 364 | ((> version emacs-major-version) |
| 368 | (when (re-search-forward | 365 | (error "No news about emacs %d (yet)" version)))) |
| 369 | (concat (if (string-match "^ONEWS\\.[0-9]+$" file) | 366 | (let* ((vn (if (stringp version) |
| 370 | "Changes in \\(?:Emacs\\|version\\)?[ \t]*" | 367 | (string-to-number version) |
| 371 | "^\* [^0-9\n]*") version) | 368 | version)) |
| 372 | nil t) | 369 | (file (cond |
| 373 | (beginning-of-line) | 370 | ((>= vn emacs-major-version) "NEWS") |
| 374 | (narrow-to-region | 371 | ((< vn 18) "NEWS.1-17") |
| 375 | (point) | 372 | (t (format "NEWS.%d" vn))))) |
| 376 | (save-excursion | 373 | (view-file (expand-file-name file data-directory)) |
| 377 | (while (and (setq res | 374 | (widen) |
| 378 | (re-search-forward | 375 | (goto-char (point-min)) |
| 379 | (if (string-match "^ONEWS\\.[0-9]+$" file) | 376 | (when (stringp version) |
| 380 | "Changes in \\(?:Emacs\\|version\\)?[ \t]*\\([0-9]+\\(?:\\.[0-9]+\\)?\\)" | 377 | (when (re-search-forward |
| 381 | "^\* [^0-9\n]*\\([0-9]+\\.[0-9]+\\)") nil t)) | 378 | (concat (if (< vn 19) |
| 382 | (equal (match-string-no-properties 1) version))) | 379 | "Changes in Emacs[ \t]*" |
| 383 | (or res (goto-char (point-max))) | 380 | "^\* [^0-9\n]*") version "$") |
| 384 | (beginning-of-line) | 381 | nil t) |
| 385 | (point)))))))) | 382 | (beginning-of-line) |
| 383 | (narrow-to-region | ||
| 384 | (point) | ||
| 385 | (save-excursion | ||
| 386 | (while (and (setq res | ||
| 387 | (re-search-forward | ||
| 388 | (if (< vn 19) | ||
| 389 | "Changes in \\(?:Emacs\\|version\\)?[ \t]*\\([0-9]+\\(?:\\.[0-9]+\\)?\\)" | ||
| 390 | "^\* [^0-9\n]*\\([0-9]+\\.[0-9]+\\)") nil t)) | ||
| 391 | (equal (match-string-no-properties 1) version))) | ||
| 392 | (or res (goto-char (point-max))) | ||
| 393 | (beginning-of-line) | ||
| 394 | (point))))))) | ||
| 395 | |||
| 386 | 396 | ||
| 387 | (defun view-todo (&optional arg) | 397 | (defun view-todo (&optional arg) |
| 388 | "Display the Emacs TODO list." | 398 | "Display the Emacs TODO list." |
| @@ -942,11 +952,11 @@ is currently activated with completion." | |||
| 942 | 952 | ||
| 943 | (defcustom temp-buffer-max-height (lambda (buffer) (/ (- (frame-height) 2) 2)) | 953 | (defcustom temp-buffer-max-height (lambda (buffer) (/ (- (frame-height) 2) 2)) |
| 944 | "Maximum height of a window displaying a temporary buffer. | 954 | "Maximum height of a window displaying a temporary buffer. |
| 945 | This is the maximum height (in text lines) which `resize-temp-buffer-window' | 955 | This is effective only when Temp Buffer Resize mode is enabled. |
| 956 | The value is the maximum height (in lines) which `resize-temp-buffer-window' | ||
| 946 | will give to a window displaying a temporary buffer. | 957 | will give to a window displaying a temporary buffer. |
| 947 | It can also be a function which will be called with the object corresponding | 958 | It can also be a function to be called to choose the height for such a buffer. |
| 948 | to the buffer to be displayed as argument and should return an integer | 959 | It gets one argumemt, the buffer, and should return a positive integer." |
| 949 | positive number." | ||
| 950 | :type '(choice integer function) | 960 | :type '(choice integer function) |
| 951 | :group 'help | 961 | :group 'help |
| 952 | :version "20.4") | 962 | :version "20.4") |
diff --git a/lisp/ido.el b/lisp/ido.el index 1c2617b814d..a4c26b52c98 100644 --- a/lisp/ido.el +++ b/lisp/ido.el | |||
| @@ -448,35 +448,41 @@ in merged file and directory lists." | |||
| 448 | ;;; Examples for setting the value of ido-ignore-files | 448 | ;;; Examples for setting the value of ido-ignore-files |
| 449 | ;(setq ido-ignore-files '("^ " "\\.c$" "\\.h$")) | 449 | ;(setq ido-ignore-files '("^ " "\\.c$" "\\.h$")) |
| 450 | 450 | ||
| 451 | (defcustom ido-default-file-method 'always-frame | 451 | (defcustom ido-default-file-method 'raise-frame |
| 452 | "*How to switch to new file when using `ido-find-file'. | 452 | "*How to visit a new file when using `ido-find-file'. |
| 453 | Possible values: | 453 | Possible values: |
| 454 | `samewindow' Show new file in same window | 454 | `selected-window' Show new file in selected window |
| 455 | `otherwindow' Show new file in another window (same frame) | 455 | `other-window' Show new file in another window (same frame) |
| 456 | `display' Display file in another window without switching to it | 456 | `display' Display file in another window without selecting to it |
| 457 | `otherframe' Show new file in another frame | 457 | `other-frame' Show new file in another frame |
| 458 | `maybe-frame' If a file is visible in another frame, prompt to ask if you | 458 | `maybe-frame' If a file is visible in another frame, prompt to ask if you |
| 459 | you want to see the file in the same window of the current | 459 | you want to see the file in the same window of the current |
| 460 | frame or in the other frame | 460 | frame or in the other frame |
| 461 | `always-frame' If a file is visible in another frame, raise that | 461 | `raise-frame' If a file is visible in another frame, raise that |
| 462 | frame; otherwise, visit the file in the same window" | 462 | frame; otherwise, visit the file in the same window" |
| 463 | :type '(choice (const samewindow) | 463 | :type '(choice (const :tag "Visit in selected window" selected-window) |
| 464 | (const otherwindow) | 464 | (const :tag "Visit in other window" other-window) |
| 465 | (const display) | 465 | (const :tag "Display (no select) in other window" display) |
| 466 | (const otherframe) | 466 | (const :tag "Visit in other frame" other-frame) |
| 467 | (const maybe-frame) | 467 | (const :tag "Ask to visit in other frame" maybe-frame) |
| 468 | (const always-frame)) | 468 | (const :tag "Raise frame if already visited" raise-frame)) |
| 469 | :group 'ido) | 469 | :group 'ido) |
| 470 | 470 | ||
| 471 | (defcustom ido-default-buffer-method 'always-frame | 471 | (defcustom ido-default-buffer-method 'raise-frame |
| 472 | "*How to switch to new buffer when using `ido-switch-buffer'. | 472 | "*How to switch to new buffer when using `ido-switch-buffer'. |
| 473 | See `ido-default-file-method' for details." | 473 | See `ido-default-file-method' for details." |
| 474 | :type '(choice (const samewindow) | 474 | :type '(choice (const :tag "Show in selected window" selected-window) |
| 475 | (const otherwindow) | 475 | (const :tag "Show in other window" other-window) |
| 476 | (const :tag "Display (no select) in other window" display) | ||
| 477 | (const :tag "Show in other frame" other-frame) | ||
| 478 | (const :tag "Ask to show in other frame" maybe-frame) | ||
| 479 | (const :tag "Raise frame if already shown" raise-frame)) | ||
| 480 | :type '(choice (const selected-window) | ||
| 481 | (const other-window) | ||
| 476 | (const display) | 482 | (const display) |
| 477 | (const otherframe) | 483 | (const other-frame) |
| 478 | (const maybe-frame) | 484 | (const maybe-frame) |
| 479 | (const always-frame)) | 485 | (const raise-frame)) |
| 480 | :group 'ido) | 486 | :group 'ido) |
| 481 | 487 | ||
| 482 | (defcustom ido-enable-flex-matching nil | 488 | (defcustom ido-enable-flex-matching nil |
| @@ -1532,6 +1538,7 @@ With ARG, turn ido speed-up on if arg is positive, off otherwise." | |||
| 1532 | (define-key map "\C-t" 'ido-toggle-regexp) | 1538 | (define-key map "\C-t" 'ido-toggle-regexp) |
| 1533 | (define-key map "\C-z" 'ido-undo-merge-work-directory) | 1539 | (define-key map "\C-z" 'ido-undo-merge-work-directory) |
| 1534 | (define-key map [(control ?\s)] 'ido-restrict-to-matches) | 1540 | (define-key map [(control ?\s)] 'ido-restrict-to-matches) |
| 1541 | (define-key map [(meta ?\s)] 'ido-take-first-match) | ||
| 1535 | (define-key map [(control ?@)] 'ido-restrict-to-matches) | 1542 | (define-key map [(control ?@)] 'ido-restrict-to-matches) |
| 1536 | (define-key map [right] 'ido-next-match) | 1543 | (define-key map [right] 'ido-next-match) |
| 1537 | (define-key map [left] 'ido-prev-match) | 1544 | (define-key map [left] 'ido-prev-match) |
| @@ -1559,6 +1566,7 @@ With ARG, turn ido speed-up on if arg is positive, off otherwise." | |||
| 1559 | (define-key map "\C-l" 'ido-reread-directory) | 1566 | (define-key map "\C-l" 'ido-reread-directory) |
| 1560 | (define-key map [(meta ?d)] 'ido-wide-find-dir-or-delete-dir) | 1567 | (define-key map [(meta ?d)] 'ido-wide-find-dir-or-delete-dir) |
| 1561 | (define-key map [(meta ?b)] 'ido-push-dir) | 1568 | (define-key map [(meta ?b)] 'ido-push-dir) |
| 1569 | (define-key map [(meta ?v)] 'ido-push-dir-first) | ||
| 1562 | (define-key map [(meta ?f)] 'ido-wide-find-file-or-pop-dir) | 1570 | (define-key map [(meta ?f)] 'ido-wide-find-file-or-pop-dir) |
| 1563 | (define-key map [(meta ?k)] 'ido-forget-work-directory) | 1571 | (define-key map [(meta ?k)] 'ido-forget-work-directory) |
| 1564 | (define-key map [(meta ?m)] 'ido-make-directory) | 1572 | (define-key map [(meta ?m)] 'ido-make-directory) |
| @@ -2086,8 +2094,10 @@ If INITIAL is non-nil, it specifies the initial input string." | |||
| 2086 | (cons (cons ido-current-directory ido-selected) ido-last-directory-list))))) | 2094 | (cons (cons ido-current-directory ido-selected) ido-last-directory-list))))) |
| 2087 | (ido-set-current-directory ido-current-directory ido-selected) | 2095 | (ido-set-current-directory ido-current-directory ido-selected) |
| 2088 | (if ido-input-stack | 2096 | (if ido-input-stack |
| 2089 | (while ido-input-stack | 2097 | ; automatically pop stack elements which match existing files or directories |
| 2090 | (let ((elt (car ido-input-stack))) | 2098 | (let (elt) |
| 2099 | (while (and (setq elt (car ido-input-stack)) | ||
| 2100 | (file-exists-p (concat ido-current-directory (cdr elt)))) | ||
| 2091 | (if (setq ido-input-stack (cdr ido-input-stack)) | 2101 | (if (setq ido-input-stack (cdr ido-input-stack)) |
| 2092 | (ido-set-current-directory ido-current-directory (cdr elt)) | 2102 | (ido-set-current-directory ido-current-directory (cdr elt)) |
| 2093 | (setq ido-text-init (cdr elt))) | 2103 | (setq ido-text-init (cdr elt))) |
| @@ -2331,7 +2341,7 @@ If INITIAL is non-nil, it specifies the initial input string." | |||
| 2331 | (setq default-directory ido-current-directory) | 2341 | (setq default-directory ido-current-directory) |
| 2332 | (ido-record-command 'write-file (concat ido-current-directory filename)) | 2342 | (ido-record-command 'write-file (concat ido-current-directory filename)) |
| 2333 | (ido-record-work-directory) | 2343 | (ido-record-work-directory) |
| 2334 | (write-file filename)) | 2344 | (write-file (concat ido-current-directory filename))) |
| 2335 | 2345 | ||
| 2336 | ((eq method 'read-only) | 2346 | ((eq method 'read-only) |
| 2337 | (ido-record-work-file filename) | 2347 | (ido-record-work-file filename) |
| @@ -2799,12 +2809,28 @@ If input stack is non-empty, delete current directory component." | |||
| 2799 | (ido-delete-backward-word-updir 1) | 2809 | (ido-delete-backward-word-updir 1) |
| 2800 | (ido-wide-find-dir))) | 2810 | (ido-wide-find-dir))) |
| 2801 | 2811 | ||
| 2812 | (defun ido-take-first-match () | ||
| 2813 | "Use first matching item as input text." | ||
| 2814 | (interactive) | ||
| 2815 | (when ido-matches | ||
| 2816 | (setq ido-text-init (car ido-matches)) | ||
| 2817 | (setq ido-exit 'refresh) | ||
| 2818 | (exit-minibuffer))) | ||
| 2819 | |||
| 2802 | (defun ido-push-dir () | 2820 | (defun ido-push-dir () |
| 2803 | "Move to previous directory in file name, push current input on stack." | 2821 | "Move to previous directory in file name, push current input on stack." |
| 2804 | (interactive) | 2822 | (interactive) |
| 2805 | (setq ido-exit 'push) | 2823 | (setq ido-exit 'push) |
| 2806 | (exit-minibuffer)) | 2824 | (exit-minibuffer)) |
| 2807 | 2825 | ||
| 2826 | (defun ido-push-dir-first () | ||
| 2827 | "Move to previous directory in file name, push first match on stack." | ||
| 2828 | (interactive) | ||
| 2829 | (if ido-matches | ||
| 2830 | (setq ido-text (car ido-matches))) | ||
| 2831 | (setq ido-exit 'push) | ||
| 2832 | (exit-minibuffer)) | ||
| 2833 | |||
| 2808 | (defun ido-pop-dir (arg) | 2834 | (defun ido-pop-dir (arg) |
| 2809 | "Pop directory from input stack back to input. | 2835 | "Pop directory from input stack back to input. |
| 2810 | With \\[universal-argument], pop all element." | 2836 | With \\[universal-argument], pop all element." |
| @@ -2874,6 +2900,7 @@ If repeated, insert text from buffer instead." | |||
| 2874 | (when name | 2900 | (when name |
| 2875 | (setq ido-text-init | 2901 | (setq ido-text-init |
| 2876 | (if (or all | 2902 | (if (or all |
| 2903 | (eq last-command this-command) | ||
| 2877 | (not (equal (file-name-directory bfname) ido-current-directory)) | 2904 | (not (equal (file-name-directory bfname) ido-current-directory)) |
| 2878 | (not (string-match "\\.[^.]*\\'" name))) | 2905 | (not (string-match "\\.[^.]*\\'" name))) |
| 2879 | name | 2906 | name |
| @@ -3742,7 +3769,7 @@ for first matching file." | |||
| 3742 | 3769 | ||
| 3743 | ;;; VISIT CHOSEN BUFFER | 3770 | ;;; VISIT CHOSEN BUFFER |
| 3744 | (defun ido-visit-buffer (buffer method &optional record) | 3771 | (defun ido-visit-buffer (buffer method &optional record) |
| 3745 | "Visit file named FILE according to METHOD. | 3772 | "Switch to BUFFER according to METHOD. |
| 3746 | Record command in `command-history' if optional RECORD is non-nil." | 3773 | Record command in `command-history' if optional RECORD is non-nil." |
| 3747 | 3774 | ||
| 3748 | (let (win newframe) | 3775 | (let (win newframe) |
| @@ -3752,33 +3779,7 @@ Record command in `command-history' if optional RECORD is non-nil." | |||
| 3752 | (ido-record-command 'kill-buffer buffer)) | 3779 | (ido-record-command 'kill-buffer buffer)) |
| 3753 | (kill-buffer buffer)) | 3780 | (kill-buffer buffer)) |
| 3754 | 3781 | ||
| 3755 | ((eq method 'samewindow) | 3782 | ((eq method 'other-window) |
| 3756 | (if record | ||
| 3757 | (ido-record-command 'switch-to-buffer buffer)) | ||
| 3758 | (switch-to-buffer buffer)) | ||
| 3759 | |||
| 3760 | ((memq method '(always-frame maybe-frame)) | ||
| 3761 | (cond | ||
| 3762 | ((and window-system | ||
| 3763 | (setq win (ido-window-buffer-p buffer)) | ||
| 3764 | (or (eq method 'always-frame) | ||
| 3765 | (y-or-n-p "Jump to frame? "))) | ||
| 3766 | (setq newframe (window-frame win)) | ||
| 3767 | (if (fboundp 'select-frame-set-input-focus) | ||
| 3768 | (select-frame-set-input-focus newframe) | ||
| 3769 | (raise-frame newframe) | ||
| 3770 | (select-frame newframe) | ||
| 3771 | (unless (featurep 'xemacs) | ||
| 3772 | (set-mouse-position (selected-frame) (1- (frame-width)) 0))) | ||
| 3773 | (select-window win)) | ||
| 3774 | (t | ||
| 3775 | ;; No buffer in other frames... | ||
| 3776 | (if record | ||
| 3777 | (ido-record-command 'switch-to-buffer buffer)) | ||
| 3778 | (switch-to-buffer buffer) | ||
| 3779 | ))) | ||
| 3780 | |||
| 3781 | ((eq method 'otherwindow) | ||
| 3782 | (if record | 3783 | (if record |
| 3783 | (ido-record-command 'switch-to-buffer buffer)) | 3784 | (ido-record-command 'switch-to-buffer buffer)) |
| 3784 | (switch-to-buffer-other-window buffer)) | 3785 | (switch-to-buffer-other-window buffer)) |
| @@ -3786,14 +3787,29 @@ Record command in `command-history' if optional RECORD is non-nil." | |||
| 3786 | ((eq method 'display) | 3787 | ((eq method 'display) |
| 3787 | (display-buffer buffer)) | 3788 | (display-buffer buffer)) |
| 3788 | 3789 | ||
| 3789 | ((eq method 'otherframe) | 3790 | ((eq method 'other-frame) |
| 3790 | (switch-to-buffer-other-frame buffer) | 3791 | (switch-to-buffer-other-frame buffer) |
| 3791 | (unless (featurep 'xemacs) | 3792 | (select-frame-set-input-focus (selected-frame))) |
| 3792 | (select-frame-set-input-focus (selected-frame))) | 3793 | |
| 3794 | ((and (memq method '(raise-frame maybe-frame)) | ||
| 3795 | window-system | ||
| 3796 | (setq win (ido-buffer-window-other-frame buffer)) | ||
| 3797 | (or (eq method 'raise-frame) | ||
| 3798 | (y-or-n-p "Jump to frame? "))) | ||
| 3799 | (setq newframe (window-frame win)) | ||
| 3800 | (select-frame-set-input-focus newframe) | ||
| 3801 | (select-window win)) | ||
| 3802 | |||
| 3803 | ;; (eq method 'selected-window) | ||
| 3804 | (t | ||
| 3805 | ;; No buffer in other frames... | ||
| 3806 | (if record | ||
| 3807 | (ido-record-command 'switch-to-buffer buffer)) | ||
| 3808 | (switch-to-buffer buffer) | ||
| 3793 | )))) | 3809 | )))) |
| 3794 | 3810 | ||
| 3795 | 3811 | ||
| 3796 | (defun ido-window-buffer-p (buffer) | 3812 | (defun ido-buffer-window-other-frame (buffer) |
| 3797 | ;; Return window pointer if BUFFER is visible in another frame. | 3813 | ;; Return window pointer if BUFFER is visible in another frame. |
| 3798 | ;; If BUFFER is visible in the current frame, return nil. | 3814 | ;; If BUFFER is visible in the current frame, return nil. |
| 3799 | (let ((blist (ido-get-buffers-in-frames 'current))) | 3815 | (let ((blist (ido-get-buffers-in-frames 'current))) |
| @@ -3850,7 +3866,7 @@ in a separate window. | |||
| 3850 | The buffer name is selected interactively by typing a substring. | 3866 | The buffer name is selected interactively by typing a substring. |
| 3851 | For details of keybindings, do `\\[describe-function] ido'." | 3867 | For details of keybindings, do `\\[describe-function] ido'." |
| 3852 | (interactive) | 3868 | (interactive) |
| 3853 | (ido-buffer-internal 'otherwindow 'switch-to-buffer-other-window)) | 3869 | (ido-buffer-internal 'other-window 'switch-to-buffer-other-window)) |
| 3854 | 3870 | ||
| 3855 | ;;;###autoload | 3871 | ;;;###autoload |
| 3856 | (defun ido-display-buffer () | 3872 | (defun ido-display-buffer () |
| @@ -3883,7 +3899,7 @@ The buffer name is selected interactively by typing a substring. | |||
| 3883 | For details of keybindings, do `\\[describe-function] ido'." | 3899 | For details of keybindings, do `\\[describe-function] ido'." |
| 3884 | (interactive) | 3900 | (interactive) |
| 3885 | (if ido-mode | 3901 | (if ido-mode |
| 3886 | (ido-buffer-internal 'otherframe) | 3902 | (ido-buffer-internal 'other-frame) |
| 3887 | (call-interactively 'switch-to-buffer-other-frame))) | 3903 | (call-interactively 'switch-to-buffer-other-frame))) |
| 3888 | 3904 | ||
| 3889 | ;;;###autoload | 3905 | ;;;###autoload |
| @@ -3945,7 +3961,7 @@ in a separate window. | |||
| 3945 | The file name is selected interactively by typing a substring. | 3961 | The file name is selected interactively by typing a substring. |
| 3946 | For details of keybindings, do `\\[describe-function] ido-find-file'." | 3962 | For details of keybindings, do `\\[describe-function] ido-find-file'." |
| 3947 | (interactive) | 3963 | (interactive) |
| 3948 | (ido-file-internal 'otherwindow 'find-file-other-window)) | 3964 | (ido-file-internal 'other-window 'find-file-other-window)) |
| 3949 | 3965 | ||
| 3950 | ;;;###autoload | 3966 | ;;;###autoload |
| 3951 | (defun ido-find-alternate-file () | 3967 | (defun ido-find-alternate-file () |
| @@ -3993,7 +4009,7 @@ For details of keybindings, do `\\[describe-function] ido-find-file'." | |||
| 3993 | The file name is selected interactively by typing a substring. | 4009 | The file name is selected interactively by typing a substring. |
| 3994 | For details of keybindings, do `\\[describe-function] ido-find-file'." | 4010 | For details of keybindings, do `\\[describe-function] ido-find-file'." |
| 3995 | (interactive) | 4011 | (interactive) |
| 3996 | (ido-file-internal 'otherframe 'find-file-other-frame)) | 4012 | (ido-file-internal 'other-frame 'find-file-other-frame)) |
| 3997 | 4013 | ||
| 3998 | ;;;###autoload | 4014 | ;;;###autoload |
| 3999 | (defun ido-write-file () | 4015 | (defun ido-write-file () |
diff --git a/lisp/image-mode.el b/lisp/image-mode.el index 1a55676e3c7..66d7fb6c16a 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el | |||
| @@ -139,6 +139,7 @@ and showing the image as an image." | |||
| 139 | ;; was inserted | 139 | ;; was inserted |
| 140 | (let* ((image | 140 | (let* ((image |
| 141 | (if (and (buffer-file-name) | 141 | (if (and (buffer-file-name) |
| 142 | (not (file-remote-p (buffer-file-name))) | ||
| 142 | (not (buffer-modified-p)) | 143 | (not (buffer-modified-p)) |
| 143 | (not (and (boundp 'archive-superior-buffer) | 144 | (not (and (boundp 'archive-superior-buffer) |
| 144 | archive-superior-buffer)) | 145 | archive-superior-buffer)) |
diff --git a/lisp/info.el b/lisp/info.el index 2737999b090..2669b709316 100644 --- a/lisp/info.el +++ b/lisp/info.el | |||
| @@ -2866,8 +2866,11 @@ Give an empty topic name to go to the Index node itself." | |||
| 2866 | (car (car Info-index-alternatives)) | 2866 | (car (car Info-index-alternatives)) |
| 2867 | (nth 2 (car Info-index-alternatives)) | 2867 | (nth 2 (car Info-index-alternatives)) |
| 2868 | (if (cdr Info-index-alternatives) | 2868 | (if (cdr Info-index-alternatives) |
| 2869 | (format "(%s total; use `,' for next)" | 2869 | (format "(%s total; use `%s' for next)" |
| 2870 | (length Info-index-alternatives)) | 2870 | (length Info-index-alternatives) |
| 2871 | (key-description (where-is-internal | ||
| 2872 | 'Info-index-next overriding-local-map | ||
| 2873 | t))) | ||
| 2871 | "(Only match)"))) | 2874 | "(Only match)"))) |
| 2872 | 2875 | ||
| 2873 | (defun Info-find-index-name (name) | 2876 | (defun Info-find-index-name (name) |
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index c666669d797..c50afd2de74 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el | |||
| @@ -70,8 +70,7 @@ | |||
| 70 | (make-sparse-keymap "Set Coding System")) | 70 | (make-sparse-keymap "Set Coding System")) |
| 71 | 71 | ||
| 72 | (define-key-after mule-menu-keymap [set-language-environment] | 72 | (define-key-after mule-menu-keymap [set-language-environment] |
| 73 | (list 'menu-item "Set Language Environment" setup-language-environment-map | 73 | (list 'menu-item "Set Language Environment" setup-language-environment-map)) |
| 74 | :help "Multilingual environment suitable for a specific language")) | ||
| 75 | (define-key-after mule-menu-keymap [separator-mule] | 74 | (define-key-after mule-menu-keymap [separator-mule] |
| 76 | '("--") | 75 | '("--") |
| 77 | t) | 76 | t) |
diff --git a/lisp/international/mule.el b/lisp/international/mule.el index 1c7d8b08062..4d2d22c51c0 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el | |||
| @@ -98,9 +98,9 @@ Return t if file exists." | |||
| 98 | )) | 98 | )) |
| 99 | (let (kill-buffer-hook kill-buffer-query-functions) | 99 | (let (kill-buffer-hook kill-buffer-query-functions) |
| 100 | (kill-buffer buffer))) | 100 | (kill-buffer buffer))) |
| 101 | (let ((hook (assoc file after-load-alist))) | 101 | (unless purify-flag |
| 102 | (when hook | 102 | (do-after-load-evaluation fullname)) |
| 103 | (mapcar (function eval) (cdr hook)))) | 103 | |
| 104 | (unless (or nomessage noninteractive) | 104 | (unless (or nomessage noninteractive) |
| 105 | (if source | 105 | (if source |
| 106 | (message "Loading %s (source)...done" file) | 106 | (message "Loading %s (source)...done" file) |
| @@ -1662,6 +1662,9 @@ This is used for loading and byte-compiling Emacs Lisp files.") | |||
| 1662 | (setq alist (cdr alist)))) | 1662 | (setq alist (cdr alist)))) |
| 1663 | coding-system)) | 1663 | coding-system)) |
| 1664 | 1664 | ||
| 1665 | (put 'enable-character-translation 'permanent-local t) | ||
| 1666 | (put 'enable-character-translation 'safe-local-variable 'booleanp) | ||
| 1667 | |||
| 1665 | (defun find-auto-coding (filename size) | 1668 | (defun find-auto-coding (filename size) |
| 1666 | "Find a coding system for a file FILENAME of which SIZE bytes follow point. | 1669 | "Find a coding system for a file FILENAME of which SIZE bytes follow point. |
| 1667 | These bytes should include at least the first 1k of the file | 1670 | These bytes should include at least the first 1k of the file |
| @@ -1699,17 +1702,21 @@ If nothing is specified, the return value is nil." | |||
| 1699 | (head-end (+ head-start (min size 1024))) | 1702 | (head-end (+ head-start (min size 1024))) |
| 1700 | (tail-start (+ head-start (max (- size 3072) 0))) | 1703 | (tail-start (+ head-start (max (- size 3072) 0))) |
| 1701 | (tail-end (+ head-start size)) | 1704 | (tail-end (+ head-start size)) |
| 1702 | coding-system head-found tail-found pos) | 1705 | coding-system head-found tail-found pos char-trans) |
| 1703 | ;; Try a short cut by searching for the string "coding:" | 1706 | ;; Try a short cut by searching for the string "coding:" |
| 1704 | ;; and for "unibyte:" at the head and tail of SIZE bytes. | 1707 | ;; and for "unibyte:" at the head and tail of SIZE bytes. |
| 1705 | (setq head-found (or (search-forward "coding:" head-end t) | 1708 | (setq head-found (or (search-forward "coding:" head-end t) |
| 1706 | (search-forward "unibyte:" head-end t))) | 1709 | (search-forward "unibyte:" head-end t) |
| 1710 | (search-forward "enable-character-translation:" | ||
| 1711 | head-end t))) | ||
| 1707 | (if (and head-found (> head-found tail-start)) | 1712 | (if (and head-found (> head-found tail-start)) |
| 1708 | ;; Head and tail are overlapped. | 1713 | ;; Head and tail are overlapped. |
| 1709 | (setq tail-found head-found) | 1714 | (setq tail-found head-found) |
| 1710 | (goto-char tail-start) | 1715 | (goto-char tail-start) |
| 1711 | (setq tail-found (or (search-forward "coding:" tail-end t) | 1716 | (setq tail-found (or (search-forward "coding:" tail-end t) |
| 1712 | (search-forward "unibyte:" tail-end t)))) | 1717 | (search-forward "unibyte:" tail-end t) |
| 1718 | (search-forward "enable-character-translation:" | ||
| 1719 | tail-end t)))) | ||
| 1713 | 1720 | ||
| 1714 | ;; At first check the head. | 1721 | ;; At first check the head. |
| 1715 | (when head-found | 1722 | (when head-found |
| @@ -1727,12 +1734,16 @@ If nothing is specified, the return value is nil." | |||
| 1727 | (re-search-forward | 1734 | (re-search-forward |
| 1728 | "\\(.*;\\)?[ \t]*coding:[ \t]*\\([^ ;]+\\)" | 1735 | "\\(.*;\\)?[ \t]*coding:[ \t]*\\([^ ;]+\\)" |
| 1729 | head-end t)) | 1736 | head-end t)) |
| 1730 | (setq coding-system (intern (match-string 2)))))) | 1737 | (setq coding-system (intern (match-string 2)))) |
| 1738 | (when (re-search-forward | ||
| 1739 | "\\(.*;\\)?[ \t]*enable-character-translation:[ \t]*\\([^ ;]+\\)" | ||
| 1740 | head-end t) | ||
| 1741 | (setq char-trans (match-string 2))))) | ||
| 1731 | 1742 | ||
| 1732 | ;; If no coding: tag in the head, check the tail. | 1743 | ;; If no coding: tag in the head, check the tail. |
| 1733 | ;; Here we must pay attention to the case that the end-of-line | 1744 | ;; Here we must pay attention to the case that the end-of-line |
| 1734 | ;; is just "\r" and we can't use "^" nor "$" in regexp. | 1745 | ;; is just "\r" and we can't use "^" nor "$" in regexp. |
| 1735 | (when (and tail-found (not coding-system)) | 1746 | (when (and tail-found (or (not coding-system) (not char-trans))) |
| 1736 | (goto-char tail-start) | 1747 | (goto-char tail-start) |
| 1737 | (re-search-forward "[\r\n]\^L" nil t) | 1748 | (re-search-forward "[\r\n]\^L" nil t) |
| 1738 | (if (re-search-forward | 1749 | (if (re-search-forward |
| @@ -1755,6 +1766,11 @@ If nothing is specified, the return value is nil." | |||
| 1755 | "[\r\n]" prefix | 1766 | "[\r\n]" prefix |
| 1756 | "[ \t]*unibyte[ \t]*:[ \t]*\\([^ \t\r\n]+\\)[ \t]*" | 1767 | "[ \t]*unibyte[ \t]*:[ \t]*\\([^ \t\r\n]+\\)[ \t]*" |
| 1757 | suffix "[\r\n]")) | 1768 | suffix "[\r\n]")) |
| 1769 | (re-char-trans | ||
| 1770 | (concat | ||
| 1771 | "[\r\n]" prefix | ||
| 1772 | "[ \t]*enable-character-translation[ \t]*:[ \t]*\\([^ \t\r\n]+\\)[ \t]*" | ||
| 1773 | suffix "[\r\n]")) | ||
| 1758 | (re-end | 1774 | (re-end |
| 1759 | (concat "[\r\n]" prefix "[ \t]*End *:[ \t]*" suffix | 1775 | (concat "[\r\n]" prefix "[ \t]*End *:[ \t]*" suffix |
| 1760 | "[\r\n]?")) | 1776 | "[\r\n]?")) |
| @@ -1768,7 +1784,21 @@ If nothing is specified, the return value is nil." | |||
| 1768 | (setq coding-system 'raw-text)) | 1784 | (setq coding-system 'raw-text)) |
| 1769 | (when (and (not coding-system) | 1785 | (when (and (not coding-system) |
| 1770 | (re-search-forward re-coding tail-end t)) | 1786 | (re-search-forward re-coding tail-end t)) |
| 1771 | (setq coding-system (intern (match-string 1))))))) | 1787 | (setq coding-system (intern (match-string 1)))) |
| 1788 | (when (and (not char-trans) | ||
| 1789 | (re-search-forward re-char-trans tail-end t)) | ||
| 1790 | (setq char-trans (match-string 1)))))) | ||
| 1791 | (if coding-system | ||
| 1792 | ;; If the coding-system name ends with "!", remove it and | ||
| 1793 | ;; set char-trans to "nil". | ||
| 1794 | (let ((name (symbol-name coding-system))) | ||
| 1795 | (if (= (aref name (1- (length name))) ?!) | ||
| 1796 | (setq coding-system (intern (substring name 0 -1)) | ||
| 1797 | char-trans "nil")))) | ||
| 1798 | (when (and char-trans | ||
| 1799 | (not (setq char-trans (intern char-trans)))) | ||
| 1800 | (make-local-variable 'enable-character-translation) | ||
| 1801 | (setq enable-character-translation nil)) | ||
| 1772 | (if coding-system | 1802 | (if coding-system |
| 1773 | (cons coding-system :coding))) | 1803 | (cons coding-system :coding))) |
| 1774 | ;; Finally, try all the `auto-coding-functions'. | 1804 | ;; Finally, try all the `auto-coding-functions'. |
| @@ -1993,7 +2023,8 @@ Part of the job of this function is setting `buffer-undo-list' appropriately." | |||
| 1993 | (or coding | 2023 | (or coding |
| 1994 | (setq coding (car (find-operation-coding-system | 2024 | (setq coding (car (find-operation-coding-system |
| 1995 | 'insert-file-contents | 2025 | 'insert-file-contents |
| 1996 | filename visit beg end replace)))) | 2026 | (cons filename (current-buffer)) |
| 2027 | visit beg end replace)))) | ||
| 1997 | (if (coding-system-p coding) | 2028 | (if (coding-system-p coding) |
| 1998 | (or enable-multibyte-characters | 2029 | (or enable-multibyte-characters |
| 1999 | (setq coding | 2030 | (setq coding |
| @@ -2260,18 +2291,19 @@ This function is intended to be added to `auto-coding-functions'." | |||
| 2260 | "If the buffer has an HTML meta tag, use it to determine encoding. | 2291 | "If the buffer has an HTML meta tag, use it to determine encoding. |
| 2261 | This function is intended to be added to `auto-coding-functions'." | 2292 | This function is intended to be added to `auto-coding-functions'." |
| 2262 | (setq size (min (+ (point) size) | 2293 | (setq size (min (+ (point) size) |
| 2263 | ;; Only search forward 10 lines | ||
| 2264 | (save-excursion | 2294 | (save-excursion |
| 2265 | (forward-line 10) | 2295 | ;; Limit the search by the end of the HTML header. |
| 2296 | (or (search-forward "</head>" size t) | ||
| 2297 | ;; In case of no header, search only 10 lines. | ||
| 2298 | (forward-line 10)) | ||
| 2266 | (point)))) | 2299 | (point)))) |
| 2267 | (when (and (search-forward "<html" size t) | 2300 | (when (re-search-forward "<meta\\s-+http-equiv=[\"']?content-type[\"']?\\s-+content=[\"']text/\\sw+;\\s-*charset=\\(.+?\\)[\"']" size t) |
| 2268 | (re-search-forward "<meta\\s-+http-equiv=\"content-type\"\\s-+content=\"text/\\sw+;\\s-*charset=\\(.+?\\)\"" size t)) | 2301 | (let* ((match (match-string 1)) |
| 2269 | (let* ((match (match-string 1)) | 2302 | (sym (intern (downcase match)))) |
| 2270 | (sym (intern (downcase match)))) | 2303 | (if (coding-system-p sym) |
| 2271 | (if (coding-system-p sym) | 2304 | sym |
| 2272 | sym | 2305 | (message "Warning: unknown coding system \"%s\"" match) |
| 2273 | (message "Warning: unknown coding system \"%s\"" match) | 2306 | nil)))) |
| 2274 | nil)))) | ||
| 2275 | 2307 | ||
| 2276 | ;;; | 2308 | ;;; |
| 2277 | (provide 'mule) | 2309 | (provide 'mule) |
diff --git a/lisp/language/ethio-util.el b/lisp/language/ethio-util.el index 413ad3c3183..7b950dccd80 100644 --- a/lisp/language/ethio-util.el +++ b/lisp/language/ethio-util.el | |||
| @@ -1786,7 +1786,7 @@ Each command is always surrounded by braces." | |||
| 1786 | (defun ethio-fidel-to-java-buffer nil | 1786 | (defun ethio-fidel-to-java-buffer nil |
| 1787 | "Convert Ethiopic characters into the Java escape sequences. | 1787 | "Convert Ethiopic characters into the Java escape sequences. |
| 1788 | 1788 | ||
| 1789 | Each escape sequence is of the form \uXXXX, where XXXX is the | 1789 | Each escape sequence is of the form \\uXXXX, where XXXX is the |
| 1790 | character's codepoint (in hex) in Unicode. | 1790 | character's codepoint (in hex) in Unicode. |
| 1791 | 1791 | ||
| 1792 | If `ethio-java-save-lowercase' is non-nil, use [0-9a-f]. | 1792 | If `ethio-java-save-lowercase' is non-nil, use [0-9a-f]. |
diff --git a/lisp/loadup.el b/lisp/loadup.el index 4cee6fd656a..aa019a8fbcc 100644 --- a/lisp/loadup.el +++ b/lisp/loadup.el | |||
| @@ -83,6 +83,7 @@ | |||
| 83 | 83 | ||
| 84 | (load "help") | 84 | (load "help") |
| 85 | 85 | ||
| 86 | (load "jka-cmpr-hook") | ||
| 86 | ;; Any Emacs Lisp source file (*.el) loaded here after can contain | 87 | ;; Any Emacs Lisp source file (*.el) loaded here after can contain |
| 87 | ;; multilingual text. | 88 | ;; multilingual text. |
| 88 | (load "international/mule-cmds") | 89 | (load "international/mule-cmds") |
| @@ -211,7 +212,6 @@ | |||
| 211 | (message "%s" (garbage-collect)) | 212 | (message "%s" (garbage-collect)) |
| 212 | 213 | ||
| 213 | (load "vc-hooks") | 214 | (load "vc-hooks") |
| 214 | (load "jka-cmpr-hook") | ||
| 215 | (load "ediff-hook") | 215 | (load "ediff-hook") |
| 216 | (if (fboundp 'x-show-tip) (load "tooltip")) | 216 | (if (fboundp 'x-show-tip) (load "tooltip")) |
| 217 | 217 | ||
diff --git a/lisp/makefile.w32-in b/lisp/makefile.w32-in index 15fab808381..6c5a68d9ec7 100644 --- a/lisp/makefile.w32-in +++ b/lisp/makefile.w32-in | |||
| @@ -33,7 +33,7 @@ srcdir = $(CURDIR)/.. | |||
| 33 | # You can specify a different executable on the make command line, | 33 | # You can specify a different executable on the make command line, |
| 34 | # e.g. "make EMACS=../src/emacs ...". | 34 | # e.g. "make EMACS=../src/emacs ...". |
| 35 | 35 | ||
| 36 | EMACS = "$(THISDIR)/../bin/emacs.exe" | 36 | EMACS = $(THISDIR)/../bin/emacs.exe |
| 37 | 37 | ||
| 38 | # Command line flags for Emacs. This must include --multibyte, | 38 | # Command line flags for Emacs. This must include --multibyte, |
| 39 | # otherwise some files will not compile. | 39 | # otherwise some files will not compile. |
| @@ -61,8 +61,11 @@ COMPILE_FIRST = \ | |||
| 61 | $(lisp)/progmodes/cc-vars.el | 61 | $(lisp)/progmodes/cc-vars.el |
| 62 | 62 | ||
| 63 | # The actual Emacs command run in the targets below. | 63 | # The actual Emacs command run in the targets below. |
| 64 | # The quotes around $(EMACS) are here because the user could type | ||
| 65 | # it with forward slashes and without quotes, which will fail if | ||
| 66 | # the shell is cmd.exe. | ||
| 64 | 67 | ||
| 65 | emacs = $(EMACS) $(EMACSOPT) | 68 | emacs = "$(EMACS)" $(EMACSOPT) |
| 66 | 69 | ||
| 67 | # Common command to find subdirectories | 70 | # Common command to find subdirectories |
| 68 | 71 | ||
| @@ -317,7 +320,7 @@ $(lisp)/mh-e/mh-loaddefs.el: $(MH_E_SRC) | |||
| 317 | $(MAKE) $(MFLAGS) pre-mh-loaddefs.el-$(SHELLTYPE) | 320 | $(MAKE) $(MFLAGS) pre-mh-loaddefs.el-$(SHELLTYPE) |
| 318 | cp pre-mh-loaddefs.el-$(SHELLTYPE) $@ | 321 | cp pre-mh-loaddefs.el-$(SHELLTYPE) $@ |
| 319 | rm pre-mh-loaddefs.el-$(SHELLTYPE) | 322 | rm pre-mh-loaddefs.el-$(SHELLTYPE) |
| 320 | $(EMACS) $(EMACSOPT) \ | 323 | "$(EMACS)" $(EMACSOPT) \ |
| 321 | -l autoload \ | 324 | -l autoload \ |
| 322 | --eval "(setq generate-autoload-cookie \";;;###mh-autoload\")" \ | 325 | --eval "(setq generate-autoload-cookie \";;;###mh-autoload\")" \ |
| 323 | --eval "(setq find-file-suppress-same-file-warnings t)" \ | 326 | --eval "(setq find-file-suppress-same-file-warnings t)" \ |
| @@ -378,12 +381,12 @@ pre-mh-loaddefs.el-CMD: | |||
| 378 | bootstrap-clean: bootstrap-clean-$(SHELLTYPE) $(lisp)/loaddefs.el | 381 | bootstrap-clean: bootstrap-clean-$(SHELLTYPE) $(lisp)/loaddefs.el |
| 379 | 382 | ||
| 380 | bootstrap-clean-CMD: | 383 | bootstrap-clean-CMD: |
| 381 | # if exist $(EMACS) $(MAKE) $(MFLAGS) autoloads | 384 | # if exist "$(EMACS)" $(MAKE) $(MFLAGS) autoloads |
| 382 | cp $(lisp)/ldefs-boot.el $(lisp)/loaddefs.el | 385 | cp $(lisp)/ldefs-boot.el $(lisp)/loaddefs.el |
| 383 | -for %%f in (. $(WINS)) do for %%g in (%%f\*.elc) do @$(DEL) %%g | 386 | -for %%f in (. $(WINS)) do for %%g in (%%f\*.elc) do @$(DEL) %%g |
| 384 | 387 | ||
| 385 | bootstrap-clean-SH: | 388 | bootstrap-clean-SH: |
| 386 | # if test -f $(EMACS); then $(MAKE) $(MFLAGS) autoloads; fi | 389 | # if test -f "$(EMACS)"; then $(MAKE) $(MFLAGS) autoloads; fi |
| 387 | # -rm -f $(lisp)/*.elc $(lisp)/*/*.elc | 390 | # -rm -f $(lisp)/*.elc $(lisp)/*/*.elc |
| 388 | cp $(lisp)/ldefs-boot.el $(lisp)/loaddefs.el | 391 | cp $(lisp)/ldefs-boot.el $(lisp)/loaddefs.el |
| 389 | -for dir in . $(WINS); do rm -f $$dir/*.elc; done | 392 | -for dir in . $(WINS); do rm -f $$dir/*.elc; done |
| @@ -393,7 +396,7 @@ bootstrap-clean-SH: | |||
| 393 | # it will not be mistaken for an installed binary. | 396 | # it will not be mistaken for an installed binary. |
| 394 | 397 | ||
| 395 | bootstrap: update-subdirs autoloads mh-autoloads compile finder-data custom-deps | 398 | bootstrap: update-subdirs autoloads mh-autoloads compile finder-data custom-deps |
| 396 | - $(DEL) $(EMACS) | 399 | - $(DEL) "$(EMACS)" |
| 397 | 400 | ||
| 398 | # | 401 | # |
| 399 | # Assuming INSTALL_DIR is defined, copy the elisp files to it | 402 | # Assuming INSTALL_DIR is defined, copy the elisp files to it |
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 9615e2e7ff1..598c18128c9 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el | |||
| @@ -300,8 +300,7 @@ A large number or nil slows down menu responsiveness." | |||
| 300 | 300 | ||
| 301 | 301 | ||
| 302 | (define-key menu-bar-search-menu [i-search] | 302 | (define-key menu-bar-search-menu [i-search] |
| 303 | (list 'menu-item "Incremental Search" menu-bar-i-search-menu | 303 | (list 'menu-item "Incremental Search" menu-bar-i-search-menu)) |
| 304 | :help "Incremental Search finds partial matches while you type the search string.\nIt is most convenient from the keyboard. Try it!")) | ||
| 305 | (define-key menu-bar-search-menu [separator-tag-isearch] | 304 | (define-key menu-bar-search-menu [separator-tag-isearch] |
| 306 | '(menu-item "--")) | 305 | '(menu-item "--")) |
| 307 | 306 | ||
| @@ -369,8 +368,7 @@ A large number or nil slows down menu responsiveness." | |||
| 369 | 368 | ||
| 370 | ;;; Assemble the top-level Edit menu items. | 369 | ;;; Assemble the top-level Edit menu items. |
| 371 | (define-key menu-bar-edit-menu [props] | 370 | (define-key menu-bar-edit-menu [props] |
| 372 | '(menu-item "Text Properties" facemenu-menu | 371 | '(menu-item "Text Properties" facemenu-menu)) |
| 373 | :help "Change properties of text in region")) | ||
| 374 | 372 | ||
| 375 | (define-key menu-bar-edit-menu [fill] | 373 | (define-key menu-bar-edit-menu [fill] |
| 376 | '(menu-item "Fill" fill-region | 374 | '(menu-item "Fill" fill-region |
| @@ -382,8 +380,7 @@ A large number or nil slows down menu responsiveness." | |||
| 382 | '(menu-item "--")) | 380 | '(menu-item "--")) |
| 383 | 381 | ||
| 384 | (define-key menu-bar-edit-menu [bookmark] | 382 | (define-key menu-bar-edit-menu [bookmark] |
| 385 | '(menu-item "Bookmarks" menu-bar-bookmark-map | 383 | '(menu-item "Bookmarks" menu-bar-bookmark-map)) |
| 386 | :help "Record positions and jump between them")) | ||
| 387 | 384 | ||
| 388 | (defvar menu-bar-goto-menu (make-sparse-keymap "Go To")) | 385 | (defvar menu-bar-goto-menu (make-sparse-keymap "Go To")) |
| 389 | 386 | ||
| @@ -467,8 +464,7 @@ A large number or nil slows down menu responsiveness." | |||
| 467 | (fset 'yank-menu (cons 'keymap yank-menu)) | 464 | (fset 'yank-menu (cons 'keymap yank-menu)) |
| 468 | (define-key menu-bar-edit-menu [select-paste] | 465 | (define-key menu-bar-edit-menu [select-paste] |
| 469 | '(menu-item "Select and Paste" yank-menu | 466 | '(menu-item "Select and Paste" yank-menu |
| 470 | :enable (and (cdr yank-menu) (not buffer-read-only)) | 467 | :enable (and (cdr yank-menu) (not buffer-read-only)))) |
| 471 | :help "Paste (yank) text cut or copied earlier")) | ||
| 472 | (define-key menu-bar-edit-menu [paste] | 468 | (define-key menu-bar-edit-menu [paste] |
| 473 | '(menu-item "Paste" yank | 469 | '(menu-item "Paste" yank |
| 474 | :enable (and | 470 | :enable (and |
| @@ -641,8 +637,7 @@ by \"Save Options\" in Custom buffers.") | |||
| 641 | 637 | ||
| 642 | ;;; Assemble all the top-level items of the "Options" menu | 638 | ;;; Assemble all the top-level items of the "Options" menu |
| 643 | (define-key menu-bar-options-menu [customize] | 639 | (define-key menu-bar-options-menu [customize] |
| 644 | (list 'menu-item "Customize Emacs" menu-bar-custom-menu | 640 | (list 'menu-item "Customize Emacs" menu-bar-custom-menu)) |
| 645 | :help "Full customization of every Emacs feature")) | ||
| 646 | 641 | ||
| 647 | (defun menu-bar-options-save () | 642 | (defun menu-bar-options-save () |
| 648 | "Save current values of Options menu items using Custom." | 643 | "Save current values of Options menu items using Custom." |
| @@ -880,8 +875,7 @@ mail status in mode line")) | |||
| 880 | 875 | ||
| 881 | (define-key menu-bar-showhide-menu [showhide-fringe] | 876 | (define-key menu-bar-showhide-menu [showhide-fringe] |
| 882 | (list 'menu-item "Fringe" menu-bar-showhide-fringe-menu | 877 | (list 'menu-item "Fringe" menu-bar-showhide-fringe-menu |
| 883 | :visible `(display-graphic-p) | 878 | :visible `(display-graphic-p))) |
| 884 | :help "Select fringe mode")) | ||
| 885 | 879 | ||
| 886 | (defvar menu-bar-showhide-scroll-bar-menu (make-sparse-keymap "Scroll-bar")) | 880 | (defvar menu-bar-showhide-scroll-bar-menu (make-sparse-keymap "Scroll-bar")) |
| 887 | 881 | ||
| @@ -925,8 +919,7 @@ mail status in mode line")) | |||
| 925 | 919 | ||
| 926 | (define-key menu-bar-showhide-menu [showhide-scroll-bar] | 920 | (define-key menu-bar-showhide-menu [showhide-scroll-bar] |
| 927 | (list 'menu-item "Scroll-bar" menu-bar-showhide-scroll-bar-menu | 921 | (list 'menu-item "Scroll-bar" menu-bar-showhide-scroll-bar-menu |
| 928 | :visible `(display-graphic-p) | 922 | :visible `(display-graphic-p))) |
| 929 | :help "Select scroll-bar mode")) | ||
| 930 | 923 | ||
| 931 | (define-key menu-bar-showhide-menu [showhide-tooltip-mode] | 924 | (define-key menu-bar-showhide-menu [showhide-tooltip-mode] |
| 932 | (list 'menu-item "Tooltips" 'tooltip-mode | 925 | (list 'menu-item "Tooltips" 'tooltip-mode |
| @@ -946,8 +939,7 @@ mail status in mode line")) | |||
| 946 | :button `(:toggle . (> (frame-parameter nil 'tool-bar-lines) 0)))) | 939 | :button `(:toggle . (> (frame-parameter nil 'tool-bar-lines) 0)))) |
| 947 | 940 | ||
| 948 | (define-key menu-bar-options-menu [showhide] | 941 | (define-key menu-bar-options-menu [showhide] |
| 949 | (list 'menu-item "Show/Hide" menu-bar-showhide-menu | 942 | (list 'menu-item "Show/Hide" menu-bar-showhide-menu)) |
| 950 | :help "Toggle on/off various display features")) | ||
| 951 | 943 | ||
| 952 | (define-key menu-bar-options-menu [showhide-separator] | 944 | (define-key menu-bar-options-menu [showhide-separator] |
| 953 | '("--")) | 945 | '("--")) |
| @@ -960,7 +952,7 @@ mail status in mode line")) | |||
| 960 | ;; Most of the MULE menu actually does make sense in unibyte mode, | 952 | ;; Most of the MULE menu actually does make sense in unibyte mode, |
| 961 | ;; e.g. language selection. | 953 | ;; e.g. language selection. |
| 962 | ;;; ':visible 'default-enable-multibyte-characters | 954 | ;;; ':visible 'default-enable-multibyte-characters |
| 963 | ':help "Default language, encodings, input method")) | 955 | )) |
| 964 | ;(setq menu-bar-final-items (cons 'mule menu-bar-final-items)) | 956 | ;(setq menu-bar-final-items (cons 'mule menu-bar-final-items)) |
| 965 | ;(define-key menu-bar-options-menu [preferences] | 957 | ;(define-key menu-bar-options-menu [preferences] |
| 966 | ; (list 'menu-item "Preferences" menu-bar-preferences-menu | 958 | ; (list 'menu-item "Preferences" menu-bar-preferences-menu |
| @@ -1137,14 +1129,13 @@ mail status in mode line")) | |||
| 1137 | '(menu-item "Programmable Calculator" calc | 1129 | '(menu-item "Programmable Calculator" calc |
| 1138 | :help "Invoke the Emacs built-in full scientific calculator")) | 1130 | :help "Invoke the Emacs built-in full scientific calculator")) |
| 1139 | (define-key menu-bar-tools-menu [calendar] | 1131 | (define-key menu-bar-tools-menu [calendar] |
| 1140 | '(menu-item "Display Calendar" calendar)) | 1132 | '(menu-item "Calendar" calendar)) |
| 1141 | 1133 | ||
| 1142 | (define-key menu-bar-tools-menu [separator-net] | 1134 | (define-key menu-bar-tools-menu [separator-net] |
| 1143 | '("--")) | 1135 | '("--")) |
| 1144 | 1136 | ||
| 1145 | (define-key menu-bar-tools-menu [directory-search] | 1137 | (define-key menu-bar-tools-menu [directory-search] |
| 1146 | '(menu-item "Directory Search" eudc-tools-menu | 1138 | '(menu-item "Directory Search" eudc-tools-menu)) |
| 1147 | :help "Query directory servers via LDAP, CCSO PH/QI or BBDB")) | ||
| 1148 | (define-key menu-bar-tools-menu [compose-mail] | 1139 | (define-key menu-bar-tools-menu [compose-mail] |
| 1149 | (list | 1140 | (list |
| 1150 | 'menu-item `(format "Send Mail (with %s)" (send-mail-item-name)) | 1141 | 'menu-item `(format "Send Mail (with %s)" (send-mail-item-name)) |
| @@ -1172,27 +1163,21 @@ mail status in mode line")) | |||
| 1172 | 1163 | ||
| 1173 | (defvar vc-menu-map (make-sparse-keymap "Version Control")) | 1164 | (defvar vc-menu-map (make-sparse-keymap "Version Control")) |
| 1174 | (define-key menu-bar-tools-menu [pcl-cvs] | 1165 | (define-key menu-bar-tools-menu [pcl-cvs] |
| 1175 | '(menu-item "PCL-CVS" cvs-global-menu | 1166 | '(menu-item "PCL-CVS" cvs-global-menu)) |
| 1176 | :help "Module-level interface to CVS")) | ||
| 1177 | (define-key menu-bar-tools-menu [vc] | 1167 | (define-key menu-bar-tools-menu [vc] |
| 1178 | (list 'menu-item "Version Control" vc-menu-map | 1168 | (list 'menu-item "Version Control" vc-menu-map)) |
| 1179 | :help "Interface to RCS, CVS, SCCS")) | ||
| 1180 | 1169 | ||
| 1181 | (define-key menu-bar-tools-menu [separator-compare] | 1170 | (define-key menu-bar-tools-menu [separator-compare] |
| 1182 | '("--")) | 1171 | '("--")) |
| 1183 | 1172 | ||
| 1184 | (define-key menu-bar-tools-menu [ediff-misc] | 1173 | (define-key menu-bar-tools-menu [ediff-misc] |
| 1185 | '(menu-item "Ediff Miscellanea" menu-bar-ediff-misc-menu | 1174 | '(menu-item "Ediff Miscellanea" menu-bar-ediff-misc-menu)) |
| 1186 | :help "Ediff manual, customization, sessions, etc.")) | ||
| 1187 | (define-key menu-bar-tools-menu [epatch] | 1175 | (define-key menu-bar-tools-menu [epatch] |
| 1188 | '(menu-item "Apply Patch" menu-bar-epatch-menu)) | 1176 | '(menu-item "Apply Patch" menu-bar-epatch-menu)) |
| 1189 | (define-key menu-bar-tools-menu [ediff-merge] | 1177 | (define-key menu-bar-tools-menu [ediff-merge] |
| 1190 | '(menu-item "Merge" menu-bar-ediff-merge-menu | 1178 | '(menu-item "Merge" menu-bar-ediff-merge-menu)) |
| 1191 | :help "Merge different revisions of files/directories")) | ||
| 1192 | (define-key menu-bar-tools-menu [compare] | 1179 | (define-key menu-bar-tools-menu [compare] |
| 1193 | '(menu-item "Compare (Ediff)" menu-bar-ediff-menu | 1180 | '(menu-item "Compare (Ediff)" menu-bar-ediff-menu)) |
| 1194 | :help "Display differences between files/directories")) | ||
| 1195 | |||
| 1196 | 1181 | ||
| 1197 | (define-key menu-bar-tools-menu [separator-spell] | 1182 | (define-key menu-bar-tools-menu [separator-spell] |
| 1198 | '("--")) | 1183 | '("--")) |
| @@ -1242,8 +1227,7 @@ mail status in mode line")) | |||
| 1242 | :help "Keyboard layout for specific input method")) | 1227 | :help "Keyboard layout for specific input method")) |
| 1243 | (define-key menu-bar-describe-menu [describe-language-environment] | 1228 | (define-key menu-bar-describe-menu [describe-language-environment] |
| 1244 | (list 'menu-item "Describe Language Environment" | 1229 | (list 'menu-item "Describe Language Environment" |
| 1245 | describe-language-environment-map | 1230 | describe-language-environment-map)) |
| 1246 | :help "Show multilingual settings for a specific language")) | ||
| 1247 | 1231 | ||
| 1248 | (define-key menu-bar-describe-menu [separator-desc-mule] | 1232 | (define-key menu-bar-describe-menu [separator-desc-mule] |
| 1249 | '("--")) | 1233 | '("--")) |
| @@ -1318,6 +1302,12 @@ key, a click, or a menu-item")) | |||
| 1318 | :help "Find commands whose names match a regexp")) | 1302 | :help "Find commands whose names match a regexp")) |
| 1319 | (define-key menu-bar-apropos-menu [sep1] | 1303 | (define-key menu-bar-apropos-menu [sep1] |
| 1320 | '("--")) | 1304 | '("--")) |
| 1305 | (define-key menu-bar-apropos-menu [emacs-command-node] | ||
| 1306 | '(menu-item "Look Up Command in User Manual..." Info-goto-emacs-command-node | ||
| 1307 | :help "Display manual section that describes a command")) | ||
| 1308 | (define-key menu-bar-apropos-menu [emacs-key-command-node] | ||
| 1309 | '(menu-item "Look Up Key in User Manual..." Info-goto-emacs-key-command-node | ||
| 1310 | :help "Display manual section that describes a key")) | ||
| 1321 | (define-key menu-bar-apropos-menu [elisp-index-search] | 1311 | (define-key menu-bar-apropos-menu [elisp-index-search] |
| 1322 | '(menu-item "Look Up Subject in ELisp Manual..." elisp-index-search | 1312 | '(menu-item "Look Up Subject in ELisp Manual..." elisp-index-search |
| 1323 | :help "Find description of a subject in Emacs Lisp manual")) | 1313 | :help "Find description of a subject in Emacs Lisp manual")) |
| @@ -1350,14 +1340,6 @@ key, a click, or a menu-item")) | |||
| 1350 | (define-key menu-bar-manuals-menu [info-elintro] | 1340 | (define-key menu-bar-manuals-menu [info-elintro] |
| 1351 | '(menu-item "Introduction to Emacs Lisp" menu-bar-read-lispintro | 1341 | '(menu-item "Introduction to Emacs Lisp" menu-bar-read-lispintro |
| 1352 | :help "Read the Introduction to Emacs Lisp Programming")) | 1342 | :help "Read the Introduction to Emacs Lisp Programming")) |
| 1353 | (define-key menu-bar-manuals-menu [sep3] | ||
| 1354 | '("--")) | ||
| 1355 | (define-key menu-bar-manuals-menu [command] | ||
| 1356 | '(menu-item "Find Command in Manual..." Info-goto-emacs-command-node | ||
| 1357 | :help "Display manual section that describes a command")) | ||
| 1358 | (define-key menu-bar-manuals-menu [key] | ||
| 1359 | '(menu-item "Find Key in Manual..." Info-goto-emacs-key-command-node | ||
| 1360 | :help "Display manual section that describes a key")) | ||
| 1361 | 1343 | ||
| 1362 | (define-key menu-bar-help-menu [eliza] | 1344 | (define-key menu-bar-help-menu [eliza] |
| 1363 | '(menu-item "Emacs Psychotherapist" doctor | 1345 | '(menu-item "Emacs Psychotherapist" doctor |
| @@ -1392,17 +1374,14 @@ key, a click, or a menu-item")) | |||
| 1392 | '(menu-item "Find Emacs Packages" finder-by-keyword | 1374 | '(menu-item "Find Emacs Packages" finder-by-keyword |
| 1393 | :help "Find packages and features by keyword")) | 1375 | :help "Find packages and features by keyword")) |
| 1394 | (define-key menu-bar-help-menu [manuals] | 1376 | (define-key menu-bar-help-menu [manuals] |
| 1395 | (list 'menu-item "More Manuals" menu-bar-manuals-menu | 1377 | (list 'menu-item "More Manuals" menu-bar-manuals-menu)) |
| 1396 | :help "Search and browse on-line manuals")) | ||
| 1397 | (define-key menu-bar-help-menu [emacs-manual] | 1378 | (define-key menu-bar-help-menu [emacs-manual] |
| 1398 | '(menu-item "Read the Emacs Manual" info-emacs-manual | 1379 | '(menu-item "Read the Emacs Manual" info-emacs-manual |
| 1399 | :help "Full documentation of Emacs features")) | 1380 | :help "Full documentation of Emacs features")) |
| 1400 | (define-key menu-bar-help-menu [describe] | 1381 | (define-key menu-bar-help-menu [describe] |
| 1401 | (list 'menu-item "Describe" menu-bar-describe-menu | 1382 | (list 'menu-item "Describe" menu-bar-describe-menu)) |
| 1402 | :help "Describe commands, variables, keys")) | ||
| 1403 | (define-key menu-bar-help-menu [apropos] | 1383 | (define-key menu-bar-help-menu [apropos] |
| 1404 | (list 'menu-item "Search Documentation" menu-bar-apropos-menu | 1384 | (list 'menu-item "Search Documentation" menu-bar-apropos-menu)) |
| 1405 | :help "Look up terms, find commands, options, etc. (Apropos)")) | ||
| 1406 | (define-key menu-bar-help-menu [sep1] | 1385 | (define-key menu-bar-help-menu [sep1] |
| 1407 | '("--")) | 1386 | '("--")) |
| 1408 | (define-key menu-bar-help-menu [report-emacs-bug] | 1387 | (define-key menu-bar-help-menu [report-emacs-bug] |
diff --git a/lisp/mh-e/mh-search.el b/lisp/mh-e/mh-search.el index 14891204fad..b6f8dd71d9a 100644 --- a/lisp/mh-e/mh-search.el +++ b/lisp/mh-e/mh-search.el | |||
| @@ -1524,7 +1524,7 @@ construct the base name." | |||
| 1524 | (with-temp-buffer | 1524 | (with-temp-buffer |
| 1525 | (mh-exec-cmd-output "folder" nil "-fast" "-nocreate" folder) | 1525 | (mh-exec-cmd-output "folder" nil "-fast" "-nocreate" folder) |
| 1526 | (goto-char (point-min)) | 1526 | (goto-char (point-min)) |
| 1527 | (not (eobp)))))) | 1527 | (looking-at (format "+?%s" folder)))))) |
| 1528 | 1528 | ||
| 1529 | (defun mh-msg-exists-p (msg folder) | 1529 | (defun mh-msg-exists-p (msg folder) |
| 1530 | "Check if MSG exists in FOLDER." | 1530 | "Check if MSG exists in FOLDER." |
diff --git a/lisp/msb.el b/lisp/msb.el index 61ddce5dae0..d5f32486971 100644 --- a/lisp/msb.el +++ b/lisp/msb.el | |||
| @@ -1007,7 +1007,7 @@ variable `msb-menu-cond'." | |||
| 1007 | (mouse-select-buffer event)) | 1007 | (mouse-select-buffer event)) |
| 1008 | ((and (numberp (car choice)) | 1008 | ((and (numberp (car choice)) |
| 1009 | (null (cdr choice))) | 1009 | (null (cdr choice))) |
| 1010 | (let ((msb--last-buffer-menu (nthcdr 3 (assq (car choice) | 1010 | (let ((msb--last-buffer-menu (nthcdr 2 (assq (car choice) |
| 1011 | msb--last-buffer-menu)))) | 1011 | msb--last-buffer-menu)))) |
| 1012 | (mouse-select-buffer event))) | 1012 | (mouse-select-buffer event))) |
| 1013 | ((while (numberp (car choice)) | 1013 | ((while (numberp (car choice)) |
diff --git a/lisp/pcvs.el b/lisp/pcvs.el index 7209c135e52..5e322b9276a 100644 --- a/lisp/pcvs.el +++ b/lisp/pcvs.el | |||
| @@ -467,7 +467,7 @@ If non-nil, NEW means to create a new buffer no matter what." | |||
| 467 | (cvs-mode) | 467 | (cvs-mode) |
| 468 | (set (make-local-variable 'list-buffers-directory) buffer-name) | 468 | (set (make-local-variable 'list-buffers-directory) buffer-name) |
| 469 | ;;(set (make-local-variable 'cvs-temp-buffer) (cvs-temp-buffer)) | 469 | ;;(set (make-local-variable 'cvs-temp-buffer) (cvs-temp-buffer)) |
| 470 | (let ((cookies (ewoc-create 'cvs-fileinfo-pp "\n\n" "\n"))) | 470 | (let ((cookies (ewoc-create 'cvs-fileinfo-pp "\n\n" "\n" t))) |
| 471 | (set (make-local-variable 'cvs-cookies) cookies) | 471 | (set (make-local-variable 'cvs-cookies) cookies) |
| 472 | (add-hook 'kill-buffer-hook | 472 | (add-hook 'kill-buffer-hook |
| 473 | (lambda () | 473 | (lambda () |
diff --git a/lisp/pgg-pgp.el b/lisp/pgg-pgp.el index f58fd0d3c6d..e53a0c2c867 100644 --- a/lisp/pgg-pgp.el +++ b/lisp/pgg-pgp.el | |||
| @@ -136,21 +136,21 @@ Bourne shell or its equivalent \(not tcsh) is needed for \"2>\"." | |||
| 136 | "Encrypt the current region between START and END." | 136 | "Encrypt the current region between START and END." |
| 137 | (let* ((pgg-pgp-user-id (or pgg-pgp-user-id pgg-default-user-id)) | 137 | (let* ((pgg-pgp-user-id (or pgg-pgp-user-id pgg-default-user-id)) |
| 138 | (passphrase (or passphrase | 138 | (passphrase (or passphrase |
| 139 | (when sign | 139 | (when sign |
| 140 | (pgg-read-passphrase | 140 | (pgg-read-passphrase |
| 141 | (format "PGP passphrase for %s: " | 141 | (format "PGP passphrase for %s: " |
| 142 | pgg-pgp-user-id) | 142 | pgg-pgp-user-id) |
| 143 | pgg-pgp-user-id)))) | 143 | pgg-pgp-user-id)))) |
| 144 | (args | 144 | (args |
| 145 | (append | 145 | (append |
| 146 | `("+encrypttoself=off +verbose=1" "+batchmode" | 146 | `("+encrypttoself=off +verbose=1" "+batchmode" |
| 147 | "+language=us" "-fate" | 147 | "+language=us" "-fate" |
| 148 | ,@(if recipients | 148 | ,@(if recipients |
| 149 | (mapcar (lambda (rcpt) (concat "\"" rcpt "\"")) | 149 | (mapcar (lambda (rcpt) (concat "\"" rcpt "\"")) |
| 150 | (append recipients | 150 | (append recipients |
| 151 | (if pgg-encrypt-for-me | 151 | (if pgg-encrypt-for-me |
| 152 | (list pgg-pgp-user-id)))))) | 152 | (list pgg-pgp-user-id)))))) |
| 153 | (if sign '("-s" "-u" pgg-pgp-user-id))))) | 153 | (if sign '("-s" "-u" pgg-pgp-user-id))))) |
| 154 | (pgg-pgp-process-region start end nil pgg-pgp-program args) | 154 | (pgg-pgp-process-region start end nil pgg-pgp-program args) |
| 155 | (pgg-process-when-success nil))) | 155 | (pgg-process-when-success nil))) |
| 156 | 156 | ||
| @@ -162,11 +162,11 @@ passphrase cache or user." | |||
| 162 | (let* ((pgg-pgp-user-id (or pgg-pgp-user-id pgg-default-user-id)) | 162 | (let* ((pgg-pgp-user-id (or pgg-pgp-user-id pgg-default-user-id)) |
| 163 | (key (pgg-pgp-lookup-key pgg-pgp-user-id 'encrypt)) | 163 | (key (pgg-pgp-lookup-key pgg-pgp-user-id 'encrypt)) |
| 164 | (passphrase | 164 | (passphrase |
| 165 | (or passphrase | 165 | (or passphrase |
| 166 | (pgg-read-passphrase | 166 | (pgg-read-passphrase |
| 167 | (format "PGP passphrase for %s: " pgg-pgp-user-id) key))) | 167 | (format "PGP passphrase for %s: " pgg-pgp-user-id) key))) |
| 168 | (args | 168 | (args |
| 169 | '("+verbose=1" "+batchmode" "+language=us" "-f"))) | 169 | '("+verbose=1" "+batchmode" "+language=us" "-f"))) |
| 170 | (pgg-pgp-process-region start end passphrase pgg-pgp-program args) | 170 | (pgg-pgp-process-region start end passphrase pgg-pgp-program args) |
| 171 | (pgg-process-when-success | 171 | (pgg-process-when-success |
| 172 | (if pgg-cache-passphrase | 172 | (if pgg-cache-passphrase |
| @@ -179,10 +179,10 @@ If optional PASSPHRASE is not specified, it will be obtained from the | |||
| 179 | passphrase cache or user." | 179 | passphrase cache or user." |
| 180 | (let* ((pgg-pgp-user-id (or pgg-pgp-user-id pgg-default-user-id)) | 180 | (let* ((pgg-pgp-user-id (or pgg-pgp-user-id pgg-default-user-id)) |
| 181 | (passphrase | 181 | (passphrase |
| 182 | (or passphrase | 182 | (or passphrase |
| 183 | (pgg-read-passphrase | 183 | (pgg-read-passphrase |
| 184 | (format "PGP passphrase for %s: " pgg-pgp-user-id) | 184 | (format "PGP passphrase for %s: " pgg-pgp-user-id) |
| 185 | (pgg-pgp-lookup-key pgg-pgp-user-id 'sign)))) | 185 | (pgg-pgp-lookup-key pgg-pgp-user-id 'sign)))) |
| 186 | (args | 186 | (args |
| 187 | (list (if clearsign "-fast" "-fbast") | 187 | (list (if clearsign "-fast" "-fbast") |
| 188 | "+verbose=1" "+language=us" "+batchmode" | 188 | "+verbose=1" "+language=us" "+batchmode" |
diff --git a/lisp/pgg-pgp5.el b/lisp/pgg-pgp5.el index 3cba59916e5..75c96e59909 100644 --- a/lisp/pgg-pgp5.el +++ b/lisp/pgg-pgp5.el | |||
| @@ -147,23 +147,23 @@ Bourne shell or its equivalent \(not tcsh) is needed for \"2>\"." | |||
| 147 | "Encrypt the current region between START and END." | 147 | "Encrypt the current region between START and END." |
| 148 | (let* ((pgg-pgp5-user-id (or pgg-pgp5-user-id pgg-default-user-id)) | 148 | (let* ((pgg-pgp5-user-id (or pgg-pgp5-user-id pgg-default-user-id)) |
| 149 | (passphrase (or passphrase | 149 | (passphrase (or passphrase |
| 150 | (when sign | 150 | (when sign |
| 151 | (pgg-read-passphrase | 151 | (pgg-read-passphrase |
| 152 | (format "PGP passphrase for %s: " | 152 | (format "PGP passphrase for %s: " |
| 153 | pgg-pgp5-user-id) | 153 | pgg-pgp5-user-id) |
| 154 | pgg-pgp5-user-id)))) | 154 | pgg-pgp5-user-id)))) |
| 155 | (args | 155 | (args |
| 156 | (append | 156 | (append |
| 157 | `("+NoBatchInvalidKeys=off" "-fat" "+batchmode=1" | 157 | `("+NoBatchInvalidKeys=off" "-fat" "+batchmode=1" |
| 158 | ,@(if recipients | 158 | ,@(if recipients |
| 159 | (apply #'append | 159 | (apply #'append |
| 160 | (mapcar (lambda (rcpt) | 160 | (mapcar (lambda (rcpt) |
| 161 | (list "-r" | 161 | (list "-r" |
| 162 | (concat "\"" rcpt "\""))) | 162 | (concat "\"" rcpt "\""))) |
| 163 | (append recipients | 163 | (append recipients |
| 164 | (if pgg-encrypt-for-me | 164 | (if pgg-encrypt-for-me |
| 165 | (list pgg-pgp5-user-id))))))) | 165 | (list pgg-pgp5-user-id))))))) |
| 166 | (if sign '("-s" "-u" pgg-pgp5-user-id))))) | 166 | (if sign '("-s" "-u" pgg-pgp5-user-id))))) |
| 167 | (pgg-pgp5-process-region start end nil pgg-pgp5-pgpe-program args) | 167 | (pgg-pgp5-process-region start end nil pgg-pgp5-pgpe-program args) |
| 168 | (pgg-process-when-success nil))) | 168 | (pgg-process-when-success nil))) |
| 169 | 169 | ||
| @@ -171,10 +171,10 @@ Bourne shell or its equivalent \(not tcsh) is needed for \"2>\"." | |||
| 171 | "Decrypt the current region between START and END." | 171 | "Decrypt the current region between START and END." |
| 172 | (let* ((pgg-pgp5-user-id (or pgg-pgp5-user-id pgg-default-user-id)) | 172 | (let* ((pgg-pgp5-user-id (or pgg-pgp5-user-id pgg-default-user-id)) |
| 173 | (passphrase | 173 | (passphrase |
| 174 | (or passphrase | 174 | (or passphrase |
| 175 | (pgg-read-passphrase | 175 | (pgg-read-passphrase |
| 176 | (format "PGP passphrase for %s: " pgg-pgp5-user-id) | 176 | (format "PGP passphrase for %s: " pgg-pgp5-user-id) |
| 177 | (pgg-pgp5-lookup-key pgg-pgp5-user-id 'encrypt)))) | 177 | (pgg-pgp5-lookup-key pgg-pgp5-user-id 'encrypt)))) |
| 178 | (args | 178 | (args |
| 179 | '("+verbose=1" "+batchmode=1" "+language=us" "-f"))) | 179 | '("+verbose=1" "+batchmode=1" "+language=us" "-f"))) |
| 180 | (pgg-pgp5-process-region start end passphrase pgg-pgp5-pgpv-program args) | 180 | (pgg-pgp5-process-region start end passphrase pgg-pgp5-pgpv-program args) |
| @@ -184,10 +184,10 @@ Bourne shell or its equivalent \(not tcsh) is needed for \"2>\"." | |||
| 184 | "Make detached signature from text between START and END." | 184 | "Make detached signature from text between START and END." |
| 185 | (let* ((pgg-pgp5-user-id (or pgg-pgp5-user-id pgg-default-user-id)) | 185 | (let* ((pgg-pgp5-user-id (or pgg-pgp5-user-id pgg-default-user-id)) |
| 186 | (passphrase | 186 | (passphrase |
| 187 | (or passphrase | 187 | (or passphrase |
| 188 | (pgg-read-passphrase | 188 | (pgg-read-passphrase |
| 189 | (format "PGP passphrase for %s: " pgg-pgp5-user-id) | 189 | (format "PGP passphrase for %s: " pgg-pgp5-user-id) |
| 190 | (pgg-pgp5-lookup-key pgg-pgp5-user-id 'sign)))) | 190 | (pgg-pgp5-lookup-key pgg-pgp5-user-id 'sign)))) |
| 191 | (args | 191 | (args |
| 192 | (list (if clearsign "-fat" "-fbat") | 192 | (list (if clearsign "-fat" "-fbat") |
| 193 | "+verbose=1" "+language=us" "+batchmode=1" | 193 | "+verbose=1" "+language=us" "+batchmode=1" |
diff --git a/lisp/play/pong.el b/lisp/play/pong.el index d73d789d0d3..4efa8c2a639 100644 --- a/lisp/play/pong.el +++ b/lisp/play/pong.el | |||
| @@ -244,7 +244,7 @@ | |||
| 244 | 244 | ||
| 245 | (gamegrid-init-buffer pong-width | 245 | (gamegrid-init-buffer pong-width |
| 246 | (+ 2 pong-height) | 246 | (+ 2 pong-height) |
| 247 | 1) | 247 | ?\s) |
| 248 | 248 | ||
| 249 | (let ((buffer-read-only nil)) | 249 | (let ((buffer-read-only nil)) |
| 250 | (loop for y from 0 to (1- pong-height) do | 250 | (loop for y from 0 to (1- pong-height) do |
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 527624bfc4e..5da86972ec5 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el | |||
| @@ -228,7 +228,7 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1)) | |||
| 228 | \\([0-9]+\\)\\([.:]?\\)\\([0-9]+\\)?\ | 228 | \\([0-9]+\\)\\([.:]?\\)\\([0-9]+\\)?\ |
| 229 | \\(?:-\\(?:\\([0-9]+\\)\\3\\)?\\.?\\([0-9]+\\)?\\)?:\ | 229 | \\(?:-\\(?:\\([0-9]+\\)\\3\\)?\\.?\\([0-9]+\\)?\\)?:\ |
| 230 | \\(?: *\\(\\(?:Future\\|Runtime\\)?[Ww]arning\\|W:\\)\\|\ | 230 | \\(?: *\\(\\(?:Future\\|Runtime\\)?[Ww]arning\\|W:\\)\\|\ |
| 231 | *\\([Ii]nfo\\(?:\\>\\|rmationa?l?\\)\\|I:\\)\\)?" | 231 | *\\([Ii]nfo\\(?:\\>\\|rmationa?l?\\)\\|I:\\|instantiated from\\)\\)?" |
| 232 | 1 (2 . 5) (4 . 6) (7 . 8)) | 232 | 1 (2 . 5) (4 . 6) (7 . 8)) |
| 233 | 233 | ||
| 234 | (lcc | 234 | (lcc |
| @@ -236,7 +236,7 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1)) | |||
| 236 | 2 3 4 (1)) | 236 | 2 3 4 (1)) |
| 237 | 237 | ||
| 238 | (makepp | 238 | (makepp |
| 239 | "^makepp: \\(?:\\(?:warning\\(:\\).*?\\|\\(Scanning\\|[LR]e?l?oading makefile\\) \\|.*?\\)\ | 239 | "^makepp: \\(?:\\(?:warning\\(:\\).*?\\|\\(Scanning\\|[LR]e?l?oading makefile\\|Imported\\) \\|.*?\\)\ |
| 240 | `\\(\\(\\S +?\\)\\(?::\\([0-9]+\\)\\)?\\)['(]\\)" | 240 | `\\(\\(\\S +?\\)\\(?::\\([0-9]+\\)\\)?\\)['(]\\)" |
| 241 | 4 5 nil (1 . 2) 3 | 241 | 4 5 nil (1 . 2) 3 |
| 242 | ("`\\(\\(\\S +?\\)\\(?::\\([0-9]+\\)\\)?\\)['(]" nil nil | 242 | ("`\\(\\(\\S +?\\)\\(?::\\([0-9]+\\)\\)?\\)['(]" nil nil |
| @@ -293,15 +293,34 @@ File = \\(.+\\), Line = \\([0-9]+\\)\\(?:, Column = \\([0-9]+\\)\\)?" | |||
| 293 | \\(?:: \\(warning:\\)?\\|$\\| ),\\)" 1 2 nil (3)) | 293 | \\(?:: \\(warning:\\)?\\|$\\| ),\\)" 1 2 nil (3)) |
| 294 | 294 | ||
| 295 | (gcov-file | 295 | (gcov-file |
| 296 | "^ +-: \\(0\\):Source:\\(.+\\)$" 2 1 nil 0) | 296 | "^ *-: *\\(0\\):Source:\\(.+\\)$" |
| 297 | (gcov-bb-file | 297 | 2 1 nil 0 nil |
| 298 | "^ +-: \\(0\\):Object:\\(?:.+\\)$" nil 1 nil 0) | 298 | (1 compilation-line-face prepend) (2 compilation-info-face prepend)) |
| 299 | (gcov-never-called-line | 299 | (gcov-header |
| 300 | "^ +\\(#####\\): +\\([0-9]+\\):.+$" nil 2 nil 2 nil | 300 | "^ *-: *\\(0\\):\\(?:Object\\|Graph\\|Data\\|Runs\\|Programs\\):.+$" |
| 301 | (1 compilation-error-face)) | 301 | nil 1 nil 0 nil |
| 302 | (1 compilation-line-face prepend)) | ||
| 303 | ;; Underlines over all lines of gcov output are too uncomfortable to read. | ||
| 304 | ;; However, hyperlinks embedded in the lines are useful. | ||
| 305 | ;; So I put default face on the lines; and then put | ||
| 306 | ;; compilation-*-face by manually to eliminate the underlines. | ||
| 307 | ;; The hyperlinks are still effective. | ||
| 308 | (gcov-nomark | ||
| 309 | "^ *-: *\\([1-9]\\|[0-9]\\{2,\\}\\):.*$" | ||
| 310 | nil 1 nil 0 nil | ||
| 311 | (0 'default t) | ||
| 312 | (1 compilation-line-face prepend)) | ||
| 302 | (gcov-called-line | 313 | (gcov-called-line |
| 303 | "^ +[-0-9]+: +\\([1-9]\\|[0-9]\\{2,\\}\\):.*$" nil 1 nil 0) | 314 | "^ *\\([0-9]+\\): *\\([0-9]+\\):.*$" |
| 304 | ) | 315 | nil 2 nil 0 nil |
| 316 | (0 'default t) | ||
| 317 | (1 compilation-info-face prepend) (2 compilation-line-face prepend)) | ||
| 318 | (gcov-never-called | ||
| 319 | "^ *\\(#####\\): *\\([0-9]+\\):.*$" | ||
| 320 | nil 2 nil 2 nil | ||
| 321 | (0 'default t) | ||
| 322 | (1 compilation-error-face prepend) (2 compilation-line-face prepend)) | ||
| 323 | ) | ||
| 305 | "Alist of values for `compilation-error-regexp-alist'.") | 324 | "Alist of values for `compilation-error-regexp-alist'.") |
| 306 | 325 | ||
| 307 | (defcustom compilation-error-regexp-alist | 326 | (defcustom compilation-error-regexp-alist |
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index 36f75b757b5..ad44753f352 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el | |||
| @@ -6298,7 +6298,7 @@ $^E Information about the last system error other than that provided by $!. | |||
| 6298 | $^F The highest system file descriptor, ordinarily 2. | 6298 | $^F The highest system file descriptor, ordinarily 2. |
| 6299 | $^H The current set of syntax checks enabled by `use strict'. | 6299 | $^H The current set of syntax checks enabled by `use strict'. |
| 6300 | $^I The value of the in-place edit extension (perl -i option). | 6300 | $^I The value of the in-place edit extension (perl -i option). |
| 6301 | $^L What formats output to perform a formfeed. Default is \f. | 6301 | $^L What formats output to perform a formfeed. Default is \\f. |
| 6302 | $^M A buffer for emergency memory allocation when running out of memory. | 6302 | $^M A buffer for emergency memory allocation when running out of memory. |
| 6303 | $^O The operating system name under which this copy of Perl was built. | 6303 | $^O The operating system name under which this copy of Perl was built. |
| 6304 | $^P Internal debugging flag. | 6304 | $^P Internal debugging flag. |
| @@ -6380,11 +6380,11 @@ $~ The name of the current report format. | |||
| 6380 | @ARGV Command line arguments (not including the command name - see $0). | 6380 | @ARGV Command line arguments (not including the command name - see $0). |
| 6381 | @INC List of places to look for perl scripts during do/include/use. | 6381 | @INC List of places to look for perl scripts during do/include/use. |
| 6382 | @_ Parameter array for subroutines; result of split() unless in list context. | 6382 | @_ Parameter array for subroutines; result of split() unless in list context. |
| 6383 | \\ Creates reference to what follows, like \$var, or quotes non-\w in strings. | 6383 | \\ Creates reference to what follows, like \\$var, or quotes non-\\w in strings. |
| 6384 | \\0 Octal char, e.g. \\033. | 6384 | \\0 Octal char, e.g. \\033. |
| 6385 | \\E Case modification terminator. See \\Q, \\L, and \\U. | 6385 | \\E Case modification terminator. See \\Q, \\L, and \\U. |
| 6386 | \\L Lowercase until \\E . See also \l, lc. | 6386 | \\L Lowercase until \\E . See also \\l, lc. |
| 6387 | \\U Upcase until \\E . See also \u, uc. | 6387 | \\U Upcase until \\E . See also \\u, uc. |
| 6388 | \\Q Quote metacharacters until \\E . See also quotemeta. | 6388 | \\Q Quote metacharacters until \\E . See also quotemeta. |
| 6389 | \\a Alarm character (octal 007). | 6389 | \\a Alarm character (octal 007). |
| 6390 | \\b Backspace character (octal 010). | 6390 | \\b Backspace character (octal 010). |
| @@ -6655,7 +6655,7 @@ ucfirst [ EXPR ] Returns EXPR with upcased first letter. | |||
| 6655 | untie VAR Unlink an object from a simple Perl variable. | 6655 | untie VAR Unlink an object from a simple Perl variable. |
| 6656 | use PACKAGE [SYMBOL1, ...] Compile-time `require' with consequent `import'. | 6656 | use PACKAGE [SYMBOL1, ...] Compile-time `require' with consequent `import'. |
| 6657 | ... xor ... Low-precedence synonym for exclusive or. | 6657 | ... xor ... Low-precedence synonym for exclusive or. |
| 6658 | prototype \&SUB Returns prototype of the function given a reference. | 6658 | prototype \\&SUB Returns prototype of the function given a reference. |
| 6659 | =head1 Top-level heading. | 6659 | =head1 Top-level heading. |
| 6660 | =head2 Second-level heading. | 6660 | =head2 Second-level heading. |
| 6661 | =head3 Third-level heading (is there such?). | 6661 | =head3 Third-level heading (is there such?). |
diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el index f5d08d533fd..bb821907aa8 100644 --- a/lisp/progmodes/gdb-ui.el +++ b/lisp/progmodes/gdb-ui.el | |||
| @@ -71,11 +71,11 @@ | |||
| 71 | ;;; Known Bugs: | 71 | ;;; Known Bugs: |
| 72 | 72 | ||
| 73 | ;; 1) Strings that are watched don't update in the speedbar when their | 73 | ;; 1) Strings that are watched don't update in the speedbar when their |
| 74 | ;; contents change unless the first character changes. | 74 | ;; contents change unless the first character changes. |
| 75 | ;; 2) Cannot handle multiple debug sessions. | 75 | ;; 2) Cannot handle multiple debug sessions. |
| 76 | ;; 3) Initially, the assembler buffer does not display the cursor at the | 76 | ;; 3) M-x gdb doesn't work with "run" command in .gdbinit, use M-x gdba instead. |
| 77 | ;; current line if the line is not visible in the window (but when testing | 77 | ;; 4) M-x gdb doesn't work if the corefile is specified in the command in the |
| 78 | ;; gdb-assembler-custom with a lisp debugger it does!). | 78 | ;; minibuffer, use M-x gdba instead (or specify the core in the GUD buffer). |
| 79 | 79 | ||
| 80 | ;;; Problems with watch expressions, GDB/MI: | 80 | ;;; Problems with watch expressions, GDB/MI: |
| 81 | ;; 1) They go out of scope when the inferior is re-run. | 81 | ;; 1) They go out of scope when the inferior is re-run. |
| @@ -83,15 +83,10 @@ | |||
| 83 | ;; 3) VARNUM increments even when variable object is not created | 83 | ;; 3) VARNUM increments even when variable object is not created |
| 84 | ;; (maybe trivial). | 84 | ;; (maybe trivial). |
| 85 | 85 | ||
| 86 | ;; Known Bugs: | ||
| 87 | ;; 1) M-x gdb doesn't work with "run" command in .gdbinit, use M-x gdba instead. | ||
| 88 | |||
| 89 | ;;; TODO: | 86 | ;;; TODO: |
| 90 | ;; 1) Use MI command -data-read-memory for memory window. | 87 | ;; 1) Use MI command -data-read-memory for memory window. |
| 91 | ;; 2) Use tree-widget.el instead of the speedbar for watch-expressions? | 88 | ;; 2) Use tree-widget.el instead of the speedbar for watch-expressions? |
| 92 | ;; 3) Mark breakpoint locations on scroll-bar of source buffer? | 89 | ;; 3) Mark breakpoint locations on scroll-bar of source buffer? |
| 93 | ;; 4) With gud-print and gud-pstar, print the variable name in the GUD | ||
| 94 | ;; buffer instead of the value's history number. | ||
| 95 | 90 | ||
| 96 | ;;; Code: | 91 | ;;; Code: |
| 97 | 92 | ||
| @@ -130,6 +125,7 @@ and #define directives otherwise.") | |||
| 130 | (defvar gdb-source-window nil) | 125 | (defvar gdb-source-window nil) |
| 131 | (defvar gdb-inferior-status nil) | 126 | (defvar gdb-inferior-status nil) |
| 132 | (defvar gdb-continuation nil) | 127 | (defvar gdb-continuation nil) |
| 128 | (defvar gdb-look-up-stack nil) | ||
| 133 | 129 | ||
| 134 | (defvar gdb-buffer-type nil | 130 | (defvar gdb-buffer-type nil |
| 135 | "One of the symbols bound in `gdb-buffer-rules'.") | 131 | "One of the symbols bound in `gdb-buffer-rules'.") |
| @@ -430,7 +426,8 @@ With arg, use separate IO iff arg is positive." | |||
| 430 | (when gud-tooltip-mode | 426 | (when gud-tooltip-mode |
| 431 | (make-local-variable 'gdb-define-alist) | 427 | (make-local-variable 'gdb-define-alist) |
| 432 | (gdb-create-define-alist) | 428 | (gdb-create-define-alist) |
| 433 | (add-hook 'after-save-hook 'gdb-create-define-alist nil t))))))) | 429 | (add-hook 'after-save-hook 'gdb-create-define-alist nil t)))))) |
| 430 | (gdb-force-mode-line-update "ready")) | ||
| 434 | 431 | ||
| 435 | (defun gdb-find-watch-expression () | 432 | (defun gdb-find-watch-expression () |
| 436 | (let* ((var (nth (- (line-number-at-pos (point)) 2) gdb-var-list)) | 433 | (let* ((var (nth (- (line-number-at-pos (point)) 2) gdb-var-list)) |
| @@ -493,26 +490,28 @@ With arg, use separate IO iff arg is positive." | |||
| 493 | 'gdb-mouse-set-clear-breakpoint) | 490 | 'gdb-mouse-set-clear-breakpoint) |
| 494 | (define-key gud-minor-mode-map [left-fringe mouse-1] | 491 | (define-key gud-minor-mode-map [left-fringe mouse-1] |
| 495 | 'gdb-mouse-set-clear-breakpoint) | 492 | 'gdb-mouse-set-clear-breakpoint) |
| 496 | (define-key gud-minor-mode-map [left-fringe mouse-2] | 493 | (define-key gud-minor-mode-map [left-margin C-mouse-1] |
| 497 | 'gdb-mouse-until) | 494 | 'gdb-mouse-toggle-breakpoint-margin) |
| 495 | (define-key gud-minor-mode-map [left-fringe C-mouse-1] | ||
| 496 | 'gdb-mouse-toggle-breakpoint-fringe) | ||
| 497 | |||
| 498 | (define-key gud-minor-mode-map [left-margin drag-mouse-1] | 498 | (define-key gud-minor-mode-map [left-margin drag-mouse-1] |
| 499 | 'gdb-mouse-until) | 499 | 'gdb-mouse-until) |
| 500 | (define-key gud-minor-mode-map [left-fringe drag-mouse-1] | 500 | (define-key gud-minor-mode-map [left-fringe drag-mouse-1] |
| 501 | 'gdb-mouse-until) | 501 | 'gdb-mouse-until) |
| 502 | (define-key gud-minor-mode-map [left-margin mouse-2] | 502 | (define-key gud-minor-mode-map [left-margin mouse-3] |
| 503 | 'gdb-mouse-until) | ||
| 504 | (define-key gud-minor-mode-map [left-fringe mouse-3] | ||
| 503 | 'gdb-mouse-until) | 505 | 'gdb-mouse-until) |
| 506 | |||
| 504 | (define-key gud-minor-mode-map [left-margin C-drag-mouse-1] | 507 | (define-key gud-minor-mode-map [left-margin C-drag-mouse-1] |
| 505 | 'gdb-mouse-jump) | 508 | 'gdb-mouse-jump) |
| 506 | (define-key gud-minor-mode-map [left-fringe C-drag-mouse-1] | 509 | (define-key gud-minor-mode-map [left-fringe C-drag-mouse-1] |
| 507 | 'gdb-mouse-jump) | 510 | 'gdb-mouse-jump) |
| 508 | (define-key gud-minor-mode-map [left-fringe C-mouse-2] | 511 | (define-key gud-minor-mode-map [left-fringe C-mouse-3] |
| 509 | 'gdb-mouse-jump) | 512 | 'gdb-mouse-jump) |
| 510 | (define-key gud-minor-mode-map [left-margin C-mouse-2] | 513 | (define-key gud-minor-mode-map [left-margin C-mouse-3] |
| 511 | 'gdb-mouse-jump) | 514 | 'gdb-mouse-jump) |
| 512 | (define-key gud-minor-mode-map [left-margin mouse-3] | ||
| 513 | 'gdb-mouse-toggle-breakpoint-margin) | ||
| 514 | (define-key gud-minor-mode-map [left-fringe mouse-3] | ||
| 515 | 'gdb-mouse-toggle-breakpoint-fringe) | ||
| 516 | 515 | ||
| 517 | (setq comint-input-sender 'gdb-send) | 516 | (setq comint-input-sender 'gdb-send) |
| 518 | 517 | ||
| @@ -543,7 +542,8 @@ With arg, use separate IO iff arg is positive." | |||
| 543 | gdb-signalled nil | 542 | gdb-signalled nil |
| 544 | gdb-source-window nil | 543 | gdb-source-window nil |
| 545 | gdb-inferior-status nil | 544 | gdb-inferior-status nil |
| 546 | gdb-continuation nil) | 545 | gdb-continuation nil |
| 546 | gdb-look-up-stack nil) | ||
| 547 | 547 | ||
| 548 | (setq gdb-buffer-type 'gdba) | 548 | (setq gdb-buffer-type 'gdba) |
| 549 | 549 | ||
| @@ -738,7 +738,7 @@ With arg, enter name of variable to be watched in the minibuffer." | |||
| 738 | `(lambda () (gdb-var-evaluate-expression-handler | 738 | `(lambda () (gdb-var-evaluate-expression-handler |
| 739 | ,(car var) nil))))) | 739 | ,(car var) nil))))) |
| 740 | (if (search-forward "Undefined command" nil t) | 740 | (if (search-forward "Undefined command" nil t) |
| 741 | (message-box "Watching expressions requires gdb 6.0 onwards") | 741 | (message-box "Watching expressions requires GDB 6.0 onwards") |
| 742 | (message-box "No symbol \"%s\" in current context." expr)))) | 742 | (message-box "No symbol \"%s\" in current context." expr)))) |
| 743 | 743 | ||
| 744 | (defun gdb-speedbar-update () | 744 | (defun gdb-speedbar-update () |
| @@ -1106,7 +1106,8 @@ This filter may simply queue input for a later time." | |||
| 1106 | (let ((item (concat string "\n"))) | 1106 | (let ((item (concat string "\n"))) |
| 1107 | (if gdb-enable-debug (push (cons 'send item) gdb-debug-ring)) | 1107 | (if gdb-enable-debug (push (cons 'send item) gdb-debug-ring)) |
| 1108 | (process-send-string proc item))) | 1108 | (process-send-string proc item))) |
| 1109 | (if (string-match "\\\\$" string) | 1109 | (if (and (string-match "\\\\$" string) |
| 1110 | (not comint-input-sender-no-newline)) ;;Try to catch C-d. | ||
| 1110 | (setq gdb-continuation (concat gdb-continuation string "\n")) | 1111 | (setq gdb-continuation (concat gdb-continuation string "\n")) |
| 1111 | (let ((item (concat gdb-continuation string "\n"))) | 1112 | (let ((item (concat gdb-continuation string "\n"))) |
| 1112 | (gdb-enqueue-input item) | 1113 | (gdb-enqueue-input item) |
| @@ -1238,6 +1239,7 @@ happens to be in effect." | |||
| 1238 | "An annotation handler for `prompt'. | 1239 | "An annotation handler for `prompt'. |
| 1239 | This sends the next command (if any) to gdb." | 1240 | This sends the next command (if any) to gdb." |
| 1240 | (when gdb-first-prompt | 1241 | (when gdb-first-prompt |
| 1242 | (gdb-force-mode-line-update "initializing...") | ||
| 1241 | (gdb-init-1) | 1243 | (gdb-init-1) |
| 1242 | (setq gdb-first-prompt nil)) | 1244 | (setq gdb-first-prompt nil)) |
| 1243 | (let ((sink gdb-output-sink)) | 1245 | (let ((sink gdb-output-sink)) |
| @@ -1334,9 +1336,20 @@ directives." | |||
| 1334 | It is just like `gdb-stopping', except that if we already set the output | 1336 | It is just like `gdb-stopping', except that if we already set the output |
| 1335 | sink to `user' in `gdb-stopping', that is fine." | 1337 | sink to `user' in `gdb-stopping', that is fine." |
| 1336 | (setq gud-running nil) | 1338 | (setq gud-running nil) |
| 1337 | (unless (or gud-overlay-arrow-position gud-last-frame | 1339 | (unless (or gud-overlay-arrow-position gud-last-frame) |
| 1338 | (not gud-last-last-frame)) | 1340 | ;;Pop up GUD buffer to display current frame when it doesn't have source |
| 1339 | (gud-display-line (car gud-last-last-frame) (cdr gud-last-last-frame))) | 1341 | ;;information i.e id not compiled with -g as with libc routines generally. |
| 1342 | (let ((special-display-regexps (append special-display-regexps '(".*"))) | ||
| 1343 | (special-display-frame-alist gdb-frame-parameters) | ||
| 1344 | (same-window-regexps nil)) | ||
| 1345 | (display-buffer gud-comint-buffer)) | ||
| 1346 | ;;Try to find source further up stack e.g after signal. | ||
| 1347 | (setq gdb-look-up-stack | ||
| 1348 | (if (gdb-get-buffer 'gdb-stack-buffer) 'keep | ||
| 1349 | (progn | ||
| 1350 | (gdb-get-buffer-create 'gdb-stack-buffer) | ||
| 1351 | (gdb-invalidate-frames) | ||
| 1352 | 'delete)))) | ||
| 1340 | (unless (member gdb-inferior-status '("exited" "signal")) | 1353 | (unless (member gdb-inferior-status '("exited" "signal")) |
| 1341 | (setq gdb-inferior-status "stopped") | 1354 | (setq gdb-inferior-status "stopped") |
| 1342 | (gdb-force-mode-line-update gdb-inferior-status)) | 1355 | (gdb-force-mode-line-update gdb-inferior-status)) |
| @@ -1945,36 +1958,57 @@ static char *magick[] = { | |||
| 1945 | (defun gdb-info-stack-custom () | 1958 | (defun gdb-info-stack-custom () |
| 1946 | (with-current-buffer (gdb-get-buffer 'gdb-stack-buffer) | 1959 | (with-current-buffer (gdb-get-buffer 'gdb-stack-buffer) |
| 1947 | (save-excursion | 1960 | (save-excursion |
| 1948 | (let ((buffer-read-only nil) | 1961 | (unless (eq gdb-look-up-stack 'delete) |
| 1949 | bl el) | 1962 | (let ((buffer-read-only nil) |
| 1950 | (goto-char (point-min)) | 1963 | bl el) |
| 1951 | (while (< (point) (point-max)) | 1964 | (goto-char (point-min)) |
| 1952 | (setq bl (line-beginning-position) | 1965 | (while (< (point) (point-max)) |
| 1953 | el (line-end-position)) | 1966 | (setq bl (line-beginning-position) |
| 1954 | (when (looking-at "#") | 1967 | el (line-end-position)) |
| 1955 | (add-text-properties bl el | 1968 | (when (looking-at "#") |
| 1956 | '(mouse-face highlight | 1969 | (add-text-properties bl el |
| 1957 | help-echo "mouse-2, RET: Select frame"))) | 1970 | '(mouse-face highlight |
| 1958 | (goto-char bl) | 1971 | help-echo "mouse-2, RET: Select frame"))) |
| 1959 | (when (looking-at "^#\\([0-9]+\\)") | 1972 | (goto-char bl) |
| 1960 | (when (string-equal (match-string 1) gdb-frame-number) | 1973 | (when (looking-at "^#\\([0-9]+\\)") |
| 1974 | (when (string-equal (match-string 1) gdb-frame-number) | ||
| 1961 | (put-text-property bl (+ bl 4) | 1975 | (put-text-property bl (+ bl 4) |
| 1962 | 'face '(:inverse-video t))) | 1976 | 'face '(:inverse-video t))) |
| 1963 | (when (re-search-forward | 1977 | (when (re-search-forward |
| 1964 | (concat | 1978 | (concat |
| 1965 | (if (string-equal (match-string 1) "0") "" " in ") | 1979 | (if (string-equal (match-string 1) "0") "" " in ") |
| 1966 | "\\([^ ]+\\) (") el t) | 1980 | "\\([^ ]+\\) (") el t) |
| 1967 | (put-text-property (match-beginning 1) (match-end 1) | ||
| 1968 | 'face font-lock-function-name-face) | ||
| 1969 | (setq bl (match-end 0)) | ||
| 1970 | (while (re-search-forward "<\\([^>]+\\)>" el t) | ||
| 1971 | (put-text-property (match-beginning 1) (match-end 1) | 1981 | (put-text-property (match-beginning 1) (match-end 1) |
| 1982 | 'face font-lock-function-name-face) | ||
| 1983 | (setq bl (match-end 0)) | ||
| 1984 | (while (re-search-forward "<\\([^>]+\\)>" el t) | ||
| 1985 | (put-text-property (match-beginning 1) (match-end 1) | ||
| 1972 | 'face font-lock-function-name-face)) | 1986 | 'face font-lock-function-name-face)) |
| 1973 | (goto-char bl) | 1987 | (goto-char bl) |
| 1974 | (while (re-search-forward "\\(\\(\\sw\\|[_.]\\)+\\)=" el t) | 1988 | (while (re-search-forward "\\(\\(\\sw\\|[_.]\\)+\\)=" el t) |
| 1975 | (put-text-property (match-beginning 1) (match-end 1) | 1989 | (put-text-property (match-beginning 1) (match-end 1) |
| 1976 | 'face font-lock-variable-name-face)))) | 1990 | 'face font-lock-variable-name-face)))) |
| 1977 | (forward-line 1)))))) | 1991 | (forward-line 1)))) |
| 1992 | (when gdb-look-up-stack | ||
| 1993 | (goto-char (point-min)) | ||
| 1994 | (when (re-search-forward "\\(\\S-+?\\):\\([0-9]+\\)" nil t) | ||
| 1995 | (let ((start (line-beginning-position)) | ||
| 1996 | (file (match-string 1)) | ||
| 1997 | (line (match-string 2))) | ||
| 1998 | (re-search-backward "^#*\\([0-9]+\\)" start t) | ||
| 1999 | (gdb-enqueue-input | ||
| 2000 | (list (concat gdb-server-prefix "frame " | ||
| 2001 | (match-string 1) "\n") 'gdb-set-hollow)) | ||
| 2002 | (gdb-enqueue-input | ||
| 2003 | (list (concat gdb-server-prefix "frame 0\n") 'ignore))))))) | ||
| 2004 | (if (eq gdb-look-up-stack 'delete) | ||
| 2005 | (kill-buffer (gdb-get-buffer 'gdb-stack-buffer))) | ||
| 2006 | (setq gdb-look-up-stack nil)) | ||
| 2007 | |||
| 2008 | (defun gdb-set-hollow () | ||
| 2009 | (with-current-buffer (gud-find-file (car gud-last-last-frame)) | ||
| 2010 | (setq fringe-indicator-alist | ||
| 2011 | '((overlay-arrow . hollow-right-triangle))))) | ||
| 1978 | 2012 | ||
| 1979 | (defun gdb-stack-buffer-name () | 2013 | (defun gdb-stack-buffer-name () |
| 1980 | (with-current-buffer gud-comint-buffer | 2014 | (with-current-buffer gud-comint-buffer |
| @@ -2030,8 +2064,7 @@ static char *magick[] = { | |||
| 2030 | (if event (posn-set-point (event-end event))) | 2064 | (if event (posn-set-point (event-end event))) |
| 2031 | (gdb-enqueue-input | 2065 | (gdb-enqueue-input |
| 2032 | (list (concat gdb-server-prefix "frame " | 2066 | (list (concat gdb-server-prefix "frame " |
| 2033 | (gdb-get-frame-number) "\n") 'ignore)) | 2067 | (gdb-get-frame-number) "\n") 'ignore))) |
| 2034 | (gud-display-frame)) | ||
| 2035 | 2068 | ||
| 2036 | 2069 | ||
| 2037 | ;; Threads buffer. This displays a selectable thread list. | 2070 | ;; Threads buffer. This displays a selectable thread list. |
| @@ -2049,13 +2082,14 @@ static char *magick[] = { | |||
| 2049 | (defun gdb-info-threads-custom () | 2082 | (defun gdb-info-threads-custom () |
| 2050 | (with-current-buffer (gdb-get-buffer 'gdb-threads-buffer) | 2083 | (with-current-buffer (gdb-get-buffer 'gdb-threads-buffer) |
| 2051 | (let ((buffer-read-only nil)) | 2084 | (let ((buffer-read-only nil)) |
| 2052 | (goto-char (point-min)) | 2085 | (save-excursion |
| 2053 | (while (< (point) (point-max)) | 2086 | (goto-char (point-min)) |
| 2054 | (unless (looking-at "No ") | 2087 | (while (< (point) (point-max)) |
| 2055 | (add-text-properties (line-beginning-position) (line-end-position) | 2088 | (unless (looking-at "No ") |
| 2056 | '(mouse-face highlight | 2089 | (add-text-properties (line-beginning-position) (line-end-position) |
| 2090 | '(mouse-face highlight | ||
| 2057 | help-echo "mouse-2, RET: select thread"))) | 2091 | help-echo "mouse-2, RET: select thread"))) |
| 2058 | (forward-line 1))))) | 2092 | (forward-line 1)))))) |
| 2059 | 2093 | ||
| 2060 | (defun gdb-threads-buffer-name () | 2094 | (defun gdb-threads-buffer-name () |
| 2061 | (with-current-buffer gud-comint-buffer | 2095 | (with-current-buffer gud-comint-buffer |
| @@ -2868,7 +2902,11 @@ of the current session." | |||
| 2868 | gud-comint-buffer | 2902 | gud-comint-buffer |
| 2869 | (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer) | 2903 | (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer) |
| 2870 | '(gdba gdbmi))) | 2904 | '(gdba gdbmi))) |
| 2871 | (if (member buffer-file-name gdb-source-file-list) | 2905 | ;;Pre GDB 6.3 "info sources" doesn't give absolute file name. |
| 2906 | (if (member (if (string-equal gdb-version "pre-6.4") | ||
| 2907 | (file-name-nondirectory buffer-file-name) | ||
| 2908 | buffer-file-name) | ||
| 2909 | gdb-source-file-list) | ||
| 2872 | (with-current-buffer (find-buffer-visiting buffer-file-name) | 2910 | (with-current-buffer (find-buffer-visiting buffer-file-name) |
| 2873 | (set (make-local-variable 'gud-minor-mode) | 2911 | (set (make-local-variable 'gud-minor-mode) |
| 2874 | (buffer-local-value 'gud-minor-mode gud-comint-buffer)) | 2912 | (buffer-local-value 'gud-minor-mode gud-comint-buffer)) |
| @@ -3203,7 +3241,8 @@ is set in them." | |||
| 3203 | (when gud-tooltip-mode | 3241 | (when gud-tooltip-mode |
| 3204 | (make-local-variable 'gdb-define-alist) | 3242 | (make-local-variable 'gdb-define-alist) |
| 3205 | (gdb-create-define-alist) | 3243 | (gdb-create-define-alist) |
| 3206 | (add-hook 'after-save-hook 'gdb-create-define-alist nil t)))))) | 3244 | (add-hook 'after-save-hook 'gdb-create-define-alist nil t))))) |
| 3245 | (gdb-force-mode-line-update "ready")) | ||
| 3207 | 3246 | ||
| 3208 | ; Uses "-var-list-children --all-values". Needs GDB 6.1 onwards. | 3247 | ; Uses "-var-list-children --all-values". Needs GDB 6.1 onwards. |
| 3209 | (defun gdb-var-list-children-1 (varnum) | 3248 | (defun gdb-var-list-children-1 (varnum) |
diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el index bda30b196e1..1ce5d404a80 100644 --- a/lisp/progmodes/gud.el +++ b/lisp/progmodes/gud.el | |||
| @@ -101,8 +101,8 @@ If SOFT is non-nil, returns nil if the symbol doesn't already exist." | |||
| 101 | (if (boundp sym) (symbol-value sym)))) | 101 | (if (boundp sym) (symbol-value sym)))) |
| 102 | 102 | ||
| 103 | (defvar gud-running nil | 103 | (defvar gud-running nil |
| 104 | "Non-nil if debuggee is running. | 104 | "Non-nil if debugged program is running. |
| 105 | Used to grey out relevant togolbar icons.") | 105 | Used to grey out relevant toolbar icons.") |
| 106 | 106 | ||
| 107 | ;; Use existing Info buffer, if possible. | 107 | ;; Use existing Info buffer, if possible. |
| 108 | (defun gud-goto-info () | 108 | (defun gud-goto-info () |
| @@ -130,10 +130,10 @@ Used to grey out relevant togolbar icons.") | |||
| 130 | 130 | ||
| 131 | (defun gud-stop-subjob () | 131 | (defun gud-stop-subjob () |
| 132 | (interactive) | 132 | (interactive) |
| 133 | (if (string-equal | 133 | (with-current-buffer gud-comint-buffer |
| 134 | (buffer-local-value 'gud-target-name gud-comint-buffer) "emacs") | 134 | (if (string-equal gud-target-name "emacs") |
| 135 | (comint-stop-subjob) | 135 | (comint-stop-subjob) |
| 136 | (comint-interrupt-subjob))) | 136 | (comint-interrupt-subjob)))) |
| 137 | 137 | ||
| 138 | (easy-mmode-defmap gud-menu-map | 138 | (easy-mmode-defmap gud-menu-map |
| 139 | '(([help] "Info" . gud-goto-info) | 139 | '(([help] "Info" . gud-goto-info) |
| @@ -141,13 +141,15 @@ Used to grey out relevant togolbar icons.") | |||
| 141 | :enable (and (not emacs-basic-display) | 141 | :enable (and (not emacs-basic-display) |
| 142 | (display-graphic-p) | 142 | (display-graphic-p) |
| 143 | (fboundp 'x-show-tip)) | 143 | (fboundp 'x-show-tip)) |
| 144 | :visible (memq gud-minor-mode | ||
| 145 | '(gdbmi gdba dbx sdb xdb pdb)) | ||
| 144 | :button (:toggle . gud-tooltip-mode)) | 146 | :button (:toggle . gud-tooltip-mode)) |
| 145 | ([refresh] "Refresh" . gud-refresh) | 147 | ([refresh] "Refresh" . gud-refresh) |
| 146 | ([run] menu-item "Run" gud-run | 148 | ([run] menu-item "Run" gud-run |
| 147 | :enable (and (not gud-running) | 149 | :enable (not gud-running) |
| 148 | (memq gud-minor-mode '(gdbmi gdb dbx jdb))) | 150 | :visible (and (memq gud-minor-mode '(gdbmi gdb dbx jdb)) |
| 149 | :visible (not (eq gud-minor-mode 'gdba))) | 151 | (not (eq gud-minor-mode 'gdba)))) |
| 150 | ([go] menu-item "Run/Continue" gud-go | 152 | ([go] menu-item (if gdb-active-process "Continue" "Run") gud-go |
| 151 | :visible (and (not gud-running) | 153 | :visible (and (not gud-running) |
| 152 | (eq gud-minor-mode 'gdba))) | 154 | (eq gud-minor-mode 'gdba))) |
| 153 | ([stop] menu-item "Stop" gud-stop-subjob | 155 | ([stop] menu-item "Stop" gud-stop-subjob |
| @@ -155,26 +157,27 @@ Used to grey out relevant togolbar icons.") | |||
| 155 | (and gud-running | 157 | (and gud-running |
| 156 | (eq gud-minor-mode 'gdba)))) | 158 | (eq gud-minor-mode 'gdba)))) |
| 157 | ([until] menu-item "Continue to selection" gud-until | 159 | ([until] menu-item "Continue to selection" gud-until |
| 158 | :enable (and (not gud-running) | 160 | :enable (not gud-running) |
| 159 | (memq gud-minor-mode '(gdbmi gdba gdb perldb))) | 161 | :visible (and (memq gud-minor-mode '(gdbmi gdba gdb perldb)) |
| 160 | :visible (gud-tool-bar-item-visible-no-fringe)) | 162 | (gud-tool-bar-item-visible-no-fringe))) |
| 161 | ([remove] menu-item "Remove Breakpoint" gud-remove | 163 | ([remove] menu-item "Remove Breakpoint" gud-remove |
| 162 | :enable (not gud-running) | 164 | :enable (not gud-running) |
| 163 | :visible (gud-tool-bar-item-visible-no-fringe)) | 165 | :visible (gud-tool-bar-item-visible-no-fringe)) |
| 164 | ([tbreak] menu-item "Temporary Breakpoint" gud-tbreak | 166 | ([tbreak] menu-item "Temporary Breakpoint" gud-tbreak |
| 165 | :enable (memq gud-minor-mode | 167 | :enable (not gud-running) |
| 168 | :visible (memq gud-minor-mode | ||
| 166 | '(gdbmi gdba gdb sdb xdb bashdb))) | 169 | '(gdbmi gdba gdb sdb xdb bashdb))) |
| 167 | ([break] menu-item "Set Breakpoint" gud-break | 170 | ([break] menu-item "Set Breakpoint" gud-break |
| 168 | :enable (not gud-running) | 171 | :enable (not gud-running) |
| 169 | :visible (gud-tool-bar-item-visible-no-fringe)) | 172 | :visible (gud-tool-bar-item-visible-no-fringe)) |
| 170 | ([up] menu-item "Up Stack" gud-up | 173 | ([up] menu-item "Up Stack" gud-up |
| 171 | :enable (and (not gud-running) | 174 | :enable (not gud-running) |
| 172 | (memq gud-minor-mode | 175 | :visible (memq gud-minor-mode |
| 173 | '(gdbmi gdba gdb dbx xdb jdb pdb bashdb)))) | 176 | '(gdbmi gdba gdb dbx xdb jdb pdb bashdb))) |
| 174 | ([down] menu-item "Down Stack" gud-down | 177 | ([down] menu-item "Down Stack" gud-down |
| 175 | :enable (and (not gud-running) | 178 | :enable (not gud-running) |
| 176 | (memq gud-minor-mode | 179 | :visible (memq gud-minor-mode |
| 177 | '(gdbmi gdba gdb dbx xdb jdb pdb bashdb)))) | 180 | '(gdbmi gdba gdb dbx xdb jdb pdb bashdb))) |
| 178 | ([pp] menu-item "Print S-expression" gud-pp | 181 | ([pp] menu-item "Print S-expression" gud-pp |
| 179 | :enable (and (not gud-running) | 182 | :enable (and (not gud-running) |
| 180 | gdb-active-process) | 183 | gdb-active-process) |
| @@ -183,23 +186,23 @@ Used to grey out relevant togolbar icons.") | |||
| 183 | 'gud-target-name gud-comint-buffer) "emacs") | 186 | 'gud-target-name gud-comint-buffer) "emacs") |
| 184 | (eq gud-minor-mode 'gdba))) | 187 | (eq gud-minor-mode 'gdba))) |
| 185 | ([print*] menu-item "Print Dereference" gud-pstar | 188 | ([print*] menu-item "Print Dereference" gud-pstar |
| 186 | :enable (and (not gud-running) | 189 | :enable (not gud-running) |
| 187 | (memq gud-minor-mode '(gdbmi gdba gdb)))) | 190 | :visible (memq gud-minor-mode '(gdbmi gdba gdb))) |
| 188 | ([print] menu-item "Print Expression" gud-print | 191 | ([print] menu-item "Print Expression" gud-print |
| 189 | :enable (not gud-running)) | 192 | :enable (not gud-running)) |
| 190 | ([watch] menu-item "Watch Expression" gud-watch | 193 | ([watch] menu-item "Watch Expression" gud-watch |
| 191 | :enable (and (not gud-running) | 194 | :enable (not gud-running) |
| 192 | (memq gud-minor-mode '(gdbmi gdba)))) | 195 | :visible (memq gud-minor-mode '(gdbmi gdba))) |
| 193 | ([finish] menu-item "Finish Function" gud-finish | 196 | ([finish] menu-item "Finish Function" gud-finish |
| 194 | :enable (and (not gud-running) | 197 | :enable (not gud-running) |
| 195 | (memq gud-minor-mode | 198 | :visible (memq gud-minor-mode |
| 196 | '(gdbmi gdba gdb xdb jdb pdb bashdb)))) | 199 | '(gdbmi gdba gdb xdb jdb pdb bashdb))) |
| 197 | ([stepi] menu-item "Step Instruction" gud-stepi | 200 | ([stepi] menu-item "Step Instruction" gud-stepi |
| 198 | :enable (and (not gud-running) | 201 | :enable (not gud-running) |
| 199 | (memq gud-minor-mode '(gdbmi gdba gdb dbx)))) | 202 | :visible (memq gud-minor-mode '(gdbmi gdba gdb dbx))) |
| 200 | ([nexti] menu-item "Next Instruction" gud-nexti | 203 | ([nexti] menu-item "Next Instruction" gud-nexti |
| 201 | :enable (and (not gud-running) | 204 | :enable (not gud-running) |
| 202 | (memq gud-minor-mode '(gdbmi gdba gdb dbx)))) | 205 | :visible (memq gud-minor-mode '(gdbmi gdba gdb dbx))) |
| 203 | ([step] menu-item "Step Line" gud-step | 206 | ([step] menu-item "Step Line" gud-step |
| 204 | :enable (not gud-running)) | 207 | :enable (not gud-running)) |
| 205 | ([next] menu-item "Next Line" gud-next | 208 | ([next] menu-item "Next Line" gud-next |
| @@ -2565,7 +2568,7 @@ comint mode, which see." | |||
| 2565 | (existing-buffer (get-buffer (concat "*gud" filepart "*")))) | 2568 | (existing-buffer (get-buffer (concat "*gud" filepart "*")))) |
| 2566 | (pop-to-buffer (concat "*gud" filepart "*")) | 2569 | (pop-to-buffer (concat "*gud" filepart "*")) |
| 2567 | (when (and existing-buffer (get-buffer-process existing-buffer)) | 2570 | (when (and existing-buffer (get-buffer-process existing-buffer)) |
| 2568 | (error "This program is already running under gdb")) | 2571 | (error "This program is already being debugged")) |
| 2569 | ;; Set the dir, in case the buffer already existed with a different dir. | 2572 | ;; Set the dir, in case the buffer already existed with a different dir. |
| 2570 | (setq default-directory dir) | 2573 | (setq default-directory dir) |
| 2571 | ;; Set default-directory to the file's directory. | 2574 | ;; Set default-directory to the file's directory. |
| @@ -2693,10 +2696,10 @@ It is saved for when this flag is not set.") | |||
| 2693 | ((memq (process-status proc) '(signal exit)) | 2696 | ((memq (process-status proc) '(signal exit)) |
| 2694 | ;; Stop displaying an arrow in a source file. | 2697 | ;; Stop displaying an arrow in a source file. |
| 2695 | (setq gud-overlay-arrow-position nil) | 2698 | (setq gud-overlay-arrow-position nil) |
| 2696 | (with-current-buffer gud-comint-buffer | 2699 | (if (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer) |
| 2697 | (if (memq gud-minor-mode-type '(gdbmi gdba)) | 2700 | '(gdba gdbmi)) |
| 2698 | (gdb-reset) | 2701 | (gdb-reset) |
| 2699 | (gud-reset))) | 2702 | (gud-reset)) |
| 2700 | (let* ((obuf (current-buffer))) | 2703 | (let* ((obuf (current-buffer))) |
| 2701 | ;; save-excursion isn't the right thing if | 2704 | ;; save-excursion isn't the right thing if |
| 2702 | ;; process-buffer is current-buffer | 2705 | ;; process-buffer is current-buffer |
| @@ -3313,7 +3316,8 @@ Treats actions as defuns." | |||
| 3313 | (kill-local-variable 'gdb-define-alist) | 3316 | (kill-local-variable 'gdb-define-alist) |
| 3314 | (remove-hook 'after-save-hook 'gdb-create-define-alist t)))) | 3317 | (remove-hook 'after-save-hook 'gdb-create-define-alist t)))) |
| 3315 | 3318 | ||
| 3316 | (defcustom gud-tooltip-modes '(gud-mode c-mode c++-mode fortran-mode) | 3319 | (defcustom gud-tooltip-modes '(gud-mode c-mode c++-mode fortran-mode |
| 3320 | python-mode) | ||
| 3317 | "List of modes for which to enable GUD tooltips." | 3321 | "List of modes for which to enable GUD tooltips." |
| 3318 | :type 'sexp | 3322 | :type 'sexp |
| 3319 | :group 'gud | 3323 | :group 'gud |
| @@ -3427,9 +3431,8 @@ With arg, dereference expr iff arg is positive." | |||
| 3427 | (case gud-minor-mode | 3431 | (case gud-minor-mode |
| 3428 | (gdba (concat "server print " expr)) | 3432 | (gdba (concat "server print " expr)) |
| 3429 | ((dbx gdbmi) (concat "print " expr)) | 3433 | ((dbx gdbmi) (concat "print " expr)) |
| 3430 | (xdb (concat "p " expr)) | 3434 | ((xdb pdb) (concat "p " expr)) |
| 3431 | (sdb (concat expr "/")) | 3435 | (sdb (concat expr "/")))) |
| 3432 | (perldb expr))) | ||
| 3433 | 3436 | ||
| 3434 | (defun gud-tooltip-tips (event) | 3437 | (defun gud-tooltip-tips (event) |
| 3435 | "Show tip for identifier or selection under the mouse. | 3438 | "Show tip for identifier or selection under the mouse. |
diff --git a/lisp/progmodes/inf-lisp.el b/lisp/progmodes/inf-lisp.el index 092c7736c27..4a50e00063c 100644 --- a/lisp/progmodes/inf-lisp.el +++ b/lisp/progmodes/inf-lisp.el | |||
| @@ -233,30 +233,37 @@ documentation for variable `inferior-lisp-buffer'. | |||
| 233 | 233 | ||
| 234 | \\{inferior-lisp-mode-map} | 234 | \\{inferior-lisp-mode-map} |
| 235 | 235 | ||
| 236 | Customisation: Entry to this mode runs the hooks on `comint-mode-hook' and | 236 | Customization: Entry to this mode runs the hooks on `comint-mode-hook' and |
| 237 | `inferior-lisp-mode-hook' (in that order). | 237 | `inferior-lisp-mode-hook' (in that order). |
| 238 | 238 | ||
| 239 | You can send text to the inferior Lisp process from other buffers containing | 239 | You can send text to the inferior Lisp process from other buffers containing |
| 240 | Lisp source. | 240 | Lisp source. |
| 241 | switch-to-lisp switches the current buffer to the Lisp process buffer. | 241 | `switch-to-lisp' switches the current buffer to the Lisp process buffer. |
| 242 | lisp-eval-defun sends the current defun to the Lisp process. | 242 | `lisp-eval-defun' sends the current defun to the Lisp process. |
| 243 | lisp-compile-defun compiles the current defun. | 243 | `lisp-compile-defun' compiles the current defun. |
| 244 | lisp-eval-region sends the current region to the Lisp process. | 244 | `lisp-eval-region' sends the current region to the Lisp process. |
| 245 | lisp-compile-region compiles the current region. | 245 | `lisp-compile-region' compiles the current region. |
| 246 | 246 | ||
| 247 | Prefixing the lisp-eval/compile-defun/region commands with | 247 | Prefixing the lisp-eval/compile-defun/region commands with |
| 248 | a \\[universal-argument] causes a switch to the Lisp process buffer after sending | 248 | a \\[universal-argument] causes a switch to the Lisp process buffer after sending |
| 249 | the text. | 249 | the text. |
| 250 | 250 | ||
| 251 | Commands: | 251 | Commands:\\<inferior-lisp-mode-map> |
| 252 | Return after the end of the process' output sends the text from the | 252 | \\[comint-send-input] after the end of the process' output sends the text from the |
| 253 | end of process to point. | 253 | end of process to point. |
| 254 | Return before the end of the process' output copies the sexp ending at point | 254 | \\[comint-send-input] before the end of the process' output copies the sexp ending at point |
| 255 | to the end of the process' output, and sends it. | 255 | to the end of the process' output, and sends it. |
| 256 | Delete converts tabs to spaces as it moves back. | 256 | \\[comint-copy-old-input] copies the sexp ending at point to the end of the process' output, |
| 257 | Tab indents for Lisp; with argument, shifts rest | 257 | allowing you to edit it before sending it. |
| 258 | If `comint-use-prompt-regexp' is nil (the default), \\[comint-insert-input] on old input | ||
| 259 | copies the entire old input to the end of the process' output, allowing | ||
| 260 | you to edit it before sending it. When not used on old input, or if | ||
| 261 | `comint-use-prompt-regexp' is non-nil, \\[comint-insert-input] behaves according to | ||
| 262 | its global binding. | ||
| 263 | \\[backward-delete-char-untabify] converts tabs to spaces as it moves back. | ||
| 264 | \\[lisp-indent-line] indents for Lisp; with argument, shifts rest | ||
| 258 | of expression rigidly with the current line. | 265 | of expression rigidly with the current line. |
| 259 | C-M-q does Tab on each line starting within following expression. | 266 | \\[indent-sexp] does \\[lisp-indent-line] on each line starting within following expression. |
| 260 | Paragraphs are separated only by blank lines. Semicolons start comments. | 267 | Paragraphs are separated only by blank lines. Semicolons start comments. |
| 261 | If you accidentally suspend your process, use \\[comint-continue-subjob] | 268 | If you accidentally suspend your process, use \\[comint-continue-subjob] |
| 262 | to continue it." | 269 | to continue it." |
diff --git a/lisp/progmodes/make-mode.el b/lisp/progmodes/make-mode.el index 66507dd78df..a3146df3e45 100644 --- a/lisp/progmodes/make-mode.el +++ b/lisp/progmodes/make-mode.el | |||
| @@ -291,6 +291,9 @@ not be enclosed in { } or ( )." | |||
| 291 | ;; that if you change this regexp you might have to fix the imenu index in | 291 | ;; that if you change this regexp you might have to fix the imenu index in |
| 292 | ;; makefile-imenu-generic-expression. | 292 | ;; makefile-imenu-generic-expression. |
| 293 | (defconst makefile-macroassign-regex | 293 | (defconst makefile-macroassign-regex |
| 294 | ;; We used to match not just the varname but also the whole value | ||
| 295 | ;; (spanning potentially several lines). | ||
| 296 | ;; "^ *\\([^ \n\t][^:#= \t\n]*\\)[ \t]*\\(?:!=[ \t]*\\(\\(?:.+\\\\\n\\)*.+\\)\\|[*:+]?[:?]?=[ \t]*\\(\\(?:.*\\\\\n\\)*.*\\)\\)" | ||
| 294 | "^ *\\([^ \n\t][^:#= \t\n]*\\)[ \t]*\\(?:!=\\|[*:+]?[:?]?=\\)" | 297 | "^ *\\([^ \n\t][^:#= \t\n]*\\)[ \t]*\\(?:!=\\|[*:+]?[:?]?=\\)" |
| 295 | "Regex used to find macro assignment lines in a makefile.") | 298 | "Regex used to find macro assignment lines in a makefile.") |
| 296 | 299 | ||
| @@ -623,39 +626,38 @@ The function must satisfy this calling convention: | |||
| 623 | map) | 626 | map) |
| 624 | "The keymap that is used in Makefile mode.") | 627 | "The keymap that is used in Makefile mode.") |
| 625 | 628 | ||
| 626 | (defvar makefile-browser-map nil | 629 | |
| 630 | (defvar makefile-browser-map | ||
| 631 | (let ((map (make-sparse-keymap))) | ||
| 632 | (define-key map "n" 'makefile-browser-next-line) | ||
| 633 | (define-key map "\C-n" 'makefile-browser-next-line) | ||
| 634 | (define-key map "p" 'makefile-browser-previous-line) | ||
| 635 | (define-key map "\C-p" 'makefile-browser-previous-line) | ||
| 636 | (define-key map " " 'makefile-browser-toggle) | ||
| 637 | (define-key map "i" 'makefile-browser-insert-selection) | ||
| 638 | (define-key map "I" 'makefile-browser-insert-selection-and-quit) | ||
| 639 | (define-key map "\C-c\C-m" 'makefile-browser-insert-continuation) | ||
| 640 | (define-key map "q" 'makefile-browser-quit) | ||
| 641 | ;; disable horizontal movement | ||
| 642 | (define-key map "\C-b" 'undefined) | ||
| 643 | (define-key map "\C-f" 'undefined) | ||
| 644 | map) | ||
| 627 | "The keymap that is used in the macro- and target browser.") | 645 | "The keymap that is used in the macro- and target browser.") |
| 628 | (if makefile-browser-map | 646 | |
| 629 | () | 647 | |
| 630 | (setq makefile-browser-map (make-sparse-keymap)) | 648 | (defvar makefile-mode-syntax-table |
| 631 | (define-key makefile-browser-map "n" 'makefile-browser-next-line) | 649 | (let ((st (make-syntax-table))) |
| 632 | (define-key makefile-browser-map "\C-n" 'makefile-browser-next-line) | 650 | (modify-syntax-entry ?\( "() " st) |
| 633 | (define-key makefile-browser-map "p" 'makefile-browser-previous-line) | 651 | (modify-syntax-entry ?\) ")( " st) |
| 634 | (define-key makefile-browser-map "\C-p" 'makefile-browser-previous-line) | 652 | (modify-syntax-entry ?\[ "(] " st) |
| 635 | (define-key makefile-browser-map " " 'makefile-browser-toggle) | 653 | (modify-syntax-entry ?\] ")[ " st) |
| 636 | (define-key makefile-browser-map "i" 'makefile-browser-insert-selection) | 654 | (modify-syntax-entry ?\{ "(} " st) |
| 637 | (define-key makefile-browser-map "I" 'makefile-browser-insert-selection-and-quit) | 655 | (modify-syntax-entry ?\} "){ " st) |
| 638 | (define-key makefile-browser-map "\C-c\C-m" 'makefile-browser-insert-continuation) | 656 | (modify-syntax-entry ?\' "\" " st) |
| 639 | (define-key makefile-browser-map "q" 'makefile-browser-quit) | 657 | (modify-syntax-entry ?\` "\" " st) |
| 640 | ;; disable horizontal movement | 658 | (modify-syntax-entry ?# "< " st) |
| 641 | (define-key makefile-browser-map "\C-b" 'undefined) | 659 | (modify-syntax-entry ?\n "> " st) |
| 642 | (define-key makefile-browser-map "\C-f" 'undefined)) | 660 | st)) |
| 643 | |||
| 644 | |||
| 645 | (defvar makefile-mode-syntax-table nil) | ||
| 646 | (if makefile-mode-syntax-table | ||
| 647 | () | ||
| 648 | (setq makefile-mode-syntax-table (make-syntax-table)) | ||
| 649 | (modify-syntax-entry ?\( "() " makefile-mode-syntax-table) | ||
| 650 | (modify-syntax-entry ?\) ")( " makefile-mode-syntax-table) | ||
| 651 | (modify-syntax-entry ?\[ "(] " makefile-mode-syntax-table) | ||
| 652 | (modify-syntax-entry ?\] ")[ " makefile-mode-syntax-table) | ||
| 653 | (modify-syntax-entry ?\{ "(} " makefile-mode-syntax-table) | ||
| 654 | (modify-syntax-entry ?\} "){ " makefile-mode-syntax-table) | ||
| 655 | (modify-syntax-entry ?\' "\" " makefile-mode-syntax-table) | ||
| 656 | (modify-syntax-entry ?\` "\" " makefile-mode-syntax-table) | ||
| 657 | (modify-syntax-entry ?# "< " makefile-mode-syntax-table) | ||
| 658 | (modify-syntax-entry ?\n "> " makefile-mode-syntax-table)) | ||
| 659 | 661 | ||
| 660 | (defvar makefile-imake-mode-syntax-table (copy-syntax-table | 662 | (defvar makefile-imake-mode-syntax-table (copy-syntax-table |
| 661 | makefile-mode-syntax-table)) | 663 | makefile-mode-syntax-table)) |
| @@ -1302,30 +1304,9 @@ definition and conveniently use this command." | |||
| 1302 | (save-excursion | 1304 | (save-excursion |
| 1303 | (beginning-of-line) | 1305 | (beginning-of-line) |
| 1304 | (cond | 1306 | (cond |
| 1305 | ((looking-at "^#+") | 1307 | ((looking-at "^#+\\s-*") |
| 1306 | ;; Found a comment. Set the fill prefix, and find the paragraph | 1308 | ;; Found a comment. Return nil to let normal filling take place. |
| 1307 | ;; boundaries by searching for lines that look like comment-only | 1309 | nil) |
| 1308 | ;; lines. | ||
| 1309 | (let ((fill-prefix (match-string-no-properties 0)) | ||
| 1310 | (fill-paragraph-function nil)) | ||
| 1311 | (save-excursion | ||
| 1312 | (save-restriction | ||
| 1313 | (narrow-to-region | ||
| 1314 | ;; Search backwards. | ||
| 1315 | (save-excursion | ||
| 1316 | (while (and (zerop (forward-line -1)) | ||
| 1317 | (looking-at "^#"))) | ||
| 1318 | ;; We may have gone too far. Go forward again. | ||
| 1319 | (or (looking-at "^#") | ||
| 1320 | (forward-line 1)) | ||
| 1321 | (point)) | ||
| 1322 | ;; Search forwards. | ||
| 1323 | (save-excursion | ||
| 1324 | (while (looking-at "^#") | ||
| 1325 | (forward-line)) | ||
| 1326 | (point))) | ||
| 1327 | (fill-paragraph nil) | ||
| 1328 | t)))) | ||
| 1329 | 1310 | ||
| 1330 | ;; Must look for backslashed-region before looking for variable | 1311 | ;; Must look for backslashed-region before looking for variable |
| 1331 | ;; assignment. | 1312 | ;; assignment. |
| @@ -1354,7 +1335,9 @@ definition and conveniently use this command." | |||
| 1354 | (makefile-backslash-region (point-min) (point-max) nil) | 1335 | (makefile-backslash-region (point-min) (point-max) nil) |
| 1355 | (goto-char (point-max)) | 1336 | (goto-char (point-max)) |
| 1356 | (if (< (skip-chars-backward "\n") 0) | 1337 | (if (< (skip-chars-backward "\n") 0) |
| 1357 | (delete-region (point) (point-max)))))) | 1338 | (delete-region (point) (point-max))))) |
| 1339 | ;; Return non-nil to indicate it's been filled. | ||
| 1340 | t) | ||
| 1358 | 1341 | ||
| 1359 | ((looking-at makefile-macroassign-regex) | 1342 | ((looking-at makefile-macroassign-regex) |
| 1360 | ;; Have a macro assign. Fill just this line, and then backslash | 1343 | ;; Have a macro assign. Fill just this line, and then backslash |
| @@ -1363,10 +1346,13 @@ definition and conveniently use this command." | |||
| 1363 | (narrow-to-region (point) (line-beginning-position 2)) | 1346 | (narrow-to-region (point) (line-beginning-position 2)) |
| 1364 | (let ((fill-paragraph-function nil)) | 1347 | (let ((fill-paragraph-function nil)) |
| 1365 | (fill-paragraph nil)) | 1348 | (fill-paragraph nil)) |
| 1366 | (makefile-backslash-region (point-min) (point-max) nil))))) | 1349 | (makefile-backslash-region (point-min) (point-max) nil)) |
| 1350 | ;; Return non-nil to indicate it's been filled. | ||
| 1351 | t) | ||
| 1367 | 1352 | ||
| 1368 | ;; Always return non-nil so we don't fill anything else. | 1353 | (t |
| 1369 | t) | 1354 | ;; Return non-nil so we don't fill anything else. |
| 1355 | t)))) | ||
| 1370 | 1356 | ||
| 1371 | 1357 | ||
| 1372 | 1358 | ||
| @@ -1882,5 +1868,5 @@ If it isn't in one, return nil." | |||
| 1882 | 1868 | ||
| 1883 | (provide 'make-mode) | 1869 | (provide 'make-mode) |
| 1884 | 1870 | ||
| 1885 | ;;; arch-tag: bd23545a-de91-44fb-b1b2-feafbb2635a0 | 1871 | ;; arch-tag: bd23545a-de91-44fb-b1b2-feafbb2635a0 |
| 1886 | ;;; make-mode.el ends here | 1872 | ;;; make-mode.el ends here |
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index ab3da050456..ef80d28c578 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el | |||
| @@ -814,6 +814,18 @@ See `sh-feature'.") | |||
| 814 | (:weight bold))) | 814 | (:weight bold))) |
| 815 | "Face to show a here-document" | 815 | "Face to show a here-document" |
| 816 | :group 'sh-indentation) | 816 | :group 'sh-indentation) |
| 817 | |||
| 818 | ;; These colours are probably icky. It's just a placeholder though. | ||
| 819 | (defface sh-quoted-exec | ||
| 820 | '((((class color) (background dark)) | ||
| 821 | (:foreground "salmon")) | ||
| 822 | (((class color) (background light)) | ||
| 823 | (:foreground "magenta")) | ||
| 824 | (t | ||
| 825 | (:weight bold))) | ||
| 826 | "Face to show quoted execs like ``" | ||
| 827 | :group 'sh-indentation) | ||
| 828 | |||
| 817 | ;; backward-compatibility alias | 829 | ;; backward-compatibility alias |
| 818 | (put 'sh-heredoc-face 'face-alias 'sh-heredoc) | 830 | (put 'sh-heredoc-face 'face-alias 'sh-heredoc) |
| 819 | (defvar sh-heredoc-face 'sh-heredoc) | 831 | (defvar sh-heredoc-face 'sh-heredoc) |
| @@ -833,7 +845,7 @@ See `sh-feature'.") | |||
| 833 | font-lock-variable-name-face)) | 845 | font-lock-variable-name-face)) |
| 834 | 846 | ||
| 835 | (rc sh-append es) | 847 | (rc sh-append es) |
| 836 | 848 | (bash sh-append shell ("\\$(\\(\\sw+\\)" (1 'sh-quoted-exec t) )) | |
| 837 | (sh sh-append shell | 849 | (sh sh-append shell |
| 838 | ;; Variable names. | 850 | ;; Variable names. |
| 839 | ("\\$\\({#?\\)?\\([A-Za-z_][A-Za-z0-9_]*\\|[-#?@!]\\)" 2 | 851 | ("\\$\\({#?\\)?\\([A-Za-z_][A-Za-z0-9_]*\\|[-#?@!]\\)" 2 |
| @@ -967,6 +979,49 @@ Point is at the beginning of the next line." | |||
| 967 | ;; This looks silly, but it's because `sh-here-doc-re' keeps changing. | 979 | ;; This looks silly, but it's because `sh-here-doc-re' keeps changing. |
| 968 | (re-search-forward sh-here-doc-re limit t)) | 980 | (re-search-forward sh-here-doc-re limit t)) |
| 969 | 981 | ||
| 982 | (defun sh-quoted-subshell (limit) | ||
| 983 | "Search for a subshell embedded in a string. Find all the unescaped | ||
| 984 | \" characters within said subshell, remembering that subshells can nest." | ||
| 985 | (if (re-search-forward "\"\\(?:.\\|\n\\)*?\\(\\$(\\|`\\)" limit t) | ||
| 986 | ;; bingo we have a $( or a ` inside a "" | ||
| 987 | (let ((char (char-after (point))) | ||
| 988 | (continue t) | ||
| 989 | (pos (point)) | ||
| 990 | (data nil) ;; value to put into match-data (and return) | ||
| 991 | (last nil) ;; last char seen | ||
| 992 | (bq (equal (match-string 1) "`")) ;; ` state flip-flop | ||
| 993 | (seen nil) ;; list of important positions | ||
| 994 | (nest 1)) ;; subshell nesting level | ||
| 995 | (while (and continue char (<= pos limit)) | ||
| 996 | ;; unescaped " inside a $( ... ) construct. | ||
| 997 | ;; state machine time... | ||
| 998 | ;; \ => ignore next char; | ||
| 999 | ;; ` => increase or decrease nesting level based on bq flag | ||
| 1000 | ;; ) [where nesting > 0] => decrease nesting | ||
| 1001 | ;; ( [where nesting > 0] => increase nesting | ||
| 1002 | ;; ( [preceeded by $ ] => increase nesting | ||
| 1003 | ;; " [nesting <= 0 ] => terminate, we're done. | ||
| 1004 | ;; " [nesting > 0 ] => remember this, it's not a proper " | ||
| 1005 | (if (eq ?\\ last) nil | ||
| 1006 | (if (eq ?\` char) (setq nest (+ nest (if bq -1 1)) bq (not bq)) | ||
| 1007 | (if (and (> nest 0) (eq ?\) char)) (setq nest (1- nest)) | ||
| 1008 | (if (and (eq ?$ last) (eq ?\( char)) (setq nest (1+ nest)) | ||
| 1009 | (if (and (> nest 0) (eq ?\( char)) (setq nest (1+ nest)) | ||
| 1010 | (if (eq char ?\") | ||
| 1011 | (if (>= 0 nest) (setq continue nil) | ||
| 1012 | (setq seen (cons pos seen)) ) )))))) | ||
| 1013 | ;;(message "POS: %d [%d]" pos nest) | ||
| 1014 | (setq last char | ||
| 1015 | pos (1+ pos) | ||
| 1016 | char (char-after pos)) ) | ||
| 1017 | (when seen | ||
| 1018 | ;;(message "SEEN: %S" seen) | ||
| 1019 | (setq data (list (current-buffer))) | ||
| 1020 | (mapc (lambda (P) | ||
| 1021 | (setq data (cons P (cons (1+ P) data)) ) ) seen) | ||
| 1022 | (store-match-data data)) | ||
| 1023 | data) )) | ||
| 1024 | |||
| 970 | (defun sh-is-quoted-p (pos) | 1025 | (defun sh-is-quoted-p (pos) |
| 971 | (and (eq (char-before pos) ?\\) | 1026 | (and (eq (char-before pos) ?\\) |
| 972 | (not (sh-is-quoted-p (1- pos))))) | 1027 | (not (sh-is-quoted-p (1- pos))))) |
| @@ -997,6 +1052,17 @@ Point is at the beginning of the next line." | |||
| 997 | (when (save-excursion (backward-char 2) (looking-at ";;\\|in")) | 1052 | (when (save-excursion (backward-char 2) (looking-at ";;\\|in")) |
| 998 | sh-st-punc))) | 1053 | sh-st-punc))) |
| 999 | 1054 | ||
| 1055 | (defun sh-apply-quoted-subshell () | ||
| 1056 | "Apply the `sh-st-punc' syntax to all the matches in `match-data'. | ||
| 1057 | This is used to flag quote characters in subshell constructs inside strings | ||
| 1058 | \(which should therefore not be treated as normal quote characters\)" | ||
| 1059 | (let ((m (match-data)) a b) | ||
| 1060 | (while m | ||
| 1061 | (setq a (car m) | ||
| 1062 | b (cadr m) | ||
| 1063 | m (cddr m)) | ||
| 1064 | (put-text-property a b 'syntax-table sh-st-punc))) sh-st-punc) | ||
| 1065 | |||
| 1000 | (defconst sh-font-lock-syntactic-keywords | 1066 | (defconst sh-font-lock-syntactic-keywords |
| 1001 | ;; A `#' begins a comment when it is unquoted and at the beginning of a | 1067 | ;; A `#' begins a comment when it is unquoted and at the beginning of a |
| 1002 | ;; word. In the shell, words are separated by metacharacters. | 1068 | ;; word. In the shell, words are separated by metacharacters. |
| @@ -1007,6 +1073,9 @@ Point is at the beginning of the next line." | |||
| 1007 | ("\\(\\\\\\)'" 1 ,sh-st-punc) | 1073 | ("\\(\\\\\\)'" 1 ,sh-st-punc) |
| 1008 | ;; Make sure $@ and @? are correctly recognized as sexps. | 1074 | ;; Make sure $@ and @? are correctly recognized as sexps. |
| 1009 | ("\\$\\([?@]\\)" 1 ,sh-st-symbol) | 1075 | ("\\$\\([?@]\\)" 1 ,sh-st-symbol) |
| 1076 | ;; highlight (possibly nested) subshells inside "" quoted regions correctly. | ||
| 1077 | (sh-quoted-subshell | ||
| 1078 | (1 (sh-apply-quoted-subshell) t t)) | ||
| 1010 | ;; Find HEREDOC starters and add a corresponding rule for the ender. | 1079 | ;; Find HEREDOC starters and add a corresponding rule for the ender. |
| 1011 | (sh-font-lock-here-doc | 1080 | (sh-font-lock-here-doc |
| 1012 | (2 (sh-font-lock-open-heredoc | 1081 | (2 (sh-font-lock-open-heredoc |
| @@ -1019,11 +1088,12 @@ Point is at the beginning of the next line." | |||
| 1019 | (")" 0 (sh-font-lock-paren (match-beginning 0))))) | 1088 | (")" 0 (sh-font-lock-paren (match-beginning 0))))) |
| 1020 | 1089 | ||
| 1021 | (defun sh-font-lock-syntactic-face-function (state) | 1090 | (defun sh-font-lock-syntactic-face-function (state) |
| 1022 | (if (nth 3 state) | 1091 | (let ((q (nth 3 state))) |
| 1023 | (if (char-valid-p (nth 3 state)) | 1092 | (if q |
| 1024 | font-lock-string-face | 1093 | (if (char-valid-p q) |
| 1025 | sh-heredoc-face) | 1094 | (if (eq q ?\`) 'sh-quoted-exec font-lock-string-face) |
| 1026 | font-lock-comment-face)) | 1095 | sh-heredoc-face) |
| 1096 | font-lock-comment-face))) | ||
| 1027 | 1097 | ||
| 1028 | (defgroup sh-indentation nil | 1098 | (defgroup sh-indentation nil |
| 1029 | "Variables controlling indentation in shell scripts. | 1099 | "Variables controlling indentation in shell scripts. |
diff --git a/lisp/replace.el b/lisp/replace.el index f1792b499fc..2f8fe86860c 100644 --- a/lisp/replace.el +++ b/lisp/replace.el | |||
| @@ -36,6 +36,11 @@ | |||
| 36 | 36 | ||
| 37 | (defvar query-replace-history nil) | 37 | (defvar query-replace-history nil) |
| 38 | 38 | ||
| 39 | (defvar query-replace-defaults nil | ||
| 40 | "Default values of FROM-STRING and TO-STRING for `query-replace'. | ||
| 41 | This is a cons cell (FROM-STRING . TO-STRING), or nil if there is | ||
| 42 | no default value.") | ||
| 43 | |||
| 39 | (defvar query-replace-interactive nil | 44 | (defvar query-replace-interactive nil |
| 40 | "Non-nil means `query-replace' uses the last search string. | 45 | "Non-nil means `query-replace' uses the last search string. |
| 41 | That becomes the \"string to replace\".") | 46 | That becomes the \"string to replace\".") |
| @@ -94,32 +99,26 @@ The return value can also be a pair (FROM . TO) indicating that the user | |||
| 94 | wants to replace FROM with TO." | 99 | wants to replace FROM with TO." |
| 95 | (if query-replace-interactive | 100 | (if query-replace-interactive |
| 96 | (car (if regexp-flag regexp-search-ring search-ring)) | 101 | (car (if regexp-flag regexp-search-ring search-ring)) |
| 97 | (let* ((lastfrom (car (symbol-value query-replace-from-history-variable))) | 102 | (let* ((history-add-new-input nil) |
| 98 | (lastto (car (symbol-value query-replace-to-history-variable))) | ||
| 99 | (from | 103 | (from |
| 100 | ;; The save-excursion here is in case the user marks and copies | 104 | ;; The save-excursion here is in case the user marks and copies |
| 101 | ;; a region in order to specify the minibuffer input. | 105 | ;; a region in order to specify the minibuffer input. |
| 102 | ;; That should not clobber the region for the query-replace itself. | 106 | ;; That should not clobber the region for the query-replace itself. |
| 103 | (save-excursion | 107 | (save-excursion |
| 104 | (when (equal lastfrom lastto) | ||
| 105 | ;; Typically, this is because the two histlists are shared. | ||
| 106 | (setq lastfrom (cadr (symbol-value | ||
| 107 | query-replace-from-history-variable)))) | ||
| 108 | (read-from-minibuffer | 108 | (read-from-minibuffer |
| 109 | (if (and lastto lastfrom) | 109 | (if query-replace-defaults |
| 110 | (format "%s (default %s -> %s): " prompt | 110 | (format "%s (default %s -> %s): " prompt |
| 111 | (query-replace-descr lastfrom) | 111 | (query-replace-descr (car query-replace-defaults)) |
| 112 | (query-replace-descr lastto)) | 112 | (query-replace-descr (cdr query-replace-defaults))) |
| 113 | (format "%s: " prompt)) | 113 | (format "%s: " prompt)) |
| 114 | nil nil nil | 114 | nil nil nil |
| 115 | query-replace-from-history-variable | 115 | query-replace-from-history-variable |
| 116 | nil t t)))) | 116 | nil t)))) |
| 117 | (if (and (zerop (length from)) lastto lastfrom) | 117 | (if (and (zerop (length from)) query-replace-defaults) |
| 118 | (progn | 118 | (cons (car query-replace-defaults) |
| 119 | (set query-replace-from-history-variable | 119 | (query-replace-compile-replacement |
| 120 | (cdr (symbol-value query-replace-from-history-variable))) | 120 | (cdr query-replace-defaults) regexp-flag)) |
| 121 | (cons lastfrom | 121 | (add-to-history query-replace-from-history-variable from nil t) |
| 122 | (query-replace-compile-replacement lastto regexp-flag))) | ||
| 123 | ;; Warn if user types \n or \t, but don't reject the input. | 122 | ;; Warn if user types \n or \t, but don't reject the input. |
| 124 | (and regexp-flag | 123 | (and regexp-flag |
| 125 | (string-match "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\(\\\\[nt]\\)" from) | 124 | (string-match "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\(\\\\[nt]\\)" from) |
| @@ -177,10 +176,14 @@ the original string if not." | |||
| 177 | "Query and return the `to' argument of a query-replace operation." | 176 | "Query and return the `to' argument of a query-replace operation." |
| 178 | (query-replace-compile-replacement | 177 | (query-replace-compile-replacement |
| 179 | (save-excursion | 178 | (save-excursion |
| 180 | (read-from-minibuffer | 179 | (let* ((history-add-new-input nil) |
| 181 | (format "%s %s with: " prompt (query-replace-descr from)) | 180 | (to (read-from-minibuffer |
| 182 | nil nil nil | 181 | (format "%s %s with: " prompt (query-replace-descr from)) |
| 183 | query-replace-to-history-variable from t t)) | 182 | nil nil nil |
| 183 | query-replace-to-history-variable from t))) | ||
| 184 | (add-to-history query-replace-to-history-variable to nil t) | ||
| 185 | (setq query-replace-defaults (cons from to)) | ||
| 186 | to)) | ||
| 184 | regexp-flag)) | 187 | regexp-flag)) |
| 185 | 188 | ||
| 186 | (defun query-replace-read-args (prompt regexp-flag &optional noerror) | 189 | (defun query-replace-read-args (prompt regexp-flag &optional noerror) |
diff --git a/lisp/server.el b/lisp/server.el index 1f33a552575..c40b36fa752 100644 --- a/lisp/server.el +++ b/lisp/server.el | |||
| @@ -1026,11 +1026,13 @@ which filenames are considered temporary. | |||
| 1026 | If invoked with a prefix argument, or if there is no server process running, | 1026 | If invoked with a prefix argument, or if there is no server process running, |
| 1027 | starts server process and that is all. Invoked by \\[server-edit]." | 1027 | starts server process and that is all. Invoked by \\[server-edit]." |
| 1028 | (interactive "P") | 1028 | (interactive "P") |
| 1029 | (if (or arg | 1029 | (cond |
| 1030 | (not server-process) | 1030 | ((or arg |
| 1031 | (memq (process-status server-process) '(signal exit))) | 1031 | (not server-process) |
| 1032 | (server-mode 1) | 1032 | (memq (process-status server-process) '(signal exit))) |
| 1033 | (apply 'server-switch-buffer (server-done)))) | 1033 | (server-mode 1)) |
| 1034 | (server-clients (apply 'server-switch-buffer (server-done))) | ||
| 1035 | (t (message "No server editing buffers exist")))) | ||
| 1034 | 1036 | ||
| 1035 | (defun server-switch-buffer (&optional next-buffer killed-one) | 1037 | (defun server-switch-buffer (&optional next-buffer killed-one) |
| 1036 | "Switch to another buffer, preferably one that has a client. | 1038 | "Switch to another buffer, preferably one that has a client. |
diff --git a/lisp/ses.el b/lisp/ses.el index debb22d84db..fc594167187 100644 --- a/lisp/ses.el +++ b/lisp/ses.el | |||
| @@ -399,7 +399,7 @@ for safety. This is a macro to prevent propagate-on-load viruses." | |||
| 399 | (defmacro ses-header-row (row) | 399 | (defmacro ses-header-row (row) |
| 400 | "Load the header row from the spreadsheet file and checks it | 400 | "Load the header row from the spreadsheet file and checks it |
| 401 | for safety. This is a macro to prevent propagate-on-load viruses." | 401 | for safety. This is a macro to prevent propagate-on-load viruses." |
| 402 | (or (and (wholenump row) (< row ses--numrows)) | 402 | (or (and (wholenump row) (or (zerop ses--numrows) (< row ses--numrows))) |
| 403 | (error "Bad header-row")) | 403 | (error "Bad header-row")) |
| 404 | (setq ses--header-row row) | 404 | (setq ses--header-row row) |
| 405 | t) | 405 | t) |
| @@ -940,14 +940,18 @@ cell (ROW,COL) has changed." | |||
| 940 | 940 | ||
| 941 | (defun ses-narrowed-p () (/= (- (point-max) (point-min)) (buffer-size))) | 941 | (defun ses-narrowed-p () (/= (- (point-max) (point-min)) (buffer-size))) |
| 942 | 942 | ||
| 943 | (defun ses-widen () | ||
| 944 | "Turn off narrowing, to be reenabled at end of command loop." | ||
| 945 | (if (ses-narrowed-p) | ||
| 946 | (setq ses--deferred-narrow t)) | ||
| 947 | (widen)) | ||
| 948 | |||
| 943 | (defun ses-goto-data (def &optional col) | 949 | (defun ses-goto-data (def &optional col) |
| 944 | "Move point to data area for (DEF,COL). If DEF is a row | 950 | "Move point to data area for (DEF,COL). If DEF is a row |
| 945 | number, COL is the column number for a data cell -- otherwise DEF | 951 | number, COL is the column number for a data cell -- otherwise DEF |
| 946 | is one of the symbols ses--col-widths, ses--col-printers, | 952 | is one of the symbols ses--col-widths, ses--col-printers, |
| 947 | ses--default-printer, ses--numrows, or ses--numcols." | 953 | ses--default-printer, ses--numrows, or ses--numcols." |
| 948 | (if (ses-narrowed-p) | 954 | (ses-widen) |
| 949 | (setq ses--deferred-narrow t)) | ||
| 950 | (widen) | ||
| 951 | (let ((inhibit-point-motion-hooks t)) ;In case intangible attrs are wrong | 955 | (let ((inhibit-point-motion-hooks t)) ;In case intangible attrs are wrong |
| 952 | (goto-char (point-min)) | 956 | (goto-char (point-min)) |
| 953 | (if col | 957 | (if col |
| @@ -966,9 +970,6 @@ If ELEM is specified, it is the array subscript within DEF to be set to VALUE." | |||
| 966 | ;;We call ses-goto-data early, using the old values of numrows and | 970 | ;;We call ses-goto-data early, using the old values of numrows and |
| 967 | ;;numcols in case one of them is being changed. | 971 | ;;numcols in case one of them is being changed. |
| 968 | (ses-goto-data def) | 972 | (ses-goto-data def) |
| 969 | (if elem | ||
| 970 | (ses-aset-with-undo (symbol-value def) elem value) | ||
| 971 | (ses-set-with-undo def value)) | ||
| 972 | (let ((inhibit-read-only t) | 973 | (let ((inhibit-read-only t) |
| 973 | (fmt (plist-get '(ses--col-widths "(ses-column-widths %S)" | 974 | (fmt (plist-get '(ses--col-widths "(ses-column-widths %S)" |
| 974 | ses--col-printers "(ses-column-printers %S)" | 975 | ses--col-printers "(ses-column-printers %S)" |
| @@ -977,9 +978,20 @@ If ELEM is specified, it is the array subscript within DEF to be set to VALUE." | |||
| 977 | ses--file-format " %S ;SES file-format" | 978 | ses--file-format " %S ;SES file-format" |
| 978 | ses--numrows " %S ;numrows" | 979 | ses--numrows " %S ;numrows" |
| 979 | ses--numcols " %S ;numcols") | 980 | ses--numcols " %S ;numcols") |
| 980 | def))) | 981 | def)) |
| 981 | (delete-region (point) (line-end-position)) | 982 | oldval) |
| 982 | (insert (format fmt (symbol-value def)))))) | 983 | (if elem |
| 984 | (progn | ||
| 985 | (setq oldval (aref (symbol-value def) elem)) | ||
| 986 | (aset (symbol-value def) elem value)) | ||
| 987 | (setq oldval (symbol-value def)) | ||
| 988 | (set def value)) | ||
| 989 | ;;Special undo since it's outside the narrowed buffer | ||
| 990 | (let (buffer-undo-list) | ||
| 991 | (delete-region (point) (line-end-position)) | ||
| 992 | (insert (format fmt (symbol-value def)))) | ||
| 993 | (push `(apply ses-set-parameter ,def ,oldval ,elem) buffer-undo-list)))) | ||
| 994 | |||
| 983 | 995 | ||
| 984 | (defun ses-write-cells () | 996 | (defun ses-write-cells () |
| 985 | "Write cells in `ses--deferred-write' from local variables to data area. | 997 | "Write cells in `ses--deferred-write' from local variables to data area. |
| @@ -1278,23 +1290,6 @@ to each symbol." | |||
| 1278 | ;; Undo control | 1290 | ;; Undo control |
| 1279 | ;;---------------------------------------------------------------------------- | 1291 | ;;---------------------------------------------------------------------------- |
| 1280 | 1292 | ||
| 1281 | ;; This should be unnecessary, because the feature is now built in. | ||
| 1282 | |||
| 1283 | (defadvice undo-more (around ses-undo-more activate preactivate) | ||
| 1284 | "For SES mode, allow undo outside of narrowed buffer range." | ||
| 1285 | (if (not (eq major-mode 'ses-mode)) | ||
| 1286 | ad-do-it | ||
| 1287 | ;;Here is some extra code for SES mode. | ||
| 1288 | (setq ses--deferred-narrow | ||
| 1289 | (or ses--deferred-narrow (ses-narrowed-p))) | ||
| 1290 | (widen) | ||
| 1291 | (condition-case x | ||
| 1292 | ad-do-it | ||
| 1293 | (error | ||
| 1294 | ;;Restore narrow if appropriate | ||
| 1295 | (ses-command-hook) | ||
| 1296 | (signal (car x) (cdr x)))))) | ||
| 1297 | |||
| 1298 | (defun ses-begin-change () | 1293 | (defun ses-begin-change () |
| 1299 | "For undo, remember point before we start changing hidden stuff." | 1294 | "For undo, remember point before we start changing hidden stuff." |
| 1300 | (let ((inhibit-read-only t)) | 1295 | (let ((inhibit-read-only t)) |
| @@ -1303,7 +1298,7 @@ to each symbol." | |||
| 1303 | 1298 | ||
| 1304 | (defun ses-set-with-undo (sym newval) | 1299 | (defun ses-set-with-undo (sym newval) |
| 1305 | "Like set, but undoable. Result is t if value has changed." | 1300 | "Like set, but undoable. Result is t if value has changed." |
| 1306 | ;;We avoid adding redundant entries to the undo list, but this is | 1301 | ;;We try to avoid adding redundant entries to the undo list, but this is |
| 1307 | ;;unavoidable for strings because equal ignores text properties and there's | 1302 | ;;unavoidable for strings because equal ignores text properties and there's |
| 1308 | ;;no easy way to get the whole property list to see if it's different! | 1303 | ;;no easy way to get the whole property list to see if it's different! |
| 1309 | (unless (and (boundp sym) | 1304 | (unless (and (boundp sym) |
| @@ -1346,7 +1341,7 @@ execute cell formulas or print functions." | |||
| 1346 | (or (and (= (safe-length params) 3) | 1341 | (or (and (= (safe-length params) 3) |
| 1347 | (numberp (car params)) | 1342 | (numberp (car params)) |
| 1348 | (numberp (cadr params)) | 1343 | (numberp (cadr params)) |
| 1349 | (> (cadr params) 0) | 1344 | (>= (cadr params) 0) |
| 1350 | (numberp (nth 2 params)) | 1345 | (numberp (nth 2 params)) |
| 1351 | (> (nth 2 params) 0)) | 1346 | (> (nth 2 params) 0)) |
| 1352 | (error "Invalid SES file")) | 1347 | (error "Invalid SES file")) |
| @@ -1568,11 +1563,12 @@ narrows the buffer now." | |||
| 1568 | (let ((old ses--deferred-recalc)) | 1563 | (let ((old ses--deferred-recalc)) |
| 1569 | (setq ses--deferred-recalc nil) | 1564 | (setq ses--deferred-recalc nil) |
| 1570 | (ses-update-cells old))) | 1565 | (ses-update-cells old))) |
| 1571 | (if ses--deferred-write | 1566 | (when ses--deferred-write |
| 1572 | ;;We don't reset the deferred list before starting -- the most | 1567 | ;;We don't reset the deferred list before starting -- the most |
| 1573 | ;;likely error is keyboard-quit, and we do want to keep trying | 1568 | ;;likely error is keyboard-quit, and we do want to keep trying |
| 1574 | ;;these writes after a quit. | 1569 | ;;these writes after a quit. |
| 1575 | (ses-write-cells)) | 1570 | (ses-write-cells) |
| 1571 | (push '(apply ses-widen) buffer-undo-list)) | ||
| 1576 | (when ses--deferred-narrow | 1572 | (when ses--deferred-narrow |
| 1577 | ;;We're not allowed to narrow the buffer until after-find-file has | 1573 | ;;We're not allowed to narrow the buffer until after-find-file has |
| 1578 | ;;read the local variables at the end of the file. Now it's safe to | 1574 | ;;read the local variables at the end of the file. Now it's safe to |
| @@ -1794,9 +1790,7 @@ cells." | |||
| 1794 | (cons (ses-cell-symbol row col) | 1790 | (cons (ses-cell-symbol row col) |
| 1795 | (ses-cell-references yrow ycol))))))) | 1791 | (ses-cell-references yrow ycol))))))) |
| 1796 | ;;Delete everything and reconstruct basic data area | 1792 | ;;Delete everything and reconstruct basic data area |
| 1797 | (if (ses-narrowed-p) | 1793 | (ses-widen) |
| 1798 | (setq ses--deferred-narrow t)) | ||
| 1799 | (widen) | ||
| 1800 | (let ((inhibit-read-only t)) | 1794 | (let ((inhibit-read-only t)) |
| 1801 | (goto-char (point-max)) | 1795 | (goto-char (point-max)) |
| 1802 | (if (search-backward ";; Local Variables:\n" nil t) | 1796 | (if (search-backward ";; Local Variables:\n" nil t) |
| @@ -1877,7 +1871,9 @@ cell formula was unsafe and user declined confirmation." | |||
| 1877 | ses-mode-edit-map | 1871 | ses-mode-edit-map |
| 1878 | t ;Convert to Lisp object | 1872 | t ;Convert to Lisp object |
| 1879 | 'ses-read-cell-history | 1873 | 'ses-read-cell-history |
| 1880 | (prin1-to-string curval))))) | 1874 | (prin1-to-string (if (eq (car-safe curval) 'ses-safe-formula) |
| 1875 | (cadr curval) | ||
| 1876 | curval)))))) | ||
| 1881 | (when (ses-edit-cell row col newval) | 1877 | (when (ses-edit-cell row col newval) |
| 1882 | (ses-command-hook) ;Update cell widths before movement | 1878 | (ses-command-hook) ;Update cell widths before movement |
| 1883 | (dolist (x ses-after-entry-functions) | 1879 | (dolist (x ses-after-entry-functions) |
| @@ -2073,6 +2069,8 @@ before current one." | |||
| 2073 | (ses-reset-header-string))) | 2069 | (ses-reset-header-string))) |
| 2074 | ;;Reconstruct text attributes | 2070 | ;;Reconstruct text attributes |
| 2075 | (ses-setup) | 2071 | (ses-setup) |
| 2072 | ;;Prepare for undo | ||
| 2073 | (push '(apply ses-widen) buffer-undo-list) | ||
| 2076 | ;;Return to current cell | 2074 | ;;Return to current cell |
| 2077 | (if ses--curcell | 2075 | (if ses--curcell |
| 2078 | (ses-jump-safe ses--curcell) | 2076 | (ses-jump-safe ses--curcell) |
| @@ -2109,6 +2107,8 @@ current one." | |||
| 2109 | (ses-reset-header-string))) | 2107 | (ses-reset-header-string))) |
| 2110 | ;;Reconstruct attributes | 2108 | ;;Reconstruct attributes |
| 2111 | (ses-setup) | 2109 | (ses-setup) |
| 2110 | ;;Prepare for undo | ||
| 2111 | (push '(apply ses-widen) buffer-undo-list) | ||
| 2112 | (ses-jump-safe ses--curcell)) | 2112 | (ses-jump-safe ses--curcell)) |
| 2113 | 2113 | ||
| 2114 | (defun ses-insert-column (count &optional col width printer) | 2114 | (defun ses-insert-column (count &optional col width printer) |
| @@ -2643,7 +2643,10 @@ The top row is row 1. Selecting row 0 displays the default header row." | |||
| 2643 | (if (or (< row 0) (> row ses--numrows)) | 2643 | (if (or (< row 0) (> row ses--numrows)) |
| 2644 | (error "Invalid header-row")) | 2644 | (error "Invalid header-row")) |
| 2645 | (ses-begin-change) | 2645 | (ses-begin-change) |
| 2646 | (ses-set-parameter 'ses--header-row row) | 2646 | (let ((oldval ses--header-row)) |
| 2647 | (let (buffer-undo-list) | ||
| 2648 | (ses-set-parameter 'ses--header-row row)) | ||
| 2649 | (push `(apply ses-set-header-row ,oldval) buffer-undo-list)) | ||
| 2647 | (ses-reset-header-string)) | 2650 | (ses-reset-header-string)) |
| 2648 | 2651 | ||
| 2649 | (defun ses-mark-row () | 2652 | (defun ses-mark-row () |
diff --git a/lisp/shell.el b/lisp/shell.el index bfa9565e8d4..6b22ac79238 100644 --- a/lisp/shell.el +++ b/lisp/shell.el | |||
| @@ -367,7 +367,7 @@ Thus, this does not include the shell's current directory.") | |||
| 367 | (put 'shell-mode 'mode-class 'special) | 367 | (put 'shell-mode 'mode-class 'special) |
| 368 | 368 | ||
| 369 | (define-derived-mode shell-mode comint-mode "Shell" | 369 | (define-derived-mode shell-mode comint-mode "Shell" |
| 370 | "Major mode for interacting with an inferior shell. | 370 | "Major mode for interacting with an inferior shell.\\<shell-mode-map> |
| 371 | \\[comint-send-input] after the end of the process' output sends the text from | 371 | \\[comint-send-input] after the end of the process' output sends the text from |
| 372 | the end of process to the end of the current line. | 372 | the end of process to the end of the current line. |
| 373 | \\[comint-send-input] before end of process output copies the current line minus the prompt to | 373 | \\[comint-send-input] before end of process output copies the current line minus the prompt to |
| @@ -433,11 +433,11 @@ buffer." | |||
| 433 | (setq shell-dirstack nil) | 433 | (setq shell-dirstack nil) |
| 434 | (make-local-variable 'shell-last-dir) | 434 | (make-local-variable 'shell-last-dir) |
| 435 | (setq shell-last-dir nil) | 435 | (setq shell-last-dir nil) |
| 436 | (shell-dirtrack-mode 1) | ||
| 437 | (setq comint-input-autoexpand shell-input-autoexpand) | 436 | (setq comint-input-autoexpand shell-input-autoexpand) |
| 438 | ;; This is not really correct, since the shell buffer does not really | 437 | ;; This is not really correct, since the shell buffer does not really |
| 439 | ;; edit this directory. But it is useful in the buffer list and menus. | 438 | ;; edit this directory. But it is useful in the buffer list and menus. |
| 440 | (make-local-variable 'list-buffers-directory) | 439 | (make-local-variable 'list-buffers-directory) |
| 440 | (shell-dirtrack-mode 1) | ||
| 441 | (setq list-buffers-directory (expand-file-name default-directory)) | 441 | (setq list-buffers-directory (expand-file-name default-directory)) |
| 442 | ;; shell-dependent assignments. | 442 | ;; shell-dependent assignments. |
| 443 | (when (ring-empty-p comint-input-ring) | 443 | (when (ring-empty-p comint-input-ring) |
diff --git a/lisp/simple.el b/lisp/simple.el index a2f21465fad..a91f2a5f0fb 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -4239,7 +4239,7 @@ The variable `selective-display' has a separate value for each buffer." | |||
| 4239 | (defvaralias 'indicate-unused-lines 'indicate-empty-lines) | 4239 | (defvaralias 'indicate-unused-lines 'indicate-empty-lines) |
| 4240 | (defvaralias 'default-indicate-unused-lines 'default-indicate-empty-lines) | 4240 | (defvaralias 'default-indicate-unused-lines 'default-indicate-empty-lines) |
| 4241 | 4241 | ||
| 4242 | (defun toggle-truncate-lines (arg) | 4242 | (defun toggle-truncate-lines (&optional arg) |
| 4243 | "Toggle whether to fold or truncate long lines on the screen. | 4243 | "Toggle whether to fold or truncate long lines on the screen. |
| 4244 | With arg, truncate long lines iff arg is positive. | 4244 | With arg, truncate long lines iff arg is positive. |
| 4245 | Note that in side-by-side windows, truncation is always enabled." | 4245 | Note that in side-by-side windows, truncation is always enabled." |
diff --git a/lisp/speedbar.el b/lisp/speedbar.el index b3913f6f6c6..e5ab181e8c6 100644 --- a/lisp/speedbar.el +++ b/lisp/speedbar.el | |||
| @@ -921,8 +921,6 @@ This basically creates a sparse keymap, and makes it's parent be | |||
| 921 | (if (and (featurep 'custom) (fboundp 'custom-declare-variable)) | 921 | (if (and (featurep 'custom) (fboundp 'custom-declare-variable)) |
| 922 | (list ["Customize..." speedbar-customize t])) | 922 | (list ["Customize..." speedbar-customize t])) |
| 923 | (list | 923 | (list |
| 924 | ["Detach" speedbar-detach (and speedbar-frame | ||
| 925 | (eq (selected-frame) speedbar-frame)) ] | ||
| 926 | ["Close" dframe-close-frame t] | 924 | ["Close" dframe-close-frame t] |
| 927 | ["Quit" delete-frame t] )) | 925 | ["Quit" delete-frame t] )) |
| 928 | "Menu items appearing at the end of the speedbar menu.") | 926 | "Menu items appearing at the end of the speedbar menu.") |
| @@ -1047,21 +1045,6 @@ supported at a time. | |||
| 1047 | (dframe-attached-frame speedbar-frame) | 1045 | (dframe-attached-frame speedbar-frame) |
| 1048 | speedbar-default-position)))) | 1046 | speedbar-default-position)))) |
| 1049 | 1047 | ||
| 1050 | (defun speedbar-detach () | ||
| 1051 | "Detach the current Speedbar from auto-updating. | ||
| 1052 | Doing this allows the creation of a second speedbar." | ||
| 1053 | (interactive) | ||
| 1054 | (let ((buffer speedbar-buffer)) | ||
| 1055 | (dframe-detach 'speedbar-frame 'speedbar-cached-frame 'speedbar-buffer) | ||
| 1056 | (save-excursion | ||
| 1057 | (set-buffer buffer) | ||
| 1058 | ;; Permanently disable auto-updating in this speedbar buffer. | ||
| 1059 | (set (make-local-variable 'speedbar-update-flag) nil) | ||
| 1060 | (set (make-local-variable 'speedbar-update-flag-disable) t) | ||
| 1061 | ;; Make local copies of all the different variables to prevent | ||
| 1062 | ;; funny stuff later... | ||
| 1063 | ))) | ||
| 1064 | |||
| 1065 | (defsubst speedbar-current-frame () | 1048 | (defsubst speedbar-current-frame () |
| 1066 | "Return the frame to use for speedbar based on current context." | 1049 | "Return the frame to use for speedbar based on current context." |
| 1067 | (dframe-current-frame 'speedbar-frame 'speedbar-mode)) | 1050 | (dframe-current-frame 'speedbar-frame 'speedbar-mode)) |
| @@ -1224,11 +1207,8 @@ and the existence of packages." | |||
| 1224 | (speedbar-initial-menu) | 1207 | (speedbar-initial-menu) |
| 1225 | (save-excursion | 1208 | (save-excursion |
| 1226 | (dframe-select-attached-frame speedbar-frame) | 1209 | (dframe-select-attached-frame speedbar-frame) |
| 1227 | (if (local-variable-p | 1210 | (eval (nth 1 (assoc speedbar-initial-expansion-list-name |
| 1228 | 'speedbar-easymenu-definition-special | 1211 | speedbar-initial-expansion-mode-alist))))) |
| 1229 | (current-buffer)) | ||
| 1230 | ;; If bound locally, we can use it | ||
| 1231 | speedbar-easymenu-definition-special))) | ||
| 1232 | ;; Dynamic menu stuff | 1212 | ;; Dynamic menu stuff |
| 1233 | '("-") | 1213 | '("-") |
| 1234 | (list (cons "Displays" | 1214 | (list (cons "Displays" |
diff --git a/lisp/startup.el b/lisp/startup.el index 12a53113f0a..0ec53f98ae7 100644 --- a/lisp/startup.el +++ b/lisp/startup.el | |||
| @@ -650,18 +650,17 @@ opening the first frame (e.g. open a connection to an X server).") | |||
| 650 | 650 | ||
| 651 | ;; Convert preloaded file names to absolute. | 651 | ;; Convert preloaded file names to absolute. |
| 652 | (let ((lisp-dir | 652 | (let ((lisp-dir |
| 653 | (file-name-directory | 653 | (file-truename |
| 654 | (locate-file "simple" load-path | 654 | (file-name-directory |
| 655 | (get-load-suffixes))))) | 655 | (locate-file "simple" load-path |
| 656 | (get-load-suffixes)))))) | ||
| 656 | 657 | ||
| 657 | (setq load-history | 658 | (setq load-history |
| 658 | (mapcar (lambda (elt) | 659 | (mapcar (lambda (elt) |
| 659 | (if (and (stringp (car elt)) | 660 | (if (and (stringp (car elt)) |
| 660 | (not (file-name-absolute-p (car elt)))) | 661 | (not (file-name-absolute-p (car elt)))) |
| 661 | (cons (concat lisp-dir | 662 | (cons (concat lisp-dir |
| 662 | (car elt) | 663 | (car elt)) |
| 663 | (if (string-match "[.]el$" (car elt)) | ||
| 664 | "" ".elc")) | ||
| 665 | (cdr elt)) | 664 | (cdr elt)) |
| 666 | elt)) | 665 | elt)) |
| 667 | load-history))) | 666 | load-history))) |
diff --git a/lisp/subr.el b/lisp/subr.el index 2e18efd029d..313ae8dcee4 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -1393,32 +1393,94 @@ That function's doc string says which file created it." | |||
| 1393 | t)) | 1393 | t)) |
| 1394 | nil)) | 1394 | nil)) |
| 1395 | 1395 | ||
| 1396 | (defun load-history-regexp (file) | ||
| 1397 | "Form a regexp to find FILE in `load-history'. | ||
| 1398 | FILE, a string, is described in the function `eval-after-load'." | ||
| 1399 | (if (file-name-absolute-p file) | ||
| 1400 | (setq file (file-truename file))) | ||
| 1401 | (concat (if (file-name-absolute-p file) "\\`" "\\(\\`\\|/\\)") | ||
| 1402 | (regexp-quote file) | ||
| 1403 | (if (file-name-extension file) | ||
| 1404 | "" | ||
| 1405 | ;; Note: regexp-opt can't be used here, since we need to call | ||
| 1406 | ;; this before Emacs has been fully started. 2006-05-21 | ||
| 1407 | (concat "\\(" (mapconcat 'regexp-quote load-suffixes "\\|") "\\)?")) | ||
| 1408 | "\\(" (mapconcat 'regexp-quote jka-compr-load-suffixes "\\|") | ||
| 1409 | "\\)?\\'")) | ||
| 1410 | |||
| 1411 | (defun load-history-filename-element (file-regexp) | ||
| 1412 | "Get the first elt of `load-history' whose car matches FILE-REGEXP. | ||
| 1413 | Return nil if there isn't one." | ||
| 1414 | (let* ((loads load-history) | ||
| 1415 | (load-elt (and loads (car loads)))) | ||
| 1416 | (save-match-data | ||
| 1417 | (while (and loads | ||
| 1418 | (or (null (car load-elt)) | ||
| 1419 | (not (string-match file-regexp (car load-elt))))) | ||
| 1420 | (setq loads (cdr loads) | ||
| 1421 | load-elt (and loads (car loads))))) | ||
| 1422 | load-elt)) | ||
| 1423 | |||
| 1396 | (defun eval-after-load (file form) | 1424 | (defun eval-after-load (file form) |
| 1397 | "Arrange that, if FILE is ever loaded, FORM will be run at that time. | 1425 | "Arrange that, if FILE is ever loaded, FORM will be run at that time. |
| 1398 | This makes or adds to an entry on `after-load-alist'. | ||
| 1399 | If FILE is already loaded, evaluate FORM right now. | 1426 | If FILE is already loaded, evaluate FORM right now. |
| 1400 | It does nothing if FORM is already on the list for FILE. | 1427 | |
| 1401 | FILE must match exactly. Normally FILE is the name of a library, | 1428 | If a matching file is loaded again, FORM will be evaluated again. |
| 1402 | with no directory or extension specified, since that is how `load' | 1429 | |
| 1403 | is normally called. | 1430 | If FILE is a string, it may be either an absolute or a relative file |
| 1404 | FILE can also be a feature (i.e. a symbol), in which case FORM is | 1431 | name, and may have an extension \(e.g. \".el\") or may lack one, and |
| 1405 | evaluated whenever that feature is `provide'd." | 1432 | additionally may or may not have an extension denoting a compressed |
| 1406 | (let ((elt (assoc file after-load-alist))) | 1433 | format \(e.g. \".gz\"). |
| 1407 | ;; Make sure there is an element for FILE. | 1434 | |
| 1408 | (unless elt (setq elt (list file)) (push elt after-load-alist)) | 1435 | When FILE is absolute, this first converts it to a true name by chasing |
| 1409 | ;; Add FORM to the element if it isn't there. | 1436 | symbolic links. Only a file of this name \(see next paragraph regarding |
| 1437 | extensions) will trigger the evaluation of FORM. When FILE is relative, | ||
| 1438 | a file whose absolute true name ends in FILE will trigger evaluation. | ||
| 1439 | |||
| 1440 | When FILE lacks an extension, a file name with any extension will trigger | ||
| 1441 | evaluation. Otherwise, its extension must match FILE's. A further | ||
| 1442 | extension for a compressed format \(e.g. \".gz\") on FILE will not affect | ||
| 1443 | this name matching. | ||
| 1444 | |||
| 1445 | Alternatively, FILE can be a feature (i.e. a symbol), in which case FORM | ||
| 1446 | is evaluated whenever that feature is `provide'd. | ||
| 1447 | |||
| 1448 | Usually FILE is just a library name like \"font-lock\" or a feature name | ||
| 1449 | like 'font-lock. | ||
| 1450 | |||
| 1451 | This function makes or adds to an entry on `after-load-alist'." | ||
| 1452 | ;; Add this FORM into after-load-alist (regardless of whether we'll be | ||
| 1453 | ;; evaluating it now). | ||
| 1454 | (let* ((regexp-or-feature | ||
| 1455 | (if (stringp file) (load-history-regexp file) file)) | ||
| 1456 | (elt (assoc regexp-or-feature after-load-alist))) | ||
| 1457 | (unless elt | ||
| 1458 | (setq elt (list regexp-or-feature)) | ||
| 1459 | (push elt after-load-alist)) | ||
| 1460 | ;; Add FORM to the element unless it's already there. | ||
| 1410 | (unless (member form (cdr elt)) | 1461 | (unless (member form (cdr elt)) |
| 1411 | (nconc elt (list form)) | 1462 | (nconc elt (list form))) |
| 1412 | ;; If the file has been loaded already, run FORM right away. | 1463 | |
| 1413 | (if (if (symbolp file) | 1464 | ;; Is there an already loaded file whose name (or `provide' name) |
| 1414 | (featurep file) | 1465 | ;; matches FILE? |
| 1415 | ;; Make sure `load-history' contains the files dumped with | 1466 | (if (if (stringp file) |
| 1416 | ;; Emacs for the case that FILE is one of them. | 1467 | (load-history-filename-element regexp-or-feature) |
| 1417 | ;; (load-symbol-file-load-history) | 1468 | (featurep file)) |
| 1418 | (when (locate-library file) | 1469 | (eval form)))) |
| 1419 | (assoc (locate-library file) load-history))) | 1470 | |
| 1420 | (eval form)))) | 1471 | (defun do-after-load-evaluation (abs-file) |
| 1421 | form) | 1472 | "Evaluate all `eval-after-load' forms, if any, for ABS-FILE. |
| 1473 | ABS-FILE, a string, should be the absolute true name of a file just loaded." | ||
| 1474 | (let ((after-load-elts after-load-alist) | ||
| 1475 | a-l-element file-elements file-element form) | ||
| 1476 | (while after-load-elts | ||
| 1477 | (setq a-l-element (car after-load-elts) | ||
| 1478 | after-load-elts (cdr after-load-elts)) | ||
| 1479 | (when (and (stringp (car a-l-element)) | ||
| 1480 | (string-match (car a-l-element) abs-file)) | ||
| 1481 | (while (setq a-l-element (cdr a-l-element)) ; discard the file name | ||
| 1482 | (setq form (car a-l-element)) | ||
| 1483 | (eval form)))))) | ||
| 1422 | 1484 | ||
| 1423 | (defun eval-next-after-load (file) | 1485 | (defun eval-next-after-load (file) |
| 1424 | "Read the following input sexp, and run it whenever FILE is loaded. | 1486 | "Read the following input sexp, and run it whenever FILE is loaded. |
| @@ -1555,7 +1617,7 @@ Optional DEFAULT is a default password to use instead of empty input. | |||
| 1555 | This function echoes `.' for each character that the user types. | 1617 | This function echoes `.' for each character that the user types. |
| 1556 | The user ends with RET, LFD, or ESC. DEL or C-h rubs out. C-u kills line. | 1618 | The user ends with RET, LFD, or ESC. DEL or C-h rubs out. C-u kills line. |
| 1557 | C-g quits; if `inhibit-quit' was non-nil around this function, | 1619 | C-g quits; if `inhibit-quit' was non-nil around this function, |
| 1558 | then it returns nil if the user types C-g. | 1620 | then it returns nil if the user types C-g, but quit-flag remains set. |
| 1559 | 1621 | ||
| 1560 | Once the caller uses the password, it can erase the password | 1622 | Once the caller uses the password, it can erase the password |
| 1561 | by doing (clear-string STRING)." | 1623 | by doing (clear-string STRING)." |
| @@ -1575,6 +1637,9 @@ by doing (clear-string STRING)." | |||
| 1575 | (sit-for 1)))) | 1637 | (sit-for 1)))) |
| 1576 | success) | 1638 | success) |
| 1577 | (let ((pass nil) | 1639 | (let ((pass nil) |
| 1640 | ;; Copy it so that add-text-properties won't modify | ||
| 1641 | ;; the object that was passed in by the caller. | ||
| 1642 | (prompt (copy-sequence prompt)) | ||
| 1578 | (c 0) | 1643 | (c 0) |
| 1579 | (echo-keystrokes 0) | 1644 | (echo-keystrokes 0) |
| 1580 | (cursor-in-echo-area t) | 1645 | (cursor-in-echo-area t) |
| @@ -2137,7 +2202,8 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again." | |||
| 2137 | ;;;; Lisp macros to do various things temporarily. | 2202 | ;;;; Lisp macros to do various things temporarily. |
| 2138 | 2203 | ||
| 2139 | (defmacro with-current-buffer (buffer &rest body) | 2204 | (defmacro with-current-buffer (buffer &rest body) |
| 2140 | "Execute the forms in BODY with BUFFER as the current buffer. | 2205 | "Execute the forms in BODY with BUFFER temporarily current. |
| 2206 | BUFFER can be a buffer or a buffer name. | ||
| 2141 | The value returned is the value of the last form in BODY. | 2207 | The value returned is the value of the last form in BODY. |
| 2142 | See also `with-temp-buffer'." | 2208 | See also `with-temp-buffer'." |
| 2143 | (declare (indent 1) (debug t)) | 2209 | (declare (indent 1) (debug t)) |
| @@ -2267,13 +2333,19 @@ See also `with-temp-file' and `with-output-to-string'." | |||
| 2267 | (defmacro with-local-quit (&rest body) | 2333 | (defmacro with-local-quit (&rest body) |
| 2268 | "Execute BODY, allowing quits to terminate BODY but not escape further. | 2334 | "Execute BODY, allowing quits to terminate BODY but not escape further. |
| 2269 | When a quit terminates BODY, `with-local-quit' returns nil but | 2335 | When a quit terminates BODY, `with-local-quit' returns nil but |
| 2270 | requests another quit. That quit will be processed, the next time quitting | 2336 | requests another quit. That quit will be processed as soon as quitting |
| 2271 | is allowed once again." | 2337 | is allowed once again. (Immediately, if `inhibit-quit' is nil.)" |
| 2272 | (declare (debug t) (indent 0)) | 2338 | (declare (debug t) (indent 0)) |
| 2273 | `(condition-case nil | 2339 | `(condition-case nil |
| 2274 | (let ((inhibit-quit nil)) | 2340 | (let ((inhibit-quit nil)) |
| 2275 | ,@body) | 2341 | ,@body) |
| 2276 | (quit (setq quit-flag t) nil))) | 2342 | (quit (setq quit-flag t) |
| 2343 | ;; This call is to give a chance to handle quit-flag | ||
| 2344 | ;; in case inhibit-quit is nil. | ||
| 2345 | ;; Without this, it will not be handled until the next function | ||
| 2346 | ;; call, and that might allow it to exit thru a condition-case | ||
| 2347 | ;; that intends to handle the quit signal next time. | ||
| 2348 | (eval '(ignore nil))))) | ||
| 2277 | 2349 | ||
| 2278 | (defmacro while-no-input (&rest body) | 2350 | (defmacro while-no-input (&rest body) |
| 2279 | "Execute BODY only as long as there's no pending input. | 2351 | "Execute BODY only as long as there's no pending input. |
diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el index f24a91d4145..a02fd1b2ba9 100644 --- a/lisp/tar-mode.el +++ b/lisp/tar-mode.el | |||
| @@ -736,7 +736,8 @@ appear on disk when you save the tar-file's buffer." | |||
| 736 | (funcall set-auto-coding-function | 736 | (funcall set-auto-coding-function |
| 737 | name (- (point-max) (point))))) | 737 | name (- (point-max) (point))))) |
| 738 | (car (find-operation-coding-system | 738 | (car (find-operation-coding-system |
| 739 | 'insert-file-contents name t)))) | 739 | 'insert-file-contents |
| 740 | (cons name (current-buffer)) t)))) | ||
| 740 | (multibyte enable-multibyte-characters) | 741 | (multibyte enable-multibyte-characters) |
| 741 | (detected (detect-coding-region | 742 | (detected (detect-coding-region |
| 742 | (point-min) | 743 | (point-min) |
diff --git a/lisp/term.el b/lisp/term.el index a03970a368b..8e2e0773121 100644 --- a/lisp/term.el +++ b/lisp/term.el | |||
| @@ -660,13 +660,6 @@ Buffer local variable.") | |||
| 660 | (put 'term-scroll-show-maximum-output 'permanent-local t) | 660 | (put 'term-scroll-show-maximum-output 'permanent-local t) |
| 661 | (put 'term-ptyp 'permanent-local t) | 661 | (put 'term-ptyp 'permanent-local t) |
| 662 | 662 | ||
| 663 | ;; Do FORM if running under XEmacs (previously Lucid Emacs). | ||
| 664 | (defmacro term-if-xemacs (&rest forms) | ||
| 665 | (if (featurep 'xemacs) (cons 'progn forms))) | ||
| 666 | ;; Do FORM if NOT running under XEmacs (previously Lucid Emacs). | ||
| 667 | (defmacro term-ifnot-xemacs (&rest forms) | ||
| 668 | (if (not (featurep 'xemacs)) (cons 'progn forms))) | ||
| 669 | |||
| 670 | (defmacro term-in-char-mode () '(eq (current-local-map) term-raw-map)) | 663 | (defmacro term-in-char-mode () '(eq (current-local-map) term-raw-map)) |
| 671 | (defmacro term-in-line-mode () '(not (term-in-char-mode))) | 664 | (defmacro term-in-line-mode () '(not (term-in-char-mode))) |
| 672 | ;; True if currently doing PAGER handling. | 665 | ;; True if currently doing PAGER handling. |
| @@ -725,13 +718,13 @@ Notice that a setting of 0 means 'don't truncate anything'. This variable | |||
| 725 | is buffer-local.") | 718 | is buffer-local.") |
| 726 | ;;; | 719 | ;;; |
| 727 | 720 | ||
| 728 | (term-if-xemacs | 721 | (when (featurep 'xemacs) |
| 729 | (defvar term-terminal-menu | 722 | (defvar term-terminal-menu |
| 730 | '("Terminal" | 723 | '("Terminal" |
| 731 | [ "Character mode" term-char-mode (term-in-line-mode)] | 724 | [ "Character mode" term-char-mode (term-in-line-mode)] |
| 732 | [ "Line mode" term-line-mode (term-in-char-mode)] | 725 | [ "Line mode" term-line-mode (term-in-char-mode)] |
| 733 | [ "Enable paging" term-pager-toggle (not term-pager-count)] | 726 | [ "Enable paging" term-pager-toggle (not term-pager-count)] |
| 734 | [ "Disable paging" term-pager-toggle term-pager-count]))) | 727 | [ "Disable paging" term-pager-toggle term-pager-count]))) |
| 735 | 728 | ||
| 736 | (unless term-mode-map | 729 | (unless term-mode-map |
| 737 | (setq term-mode-map (make-sparse-keymap)) | 730 | (setq term-mode-map (make-sparse-keymap)) |
| @@ -739,10 +732,10 @@ is buffer-local.") | |||
| 739 | (define-key term-mode-map "\en" 'term-next-input) | 732 | (define-key term-mode-map "\en" 'term-next-input) |
| 740 | (define-key term-mode-map "\er" 'term-previous-matching-input) | 733 | (define-key term-mode-map "\er" 'term-previous-matching-input) |
| 741 | (define-key term-mode-map "\es" 'term-next-matching-input) | 734 | (define-key term-mode-map "\es" 'term-next-matching-input) |
| 742 | (term-ifnot-xemacs | 735 | (unless (featurep 'xemacs) |
| 743 | (define-key term-mode-map [?\A-\M-r] | 736 | (define-key term-mode-map [?\A-\M-r] |
| 744 | 'term-previous-matching-input-from-input) | 737 | 'term-previous-matching-input-from-input) |
| 745 | (define-key term-mode-map [?\A-\M-s] 'term-next-matching-input-from-input)) | 738 | (define-key term-mode-map [?\A-\M-s] 'term-next-matching-input-from-input)) |
| 746 | (define-key term-mode-map "\e\C-l" 'term-show-output) | 739 | (define-key term-mode-map "\e\C-l" 'term-show-output) |
| 747 | (define-key term-mode-map "\C-m" 'term-send-input) | 740 | (define-key term-mode-map "\C-m" 'term-send-input) |
| 748 | (define-key term-mode-map "\C-d" 'term-delchar-or-maybe-eof) | 741 | (define-key term-mode-map "\C-d" 'term-delchar-or-maybe-eof) |
| @@ -781,9 +774,7 @@ is buffer-local.") | |||
| 781 | ) | 774 | ) |
| 782 | 775 | ||
| 783 | ;; Menu bars: | 776 | ;; Menu bars: |
| 784 | (term-ifnot-xemacs | 777 | (unless (featurep 'xemacs) |
| 785 | (progn | ||
| 786 | |||
| 787 | ;; terminal: | 778 | ;; terminal: |
| 788 | (let (newmap) | 779 | (let (newmap) |
| 789 | (setq newmap (make-sparse-keymap "Terminal")) | 780 | (setq newmap (make-sparse-keymap "Terminal")) |
| @@ -860,14 +851,14 @@ is buffer-local.") | |||
| 860 | (define-key newmap [] '("BREAK" . term-interrupt-subjob)) | 851 | (define-key newmap [] '("BREAK" . term-interrupt-subjob)) |
| 861 | (define-key term-mode-map [menu-bar signals] | 852 | (define-key term-mode-map [menu-bar signals] |
| 862 | (setq term-signals-menu (cons "Signals" newmap))) | 853 | (setq term-signals-menu (cons "Signals" newmap))) |
| 863 | ))) | 854 | )) |
| 864 | 855 | ||
| 865 | ;; Set up term-raw-map, etc. | 856 | ;; Set up term-raw-map, etc. |
| 866 | 857 | ||
| 867 | (defun term-set-escape-char (c) | 858 | (defun term-set-escape-char (c) |
| 868 | "Change term-escape-char and keymaps that depend on it." | 859 | "Change term-escape-char and keymaps that depend on it." |
| 869 | (if term-escape-char | 860 | (when term-escape-char |
| 870 | (define-key term-raw-map term-escape-char 'term-send-raw)) | 861 | (define-key term-raw-map term-escape-char 'term-send-raw)) |
| 871 | (setq c (make-string 1 c)) | 862 | (setq c (make-string 1 c)) |
| 872 | (define-key term-raw-map c term-raw-escape-map) | 863 | (define-key term-raw-map c term-raw-escape-map) |
| 873 | ;; Define standard bindings in term-raw-escape-map | 864 | ;; Define standard bindings in term-raw-escape-map |
| @@ -901,28 +892,26 @@ is buffer-local.") | |||
| 901 | 892 | ||
| 902 | ;;; Added nearly all the 'grey keys' -mm | 893 | ;;; Added nearly all the 'grey keys' -mm |
| 903 | 894 | ||
| 904 | (progn | 895 | (if (featurep 'xemacs) |
| 905 | (term-if-xemacs | 896 | (define-key term-raw-map [button2] 'term-mouse-paste) |
| 906 | (define-key term-raw-map [button2] 'term-mouse-paste)) | 897 | (define-key term-raw-map [mouse-2] 'term-mouse-paste) |
| 907 | (term-ifnot-xemacs | 898 | (define-key term-raw-map [menu-bar terminal] term-terminal-menu) |
| 908 | (define-key term-raw-map [mouse-2] 'term-mouse-paste) | 899 | (define-key term-raw-map [menu-bar signals] term-signals-menu)) |
| 909 | (define-key term-raw-map [menu-bar terminal] term-terminal-menu) | 900 | (define-key term-raw-map [up] 'term-send-up) |
| 910 | (define-key term-raw-map [menu-bar signals] term-signals-menu)) | 901 | (define-key term-raw-map [down] 'term-send-down) |
| 911 | (define-key term-raw-map [up] 'term-send-up) | 902 | (define-key term-raw-map [right] 'term-send-right) |
| 912 | (define-key term-raw-map [down] 'term-send-down) | 903 | (define-key term-raw-map [left] 'term-send-left) |
| 913 | (define-key term-raw-map [right] 'term-send-right) | 904 | (define-key term-raw-map [delete] 'term-send-del) |
| 914 | (define-key term-raw-map [left] 'term-send-left) | 905 | (define-key term-raw-map [deletechar] 'term-send-del) |
| 915 | (define-key term-raw-map [delete] 'term-send-del) | 906 | (define-key term-raw-map [backspace] 'term-send-backspace) |
| 916 | (define-key term-raw-map [deletechar] 'term-send-del) | 907 | (define-key term-raw-map [home] 'term-send-home) |
| 917 | (define-key term-raw-map [backspace] 'term-send-backspace) | 908 | (define-key term-raw-map [end] 'term-send-end) |
| 918 | (define-key term-raw-map [home] 'term-send-home) | 909 | (define-key term-raw-map [insert] 'term-send-insert) |
| 919 | (define-key term-raw-map [end] 'term-send-end) | 910 | (define-key term-raw-map [S-prior] 'scroll-down) |
| 920 | (define-key term-raw-map [insert] 'term-send-insert) | 911 | (define-key term-raw-map [S-next] 'scroll-up) |
| 921 | (define-key term-raw-map [S-prior] 'scroll-down) | 912 | (define-key term-raw-map [S-insert] 'term-paste) |
| 922 | (define-key term-raw-map [S-next] 'scroll-up) | 913 | (define-key term-raw-map [prior] 'term-send-prior) |
| 923 | (define-key term-raw-map [S-insert] 'term-paste) | 914 | (define-key term-raw-map [next] 'term-send-next)) |
| 924 | (define-key term-raw-map [prior] 'term-send-prior) | ||
| 925 | (define-key term-raw-map [next] 'term-send-next))) | ||
| 926 | 915 | ||
| 927 | (term-set-escape-char ?\C-c) | 916 | (term-set-escape-char ?\C-c) |
| 928 | 917 | ||
| @@ -1114,9 +1103,9 @@ Entry to this mode runs the hooks on `term-mode-hook'." | |||
| 1114 | ;; Cua-mode's keybindings interfere with the term keybindings, disable it. | 1103 | ;; Cua-mode's keybindings interfere with the term keybindings, disable it. |
| 1115 | (set (make-local-variable 'cua-mode) nil) | 1104 | (set (make-local-variable 'cua-mode) nil) |
| 1116 | (run-mode-hooks 'term-mode-hook) | 1105 | (run-mode-hooks 'term-mode-hook) |
| 1117 | (term-if-xemacs | 1106 | (when (featurep 'xemacs) |
| 1118 | (set-buffer-menubar | 1107 | (set-buffer-menubar |
| 1119 | (append current-menubar (list term-terminal-menu)))) | 1108 | (append current-menubar (list term-terminal-menu)))) |
| 1120 | (or term-input-ring | 1109 | (or term-input-ring |
| 1121 | (setq term-input-ring (make-ring term-input-ring-size))) | 1110 | (setq term-input-ring (make-ring term-input-ring-size))) |
| 1122 | (term-update-mode-line)) | 1111 | (term-update-mode-line)) |
| @@ -1153,16 +1142,15 @@ Entry to this mode runs the hooks on `term-mode-hook'." | |||
| 1153 | (setq term-start-line-column nil) | 1142 | (setq term-start-line-column nil) |
| 1154 | (setq cur nil found t)) | 1143 | (setq cur nil found t)) |
| 1155 | (setq cur (cdr cur)))))) | 1144 | (setq cur (cdr cur)))))) |
| 1156 | (if (not found) | 1145 | (when (not found) |
| 1157 | (goto-char save-point))) | 1146 | (goto-char save-point))) |
| 1158 | found)) | 1147 | found)) |
| 1159 | 1148 | ||
| 1160 | (defun term-check-size (process) | 1149 | (defun term-check-size (process) |
| 1161 | (if (or (/= term-height (1- (window-height))) | 1150 | (when (or (/= term-height (1- (window-height))) |
| 1162 | (/= term-width (term-window-width))) | 1151 | (/= term-width (term-window-width))) |
| 1163 | (progn | 1152 | (term-reset-size (1- (window-height)) (term-window-width)) |
| 1164 | (term-reset-size (1- (window-height)) (term-window-width)) | 1153 | (set-process-window-size process term-height term-width))) |
| 1165 | (set-process-window-size process term-height term-width)))) | ||
| 1166 | 1154 | ||
| 1167 | (defun term-send-raw-string (chars) | 1155 | (defun term-send-raw-string (chars) |
| 1168 | (let ((proc (get-buffer-process (current-buffer)))) | 1156 | (let ((proc (get-buffer-process (current-buffer)))) |
| @@ -1171,8 +1159,8 @@ Entry to this mode runs the hooks on `term-mode-hook'." | |||
| 1171 | ;; Note that (term-current-row) must be called *after* | 1159 | ;; Note that (term-current-row) must be called *after* |
| 1172 | ;; (point) has been updated to (process-mark proc). | 1160 | ;; (point) has been updated to (process-mark proc). |
| 1173 | (goto-char (process-mark proc)) | 1161 | (goto-char (process-mark proc)) |
| 1174 | (if (term-pager-enabled) | 1162 | (when (term-pager-enabled) |
| 1175 | (setq term-pager-count (term-current-row))) | 1163 | (setq term-pager-count (term-current-row))) |
| 1176 | (process-send-string proc chars)))) | 1164 | (process-send-string proc chars)))) |
| 1177 | 1165 | ||
| 1178 | (defun term-send-raw () | 1166 | (defun term-send-raw () |
| @@ -1180,9 +1168,9 @@ Entry to this mode runs the hooks on `term-mode-hook'." | |||
| 1180 | without any interpretation." | 1168 | without any interpretation." |
| 1181 | (interactive) | 1169 | (interactive) |
| 1182 | ;; Convert `return' to C-m, etc. | 1170 | ;; Convert `return' to C-m, etc. |
| 1183 | (if (and (symbolp last-input-char) | 1171 | (when (and (symbolp last-input-char) |
| 1184 | (get last-input-char 'ascii-character)) | 1172 | (get last-input-char 'ascii-character)) |
| 1185 | (setq last-input-char (get last-input-char 'ascii-character))) | 1173 | (setq last-input-char (get last-input-char 'ascii-character))) |
| 1186 | (term-send-raw-string (make-string 1 last-input-char))) | 1174 | (term-send-raw-string (make-string 1 last-input-char))) |
| 1187 | 1175 | ||
| 1188 | (defun term-send-raw-meta () | 1176 | (defun term-send-raw-meta () |
| @@ -1207,19 +1195,19 @@ without any interpretation." | |||
| 1207 | (defun term-mouse-paste (click arg) | 1195 | (defun term-mouse-paste (click arg) |
| 1208 | "Insert the last stretch of killed text at the position clicked on." | 1196 | "Insert the last stretch of killed text at the position clicked on." |
| 1209 | (interactive "e\nP") | 1197 | (interactive "e\nP") |
| 1210 | (term-if-xemacs | 1198 | (if (featurep 'xemacs) |
| 1211 | (term-send-raw-string (or (condition-case () (x-get-selection) (error ())) | 1199 | (term-send-raw-string |
| 1212 | (x-get-cutbuffer) | 1200 | (or (condition-case () (x-get-selection) (error ())) |
| 1213 | (error "No selection or cut buffer available")))) | 1201 | (x-get-cutbuffer) |
| 1214 | (term-ifnot-xemacs | 1202 | (error "No selection or cut buffer available"))) |
| 1215 | ;; Give temporary modes such as isearch a chance to turn off. | 1203 | ;; Give temporary modes such as isearch a chance to turn off. |
| 1216 | (run-hooks 'mouse-leave-buffer-hook) | 1204 | (run-hooks 'mouse-leave-buffer-hook) |
| 1217 | (setq this-command 'yank) | 1205 | (setq this-command 'yank) |
| 1218 | (mouse-set-point click) | 1206 | (mouse-set-point click) |
| 1219 | (term-send-raw-string (current-kill (cond | 1207 | (term-send-raw-string (current-kill (cond |
| 1220 | ((listp arg) 0) | 1208 | ((listp arg) 0) |
| 1221 | ((eq arg '-) -1) | 1209 | ((eq arg '-) -1) |
| 1222 | (t (1- arg))))))) | 1210 | (t (1- arg))))))) |
| 1223 | 1211 | ||
| 1224 | (defun term-paste () | 1212 | (defun term-paste () |
| 1225 | "Insert the last stretch of killed text at point." | 1213 | "Insert the last stretch of killed text at point." |
| @@ -1248,33 +1236,31 @@ Each character you type is sent directly to the inferior without | |||
| 1248 | intervention from Emacs, except for the escape character (usually C-c)." | 1236 | intervention from Emacs, except for the escape character (usually C-c)." |
| 1249 | (interactive) | 1237 | (interactive) |
| 1250 | ;; FIXME: Emit message? Cfr ilisp-raw-message | 1238 | ;; FIXME: Emit message? Cfr ilisp-raw-message |
| 1251 | (if (term-in-line-mode) | 1239 | (when (term-in-line-mode) |
| 1252 | (progn | 1240 | (setq term-old-mode-map (current-local-map)) |
| 1253 | (setq term-old-mode-map (current-local-map)) | 1241 | (use-local-map term-raw-map) |
| 1254 | (use-local-map term-raw-map) | 1242 | |
| 1255 | 1243 | ;; Send existing partial line to inferior (without newline). | |
| 1256 | ;; Send existing partial line to inferior (without newline). | 1244 | (let ((pmark (process-mark (get-buffer-process (current-buffer)))) |
| 1257 | (let ((pmark (process-mark (get-buffer-process (current-buffer)))) | 1245 | (save-input-sender term-input-sender)) |
| 1258 | (save-input-sender term-input-sender)) | 1246 | (when (> (point) pmark) |
| 1259 | (if (> (point) pmark) | 1247 | (unwind-protect |
| 1260 | (unwind-protect | 1248 | (progn |
| 1261 | (progn | 1249 | (setq term-input-sender |
| 1262 | (setq term-input-sender | 1250 | (symbol-function 'term-send-string)) |
| 1263 | (symbol-function 'term-send-string)) | 1251 | (end-of-line) |
| 1264 | (end-of-line) | 1252 | (term-send-input)) |
| 1265 | (term-send-input)) | 1253 | (setq term-input-sender save-input-sender)))) |
| 1266 | (setq term-input-sender save-input-sender)))) | 1254 | (term-update-mode-line))) |
| 1267 | (term-update-mode-line)))) | ||
| 1268 | 1255 | ||
| 1269 | (defun term-line-mode () | 1256 | (defun term-line-mode () |
| 1270 | "Switch to line (\"cooked\") sub-mode of term mode. | 1257 | "Switch to line (\"cooked\") sub-mode of term mode. |
| 1271 | This means that Emacs editing commands work as normally, until | 1258 | This means that Emacs editing commands work as normally, until |
| 1272 | you type \\[term-send-input] which sends the current line to the inferior." | 1259 | you type \\[term-send-input] which sends the current line to the inferior." |
| 1273 | (interactive) | 1260 | (interactive) |
| 1274 | (if (term-in-char-mode) | 1261 | (when (term-in-char-mode) |
| 1275 | (progn | 1262 | (use-local-map term-old-mode-map) |
| 1276 | (use-local-map term-old-mode-map) | 1263 | (term-update-mode-line))) |
| 1277 | (term-update-mode-line)))) | ||
| 1278 | 1264 | ||
| 1279 | (defun term-update-mode-line () | 1265 | (defun term-update-mode-line () |
| 1280 | (setq mode-line-process | 1266 | (setq mode-line-process |
| @@ -1332,7 +1318,7 @@ buffer. The hook term-exec-hook is run after each exec." | |||
| 1332 | (save-excursion | 1318 | (save-excursion |
| 1333 | (set-buffer buffer) | 1319 | (set-buffer buffer) |
| 1334 | (let ((proc (get-buffer-process buffer))) ; Blast any old process. | 1320 | (let ((proc (get-buffer-process buffer))) ; Blast any old process. |
| 1335 | (if proc (delete-process proc))) | 1321 | (when proc (delete-process proc))) |
| 1336 | ;; Crank up a new process | 1322 | ;; Crank up a new process |
| 1337 | (let ((proc (term-exec-1 name buffer command switches))) | 1323 | (let ((proc (term-exec-1 name buffer command switches))) |
| 1338 | (make-local-variable 'term-ptyp) | 1324 | (make-local-variable 'term-ptyp) |
| @@ -1362,29 +1348,28 @@ buffer. The hook term-exec-hook is run after each exec." | |||
| 1362 | "Sentinel for term buffers. | 1348 | "Sentinel for term buffers. |
| 1363 | The main purpose is to get rid of the local keymap." | 1349 | The main purpose is to get rid of the local keymap." |
| 1364 | (let ((buffer (process-buffer proc))) | 1350 | (let ((buffer (process-buffer proc))) |
| 1365 | (if (memq (process-status proc) '(signal exit)) | 1351 | (when (memq (process-status proc) '(signal exit)) |
| 1366 | (progn | 1352 | (if (null (buffer-name buffer)) |
| 1367 | (if (null (buffer-name buffer)) | 1353 | ;; buffer killed |
| 1368 | ;; buffer killed | 1354 | (set-process-buffer proc nil) |
| 1369 | (set-process-buffer proc nil) | 1355 | (let ((obuf (current-buffer))) |
| 1370 | (let ((obuf (current-buffer))) | 1356 | ;; save-excursion isn't the right thing if |
| 1371 | ;; save-excursion isn't the right thing if | 1357 | ;; process-buffer is current-buffer |
| 1372 | ;; process-buffer is current-buffer | 1358 | (unwind-protect |
| 1373 | (unwind-protect | 1359 | (progn |
| 1374 | (progn | 1360 | ;; Write something in the compilation buffer |
| 1375 | ;; Write something in the compilation buffer | 1361 | ;; and hack its mode line. |
| 1376 | ;; and hack its mode line. | 1362 | (set-buffer buffer) |
| 1377 | (set-buffer buffer) | 1363 | ;; Get rid of local keymap. |
| 1378 | ;; Get rid of local keymap. | 1364 | (use-local-map nil) |
| 1379 | (use-local-map nil) | 1365 | (term-handle-exit (process-name proc) |
| 1380 | (term-handle-exit (process-name proc) | 1366 | msg) |
| 1381 | msg) | 1367 | ;; Since the buffer and mode line will show that the |
| 1382 | ;; Since the buffer and mode line will show that the | 1368 | ;; process is dead, we can delete it now. Otherwise it |
| 1383 | ;; process is dead, we can delete it now. Otherwise it | 1369 | ;; will stay around until M-x list-processes. |
| 1384 | ;; will stay around until M-x list-processes. | 1370 | (delete-process proc)) |
| 1385 | (delete-process proc)) | 1371 | (set-buffer obuf))) |
| 1386 | (set-buffer obuf)))) | 1372 | )))) |
| 1387 | )))) | ||
| 1388 | 1373 | ||
| 1389 | (defun term-handle-exit (process-name msg) | 1374 | (defun term-handle-exit (process-name msg) |
| 1390 | "Write process exit (or other change) message MSG in the current buffer." | 1375 | "Write process exit (or other change) message MSG in the current buffer." |
| @@ -1397,8 +1382,8 @@ The main purpose is to get rid of the local keymap." | |||
| 1397 | (insert ?\n "Process " process-name " " msg) | 1382 | (insert ?\n "Process " process-name " " msg) |
| 1398 | ;; Force mode line redisplay soon. | 1383 | ;; Force mode line redisplay soon. |
| 1399 | (force-mode-line-update) | 1384 | (force-mode-line-update) |
| 1400 | (if (and opoint (< opoint omax)) | 1385 | (when (and opoint (< opoint omax)) |
| 1401 | (goto-char opoint)))) | 1386 | (goto-char opoint)))) |
| 1402 | 1387 | ||
| 1403 | 1388 | ||
| 1404 | ;;; Name to use for TERM. | 1389 | ;;; Name to use for TERM. |
| @@ -1521,9 +1506,9 @@ See also `term-input-ignoredups' and `term-write-input-ring'." | |||
| 1521 | nil t)) | 1506 | nil t)) |
| 1522 | (let ((history (buffer-substring (match-beginning 1) | 1507 | (let ((history (buffer-substring (match-beginning 1) |
| 1523 | (match-end 1)))) | 1508 | (match-end 1)))) |
| 1524 | (if (or (null term-input-ignoredups) | 1509 | (when (or (null term-input-ignoredups) |
| 1525 | (ring-empty-p ring) | 1510 | (ring-empty-p ring) |
| 1526 | (not (string-equal (ring-ref ring 0) history))) | 1511 | (not (string-equal (ring-ref ring 0) history))) |
| 1527 | (ring-insert-at-beginning ring history))) | 1512 | (ring-insert-at-beginning ring history))) |
| 1528 | (setq count (1+ count)))) | 1513 | (setq count (1+ count)))) |
| 1529 | (kill-buffer history-buf)) | 1514 | (kill-buffer history-buf)) |
| @@ -1651,15 +1636,15 @@ Moves relative to `term-input-ring-index'." | |||
| 1651 | "Return the string matching REGEXP ARG places along the input ring. | 1636 | "Return the string matching REGEXP ARG places along the input ring. |
| 1652 | Moves relative to `term-input-ring-index'." | 1637 | Moves relative to `term-input-ring-index'." |
| 1653 | (let* ((pos (term-previous-matching-input-string-position regexp arg))) | 1638 | (let* ((pos (term-previous-matching-input-string-position regexp arg))) |
| 1654 | (if pos (ring-ref term-input-ring pos)))) | 1639 | (when pos (ring-ref term-input-ring pos)))) |
| 1655 | 1640 | ||
| 1656 | (defun term-previous-matching-input-string-position | 1641 | (defun term-previous-matching-input-string-position |
| 1657 | (regexp arg &optional start) | 1642 | (regexp arg &optional start) |
| 1658 | "Return the index matching REGEXP ARG places along the input ring. | 1643 | "Return the index matching REGEXP ARG places along the input ring. |
| 1659 | Moves relative to START, or `term-input-ring-index'." | 1644 | Moves relative to START, or `term-input-ring-index'." |
| 1660 | (if (or (not (ring-p term-input-ring)) | 1645 | (when (or (not (ring-p term-input-ring)) |
| 1661 | (ring-empty-p term-input-ring)) | 1646 | (ring-empty-p term-input-ring)) |
| 1662 | (error "No history")) | 1647 | (error "No history")) |
| 1663 | (let* ((len (ring-length term-input-ring)) | 1648 | (let* ((len (ring-length term-input-ring)) |
| 1664 | (motion (if (> arg 0) 1 -1)) | 1649 | (motion (if (> arg 0) 1 -1)) |
| 1665 | (n (mod (- (or start (term-search-start arg)) motion) len)) | 1650 | (n (mod (- (or start (term-search-start arg)) motion) len)) |
| @@ -1678,8 +1663,8 @@ Moves relative to START, or `term-input-ring-index'." | |||
| 1678 | tried-each-ring-item (= n prev))) | 1663 | tried-each-ring-item (= n prev))) |
| 1679 | (setq arg (if (> arg 0) (1- arg) (1+ arg)))) | 1664 | (setq arg (if (> arg 0) (1- arg) (1+ arg)))) |
| 1680 | ;; Now that we know which ring element to use, if we found it, return that. | 1665 | ;; Now that we know which ring element to use, if we found it, return that. |
| 1681 | (if (string-match regexp (ring-ref term-input-ring n)) | 1666 | (when (string-match regexp (ring-ref term-input-ring n)) |
| 1682 | n))) | 1667 | n))) |
| 1683 | 1668 | ||
| 1684 | (defun term-previous-matching-input (regexp arg) | 1669 | (defun term-previous-matching-input (regexp arg) |
| 1685 | "Search backwards through input history for match for REGEXP. | 1670 | "Search backwards through input history for match for REGEXP. |
| @@ -1713,14 +1698,14 @@ If N is negative, find the previous or Nth previous match." | |||
| 1713 | With prefix argument N, search for Nth previous match. | 1698 | With prefix argument N, search for Nth previous match. |
| 1714 | If N is negative, search forwards for the -Nth following match." | 1699 | If N is negative, search forwards for the -Nth following match." |
| 1715 | (interactive "p") | 1700 | (interactive "p") |
| 1716 | (if (not (memq last-command '(term-previous-matching-input-from-input | 1701 | (when (not (memq last-command '(term-previous-matching-input-from-input |
| 1717 | term-next-matching-input-from-input))) | 1702 | term-next-matching-input-from-input))) |
| 1718 | ;; Starting a new search | 1703 | ;; Starting a new search |
| 1719 | (setq term-matching-input-from-input-string | 1704 | (setq term-matching-input-from-input-string |
| 1720 | (buffer-substring | 1705 | (buffer-substring |
| 1721 | (process-mark (get-buffer-process (current-buffer))) | 1706 | (process-mark (get-buffer-process (current-buffer))) |
| 1722 | (point)) | 1707 | (point)) |
| 1723 | term-input-ring-index nil)) | 1708 | term-input-ring-index nil)) |
| 1724 | (term-previous-matching-input | 1709 | (term-previous-matching-input |
| 1725 | (concat "^" (regexp-quote term-matching-input-from-input-string)) | 1710 | (concat "^" (regexp-quote term-matching-input-from-input-string)) |
| 1726 | arg)) | 1711 | arg)) |
| @@ -1752,15 +1737,15 @@ See `term-magic-space' and `term-replace-by-expanded-history-before-point'. | |||
| 1752 | 1737 | ||
| 1753 | Returns t if successful." | 1738 | Returns t if successful." |
| 1754 | (interactive) | 1739 | (interactive) |
| 1755 | (if (and term-input-autoexpand | 1740 | (when (and term-input-autoexpand |
| 1756 | (string-match "[!^]" (funcall term-get-old-input)) | 1741 | (string-match "[!^]" (funcall term-get-old-input)) |
| 1757 | (save-excursion (beginning-of-line) | 1742 | (save-excursion (beginning-of-line) |
| 1758 | (looking-at term-prompt-regexp))) | 1743 | (looking-at term-prompt-regexp))) |
| 1759 | ;; Looks like there might be history references in the command. | 1744 | ;; Looks like there might be history references in the command. |
| 1760 | (let ((previous-modified-tick (buffer-modified-tick))) | 1745 | (let ((previous-modified-tick (buffer-modified-tick))) |
| 1761 | (message "Expanding history references...") | 1746 | (message "Expanding history references...") |
| 1762 | (term-replace-by-expanded-history-before-point silent) | 1747 | (term-replace-by-expanded-history-before-point silent) |
| 1763 | (/= previous-modified-tick (buffer-modified-tick))))) | 1748 | (/= previous-modified-tick (buffer-modified-tick))))) |
| 1764 | 1749 | ||
| 1765 | 1750 | ||
| 1766 | (defun term-replace-by-expanded-history-before-point (silent) | 1751 | (defun term-replace-by-expanded-history-before-point (silent) |
| @@ -2026,17 +2011,17 @@ Similarly for Soar, Scheme, etc." | |||
| 2026 | (delete-region pmark (point)) | 2011 | (delete-region pmark (point)) |
| 2027 | (insert input) | 2012 | (insert input) |
| 2028 | copy)))) | 2013 | copy)))) |
| 2029 | (if (term-pager-enabled) | 2014 | (when (term-pager-enabled) |
| 2030 | (save-excursion | 2015 | (save-excursion |
| 2031 | (goto-char (process-mark proc)) | 2016 | (goto-char (process-mark proc)) |
| 2032 | (setq term-pager-count (term-current-row)))) | 2017 | (setq term-pager-count (term-current-row)))) |
| 2033 | (if (and (funcall term-input-filter history) | 2018 | (when (and (funcall term-input-filter history) |
| 2034 | (or (null term-input-ignoredups) | 2019 | (or (null term-input-ignoredups) |
| 2035 | (not (ring-p term-input-ring)) | 2020 | (not (ring-p term-input-ring)) |
| 2036 | (ring-empty-p term-input-ring) | 2021 | (ring-empty-p term-input-ring) |
| 2037 | (not (string-equal (ring-ref term-input-ring 0) | 2022 | (not (string-equal (ring-ref term-input-ring 0) |
| 2038 | history)))) | 2023 | history)))) |
| 2039 | (ring-insert term-input-ring history)) | 2024 | (ring-insert term-input-ring history)) |
| 2040 | (let ((functions term-input-filter-functions)) | 2025 | (let ((functions term-input-filter-functions)) |
| 2041 | (while functions | 2026 | (while functions |
| 2042 | (funcall (car functions) (concat input "\n")) | 2027 | (funcall (car functions) (concat input "\n")) |
| @@ -2047,13 +2032,12 @@ Similarly for Soar, Scheme, etc." | |||
| 2047 | ;; in case we get output amidst sending the input. | 2032 | ;; in case we get output amidst sending the input. |
| 2048 | (set-marker term-last-input-start pmark) | 2033 | (set-marker term-last-input-start pmark) |
| 2049 | (set-marker term-last-input-end (point)) | 2034 | (set-marker term-last-input-end (point)) |
| 2050 | (if input-is-new | 2035 | (when input-is-new |
| 2051 | (progn | 2036 | ;; Set up to delete, because inferior should echo. |
| 2052 | ;; Set up to delete, because inferior should echo. | 2037 | (when (marker-buffer term-pending-delete-marker) |
| 2053 | (if (marker-buffer term-pending-delete-marker) | 2038 | (delete-region term-pending-delete-marker pmark)) |
| 2054 | (delete-region term-pending-delete-marker pmark)) | 2039 | (set-marker term-pending-delete-marker pmark-val) |
| 2055 | (set-marker term-pending-delete-marker pmark-val) | 2040 | (set-marker (process-mark proc) (point))) |
| 2056 | (set-marker (process-mark proc) (point)))) | ||
| 2057 | (goto-char pmark) | 2041 | (goto-char pmark) |
| 2058 | (funcall term-input-sender proc input))))) | 2042 | (funcall term-input-sender proc input))))) |
| 2059 | 2043 | ||
| @@ -2083,9 +2067,9 @@ Calls `term-get-old-input' to get old input." | |||
| 2083 | "Skip past the text matching regexp term-prompt-regexp. | 2067 | "Skip past the text matching regexp term-prompt-regexp. |
| 2084 | If this takes us past the end of the current line, don't skip at all." | 2068 | If this takes us past the end of the current line, don't skip at all." |
| 2085 | (let ((eol (save-excursion (end-of-line) (point)))) | 2069 | (let ((eol (save-excursion (end-of-line) (point)))) |
| 2086 | (if (and (looking-at term-prompt-regexp) | 2070 | (when (and (looking-at term-prompt-regexp) |
| 2087 | (<= (match-end 0) eol)) | 2071 | (<= (match-end 0) eol)) |
| 2088 | (goto-char (match-end 0))))) | 2072 | (goto-char (match-end 0))))) |
| 2089 | 2073 | ||
| 2090 | 2074 | ||
| 2091 | (defun term-after-pmark-p () | 2075 | (defun term-after-pmark-p () |
| @@ -2114,7 +2098,7 @@ The prompt skip is done by skipping text matching the regular expression | |||
| 2114 | term-prompt-regexp, a buffer local variable." | 2098 | term-prompt-regexp, a buffer local variable." |
| 2115 | (interactive "P") | 2099 | (interactive "P") |
| 2116 | (beginning-of-line) | 2100 | (beginning-of-line) |
| 2117 | (if (null arg) (term-skip-prompt))) | 2101 | (when (null arg) (term-skip-prompt))) |
| 2118 | 2102 | ||
| 2119 | ;;; These two functions are for entering text you don't want echoed or | 2103 | ;;; These two functions are for entering text you don't want echoed or |
| 2120 | ;;; saved -- typically passwords to ftp, telnet, or somesuch. | 2104 | ;;; saved -- typically passwords to ftp, telnet, or somesuch. |
| @@ -2175,10 +2159,10 @@ is additionally sent. String is not saved on term input history list. | |||
| 2175 | Security bug: your string can still be temporarily recovered with | 2159 | Security bug: your string can still be temporarily recovered with |
| 2176 | \\[view-lossage]." | 2160 | \\[view-lossage]." |
| 2177 | (interactive "P") ; Defeat snooping via C-x esc | 2161 | (interactive "P") ; Defeat snooping via C-x esc |
| 2178 | (if (not (stringp str)) | 2162 | (when (not (stringp str)) |
| 2179 | (setq str (term-read-noecho "Non-echoed text: " t))) | 2163 | (setq str (term-read-noecho "Non-echoed text: " t))) |
| 2180 | (if (not proc) | 2164 | (when (not proc) |
| 2181 | (setq proc (get-buffer-process (current-buffer)))) | 2165 | (setq proc (get-buffer-process (current-buffer)))) |
| 2182 | (if (not proc) (error "Current buffer has no process") | 2166 | (if (not proc) (error "Current buffer has no process") |
| 2183 | (setq term-kill-echo-list (nconc term-kill-echo-list | 2167 | (setq term-kill-echo-list (nconc term-kill-echo-list |
| 2184 | (cons str nil))) | 2168 | (cons str nil))) |
| @@ -2270,8 +2254,8 @@ Useful if you accidentally suspend the top-level process." | |||
| 2270 | (interactive) | 2254 | (interactive) |
| 2271 | (let* ((pmark (process-mark (get-buffer-process (current-buffer)))) | 2255 | (let* ((pmark (process-mark (get-buffer-process (current-buffer)))) |
| 2272 | (p-pos (marker-position pmark))) | 2256 | (p-pos (marker-position pmark))) |
| 2273 | (if (> (point) p-pos) | 2257 | (when (> (point) p-pos) |
| 2274 | (kill-region pmark (point))))) | 2258 | (kill-region pmark (point))))) |
| 2275 | 2259 | ||
| 2276 | (defun term-delchar-or-maybe-eof (arg) | 2260 | (defun term-delchar-or-maybe-eof (arg) |
| 2277 | "Delete ARG characters forward, or send an EOF to process if at end of | 2261 | "Delete ARG characters forward, or send an EOF to process if at end of |
| @@ -2279,7 +2263,7 @@ buffer." | |||
| 2279 | (interactive "p") | 2263 | (interactive "p") |
| 2280 | (if (eobp) | 2264 | (if (eobp) |
| 2281 | (process-send-eof) | 2265 | (process-send-eof) |
| 2282 | (delete-char arg))) | 2266 | (delete-char arg))) |
| 2283 | 2267 | ||
| 2284 | (defun term-send-eof () | 2268 | (defun term-send-eof () |
| 2285 | "Send an EOF to the current buffer's process." | 2269 | "Send an EOF to the current buffer's process." |
| @@ -2294,8 +2278,8 @@ If N is negative, find the next or Nth next match." | |||
| 2294 | (interactive (term-regexp-arg "Backward input matching (regexp): ")) | 2278 | (interactive (term-regexp-arg "Backward input matching (regexp): ")) |
| 2295 | (let* ((re (concat term-prompt-regexp ".*" regexp)) | 2279 | (let* ((re (concat term-prompt-regexp ".*" regexp)) |
| 2296 | (pos (save-excursion (end-of-line (if (> arg 0) 0 1)) | 2280 | (pos (save-excursion (end-of-line (if (> arg 0) 0 1)) |
| 2297 | (if (re-search-backward re nil t arg) | 2281 | (when (re-search-backward re nil t arg) |
| 2298 | (point))))) | 2282 | (point))))) |
| 2299 | (if (null pos) | 2283 | (if (null pos) |
| 2300 | (progn (message "Not found") | 2284 | (progn (message "Not found") |
| 2301 | (ding)) | 2285 | (ding)) |
| @@ -2407,15 +2391,15 @@ See `term-prompt-regexp'." | |||
| 2407 | 2391 | ||
| 2408 | (defun term-check-source (fname) | 2392 | (defun term-check-source (fname) |
| 2409 | (let ((buff (get-file-buffer fname))) | 2393 | (let ((buff (get-file-buffer fname))) |
| 2410 | (if (and buff | 2394 | (when (and buff |
| 2411 | (buffer-modified-p buff) | 2395 | (buffer-modified-p buff) |
| 2412 | (y-or-n-p (format "Save buffer %s first? " | 2396 | (y-or-n-p (format "Save buffer %s first? " |
| 2413 | (buffer-name buff)))) | 2397 | (buffer-name buff)))) |
| 2414 | ;; save BUFF. | 2398 | ;; save BUFF. |
| 2415 | (let ((old-buffer (current-buffer))) | 2399 | (let ((old-buffer (current-buffer))) |
| 2416 | (set-buffer buff) | 2400 | (set-buffer buff) |
| 2417 | (save-buffer) | 2401 | (save-buffer) |
| 2418 | (set-buffer old-buffer))))) | 2402 | (set-buffer old-buffer))))) |
| 2419 | 2403 | ||
| 2420 | 2404 | ||
| 2421 | ;;; (TERM-GET-SOURCE prompt prev-dir/file source-modes mustmatch-p) | 2405 | ;;; (TERM-GET-SOURCE prompt prev-dir/file source-modes mustmatch-p) |
| @@ -2510,12 +2494,12 @@ See `term-prompt-regexp'." | |||
| 2510 | ;; Try to position the proc window so you can see the answer. | 2494 | ;; Try to position the proc window so you can see the answer. |
| 2511 | ;; This is bogus code. If you delete the (sit-for 0), it breaks. | 2495 | ;; This is bogus code. If you delete the (sit-for 0), it breaks. |
| 2512 | ;; I don't know why. Wizards invited to improve it. | 2496 | ;; I don't know why. Wizards invited to improve it. |
| 2513 | (if (not (pos-visible-in-window-p proc-pt proc-win)) | 2497 | (when (not (pos-visible-in-window-p proc-pt proc-win)) |
| 2514 | (let ((opoint (window-point proc-win))) | 2498 | (let ((opoint (window-point proc-win))) |
| 2515 | (set-window-point proc-win proc-mark) (sit-for 0) | 2499 | (set-window-point proc-win proc-mark) (sit-for 0) |
| 2516 | (if (not (pos-visible-in-window-p opoint proc-win)) | 2500 | (if (not (pos-visible-in-window-p opoint proc-win)) |
| 2517 | (push-mark opoint) | 2501 | (push-mark opoint) |
| 2518 | (set-window-point proc-win opoint))))))) | 2502 | (set-window-point proc-win opoint))))))) |
| 2519 | 2503 | ||
| 2520 | ;;; Returns the current column in the current screen line. | 2504 | ;;; Returns the current column in the current screen line. |
| 2521 | ;;; Note: (current-column) yields column in buffer line. | 2505 | ;;; Note: (current-column) yields column in buffer line. |
| @@ -2703,16 +2687,15 @@ See `term-prompt-regexp'." | |||
| 2703 | ;; Let's handle the messages. -mm | 2687 | ;; Let's handle the messages. -mm |
| 2704 | 2688 | ||
| 2705 | (let* ((newstr (term-handle-ansi-terminal-messages str))) | 2689 | (let* ((newstr (term-handle-ansi-terminal-messages str))) |
| 2706 | (if (not (eq str newstr)) | 2690 | (when (not (eq str newstr)) |
| 2707 | (setq handled-ansi-message t | 2691 | (setq handled-ansi-message t |
| 2708 | str newstr))) | 2692 | str newstr))) |
| 2709 | (setq str-length (length str)) | 2693 | (setq str-length (length str)) |
| 2710 | 2694 | ||
| 2711 | (if (marker-buffer term-pending-delete-marker) | 2695 | (when (marker-buffer term-pending-delete-marker) |
| 2712 | (progn | 2696 | ;; Delete text following term-pending-delete-marker. |
| 2713 | ;; Delete text following term-pending-delete-marker. | 2697 | (delete-region term-pending-delete-marker (process-mark proc)) |
| 2714 | (delete-region term-pending-delete-marker (process-mark proc)) | 2698 | (set-marker term-pending-delete-marker nil)) |
| 2715 | (set-marker term-pending-delete-marker nil))) | ||
| 2716 | 2699 | ||
| 2717 | (if (eq (window-buffer) (current-buffer)) | 2700 | (if (eq (window-buffer) (current-buffer)) |
| 2718 | (progn | 2701 | (progn |
| @@ -2723,20 +2706,20 @@ See `term-prompt-regexp'." | |||
| 2723 | 2706 | ||
| 2724 | (setq save-marker (copy-marker (process-mark proc))) | 2707 | (setq save-marker (copy-marker (process-mark proc))) |
| 2725 | 2708 | ||
| 2726 | (if (/= (point) (process-mark proc)) | 2709 | (when (/= (point) (process-mark proc)) |
| 2727 | (progn (setq save-point (point-marker)) | 2710 | (setq save-point (point-marker)) |
| 2728 | (goto-char (process-mark proc)))) | 2711 | (goto-char (process-mark proc))) |
| 2729 | 2712 | ||
| 2730 | (save-restriction | 2713 | (save-restriction |
| 2731 | ;; If the buffer is in line mode, and there is a partial | 2714 | ;; If the buffer is in line mode, and there is a partial |
| 2732 | ;; input line, save the line (by narrowing to leave it | 2715 | ;; input line, save the line (by narrowing to leave it |
| 2733 | ;; outside the restriction ) until we're done with output. | 2716 | ;; outside the restriction ) until we're done with output. |
| 2734 | (if (and (> (point-max) (process-mark proc)) | 2717 | (when (and (> (point-max) (process-mark proc)) |
| 2735 | (term-in-line-mode)) | 2718 | (term-in-line-mode)) |
| 2736 | (narrow-to-region (point-min) (process-mark proc))) | 2719 | (narrow-to-region (point-min) (process-mark proc))) |
| 2737 | 2720 | ||
| 2738 | (if term-log-buffer | 2721 | (when term-log-buffer |
| 2739 | (princ str term-log-buffer)) | 2722 | (princ str term-log-buffer)) |
| 2740 | (cond ((eq term-terminal-state 4) ;; Have saved pending output. | 2723 | (cond ((eq term-terminal-state 4) ;; Have saved pending output. |
| 2741 | (setq str (concat term-terminal-parameter str)) | 2724 | (setq str (concat term-terminal-parameter str)) |
| 2742 | (setq term-terminal-parameter nil) | 2725 | (setq term-terminal-parameter nil) |
| @@ -2750,7 +2733,7 @@ See `term-prompt-regexp'." | |||
| 2750 | (setq funny | 2733 | (setq funny |
| 2751 | (string-match "[\r\n\000\007\033\t\b\032\016\017]" | 2734 | (string-match "[\r\n\000\007\033\t\b\032\016\017]" |
| 2752 | str i)) | 2735 | str i)) |
| 2753 | (if (not funny) (setq funny str-length)) | 2736 | (when (not funny) (setq funny str-length)) |
| 2754 | (cond ((> funny i) | 2737 | (cond ((> funny i) |
| 2755 | (cond ((eq term-terminal-state 1) | 2738 | (cond ((eq term-terminal-state 1) |
| 2756 | ;; We are in state 1, we need to wrap | 2739 | ;; We are in state 1, we need to wrap |
| @@ -2824,10 +2807,10 @@ See `term-prompt-regexp'." | |||
| 2824 | (setq count (min term-width | 2807 | (setq count (min term-width |
| 2825 | (+ count 8 (- (mod count 8))))) | 2808 | (+ count 8 (- (mod count 8))))) |
| 2826 | (if (> term-width count) | 2809 | (if (> term-width count) |
| 2827 | (progn | 2810 | (progn |
| 2828 | (term-move-columns | 2811 | (term-move-columns |
| 2829 | (- count (term-current-column))) | 2812 | (- count (term-current-column))) |
| 2830 | (setq term-current-column count)) | 2813 | (setq term-current-column count)) |
| 2831 | (when (> term-width (term-current-column)) | 2814 | (when (> term-width (term-current-column)) |
| 2832 | (term-move-columns | 2815 | (term-move-columns |
| 2833 | (1- (- term-width (term-current-column))))) | 2816 | (1- (- term-width (term-current-column))))) |
| @@ -2969,44 +2952,43 @@ See `term-prompt-regexp'." | |||
| 2969 | (setq term-terminal-previous-parameter-2 -1) | 2952 | (setq term-terminal-previous-parameter-2 -1) |
| 2970 | (setq term-terminal-previous-parameter -1) | 2953 | (setq term-terminal-previous-parameter -1) |
| 2971 | (setq term-terminal-state 0))))) | 2954 | (setq term-terminal-state 0))))) |
| 2972 | (if (term-handling-pager) | 2955 | (when (term-handling-pager) |
| 2973 | ;; Finish stuff to get ready to handle PAGER. | 2956 | ;; Finish stuff to get ready to handle PAGER. |
| 2974 | (progn | 2957 | (if (> (% (current-column) term-width) 0) |
| 2975 | (if (> (% (current-column) term-width) 0) | 2958 | (setq term-terminal-parameter |
| 2976 | (setq term-terminal-parameter | 2959 | (substring str i)) |
| 2977 | (substring str i)) | 2960 | ;; We're at column 0. Goto end of buffer; to compensate, |
| 2978 | ;; We're at column 0. Goto end of buffer; to compensate, | 2961 | ;; prepend a ?\r for later. This looks more consistent. |
| 2979 | ;; prepend a ?\r for later. This looks more consistent. | 2962 | (if (zerop i) |
| 2980 | (if (zerop i) | 2963 | (setq term-terminal-parameter |
| 2981 | (setq term-terminal-parameter | 2964 | (concat "\r" (substring str i))) |
| 2982 | (concat "\r" (substring str i))) | 2965 | (setq term-terminal-parameter (substring str (1- i))) |
| 2983 | (setq term-terminal-parameter (substring str (1- i))) | 2966 | (aset term-terminal-parameter 0 ?\r)) |
| 2984 | (aset term-terminal-parameter 0 ?\r)) | 2967 | (goto-char (point-max))) |
| 2985 | (goto-char (point-max))) | 2968 | (setq term-terminal-state 4) |
| 2986 | (setq term-terminal-state 4) | 2969 | (make-local-variable 'term-pager-old-filter) |
| 2987 | (make-local-variable 'term-pager-old-filter) | 2970 | (setq term-pager-old-filter (process-filter proc)) |
| 2988 | (setq term-pager-old-filter (process-filter proc)) | 2971 | (set-process-filter proc term-pager-filter) |
| 2989 | (set-process-filter proc term-pager-filter) | 2972 | (setq i str-length)) |
| 2990 | (setq i str-length))) | ||
| 2991 | (setq i (1+ i)))) | 2973 | (setq i (1+ i)))) |
| 2992 | 2974 | ||
| 2993 | (if (>= (term-current-row) term-height) | 2975 | (when (>= (term-current-row) term-height) |
| 2994 | (term-handle-deferred-scroll)) | 2976 | (term-handle-deferred-scroll)) |
| 2995 | 2977 | ||
| 2996 | (set-marker (process-mark proc) (point)) | 2978 | (set-marker (process-mark proc) (point)) |
| 2997 | (if save-point | 2979 | (when save-point |
| 2998 | (progn (goto-char save-point) | 2980 | (goto-char save-point) |
| 2999 | (set-marker save-point nil))) | 2981 | (set-marker save-point nil)) |
| 3000 | 2982 | ||
| 3001 | ;; Check for a pending filename-and-line number to display. | 2983 | ;; Check for a pending filename-and-line number to display. |
| 3002 | ;; We do this before scrolling, because we might create a new window. | 2984 | ;; We do this before scrolling, because we might create a new window. |
| 3003 | (if (and term-pending-frame | 2985 | (when (and term-pending-frame |
| 3004 | (eq (window-buffer selected) (current-buffer))) | 2986 | (eq (window-buffer selected) (current-buffer))) |
| 3005 | (progn (term-display-line (car term-pending-frame) | 2987 | (term-display-line (car term-pending-frame) |
| 3006 | (cdr term-pending-frame)) | 2988 | (cdr term-pending-frame)) |
| 3007 | (setq term-pending-frame nil) | 2989 | (setq term-pending-frame nil) |
| 3008 | ;; We have created a new window, so check the window size. | 2990 | ;; We have created a new window, so check the window size. |
| 3009 | (term-check-size proc))) | 2991 | (term-check-size proc)) |
| 3010 | 2992 | ||
| 3011 | ;; Scroll each window displaying the buffer but (by default) | 2993 | ;; Scroll each window displaying the buffer but (by default) |
| 3012 | ;; only if the point matches the process-mark we started with. | 2994 | ;; only if the point matches the process-mark we started with. |
| @@ -3018,50 +3000,47 @@ See `term-prompt-regexp'." | |||
| 3018 | (setq last-win win) | 3000 | (setq last-win win) |
| 3019 | (while (progn | 3001 | (while (progn |
| 3020 | (setq win (next-window win nil t)) | 3002 | (setq win (next-window win nil t)) |
| 3021 | (if (eq (window-buffer win) (process-buffer proc)) | 3003 | (when (eq (window-buffer win) (process-buffer proc)) |
| 3022 | (let ((scroll term-scroll-to-bottom-on-output)) | 3004 | (let ((scroll term-scroll-to-bottom-on-output)) |
| 3023 | (select-window win) | 3005 | (select-window win) |
| 3024 | (if (or (= (point) save-marker) | 3006 | (when (or (= (point) save-marker) |
| 3025 | (eq scroll t) (eq scroll 'all) | 3007 | (eq scroll t) (eq scroll 'all) |
| 3026 | ;; Maybe user wants point to jump to the end. | 3008 | ;; Maybe user wants point to jump to the end. |
| 3027 | (and (eq selected win) | 3009 | (and (eq selected win) |
| 3028 | (or (eq scroll 'this) (not save-point))) | 3010 | (or (eq scroll 'this) (not save-point))) |
| 3029 | (and (eq scroll 'others) | 3011 | (and (eq scroll 'others) |
| 3030 | (not (eq selected win)))) | 3012 | (not (eq selected win)))) |
| 3031 | (progn | 3013 | (goto-char term-home-marker) |
| 3032 | (goto-char term-home-marker) | 3014 | (recenter 0) |
| 3033 | (recenter 0) | 3015 | (goto-char (process-mark proc)) |
| 3034 | (goto-char (process-mark proc)) | 3016 | (if (not (pos-visible-in-window-p (point) win)) |
| 3035 | (if (not (pos-visible-in-window-p (point) win)) | 3017 | (recenter -1))) |
| 3036 | (recenter -1)))) | 3018 | ;; Optionally scroll so that the text |
| 3037 | ;; Optionally scroll so that the text | 3019 | ;; ends at the bottom of the window. |
| 3038 | ;; ends at the bottom of the window. | 3020 | (when (and term-scroll-show-maximum-output |
| 3039 | (if (and term-scroll-show-maximum-output | ||
| 3040 | (>= (point) (process-mark proc))) | 3021 | (>= (point) (process-mark proc))) |
| 3041 | (save-excursion | 3022 | (save-excursion |
| 3042 | (goto-char (point-max)) | 3023 | (goto-char (point-max)) |
| 3043 | (recenter -1))))) | 3024 | (recenter -1))))) |
| 3044 | (not (eq win last-win)))) | 3025 | (not (eq win last-win)))) |
| 3045 | 3026 | ||
| 3046 | ;;; Stolen from comint.el and adapted -mm | 3027 | ;;; Stolen from comint.el and adapted -mm |
| 3047 | (if (> term-buffer-maximum-size 0) | 3028 | (when (> term-buffer-maximum-size 0) |
| 3048 | (save-excursion | 3029 | (save-excursion |
| 3049 | (goto-char (process-mark (get-buffer-process (current-buffer)))) | 3030 | (goto-char (process-mark (get-buffer-process (current-buffer)))) |
| 3050 | (forward-line (- term-buffer-maximum-size)) | 3031 | (forward-line (- term-buffer-maximum-size)) |
| 3051 | (beginning-of-line) | 3032 | (beginning-of-line) |
| 3052 | (delete-region (point-min) (point)))) | 3033 | (delete-region (point-min) (point)))) |
| 3053 | ;;; | ||
| 3054 | |||
| 3055 | (set-marker save-marker nil))))) | 3034 | (set-marker save-marker nil))))) |
| 3056 | 3035 | ||
| 3057 | (defun term-handle-deferred-scroll () | 3036 | (defun term-handle-deferred-scroll () |
| 3058 | (let ((count (- (term-current-row) term-height))) | 3037 | (let ((count (- (term-current-row) term-height))) |
| 3059 | (if (>= count 0) | 3038 | (when (>= count 0) |
| 3060 | (save-excursion | 3039 | (save-excursion |
| 3061 | (goto-char term-home-marker) | 3040 | (goto-char term-home-marker) |
| 3062 | (term-vertical-motion (1+ count)) | 3041 | (term-vertical-motion (1+ count)) |
| 3063 | (set-marker term-home-marker (point)) | 3042 | (set-marker term-home-marker (point)) |
| 3064 | (setq term-current-row (1- term-height)))))) | 3043 | (setq term-current-row (1- term-height)))))) |
| 3065 | 3044 | ||
| 3066 | ;;; Reset the terminal, delete all the content and set the face to the | 3045 | ;;; Reset the terminal, delete all the content and set the face to the |
| 3067 | ;;; default one. | 3046 | ;;; default one. |
| @@ -3172,17 +3151,17 @@ See `term-prompt-regexp'." | |||
| 3172 | (list :background | 3151 | (list :background |
| 3173 | (if (= term-ansi-current-color 0) | 3152 | (if (= term-ansi-current-color 0) |
| 3174 | (face-foreground 'default) | 3153 | (face-foreground 'default) |
| 3175 | (elt ansi-term-color-vector term-ansi-current-color)) | 3154 | (elt ansi-term-color-vector term-ansi-current-color)) |
| 3176 | :foreground | 3155 | :foreground |
| 3177 | (if (= term-ansi-current-bg-color 0) | 3156 | (if (= term-ansi-current-bg-color 0) |
| 3178 | (face-background 'default) | 3157 | (face-background 'default) |
| 3179 | (elt ansi-term-color-vector term-ansi-current-bg-color)))) | 3158 | (elt ansi-term-color-vector term-ansi-current-bg-color)))) |
| 3180 | (when term-ansi-current-bold | 3159 | (when term-ansi-current-bold |
| 3181 | (setq term-current-face | 3160 | (setq term-current-face |
| 3182 | (append '(:weight bold) term-current-face))) | 3161 | (append '(:weight bold) term-current-face))) |
| 3183 | (when term-ansi-current-underline | 3162 | (when term-ansi-current-underline |
| 3184 | (setq term-current-face | 3163 | (setq term-current-face |
| 3185 | (append '(:underline t) term-current-face)))) | 3164 | (append '(:underline t) term-current-face)))) |
| 3186 | (if term-ansi-current-invisible | 3165 | (if term-ansi-current-invisible |
| 3187 | (setq term-current-face | 3166 | (setq term-current-face |
| 3188 | (if (= term-ansi-current-bg-color 0) | 3167 | (if (= term-ansi-current-bg-color 0) |
| @@ -3202,12 +3181,12 @@ See `term-prompt-regexp'." | |||
| 3202 | :background | 3181 | :background |
| 3203 | (elt ansi-term-color-vector term-ansi-current-bg-color))) | 3182 | (elt ansi-term-color-vector term-ansi-current-bg-color))) |
| 3204 | (when term-ansi-current-bold | 3183 | (when term-ansi-current-bold |
| 3205 | (setq term-current-face | 3184 | (setq term-current-face |
| 3206 | (append '(:weight bold) term-current-face))) | 3185 | (append '(:weight bold) term-current-face))) |
| 3207 | (when term-ansi-current-underline | 3186 | (when term-ansi-current-underline |
| 3208 | (setq term-current-face | 3187 | (setq term-current-face |
| 3209 | (append '(:underline t) term-current-face)))))) | 3188 | (append '(:underline t) term-current-face)))))) |
| 3210 | 3189 | ||
| 3211 | ;;; (message "Debug %S" term-current-face) | 3190 | ;;; (message "Debug %S" term-current-face) |
| 3212 | (setq term-ansi-face-already-done nil)) | 3191 | (setq term-ansi-face-already-done nil)) |
| 3213 | 3192 | ||
| @@ -3221,14 +3200,14 @@ See `term-prompt-regexp'." | |||
| 3221 | ;; (eq char ?f) ;; xterm seems to handle this sequence too, not | 3200 | ;; (eq char ?f) ;; xterm seems to handle this sequence too, not |
| 3222 | ;; needed for now | 3201 | ;; needed for now |
| 3223 | ) | 3202 | ) |
| 3224 | (if (<= term-terminal-parameter 0) | 3203 | (when (<= term-terminal-parameter 0) |
| 3225 | (setq term-terminal-parameter 1)) | 3204 | (setq term-terminal-parameter 1)) |
| 3226 | (if (<= term-terminal-previous-parameter 0) | 3205 | (when (<= term-terminal-previous-parameter 0) |
| 3227 | (setq term-terminal-previous-parameter 1)) | 3206 | (setq term-terminal-previous-parameter 1)) |
| 3228 | (if (> term-terminal-previous-parameter term-height) | 3207 | (when (> term-terminal-previous-parameter term-height) |
| 3229 | (setq term-terminal-previous-parameter term-height)) | 3208 | (setq term-terminal-previous-parameter term-height)) |
| 3230 | (if (> term-terminal-parameter term-width) | 3209 | (when (> term-terminal-parameter term-width) |
| 3231 | (setq term-terminal-parameter term-width)) | 3210 | (setq term-terminal-parameter term-width)) |
| 3232 | (term-goto | 3211 | (term-goto |
| 3233 | (1- term-terminal-previous-parameter) | 3212 | (1- term-terminal-previous-parameter) |
| 3234 | (1- term-terminal-parameter))) | 3213 | (1- term-terminal-parameter))) |
| @@ -3445,50 +3424,49 @@ The top-most line is line 0." | |||
| 3445 | ; The page is full, so enter "pager" mode, and wait for input. | 3424 | ; The page is full, so enter "pager" mode, and wait for input. |
| 3446 | 3425 | ||
| 3447 | (defun term-process-pager () | 3426 | (defun term-process-pager () |
| 3448 | (if (not term-pager-break-map) | 3427 | (when (not term-pager-break-map) |
| 3449 | (let* ((map (make-keymap)) | 3428 | (let* ((map (make-keymap)) |
| 3450 | (i 0) tmp) | 3429 | (i 0) tmp) |
| 3451 | ; (while (< i 128) | 3430 | ; (while (< i 128) |
| 3452 | ; (define-key map (make-string 1 i) 'term-send-raw) | 3431 | ; (define-key map (make-string 1 i) 'term-send-raw) |
| 3453 | ; (setq i (1+ i))) | 3432 | ; (setq i (1+ i))) |
| 3454 | (define-key map "\e" | 3433 | (define-key map "\e" |
| 3455 | (lookup-key (current-global-map) "\e")) | 3434 | (lookup-key (current-global-map) "\e")) |
| 3456 | (define-key map "\C-x" | 3435 | (define-key map "\C-x" |
| 3457 | (lookup-key (current-global-map) "\C-x")) | 3436 | (lookup-key (current-global-map) "\C-x")) |
| 3458 | (define-key map "\C-u" | 3437 | (define-key map "\C-u" |
| 3459 | (lookup-key (current-global-map) "\C-u")) | 3438 | (lookup-key (current-global-map) "\C-u")) |
| 3460 | (define-key map " " 'term-pager-page) | 3439 | (define-key map " " 'term-pager-page) |
| 3461 | (define-key map "\r" 'term-pager-line) | 3440 | (define-key map "\r" 'term-pager-line) |
| 3462 | (define-key map "?" 'term-pager-help) | 3441 | (define-key map "?" 'term-pager-help) |
| 3463 | (define-key map "h" 'term-pager-help) | 3442 | (define-key map "h" 'term-pager-help) |
| 3464 | (define-key map "b" 'term-pager-back-page) | 3443 | (define-key map "b" 'term-pager-back-page) |
| 3465 | (define-key map "\177" 'term-pager-back-line) | 3444 | (define-key map "\177" 'term-pager-back-line) |
| 3466 | (define-key map "q" 'term-pager-discard) | 3445 | (define-key map "q" 'term-pager-discard) |
| 3467 | (define-key map "D" 'term-pager-disable) | 3446 | (define-key map "D" 'term-pager-disable) |
| 3468 | (define-key map "<" 'term-pager-bob) | 3447 | (define-key map "<" 'term-pager-bob) |
| 3469 | (define-key map ">" 'term-pager-eob) | 3448 | (define-key map ">" 'term-pager-eob) |
| 3470 | 3449 | ||
| 3471 | ;; Add menu bar. | 3450 | ;; Add menu bar. |
| 3472 | (progn | 3451 | (unless (featurep 'xemacs) |
| 3473 | (term-ifnot-xemacs | 3452 | (define-key map [menu-bar terminal] term-terminal-menu) |
| 3474 | (define-key map [menu-bar terminal] term-terminal-menu) | 3453 | (define-key map [menu-bar signals] term-signals-menu) |
| 3475 | (define-key map [menu-bar signals] term-signals-menu) | 3454 | (setq tmp (make-sparse-keymap "More pages?")) |
| 3476 | (setq tmp (make-sparse-keymap "More pages?")) | 3455 | (define-key tmp [help] '("Help" . term-pager-help)) |
| 3477 | (define-key tmp [help] '("Help" . term-pager-help)) | 3456 | (define-key tmp [disable] |
| 3478 | (define-key tmp [disable] | 3457 | '("Disable paging" . term-fake-pager-disable)) |
| 3479 | '("Disable paging" . term-fake-pager-disable)) | 3458 | (define-key tmp [discard] |
| 3480 | (define-key tmp [discard] | 3459 | '("Discard remaining output" . term-pager-discard)) |
| 3481 | '("Discard remaining output" . term-pager-discard)) | 3460 | (define-key tmp [eob] '("Goto to end" . term-pager-eob)) |
| 3482 | (define-key tmp [eob] '("Goto to end" . term-pager-eob)) | 3461 | (define-key tmp [bob] '("Goto to beginning" . term-pager-bob)) |
| 3483 | (define-key tmp [bob] '("Goto to beginning" . term-pager-bob)) | 3462 | (define-key tmp [line] '("1 line forwards" . term-pager-line)) |
| 3484 | (define-key tmp [line] '("1 line forwards" . term-pager-line)) | 3463 | (define-key tmp [bline] '("1 line backwards" . term-pager-back-line)) |
| 3485 | (define-key tmp [bline] '("1 line backwards" . term-pager-back-line)) | 3464 | (define-key tmp [back] '("1 page backwards" . term-pager-back-page)) |
| 3486 | (define-key tmp [back] '("1 page backwards" . term-pager-back-page)) | 3465 | (define-key tmp [page] '("1 page forwards" . term-pager-page)) |
| 3487 | (define-key tmp [page] '("1 page forwards" . term-pager-page)) | 3466 | (define-key map [menu-bar page] (cons "More pages?" tmp)) |
| 3488 | (define-key map [menu-bar page] (cons "More pages?" tmp)) | 3467 | ) |
| 3489 | )) | ||
| 3490 | 3468 | ||
| 3491 | (setq term-pager-break-map map))) | 3469 | (setq term-pager-break-map map))) |
| 3492 | ; (let ((process (get-buffer-process (current-buffer)))) | 3470 | ; (let ((process (get-buffer-process (current-buffer)))) |
| 3493 | ; (stop-process process)) | 3471 | ; (stop-process process)) |
| 3494 | (setq term-pager-old-local-map (current-local-map)) | 3472 | (setq term-pager-old-local-map (current-local-map)) |
| @@ -3506,8 +3484,8 @@ The top-most line is line 0." | |||
| 3506 | (interactive "p") | 3484 | (interactive "p") |
| 3507 | (let* ((moved (vertical-motion (1+ lines))) | 3485 | (let* ((moved (vertical-motion (1+ lines))) |
| 3508 | (deficit (- lines moved))) | 3486 | (deficit (- lines moved))) |
| 3509 | (if (> moved lines) | 3487 | (when (> moved lines) |
| 3510 | (backward-char)) | 3488 | (backward-char)) |
| 3511 | (cond ((<= deficit 0) ;; OK, had enough in the buffer for request. | 3489 | (cond ((<= deficit 0) ;; OK, had enough in the buffer for request. |
| 3512 | (recenter (1- term-height))) | 3490 | (recenter (1- term-height))) |
| 3513 | ((term-pager-continue deficit))))) | 3491 | ((term-pager-continue deficit))))) |
| @@ -3521,8 +3499,8 @@ The top-most line is line 0." | |||
| 3521 | (defun term-pager-bob () | 3499 | (defun term-pager-bob () |
| 3522 | (interactive) | 3500 | (interactive) |
| 3523 | (goto-char (point-min)) | 3501 | (goto-char (point-min)) |
| 3524 | (if (= (vertical-motion term-height) term-height) | 3502 | (when (= (vertical-motion term-height) term-height) |
| 3525 | (backward-char)) | 3503 | (backward-char)) |
| 3526 | (recenter (1- term-height))) | 3504 | (recenter (1- term-height))) |
| 3527 | 3505 | ||
| 3528 | ; pager mode command to go to end of buffer | 3506 | ; pager mode command to go to end of buffer |
| @@ -3573,7 +3551,7 @@ The top-most line is line 0." | |||
| 3573 | (interactive) | 3551 | (interactive) |
| 3574 | (if (term-pager-enabled) (term-pager-disable) (term-pager-enable))) | 3552 | (if (term-pager-enabled) (term-pager-disable) (term-pager-enable))) |
| 3575 | 3553 | ||
| 3576 | (term-ifnot-xemacs | 3554 | (unless (featurep 'xemacs) |
| 3577 | (defalias 'term-fake-pager-enable 'term-pager-toggle) | 3555 | (defalias 'term-fake-pager-enable 'term-pager-toggle) |
| 3578 | (defalias 'term-fake-pager-disable 'term-pager-toggle) | 3556 | (defalias 'term-fake-pager-disable 'term-pager-toggle) |
| 3579 | (put 'term-char-mode 'menu-enable '(term-in-line-mode)) | 3557 | (put 'term-char-mode 'menu-enable '(term-in-line-mode)) |
| @@ -3626,45 +3604,45 @@ all pending output has been dealt with.")) | |||
| 3626 | (let ((scroll-needed | 3604 | (let ((scroll-needed |
| 3627 | (- (+ (term-current-row) down) | 3605 | (- (+ (term-current-row) down) |
| 3628 | (if (< down 0) term-scroll-start term-scroll-end)))) | 3606 | (if (< down 0) term-scroll-start term-scroll-end)))) |
| 3629 | (if (or (and (< down 0) (< scroll-needed 0)) | 3607 | (when (or (and (< down 0) (< scroll-needed 0)) |
| 3630 | (and (> down 0) (> scroll-needed 0))) | 3608 | (and (> down 0) (> scroll-needed 0))) |
| 3631 | (let ((save-point (copy-marker (point))) (save-top)) | 3609 | (let ((save-point (copy-marker (point))) (save-top)) |
| 3632 | (goto-char term-home-marker) | 3610 | (goto-char term-home-marker) |
| 3633 | (cond (term-scroll-with-delete | 3611 | (cond (term-scroll-with-delete |
| 3634 | (if (< down 0) | 3612 | (if (< down 0) |
| 3635 | (progn | 3613 | (progn |
| 3636 | ;; Delete scroll-needed lines at term-scroll-end, | 3614 | ;; Delete scroll-needed lines at term-scroll-end, |
| 3637 | ;; then insert scroll-needed lines. | 3615 | ;; then insert scroll-needed lines. |
| 3638 | (term-vertical-motion (1- term-scroll-end)) | 3616 | (term-vertical-motion (1- term-scroll-end)) |
| 3639 | (end-of-line) | 3617 | (end-of-line) |
| 3640 | (setq save-top (point)) | 3618 | (setq save-top (point)) |
| 3641 | (term-vertical-motion scroll-needed) | 3619 | (term-vertical-motion scroll-needed) |
| 3642 | (end-of-line) | 3620 | (end-of-line) |
| 3643 | (delete-region save-top (point)) | 3621 | (delete-region save-top (point)) |
| 3644 | (goto-char save-point) | 3622 | (goto-char save-point) |
| 3645 | (setq down (- scroll-needed down)) | 3623 | (setq down (- scroll-needed down)) |
| 3646 | (term-vertical-motion down)) | 3624 | (term-vertical-motion down)) |
| 3647 | ;; Delete scroll-needed lines at term-scroll-start. | 3625 | ;; Delete scroll-needed lines at term-scroll-start. |
| 3648 | (term-vertical-motion term-scroll-start) | 3626 | (term-vertical-motion term-scroll-start) |
| 3649 | (setq save-top (point)) | 3627 | (setq save-top (point)) |
| 3650 | (term-vertical-motion scroll-needed) | ||
| 3651 | (delete-region save-top (point)) | ||
| 3652 | (goto-char save-point) | ||
| 3653 | (term-vertical-motion down) | ||
| 3654 | (term-adjust-current-row-cache (- scroll-needed))) | ||
| 3655 | (setq term-current-column nil) | ||
| 3656 | (term-insert-char ?\n (abs scroll-needed))) | ||
| 3657 | ((and (numberp term-pager-count) | ||
| 3658 | (< (setq term-pager-count (- term-pager-count down)) | ||
| 3659 | 0)) | ||
| 3660 | (setq down 0) | ||
| 3661 | (term-process-pager)) | ||
| 3662 | (t | ||
| 3663 | (term-adjust-current-row-cache (- scroll-needed)) | ||
| 3664 | (term-vertical-motion scroll-needed) | 3628 | (term-vertical-motion scroll-needed) |
| 3665 | (set-marker term-home-marker (point)))) | 3629 | (delete-region save-top (point)) |
| 3666 | (goto-char save-point) | 3630 | (goto-char save-point) |
| 3667 | (set-marker save-point nil)))) | 3631 | (term-vertical-motion down) |
| 3632 | (term-adjust-current-row-cache (- scroll-needed))) | ||
| 3633 | (setq term-current-column nil) | ||
| 3634 | (term-insert-char ?\n (abs scroll-needed))) | ||
| 3635 | ((and (numberp term-pager-count) | ||
| 3636 | (< (setq term-pager-count (- term-pager-count down)) | ||
| 3637 | 0)) | ||
| 3638 | (setq down 0) | ||
| 3639 | (term-process-pager)) | ||
| 3640 | (t | ||
| 3641 | (term-adjust-current-row-cache (- scroll-needed)) | ||
| 3642 | (term-vertical-motion scroll-needed) | ||
| 3643 | (set-marker term-home-marker (point)))) | ||
| 3644 | (goto-char save-point) | ||
| 3645 | (set-marker save-point nil)))) | ||
| 3668 | down) | 3646 | down) |
| 3669 | 3647 | ||
| 3670 | (defun term-down (down &optional check-for-scroll) | 3648 | (defun term-down (down &optional check-for-scroll) |
| @@ -3701,34 +3679,34 @@ all pending output has been dealt with.")) | |||
| 3701 | ;; if the line above point wraps around, add a ?\n to undo the wrapping. | 3679 | ;; if the line above point wraps around, add a ?\n to undo the wrapping. |
| 3702 | ;; FIXME: Probably should be called more than it is. | 3680 | ;; FIXME: Probably should be called more than it is. |
| 3703 | (defun term-unwrap-line () | 3681 | (defun term-unwrap-line () |
| 3704 | (if (not (bolp)) (insert-before-markers ?\n))) | 3682 | (when (not (bolp)) (insert-before-markers ?\n))) |
| 3705 | 3683 | ||
| 3706 | (defun term-erase-in-line (kind) | 3684 | (defun term-erase-in-line (kind) |
| 3707 | (if (= kind 1) ;; erase left of point | 3685 | (when (= kind 1) ;; erase left of point |
| 3708 | (let ((cols (term-horizontal-column)) (saved-point (point))) | 3686 | (let ((cols (term-horizontal-column)) (saved-point (point))) |
| 3709 | (term-vertical-motion 0) | 3687 | (term-vertical-motion 0) |
| 3710 | (delete-region (point) saved-point) | 3688 | (delete-region (point) saved-point) |
| 3711 | (term-insert-char ? cols))) | 3689 | (term-insert-char ? cols))) |
| 3712 | (if (not (eq kind 1)) ;; erase right of point | 3690 | (when (not (eq kind 1)) ;; erase right of point |
| 3713 | (let ((saved-point (point)) | 3691 | (let ((saved-point (point)) |
| 3714 | (wrapped (and (zerop (term-horizontal-column)) | 3692 | (wrapped (and (zerop (term-horizontal-column)) |
| 3715 | (not (zerop (term-current-column)))))) | 3693 | (not (zerop (term-current-column)))))) |
| 3716 | (term-vertical-motion 1) | 3694 | (term-vertical-motion 1) |
| 3717 | (delete-region saved-point (point)) | 3695 | (delete-region saved-point (point)) |
| 3718 | ;; wrapped is true if we're at the beginning of screen line, | 3696 | ;; wrapped is true if we're at the beginning of screen line, |
| 3719 | ;; but not a buffer line. If we delete the current screen line | 3697 | ;; but not a buffer line. If we delete the current screen line |
| 3720 | ;; that will make the previous line no longer wrap, and (because | 3698 | ;; that will make the previous line no longer wrap, and (because |
| 3721 | ;; of the way Emacs display works) point will be at the end of | 3699 | ;; of the way Emacs display works) point will be at the end of |
| 3722 | ;; the previous screen line rather then the beginning of the | 3700 | ;; the previous screen line rather then the beginning of the |
| 3723 | ;; current one. To avoid that, we make sure that current line | 3701 | ;; current one. To avoid that, we make sure that current line |
| 3724 | ;; contain a space, to force the previous line to continue to wrap. | 3702 | ;; contain a space, to force the previous line to continue to wrap. |
| 3725 | ;; We could do this always, but it seems preferable to not add the | 3703 | ;; We could do this always, but it seems preferable to not add the |
| 3726 | ;; extra space when wrapped is false. | 3704 | ;; extra space when wrapped is false. |
| 3727 | (if wrapped | 3705 | (when wrapped |
| 3728 | (insert ? )) | 3706 | (insert ? )) |
| 3729 | (insert ?\n) | 3707 | (insert ?\n) |
| 3730 | (put-text-property saved-point (point) 'face 'default) | 3708 | (put-text-property saved-point (point) 'face 'default) |
| 3731 | (goto-char saved-point)))) | 3709 | (goto-char saved-point)))) |
| 3732 | 3710 | ||
| 3733 | (defun term-erase-in-display (kind) | 3711 | (defun term-erase-in-display (kind) |
| 3734 | "Erases (that is blanks out) part of the window. | 3712 | "Erases (that is blanks out) part of the window. |
| @@ -3934,8 +3912,8 @@ inside of a \"[...]\" (see `skip-chars-forward')." | |||
| 3934 | (let ((limit (point)) | 3912 | (let ((limit (point)) |
| 3935 | (word (concat "[" word-chars "]")) | 3913 | (word (concat "[" word-chars "]")) |
| 3936 | (non-word (concat "[^" word-chars "]"))) | 3914 | (non-word (concat "[^" word-chars "]"))) |
| 3937 | (if (re-search-backward non-word nil 'move) | 3915 | (when (re-search-backward non-word nil 'move) |
| 3938 | (forward-char 1)) | 3916 | (forward-char 1)) |
| 3939 | ;; Anchor the search forwards. | 3917 | ;; Anchor the search forwards. |
| 3940 | (if (or (eolp) (looking-at non-word)) | 3918 | (if (or (eolp) (looking-at non-word)) |
| 3941 | nil | 3919 | nil |
| @@ -3976,10 +3954,10 @@ completions listing is dependent on the value of `term-completion-autolist'. | |||
| 3976 | 3954 | ||
| 3977 | Returns t if successful." | 3955 | Returns t if successful." |
| 3978 | (interactive) | 3956 | (interactive) |
| 3979 | (if (term-match-partial-filename) | 3957 | (when (term-match-partial-filename) |
| 3980 | (prog2 (or (eq (selected-window) (minibuffer-window)) | 3958 | (prog2 (or (eq (selected-window) (minibuffer-window)) |
| 3981 | (message "Completing file name...")) | 3959 | (message "Completing file name...")) |
| 3982 | (term-dynamic-complete-as-filename)))) | 3960 | (term-dynamic-complete-as-filename)))) |
| 3983 | 3961 | ||
| 3984 | (defun term-dynamic-complete-as-filename () | 3962 | (defun term-dynamic-complete-as-filename () |
| 3985 | "Dynamically complete at point as a filename. | 3963 | "Dynamically complete at point as a filename. |
| @@ -4003,7 +3981,7 @@ See `term-dynamic-complete-filename'. Returns t if successful." | |||
| 4003 | (message "No completions of %s" filename) | 3981 | (message "No completions of %s" filename) |
| 4004 | (setq success nil)) | 3982 | (setq success nil)) |
| 4005 | ((eq completion t) ; Means already completed "file". | 3983 | ((eq completion t) ; Means already completed "file". |
| 4006 | (if term-completion-addsuffix (insert " ")) | 3984 | (when term-completion-addsuffix (insert " ")) |
| 4007 | (or mini-flag (message "Sole completion"))) | 3985 | (or mini-flag (message "Sole completion"))) |
| 4008 | ((string-equal completion "") ; Means completion on "directory/". | 3986 | ((string-equal completion "") ; Means completion on "directory/". |
| 4009 | (term-dynamic-list-filename-completions)) | 3987 | (term-dynamic-list-filename-completions)) |
| @@ -4068,7 +4046,7 @@ See also `term-dynamic-complete-filename'." | |||
| 4068 | (message "Sole completion") | 4046 | (message "Sole completion") |
| 4069 | (insert (substring completion (length stub))) | 4047 | (insert (substring completion (length stub))) |
| 4070 | (message "Completed")) | 4048 | (message "Completed")) |
| 4071 | (if term-completion-addsuffix (insert " ")) | 4049 | (when term-completion-addsuffix (insert " ")) |
| 4072 | 'sole)) | 4050 | 'sole)) |
| 4073 | (t ; There's no unique completion. | 4051 | (t ; There's no unique completion. |
| 4074 | (let ((completion (try-completion stub candidates))) | 4052 | (let ((completion (try-completion stub candidates))) |
diff --git a/lisp/term/mac-win.el b/lisp/term/mac-win.el index 5ad2fe700cb..736fbef76b2 100644 --- a/lisp/term/mac-win.el +++ b/lisp/term/mac-win.el | |||
| @@ -84,6 +84,7 @@ | |||
| 84 | (defvar mac-apple-event-map) | 84 | (defvar mac-apple-event-map) |
| 85 | (defvar mac-atsu-font-table) | 85 | (defvar mac-atsu-font-table) |
| 86 | (defvar mac-font-panel-mode) | 86 | (defvar mac-font-panel-mode) |
| 87 | (defvar mac-ts-active-input-overlay) | ||
| 87 | (defvar x-invocation-args) | 88 | (defvar x-invocation-args) |
| 88 | 89 | ||
| 89 | (defvar x-command-line-resources nil) | 90 | (defvar x-command-line-resources nil) |
| @@ -1570,6 +1571,15 @@ in `selection-converter-alist', which see." | |||
| 1570 | (mac-coerce-ae-data (car type-data) (cdr type-data) type)) | 1571 | (mac-coerce-ae-data (car type-data) (cdr type-data) type)) |
| 1571 | (cdr desc))))))) | 1572 | (cdr desc))))))) |
| 1572 | 1573 | ||
| 1574 | (defun mac-ae-number (ae keyword) | ||
| 1575 | (let ((type-data (mac-ae-parameter ae keyword)) | ||
| 1576 | str) | ||
| 1577 | (if (and type-data | ||
| 1578 | (setq str (mac-coerce-ae-data (car type-data) | ||
| 1579 | (cdr type-data) "TEXT"))) | ||
| 1580 | (string-to-number str) | ||
| 1581 | nil))) | ||
| 1582 | |||
| 1573 | (defun mac-bytes-to-integer (bytes &optional from to) | 1583 | (defun mac-bytes-to-integer (bytes &optional from to) |
| 1574 | (or from (setq from 0)) | 1584 | (or from (setq from 0)) |
| 1575 | (or to (setq to (length bytes))) | 1585 | (or to (setq to (length bytes))) |
| @@ -1610,6 +1620,65 @@ in `selection-converter-alist', which see." | |||
| 1610 | (and utf8-text | 1620 | (and utf8-text |
| 1611 | (decode-coding-string utf8-text 'utf-8)))) | 1621 | (decode-coding-string utf8-text 'utf-8)))) |
| 1612 | 1622 | ||
| 1623 | (defun mac-ae-text (ae) | ||
| 1624 | (or (cdr (mac-ae-parameter ae nil "TEXT")) | ||
| 1625 | (error "No text in Apple event."))) | ||
| 1626 | |||
| 1627 | (defun mac-ae-frame (ae &optional keyword type) | ||
| 1628 | (let ((bytes (cdr (mac-ae-parameter ae keyword type)))) | ||
| 1629 | (if (or (null bytes) (/= (length bytes) 4)) | ||
| 1630 | (error "No window reference in Apple event.") | ||
| 1631 | (let ((window-id (mac-coerce-ae-data "long" bytes "TEXT")) | ||
| 1632 | (rest (frame-list)) | ||
| 1633 | frame) | ||
| 1634 | (while (and (null frame) rest) | ||
| 1635 | (if (string= (frame-parameter (car rest) 'window-id) window-id) | ||
| 1636 | (setq frame (car rest))) | ||
| 1637 | (setq rest (cdr rest))) | ||
| 1638 | frame)))) | ||
| 1639 | |||
| 1640 | (defun mac-ae-script-language (ae keyword) | ||
| 1641 | ;; struct WritingCode { | ||
| 1642 | ;; ScriptCode theScriptCode; | ||
| 1643 | ;; LangCode theLangCode; | ||
| 1644 | ;; }; | ||
| 1645 | (let ((bytes (cdr (mac-ae-parameter ae keyword "intl")))) | ||
| 1646 | (and bytes | ||
| 1647 | (cons (mac-bytes-to-integer bytes 0 2) | ||
| 1648 | (mac-bytes-to-integer bytes 2 4))))) | ||
| 1649 | |||
| 1650 | (defun mac-bytes-to-text-range (bytes &optional from to) | ||
| 1651 | ;; struct TextRange { | ||
| 1652 | ;; long fStart; | ||
| 1653 | ;; long fEnd; | ||
| 1654 | ;; short fHiliteStyle; | ||
| 1655 | ;; }; | ||
| 1656 | (or from (setq from 0)) | ||
| 1657 | (or to (setq to (length bytes))) | ||
| 1658 | (and (= (- to from) (+ 4 4 2)) | ||
| 1659 | (list (mac-bytes-to-integer bytes from (+ from 4)) | ||
| 1660 | (mac-bytes-to-integer bytes (+ from 4) (+ from 8)) | ||
| 1661 | (mac-bytes-to-integer bytes (+ from 8) to)))) | ||
| 1662 | |||
| 1663 | (defun mac-ae-text-range-array (ae keyword) | ||
| 1664 | ;; struct TextRangeArray { | ||
| 1665 | ;; short fNumOfRanges; | ||
| 1666 | ;; TextRange fRange[1]; | ||
| 1667 | ;; }; | ||
| 1668 | (let* ((bytes (cdr (mac-ae-parameter ae keyword "tray"))) | ||
| 1669 | (len (length bytes)) | ||
| 1670 | nranges result) | ||
| 1671 | (when (and bytes (>= len 2) | ||
| 1672 | (progn | ||
| 1673 | (setq nranges (mac-bytes-to-integer bytes 0 2)) | ||
| 1674 | (= len (+ 2 (* nranges 10))))) | ||
| 1675 | (setq result (make-vector nranges nil)) | ||
| 1676 | (dotimes (i nranges) | ||
| 1677 | (aset result i | ||
| 1678 | (mac-bytes-to-text-range bytes (+ (* i 10) 2) | ||
| 1679 | (+ (* i 10) 12))))) | ||
| 1680 | result)) | ||
| 1681 | |||
| 1613 | (defun mac-ae-open-documents (event) | 1682 | (defun mac-ae-open-documents (event) |
| 1614 | "Open the documents specified by the Apple event EVENT." | 1683 | "Open the documents specified by the Apple event EVENT." |
| 1615 | (interactive "e") | 1684 | (interactive "e") |
| @@ -1637,10 +1706,6 @@ in `selection-converter-alist', which see." | |||
| 1637 | nil t))))) | 1706 | nil t))))) |
| 1638 | (select-frame-set-input-focus (selected-frame))) | 1707 | (select-frame-set-input-focus (selected-frame))) |
| 1639 | 1708 | ||
| 1640 | (defun mac-ae-text (ae) | ||
| 1641 | (or (cdr (mac-ae-parameter ae nil "TEXT")) | ||
| 1642 | (error "No text in Apple event."))) | ||
| 1643 | |||
| 1644 | (defun mac-ae-get-url (event) | 1709 | (defun mac-ae-get-url (event) |
| 1645 | "Open the URL specified by the Apple event EVENT. | 1710 | "Open the URL specified by the Apple event EVENT. |
| 1646 | Currently the `mailto' scheme is supported." | 1711 | Currently the `mailto' scheme is supported." |
| @@ -1649,7 +1714,7 @@ Currently the `mailto' scheme is supported." | |||
| 1649 | (parsed-url (url-generic-parse-url (mac-ae-text ae)))) | 1714 | (parsed-url (url-generic-parse-url (mac-ae-text ae)))) |
| 1650 | (if (string= (url-type parsed-url) "mailto") | 1715 | (if (string= (url-type parsed-url) "mailto") |
| 1651 | (url-mailto parsed-url) | 1716 | (url-mailto parsed-url) |
| 1652 | (error "Unsupported URL scheme: %s" (url-type parsed-url))))) | 1717 | (mac-resume-apple-event ae t)))) |
| 1653 | 1718 | ||
| 1654 | (setq mac-apple-event-map (make-sparse-keymap)) | 1719 | (setq mac-apple-event-map (make-sparse-keymap)) |
| 1655 | 1720 | ||
| @@ -1685,14 +1750,7 @@ modifiers, it changes global tool-bar visibility setting." | |||
| 1685 | (if (and modifiers (not (string= modifiers "\000\000\000\000"))) | 1750 | (if (and modifiers (not (string= modifiers "\000\000\000\000"))) |
| 1686 | ;; Globally toggle tool-bar-mode if some modifier key is pressed. | 1751 | ;; Globally toggle tool-bar-mode if some modifier key is pressed. |
| 1687 | (tool-bar-mode) | 1752 | (tool-bar-mode) |
| 1688 | (let ((window-id | 1753 | (let ((frame (mac-ae-frame ae))) |
| 1689 | (mac-coerce-ae-data "long" (cdr (mac-ae-parameter ae)) "TEXT")) | ||
| 1690 | (rest (frame-list)) | ||
| 1691 | frame) | ||
| 1692 | (while (and (null frame) rest) | ||
| 1693 | (if (string= (frame-parameter (car rest) 'window-id) window-id) | ||
| 1694 | (setq frame (car rest))) | ||
| 1695 | (setq rest (cdr rest))) | ||
| 1696 | (set-frame-parameter frame 'tool-bar-lines | 1754 | (set-frame-parameter frame 'tool-bar-lines |
| 1697 | (if (= (frame-parameter frame 'tool-bar-lines) 0) | 1755 | (if (= (frame-parameter frame 'tool-bar-lines) 0) |
| 1698 | 1 0)))))) | 1756 | 1 0)))))) |
| @@ -1722,13 +1780,12 @@ With numeric ARG, display the font panel if and only if ARG is positive." | |||
| 1722 | "Change default face attributes according to font selection EVENT." | 1780 | "Change default face attributes according to font selection EVENT." |
| 1723 | (interactive "e") | 1781 | (interactive "e") |
| 1724 | (let* ((ae (mac-event-ae event)) | 1782 | (let* ((ae (mac-event-ae event)) |
| 1725 | (fm-font-size (cdr (mac-ae-parameter ae "fmsz"))) | 1783 | (fm-font-size (mac-ae-number ae "fmsz")) |
| 1726 | (atsu-font-id (cdr (mac-ae-parameter ae "auid"))) | 1784 | (atsu-font-id (cdr (mac-ae-parameter ae "auid"))) |
| 1727 | (attribute-values (gethash atsu-font-id mac-atsu-font-table))) | 1785 | (attribute-values (gethash atsu-font-id mac-atsu-font-table))) |
| 1728 | (if fm-font-size | 1786 | (if fm-font-size |
| 1729 | (setq attribute-values | 1787 | (setq attribute-values |
| 1730 | `(:height ,(* 10 (mac-bytes-to-integer fm-font-size)) | 1788 | `(:height ,(* 10 fm-font-size) ,@attribute-values))) |
| 1731 | ,@attribute-values))) | ||
| 1732 | (apply 'set-face-attribute 'default (selected-frame) attribute-values))) | 1789 | (apply 'set-face-attribute 'default (selected-frame) attribute-values))) |
| 1733 | 1790 | ||
| 1734 | ;; kEventClassFont/kEventFontPanelClosed | 1791 | ;; kEventClassFont/kEventFontPanelClosed |
| @@ -1745,6 +1802,258 @@ With numeric ARG, display the font panel if and only if ARG is positive." | |||
| 1745 | 1802 | ||
| 1746 | ) ;; (fboundp 'mac-set-font-panel-visibility) | 1803 | ) ;; (fboundp 'mac-set-font-panel-visibility) |
| 1747 | 1804 | ||
| 1805 | ;;; Text Services | ||
| 1806 | (defvar mac-ts-active-input-buf "" | ||
| 1807 | "Byte sequence of the current Mac TSM active input area.") | ||
| 1808 | (defvar mac-ts-update-active-input-area-seqno 0 | ||
| 1809 | "Number of processed update-active-input-area events.") | ||
| 1810 | (setq mac-ts-active-input-overlay (make-overlay 0 0)) | ||
| 1811 | |||
| 1812 | (defface mac-ts-caret-position | ||
| 1813 | '((t :inverse-video t)) | ||
| 1814 | "Face for caret position in Mac TSM active input area. | ||
| 1815 | This is used only when the active input area is displayed in the | ||
| 1816 | echo area." | ||
| 1817 | :group 'mac) | ||
| 1818 | |||
| 1819 | (defface mac-ts-raw-text | ||
| 1820 | '((t :underline t)) | ||
| 1821 | "Face for raw text in Mac TSM active input area." | ||
| 1822 | :group 'mac) | ||
| 1823 | |||
| 1824 | (defface mac-ts-selected-raw-text | ||
| 1825 | '((t :underline t)) | ||
| 1826 | "Face for selected raw text in Mac TSM active input area." | ||
| 1827 | :group 'mac) | ||
| 1828 | |||
| 1829 | (defface mac-ts-converted-text | ||
| 1830 | '((((background dark)) :underline "gray20") | ||
| 1831 | (t :underline "gray80")) | ||
| 1832 | "Face for converted text in Mac TSM active input area." | ||
| 1833 | :group 'mac) | ||
| 1834 | |||
| 1835 | (defface mac-ts-selected-converted-text | ||
| 1836 | '((t :underline t)) | ||
| 1837 | "Face for selected converted text in Mac TSM active input area." | ||
| 1838 | :group 'mac) | ||
| 1839 | |||
| 1840 | (defface mac-ts-block-fill-text | ||
| 1841 | '((t :underline t)) | ||
| 1842 | "Face for block fill text in Mac TSM active input area." | ||
| 1843 | :group 'mac) | ||
| 1844 | |||
| 1845 | (defface mac-ts-outline-text | ||
| 1846 | '((t :underline t)) | ||
| 1847 | "Face for outline text in Mac TSM active input area." | ||
| 1848 | :group 'mac) | ||
| 1849 | |||
| 1850 | (defface mac-ts-selected-text | ||
| 1851 | '((t :underline t)) | ||
| 1852 | "Face for selected text in Mac TSM active input area." | ||
| 1853 | :group 'mac) | ||
| 1854 | |||
| 1855 | (defface mac-ts-no-hilite | ||
| 1856 | '((t :inherit default)) | ||
| 1857 | "Face for no hilite in Mac TSM active input area." | ||
| 1858 | :group 'mac) | ||
| 1859 | |||
| 1860 | (defconst mac-ts-hilite-style-faces | ||
| 1861 | '((2 . mac-ts-raw-text) ; kTSMHiliteRawText | ||
| 1862 | (3 . mac-ts-selected-raw-text) ; kTSMHiliteSelectedRawText | ||
| 1863 | (4 . mac-ts-converted-text) ; kTSMHiliteConvertedText | ||
| 1864 | (5 . mac-ts-selected-converted-text) ; kTSMHiliteSelectedConvertedText | ||
| 1865 | (6 . mac-ts-block-fill-text) ; kTSMHiliteBlockFillText | ||
| 1866 | (7 . mac-ts-outline-text) ; kTSMHiliteOutlineText | ||
| 1867 | (8 . mac-ts-selected-text) ; kTSMHiliteSelectedText | ||
| 1868 | (9 . mac-ts-no-hilite)) ; kTSMHiliteNoHilite | ||
| 1869 | "Alist of Mac TSM hilite style vs Emacs face.") | ||
| 1870 | |||
| 1871 | (defun mac-ts-update-active-input-buf (text fix-len hilite-rng update-rng) | ||
| 1872 | (let ((buf-len (length mac-ts-active-input-buf)) | ||
| 1873 | confirmed) | ||
| 1874 | (if (or (null update-rng) | ||
| 1875 | (/= (% (length update-rng) 2) 0)) | ||
| 1876 | ;; The parameter is missing (or in a bad format). The | ||
| 1877 | ;; existing inline input session is completely replaced with | ||
| 1878 | ;; the new text. | ||
| 1879 | (setq mac-ts-active-input-buf text) | ||
| 1880 | ;; Otherwise, the current subtext specified by the (2*j)-th | ||
| 1881 | ;; range is replaced with the new subtext specified by the | ||
| 1882 | ;; (2*j+1)-th range. | ||
| 1883 | (let ((tail buf-len) | ||
| 1884 | (i (length update-rng)) | ||
| 1885 | segments rng) | ||
| 1886 | (while (> i 0) | ||
| 1887 | (setq i (- i 2)) | ||
| 1888 | (setq rng (aref update-rng i)) | ||
| 1889 | (if (and (<= 0 (cadr rng)) (< (cadr rng) tail) | ||
| 1890 | (<= tail buf-len)) | ||
| 1891 | (setq segments | ||
| 1892 | (cons (substring mac-ts-active-input-buf (cadr rng) tail) | ||
| 1893 | segments))) | ||
| 1894 | (setq tail (car rng)) | ||
| 1895 | (setq rng (aref update-rng (1+ i))) | ||
| 1896 | (if (and (<= 0 (car rng)) (< (car rng) (cadr rng)) | ||
| 1897 | (<= (cadr rng) (length text))) | ||
| 1898 | (setq segments | ||
| 1899 | (cons (substring text (car rng) (cadr rng)) | ||
| 1900 | segments)))) | ||
| 1901 | (if (and (< 0 tail) (<= tail buf-len)) | ||
| 1902 | (setq segments | ||
| 1903 | (cons (substring mac-ts-active-input-buf 0 tail) | ||
| 1904 | segments))) | ||
| 1905 | (setq mac-ts-active-input-buf (apply 'concat segments)))) | ||
| 1906 | (setq buf-len (length mac-ts-active-input-buf)) | ||
| 1907 | ;; Confirm (a part of) inline input session. | ||
| 1908 | (cond ((< fix-len 0) | ||
| 1909 | ;; Entire inline session is being confirmed. | ||
| 1910 | (setq confirmed mac-ts-active-input-buf) | ||
| 1911 | (setq mac-ts-active-input-buf "")) | ||
| 1912 | ((= fix-len 0) | ||
| 1913 | ;; None of the text is being confirmed (yet). | ||
| 1914 | (setq confirmed "")) | ||
| 1915 | (t | ||
| 1916 | (if (> fix-len buf-len) | ||
| 1917 | (setq fix-len buf-len)) | ||
| 1918 | (setq confirmed (substring mac-ts-active-input-buf 0 fix-len)) | ||
| 1919 | (setq mac-ts-active-input-buf | ||
| 1920 | (substring mac-ts-active-input-buf fix-len)))) | ||
| 1921 | (setq buf-len (length mac-ts-active-input-buf)) | ||
| 1922 | ;; Update highlighting and the caret position in the new inline | ||
| 1923 | ;; input session. | ||
| 1924 | (remove-text-properties 0 buf-len '(cursor nil) mac-ts-active-input-buf) | ||
| 1925 | (mapc (lambda (rng) | ||
| 1926 | (cond ((and (= (nth 2 rng) 1) ; kTSMHiliteCaretPosition | ||
| 1927 | (<= 0 (car rng)) (< (car rng) buf-len)) | ||
| 1928 | (put-text-property (car rng) buf-len | ||
| 1929 | 'cursor t mac-ts-active-input-buf)) | ||
| 1930 | ((and (<= 0 (car rng)) (< (car rng) (cadr rng)) | ||
| 1931 | (<= (cadr rng) buf-len)) | ||
| 1932 | (put-text-property (car rng) (cadr rng) 'face | ||
| 1933 | (cdr (assq (nth 2 rng) | ||
| 1934 | mac-ts-hilite-style-faces)) | ||
| 1935 | mac-ts-active-input-buf)))) | ||
| 1936 | hilite-rng) | ||
| 1937 | confirmed)) | ||
| 1938 | |||
| 1939 | (defun mac-split-string-by-property-change (string) | ||
| 1940 | (let ((tail (length string)) | ||
| 1941 | head result) | ||
| 1942 | (unless (= tail 0) | ||
| 1943 | (while (setq head (previous-property-change tail string) | ||
| 1944 | result (cons (substring string (or head 0) tail) result) | ||
| 1945 | tail head))) | ||
| 1946 | result)) | ||
| 1947 | |||
| 1948 | (defun mac-replace-untranslated-utf-8-chars (string &optional to-string) | ||
| 1949 | (or to-string (setq to-string "$,3u=(B")) | ||
| 1950 | (mapconcat | ||
| 1951 | (lambda (str) | ||
| 1952 | (if (get-text-property 0 'untranslated-utf-8 str) to-string str)) | ||
| 1953 | (mac-split-string-by-property-change string) | ||
| 1954 | "")) | ||
| 1955 | |||
| 1956 | (defun mac-ts-update-active-input-area (event) | ||
| 1957 | "Update Mac TSM active input area according to EVENT. | ||
| 1958 | The confirmed text is converted to Emacs input events and pushed | ||
| 1959 | into `unread-command-events'. The unconfirmed text is displayed | ||
| 1960 | either in the current buffer or in the echo area." | ||
| 1961 | (interactive "e") | ||
| 1962 | (let* ((ae (mac-event-ae event)) | ||
| 1963 | (text (or (cdr (mac-ae-parameter ae "tstx" "utxt")) "")) | ||
| 1964 | (script-language (mac-ae-script-language ae "tssl")) | ||
| 1965 | (coding (or (cdr (assq (car script-language) | ||
| 1966 | mac-script-code-coding-systems)) | ||
| 1967 | 'mac-roman)) | ||
| 1968 | (fix-len (mac-bytes-to-integer | ||
| 1969 | (cdr (mac-ae-parameter ae "tsfx" "long")))) | ||
| 1970 | ;; Optional parameters | ||
| 1971 | (hilite-rng (mac-ae-text-range-array ae "tshi")) | ||
| 1972 | (update-rng (mac-ae-text-range-array ae "tsup")) | ||
| 1973 | ;;(pin-rng (mac-bytes-to-text-range (cdr (mac-ae-parameter ae "tspn" "txrn")))) | ||
| 1974 | ;;(clause-offsets (cdr (mac-ae-parameter ae "tscl" "ofay"))) | ||
| 1975 | (seqno (mac-ae-number ae "tsSn")) | ||
| 1976 | confirmed) | ||
| 1977 | (unless (= seqno mac-ts-update-active-input-area-seqno) | ||
| 1978 | ;; Reset internal states if sequence number is out of sync. | ||
| 1979 | (setq mac-ts-active-input-buf "")) | ||
| 1980 | (setq confirmed | ||
| 1981 | (mac-ts-update-active-input-buf text fix-len hilite-rng update-rng)) | ||
| 1982 | (let ((use-echo-area | ||
| 1983 | (or isearch-mode | ||
| 1984 | (and cursor-in-echo-area (current-message)) | ||
| 1985 | ;; Overlay strings are not shown in some cases. | ||
| 1986 | (get-char-property (point) 'display) | ||
| 1987 | (get-char-property (point) 'invisible) | ||
| 1988 | (get-char-property (point) 'composition))) | ||
| 1989 | active-input-string caret-seen) | ||
| 1990 | ;; Decode the active input area text with inheriting faces and | ||
| 1991 | ;; the caret position. | ||
| 1992 | (setq active-input-string | ||
| 1993 | (mapconcat | ||
| 1994 | (lambda (str) | ||
| 1995 | (let ((decoded (mac-utxt-to-string str coding))) | ||
| 1996 | (put-text-property 0 (length decoded) 'face | ||
| 1997 | (get-text-property 0 'face str) decoded) | ||
| 1998 | (when (and (not caret-seen) | ||
| 1999 | (get-text-property 0 'cursor str)) | ||
| 2000 | (setq caret-seen t) | ||
| 2001 | (if use-echo-area | ||
| 2002 | (put-text-property 0 1 'face 'mac-ts-caret-position | ||
| 2003 | decoded) | ||
| 2004 | (put-text-property 0 1 'cursor t decoded))) | ||
| 2005 | decoded)) | ||
| 2006 | (mac-split-string-by-property-change mac-ts-active-input-buf) | ||
| 2007 | "")) | ||
| 2008 | (put-text-property 0 (length active-input-string) | ||
| 2009 | 'mac-ts-active-input-string t active-input-string) | ||
| 2010 | (if use-echo-area | ||
| 2011 | (let (msg message-log-max) | ||
| 2012 | (if (and (current-message) | ||
| 2013 | ;; Don't get confused by previously displayed | ||
| 2014 | ;; `active-input-string'. | ||
| 2015 | (null (get-text-property 0 'mac-ts-active-input-string | ||
| 2016 | (current-message)))) | ||
| 2017 | (setq msg (propertize (current-message) 'display | ||
| 2018 | (concat (current-message) | ||
| 2019 | active-input-string))) | ||
| 2020 | (setq msg active-input-string)) | ||
| 2021 | (message "%s" msg) | ||
| 2022 | (overlay-put mac-ts-active-input-overlay 'before-string nil)) | ||
| 2023 | (move-overlay mac-ts-active-input-overlay | ||
| 2024 | (point) (point) (current-buffer)) | ||
| 2025 | (overlay-put mac-ts-active-input-overlay 'before-string | ||
| 2026 | active-input-string)) | ||
| 2027 | ;; Unread confirmed characters and insert them in a keyboard | ||
| 2028 | ;; macro being defined. | ||
| 2029 | (apply 'isearch-unread | ||
| 2030 | (append (mac-replace-untranslated-utf-8-chars | ||
| 2031 | (mac-utxt-to-string confirmed coding)) '()))) | ||
| 2032 | ;; The event is successfully processed. Sync the sequence number. | ||
| 2033 | (setq mac-ts-update-active-input-area-seqno (1+ seqno)))) | ||
| 2034 | |||
| 2035 | (defun mac-ts-unicode-for-key-event (event) | ||
| 2036 | "Convert Unicode key EVENT to Emacs key events and unread them." | ||
| 2037 | (interactive "e") | ||
| 2038 | (let* ((ae (mac-event-ae event)) | ||
| 2039 | (text (cdr (mac-ae-parameter ae "tstx" "utxt"))) | ||
| 2040 | (script-language (mac-ae-script-language ae "tssl")) | ||
| 2041 | (coding (or (cdr (assq (car script-language) | ||
| 2042 | mac-script-code-coding-systems)) | ||
| 2043 | 'mac-roman))) | ||
| 2044 | ;; Unread characters and insert them in a keyboard macro being | ||
| 2045 | ;; defined. | ||
| 2046 | (apply 'isearch-unread | ||
| 2047 | (append (mac-replace-untranslated-utf-8-chars | ||
| 2048 | (mac-utxt-to-string text coding)) '())))) | ||
| 2049 | |||
| 2050 | ;; kEventClassTextInput/kEventTextInputUpdateActiveInputArea | ||
| 2051 | (define-key mac-apple-event-map [text-input update-active-input-area] | ||
| 2052 | 'mac-ts-update-active-input-area) | ||
| 2053 | ;; kEventClassTextInput/kEventTextInputUnicodeForKeyEvent | ||
| 2054 | (define-key mac-apple-event-map [text-input unicode-for-key-event] | ||
| 2055 | 'mac-ts-unicode-for-key-event) | ||
| 2056 | |||
| 1748 | ;;; Services | 2057 | ;;; Services |
| 1749 | (defun mac-service-open-file () | 2058 | (defun mac-service-open-file () |
| 1750 | "Open the file specified by the selection value for Services." | 2059 | "Open the file specified by the selection value for Services." |
| @@ -1800,9 +2109,9 @@ With numeric ARG, display the font panel if and only if ARG is positive." | |||
| 1800 | "Dispatch EVENT according to the keymap `mac-apple-event-map'." | 2109 | "Dispatch EVENT according to the keymap `mac-apple-event-map'." |
| 1801 | (interactive "e") | 2110 | (interactive "e") |
| 1802 | (let* ((binding (lookup-key mac-apple-event-map (mac-event-spec event))) | 2111 | (let* ((binding (lookup-key mac-apple-event-map (mac-event-spec event))) |
| 1803 | (service-message | 2112 | (ae (mac-event-ae event)) |
| 1804 | (and (keymapp binding) | 2113 | (service-message (and (keymapp binding) |
| 1805 | (cdr (mac-ae-parameter (mac-event-ae event) "svmg"))))) | 2114 | (cdr (mac-ae-parameter ae "svmg"))))) |
| 1806 | (when service-message | 2115 | (when service-message |
| 1807 | (setq service-message | 2116 | (setq service-message |
| 1808 | (intern (decode-coding-string service-message 'utf-8))) | 2117 | (intern (decode-coding-string service-message 'utf-8))) |
| @@ -1810,9 +2119,18 @@ With numeric ARG, display the font panel if and only if ARG is positive." | |||
| 1810 | ;; Replace (cadr event) with a dummy position so that event-start | 2119 | ;; Replace (cadr event) with a dummy position so that event-start |
| 1811 | ;; returns it. | 2120 | ;; returns it. |
| 1812 | (setcar (cdr event) (list (selected-window) (point) '(0 . 0) 0)) | 2121 | (setcar (cdr event) (list (selected-window) (point) '(0 . 0) 0)) |
| 1813 | (call-interactively binding))) | 2122 | (if (null (mac-ae-parameter ae 'emacs-suspension-id)) |
| 2123 | (command-execute binding nil (vector event) t) | ||
| 2124 | (condition-case err | ||
| 2125 | (progn | ||
| 2126 | (command-execute binding nil (vector event) t) | ||
| 2127 | (mac-resume-apple-event ae)) | ||
| 2128 | (error | ||
| 2129 | (mac-ae-set-reply-parameter ae "errs" | ||
| 2130 | (cons "TEXT" (error-message-string err))) | ||
| 2131 | (mac-resume-apple-event ae -10000)))))) ; errAEEventFailed | ||
| 1814 | 2132 | ||
| 1815 | (global-set-key [mac-apple-event] 'mac-dispatch-apple-event) | 2133 | (define-key special-event-map [mac-apple-event] 'mac-dispatch-apple-event) |
| 1816 | 2134 | ||
| 1817 | ;; Processing of Apple events are deferred at the startup time. For | 2135 | ;; Processing of Apple events are deferred at the startup time. For |
| 1818 | ;; example, files dropped onto the Emacs application icon can only be | 2136 | ;; example, files dropped onto the Emacs application icon can only be |
| @@ -1820,6 +2138,8 @@ With numeric ARG, display the font panel if and only if ARG is positive." | |||
| 1820 | ;; the files should be opened. | 2138 | ;; the files should be opened. |
| 1821 | (add-hook 'after-init-hook 'mac-process-deferred-apple-events) | 2139 | (add-hook 'after-init-hook 'mac-process-deferred-apple-events) |
| 1822 | 2140 | ||
| 2141 | (run-with-idle-timer 5 t 'mac-cleanup-expired-apple-events) | ||
| 2142 | |||
| 1823 | 2143 | ||
| 1824 | ;;;; Drag and drop | 2144 | ;;;; Drag and drop |
| 1825 | 2145 | ||
diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el index 9e3de496b69..99e6dede206 100644 --- a/lisp/term/x-win.el +++ b/lisp/term/x-win.el | |||
| @@ -2529,5 +2529,9 @@ order until succeed.") | |||
| 2529 | (add-hook 'after-make-frame-functions 'x-dnd-init-frame) | 2529 | (add-hook 'after-make-frame-functions 'x-dnd-init-frame) |
| 2530 | (global-set-key [drag-n-drop] 'x-dnd-handle-drag-n-drop-event) | 2530 | (global-set-key [drag-n-drop] 'x-dnd-handle-drag-n-drop-event) |
| 2531 | 2531 | ||
| 2532 | ;; Let F10 do menu bar navigation. | ||
| 2533 | (and (fboundp 'menu-bar-open) | ||
| 2534 | (global-set-key [f10] 'menu-bar-open)) | ||
| 2535 | |||
| 2532 | ;; arch-tag: f1501302-db8b-4d95-88e3-116697d89f78 | 2536 | ;; arch-tag: f1501302-db8b-4d95-88e3-116697d89f78 |
| 2533 | ;;; x-win.el ends here | 2537 | ;;; x-win.el ends here |
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el index 74ec8beffa2..c82f2dcf3d0 100644 --- a/lisp/textmodes/bibtex.el +++ b/lisp/textmodes/bibtex.el | |||
| @@ -183,6 +183,17 @@ to all entries not explicitly mentioned." | |||
| 183 | :type '(repeat (choice :tag "Class" | 183 | :type '(repeat (choice :tag "Class" |
| 184 | (const :tag "catch-all" (catch-all)) | 184 | (const :tag "catch-all" (catch-all)) |
| 185 | (repeat :tag "Entry name" string)))) | 185 | (repeat :tag "Entry name" string)))) |
| 186 | (put 'bibtex-sort-entry-class 'safe-local-variable | ||
| 187 | (lambda (x) (let ((OK t)) | ||
| 188 | (while (consp x) | ||
| 189 | (let ((y (pop x))) | ||
| 190 | (while (consp y) | ||
| 191 | (let ((z (pop y))) | ||
| 192 | (unless (or (stringp z) (eq z 'catch-all)) | ||
| 193 | (setq OK nil)))) | ||
| 194 | (unless (null y) (setq OK nil)))) | ||
| 195 | (unless (null x) (setq OK nil)) | ||
| 196 | OK))) | ||
| 186 | 197 | ||
| 187 | (defcustom bibtex-sort-ignore-string-entries t | 198 | (defcustom bibtex-sort-ignore-string-entries t |
| 188 | "If non-nil, BibTeX @String entries are not sort-significant. | 199 | "If non-nil, BibTeX @String entries are not sort-significant. |
| @@ -610,6 +621,8 @@ See `bibtex-generate-autokey' for details." | |||
| 610 | (const :tag "Capitalize" capitalize) | 621 | (const :tag "Capitalize" capitalize) |
| 611 | (const :tag "Upcase" upcase) | 622 | (const :tag "Upcase" upcase) |
| 612 | (function :tag "Conversion function"))) | 623 | (function :tag "Conversion function"))) |
| 624 | (put 'bibtex-autokey-name-case-convert-function 'safe-local-variable | ||
| 625 | (lambda (x) (memq x '(upcase downcase capitalize identity)))) | ||
| 613 | (defvaralias 'bibtex-autokey-name-case-convert | 626 | (defvaralias 'bibtex-autokey-name-case-convert |
| 614 | 'bibtex-autokey-name-case-convert-function) | 627 | 'bibtex-autokey-name-case-convert-function) |
| 615 | 628 | ||
| @@ -1188,13 +1201,7 @@ The CDRs of the elements are t for header keys and nil for crossref keys.") | |||
| 1188 | (defvar bibtex-string-empty-key nil | 1201 | (defvar bibtex-string-empty-key nil |
| 1189 | "If non-nil, `bibtex-parse-string' accepts empty key.") | 1202 | "If non-nil, `bibtex-parse-string' accepts empty key.") |
| 1190 | 1203 | ||
| 1191 | (defvar bibtex-sort-entry-class-alist | 1204 | (defvar bibtex-sort-entry-class-alist nil |
| 1192 | (let ((i -1) alist) | ||
| 1193 | (dolist (class bibtex-sort-entry-class alist) | ||
| 1194 | (setq i (1+ i)) | ||
| 1195 | (dolist (entry class) | ||
| 1196 | ;; all entry names should be downcase (for ease of comparison) | ||
| 1197 | (push (cons (if (stringp entry) (downcase entry) entry) i) alist)))) | ||
| 1198 | "Alist mapping entry types to their sorting index. | 1205 | "Alist mapping entry types to their sorting index. |
| 1199 | Auto-generated from `bibtex-sort-entry-class'. | 1206 | Auto-generated from `bibtex-sort-entry-class'. |
| 1200 | Used when `bibtex-maintain-sorted-entries' is `entry-class'.") | 1207 | Used when `bibtex-maintain-sorted-entries' is `entry-class'.") |
| @@ -3188,6 +3195,17 @@ of the head of the entry found. Return nil if no entry found." | |||
| 3188 | entry-name)) | 3195 | entry-name)) |
| 3189 | (list key nil entry-name)))))) | 3196 | (list key nil entry-name)))))) |
| 3190 | 3197 | ||
| 3198 | (defun bibtex-init-sort-entry-class-alist () | ||
| 3199 | (unless (local-variable-p 'bibtex-sort-entry-class-alist) | ||
| 3200 | (set (make-local-variable 'bibtex-sort-entry-class-alist) | ||
| 3201 | (let ((i -1) alist) | ||
| 3202 | (dolist (class bibtex-sort-entry-class alist) | ||
| 3203 | (setq i (1+ i)) | ||
| 3204 | (dolist (entry class) | ||
| 3205 | ;; All entry names should be downcase (for ease of comparison). | ||
| 3206 | (push (cons (if (stringp entry) (downcase entry) entry) i) | ||
| 3207 | alist))))))) | ||
| 3208 | |||
| 3191 | (defun bibtex-lessp (index1 index2) | 3209 | (defun bibtex-lessp (index1 index2) |
| 3192 | "Predicate for sorting BibTeX entries with indices INDEX1 and INDEX2. | 3210 | "Predicate for sorting BibTeX entries with indices INDEX1 and INDEX2. |
| 3193 | Each index is a list (KEY CROSSREF-KEY ENTRY-NAME). | 3211 | Each index is a list (KEY CROSSREF-KEY ENTRY-NAME). |
| @@ -3225,13 +3243,14 @@ If its value is nil use plain sorting. Text outside of BibTeX entries is not | |||
| 3225 | affected. If `bibtex-sort-ignore-string-entries' is non-nil, @String entries | 3243 | affected. If `bibtex-sort-ignore-string-entries' is non-nil, @String entries |
| 3226 | are ignored." | 3244 | are ignored." |
| 3227 | (interactive) | 3245 | (interactive) |
| 3228 | (bibtex-beginning-of-first-entry) ;; needed by `sort-subr' | 3246 | (bibtex-beginning-of-first-entry) ; Needed by `sort-subr' |
| 3229 | (sort-subr nil | 3247 | (bibtex-init-sort-entry-class-alist) ; Needed by `bibtex-lessp'. |
| 3230 | 'bibtex-skip-to-valid-entry ; NEXTREC function | 3248 | (sort-subr nil |
| 3231 | 'bibtex-end-of-entry ; ENDREC function | 3249 | 'bibtex-skip-to-valid-entry ; NEXTREC function |
| 3232 | 'bibtex-entry-index ; STARTKEY function | 3250 | 'bibtex-end-of-entry ; ENDREC function |
| 3233 | nil ; ENDKEY function | 3251 | 'bibtex-entry-index ; STARTKEY function |
| 3234 | 'bibtex-lessp)) ; PREDICATE | 3252 | nil ; ENDKEY function |
| 3253 | 'bibtex-lessp)) ; PREDICATE | ||
| 3235 | 3254 | ||
| 3236 | (defun bibtex-find-crossref (crossref-key &optional pnt split) | 3255 | (defun bibtex-find-crossref (crossref-key &optional pnt split) |
| 3237 | "Move point to the beginning of BibTeX entry CROSSREF-KEY. | 3256 | "Move point to the beginning of BibTeX entry CROSSREF-KEY. |
| @@ -3332,6 +3351,7 @@ If `bibtex-maintain-sorted-entries' is non-nil, perform a binary | |||
| 3332 | search to look for place for KEY. This requires that buffer is sorted, | 3351 | search to look for place for KEY. This requires that buffer is sorted, |
| 3333 | see `bibtex-validate'. | 3352 | see `bibtex-validate'. |
| 3334 | Return t if preparation was successful or nil if entry KEY already exists." | 3353 | Return t if preparation was successful or nil if entry KEY already exists." |
| 3354 | (bibtex-init-sort-entry-class-alist) ; Needed by `bibtex-lessp'. | ||
| 3335 | (let ((key (nth 0 index)) | 3355 | (let ((key (nth 0 index)) |
| 3336 | key-exist) | 3356 | key-exist) |
| 3337 | (cond ((or (null key) | 3357 | (cond ((or (null key) |
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el index c20ecef31e0..23f4756f4a7 100644 --- a/lisp/textmodes/flyspell.el +++ b/lisp/textmodes/flyspell.el | |||
| @@ -486,6 +486,18 @@ in your .emacs file. | |||
| 486 | (flyspell-mode-on) | 486 | (flyspell-mode-on) |
| 487 | (flyspell-mode-off))) | 487 | (flyspell-mode-off))) |
| 488 | 488 | ||
| 489 | ;;;###autoload | ||
| 490 | (defun turn-on-flyspell () | ||
| 491 | "Unconditionally turn on Flyspell mode." | ||
| 492 | (flyspell-mode 1)) | ||
| 493 | |||
| 494 | ;;;###autoload | ||
| 495 | (defun turn-off-flyspell () | ||
| 496 | "Unconditionally turn off Flyspell mode." | ||
| 497 | (flyspell-mode -1)) | ||
| 498 | |||
| 499 | (custom-add-option 'text-mode-hook 'turn-on-flyspell) | ||
| 500 | |||
| 489 | ;;*---------------------------------------------------------------------*/ | 501 | ;;*---------------------------------------------------------------------*/ |
| 490 | ;;* flyspell-buffers ... */ | 502 | ;;* flyspell-buffers ... */ |
| 491 | ;;* ------------------------------------------------------------- */ | 503 | ;;* ------------------------------------------------------------- */ |
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index 7bfedb1bd97..a4d873a543d 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el | |||
| @@ -865,7 +865,7 @@ and added as a submenu of the \"Edit\" menu.") | |||
| 865 | (defvar ispell-process nil | 865 | (defvar ispell-process nil |
| 866 | "The process object for Ispell.") | 866 | "The process object for Ispell.") |
| 867 | 867 | ||
| 868 | (defvar ispell-async-processp (and (fboundp 'kill-process) | 868 | (defvar ispell-async-processp (and (fboundp 'delete-process) |
| 869 | (fboundp 'process-send-string) | 869 | (fboundp 'process-send-string) |
| 870 | (fboundp 'accept-process-output) | 870 | (fboundp 'accept-process-output) |
| 871 | ;;(fboundp 'start-process) | 871 | ;;(fboundp 'start-process) |
| @@ -2572,15 +2572,7 @@ With NO-ERROR, just return non-nil if there was no Ispell running." | |||
| 2572 | (or no-error | 2572 | (or no-error |
| 2573 | (error "There is no ispell process running!")) | 2573 | (error "There is no ispell process running!")) |
| 2574 | (if ispell-async-processp | 2574 | (if ispell-async-processp |
| 2575 | (progn | 2575 | (delete-process ispell-process) |
| 2576 | (process-send-eof ispell-process) | ||
| 2577 | (if (eq (ispell-process-status) 'run) | ||
| 2578 | (ispell-accept-output 1)) | ||
| 2579 | (if (eq (ispell-process-status) 'run) | ||
| 2580 | (kill-process ispell-process)) | ||
| 2581 | (while (not (or (eq (ispell-process-status) 'exit) | ||
| 2582 | (eq (ispell-process-status) 'signal))) | ||
| 2583 | (sleep-for 0.25))) | ||
| 2584 | ;; synchronous processes | 2576 | ;; synchronous processes |
| 2585 | (ispell-send-string "\n") ; make sure side effects occurred. | 2577 | (ispell-send-string "\n") ; make sure side effects occurred. |
| 2586 | (kill-buffer ispell-output-buffer) | 2578 | (kill-buffer ispell-output-buffer) |
diff --git a/lisp/textmodes/org.el b/lisp/textmodes/org.el index ea9aa4448ee..dd4dfc1a857 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, wp | 6 | ;; Keywords: outlines, hypermedia, calendar, wp |
| 7 | ;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/ | 7 | ;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/ |
| 8 | ;; Version: 4.26 | 8 | ;; Version: 4.36b |
| 9 | ;; | 9 | ;; |
| 10 | ;; This file is part of GNU Emacs. | 10 | ;; This file is part of GNU Emacs. |
| 11 | ;; | 11 | ;; |
| @@ -30,16 +30,21 @@ | |||
| 30 | ;; Org-mode is a mode for keeping notes, maintaining ToDo lists, and doing | 30 | ;; Org-mode is a mode for keeping notes, maintaining ToDo lists, and doing |
| 31 | ;; project planning with a fast and effective plain-text system. | 31 | ;; project planning with a fast and effective plain-text system. |
| 32 | ;; | 32 | ;; |
| 33 | ;; Org-mode develops organizational tasks around a NOTES file that contains | 33 | ;; Org-mode develops organizational tasks around NOTES files that contain |
| 34 | ;; information about projects as plain text. Org-mode is implemented on top | 34 | ;; information about projects as plain text. Org-mode is implemented on |
| 35 | ;; of outline-mode - ideal to keep the content of large files well structured. | 35 | ;; top of outline-mode, which makes it possible to keep the content of |
| 36 | ;; It supports ToDo items, deadlines and time stamps, which can be extracted | 36 | ;; large files well structured. Visibility cycling and structure editing |
| 37 | ;; to create a daily/weekly agenda that also integrates the diary of the Emacs | 37 | ;; help to work with the tree. Tables are easily created with a built-in |
| 38 | ;; calendar. Tables are easily created with a built-in table editor. Plain | 38 | ;; table editor. Org-mode supports ToDo items, deadlines, time stamps, |
| 39 | ;; text URL-like links connect to websites, emails (VM, RMAIL, WANDERLUST), | 39 | ;; and scheduling. It dynamically compiles entries into an agenda that |
| 40 | ;; Usenet messages (Gnus), BBDB entries, and any files related to the | 40 | ;; utilizes and smoothly integrates much of the Emacs calendar and diary. |
| 41 | ;; projects. For printing and sharing of notes, an Org-mode file (or a part | 41 | ;; Plain text URL-like links connect to websites, emails, Usenet |
| 42 | ;; of it) can be exported as a structured ASCII file, or as HTML. | 42 | ;; messages, BBDB entries, and any files related to the projects. For |
| 43 | ;; printing and sharing of notes, an Org-mode file can be exported as a | ||
| 44 | ;; structured ASCII file, as HTML, or (todo and agenda items only) as an | ||
| 45 | ;; iCalendar file. It can also serve as a publishing tool for a set of | ||
| 46 | ;; linked webpages. | ||
| 47 | ;; | ||
| 43 | ;; | 48 | ;; |
| 44 | ;; Installation | 49 | ;; Installation |
| 45 | ;; ------------ | 50 | ;; ------------ |
| @@ -52,19 +57,23 @@ | |||
| 52 | ;; (define-key global-map "\C-cl" 'org-store-link) | 57 | ;; (define-key global-map "\C-cl" 'org-store-link) |
| 53 | ;; (define-key global-map "\C-ca" 'org-agenda) | 58 | ;; (define-key global-map "\C-ca" 'org-agenda) |
| 54 | ;; | 59 | ;; |
| 55 | ;; If you have downloaded Org-mode from the Web, you must byte-compile | 60 | ;; Furthermore you need to activate font-lock-mode in org-mode buffers. |
| 56 | ;; org.el and put it on your load path. In addition to the Emacs Lisp | 61 | ;; either of the following two lins will do the trick: |
| 57 | ;; lines above, you also need to add the following lines to .emacs: | 62 | ;; |
| 63 | ;; (global-font-lock-mode 1) ; for all buffers | ||
| 64 | ;; (add-hook 'org-mode-hook 'turn-on-font-lock) ; org-mode buffers only | ||
| 65 | ;; | ||
| 66 | ;; If you have downloaded Org-mode from the Web, you have to take additional | ||
| 67 | ;; action: Byte-compile org.el and org-publish.el and put them together with | ||
| 68 | ;; org-install.el on your load path. Then also add to your .emacs file: | ||
| 69 | ;; | ||
| 70 | ;; (require 'org-install) | ||
| 58 | ;; | 71 | ;; |
| 59 | ;; (autoload 'org-mode "org" "Org mode" t) | ||
| 60 | ;; (autoload 'org-diary "org" "Diary entries from Org mode") | ||
| 61 | ;; (autoload 'org-agenda "org" "Multi-file agenda from Org mode" t) | ||
| 62 | ;; (autoload 'org-store-link "org" "Store a link to the current location" t) | ||
| 63 | ;; (autoload 'orgtbl-mode "org" "Org tables as a minor mode" t) | ||
| 64 | ;; (autoload 'turn-on-orgtbl "org" "Org tables as a minor mode") | ||
| 65 | ;; | 72 | ;; |
| 66 | ;; This setup will put all files with extension ".org" into Org-mode. As | 73 | ;; Activation |
| 67 | ;; an alternative, make the first line of a file look like this: | 74 | ;; ---------- |
| 75 | ;; The setup above will put all files with extension ".org" into Org-mode. | ||
| 76 | ;; As an alternative, make the first line of a file look like this: | ||
| 68 | ;; | 77 | ;; |
| 69 | ;; MY PROJECTS -*- mode: org; -*- | 78 | ;; MY PROJECTS -*- mode: org; -*- |
| 70 | ;; | 79 | ;; |
| @@ -79,65 +88,95 @@ | |||
| 79 | ;; excellent reference card made by Philip Rooke. This card can be found | 88 | ;; excellent reference card made by Philip Rooke. This card can be found |
| 80 | ;; in the etc/ directory of Emacs 22. | 89 | ;; in the etc/ directory of Emacs 22. |
| 81 | ;; | 90 | ;; |
| 82 | ;; Changes since version 4.10: | 91 | ;; Recent changes |
| 83 | ;; --------------------------- | 92 | ;; -------------- |
| 84 | ;; Version 4.26 | 93 | ;; Version 4.37 |
| 94 | ;; - Clock-feature for measuring time spent on specific items. | ||
| 95 | ;; - Improved emphasizing allows configuration and stacking. | ||
| 96 | ;; | ||
| 97 | ;; Version 4.36 | ||
| 98 | ;; - Improved indentation of ASCII export, when headlines become items. | ||
| 99 | ;; - Handling of 12am and 12pm fixed. Times beyond 24:00 can be used | ||
| 100 | ;; and will not lead to conflicts. | ||
| 101 | ;; - Support for mutually exclusive TAGS with the fast tags interface. | ||
| 85 | ;; - Bug fixes. | 102 | ;; - Bug fixes. |
| 86 | ;; | 103 | ;; |
| 87 | ;; Version 4.25 | 104 | ;; Version 4.35 |
| 88 | ;; - Revision of the font-lock faces section, with better tty support. | 105 | ;; - HTML export is now valid XHTML. |
| 89 | ;; - TODO keywords in Agenda buffer are fontified. | 106 | ;; - Timeline can also show dates without entries. See new option |
| 90 | ;; - Export converts links between .org files to links between .html files. | 107 | ;; `org-timeline-show-empty-dates'. |
| 91 | ;; - Better support for bold/italic/underline emphasis. | 108 | ;; - The bullets created by the ASCII exporter can now be configured. |
| 109 | ;; See the new option `org-export-ascii-bullets'. | ||
| 110 | ;; - New face `org-upcoming-deadline' (was `org-scheduled-previously'). | ||
| 111 | ;; - New function `org-context' to allow testing for local context. | ||
| 92 | ;; | 112 | ;; |
| 93 | ;; Version 4.24 | 113 | ;; Version 4.34 |
| 94 | ;; - Bug fixes. | 114 | ;; - Bug fixes. |
| 95 | ;; | 115 | ;; |
| 96 | ;; Version 4.23 | 116 | ;; Version 4.33 |
| 97 | ;; - Bug fixes. | 117 | ;; - New commands to move through plain lists: S-up and S-down. |
| 118 | ;; - Bug fixes and documentation update. | ||
| 98 | ;; | 119 | ;; |
| 99 | ;; Version 4.22 | 120 | ;; Version 4.32 |
| 121 | ;; - Fast (single-key-per-tag) interface for setting TAGS. | ||
| 122 | ;; - The list of legal tags can be configured globally and locally. | ||
| 123 | ;; - Elisp and Info links (thanks to Todd Neal). | ||
| 124 | ;; - `org-export-publishing-directory' can be an alist, with different | ||
| 125 | ;; directories for different export types. | ||
| 126 | ;; - All context-sensitive commands use `call-interactively' to dispatch. | ||
| 127 | ;; - `org-confirm-shell-links' renamed to `org-confirm-shell-link-function'. | ||
| 100 | ;; - Bug fixes. | 128 | ;; - Bug fixes. |
| 101 | ;; - In agenda buffer, mouse-1 no longer follows link. | ||
| 102 | ;; See `org-agenda-mouse-1-follows-link' and `org-mouse-1-follows-link'. | ||
| 103 | ;; | 129 | ;; |
| 104 | ;; Version 4.20 | 130 | ;; Version 4.31 |
| 105 | ;; - Links use now the [[link][description]] format by default. | ||
| 106 | ;; When inserting links, the user is prompted for a description. | ||
| 107 | ;; - If a link has a description, only the description is displayed | ||
| 108 | ;; the link part is hidden. Use C-c C-l to edit the link part. | ||
| 109 | ;; - TAGS are now bold, but in the same color as the headline. | ||
| 110 | ;; - The width of a table column can be limited by using a field "<N>". | ||
| 111 | ;; - New structure for the customization tree. | ||
| 112 | ;; - Bug fixes. | 131 | ;; - Bug fixes. |
| 113 | ;; | 132 | ;; |
| 114 | ;; Version 4.13 | 133 | ;; Version 4.30 |
| 115 | ;; - The list of agenda files can be maintainted in an external file. | 134 | ;; - Modified installation: Autoloads have been collected in org-install.el. |
| 135 | ;; - Logging (org-log-done) is now a #+STARTUP option. | ||
| 136 | ;; - Checkboxes in plain list items, following up on Frank Ruell's idea. | ||
| 137 | ;; - File links inserted with C-c C-l will use relative paths if the linked | ||
| 138 | ;; file is in the current directory or a subdirectory of it. | ||
| 139 | ;; - New variable `org-link-file-path-type' to specify preference for | ||
| 140 | ;; relative and absolute paths. | ||
| 141 | ;; - New CSS classes for tags, timestamps, timestamp keywords. | ||
| 142 | ;; - Bug and typo fixes. | ||
| 143 | ;; | ||
| 144 | ;; Version 4.29 | ||
| 145 | ;; - Inlining images in HTML export now depends on wheather the link | ||
| 146 | ;; contains a description or not. | ||
| 147 | ;; - TODO items can be scheduled from the global TODO list using C-c C-s. | ||
| 148 | ;; - TODO items already scheduled can be made to disappear from the global | ||
| 149 | ;; todo list, see `org-agenda-todo-ignore-scheduled'. | ||
| 150 | ;; - In Tables, formulas may also be Lisp forms. | ||
| 151 | ;; - Exporting the visible part of an outline with `C-c C-x v' works now | ||
| 152 | ;; for all available exporters. | ||
| 153 | ;; - Bug fixes, lots of them :-( | ||
| 154 | ;; | ||
| 155 | ;; Version 4.28 | ||
| 116 | ;; - Bug fixes. | 156 | ;; - Bug fixes. |
| 117 | ;; | 157 | ;; |
| 118 | ;; Version 4.12 | 158 | ;; Version 4.27 |
| 119 | ;; - Templates for remember buffer. Note that the remember setup changes. | 159 | ;; - HTML exporter generalized to receive external options. |
| 120 | ;; To set up templates, see `org-remember-templates'. | 160 | ;; As part of the process, author, email and date have been moved to the |
| 121 | ;; - The time in new time stamps can be rounded, see new option | 161 | ;; end of the HTML file. |
| 122 | ;; `org-time-stamp-rounding-minutes'. | 162 | ;; - Support for customizable file search in file links. |
| 123 | ;; - Bug fixes (there are *always* more bugs). | 163 | ;; - BibTeX database links as first application of the above. |
| 164 | ;; - New option `org-agenda-todo-list-sublevels' to turn off listing TODO | ||
| 165 | ;; entries that are sublevels of another TODO entry. | ||
| 166 | ;; | ||
| 124 | ;; | 167 | ;; |
| 125 | ;;; Code: | 168 | ;;; Code: |
| 126 | 169 | ||
| 127 | (eval-when-compile | 170 | (eval-when-compile |
| 128 | (require 'cl) | 171 | (require 'cl) |
| 129 | (require 'calendar)) | 172 | (require 'calendar)) |
| 130 | (require 'outline) | 173 | (require 'outline) |
| 131 | (require 'time-date) | 174 | (require 'time-date) |
| 132 | (require 'easymenu) | 175 | (require 'easymenu) |
| 133 | 176 | ||
| 134 | (defvar calc-embedded-close-formula) ; defined by the calc package | ||
| 135 | (defvar calc-embedded-open-formula) ; defined by the calc package | ||
| 136 | (defvar font-lock-unfontify-region-function) ; defined by font-lock.el | ||
| 137 | |||
| 138 | ;;; Customization variables | 177 | ;;; Customization variables |
| 139 | 178 | ||
| 140 | (defvar org-version "4.26" | 179 | (defvar org-version "4.36b" |
| 141 | "The version number of the file org.el.") | 180 | "The version number of the file org.el.") |
| 142 | (defun org-version () | 181 | (defun org-version () |
| 143 | (interactive) | 182 | (interactive) |
| @@ -298,6 +337,11 @@ Changes become only effective after restarting Emacs." | |||
| 298 | :group 'org-keywords | 337 | :group 'org-keywords |
| 299 | :type 'string) | 338 | :type 'string) |
| 300 | 339 | ||
| 340 | (defcustom org-clock-string "CLOCK:" | ||
| 341 | "String used as prefix for timestamps clocking work hours on an item." | ||
| 342 | :group 'org-keywords | ||
| 343 | :type 'string) | ||
| 344 | |||
| 301 | (defcustom org-comment-string "COMMENT" | 345 | (defcustom org-comment-string "COMMENT" |
| 302 | "Entries starting with this keyword will never be exported. | 346 | "Entries starting with this keyword will never be exported. |
| 303 | An entry can be toggled between COMMENT and normal with | 347 | An entry can be toggled between COMMENT and normal with |
| @@ -325,14 +369,30 @@ An entry can be toggled between QUOTE and normal with | |||
| 325 | :tag "Org Cycle" | 369 | :tag "Org Cycle" |
| 326 | :group 'org-structure) | 370 | :group 'org-structure) |
| 327 | 371 | ||
| 372 | (defcustom org-cycle-global-at-bob t | ||
| 373 | "Cycle globally if cursor is at beginning of buffer and not at a headline. | ||
| 374 | This makes it possible to do global cycling without having to use S-TAB or | ||
| 375 | C-u TAB. For this special case to work, the first line of the buffer | ||
| 376 | must not be a headline - it may be empty ot some other text. When used in | ||
| 377 | this way, `org-cycle-hook' is disables temporarily, to make sure the | ||
| 378 | cursor stays at the beginning of the buffer. | ||
| 379 | When this option is nil, don't do anything special at the beginning | ||
| 380 | of the buffer." | ||
| 381 | :group 'org-cycle | ||
| 382 | :type 'boolean) | ||
| 383 | |||
| 328 | (defcustom org-cycle-emulate-tab t | 384 | (defcustom org-cycle-emulate-tab t |
| 329 | "Where should `org-cycle' emulate TAB. | 385 | "Where should `org-cycle' emulate TAB. |
| 330 | nil Never | 386 | nil Never |
| 331 | white Only in completely white lines | 387 | white Only in completely white lines |
| 332 | t Everywhere except in headlines" | 388 | whitestart Only at the beginning of lines, before the first non-white char. |
| 389 | t Everywhere except in headlines | ||
| 390 | If TAB is used in a place where it does not emulate TAB, the current subtree | ||
| 391 | visibility is cycled." | ||
| 333 | :group 'org-cycle | 392 | :group 'org-cycle |
| 334 | :type '(choice (const :tag "Never" nil) | 393 | :type '(choice (const :tag "Never" nil) |
| 335 | (const :tag "Only in completely white lines" white) | 394 | (const :tag "Only in completely white lines" white) |
| 395 | (const :tag "Before first char in a line" whitestart) | ||
| 336 | (const :tag "Everywhere except in headlines" t) | 396 | (const :tag "Everywhere except in headlines" t) |
| 337 | )) | 397 | )) |
| 338 | 398 | ||
| @@ -376,6 +436,11 @@ body starts at column 0, indentation is not changed at all." | |||
| 376 | :group 'org-edit-structure | 436 | :group 'org-edit-structure |
| 377 | :type 'boolean) | 437 | :type 'boolean) |
| 378 | 438 | ||
| 439 | (defcustom org-insert-heading-hook nil | ||
| 440 | "Hook being run after inserting a new heading." | ||
| 441 | :group 'org-edit-structure | ||
| 442 | :type 'boolean) | ||
| 443 | |||
| 379 | (defcustom org-enable-fixed-width-editor t | 444 | (defcustom org-enable-fixed-width-editor t |
| 380 | "Non-nil means, lines starting with \":\" are treated as fixed-width. | 445 | "Non-nil means, lines starting with \":\" are treated as fixed-width. |
| 381 | This currently only means, they are never auto-wrapped. | 446 | This currently only means, they are never auto-wrapped. |
| @@ -756,6 +821,23 @@ additional URL: prefix, so the format would be \"<URL:%s>\"." | |||
| 756 | (const :tag "\"<URL:%s>\" (e.g. <URL:http://www.there.com>)" "<URL:%s>") | 821 | (const :tag "\"<URL:%s>\" (e.g. <URL:http://www.there.com>)" "<URL:%s>") |
| 757 | (string :tag "Other" :value "<%s>"))) | 822 | (string :tag "Other" :value "<%s>"))) |
| 758 | 823 | ||
| 824 | (defcustom org-link-file-path-type 'adaptive | ||
| 825 | "How the path name in file links should be stored. | ||
| 826 | Valid values are: | ||
| 827 | |||
| 828 | relative relative to the current directory, i.e. the directory of the file | ||
| 829 | into which the link is being inserted. | ||
| 830 | absolute absolute path, if possible with ~ for home directory. | ||
| 831 | noabbrev absolute path, no abbreviation of home directory. | ||
| 832 | adaptive Use relative path for files in the current directory and sub- | ||
| 833 | directories of it. For other files, use an absolute path." | ||
| 834 | :group 'org-link | ||
| 835 | :type '(choice | ||
| 836 | (const relative) | ||
| 837 | (const absolute) | ||
| 838 | (const noabbrev) | ||
| 839 | (const adaptive))) | ||
| 840 | |||
| 759 | (defcustom org-activate-links '(bracket angle plain radio tag date) | 841 | (defcustom org-activate-links '(bracket angle plain radio tag date) |
| 760 | "Types of links that should be activated in Org-mode files. | 842 | "Types of links that should be activated in Org-mode files. |
| 761 | This is a list of symbols, each leading to the activation of a certain link | 843 | This is a list of symbols, each leading to the activation of a certain link |
| @@ -898,15 +980,32 @@ When nil, an error will be generated." | |||
| 898 | :group 'org-link-follow | 980 | :group 'org-link-follow |
| 899 | :type 'boolean) | 981 | :type 'boolean) |
| 900 | 982 | ||
| 901 | (defcustom org-confirm-shell-links 'yes-or-no-p | 983 | (defcustom org-confirm-shell-link-function 'yes-or-no-p |
| 902 | "Non-nil means, ask for confirmation before executing shell links. | 984 | "Non-nil means, ask for confirmation before executing shell links. |
| 903 | Shell links can be dangerous, just thing about a link | 985 | Shell links can be dangerous, just thing about a link |
| 904 | 986 | ||
| 905 | [[shell:rm -rf ~/*][Google Search]] | 987 | [[shell:rm -rf ~/*][Google Search]] |
| 906 | 988 | ||
| 907 | This link would show up in your Org-mode document as \"Google Search\" | 989 | This link would show up in your Org-mode document as \"Google Search\" |
| 908 | but really it would remove your entire home directory. Dangerous indeed. | 990 | but really it would remove your entire home directory. |
| 909 | Therefore I *definitely* advise agains setting this varaiable to nil. | 991 | Therefore I *definitely* advise against setting this variable to nil. |
| 992 | Just change it to `y-or-n-p' of you want to confirm with a single key press | ||
| 993 | rather than having to type \"yes\"." | ||
| 994 | :group 'org-link-follow | ||
| 995 | :type '(choice | ||
| 996 | (const :tag "with yes-or-no (safer)" yes-or-no-p) | ||
| 997 | (const :tag "with y-or-n (faster)" y-or-n-p) | ||
| 998 | (const :tag "no confirmation (dangerous)" nil))) | ||
| 999 | |||
| 1000 | (defcustom org-confirm-elisp-link-function 'yes-or-no-p | ||
| 1001 | "Non-nil means, ask for confirmation before executing elisp links. | ||
| 1002 | Elisp links can be dangerous, just thing about a link | ||
| 1003 | |||
| 1004 | [[elisp:(shell-command \"rm -rf ~/*\")][Google Search]] | ||
| 1005 | |||
| 1006 | This link would show up in your Org-mode document as \"Google Search\" | ||
| 1007 | but really it would remove your entire home directory. | ||
| 1008 | Therefore I *definitely* advise against setting this variable to nil. | ||
| 910 | Just change it to `y-or-n-p' of you want to confirm with a single key press | 1009 | Just change it to `y-or-n-p' of you want to confirm with a single key press |
| 911 | rather than having to type \"yes\"." | 1010 | rather than having to type \"yes\"." |
| 912 | :group 'org-link-follow | 1011 | :group 'org-link-follow |
| @@ -934,7 +1033,11 @@ for some files for which the OS does not have a good default. | |||
| 934 | See `org-file-apps'.") | 1033 | See `org-file-apps'.") |
| 935 | 1034 | ||
| 936 | (defconst org-file-apps-defaults-windowsnt | 1035 | (defconst org-file-apps-defaults-windowsnt |
| 937 | '((t . (w32-shell-execute "open" file))) | 1036 | (list (cons t |
| 1037 | (list (if (featurep 'xemacs) | ||
| 1038 | 'mswindows-shell-execute | ||
| 1039 | 'w32-shell-execute) | ||
| 1040 | "open" 'file))) | ||
| 938 | "Default file applications on a Windows NT system. | 1041 | "Default file applications on a Windows NT system. |
| 939 | The system \"open\" is used for most files. | 1042 | The system \"open\" is used for most files. |
| 940 | See `org-file-apps'.") | 1043 | See `org-file-apps'.") |
| @@ -946,18 +1049,25 @@ See `org-file-apps'.") | |||
| 946 | ("ltx" . emacs) | 1049 | ("ltx" . emacs) |
| 947 | ("org" . emacs) | 1050 | ("org" . emacs) |
| 948 | ("el" . emacs) | 1051 | ("el" . emacs) |
| 1052 | ("bib" . emacs) | ||
| 949 | ) | 1053 | ) |
| 950 | "External applications for opening `file:path' items in a document. | 1054 | "External applications for opening `file:path' items in a document. |
| 951 | Org-mode uses system defaults for different file types, but | 1055 | Org-mode uses system defaults for different file types, but |
| 952 | you can use this variable to set the application for a given file | 1056 | you can use this variable to set the application for a given file |
| 953 | extension. The entries in this list are cons cells with a file extension | 1057 | extension. The entries in this list are cons cells where the car identifies |
| 954 | and the corresponding command. Possible values for the command are: | 1058 | files and the cdr the corresponding command. Possible values for the |
| 955 | `emacs' The file will be visited by the current Emacs process. | 1059 | file identifier are |
| 956 | `default' Use the default application for this file type. | 1060 | \"ext\" A string identifying an extension |
| 957 | string A command to be executed by a shell; %s will be replaced | 1061 | `directory' Matches a directory |
| 958 | by the path to the file. | 1062 | t Default for all remaining files |
| 959 | sexp A Lisp form which will be evaluated. The file path will | 1063 | |
| 960 | be available in the Lisp variable `file'. | 1064 | Possible values for the command are: |
| 1065 | `emacs' The file will be visited by the current Emacs process. | ||
| 1066 | `default' Use the default application for this file type. | ||
| 1067 | string A command to be executed by a shell; %s will be replaced | ||
| 1068 | by the path to the file. | ||
| 1069 | sexp A Lisp form which will be evaluated. The file path will | ||
| 1070 | be available in the Lisp variable `file'. | ||
| 961 | For more examples, see the system specific constants | 1071 | For more examples, see the system specific constants |
| 962 | `org-file-apps-defaults-macosx' | 1072 | `org-file-apps-defaults-macosx' |
| 963 | `org-file-apps-defaults-windowsnt' | 1073 | `org-file-apps-defaults-windowsnt' |
| @@ -1085,7 +1195,12 @@ Lisp variable `state'." | |||
| 1085 | (defcustom org-log-done nil | 1195 | (defcustom org-log-done nil |
| 1086 | "When set, insert a (non-active) time stamp when TODO entry is marked DONE. | 1196 | "When set, insert a (non-active) time stamp when TODO entry is marked DONE. |
| 1087 | When the state of an entry is changed from nothing to TODO, remove a previous | 1197 | When the state of an entry is changed from nothing to TODO, remove a previous |
| 1088 | closing date." | 1198 | closing date. |
| 1199 | This can also be configured on a per-file basis by adding one of | ||
| 1200 | the following lines anywhere in the buffer: | ||
| 1201 | |||
| 1202 | #+STARTUP: logging | ||
| 1203 | #+STARTUP: nologging" | ||
| 1089 | :group 'org-todo | 1204 | :group 'org-todo |
| 1090 | :type 'boolean) | 1205 | :type 'boolean) |
| 1091 | 1206 | ||
| @@ -1110,6 +1225,14 @@ This is the priority an item get if no explicit priority is given." | |||
| 1110 | :tag "Org Time" | 1225 | :tag "Org Time" |
| 1111 | :group 'org) | 1226 | :group 'org) |
| 1112 | 1227 | ||
| 1228 | (defcustom org-insert-labeled-timestamps-at-point nil | ||
| 1229 | "Non-nil means, SCHEDULED and DEADLINE timestamps are inserted at point. | ||
| 1230 | When nil, these labeled time stamps are forces into the second line of an | ||
| 1231 | entry, just after the headline. When scheduling from the global TODO list, | ||
| 1232 | the time stamp will always be forced into the second line." | ||
| 1233 | :group 'org-time | ||
| 1234 | :type 'boolean) | ||
| 1235 | |||
| 1113 | (defconst org-time-stamp-formats '("<%Y-%m-%d %a>" . "<%Y-%m-%d %a %H:%M>") | 1236 | (defconst org-time-stamp-formats '("<%Y-%m-%d %a>" . "<%Y-%m-%d %a %H:%M>") |
| 1114 | "Formats for `format-time-string' which are used for time stamps. | 1237 | "Formats for `format-time-string' which are used for time stamps. |
| 1115 | It is not recommended to change this constant.") | 1238 | It is not recommended to change this constant.") |
| @@ -1149,6 +1272,36 @@ moved to the new date." | |||
| 1149 | :tag "Org Tags" | 1272 | :tag "Org Tags" |
| 1150 | :group 'org) | 1273 | :group 'org) |
| 1151 | 1274 | ||
| 1275 | (defcustom org-tag-alist nil | ||
| 1276 | "List of tags allowed in Org-mode files. | ||
| 1277 | When this list is nil, Org-mode will base TAG input on what is already in the | ||
| 1278 | buffer. | ||
| 1279 | The value of this variable is an alist, the car may be (and should) be a | ||
| 1280 | character that is used to select that tag through the fast-tag-selection | ||
| 1281 | interface. See the manual for details." | ||
| 1282 | :group 'org-tags | ||
| 1283 | :type '(repeat | ||
| 1284 | (choice | ||
| 1285 | (cons (string :tag "Tag name") | ||
| 1286 | (character :tag "Access char")) | ||
| 1287 | (const :tag "Start radio group" (:startgroup)) | ||
| 1288 | (const :tag "End radio group" (:endgroup))))) | ||
| 1289 | |||
| 1290 | (defcustom org-use-fast-tag-selection 'auto | ||
| 1291 | "Non-nil means, use fast tag selection scheme. | ||
| 1292 | This is a special interface to select and deselect tags with single keys. | ||
| 1293 | When nil, fast selection is never used. | ||
| 1294 | When the symbol `auto', fast selection is used if and only if selection | ||
| 1295 | characters for tags have been configured, either through the variable | ||
| 1296 | `org-tag-alist' or through a #+TAGS line in the buffer. | ||
| 1297 | When t, fast selection is always used and selection keys are assigned | ||
| 1298 | automatically if necessary." | ||
| 1299 | :group 'org-tags | ||
| 1300 | :type '(choice | ||
| 1301 | (const :tag "Always" t) | ||
| 1302 | (const :tag "Never" nil) | ||
| 1303 | (const :tag "When selection characters are configured" 'auto))) | ||
| 1304 | |||
| 1152 | (defcustom org-tags-column 48 | 1305 | (defcustom org-tags-column 48 |
| 1153 | "The column to which tags should be indented in a headline. | 1306 | "The column to which tags should be indented in a headline. |
| 1154 | If this number is positive, it specifies the column. If it is negative, | 1307 | If this number is positive, it specifies the column. If it is negative, |
| @@ -1234,6 +1387,7 @@ key The key (a single char as a string) to be associated with the command. | |||
| 1234 | type The command type, any of the following symbols: | 1387 | type The command type, any of the following symbols: |
| 1235 | todo Entries with a specific TODO keyword, in all agenda files. | 1388 | todo Entries with a specific TODO keyword, in all agenda files. |
| 1236 | tags Tags match in all agenda files. | 1389 | tags Tags match in all agenda files. |
| 1390 | tags-todo Tags match in all agenda files, TODO entries only. | ||
| 1237 | todo-tree Sparse tree of specific TODO keyword in *current* file. | 1391 | todo-tree Sparse tree of specific TODO keyword in *current* file. |
| 1238 | tags-tree Sparse tree with all tags matches in *current* file. | 1392 | tags-tree Sparse tree with all tags matches in *current* file. |
| 1239 | occur-tree Occur sparse tree for current file. | 1393 | occur-tree Occur sparse tree for current file. |
| @@ -1246,13 +1400,30 @@ match What to search for: | |||
| 1246 | (list (string :tag "Key") | 1400 | (list (string :tag "Key") |
| 1247 | (choice :tag "Type" | 1401 | (choice :tag "Type" |
| 1248 | (const :tag "Tags search in all agenda files" tags) | 1402 | (const :tag "Tags search in all agenda files" tags) |
| 1403 | (const :tag "Tags search of TODO entries, all agenda files" tags-todo) | ||
| 1249 | (const :tag "TODO keyword search in all agenda files" todo) | 1404 | (const :tag "TODO keyword search in all agenda files" todo) |
| 1250 | (const :tag "Tags sparse tree in current buffer" tags-tree) | 1405 | (const :tag "Tags sparse tree in current buffer" tags-tree) |
| 1251 | (const :tag "TODO keyword tree in current buffer" todo-tree) | 1406 | (const :tag "TODO keyword tree in current buffer" todo-tree) |
| 1252 | (const :tag "Occur tree in current buffer" occur-tree)) | 1407 | (const :tag "Occur tree in current buffer" occur-tree)) |
| 1253 | (string :tag "Match")))) | 1408 | (string :tag "Match")))) |
| 1254 | 1409 | ||
| 1255 | (defcustom org-agenda-include-all-todo t | 1410 | (defcustom org-agenda-todo-list-sublevels t |
| 1411 | "Non-nil means, check also the sublevels of a TODO entry for TODO entries. | ||
| 1412 | When nil, the sublevels of a TODO entry are not checked, resulting in | ||
| 1413 | potentially much shorter TODO lists." | ||
| 1414 | :group 'org-agenda | ||
| 1415 | :group 'org-todo | ||
| 1416 | :type 'boolean) | ||
| 1417 | |||
| 1418 | (defcustom org-agenda-todo-ignore-scheduled nil | ||
| 1419 | "Non-nil means, don't show scheduled entries in the global todo list. | ||
| 1420 | The idea behind this is that by scheduling it, you have already taken care | ||
| 1421 | of this item." | ||
| 1422 | :group 'org-agenda | ||
| 1423 | :group 'org-todo | ||
| 1424 | :type 'boolean) | ||
| 1425 | |||
| 1426 | (defcustom org-agenda-include-all-todo nil | ||
| 1256 | "Non-nil means, the agenda will always contain all TODO entries. | 1427 | "Non-nil means, the agenda will always contain all TODO entries. |
| 1257 | When nil, date-less entries will only be shown if `org-agenda' is called | 1428 | When nil, date-less entries will only be shown if `org-agenda' is called |
| 1258 | with a prefix argument. | 1429 | with a prefix argument. |
| @@ -1274,7 +1445,7 @@ forth between agenda and calendar." | |||
| 1274 | :group 'org-agenda | 1445 | :group 'org-agenda |
| 1275 | :type 'sexp) | 1446 | :type 'sexp) |
| 1276 | 1447 | ||
| 1277 | (defgroup org-agenda-window-setup nil | 1448 | (defgroup org-agenda-setup nil |
| 1278 | "Options concerning setting up the Agenda window in Org Mode." | 1449 | "Options concerning setting up the Agenda window in Org Mode." |
| 1279 | :tag "Org Agenda Window Setup" | 1450 | :tag "Org Agenda Window Setup" |
| 1280 | :group 'org-agenda) | 1451 | :group 'org-agenda) |
| @@ -1286,9 +1457,8 @@ Needs to be set before org.el is loaded." | |||
| 1286 | :group 'org-agenda-setup | 1457 | :group 'org-agenda-setup |
| 1287 | :type 'boolean) | 1458 | :type 'boolean) |
| 1288 | 1459 | ||
| 1289 | (defcustom org-select-timeline-window t | 1460 | (defcustom org-agenda-start-with-follow-mode nil |
| 1290 | "Non-nil means, after creating a timeline, move cursor into Timeline window. | 1461 | "The initial value of follwo-mode in a newly created agenda window." |
| 1291 | When nil, cursor will remain in the current window." | ||
| 1292 | :group 'org-agenda-setup | 1462 | :group 'org-agenda-setup |
| 1293 | :type 'boolean) | 1463 | :type 'boolean) |
| 1294 | 1464 | ||
| @@ -1411,7 +1581,7 @@ categories by priority." | |||
| 1411 | (defcustom org-sort-agenda-notime-is-late t | 1581 | (defcustom org-sort-agenda-notime-is-late t |
| 1412 | "Non-nil means, items without time are considered late. | 1582 | "Non-nil means, items without time are considered late. |
| 1413 | This is only relevant for sorting. When t, items which have no explicit | 1583 | This is only relevant for sorting. When t, items which have no explicit |
| 1414 | time like 15:30 will be considered as 24:01, i.e. later than any items which | 1584 | time like 15:30 will be considered as 99:01, i.e. later than any items which |
| 1415 | do have a time. When nil, the default time is before 0:00. You can use this | 1585 | do have a time. When nil, the default time is before 0:00. You can use this |
| 1416 | option to decide if the schedule for today should come before or after timeless | 1586 | option to decide if the schedule for today should come before or after timeless |
| 1417 | agenda entries." | 1587 | agenda entries." |
| @@ -1472,17 +1642,11 @@ See also the variables `org-agenda-remove-times-when-in-prefix' and | |||
| 1472 | :type 'string | 1642 | :type 'string |
| 1473 | :group 'org-agenda-prefix) | 1643 | :group 'org-agenda-prefix) |
| 1474 | 1644 | ||
| 1475 | (defcustom org-timeline-prefix-format " % s" | ||
| 1476 | "Like `org-agenda-prefix-format', but for the timeline of a single file." | ||
| 1477 | :type 'string | ||
| 1478 | :group 'org-agenda-prefix) | ||
| 1479 | |||
| 1480 | (defvar org-prefix-format-compiled nil | 1645 | (defvar org-prefix-format-compiled nil |
| 1481 | "The compiled version of the most recently used prefix format. | 1646 | "The compiled version of the most recently used prefix format. |
| 1482 | Depending on which command was used last, this may be the compiled version | 1647 | Depending on which command was used last, this may be the compiled version |
| 1483 | of `org-agenda-prefix-format' or `org-timeline-prefix-format'.") | 1648 | of `org-agenda-prefix-format' or `org-timeline-prefix-format'.") |
| 1484 | 1649 | ||
| 1485 | ;; FIXME: There seem to be situations where this does no work. | ||
| 1486 | (defcustom org-agenda-remove-times-when-in-prefix t | 1650 | (defcustom org-agenda-remove-times-when-in-prefix t |
| 1487 | "Non-nil means, remove duplicate time specifications in agenda items. | 1651 | "Non-nil means, remove duplicate time specifications in agenda items. |
| 1488 | When the format `org-agenda-prefix-format' contains a `%t' specifier, a | 1652 | When the format `org-agenda-prefix-format' contains a `%t' specifier, a |
| @@ -1510,6 +1674,34 @@ When this is the symbol `prefix', only remove tags when | |||
| 1510 | (const :tag "Never" nil) | 1674 | (const :tag "Never" nil) |
| 1511 | (const :tag "When prefix format contains %T" prefix))) | 1675 | (const :tag "When prefix format contains %T" prefix))) |
| 1512 | 1676 | ||
| 1677 | (defgroup org-agenda-timeline nil | ||
| 1678 | "Options concerning the timeline buffer in Org Mode." | ||
| 1679 | :tag "Org Agenda Timeline" | ||
| 1680 | :group 'org-agenda) | ||
| 1681 | |||
| 1682 | (defcustom org-timeline-prefix-format " % s" | ||
| 1683 | "Like `org-agenda-prefix-format', but for the timeline of a single file." | ||
| 1684 | :type 'string | ||
| 1685 | :group 'org-agenda-timeline) | ||
| 1686 | |||
| 1687 | (defcustom org-select-timeline-window t | ||
| 1688 | "Non-nil means, after creating a timeline, move cursor into Timeline window. | ||
| 1689 | When nil, cursor will remain in the current window." | ||
| 1690 | :group 'org-agenda-timeline | ||
| 1691 | :type 'boolean) | ||
| 1692 | |||
| 1693 | (defcustom org-timeline-show-empty-dates 3 | ||
| 1694 | "Non-nil means, `org-timeline' also shows dates without an entry. | ||
| 1695 | When nil, only the days which actually have entries are shown. | ||
| 1696 | When t, all days between the first and the last date are shown. | ||
| 1697 | When an integer, show also empty dates, but if there is a gap of more than | ||
| 1698 | N days, just insert a special line indicating the size of the gap." | ||
| 1699 | :group 'org-agenda-timeline | ||
| 1700 | :type '(choice | ||
| 1701 | (const :tag "None" nil) | ||
| 1702 | (const :tag "All" t) | ||
| 1703 | (number :tag "at most"))) | ||
| 1704 | |||
| 1513 | (defgroup org-export nil | 1705 | (defgroup org-export nil |
| 1514 | "Options for exporting org-listings." | 1706 | "Options for exporting org-listings." |
| 1515 | :tag "Org Export" | 1707 | :tag "Org Export" |
| @@ -1520,6 +1712,23 @@ When this is the symbol `prefix', only remove tags when | |||
| 1520 | :tag "Org Export General" | 1712 | :tag "Org Export General" |
| 1521 | :group 'org-export) | 1713 | :group 'org-export) |
| 1522 | 1714 | ||
| 1715 | (defcustom org-export-publishing-directory "." | ||
| 1716 | "Path to the location where exported files should be located. | ||
| 1717 | This path may be relative to the directory where the Org-mode file lives. | ||
| 1718 | The default is to put them into the same directory as the Org-mode file. | ||
| 1719 | The variable may also be an alist with export types `:html', `:ascii', | ||
| 1720 | `:ical', or `:xoxo' and the corresponding directories. If a direcoty path | ||
| 1721 | is relative, it is interpreted relative to the directory where the exported | ||
| 1722 | Org-mode files lives." | ||
| 1723 | :group 'org-export-general | ||
| 1724 | :type '(choice | ||
| 1725 | (directory) | ||
| 1726 | (repeat | ||
| 1727 | (cons | ||
| 1728 | (choice :tag "Type" | ||
| 1729 | (const :html) (const :ascii) (const :ical) (const :xoxo)) | ||
| 1730 | (directory))))) | ||
| 1731 | |||
| 1523 | (defcustom org-export-language-setup | 1732 | (defcustom org-export-language-setup |
| 1524 | '(("en" "Author" "Date" "Table of Contents") | 1733 | '(("en" "Author" "Date" "Table of Contents") |
| 1525 | ("da" "Ophavsmand" "Dato" "Indhold") | 1734 | ("da" "Ophavsmand" "Dato" "Indhold") |
| @@ -1591,6 +1800,21 @@ This option can also be set with the +OPTIONS line, e.g. \"\\n:t\"." | |||
| 1591 | :group 'org-export-general | 1800 | :group 'org-export-general |
| 1592 | :type 'boolean) | 1801 | :type 'boolean) |
| 1593 | 1802 | ||
| 1803 | (defcustom org-export-with-timestamps t | ||
| 1804 | "Nil means, do not export time stamps and associated keywords." | ||
| 1805 | :group 'org-export | ||
| 1806 | :type 'boolean) | ||
| 1807 | |||
| 1808 | (defcustom org-export-with-tags t | ||
| 1809 | "Nil means, do not export tags, just remove them from headlines." | ||
| 1810 | :group 'org-export-general | ||
| 1811 | :type 'boolean) | ||
| 1812 | |||
| 1813 | (defcustom org-export-with-timestamps t | ||
| 1814 | "Nil means, do not export timestamps and associated keywords." | ||
| 1815 | :group 'org-export-general | ||
| 1816 | :type 'boolean) | ||
| 1817 | |||
| 1594 | (defgroup org-export-translation nil | 1818 | (defgroup org-export-translation nil |
| 1595 | "Options for translating special ascii sequences for the export backends." | 1819 | "Options for translating special ascii sequences for the export backends." |
| 1596 | :tag "Org Export Translation" | 1820 | :tag "Org Export Translation" |
| @@ -1714,6 +1938,22 @@ much faster." | |||
| 1714 | :tag "Org Export ASCII" | 1938 | :tag "Org Export ASCII" |
| 1715 | :group 'org-export) | 1939 | :group 'org-export) |
| 1716 | 1940 | ||
| 1941 | (defcustom org-export-ascii-underline '(?\$ ?\# ?^ ?\~ ?\= ?\-) | ||
| 1942 | "Characters for underlining headings in ASCII export. | ||
| 1943 | In the given sequence, these characters will be used for level 1, 2, ..." | ||
| 1944 | :group 'org-export-ascii | ||
| 1945 | :type '(repeat character)) | ||
| 1946 | |||
| 1947 | (defcustom org-export-ascii-bullets '(?* ?+ ?-) | ||
| 1948 | "Bullet characters for headlines converted to lists in ASCII export. | ||
| 1949 | The first character is is used for the first lest level generated in this | ||
| 1950 | way, and so on. If there are more levels than characters given here, | ||
| 1951 | the list will be repeated. | ||
| 1952 | Note that plain lists will keep the same bullets as the have in the | ||
| 1953 | Org-mode file." | ||
| 1954 | :group 'org-export-ascii | ||
| 1955 | :type '(repeat character)) | ||
| 1956 | |||
| 1717 | (defcustom org-export-ascii-show-new-buffer t | 1957 | (defcustom org-export-ascii-show-new-buffer t |
| 1718 | "Non-nil means, popup buffer containing the exported ASCII text. | 1958 | "Non-nil means, popup buffer containing the exported ASCII text. |
| 1719 | Otherwise the buffer will just be saved to a file and stay hidden." | 1959 | Otherwise the buffer will just be saved to a file and stay hidden." |
| @@ -1725,14 +1965,6 @@ Otherwise the buffer will just be saved to a file and stay hidden." | |||
| 1725 | :tag "Org Export XML" | 1965 | :tag "Org Export XML" |
| 1726 | :group 'org-export) | 1966 | :group 'org-export) |
| 1727 | 1967 | ||
| 1728 | (defcustom org-export-xml-type 'xoxo ;kw, if we have only one. | ||
| 1729 | "The kind of XML to be produced by the XML exporter. | ||
| 1730 | Allowed values are: | ||
| 1731 | xoxo The XOXO exporter." | ||
| 1732 | :group 'org-export-xml | ||
| 1733 | :type '(choice | ||
| 1734 | (const :tag "XOXO" xoxo))) | ||
| 1735 | |||
| 1736 | (defgroup org-export-html nil | 1968 | (defgroup org-export-html nil |
| 1737 | "Options specific for HTML export of Org-mode files." | 1969 | "Options specific for HTML export of Org-mode files." |
| 1738 | :tag "Org Export HTML" | 1970 | :tag "Org Export HTML" |
| @@ -1745,8 +1977,11 @@ xoxo The XOXO exporter." | |||
| 1745 | font-size: 12pt; | 1977 | font-size: 12pt; |
| 1746 | } | 1978 | } |
| 1747 | .title { text-align: center; } | 1979 | .title { text-align: center; } |
| 1748 | .todo, .deadline { color: red; } | 1980 | .todo { color: red; } |
| 1749 | .done { color: green; } | 1981 | .done { color: green; } |
| 1982 | .timestamp { color: grey } | ||
| 1983 | .timestamp-kwd { color: CadetBlue } | ||
| 1984 | .tag { background-color:lightblue; font-weight:normal } | ||
| 1750 | .target { background-color: lavender; } | 1985 | .target { background-color: lavender; } |
| 1751 | pre { | 1986 | pre { |
| 1752 | border: 1pt solid #AEBDCC; | 1987 | border: 1pt solid #AEBDCC; |
| @@ -1796,13 +2031,16 @@ When nil, the links still point to the plain `.org' file." | |||
| 1796 | :group 'org-export-html | 2031 | :group 'org-export-html |
| 1797 | :type 'boolean) | 2032 | :type 'boolean) |
| 1798 | 2033 | ||
| 1799 | (defcustom org-export-html-inline-images t | 2034 | (defcustom org-export-html-inline-images 'maybe |
| 1800 | "Non-nil means, inline images into exported HTML pages. | 2035 | "Non-nil means, inline images into exported HTML pages. |
| 1801 | The link will still be to the original location of the image file. | 2036 | This is done using an <img> tag. When nil, an anchor with href is used to |
| 1802 | So if you are moving the page, lets say to your public HTML site, | 2037 | link to the image. If this option is `maybe', then images in links with |
| 1803 | you will have to move the image and maybe change the link." | 2038 | an empty description will be inlined, while images with a description will |
| 2039 | be linked only." | ||
| 1804 | :group 'org-export-html | 2040 | :group 'org-export-html |
| 1805 | :type 'boolean) | 2041 | :type '(choice (const :tag "Never" nil) |
| 2042 | (const :tag "Always" t) | ||
| 2043 | (const :tag "When there is no description" maybe))) | ||
| 1806 | 2044 | ||
| 1807 | (defcustom org-export-html-expand t | 2045 | (defcustom org-export-html-expand t |
| 1808 | "Non-nil means, for HTML export, treat @<...> as HTML tag. | 2046 | "Non-nil means, for HTML export, treat @<...> as HTML tag. |
| @@ -1814,7 +2052,7 @@ This option can also be set with the +OPTIONS line, e.g. \"@:nil\"." | |||
| 1814 | :type 'boolean) | 2052 | :type 'boolean) |
| 1815 | 2053 | ||
| 1816 | (defcustom org-export-html-table-tag | 2054 | (defcustom org-export-html-table-tag |
| 1817 | "<table border=1 cellspacing=0 cellpadding=6>" | 2055 | "<table border=\"1\" cellspacing=\"0\" cellpadding=\"6\">" |
| 1818 | "The HTML tag used to start a table. | 2056 | "The HTML tag used to start a table. |
| 1819 | This must be a <table> tag, but you may change the options like | 2057 | This must be a <table> tag, but you may change the options like |
| 1820 | borders and spacing." | 2058 | borders and spacing." |
| @@ -1829,7 +2067,7 @@ to a file." | |||
| 1829 | :type 'boolean) | 2067 | :type 'boolean) |
| 1830 | 2068 | ||
| 1831 | (defcustom org-export-html-html-helper-timestamp | 2069 | (defcustom org-export-html-html-helper-timestamp |
| 1832 | "<br><br><hr><p><!-- hhmts start --> <!-- hhmts end -->\n" | 2070 | "<br/><br/><hr><p><!-- hhmts start --> <!-- hhmts end --></p>\n" |
| 1833 | "The HTML tag used as timestamp delimiter for HTML-helper-mode." | 2071 | "The HTML tag used as timestamp delimiter for HTML-helper-mode." |
| 1834 | :group 'org-export-html | 2072 | :group 'org-export-html |
| 1835 | :type 'string) | 2073 | :type 'string) |
| @@ -1847,7 +2085,8 @@ Otherwise, the buffer will just be saved to a file and stay hidden." | |||
| 1847 | 2085 | ||
| 1848 | (defcustom org-combined-agenda-icalendar-file "~/org.ics" | 2086 | (defcustom org-combined-agenda-icalendar-file "~/org.ics" |
| 1849 | "The file name for the iCalendar file covering all agenda files. | 2087 | "The file name for the iCalendar file covering all agenda files. |
| 1850 | This file is created with the command \\[org-export-icalendar-all-agenda-files]." | 2088 | This file is created with the command \\[org-export-icalendar-all-agenda-files]. |
| 2089 | The file name should be absolute." | ||
| 1851 | :group 'org-export-icalendar | 2090 | :group 'org-export-icalendar |
| 1852 | :type 'file) | 2091 | :type 'file) |
| 1853 | 2092 | ||
| @@ -1904,6 +2143,95 @@ Changing this variable requires a restart of Emacs to take effect." | |||
| 1904 | :group 'org-font-lock | 2143 | :group 'org-font-lock |
| 1905 | :type 'boolean) | 2144 | :type 'boolean) |
| 1906 | 2145 | ||
| 2146 | (defvar org-emph-re nil | ||
| 2147 | "Regular expression for matching emphasis.") | ||
| 2148 | (defvar org-emphasis-regexp-components) ; defined just below | ||
| 2149 | (defvar org-emphasis-alist) ; defined just below | ||
| 2150 | (defun org-set-emph-re (var val) | ||
| 2151 | "Set variable and compute the emphasis regular expression." | ||
| 2152 | (set var val) | ||
| 2153 | (when (and (boundp 'org-emphasis-alist) | ||
| 2154 | (boundp 'org-emphasis-regexp-components) | ||
| 2155 | org-emphasis-alist org-emphasis-regexp-components) | ||
| 2156 | (let* ((e org-emphasis-regexp-components) | ||
| 2157 | (pre (car e)) | ||
| 2158 | (post (nth 1 e)) | ||
| 2159 | (border (nth 2 e)) | ||
| 2160 | (body (nth 3 e)) | ||
| 2161 | (nl (nth 4 e)) | ||
| 2162 | (stacked (nth 5 e)) | ||
| 2163 | (body1 (concat body "*?")) | ||
| 2164 | (markers (mapconcat 'car org-emphasis-alist ""))) | ||
| 2165 | ;; make sure special characters appear at the right position in the class | ||
| 2166 | (if (string-match "\\^" markers) | ||
| 2167 | (setq markers (concat (replace-match "" t t markers) "^"))) | ||
| 2168 | (if (string-match "-" markers) | ||
| 2169 | (setq markers (concat (replace-match "" t t markers) "-"))) | ||
| 2170 | (while (>= (setq nl (1- nl)) 0) (setq body1 (concat body1 "\n?" body "*?"))) | ||
| 2171 | ;; Make the regexp | ||
| 2172 | (setq org-emph-re | ||
| 2173 | (concat "\\([" pre (if stacked markers) "]\\|^\\)" | ||
| 2174 | "\\(" | ||
| 2175 | "\\([" markers "]\\)" | ||
| 2176 | "\\(" | ||
| 2177 | "[^" border markers "]" | ||
| 2178 | body1 | ||
| 2179 | "[^" border markers "]" | ||
| 2180 | "\\)" | ||
| 2181 | "\\3\\)" | ||
| 2182 | "\\([" post (if stacked markers) "]\\|$\\)"))))) | ||
| 2183 | |||
| 2184 | (defcustom org-emphasis-regexp-components | ||
| 2185 | '(" \t(" " \t.,?;:'\")" " \t\r\n,." "." 1 nil) | ||
| 2186 | "Components used to build the reqular expression for emphasis. | ||
| 2187 | This is a list with 6 entries. Terminology: In an emphasis string | ||
| 2188 | like \" *strong word* \", we call the initial space PREMATCH, the final | ||
| 2189 | space POSTMATCH, the stars MARKERS, \"s\" and \"d\" are BORDER characters | ||
| 2190 | and \"trong wor\" is the body. The different components in this variable | ||
| 2191 | specify what is allowed/forbidden in each part: | ||
| 2192 | |||
| 2193 | pre Chars allowed as prematch. Beginning of line will be allowed too. | ||
| 2194 | post Chars allowed as postmatch. End of line will be allowed too. | ||
| 2195 | border The chars *forbidden* as border characters. In addition to the | ||
| 2196 | characters given here, all marker characters are forbidden too. | ||
| 2197 | body-regexp A regexp like \".\" to match a body character. Don't use | ||
| 2198 | non-shy groups here, and don't allow newline here. | ||
| 2199 | newline The maximum number of newlines allowed in an emphasis exp. | ||
| 2200 | stacked Non-nil means, allow stacked styles. This works only in HTML | ||
| 2201 | export. When this is set, all marker characters (as given in | ||
| 2202 | `org-emphasis-alist') will be allowed as pre/post, aiding | ||
| 2203 | inside-out matching. | ||
| 2204 | Use customize to modify this, or restart emacs after changing it." | ||
| 2205 | :group 'org-fixme | ||
| 2206 | :set 'org-set-emph-re | ||
| 2207 | :type '(list | ||
| 2208 | (sexp :tag "Allowed chars in pre ") | ||
| 2209 | (sexp :tag "Allowed chars in post ") | ||
| 2210 | (sexp :tag "Forbidden chars in border ") | ||
| 2211 | (sexp :tag "Regexp for body ") | ||
| 2212 | (integer :tag "number of newlines allowed") | ||
| 2213 | (boolean :tag "Stacking allowed "))) | ||
| 2214 | |||
| 2215 | (defcustom org-emphasis-alist | ||
| 2216 | '(("*" bold "<b>" "</b>") | ||
| 2217 | ("/" italic "<i>" "</i>") | ||
| 2218 | ("_" underline "<u>" "</u>") | ||
| 2219 | ("=" shadow "<code>" "</code>")) | ||
| 2220 | "Special syntax for emphasised text. | ||
| 2221 | Text starting and ending with a special character will be emphasized, for | ||
| 2222 | example *bold*, _underlined_ and /italic/. This variable sets the marker | ||
| 2223 | characters, the face to bbe used by font-lock for highlighting in Org-mode | ||
| 2224 | emacs buffers, and the HTML tags to be used for this. | ||
| 2225 | Use customize to modify this, or restart emacs after changing it." | ||
| 2226 | :group 'org-fixme | ||
| 2227 | :set 'org-set-emph-re | ||
| 2228 | :type '(repeat | ||
| 2229 | (list | ||
| 2230 | (string :tag "Marker character") | ||
| 2231 | (face :tag "Font-lock-face") | ||
| 2232 | (string :tag "HTML start tag") | ||
| 2233 | (string :tag "HTML end tag")))) | ||
| 2234 | |||
| 1907 | (defgroup org-faces nil | 2235 | (defgroup org-faces nil |
| 1908 | "Faces in Org-mode." | 2236 | "Faces in Org-mode." |
| 1909 | :tag "Org Faces" | 2237 | :tag "Org Faces" |
| @@ -2003,7 +2331,7 @@ color of the frame." | |||
| 2003 | (org-compatible-face | 2331 | (org-compatible-face |
| 2004 | '((((class color) (min-colors 16) (background light)) (:foreground "Orchid")) | 2332 | '((((class color) (min-colors 16) (background light)) (:foreground "Orchid")) |
| 2005 | (((class color) (min-colors 16) (background dark)) (:foreground "LightSteelBlue")) | 2333 | (((class color) (min-colors 16) (background dark)) (:foreground "LightSteelBlue")) |
| 2006 | (((class color) (min-colors 8)) (:foreground "blue")))) ;; FIXME: for dark bg? | 2334 | (((class color) (min-colors 8)) (:foreground "blue")))) |
| 2007 | "Face used for level 7 headlines." | 2335 | "Face used for level 7 headlines." |
| 2008 | :group 'org-faces) | 2336 | :group 'org-faces) |
| 2009 | 2337 | ||
| @@ -2120,11 +2448,21 @@ This face is only used if `org-fontify-done-headline' is set." | |||
| 2120 | "Face for items scheduled previously, and not yet done." | 2448 | "Face for items scheduled previously, and not yet done." |
| 2121 | :group 'org-faces) | 2449 | :group 'org-faces) |
| 2122 | 2450 | ||
| 2451 | (defface org-upcoming-deadline | ||
| 2452 | (org-compatible-face | ||
| 2453 | '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick")) | ||
| 2454 | (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1")) | ||
| 2455 | (((class color) (min-colors 8) (background light)) (:foreground "red")) | ||
| 2456 | (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t)) | ||
| 2457 | (t (:bold t)))) | ||
| 2458 | "Face for items scheduled previously, and not yet done." | ||
| 2459 | :group 'org-faces) | ||
| 2460 | |||
| 2123 | (defface org-time-grid ;; font-lock-variable-name-face | 2461 | (defface org-time-grid ;; font-lock-variable-name-face |
| 2124 | (org-compatible-face | 2462 | (org-compatible-face |
| 2125 | '((((class color) (min-colors 16) (background light)) (:foreground "DarkGoldenrod")) | 2463 | '((((class color) (min-colors 16) (background light)) (:foreground "DarkGoldenrod")) |
| 2126 | (((class color) (min-colors 16) (background dark)) (:foreground "LightGoldenrod")) | 2464 | (((class color) (min-colors 16) (background dark)) (:foreground "LightGoldenrod")) |
| 2127 | (((class color) (min-colors 8)) (:foreground "yellow" :weight light)))) ; FIXME: turn off??? | 2465 | (((class color) (min-colors 8)) (:foreground "yellow" :weight light)))) |
| 2128 | "Face used for time grids." | 2466 | "Face used for time grids." |
| 2129 | :group 'org-faces) | 2467 | :group 'org-faces) |
| 2130 | 2468 | ||
| @@ -2134,21 +2472,6 @@ This face is only used if `org-fontify-done-headline' is set." | |||
| 2134 | )) | 2472 | )) |
| 2135 | (defconst org-n-levels (length org-level-faces)) | 2473 | (defconst org-n-levels (length org-level-faces)) |
| 2136 | 2474 | ||
| 2137 | (defconst org-bold-re | ||
| 2138 | (if (featurep 'xemacs) | ||
| 2139 | "\\([ ]\\|^\\)\\(\\*\\(\\w[a-zA-Z0-9-_ ]*?\\w\\)\\*\\)\\([ ,.]\\|$\\)" | ||
| 2140 | "\\([ ]\\|^\\)\\(\\*\\(\\w[[:word:] -_]*?\\w\\)\\*\\)\\([ ,.]\\|$\\)") | ||
| 2141 | "Regular expression for bold emphasis.") | ||
| 2142 | (defconst org-italic-re | ||
| 2143 | (if (featurep 'xemacs) | ||
| 2144 | "\\([ ]\\|^\\)\\(/\\(\\w[a-zA-Z0-9-_ ]*?\\w\\)/\\)\\([ ,.]\\|$\\)" | ||
| 2145 | "\\([ ]\\|^\\)\\(/\\(\\w[[:word:] -_]*?\\w\\)/\\)\\([ ,.]\\|$\\)") | ||
| 2146 | "Regular expression for italic emphasis.") | ||
| 2147 | (defconst org-underline-re | ||
| 2148 | (if (featurep 'xemacs) | ||
| 2149 | "\\([ ]\\|^\\)\\(_\\(\\w[a-zA-Z0-9-_ ]*?\\w\\)_\\)\\([ ,.]\\|$\\)" | ||
| 2150 | "\\([ ]\\|^\\)\\(_\\(\\w[[:word:] -_]*?\\w\\)_\\)\\([ ,.]\\|$\\)") | ||
| 2151 | "Regular expression for underline emphasis.") | ||
| 2152 | 2475 | ||
| 2153 | ;; Variables for pre-computed regular expressions, all buffer local | 2476 | ;; Variables for pre-computed regular expressions, all buffer local |
| 2154 | (defvar org-done-string nil | 2477 | (defvar org-done-string nil |
| @@ -2163,6 +2486,10 @@ This face is only used if `org-fontify-done-headline' is set." | |||
| 2163 | (defvar org-todo-line-regexp nil | 2486 | (defvar org-todo-line-regexp nil |
| 2164 | "Matches a headline and puts TODO state into group 2 if present.") | 2487 | "Matches a headline and puts TODO state into group 2 if present.") |
| 2165 | (make-variable-buffer-local 'org-todo-line-regexp) | 2488 | (make-variable-buffer-local 'org-todo-line-regexp) |
| 2489 | (defvar org-todo-line-tags-regexp nil | ||
| 2490 | "Matches a headline and puts TODO state into group 2 if present. | ||
| 2491 | Also put tags into group 4 if tags are present.") | ||
| 2492 | (make-variable-buffer-local 'org-todo-line-tags-regexp) | ||
| 2166 | (defvar org-nl-done-regexp nil | 2493 | (defvar org-nl-done-regexp nil |
| 2167 | "Matches newline followed by a headline with the DONE keyword.") | 2494 | "Matches newline followed by a headline with the DONE keyword.") |
| 2168 | (make-variable-buffer-local 'org-nl-done-regexp) | 2495 | (make-variable-buffer-local 'org-nl-done-regexp) |
| @@ -2193,21 +2520,46 @@ This face is only used if `org-fontify-done-headline' is set." | |||
| 2193 | (defvar org-scheduled-time-regexp nil | 2520 | (defvar org-scheduled-time-regexp nil |
| 2194 | "Matches the SCHEDULED keyword together with a time stamp.") | 2521 | "Matches the SCHEDULED keyword together with a time stamp.") |
| 2195 | (make-variable-buffer-local 'org-scheduled-time-regexp) | 2522 | (make-variable-buffer-local 'org-scheduled-time-regexp) |
| 2523 | (defvar org-closed-time-regexp nil | ||
| 2524 | "Matches the CLOSED keyword together with a time stamp.") | ||
| 2525 | (make-variable-buffer-local 'org-closed-time-regexp) | ||
| 2526 | |||
| 2527 | (defvar org-keyword-time-regexp nil | ||
| 2528 | "Matches any of the 3 keywords, together with the time stamp.") | ||
| 2529 | (make-variable-buffer-local 'org-keyword-time-regexp) | ||
| 2530 | (defvar org-maybe-keyword-time-regexp nil | ||
| 2531 | "Matches a timestamp, possibly preceeded by a keyword.") | ||
| 2532 | (make-variable-buffer-local 'org-keyword-time-regexp) | ||
| 2533 | |||
| 2534 | (defconst org-rm-props '(invisible t face t keymap t intangible t mouse-face t | ||
| 2535 | mouse-map t) | ||
| 2536 | "Properties to remove when a string without properties is wanted.") | ||
| 2537 | |||
| 2538 | (defsubst org-match-string-no-properties (num &optional string) | ||
| 2539 | (if (featurep 'xemacs) | ||
| 2540 | (let ((s (match-string num string))) | ||
| 2541 | (remove-text-properties 0 (length s) org-rm-props s) | ||
| 2542 | s) | ||
| 2543 | (match-string-no-properties num string))) | ||
| 2544 | |||
| 2545 | (defsubst org-no-properties (s) | ||
| 2546 | (remove-text-properties 0 (length s) org-rm-props s) | ||
| 2547 | s) | ||
| 2196 | 2548 | ||
| 2197 | (defun org-set-regexps-and-options () | 2549 | (defun org-set-regexps-and-options () |
| 2198 | "Precompute regular expressions for current buffer." | 2550 | "Precompute regular expressions for current buffer." |
| 2199 | (when (eq major-mode 'org-mode) | 2551 | (when (eq major-mode 'org-mode) |
| 2200 | (let ((re (org-make-options-regexp | 2552 | (let ((re (org-make-options-regexp |
| 2201 | '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO" | 2553 | '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO" |
| 2202 | "STARTUP" "ARCHIVE"))) | 2554 | "STARTUP" "ARCHIVE" "TAGS"))) |
| 2203 | (splitre "[ \t]+") | 2555 | (splitre "[ \t]+") |
| 2204 | kwds int key value cat arch) | 2556 | kwds int key value cat arch tags) |
| 2205 | (save-excursion | 2557 | (save-excursion |
| 2206 | (save-restriction | 2558 | (save-restriction |
| 2207 | (widen) | 2559 | (widen) |
| 2208 | (goto-char (point-min)) | 2560 | (goto-char (point-min)) |
| 2209 | (while (re-search-forward re nil t) | 2561 | (while (re-search-forward re nil t) |
| 2210 | (setq key (match-string 1) value (match-string 2)) | 2562 | (setq key (match-string 1) value (org-match-string-no-properties 2)) |
| 2211 | (cond | 2563 | (cond |
| 2212 | ((equal key "CATEGORY") | 2564 | ((equal key "CATEGORY") |
| 2213 | (if (string-match "[ \t]+$" value) | 2565 | (if (string-match "[ \t]+$" value) |
| @@ -2222,6 +2574,8 @@ This face is only used if `org-fontify-done-headline' is set." | |||
| 2222 | ((equal key "TYP_TODO") | 2574 | ((equal key "TYP_TODO") |
| 2223 | (setq int 'type | 2575 | (setq int 'type |
| 2224 | kwds (append kwds (org-split-string value splitre)))) | 2576 | kwds (append kwds (org-split-string value splitre)))) |
| 2577 | ((equal key "TAGS") | ||
| 2578 | (setq tags (append tags (org-split-string value splitre)))) | ||
| 2225 | ((equal key "STARTUP") | 2579 | ((equal key "STARTUP") |
| 2226 | (let ((opts (org-split-string value splitre)) | 2580 | (let ((opts (org-split-string value splitre)) |
| 2227 | (set '(("fold" org-startup-folded t) | 2581 | (set '(("fold" org-startup-folded t) |
| @@ -2235,6 +2589,8 @@ This face is only used if `org-fontify-done-headline' is set." | |||
| 2235 | ("oddeven" org-odd-levels-only nil) | 2589 | ("oddeven" org-odd-levels-only nil) |
| 2236 | ("align" org-startup-align-all-tables t) | 2590 | ("align" org-startup-align-all-tables t) |
| 2237 | ("noalign" org-startup-align-all-tables nil) | 2591 | ("noalign" org-startup-align-all-tables nil) |
| 2592 | ("logging" org-log-done t) | ||
| 2593 | ("nologging" org-log-done nil) | ||
| 2238 | ("dlcheck" org-startup-with-deadline-check t) | 2594 | ("dlcheck" org-startup-with-deadline-check t) |
| 2239 | ("nodlcheck" org-startup-with-deadline-check nil))) | 2595 | ("nodlcheck" org-startup-with-deadline-check nil))) |
| 2240 | l var val) | 2596 | l var val) |
| @@ -2250,7 +2606,24 @@ This face is only used if `org-fontify-done-headline' is set." | |||
| 2250 | (and cat (set (make-local-variable 'org-category) cat)) | 2606 | (and cat (set (make-local-variable 'org-category) cat)) |
| 2251 | (and kwds (set (make-local-variable 'org-todo-keywords) kwds)) | 2607 | (and kwds (set (make-local-variable 'org-todo-keywords) kwds)) |
| 2252 | (and arch (set (make-local-variable 'org-archive-location) arch)) | 2608 | (and arch (set (make-local-variable 'org-archive-location) arch)) |
| 2253 | (and int (set (make-local-variable 'org-todo-interpretation) int))) | 2609 | (and int (set (make-local-variable 'org-todo-interpretation) int)) |
| 2610 | (when tags | ||
| 2611 | (let (e tg c tgs) | ||
| 2612 | (while (setq e (pop tags)) | ||
| 2613 | (cond | ||
| 2614 | ((equal e "{") (push '(:startgroup) tgs)) | ||
| 2615 | ((equal e "}") (push '(:endgroup) tgs)) | ||
| 2616 | ((string-match "^\\([0-9a-zA-Z_@]+\\)(\\(.\\))$" e) | ||
| 2617 | (push (cons (match-string 1 e) | ||
| 2618 | (string-to-char (match-string 2 e))) | ||
| 2619 | tgs)) | ||
| 2620 | (t (push (list e) tgs)))) | ||
| 2621 | (set (make-local-variable 'org-tag-alist) nil) | ||
| 2622 | (while (setq e (pop tgs)) | ||
| 2623 | (or (and (stringp (car e)) | ||
| 2624 | (assoc (car e) org-tag-alist)) | ||
| 2625 | (push e org-tag-alist)))))) | ||
| 2626 | |||
| 2254 | ;; Compute the regular expressions and other local variables | 2627 | ;; Compute the regular expressions and other local variables |
| 2255 | (setq org-todo-kwd-priority-p (equal org-todo-interpretation 'priority) | 2628 | (setq org-todo-kwd-priority-p (equal org-todo-interpretation 'priority) |
| 2256 | org-todo-kwd-max-priority (1- (length org-todo-keywords)) | 2629 | org-todo-kwd-max-priority (1- (length org-todo-keywords)) |
| @@ -2273,6 +2646,10 @@ This face is only used if `org-fontify-done-headline' is set." | |||
| 2273 | "\\)? *\\(.*\\)") | 2646 | "\\)? *\\(.*\\)") |
| 2274 | org-nl-done-regexp | 2647 | org-nl-done-regexp |
| 2275 | (concat "[\r\n]\\*+[ \t]+" org-done-string "\\>") | 2648 | (concat "[\r\n]\\*+[ \t]+" org-done-string "\\>") |
| 2649 | org-todo-line-tags-regexp | ||
| 2650 | (concat "^\\(\\*+\\)[ \t]*\\(" | ||
| 2651 | (mapconcat 'regexp-quote org-todo-keywords "\\|") | ||
| 2652 | "\\)? *\\(.*?\\([ \t]:[a-zA-Z0-9:_@]+:[ \t]*\\)?$\\)") | ||
| 2276 | org-looking-at-done-regexp (concat "^" org-done-string "\\>") | 2653 | org-looking-at-done-regexp (concat "^" org-done-string "\\>") |
| 2277 | org-deadline-regexp (concat "\\<" org-deadline-string) | 2654 | org-deadline-regexp (concat "\\<" org-deadline-string) |
| 2278 | org-deadline-time-regexp | 2655 | org-deadline-time-regexp |
| @@ -2282,11 +2659,29 @@ This face is only used if `org-fontify-done-headline' is set." | |||
| 2282 | org-scheduled-regexp | 2659 | org-scheduled-regexp |
| 2283 | (concat "\\<" org-scheduled-string) | 2660 | (concat "\\<" org-scheduled-string) |
| 2284 | org-scheduled-time-regexp | 2661 | org-scheduled-time-regexp |
| 2285 | (concat "\\<" org-scheduled-string " *<\\([^>]+\\)>")) | 2662 | (concat "\\<" org-scheduled-string " *<\\([^>]+\\)>") |
| 2663 | org-closed-time-regexp | ||
| 2664 | (concat "\\<" org-closed-string " *\\[\\([^]]+\\)\\]") | ||
| 2665 | org-keyword-time-regexp | ||
| 2666 | (concat "\\<\\(" org-scheduled-string | ||
| 2667 | "\\|" org-deadline-string | ||
| 2668 | "\\|" org-closed-string | ||
| 2669 | "\\|" org-clock-string "\\)" | ||
| 2670 | " *[[<]\\([^]>]+\\)[]>]") | ||
| 2671 | org-maybe-keyword-time-regexp | ||
| 2672 | (concat "\\(\\<\\(" org-scheduled-string | ||
| 2673 | "\\|" org-deadline-string | ||
| 2674 | "\\|" org-closed-string | ||
| 2675 | "\\|" org-clock-string "\\)\\)?" | ||
| 2676 | " *\\([[<][0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}[^]\r\n>]*?[]>]\\)")) | ||
| 2677 | |||
| 2286 | (org-set-font-lock-defaults))) | 2678 | (org-set-font-lock-defaults))) |
| 2287 | 2679 | ||
| 2288 | ;; Tell the compiler about dynamically scoped variables, | 2680 | ;; Tell the compiler about dynamically scoped variables, |
| 2289 | ;; and variables from other packages | 2681 | ;; and variables from other packages |
| 2682 | (defvar calc-embedded-close-formula) ; defined by the calc package | ||
| 2683 | (defvar calc-embedded-open-formula) ; defined by the calc package | ||
| 2684 | (defvar font-lock-unfontify-region-function) ; defined by font-lock.el | ||
| 2290 | (defvar zmacs-regions) ; XEmacs regions | 2685 | (defvar zmacs-regions) ; XEmacs regions |
| 2291 | (defvar original-date) ; dynamically scoped in calendar | 2686 | (defvar original-date) ; dynamically scoped in calendar |
| 2292 | (defvar org-old-auto-fill-inhibit-regexp) ; local variable used by `orgtbl-mode' | 2687 | (defvar org-old-auto-fill-inhibit-regexp) ; local variable used by `orgtbl-mode' |
| @@ -2298,14 +2693,10 @@ This face is only used if `org-fontify-done-headline' is set." | |||
| 2298 | (defvar mark-active) ; Emacs only, not available in XEmacs. | 2693 | (defvar mark-active) ; Emacs only, not available in XEmacs. |
| 2299 | (defvar timecnt) ; dynamically scoped parameter | 2694 | (defvar timecnt) ; dynamically scoped parameter |
| 2300 | (defvar levels-open) ; dynamically scoped parameter | 2695 | (defvar levels-open) ; dynamically scoped parameter |
| 2301 | (defvar title) ; dynamically scoped parameter | ||
| 2302 | (defvar author) ; dynamically scoped parameter | ||
| 2303 | (defvar email) ; dynamically scoped parameter | ||
| 2304 | (defvar text) ; dynamically scoped parameter | ||
| 2305 | (defvar entry) ; dynamically scoped parameter | 2696 | (defvar entry) ; dynamically scoped parameter |
| 2697 | (defvar state) ; dynamically scoped into `org-after-todo-state-change-hook' | ||
| 2306 | (defvar date) ; dynamically scoped parameter | 2698 | (defvar date) ; dynamically scoped parameter |
| 2307 | (defvar language) ; dynamically scoped parameter | 2699 | (defvar description) ; dynamically scoped parameter |
| 2308 | (defvar options) ; dynamically scoped parameter | ||
| 2309 | (defvar ans1) ; dynamically scoped parameter | 2700 | (defvar ans1) ; dynamically scoped parameter |
| 2310 | (defvar ans2) ; dynamically scoped parameter | 2701 | (defvar ans2) ; dynamically scoped parameter |
| 2311 | (defvar starting-day) ; local variable | 2702 | (defvar starting-day) ; local variable |
| @@ -2330,9 +2721,12 @@ This face is only used if `org-fontify-done-headline' is set." | |||
| 2330 | (defvar annotation) ; from remember.el, dynamically scoped in `remember-mode' | 2721 | (defvar annotation) ; from remember.el, dynamically scoped in `remember-mode' |
| 2331 | (defvar initial) ; from remember.el, dynamically scoped in `remember-mode' | 2722 | (defvar initial) ; from remember.el, dynamically scoped in `remember-mode' |
| 2332 | (defvar orgtbl-mode) ; defined later in this file | 2723 | (defvar orgtbl-mode) ; defined later in this file |
| 2724 | (defvar Info-current-file) ; from info.el | ||
| 2725 | (defvar Info-current-node) ; from info.el | ||
| 2726 | |||
| 2333 | ;;; Define the mode | 2727 | ;;; Define the mode |
| 2334 | 2728 | ||
| 2335 | (defvar org-mode-map | 2729 | (defvar org-mode-map |
| 2336 | (if (and (not (keymapp outline-mode-map)) (featurep 'allout)) | 2730 | (if (and (not (keymapp outline-mode-map)) (featurep 'allout)) |
| 2337 | (error "Conflict with outdated version of allout.el. Load org.el before allout.el, or ugrade to newer allout, for example by switching to Emacs 22.") | 2731 | (error "Conflict with outdated version of allout.el. Load org.el before allout.el, or ugrade to newer allout, for example by switching to Emacs 22.") |
| 2338 | (copy-keymap outline-mode-map)) | 2732 | (copy-keymap outline-mode-map)) |
| @@ -2372,21 +2766,42 @@ can be exported as a structured ASCII or HTML file. | |||
| 2372 | The following commands are available: | 2766 | The following commands are available: |
| 2373 | 2767 | ||
| 2374 | \\{org-mode-map}" | 2768 | \\{org-mode-map}" |
| 2769 | |||
| 2770 | ;; Get rid of Outline menus, they are not needed | ||
| 2771 | ;; Need to do this here because define-derived-mode sets up | ||
| 2772 | ;; the keymap so late. | ||
| 2773 | (if (featurep 'xemacs) | ||
| 2774 | (if org-noutline-p | ||
| 2775 | (progn | ||
| 2776 | (easy-menu-remove outline-mode-menu-heading) | ||
| 2777 | (easy-menu-remove outline-mode-menu-show) | ||
| 2778 | (easy-menu-remove outline-mode-menu-hide)) | ||
| 2779 | (delete-menu-item '("Headings")) | ||
| 2780 | (delete-menu-item '("Show")) | ||
| 2781 | (delete-menu-item '("Hide")) | ||
| 2782 | (set-menubar-dirty-flag)) | ||
| 2783 | (define-key org-mode-map [menu-bar headings] 'undefined) | ||
| 2784 | (define-key org-mode-map [menu-bar hide] 'undefined) | ||
| 2785 | (define-key org-mode-map [menu-bar show] 'undefined)) | ||
| 2786 | |||
| 2375 | (easy-menu-add org-org-menu) | 2787 | (easy-menu-add org-org-menu) |
| 2376 | (easy-menu-add org-tbl-menu) | 2788 | (easy-menu-add org-tbl-menu) |
| 2377 | (org-install-agenda-files-menu) | 2789 | (org-install-agenda-files-menu) |
| 2378 | (if org-descriptive-links (org-add-to-invisibility-spec '(org-link))) | 2790 | (if org-descriptive-links (org-add-to-invisibility-spec '(org-link))) |
| 2379 | (org-add-to-invisibility-spec '(org-cwidth)) | 2791 | (org-add-to-invisibility-spec '(org-cwidth)) |
| 2792 | (when (featurep 'xemacs) | ||
| 2793 | (set (make-local-variable 'line-move-ignore-invisible) t)) | ||
| 2380 | (setq outline-regexp "\\*+") | 2794 | (setq outline-regexp "\\*+") |
| 2381 | ;;(setq outline-regexp "\\(?:\\*+\\|[ \t]*\\(?:[-+*]\\|[0-9]+[.)]\\) \\)") | 2795 | ;;(setq outline-regexp "\\(?:\\*+\\|[ \t]*\\(?:[-+*]\\|[0-9]+[.)]\\) \\)") |
| 2382 | (setq outline-level 'org-outline-level) | 2796 | (setq outline-level 'org-outline-level) |
| 2383 | (when (and org-ellipsis (stringp org-ellipsis)) | 2797 | (when (and org-ellipsis (stringp org-ellipsis)) |
| 2384 | (unless org-display-table | 2798 | (unless org-display-table |
| 2385 | (setq org-display-table (make-display-table))) | 2799 | (setq org-display-table (make-display-table))) |
| 2386 | (set-display-table-slot org-display-table | 2800 | (set-display-table-slot org-display-table |
| 2387 | 4 (string-to-vector org-ellipsis)) | 2801 | 4 (string-to-vector org-ellipsis)) |
| 2388 | (setq buffer-display-table org-display-table)) | 2802 | (setq buffer-display-table org-display-table)) |
| 2389 | (org-set-regexps-and-options) | 2803 | (org-set-regexps-and-options) |
| 2804 | (modify-syntax-entry ?# "<") | ||
| 2390 | (if org-startup-truncated (setq truncate-lines t)) | 2805 | (if org-startup-truncated (setq truncate-lines t)) |
| 2391 | (set (make-local-variable 'font-lock-unfontify-region-function) | 2806 | (set (make-local-variable 'font-lock-unfontify-region-function) |
| 2392 | 'org-unfontify-region) | 2807 | 'org-unfontify-region) |
| @@ -2394,6 +2809,8 @@ The following commands are available: | |||
| 2394 | (set (make-local-variable 'org-table-may-need-update) t) | 2809 | (set (make-local-variable 'org-table-may-need-update) t) |
| 2395 | (org-add-hook 'before-change-functions 'org-before-change-function nil | 2810 | (org-add-hook 'before-change-functions 'org-before-change-function nil |
| 2396 | 'local) | 2811 | 'local) |
| 2812 | ;; Check for running clock before killing a buffer | ||
| 2813 | (org-add-hook 'kill-buffer-hook 'org-check-running-clock nil 'local) | ||
| 2397 | ;; Paragraphs and auto-filling | 2814 | ;; Paragraphs and auto-filling |
| 2398 | (org-set-autofill-regexps) | 2815 | (org-set-autofill-regexps) |
| 2399 | (org-update-radio-target-regexp) | 2816 | (org-update-radio-target-regexp) |
| @@ -2405,19 +2822,6 @@ The following commands are available: | |||
| 2405 | (= (point-min) (point-max))) | 2822 | (= (point-min) (point-max))) |
| 2406 | (insert " -*- mode: org -*-\n\n")) | 2823 | (insert " -*- mode: org -*-\n\n")) |
| 2407 | 2824 | ||
| 2408 | ;; Get rid of Outline menus, they are not needed | ||
| 2409 | ;; Need to do this here because define-derived-mode sets up | ||
| 2410 | ;; the keymap so late. | ||
| 2411 | (if (featurep 'xemacs) | ||
| 2412 | (progn | ||
| 2413 | (delete-menu-item '("Headings")) | ||
| 2414 | (delete-menu-item '("Show")) | ||
| 2415 | (delete-menu-item '("Hide")) | ||
| 2416 | (set-menubar-dirty-flag)) | ||
| 2417 | (define-key org-mode-map [menu-bar headings] 'undefined) | ||
| 2418 | (define-key org-mode-map [menu-bar hide] 'undefined) | ||
| 2419 | (define-key org-mode-map [menu-bar show] 'undefined)) | ||
| 2420 | |||
| 2421 | (unless org-inhibit-startup | 2825 | (unless org-inhibit-startup |
| 2422 | (if org-startup-align-all-tables | 2826 | (if org-startup-align-all-tables |
| 2423 | (org-table-map-tables 'org-table-align)) | 2827 | (org-table-map-tables 'org-table-align)) |
| @@ -2430,24 +2834,13 @@ The following commands are available: | |||
| 2430 | (let ((this-command 'org-cycle) (last-command 'org-cycle)) | 2834 | (let ((this-command 'org-cycle) (last-command 'org-cycle)) |
| 2431 | (org-cycle '(4)) (org-cycle '(4)))))))) | 2835 | (org-cycle '(4)) (org-cycle '(4)))))))) |
| 2432 | 2836 | ||
| 2837 | (defsubst org-call-with-arg (command arg) | ||
| 2838 | "Call COMMAND interactively, but pretend prefix are was ARG." | ||
| 2839 | (let ((current-prefix-arg arg)) (call-interactively command))) | ||
| 2840 | |||
| 2433 | (defsubst org-current-line (&optional pos) | 2841 | (defsubst org-current-line (&optional pos) |
| 2434 | (+ (if (bolp) 1 0) (count-lines (point-min) (or pos (point))))) | 2842 | (+ (if (bolp) 1 0) (count-lines (point-min) (or pos (point))))) |
| 2435 | 2843 | ||
| 2436 | (defconst org-rm-props '(invisible t face t keymap t intangible t mouse-face t | ||
| 2437 | mouse-map t) | ||
| 2438 | "Properties to remove when a string without properties is wanted.") | ||
| 2439 | |||
| 2440 | (defsubst org-match-string-no-properties (num &optional string) | ||
| 2441 | (if (featurep 'xemacs) | ||
| 2442 | (let ((s (match-string num string))) | ||
| 2443 | (remove-text-properties 0 (length s) org-rm-props s) | ||
| 2444 | s) | ||
| 2445 | (match-string-no-properties num string))) | ||
| 2446 | |||
| 2447 | (defsubst org-no-properties (s) | ||
| 2448 | (remove-text-properties 0 (length s) org-rm-props s) | ||
| 2449 | s) | ||
| 2450 | |||
| 2451 | (defun org-current-time () | 2844 | (defun org-current-time () |
| 2452 | "Current time, possibly rounded to `org-time-stamp-rounding-minutes'." | 2845 | "Current time, possibly rounded to `org-time-stamp-rounding-minutes'." |
| 2453 | (if (> org-time-stamp-rounding-minutes 0) | 2846 | (if (> org-time-stamp-rounding-minutes 0) |
| @@ -2488,8 +2881,8 @@ that will be added to PLIST. Returns the string that was modified." | |||
| 2488 | 2881 | ||
| 2489 | (defconst org-non-link-chars "]\t\n\r<>") | 2882 | (defconst org-non-link-chars "]\t\n\r<>") |
| 2490 | (defconst org-link-types '("https?" "ftp" "mailto" "file" "news" "bbdb" "vm" | 2883 | (defconst org-link-types '("https?" "ftp" "mailto" "file" "news" "bbdb" "vm" |
| 2491 | "wl" "mhe" "rmail" "gnus" "shell")) | 2884 | "wl" "mhe" "rmail" "gnus" "shell" "info" "elisp")) |
| 2492 | (defconst org-link-re-with-space | 2885 | (defconst org-link-re-with-space |
| 2493 | (concat | 2886 | (concat |
| 2494 | "<?\\(" (mapconcat 'identity org-link-types "\\|") "\\):" | 2887 | "<?\\(" (mapconcat 'identity org-link-types "\\|") "\\):" |
| 2495 | "\\([^" org-non-link-chars " ]" | 2888 | "\\([^" org-non-link-chars " ]" |
| @@ -2505,7 +2898,7 @@ that will be added to PLIST. Returns the string that was modified." | |||
| 2505 | "[^" org-non-link-chars " ]\\)>?") | 2898 | "[^" org-non-link-chars " ]\\)>?") |
| 2506 | "Matches a link with spaces, optional angular brackets around it.") | 2899 | "Matches a link with spaces, optional angular brackets around it.") |
| 2507 | 2900 | ||
| 2508 | (defconst org-angle-link-re | 2901 | (defconst org-angle-link-re |
| 2509 | (concat | 2902 | (concat |
| 2510 | "<\\(" (mapconcat 'identity org-link-types "\\|") "\\):" | 2903 | "<\\(" (mapconcat 'identity org-link-types "\\|") "\\):" |
| 2511 | "\\([^" org-non-link-chars " ]" | 2904 | "\\([^" org-non-link-chars " ]" |
| @@ -2555,6 +2948,21 @@ that will be added to PLIST. Returns the string that was modified." | |||
| 2555 | org-ts-regexp "\\)?") | 2948 | org-ts-regexp "\\)?") |
| 2556 | "Regular expression matching a time stamp or time stamp range.") | 2949 | "Regular expression matching a time stamp or time stamp range.") |
| 2557 | 2950 | ||
| 2951 | (defvar org-§emph-face nil) | ||
| 2952 | |||
| 2953 | (defun org-do-emphasis-faces (limit) | ||
| 2954 | "Run through the buffer and add overlays to links." | ||
| 2955 | (if (re-search-forward org-emph-re limit t) | ||
| 2956 | (progn | ||
| 2957 | (font-lock-prepend-text-property (match-beginning 2) (match-end 2) | ||
| 2958 | 'face | ||
| 2959 | (nth 1 (assoc (match-string 3) | ||
| 2960 | org-emphasis-alist))) | ||
| 2961 | (add-text-properties (match-beginning 2) (match-end 2) | ||
| 2962 | '(font-lock-multiline t)) | ||
| 2963 | (backward-char 1) | ||
| 2964 | t))) | ||
| 2965 | |||
| 2558 | (defun org-activate-plain-links (limit) | 2966 | (defun org-activate-plain-links (limit) |
| 2559 | "Run through the buffer and add overlays to links." | 2967 | "Run through the buffer and add overlays to links." |
| 2560 | (if (re-search-forward org-plain-link-re limit t) | 2968 | (if (re-search-forward org-plain-link-re limit t) |
| @@ -2581,6 +2989,8 @@ that will be added to PLIST. Returns the string that was modified." | |||
| 2581 | (let* ((help (concat "LINK: " | 2989 | (let* ((help (concat "LINK: " |
| 2582 | (org-match-string-no-properties 1))) | 2990 | (org-match-string-no-properties 1))) |
| 2583 | ;; FIXME: above we should remove the escapes. | 2991 | ;; FIXME: above we should remove the escapes. |
| 2992 | ;; but that requires another match, protecting match data, | ||
| 2993 | ;; a lot of overhead for font-lock. | ||
| 2584 | (ip (list 'invisible 'org-link 'intangible t 'rear-nonsticky t | 2994 | (ip (list 'invisible 'org-link 'intangible t 'rear-nonsticky t |
| 2585 | 'keymap org-mouse-map 'mouse-face 'highlight | 2995 | 'keymap org-mouse-map 'mouse-face 'highlight |
| 2586 | 'help-echo help)) | 2996 | 'help-echo help)) |
| @@ -2719,11 +3129,13 @@ between words." | |||
| 2719 | (let* ((em org-fontify-emphasized-text) | 3129 | (let* ((em org-fontify-emphasized-text) |
| 2720 | (lk org-activate-links) | 3130 | (lk org-activate-links) |
| 2721 | (org-font-lock-extra-keywords | 3131 | (org-font-lock-extra-keywords |
| 3132 | ;; Headlines | ||
| 2722 | (list | 3133 | (list |
| 2723 | '("^\\(\\**\\)\\(\\*\\)\\(.*\\)" (1 (org-get-level-face 1)) | 3134 | '("^\\(\\**\\)\\(\\*\\)\\(.*\\)" (1 (org-get-level-face 1)) |
| 2724 | (2 (org-get-level-face 2)) (3 (org-get-level-face 3))) | 3135 | (2 (org-get-level-face 2)) (3 (org-get-level-face 3))) |
| 2725 | '("^[ \t]*\\(\\(|\\|\\+-[-+]\\).*\\S-\\)" | 3136 | '("^[ \t]*\\(\\(|\\|\\+-[-+]\\).*\\S-\\)" |
| 2726 | (1 'org-table)) | 3137 | (1 'org-table)) |
| 3138 | ;; Links | ||
| 2727 | (if (memq 'angle lk) '(org-activate-angle-links (0 'org-link t))) | 3139 | (if (memq 'angle lk) '(org-activate-angle-links (0 'org-link t))) |
| 2728 | (if (memq 'plain lk) '(org-activate-plain-links (0 'org-link t))) | 3140 | (if (memq 'plain lk) '(org-activate-plain-links (0 'org-link t))) |
| 2729 | (if (memq 'bracket lk) '(org-activate-bracket-links (0 'org-link t))) | 3141 | (if (memq 'bracket lk) '(org-activate-bracket-links (0 'org-link t))) |
| @@ -2733,27 +3145,33 @@ between words." | |||
| 2733 | (if (memq 'tag lk) '(org-activate-tags (1 'org-tag prepend))) | 3145 | (if (memq 'tag lk) '(org-activate-tags (1 'org-tag prepend))) |
| 2734 | (if org-table-limit-column-width | 3146 | (if org-table-limit-column-width |
| 2735 | '(org-hide-wide-columns (0 nil append))) | 3147 | '(org-hide-wide-columns (0 nil append))) |
| 3148 | ;; TODO lines | ||
| 2736 | (list (concat "^\\*+[ \t]*" org-not-done-regexp) | 3149 | (list (concat "^\\*+[ \t]*" org-not-done-regexp) |
| 2737 | '(1 'org-todo t)) | 3150 | '(1 'org-todo t)) |
| 3151 | ;; Priorities | ||
| 2738 | (list (concat "\\[#[A-Z]\\]") '(0 'org-special-keyword t)) | 3152 | (list (concat "\\[#[A-Z]\\]") '(0 'org-special-keyword t)) |
| 3153 | ;; Special keywords | ||
| 2739 | (list (concat "\\<" org-deadline-string) '(0 'org-special-keyword t)) | 3154 | (list (concat "\\<" org-deadline-string) '(0 'org-special-keyword t)) |
| 2740 | (list (concat "\\<" org-scheduled-string) '(0 'org-special-keyword t)) | 3155 | (list (concat "\\<" org-scheduled-string) '(0 'org-special-keyword t)) |
| 2741 | (list (concat "\\<" org-closed-string) '(0 'org-special-keyword t)) | 3156 | (list (concat "\\<" org-closed-string) '(0 'org-special-keyword t)) |
| 2742 | ; (if em '("\\(\\W\\|^\\)\\(\\*\\w+\\*\\)\\(\\W\\|$\\)" 2 'bold prepend)) | 3157 | (list (concat "\\<" org-clock-string) '(0 'org-special-keyword t)) |
| 2743 | ; (if em '("\\(\\W\\|^\\)\\(/\\w+/\\)\\(\\W\\|$\\)" 2 'italic prepend)) | 3158 | ;; Emphasis |
| 2744 | ; (if em '("\\(\\W\\|^\\)\\(_\\w+_\\)\\(\\W\\|$\\)" 2 'underline prepend)) | 3159 | (if em '(org-do-emphasis-faces)) |
| 2745 | (if em (list org-bold-re 2 ''bold 'prepend)) | 3160 | ;; Checkboxes, similar to Frank Ruell's org-checklet.el |
| 2746 | (if em (list org-italic-re 2 ''italic 'prepend)) | 3161 | '("^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +\\(\\[[ X]\\]\\)" |
| 2747 | (if em (list org-underline-re 2 ''underline 'prepend)) | 3162 | 2 'bold prepend) |
| 3163 | ;; COMMENT | ||
| 2748 | (list (concat "^\\*+[ \t]*\\<\\(" org-comment-string | 3164 | (list (concat "^\\*+[ \t]*\\<\\(" org-comment-string |
| 2749 | "\\|" org-quote-string "\\)\\>") | 3165 | "\\|" org-quote-string "\\)\\>") |
| 2750 | '(1 'org-special-keyword t)) | 3166 | '(1 'org-special-keyword t)) |
| 2751 | '("^#.*" (0 'font-lock-comment-face t)) | 3167 | '("^#.*" (0 'font-lock-comment-face t)) |
| 3168 | ;; DONE | ||
| 2752 | (if org-fontify-done-headline | 3169 | (if org-fontify-done-headline |
| 2753 | (list (concat "^[*]+ +\\<\\(" org-done-string "\\)\\(.*\\)\\>") | 3170 | (list (concat "^[*]+ +\\<\\(" org-done-string "\\)\\(.*\\)\\>") |
| 2754 | '(1 'org-done t) '(2 'org-headline-done t)) | 3171 | '(1 'org-done t) '(2 'org-headline-done t)) |
| 2755 | (list (concat "^[*]+ +\\<\\(" org-done-string "\\)\\>") | 3172 | (list (concat "^[*]+ +\\<\\(" org-done-string "\\)\\>") |
| 2756 | '(1 'org-done t))) | 3173 | '(1 'org-done t))) |
| 3174 | ;; Table stuff | ||
| 2757 | '("^[ \t]*\\(:.*\\)" (1 'org-table t)) | 3175 | '("^[ \t]*\\(:.*\\)" (1 'org-table t)) |
| 2758 | '("| *\\(:?=[^|\n]*\\)" (1 'org-formula t)) | 3176 | '("| *\\(:?=[^|\n]*\\)" (1 'org-formula t)) |
| 2759 | '("^[ \t]*| *\\([#!$*_^]\\) *|" (1 'org-formula t)) | 3177 | '("^[ \t]*| *\\([#!$*_^]\\) *|" (1 'org-formula t)) |
| @@ -2795,7 +3213,11 @@ between words." | |||
| 2795 | ;;; Visibility cycling | 3213 | ;;; Visibility cycling |
| 2796 | 3214 | ||
| 2797 | (defvar org-cycle-global-status nil) | 3215 | (defvar org-cycle-global-status nil) |
| 3216 | (make-variable-buffer-local 'org-cycle-global-status) | ||
| 2798 | (defvar org-cycle-subtree-status nil) | 3217 | (defvar org-cycle-subtree-status nil) |
| 3218 | (make-variable-buffer-local 'org-cycle-subtree-status) | ||
| 3219 | |||
| 3220 | ;;;###autoload | ||
| 2799 | (defun org-cycle (&optional arg) | 3221 | (defun org-cycle (&optional arg) |
| 2800 | "Visibility cycling for Org-mode. | 3222 | "Visibility cycling for Org-mode. |
| 2801 | 3223 | ||
| @@ -2825,15 +3247,18 @@ between words." | |||
| 2825 | no headline in line 1, this function will act as if called with prefix arg." | 3247 | no headline in line 1, this function will act as if called with prefix arg." |
| 2826 | (interactive "P") | 3248 | (interactive "P") |
| 2827 | 3249 | ||
| 2828 | (if (or (and (bobp) (not (looking-at outline-regexp))) | 3250 | (let* ((outline-regexp |
| 2829 | (equal arg '(4))) | 3251 | (if org-cycle-include-plain-lists |
| 2830 | ;; special case: use global cycling | 3252 | "\\*+\\|\\([ \t]*\\)\\([-+*]\\|[0-9]+[.)]\\) " |
| 2831 | (setq arg t)) | 3253 | outline-regexp)) |
| 3254 | (bob-special (and org-cycle-global-at-bob (bobp) | ||
| 3255 | (not (looking-at outline-regexp)))) | ||
| 3256 | (org-cycle-hook (if bob-special nil org-cycle-hook)) | ||
| 3257 | (pos (point))) | ||
| 2832 | 3258 | ||
| 2833 | (let ((outline-regexp | 3259 | (if (or bob-special (equal arg '(4))) |
| 2834 | (if org-cycle-include-plain-lists | 3260 | ;; special case: use global cycling |
| 2835 | "\\*+\\|\\([ \t]*\\)\\([-+*]\\|[0-9]+[.)]\\) " | 3261 | (setq arg t)) |
| 2836 | outline-regexp))) | ||
| 2837 | 3262 | ||
| 2838 | (cond | 3263 | (cond |
| 2839 | 3264 | ||
| @@ -2843,7 +3268,7 @@ between words." | |||
| 2843 | (progn | 3268 | (progn |
| 2844 | (if arg (org-table-edit-field t) | 3269 | (if arg (org-table-edit-field t) |
| 2845 | (org-table-justify-field-maybe) | 3270 | (org-table-justify-field-maybe) |
| 2846 | (org-table-next-field))))) | 3271 | (call-interactively 'org-table-next-field))))) |
| 2847 | 3272 | ||
| 2848 | ((eq arg t) ;; Global cycling | 3273 | ((eq arg t) ;; Global cycling |
| 2849 | 3274 | ||
| @@ -2853,18 +3278,8 @@ between words." | |||
| 2853 | ;; We just created the overview - now do table of contents | 3278 | ;; We just created the overview - now do table of contents |
| 2854 | ;; This can be slow in very large buffers, so indicate action | 3279 | ;; This can be slow in very large buffers, so indicate action |
| 2855 | (message "CONTENTS...") | 3280 | (message "CONTENTS...") |
| 2856 | (save-excursion | 3281 | (org-content) |
| 2857 | ;; Visit all headings and show their offspring | 3282 | (message "CONTENTS...done") |
| 2858 | (goto-char (point-max)) | ||
| 2859 | (catch 'exit | ||
| 2860 | (while (and (progn (condition-case nil | ||
| 2861 | (outline-previous-visible-heading 1) | ||
| 2862 | (error (goto-char (point-min)))) | ||
| 2863 | t) | ||
| 2864 | (looking-at outline-regexp)) | ||
| 2865 | (show-branches) | ||
| 2866 | (if (bobp) (throw 'exit nil)))) | ||
| 2867 | (message "CONTENTS...done")) | ||
| 2868 | (setq org-cycle-global-status 'contents) | 3283 | (setq org-cycle-global-status 'contents) |
| 2869 | (run-hook-with-args 'org-cycle-hook 'contents)) | 3284 | (run-hook-with-args 'org-cycle-hook 'contents)) |
| 2870 | 3285 | ||
| @@ -2878,7 +3293,7 @@ between words." | |||
| 2878 | 3293 | ||
| 2879 | (t | 3294 | (t |
| 2880 | ;; Default action: go to overview | 3295 | ;; Default action: go to overview |
| 2881 | (hide-sublevels 1) | 3296 | (org-overview) |
| 2882 | (message "OVERVIEW") | 3297 | (message "OVERVIEW") |
| 2883 | (setq org-cycle-global-status 'overview) | 3298 | (setq org-cycle-global-status 'overview) |
| 2884 | (run-hook-with-args 'org-cycle-hook 'overview)))) | 3299 | (run-hook-with-args 'org-cycle-hook 'overview)))) |
| @@ -2908,10 +3323,10 @@ between words." | |||
| 2908 | (outline-next-heading)) | 3323 | (outline-next-heading)) |
| 2909 | ;; Find out what to do next and set `this-command' | 3324 | ;; Find out what to do next and set `this-command' |
| 2910 | (cond | 3325 | (cond |
| 2911 | ((= eos eoh) | 3326 | ((and (= eos eoh) |
| 2912 | ;; Nothing is hidden behind this heading | 3327 | ;; Nothing is hidden behind this heading |
| 2913 | (message "EMPTY ENTRY") | 3328 | (message "EMPTY ENTRY") |
| 2914 | (setq org-cycle-subtree-status nil)) | 3329 | (setq org-cycle-subtree-status nil))) |
| 2915 | ((>= eol eos) | 3330 | ((>= eol eos) |
| 2916 | ;; Entire subtree is hidden in one line: open it | 3331 | ;; Entire subtree is hidden in one line: open it |
| 2917 | (org-show-entry) | 3332 | (org-show-entry) |
| @@ -2935,8 +3350,12 @@ between words." | |||
| 2935 | 3350 | ||
| 2936 | ;; TAB emulation | 3351 | ;; TAB emulation |
| 2937 | (buffer-read-only (org-back-to-heading)) | 3352 | (buffer-read-only (org-back-to-heading)) |
| 2938 | ((if (and (eq org-cycle-emulate-tab 'white) | 3353 | ((if (and (memq org-cycle-emulate-tab '(white whitestart)) |
| 2939 | (save-excursion (beginning-of-line 1) (looking-at "[ \t]+$"))) | 3354 | (save-excursion (beginning-of-line 1) (looking-at "[ \t]*")) |
| 3355 | (or (and (eq org-cycle-emulate-tab 'white) | ||
| 3356 | (= (match-end 0) (point-at-eol))) | ||
| 3357 | (and (eq org-cycle-emulate-tab 'whitestart) | ||
| 3358 | (>= (match-end 0) pos)))) | ||
| 2940 | t | 3359 | t |
| 2941 | (eq org-cycle-emulate-tab t)) | 3360 | (eq org-cycle-emulate-tab t)) |
| 2942 | (if (and (looking-at "[ \n\r\t]") | 3361 | (if (and (looking-at "[ \n\r\t]") |
| @@ -2951,6 +3370,49 @@ between words." | |||
| 2951 | (org-back-to-heading) | 3370 | (org-back-to-heading) |
| 2952 | (org-cycle)))))) | 3371 | (org-cycle)))))) |
| 2953 | 3372 | ||
| 3373 | ;;;###autoload | ||
| 3374 | (defun org-global-cycle (&optional arg) | ||
| 3375 | "Cycle the global visibility. For details see `org-cycle'." | ||
| 3376 | (interactive "P") | ||
| 3377 | (if (integerp arg) | ||
| 3378 | (progn | ||
| 3379 | (show-all) | ||
| 3380 | (hide-sublevels arg) | ||
| 3381 | (setq org-cycle-global-status 'contents)) | ||
| 3382 | (org-cycle '(4)))) | ||
| 3383 | |||
| 3384 | (defun org-overview () | ||
| 3385 | "Switch to overview mode, shoing only top-level headlines. | ||
| 3386 | Really, this shows all headlines with level equal or greater than the level | ||
| 3387 | of the first headline in the buffer. This is important, because if the | ||
| 3388 | first headline is not level one, then (hide-sublevels 1) gives confusing | ||
| 3389 | results." | ||
| 3390 | (interactive) | ||
| 3391 | (hide-sublevels (save-excursion | ||
| 3392 | (goto-char (point-min)) | ||
| 3393 | (if (re-search-forward (concat "^" outline-regexp) nil t) | ||
| 3394 | (progn | ||
| 3395 | (goto-char (match-beginning 0)) | ||
| 3396 | (funcall outline-level)) | ||
| 3397 | 1)))) | ||
| 3398 | |||
| 3399 | ;; FIXME: allow an argument to give a limiting level for this. | ||
| 3400 | (defun org-content () | ||
| 3401 | "Show all headlines in the buffer, like a table of contents" | ||
| 3402 | (interactive) | ||
| 3403 | (save-excursion | ||
| 3404 | ;; Visit all headings and show their offspring | ||
| 3405 | (goto-char (point-max)) | ||
| 3406 | (catch 'exit | ||
| 3407 | (while (and (progn (condition-case nil | ||
| 3408 | (outline-previous-visible-heading 1) | ||
| 3409 | (error (goto-char (point-min)))) | ||
| 3410 | t) | ||
| 3411 | (looking-at outline-regexp)) | ||
| 3412 | (show-branches) | ||
| 3413 | (if (bobp) (throw 'exit nil)))))) | ||
| 3414 | |||
| 3415 | |||
| 2954 | (defun org-optimize-window-after-visibility-change (state) | 3416 | (defun org-optimize-window-after-visibility-change (state) |
| 2955 | "Adjust the window after a change in outline visibility. | 3417 | "Adjust the window after a change in outline visibility. |
| 2956 | This function is the default value of the hook `org-cycle-hook'." | 3418 | This function is the default value of the hook `org-cycle-hook'." |
| @@ -3071,7 +3533,6 @@ or nil." | |||
| 3071 | (kill-buffer "*org-goto*") | 3533 | (kill-buffer "*org-goto*") |
| 3072 | org-selected-point)) | 3534 | org-selected-point)) |
| 3073 | 3535 | ||
| 3074 | ;; FIXME: It may not be a good idea to temper with the prefix argument... | ||
| 3075 | (defun org-goto-ret (&optional arg) | 3536 | (defun org-goto-ret (&optional arg) |
| 3076 | "Finish `org-goto' by going to the new location." | 3537 | "Finish `org-goto' by going to the new location." |
| 3077 | (interactive "P") | 3538 | (interactive "P") |
| @@ -3114,26 +3575,38 @@ or nil." | |||
| 3114 | "To temporarily disable the active region.") | 3575 | "To temporarily disable the active region.") |
| 3115 | 3576 | ||
| 3116 | (defun org-insert-heading (&optional force-heading) | 3577 | (defun org-insert-heading (&optional force-heading) |
| 3117 | "Insert a new heading or item with same depth at point." | 3578 | "Insert a new heading or item with same depth at point. |
| 3579 | If point is in a plain list and FORCE-HEADING is nil, create a new list item. | ||
| 3580 | If point is at the beginning of a headline, insert a sibling before the | ||
| 3581 | current headline. If point is in the middle of a headline, split the headline | ||
| 3582 | at that position and make the rest of the headline part of the sibling below | ||
| 3583 | the current headline." | ||
| 3118 | (interactive "P") | 3584 | (interactive "P") |
| 3119 | (when (or force-heading (not (org-insert-item))) | 3585 | (if (= (buffer-size) 0) |
| 3120 | (let* ((head (save-excursion | 3586 | (insert "\n* ") |
| 3121 | (condition-case nil | 3587 | (when (or force-heading (not (org-insert-item))) |
| 3122 | (org-back-to-heading) | 3588 | (let* ((head (save-excursion |
| 3123 | (error (outline-next-heading))) | 3589 | (condition-case nil |
| 3124 | (prog1 (match-string 0) | 3590 | (progn |
| 3125 | (funcall outline-level))))) | 3591 | (org-back-to-heading) |
| 3126 | (cond | 3592 | (match-string 0)) |
| 3127 | ((and (org-on-heading-p) (bolp) | 3593 | (error "*")))) |
| 3128 | (save-excursion (backward-char 1) (not (org-invisible-p)))) | 3594 | pos) |
| 3129 | (open-line 1)) | 3595 | (cond |
| 3130 | ((bolp) nil) | 3596 | ((and (org-on-heading-p) (bolp) |
| 3131 | (t (newline))) | 3597 | (save-excursion (backward-char 1) (not (org-invisible-p)))) |
| 3132 | (insert head) | 3598 | (open-line 1)) |
| 3133 | (just-one-space) | 3599 | ((and (bolp) (save-excursion |
| 3134 | (run-hooks 'org-insert-heading-hook)))) | 3600 | (backward-char 1) (not (org-invisible-p)))) |
| 3135 | 3601 | nil) | |
| 3136 | (defun org-insert-item () | 3602 | (t (newline))) |
| 3603 | (insert head) (just-one-space) | ||
| 3604 | (setq pos (point)) | ||
| 3605 | (end-of-line 1) | ||
| 3606 | (unless (= (point) pos) (just-one-space) (backward-delete-char 1)) | ||
| 3607 | (run-hooks 'org-insert-heading-hook))))) | ||
| 3608 | |||
| 3609 | (defun org-insert-item (&optional checkbox) | ||
| 3137 | "Insert a new item at the current level. | 3610 | "Insert a new item at the current level. |
| 3138 | Return t when things worked, nil when we are not in an item." | 3611 | Return t when things worked, nil when we are not in an item." |
| 3139 | (when (save-excursion | 3612 | (when (save-excursion |
| @@ -3144,9 +3617,11 @@ Return t when things worked, nil when we are not in an item." | |||
| 3144 | t) | 3617 | t) |
| 3145 | (error nil))) | 3618 | (error nil))) |
| 3146 | (let* ((bul (match-string 0)) | 3619 | (let* ((bul (match-string 0)) |
| 3620 | (end (match-end 0)) | ||
| 3147 | (eow (save-excursion (beginning-of-line 1) (looking-at "[ \t]*") | 3621 | (eow (save-excursion (beginning-of-line 1) (looking-at "[ \t]*") |
| 3148 | (match-end 0))) | 3622 | (match-end 0))) |
| 3149 | (eowcol (save-excursion (goto-char eow) (current-column)))) | 3623 | (eowcol (save-excursion (goto-char eow) (current-column))) |
| 3624 | pos) | ||
| 3150 | (cond | 3625 | (cond |
| 3151 | ((and (org-at-item-p) (<= (point) eow)) | 3626 | ((and (org-at-item-p) (<= (point) eow)) |
| 3152 | ;; before the bullet | 3627 | ;; before the bullet |
| @@ -3155,8 +3630,11 @@ Return t when things worked, nil when we are not in an item." | |||
| 3155 | ((<= (point) eow) | 3630 | ((<= (point) eow) |
| 3156 | (beginning-of-line 1)) | 3631 | (beginning-of-line 1)) |
| 3157 | (t (newline))) | 3632 | (t (newline))) |
| 3158 | (insert bul) | 3633 | (insert bul (if checkbox "[ ]" "")) |
| 3159 | (just-one-space)) | 3634 | (just-one-space) |
| 3635 | (setq pos (point)) | ||
| 3636 | (end-of-line 1) | ||
| 3637 | (unless (= (point) pos) (just-one-space) (backward-delete-char 1))) | ||
| 3160 | (org-maybe-renumber-ordered-list) | 3638 | (org-maybe-renumber-ordered-list) |
| 3161 | t)) | 3639 | t)) |
| 3162 | 3640 | ||
| @@ -3165,16 +3643,19 @@ Return t when things worked, nil when we are not in an item." | |||
| 3165 | If the heading has no TODO state, or if the state is DONE, use the first | 3643 | If the heading has no TODO state, or if the state is DONE, use the first |
| 3166 | state (TODO by default). Also with prefix arg, force first state." | 3644 | state (TODO by default). Also with prefix arg, force first state." |
| 3167 | (interactive "P") | 3645 | (interactive "P") |
| 3168 | (org-insert-heading) | 3646 | (when (not (org-insert-item 'checkbox)) |
| 3169 | (save-excursion | 3647 | (org-insert-heading) |
| 3170 | (org-back-to-heading) | 3648 | (save-excursion |
| 3171 | (outline-previous-heading) | 3649 | (org-back-to-heading) |
| 3172 | (looking-at org-todo-line-regexp)) | 3650 | (if org-noutline-p |
| 3173 | (if (or arg | 3651 | (outline-previous-heading) |
| 3174 | (not (match-beginning 2)) | 3652 | (outline-previous-visible-heading t)) |
| 3175 | (equal (match-string 2) org-done-string)) | 3653 | (looking-at org-todo-line-regexp)) |
| 3176 | (insert (car org-todo-keywords) " ") | 3654 | (if (or arg |
| 3177 | (insert (match-string 2) " "))) | 3655 | (not (match-beginning 2)) |
| 3656 | (equal (match-string 2) org-done-string)) | ||
| 3657 | (insert (car org-todo-keywords) " ") | ||
| 3658 | (insert (match-string 2) " ")))) | ||
| 3178 | 3659 | ||
| 3179 | (defun org-promote-subtree () | 3660 | (defun org-promote-subtree () |
| 3180 | "Promote the entire subtree. | 3661 | "Promote the entire subtree. |
| @@ -3286,6 +3767,7 @@ in the region." | |||
| 3286 | (not (eobp))) | 3767 | (not (eobp))) |
| 3287 | (funcall fun))))) | 3768 | (funcall fun))))) |
| 3288 | 3769 | ||
| 3770 | ;; FIXME: this does not work well with Tabulators. This has to be re-written entirely. | ||
| 3289 | (defun org-fixup-indentation (from to prohibit) | 3771 | (defun org-fixup-indentation (from to prohibit) |
| 3290 | "Change the indentation in the current entry by re-replacing FROM with TO. | 3772 | "Change the indentation in the current entry by re-replacing FROM with TO. |
| 3291 | However, if the regexp PROHIBIT matches at all, don't do anything. | 3773 | However, if the regexp PROHIBIT matches at all, don't do anything. |
| @@ -3408,7 +3890,7 @@ If optional TREE is given, use this text instead of the kill ring." | |||
| 3408 | (error | 3890 | (error |
| 3409 | (substitute-command-keys | 3891 | (substitute-command-keys |
| 3410 | "The kill is not a (set of) tree(s) - please use \\[yank] to yank anyway"))) | 3892 | "The kill is not a (set of) tree(s) - please use \\[yank] to yank anyway"))) |
| 3411 | (let* ((txt (or tree (current-kill 0))) | 3893 | (let* ((txt (or tree (and kill-ring (current-kill 0)))) |
| 3412 | (^re (concat "^\\(" outline-regexp "\\)")) | 3894 | (^re (concat "^\\(" outline-regexp "\\)")) |
| 3413 | (re (concat "\\(" outline-regexp "\\)")) | 3895 | (re (concat "\\(" outline-regexp "\\)")) |
| 3414 | (^re_ (concat "\\(" outline-regexp "\\)[ \t]*")) | 3896 | (^re_ (concat "\\(" outline-regexp "\\)[ \t]*")) |
| @@ -3457,8 +3939,12 @@ If optional TREE is given, use this text instead of the kill ring." | |||
| 3457 | (progn (insert "\n") (backward-char 1))) | 3939 | (progn (insert "\n") (backward-char 1))) |
| 3458 | ;; Paste | 3940 | ;; Paste |
| 3459 | (setq beg (point)) | 3941 | (setq beg (point)) |
| 3942 | (if (string-match "[ \t\r\n]+\\'" txt) | ||
| 3943 | (setq txt (replace-match "\n" t t txt))) | ||
| 3460 | (insert txt) | 3944 | (insert txt) |
| 3461 | (setq end (point)) | 3945 | (setq end (point)) |
| 3946 | (if (looking-at "[ \t\r\n]+") | ||
| 3947 | (replace-match "\n")) | ||
| 3462 | (goto-char beg) | 3948 | (goto-char beg) |
| 3463 | ;; Shift if necessary | 3949 | ;; Shift if necessary |
| 3464 | (if (= shift 0) | 3950 | (if (= shift 0) |
| @@ -3471,7 +3957,8 @@ If optional TREE is given, use this text instead of the kill ring." | |||
| 3471 | (goto-char (point-min)) | 3957 | (goto-char (point-min)) |
| 3472 | (message "Pasted at level %d, with shift by %d levels" | 3958 | (message "Pasted at level %d, with shift by %d levels" |
| 3473 | new-level shift1))) | 3959 | new-level shift1))) |
| 3474 | (if (and (eq org-subtree-clip (current-kill 0)) | 3960 | (if (and kill-ring |
| 3961 | (eq org-subtree-clip (current-kill 0)) | ||
| 3475 | org-subtree-clip-folded) | 3962 | org-subtree-clip-folded) |
| 3476 | ;; The tree was folded before it was killed/copied | 3963 | ;; The tree was folded before it was killed/copied |
| 3477 | (hide-subtree)))) | 3964 | (hide-subtree)))) |
| @@ -3483,8 +3970,9 @@ headline level is not the largest headline level in the tree. | |||
| 3483 | So this will actually accept several entries of equal levels as well, | 3970 | So this will actually accept several entries of equal levels as well, |
| 3484 | which is OK for `org-paste-subtree'. | 3971 | which is OK for `org-paste-subtree'. |
| 3485 | If optional TXT is given, check this string instead of the current kill." | 3972 | If optional TXT is given, check this string instead of the current kill." |
| 3486 | (let* ((kill (or txt (current-kill 0) "")) | 3973 | (let* ((kill (or txt (and kill-ring (current-kill 0)) "")) |
| 3487 | (start-level (and (string-match (concat "\\`" outline-regexp) kill) | 3974 | (start-level (and kill |
| 3975 | (string-match (concat "\\`" outline-regexp) kill) | ||
| 3488 | (- (match-end 0) (match-beginning 0)))) | 3976 | (- (match-end 0) (match-beginning 0)))) |
| 3489 | (re (concat "^" outline-regexp)) | 3977 | (re (concat "^" outline-regexp)) |
| 3490 | (start 1)) | 3978 | (start 1)) |
| @@ -3510,16 +3998,60 @@ If optional TXT is given, check this string instead of the current kill." | |||
| 3510 | ((= llt ?\)) "\\([ \t]*\\([-+]\\|\\([0-9]+)\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") | 3998 | ((= llt ?\)) "\\([ \t]*\\([-+]\\|\\([0-9]+)\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") |
| 3511 | (t (error "Invalid value of `org-plain-list-ordered-item-terminator'"))))))) | 3999 | (t (error "Invalid value of `org-plain-list-ordered-item-terminator'"))))))) |
| 3512 | 4000 | ||
| 3513 | (defun org-get-indentation () | 4001 | (defun org-at-item-checkbox-p () |
| 3514 | "Get the indentation of the current line, interpreting tabs." | 4002 | "Is point at a line starting a plain-list item with a checklet?" |
| 4003 | (and (org-at-item-p) | ||
| 4004 | (save-excursion | ||
| 4005 | (goto-char (match-end 0)) | ||
| 4006 | (skip-chars-forward " \t") | ||
| 4007 | (looking-at "\\[[ X]\\]")))) | ||
| 4008 | |||
| 4009 | (defun org-toggle-checkbox () | ||
| 4010 | "Toggle the checkbox in the current line." | ||
| 4011 | (interactive) | ||
| 3515 | (save-excursion | 4012 | (save-excursion |
| 3516 | (beginning-of-line 1) | 4013 | (if (org-at-item-checkbox-p) |
| 3517 | (skip-chars-forward " \t") | 4014 | (replace-match (if (equal (match-string 0) "[ ]") "[X]" "[ ]") t t)))) |
| 3518 | (current-column))) | 4015 | |
| 4016 | (defun org-get-indentation (&optional line) | ||
| 4017 | "Get the indentation of the current line, interpreting tabs. | ||
| 4018 | When LINE is given, assume it represents a line and compute its indentation." | ||
| 4019 | (if line | ||
| 4020 | (if (string-match "^ *" (org-remove-tabs line)) | ||
| 4021 | (match-end 0)) | ||
| 4022 | (save-excursion | ||
| 4023 | (beginning-of-line 1) | ||
| 4024 | (skip-chars-forward " \t") | ||
| 4025 | (current-column)))) | ||
| 4026 | |||
| 4027 | (defun org-remove-tabs (s &optional width) | ||
| 4028 | "Replace tabulators in S with spaces. | ||
| 4029 | Assumes that s is a single line, starting in column 0." | ||
| 4030 | (setq width (or width tab-width)) | ||
| 4031 | (while (string-match "\t" s) | ||
| 4032 | (setq s (replace-match | ||
| 4033 | (make-string | ||
| 4034 | (- (* width (/ (+ (match-beginning 0) width) width)) | ||
| 4035 | (match-beginning 0)) ?\ ) | ||
| 4036 | t t s))) | ||
| 4037 | s) | ||
| 4038 | |||
| 4039 | ;; FIXME: document properly. | ||
| 4040 | (defun org-fix-indentation (line ind) | ||
| 4041 | "If the current indenation is smaller than ind1, leave it alone. | ||
| 4042 | If it is larger than ind, reduce it by ind." | ||
| 4043 | (let* ((l (org-remove-tabs line)) | ||
| 4044 | (i (org-get-indentation l)) | ||
| 4045 | (i1 (car ind)) (i2 (cdr ind))) | ||
| 4046 | (if (>= i i2) (setq l (substring line i2))) | ||
| 4047 | (if (> i1 0) | ||
| 4048 | (concat (make-string i1 ?\ ) l) | ||
| 4049 | l))) | ||
| 3519 | 4050 | ||
| 3520 | (defun org-beginning-of-item () | 4051 | (defun org-beginning-of-item () |
| 3521 | "Go to the beginning of the current hand-formatted item. | 4052 | "Go to the beginning of the current hand-formatted item. |
| 3522 | If the cursor is not in an item, throw an error." | 4053 | If the cursor is not in an item, throw an error." |
| 4054 | (interactive) | ||
| 3523 | (let ((pos (point)) | 4055 | (let ((pos (point)) |
| 3524 | (limit (save-excursion (org-back-to-heading) | 4056 | (limit (save-excursion (org-back-to-heading) |
| 3525 | (beginning-of-line 2) (point))) | 4057 | (beginning-of-line 2) (point))) |
| @@ -3545,6 +4077,7 @@ If the cursor is not in an item, throw an error." | |||
| 3545 | (defun org-end-of-item () | 4077 | (defun org-end-of-item () |
| 3546 | "Go to the end of the current hand-formatted item. | 4078 | "Go to the end of the current hand-formatted item. |
| 3547 | If the cursor is not in an item, throw an error." | 4079 | If the cursor is not in an item, throw an error." |
| 4080 | (interactive) | ||
| 3548 | (let ((pos (point)) | 4081 | (let ((pos (point)) |
| 3549 | (limit (save-excursion (outline-next-heading) (point))) | 4082 | (limit (save-excursion (outline-next-heading) (point))) |
| 3550 | (ind (save-excursion | 4083 | (ind (save-excursion |
| @@ -3564,11 +4097,47 @@ If the cursor is not in an item, throw an error." | |||
| 3564 | (goto-char pos) | 4097 | (goto-char pos) |
| 3565 | (error "Not in an item")))) | 4098 | (error "Not in an item")))) |
| 3566 | 4099 | ||
| 3567 | (defun org-move-item-down (arg) | 4100 | (defun org-next-item () |
| 4101 | "Move to the beginning of the next item in the current plain list. | ||
| 4102 | Error if not at a plain list, or if this is the last item in the list." | ||
| 4103 | (interactive) | ||
| 4104 | (let (beg end ind ind1 (pos (point)) txt) | ||
| 4105 | (org-beginning-of-item) | ||
| 4106 | (setq beg (point)) | ||
| 4107 | (setq ind (org-get-indentation)) | ||
| 4108 | (org-end-of-item) | ||
| 4109 | (setq end (point)) | ||
| 4110 | (setq ind1 (org-get-indentation)) | ||
| 4111 | (unless (and (org-at-item-p) (= ind ind1)) | ||
| 4112 | (goto-char pos) | ||
| 4113 | (error "On last item")))) | ||
| 4114 | |||
| 4115 | (defun org-previous-item () | ||
| 4116 | "Move to the beginning of the previous item in the current plain list. | ||
| 4117 | Error if not at a plain list, or if this is the last item in the list." | ||
| 4118 | (interactive) | ||
| 4119 | (let (beg end ind ind1 (pos (point)) txt) | ||
| 4120 | (org-beginning-of-item) | ||
| 4121 | (setq beg (point)) | ||
| 4122 | (setq ind (org-get-indentation)) | ||
| 4123 | (goto-char beg) | ||
| 4124 | (catch 'exit | ||
| 4125 | (while t | ||
| 4126 | (beginning-of-line 0) | ||
| 4127 | (if (looking-at "[ \t]*$") | ||
| 4128 | nil | ||
| 4129 | (if (<= (setq ind1 (org-get-indentation)) ind) | ||
| 4130 | (throw 'exit t))))) | ||
| 4131 | (condition-case nil | ||
| 4132 | (org-beginning-of-item) | ||
| 4133 | (error (goto-char pos) | ||
| 4134 | (error "On first item"))))) | ||
| 4135 | |||
| 4136 | (defun org-move-item-down () | ||
| 3568 | "Move the plain list item at point down, i.e. swap with following item. | 4137 | "Move the plain list item at point down, i.e. swap with following item. |
| 3569 | Subitems (items with larger indentation) are considered part of the item, | 4138 | Subitems (items with larger indentation) are considered part of the item, |
| 3570 | so this really moves item trees." | 4139 | so this really moves item trees." |
| 3571 | (interactive "p") | 4140 | (interactive) |
| 3572 | (let (beg end ind ind1 (pos (point)) txt) | 4141 | (let (beg end ind ind1 (pos (point)) txt) |
| 3573 | (org-beginning-of-item) | 4142 | (org-beginning-of-item) |
| 3574 | (setq beg (point)) | 4143 | (setq beg (point)) |
| @@ -3647,7 +4216,7 @@ doing the renumbering." | |||
| 3647 | 4216 | ||
| 3648 | (defun org-renumber-ordered-list (arg) | 4217 | (defun org-renumber-ordered-list (arg) |
| 3649 | "Renumber an ordered plain list. | 4218 | "Renumber an ordered plain list. |
| 3650 | Cursor next to be in the first line of an item, the line that starts | 4219 | Cursor needs to be in the first line of an item, the line that starts |
| 3651 | with something like \"1.\" or \"2)\"." | 4220 | with something like \"1.\" or \"2)\"." |
| 3652 | (interactive "p") | 4221 | (interactive "p") |
| 3653 | (unless (and (org-at-item-p) | 4222 | (unless (and (org-at-item-p) |
| @@ -3702,24 +4271,24 @@ with something like \"1.\" or \"2)\"." | |||
| 3702 | (interactive "p") | 4271 | (interactive "p") |
| 3703 | (unless (org-at-item-p) | 4272 | (unless (org-at-item-p) |
| 3704 | (error "Not on an item")) | 4273 | (error "Not on an item")) |
| 3705 | (let (beg end ind ind1) | 4274 | (save-excursion |
| 3706 | (if (memq last-command '(org-shiftmetaright org-shiftmetaleft)) | 4275 | (let (beg end ind ind1) |
| 4276 | (if (memq last-command '(org-shiftmetaright org-shiftmetaleft)) | ||
| 3707 | (setq beg org-last-indent-begin-marker | 4277 | (setq beg org-last-indent-begin-marker |
| 3708 | end org-last-indent-end-marker) | 4278 | end org-last-indent-end-marker) |
| 3709 | (org-beginning-of-item) | 4279 | (org-beginning-of-item) |
| 3710 | (setq beg (move-marker org-last-indent-begin-marker (point))) | 4280 | (setq beg (move-marker org-last-indent-begin-marker (point))) |
| 3711 | (org-end-of-item) | 4281 | (org-end-of-item) |
| 3712 | (setq end (move-marker org-last-indent-end-marker (point)))) | 4282 | (setq end (move-marker org-last-indent-end-marker (point)))) |
| 3713 | (goto-char beg) | 4283 | (goto-char beg) |
| 3714 | (skip-chars-forward " \t") (setq ind (current-column)) | 4284 | (skip-chars-forward " \t") (setq ind (current-column)) |
| 3715 | (if (< (+ arg ind) 0) (error "Cannot outdent beyond margin")) | 4285 | (if (< (+ arg ind) 0) (error "Cannot outdent beyond margin")) |
| 3716 | (while (< (point) end) | 4286 | (while (< (point) end) |
| 3717 | (beginning-of-line 1) | 4287 | (beginning-of-line 1) |
| 3718 | (skip-chars-forward " \t") (setq ind1 (current-column)) | 4288 | (skip-chars-forward " \t") (setq ind1 (current-column)) |
| 3719 | (delete-region (point-at-bol) (point)) | 4289 | (delete-region (point-at-bol) (point)) |
| 3720 | (indent-to-column (+ ind1 arg)) | 4290 | (indent-to-column (+ ind1 arg)) |
| 3721 | (beginning-of-line 2)) | 4291 | (beginning-of-line 2))))) |
| 3722 | (goto-char beg))) | ||
| 3723 | 4292 | ||
| 3724 | ;;; Archiving | 4293 | ;;; Archiving |
| 3725 | 4294 | ||
| @@ -3789,14 +4358,13 @@ heading be marked DONE, and the current time will be added." | |||
| 3789 | (or (bolp) (insert "\n")) | 4358 | (or (bolp) (insert "\n")) |
| 3790 | (insert "\n" heading "\n") | 4359 | (insert "\n" heading "\n") |
| 3791 | (end-of-line 0)) | 4360 | (end-of-line 0)) |
| 3792 | ;; Make the heading visible, and the following as well | 4361 | ;; Make the subtree visible |
| 3793 | (let ((org-show-following-heading t)) (org-show-hierarchy-above)) | 4362 | (show-subtree) |
| 3794 | (if (re-search-forward | 4363 | (org-end-of-subtree t) |
| 3795 | (concat "^" (regexp-quote (make-string level ?*)) "[ \t]") | 4364 | (skip-chars-backward " \t\r\n]") |
| 3796 | nil t) | 4365 | (and (looking-at "[ \t\r\n]*") |
| 3797 | (progn (goto-char (match-beginning 0)) (insert "\n") | 4366 | (replace-match "\n\n"))) |
| 3798 | (beginning-of-line 0)) | 4367 | ;; No specific heading, just go to end of file. |
| 3799 | (goto-char (point-max)) (insert "\n"))) | ||
| 3800 | (goto-char (point-max)) (insert "\n")) | 4368 | (goto-char (point-max)) (insert "\n")) |
| 3801 | ;; Paste | 4369 | ;; Paste |
| 3802 | (org-paste-subtree (1+ level)) | 4370 | (org-paste-subtree (1+ level)) |
| @@ -3816,7 +4384,7 @@ heading be marked DONE, and the current time will be added." | |||
| 3816 | ;; Here we are back in the original buffer. Everything seems to have | 4384 | ;; Here we are back in the original buffer. Everything seems to have |
| 3817 | ;; worked. So now cut the tree and finish up. | 4385 | ;; worked. So now cut the tree and finish up. |
| 3818 | (let (this-command) (org-cut-subtree)) | 4386 | (let (this-command) (org-cut-subtree)) |
| 3819 | (if (looking-at "[ \t]*$") (kill-line)) | 4387 | (if (and (not (eobp)) (looking-at "[ \t]*$")) (kill-line)) |
| 3820 | (message "Subtree archived %s" | 4388 | (message "Subtree archived %s" |
| 3821 | (if (eq this-buffer buffer) | 4389 | (if (eq this-buffer buffer) |
| 3822 | (concat "under heading: " heading) | 4390 | (concat "under heading: " heading) |
| @@ -3844,6 +4412,7 @@ At all other locations, this simply calls `ispell-complete-word'." | |||
| 3844 | (if (equal (char-before (point)) ?\ ) (backward-char 1)) | 4412 | (if (equal (char-before (point)) ?\ ) (backward-char 1)) |
| 3845 | (skip-chars-backward "a-zA-Z0-9_:$") | 4413 | (skip-chars-backward "a-zA-Z0-9_:$") |
| 3846 | (point))) | 4414 | (point))) |
| 4415 | (confirm (lambda (x) (stringp (car x)))) | ||
| 3847 | (camel (equal (char-before beg) ?*)) | 4416 | (camel (equal (char-before beg) ?*)) |
| 3848 | (tag (equal (char-before beg1) ?:)) | 4417 | (tag (equal (char-before beg1) ?:)) |
| 3849 | (texp (equal (char-before beg) ?\\)) | 4418 | (texp (equal (char-before beg) ?\\)) |
| @@ -3880,10 +4449,10 @@ At all other locations, this simply calls `ispell-complete-word'." | |||
| 3880 | tbl))) | 4449 | tbl))) |
| 3881 | tbl) | 4450 | tbl) |
| 3882 | (tag (setq type :tag beg beg1) | 4451 | (tag (setq type :tag beg beg1) |
| 3883 | (org-get-buffer-tags)) | 4452 | (or org-tag-alist (org-get-buffer-tags))) |
| 3884 | (t (progn (ispell-complete-word arg) (throw 'exit nil))))) | 4453 | (t (progn (ispell-complete-word arg) (throw 'exit nil))))) |
| 3885 | (pattern (buffer-substring-no-properties beg end)) | 4454 | (pattern (buffer-substring-no-properties beg end)) |
| 3886 | (completion (try-completion pattern table))) | 4455 | (completion (try-completion pattern table confirm))) |
| 3887 | (cond ((eq completion t) | 4456 | (cond ((eq completion t) |
| 3888 | (if (equal type :opt) | 4457 | (if (equal type :opt) |
| 3889 | (insert (substring (cdr (assoc (upcase pattern) table)) | 4458 | (insert (substring (cdr (assoc (upcase pattern) table)) |
| @@ -3906,7 +4475,8 @@ At all other locations, this simply calls `ispell-complete-word'." | |||
| 3906 | "Press \\[org-complete] again to insert example settings")))) | 4475 | "Press \\[org-complete] again to insert example settings")))) |
| 3907 | (t | 4476 | (t |
| 3908 | (message "Making completion list...") | 4477 | (message "Making completion list...") |
| 3909 | (let ((list (sort (all-completions pattern table) 'string<))) | 4478 | (let ((list (sort (all-completions pattern table confirm) |
| 4479 | 'string<))) | ||
| 3910 | (with-output-to-temp-buffer "*Completions*" | 4480 | (with-output-to-temp-buffer "*Completions*" |
| 3911 | (condition-case nil | 4481 | (condition-case nil |
| 3912 | ;; Protection needed for XEmacs and emacs 21 | 4482 | ;; Protection needed for XEmacs and emacs 21 |
| @@ -3960,44 +4530,44 @@ prefix arg, switch to that state." | |||
| 3960 | (member (member this org-todo-keywords)) | 4530 | (member (member this org-todo-keywords)) |
| 3961 | (tail (cdr member)) | 4531 | (tail (cdr member)) |
| 3962 | (state (cond | 4532 | (state (cond |
| 3963 | ((equal arg '(4)) | 4533 | ((equal arg '(4)) |
| 3964 | ;; Read a state with completion | 4534 | ;; Read a state with completion |
| 3965 | (completing-read "State: " (mapcar (lambda(x) (list x)) | 4535 | (completing-read "State: " (mapcar (lambda(x) (list x)) |
| 3966 | org-todo-keywords) | 4536 | org-todo-keywords) |
| 3967 | nil t)) | 4537 | nil t)) |
| 3968 | ((eq arg 'right) | 4538 | ((eq arg 'right) |
| 3969 | (if this | 4539 | (if this |
| 3970 | (if tail (car tail) nil) | 4540 | (if tail (car tail) nil) |
| 3971 | (car org-todo-keywords))) | 4541 | (car org-todo-keywords))) |
| 3972 | ((eq arg 'left) | 4542 | ((eq arg 'left) |
| 3973 | (if (equal member org-todo-keywords) | 4543 | (if (equal member org-todo-keywords) |
| 3974 | nil | 4544 | nil |
| 3975 | (if this | 4545 | (if this |
| 3976 | (nth (- (length org-todo-keywords) (length tail) 2) | 4546 | (nth (- (length org-todo-keywords) (length tail) 2) |
| 3977 | org-todo-keywords) | 4547 | org-todo-keywords) |
| 3978 | org-done-string))) | 4548 | org-done-string))) |
| 3979 | (arg | 4549 | (arg |
| 3980 | ;; user requests a specific state | 4550 | ;; user requests a specific state |
| 3981 | (nth (1- (prefix-numeric-value arg)) | 4551 | (nth (1- (prefix-numeric-value arg)) |
| 3982 | org-todo-keywords)) | 4552 | org-todo-keywords)) |
| 3983 | ((null member) (car org-todo-keywords)) | 4553 | ((null member) (car org-todo-keywords)) |
| 3984 | ((null tail) nil) ;; -> first entry | 4554 | ((null tail) nil) ;; -> first entry |
| 3985 | ((eq org-todo-interpretation 'sequence) | 4555 | ((eq org-todo-interpretation 'sequence) |
| 3986 | (car tail)) | 4556 | (car tail)) |
| 3987 | ((memq org-todo-interpretation '(type priority)) | 4557 | ((memq org-todo-interpretation '(type priority)) |
| 3988 | (if (eq this-command last-command) | 4558 | (if (eq this-command last-command) |
| 3989 | (car tail) | 4559 | (car tail) |
| 3990 | (if (> (length tail) 0) org-done-string nil))) | 4560 | (if (> (length tail) 0) org-done-string nil))) |
| 3991 | (t nil))) | 4561 | (t nil))) |
| 3992 | (next (if state (concat " " state " ") " "))) | 4562 | (next (if state (concat " " state " ") " "))) |
| 3993 | (replace-match next t t) | 4563 | (replace-match next t t) |
| 3994 | (setq org-last-todo-state-is-todo | 4564 | (setq org-last-todo-state-is-todo |
| 3995 | (not (equal state org-done-string))) | 4565 | (not (equal state org-done-string))) |
| 3996 | (when org-log-done | 4566 | (when org-log-done |
| 3997 | (if (equal state org-done-string) | 4567 | (if (equal state org-done-string) |
| 3998 | (org-log-done) | 4568 | (org-add-planning-info 'closed (current-time) 'scheduled) |
| 3999 | (if (not this) | 4569 | (if (not this) |
| 4000 | (org-log-done t)))) | 4570 | (org-add-planning-info nil nil 'closed)))) |
| 4001 | ;; Fixup tag positioning | 4571 | ;; Fixup tag positioning |
| 4002 | (and org-auto-align-tags (org-set-tags nil t)) | 4572 | (and org-auto-align-tags (org-set-tags nil t)) |
| 4003 | (run-hooks 'org-after-todo-state-change-hook))) | 4573 | (run-hooks 'org-after-todo-state-change-hook))) |
| @@ -4067,25 +4637,80 @@ of `org-todo-keywords'." | |||
| 4067 | A timestamp is also inserted - use \\[org-timestamp-up] and \\[org-timestamp-down] | 4637 | A timestamp is also inserted - use \\[org-timestamp-up] and \\[org-timestamp-down] |
| 4068 | to modify it to the correct date." | 4638 | to modify it to the correct date." |
| 4069 | (interactive) | 4639 | (interactive) |
| 4070 | (insert | 4640 | (org-add-planning-info 'deadline nil 'closed)) |
| 4071 | org-deadline-string " " | ||
| 4072 | (format-time-string (car org-time-stamp-formats) | ||
| 4073 | (org-read-date nil 'to-time))) | ||
| 4074 | (message "%s" (substitute-command-keys | ||
| 4075 | "Use \\[org-timestamp-up-day] and \\[org-timestamp-down-day] to change the date."))) | ||
| 4076 | 4641 | ||
| 4077 | (defun org-schedule () | 4642 | (defun org-schedule () |
| 4078 | "Insert the SCHEDULED: string to schedule a TODO item. | 4643 | "Insert the SCHEDULED: string to schedule a TODO item. |
| 4079 | A timestamp is also inserted - use \\[org-timestamp-up] and \\[org-timestamp-down] | 4644 | A timestamp is also inserted - use \\[org-timestamp-up] and \\[org-timestamp-down] |
| 4080 | to modify it to the correct date." | 4645 | to modify it to the correct date." |
| 4081 | (interactive) | 4646 | (interactive) |
| 4082 | (insert | 4647 | (org-add-planning-info 'scheduled nil 'closed)) |
| 4083 | org-scheduled-string " " | 4648 | |
| 4084 | (format-time-string (car org-time-stamp-formats) | 4649 | (defun org-add-planning-info (what &optional time &rest remove) |
| 4085 | (org-read-date nil 'to-time))) | 4650 | "Insert new timestamp with keyword in the line directly after the headline. |
| 4086 | (message "%s" (substitute-command-keys | 4651 | WHAT indicates what kind of time stamp to add. TIME indicated the time to use. |
| 4087 | "Use \\[org-timestamp-up-day] and \\[org-timestamp-down-day] to change the date."))) | 4652 | If non is given, the user is prompted for a date. |
| 4088 | 4653 | REMOVE indicates what kind of entries to remove. An old WHAT entry will also | |
| 4654 | be removed." | ||
| 4655 | (interactive) | ||
| 4656 | (when what (setq time (or time (org-read-date nil 'to-time)))) | ||
| 4657 | (when (and org-insert-labeled-timestamps-at-point | ||
| 4658 | (member what '(scheduled deadline))) | ||
| 4659 | (insert | ||
| 4660 | (if (eq what 'scheduled) org-scheduled-string org-deadline-string) | ||
| 4661 | " " | ||
| 4662 | (format-time-string (car org-time-stamp-formats) time)) | ||
| 4663 | (setq what nil)) | ||
| 4664 | (save-excursion | ||
| 4665 | (let (beg end col list elt (buffer-invisibility-spec nil) ts) | ||
| 4666 | (org-back-to-heading t) | ||
| 4667 | (setq beg (point)) | ||
| 4668 | (looking-at (concat outline-regexp "\\( *\\)[^\r\n]*")) | ||
| 4669 | (goto-char (match-end 1)) | ||
| 4670 | (setq col (current-column)) | ||
| 4671 | (goto-char (1+ (match-end 0))) | ||
| 4672 | (if (and (not (looking-at outline-regexp)) | ||
| 4673 | (looking-at (concat "[^\r\n]*?" org-keyword-time-regexp | ||
| 4674 | "[^\r\n]*")) | ||
| 4675 | (not (equal (match-string 1) org-clock-string))) | ||
| 4676 | (narrow-to-region (match-beginning 0) (match-end 0)) | ||
| 4677 | (insert "\n") | ||
| 4678 | (backward-char 1) | ||
| 4679 | (narrow-to-region (point) (point)) | ||
| 4680 | (indent-to-column col)) | ||
| 4681 | ;; Check if we have to remove something. | ||
| 4682 | (setq list (cons what remove)) | ||
| 4683 | (while list | ||
| 4684 | (setq elt (pop list)) | ||
| 4685 | (goto-char (point-min)) | ||
| 4686 | (when (or (and (eq elt 'scheduled) | ||
| 4687 | (re-search-forward org-scheduled-time-regexp nil t)) | ||
| 4688 | (and (eq elt 'deadline) | ||
| 4689 | (re-search-forward org-deadline-time-regexp nil t)) | ||
| 4690 | (and (eq elt 'closed) | ||
| 4691 | (re-search-forward org-closed-time-regexp nil t))) | ||
| 4692 | (replace-match "") | ||
| 4693 | (if (looking-at " +") (replace-match "")))) | ||
| 4694 | (goto-char (point-max)) | ||
| 4695 | (when what | ||
| 4696 | (insert | ||
| 4697 | (if (not (equal (char-before) ?\ )) " " "") | ||
| 4698 | (cond ((eq what 'scheduled) org-scheduled-string) | ||
| 4699 | ((eq what 'deadline) org-deadline-string) | ||
| 4700 | ((eq what 'closed) org-closed-string)) | ||
| 4701 | " ") | ||
| 4702 | (insert | ||
| 4703 | (setq ts | ||
| 4704 | (format-time-string | ||
| 4705 | (if (eq what 'closed) | ||
| 4706 | (concat "[" (substring (cdr org-time-stamp-formats) 1 -1) "]") | ||
| 4707 | (car org-time-stamp-formats)) | ||
| 4708 | time)))) | ||
| 4709 | (goto-char (point-min)) | ||
| 4710 | (widen) | ||
| 4711 | (if (looking-at "[ \t]+\r?\n") | ||
| 4712 | (replace-match "")) | ||
| 4713 | ts))) | ||
| 4089 | 4714 | ||
| 4090 | (defun org-occur (regexp &optional callback) | 4715 | (defun org-occur (regexp &optional callback) |
| 4091 | "Make a compact tree which shows all matches of REGEXP. | 4716 | "Make a compact tree which shows all matches of REGEXP. |
| @@ -4100,7 +4725,7 @@ that the match should indeed be shown." | |||
| 4100 | (let ((cnt 0)) | 4725 | (let ((cnt 0)) |
| 4101 | (save-excursion | 4726 | (save-excursion |
| 4102 | (goto-char (point-min)) | 4727 | (goto-char (point-min)) |
| 4103 | (hide-sublevels 1) | 4728 | (org-overview) |
| 4104 | (while (re-search-forward regexp nil t) | 4729 | (while (re-search-forward regexp nil t) |
| 4105 | (when (or (not callback) | 4730 | (when (or (not callback) |
| 4106 | (save-match-data (funcall callback))) | 4731 | (save-match-data (funcall callback))) |
| @@ -4340,7 +4965,7 @@ used to insert the time stamp into the buffer to include the time." | |||
| 4340 | ;; the range start. | 4965 | ;; the range start. |
| 4341 | (if (save-excursion | 4966 | (if (save-excursion |
| 4342 | (re-search-backward | 4967 | (re-search-backward |
| 4343 | (concat org-ts-regexp "--\\=") ; FIXME: exactly two minuses? | 4968 | (concat org-ts-regexp "--?-?\\=") ; 1-3 minuses |
| 4344 | (- (point) 20) t)) | 4969 | (- (point) 20) t)) |
| 4345 | (apply | 4970 | (apply |
| 4346 | 'encode-time | 4971 | 'encode-time |
| @@ -4348,8 +4973,8 @@ used to insert the time stamp into the buffer to include the time." | |||
| 4348 | (parse-time-string (match-string 1)))) | 4973 | (parse-time-string (match-string 1)))) |
| 4349 | ct)) | 4974 | ct)) |
| 4350 | (calendar-move-hook nil) | 4975 | (calendar-move-hook nil) |
| 4351 | (view-calendar-holidays-initially nil) | ||
| 4352 | (view-diary-entries-initially nil) | 4976 | (view-diary-entries-initially nil) |
| 4977 | (view-calendar-holidays-initially nil) | ||
| 4353 | (timestr (format-time-string | 4978 | (timestr (format-time-string |
| 4354 | (if with-time "%Y-%m-%d %H:%M" "%Y-%m-%d") default-time)) | 4979 | (if with-time "%Y-%m-%d %H:%M" "%Y-%m-%d") default-time)) |
| 4355 | (prompt (format "YYYY-MM-DD [%s]: " timestr)) | 4980 | (prompt (format "YYYY-MM-DD [%s]: " timestr)) |
| @@ -4745,6 +5370,193 @@ If there is already a time stamp at the cursor position, update it." | |||
| 4745 | (interactive) | 5370 | (interactive) |
| 4746 | (org-timestamp-change 0 'calendar)) | 5371 | (org-timestamp-change 0 'calendar)) |
| 4747 | 5372 | ||
| 5373 | ;;; The clock for measuring work time. | ||
| 5374 | |||
| 5375 | (defvar org-clock-marker (make-marker) | ||
| 5376 | "Marker recording the last clock-in.") | ||
| 5377 | |||
| 5378 | (defun org-clock-in () | ||
| 5379 | "Start the clock on the current item. | ||
| 5380 | If necessary, clock-out of the currently active clock." | ||
| 5381 | (interactive) | ||
| 5382 | (org-clock-out t) | ||
| 5383 | (let (ts) | ||
| 5384 | (save-excursion | ||
| 5385 | (org-back-to-heading t) | ||
| 5386 | (beginning-of-line 2) | ||
| 5387 | (if (and (looking-at (concat "[ \t]*" org-keyword-time-regexp)) | ||
| 5388 | (not (equal (match-string 1) org-clock-string))) | ||
| 5389 | (beginning-of-line 1)) | ||
| 5390 | (insert "\n") (backward-char 1) | ||
| 5391 | (indent-relative) | ||
| 5392 | (insert org-clock-string " " | ||
| 5393 | (setq ts (concat "[" (format-time-string | ||
| 5394 | (substring | ||
| 5395 | (cdr org-time-stamp-formats) 1 -1) | ||
| 5396 | (current-time)) | ||
| 5397 | "]"))) | ||
| 5398 | (move-marker org-clock-marker (point)) | ||
| 5399 | (message "Clock started at %s" ts)))) | ||
| 5400 | |||
| 5401 | (defun org-clock-out (&optional fail-quietly) | ||
| 5402 | "Stop the currently running clock. | ||
| 5403 | If there is no running clock, throw an error, unless FAIL-QUIETLY is set." | ||
| 5404 | (interactive) | ||
| 5405 | (catch 'exit | ||
| 5406 | (if (not (marker-buffer org-clock-marker)) | ||
| 5407 | (if fail-quietly (throw 'exit t) (error "No active clock"))) | ||
| 5408 | (let (ts te s h m) | ||
| 5409 | (save-excursion | ||
| 5410 | (set-buffer (marker-buffer org-clock-marker)) | ||
| 5411 | (goto-char org-clock-marker) | ||
| 5412 | (beginning-of-line 1) | ||
| 5413 | (if (and (looking-at (concat "[ \t]*" org-keyword-time-regexp)) | ||
| 5414 | (equal (match-string 1) org-clock-string)) | ||
| 5415 | (setq ts (match-string 2)) | ||
| 5416 | (if fail-quietly (throw 'exit nil) (error "Clock start time is gone"))) | ||
| 5417 | (goto-char org-clock-marker) | ||
| 5418 | (setq te (concat "[" (format-time-string | ||
| 5419 | (substring | ||
| 5420 | (cdr org-time-stamp-formats) 1 -1) | ||
| 5421 | (current-time)) | ||
| 5422 | "]")) | ||
| 5423 | (setq s (- (time-to-seconds (apply 'encode-time (org-parse-time-string te))) | ||
| 5424 | (time-to-seconds (apply 'encode-time (org-parse-time-string ts)))) | ||
| 5425 | h (floor (/ s 3600)) | ||
| 5426 | s (- s (* 3600 h)) | ||
| 5427 | m (floor (/ s 60)) | ||
| 5428 | s (- s (* 60 s))) | ||
| 5429 | (insert "--" te " => " (format "%2d:%02d" h m)) | ||
| 5430 | (move-marker org-clock-marker nil) | ||
| 5431 | (message "Clock stopped at %s after HH:MM = %d:%02d" te h m))))) | ||
| 5432 | |||
| 5433 | (defun org-clock-cancel () | ||
| 5434 | "Cancel the running clock be removing the start timestamp." | ||
| 5435 | (interactive) | ||
| 5436 | (if (not (marker-buffer org-clock-marker)) | ||
| 5437 | (error "No active clock")) | ||
| 5438 | (save-excursion | ||
| 5439 | (set-buffer (marker-buffer org-clock-marker)) | ||
| 5440 | (goto-char org-clock-marker) | ||
| 5441 | (delete-region (1- (point-at-bol)) (point-at-eol))) | ||
| 5442 | (message "Clock canceled")) | ||
| 5443 | |||
| 5444 | (defvar org-clock-file-total-minutes nil | ||
| 5445 | "Holds the file total time in minutes, after a call to `org-clock-sum'.") | ||
| 5446 | (make-variable-buffer-local 'org-clock-file-total-minutes) | ||
| 5447 | |||
| 5448 | (defun org-clock-sum () | ||
| 5449 | "Sum the times for each subtree. | ||
| 5450 | Puts the resulting times in minutes as a text property on each headline." | ||
| 5451 | (interactive) | ||
| 5452 | (remove-text-properties (point-min) (point-max) '(:org-clock-minutes t)) | ||
| 5453 | (let* ((re (concat "^\\(\\*+\\)[ \t]\\|^[ \t]*" | ||
| 5454 | org-clock-string | ||
| 5455 | ".*=>[ \t]*\\([0-9]+\\):\\([0-9]+\\)[ \t]*$")) | ||
| 5456 | (lmax 30) | ||
| 5457 | (ltimes (make-vector lmax 0)) | ||
| 5458 | (t1 0) | ||
| 5459 | (level 0) | ||
| 5460 | (lastlevel 0) time) | ||
| 5461 | (save-excursion | ||
| 5462 | (goto-char (point-max)) | ||
| 5463 | (while (re-search-backward re nil t) | ||
| 5464 | (if (match-end 2) | ||
| 5465 | ;; A time | ||
| 5466 | (setq t1 (+ t1 (* 60 (string-to-number (match-string 2))) | ||
| 5467 | (string-to-number (match-string 3)))) | ||
| 5468 | ;; A headline | ||
| 5469 | (setq level (- (match-end 1) (match-beginning 1))) | ||
| 5470 | (when (or (> t1 0) (> (aref ltimes level) 0)) | ||
| 5471 | (loop for l from 0 to level do | ||
| 5472 | (aset ltimes l (+ (aref ltimes l) t1))) | ||
| 5473 | (setq t1 0 time (aref ltimes level)) | ||
| 5474 | (loop for l from level to (1- lmax) do | ||
| 5475 | (aset ltimes l 0)) | ||
| 5476 | (goto-char (match-beginning 0)) | ||
| 5477 | (put-text-property (point) (point-at-eol) :org-clock-minutes time)))) | ||
| 5478 | (setq org-clock-file-total-minutes (aref ltimes 0))))) | ||
| 5479 | |||
| 5480 | (defun org-clock-display (&optional total-only) | ||
| 5481 | "Show subtree times in the entire buffer. | ||
| 5482 | If TOTAL-ONLY is non-nil, only show the total time for the entire file | ||
| 5483 | in the echo area." | ||
| 5484 | (interactive) | ||
| 5485 | (org-remove-clock-overlays) | ||
| 5486 | (let (time h m p) | ||
| 5487 | (org-clock-sum) | ||
| 5488 | (unless total-only | ||
| 5489 | (save-excursion | ||
| 5490 | (goto-char (point-min)) | ||
| 5491 | (while (setq p (next-single-property-change (point) :org-clock-minutes)) | ||
| 5492 | (goto-char p) | ||
| 5493 | (when (setq time (get-text-property p :org-clock-minutes)) | ||
| 5494 | (org-put-clock-overlay time (funcall outline-level)))) | ||
| 5495 | (setq h (/ org-clock-file-total-minutes 60) | ||
| 5496 | m (- org-clock-file-total-minutes (* 60 h))) | ||
| 5497 | ;; Arrange to remove the overlays upon next change. | ||
| 5498 | (org-add-hook 'before-change-functions 'org-remove-clock-overlays | ||
| 5499 | nil 'local))) | ||
| 5500 | (message "Total file time: %d:%02d (%d hours and %d minutes)" h m h m))) | ||
| 5501 | |||
| 5502 | (defvar org-clock-overlays nil) | ||
| 5503 | (defun org-put-clock-overlay (time &optional level) | ||
| 5504 | "Put an overlays on the current line, displaying TIME. | ||
| 5505 | If LEVEL is given, prefix time with a corresponding number of stars. | ||
| 5506 | This creates a new overlay and stores it in `org-clock-overlays', so that it | ||
| 5507 | will be easy to remove." | ||
| 5508 | (let* ((c 60) (h (floor (/ time 60))) (m (- time (* 60 h))) | ||
| 5509 | (l (if level (org-get-legal-level level 0) 0)) | ||
| 5510 | (off 0) | ||
| 5511 | ov tx) | ||
| 5512 | (move-to-column c) | ||
| 5513 | (if (eolp) (setq off 1)) | ||
| 5514 | (unless (eolp) (skip-chars-backward "^ \t")) | ||
| 5515 | (skip-chars-backward " \t") | ||
| 5516 | (setq ov (org-make-overlay (- (point) off) (point-at-eol)) | ||
| 5517 | tx (concat (make-string (+ off (max 0 (- c (current-column)))) ?.) | ||
| 5518 | (org-add-props (format "%s %2d:%02d%s" | ||
| 5519 | (make-string l ?*) h m | ||
| 5520 | (make-string (- 10 l) ?\ )) | ||
| 5521 | '(face secondary-selection)) | ||
| 5522 | "")) | ||
| 5523 | (org-overlay-put ov 'display tx) | ||
| 5524 | (push ov org-clock-overlays))) | ||
| 5525 | |||
| 5526 | (defun org-remove-clock-overlays (&optional beg end noremove) | ||
| 5527 | "Remove the occur highlights from the buffer. | ||
| 5528 | BEG and END are ignored. If NOREMOVE is nil, remove this function | ||
| 5529 | from the `before-change-functions' in the current buffer." | ||
| 5530 | (interactive) | ||
| 5531 | (mapc 'org-delete-overlay org-clock-overlays) | ||
| 5532 | (setq org-clock-overlays nil) | ||
| 5533 | (unless noremove | ||
| 5534 | (remove-hook 'before-change-functions | ||
| 5535 | 'org-remove-clock-overlays 'local))) | ||
| 5536 | |||
| 5537 | (defun org-clock-out-if-current () | ||
| 5538 | "Clock out if the current entry contains the running clock. | ||
| 5539 | This is used to stop the clock after a TODO entry is marked DONE." | ||
| 5540 | (when (and (equal state org-done-string) | ||
| 5541 | (equal (marker-buffer org-clock-marker) (current-buffer)) | ||
| 5542 | (< (point) org-clock-marker) | ||
| 5543 | (> (save-excursion (outline-next-heading) (point)) | ||
| 5544 | org-clock-marker)) | ||
| 5545 | (org-clock-out))) | ||
| 5546 | |||
| 5547 | (add-hook 'org-after-todo-state-change-hook | ||
| 5548 | 'org-clock-out-if-current) | ||
| 5549 | |||
| 5550 | (defun org-check-running-clock () | ||
| 5551 | "Check if the current buffer contains the running clock. | ||
| 5552 | If yes, offer to stop it and to save the buffer with the changes." | ||
| 5553 | (when (and (equal (marker-buffer org-clock-marker) (current-buffer)) | ||
| 5554 | (y-or-n-p (format "Clock-out in buffer %s before killing it? " | ||
| 5555 | (buffer-name)))) | ||
| 5556 | (org-clock-out) | ||
| 5557 | (when (y-or-n-p "Save changed buffer?") | ||
| 5558 | (save-buffer)))) | ||
| 5559 | |||
| 4748 | ;;; Agenda, and Diary Integration | 5560 | ;;; Agenda, and Diary Integration |
| 4749 | 5561 | ||
| 4750 | ;;; Define the mode | 5562 | ;;; Define the mode |
| @@ -4761,7 +5573,6 @@ If there is already a time stamp at the cursor position, update it." | |||
| 4761 | (defvar org-agenda-type nil) | 5573 | (defvar org-agenda-type nil) |
| 4762 | (defvar org-agenda-force-single-file nil) | 5574 | (defvar org-agenda-force-single-file nil) |
| 4763 | 5575 | ||
| 4764 | ;;;###autoload | ||
| 4765 | (defun org-agenda-mode () | 5576 | (defun org-agenda-mode () |
| 4766 | "Mode for time-sorted view on action items in Org-mode files. | 5577 | "Mode for time-sorted view on action items in Org-mode files. |
| 4767 | 5578 | ||
| @@ -4778,7 +5589,7 @@ The following commands are available: | |||
| 4778 | (org-add-hook 'post-command-hook 'org-agenda-post-command-hook nil 'local) | 5589 | (org-add-hook 'post-command-hook 'org-agenda-post-command-hook nil 'local) |
| 4779 | (org-add-hook 'pre-command-hook 'org-unhighlight nil 'local) | 5590 | (org-add-hook 'pre-command-hook 'org-unhighlight nil 'local) |
| 4780 | (unless org-agenda-keep-modes | 5591 | (unless org-agenda-keep-modes |
| 4781 | (setq org-agenda-follow-mode nil | 5592 | (setq org-agenda-follow-mode org-agenda-start-with-follow-mode |
| 4782 | org-agenda-show-log nil)) | 5593 | org-agenda-show-log nil)) |
| 4783 | (easy-menu-change | 5594 | (easy-menu-change |
| 4784 | '("Agenda") "Agenda Files" | 5595 | '("Agenda") "Agenda Files" |
| @@ -4815,6 +5626,8 @@ The following commands are available: | |||
| 4815 | (define-key org-agenda-mode-map [?\C-c ?\C-x (left)] 'org-agenda-date-earlier) | 5626 | (define-key org-agenda-mode-map [?\C-c ?\C-x (left)] 'org-agenda-date-earlier) |
| 4816 | 5627 | ||
| 4817 | (define-key org-agenda-mode-map ">" 'org-agenda-date-prompt) | 5628 | (define-key org-agenda-mode-map ">" 'org-agenda-date-prompt) |
| 5629 | (define-key org-agenda-mode-map "\C-c\C-s" 'org-agenda-schedule) | ||
| 5630 | (define-key org-agenda-mode-map "\C-c\C-d" 'org-agenda-deadline) | ||
| 4818 | (let ((l '(1 2 3 4 5 6 7 8 9 0))) | 5631 | (let ((l '(1 2 3 4 5 6 7 8 9 0))) |
| 4819 | (while l (define-key org-agenda-mode-map | 5632 | (while l (define-key org-agenda-mode-map |
| 4820 | (int-to-string (pop l)) 'digit-argument))) | 5633 | (int-to-string (pop l)) 'digit-argument))) |
| @@ -4847,6 +5660,9 @@ The following commands are available: | |||
| 4847 | (define-key org-agenda-mode-map "h" 'org-agenda-holidays) | 5660 | (define-key org-agenda-mode-map "h" 'org-agenda-holidays) |
| 4848 | (define-key org-agenda-mode-map "H" 'org-agenda-holidays) | 5661 | (define-key org-agenda-mode-map "H" 'org-agenda-holidays) |
| 4849 | (define-key org-agenda-mode-map "+" 'org-agenda-priority-up) | 5662 | (define-key org-agenda-mode-map "+" 'org-agenda-priority-up) |
| 5663 | (define-key org-agenda-mode-map "I" 'org-agenda-clock-in) | ||
| 5664 | (define-key org-agenda-mode-map "O" 'org-clock-out) | ||
| 5665 | (define-key org-agenda-mode-map "X" 'org-clock-cancel) | ||
| 4850 | (define-key org-agenda-mode-map "-" 'org-agenda-priority-down) | 5666 | (define-key org-agenda-mode-map "-" 'org-agenda-priority-down) |
| 4851 | (define-key org-agenda-mode-map (org-key 'S-up) 'org-agenda-priority-up) | 5667 | (define-key org-agenda-mode-map (org-key 'S-up) 'org-agenda-priority-up) |
| 4852 | (define-key org-agenda-mode-map (org-key 'S-down) 'org-agenda-priority-down) | 5668 | (define-key org-agenda-mode-map (org-key 'S-down) 'org-agenda-priority-down) |
| @@ -4878,10 +5694,12 @@ The following commands are available: | |||
| 4878 | ("Tags" | 5694 | ("Tags" |
| 4879 | ["Show all Tags" org-agenda-show-tags t] | 5695 | ["Show all Tags" org-agenda-show-tags t] |
| 4880 | ["Set Tags" org-agenda-set-tags t]) | 5696 | ["Set Tags" org-agenda-set-tags t]) |
| 4881 | ("Reschedule" | 5697 | ("Schedule" |
| 5698 | ["Schedule" org-agenda-schedule t] | ||
| 5699 | ["Set Deadline" org-agenda-deadline t] | ||
| 5700 | "--" | ||
| 4882 | ["Reschedule +1 day" org-agenda-date-later (org-agenda-check-type nil 'agenda 'timeline)] | 5701 | ["Reschedule +1 day" org-agenda-date-later (org-agenda-check-type nil 'agenda 'timeline)] |
| 4883 | ["Reschedule -1 day" org-agenda-date-earlier (org-agenda-check-type nil 'agenda 'timeline)] | 5702 | ["Reschedule -1 day" org-agenda-date-earlier (org-agenda-check-type nil 'agenda 'timeline)] |
| 4884 | "--" | ||
| 4885 | ["Reschedule to ..." org-agenda-date-prompt (org-agenda-check-type nil 'agenda 'timeline)]) | 5703 | ["Reschedule to ..." org-agenda-date-prompt (org-agenda-check-type nil 'agenda 'timeline)]) |
| 4886 | ("Priority" | 5704 | ("Priority" |
| 4887 | ["Set Priority" org-agenda-priority t] | 5705 | ["Set Priority" org-agenda-priority t] |
| @@ -4945,6 +5763,7 @@ next use of \\[org-agenda]) restricted to the current file." | |||
| 4945 | (interactive "P") | 5763 | (interactive "P") |
| 4946 | (catch 'exit | 5764 | (catch 'exit |
| 4947 | (let ((restrict-ok (and buffer-file-name (eq major-mode 'org-mode))) | 5765 | (let ((restrict-ok (and buffer-file-name (eq major-mode 'org-mode))) |
| 5766 | (bfn buffer-file-name) | ||
| 4948 | (custom org-agenda-custom-commands) | 5767 | (custom org-agenda-custom-commands) |
| 4949 | c entry key type string) | 5768 | c entry key type string) |
| 4950 | (put 'org-agenda-files 'org-restrict nil) | 5769 | (put 'org-agenda-files 'org-restrict nil) |
| @@ -4979,7 +5798,7 @@ C Configure your own agenda commands") | |||
| 4979 | (message "") | 5798 | (message "") |
| 4980 | (when (equal c ?1) | 5799 | (when (equal c ?1) |
| 4981 | (if restrict-ok | 5800 | (if restrict-ok |
| 4982 | (put 'org-agenda-files 'org-restrict (list buffer-file-name)) | 5801 | (put 'org-agenda-files 'org-restrict (list bfn)) |
| 4983 | (error "Cannot restrict agenda to current buffer")) | 5802 | (error "Cannot restrict agenda to current buffer")) |
| 4984 | (message "Press key for agenda command%s" | 5803 | (message "Press key for agenda command%s" |
| 4985 | (if restrict-ok " (restricted to current file)" "")) | 5804 | (if restrict-ok " (restricted to current file)" "")) |
| @@ -4991,18 +5810,16 @@ C Configure your own agenda commands") | |||
| 4991 | ((equal c ?C) (customize-variable 'org-agenda-custom-commands)) | 5810 | ((equal c ?C) (customize-variable 'org-agenda-custom-commands)) |
| 4992 | ((equal c ?a) (call-interactively 'org-agenda-list)) | 5811 | ((equal c ?a) (call-interactively 'org-agenda-list)) |
| 4993 | ((equal c ?t) (call-interactively 'org-todo-list)) | 5812 | ((equal c ?t) (call-interactively 'org-todo-list)) |
| 4994 | ((equal c ?T) | 5813 | ((equal c ?T) (org-call-with-arg 'org-todo-list (or arg '(4)))) |
| 4995 | (setq current-prefix-arg (or arg '(4))) | ||
| 4996 | (call-interactively 'org-todo-list)) | ||
| 4997 | ((equal c ?m) (call-interactively 'org-tags-view)) | 5814 | ((equal c ?m) (call-interactively 'org-tags-view)) |
| 4998 | ((equal c ?M) | 5815 | ((equal c ?M) (org-call-with-arg 'org-tags-view (or arg '(4)))) |
| 4999 | (setq current-prefix-arg (or arg '(4))) | ||
| 5000 | (call-interactively 'org-tags-view)) | ||
| 5001 | ((setq entry (assoc (char-to-string c) org-agenda-custom-commands)) | 5816 | ((setq entry (assoc (char-to-string c) org-agenda-custom-commands)) |
| 5002 | (setq type (nth 1 entry) string (nth 2 entry)) | 5817 | (setq type (nth 1 entry) string (nth 2 entry)) |
| 5003 | (cond | 5818 | (cond |
| 5004 | ((eq type 'tags) | 5819 | ((eq type 'tags) |
| 5005 | (org-tags-view current-prefix-arg string)) | 5820 | (org-tags-view current-prefix-arg string)) |
| 5821 | ((eq type 'tags-todo) | ||
| 5822 | (org-tags-view '(4) string)) | ||
| 5006 | ((eq type 'todo) | 5823 | ((eq type 'todo) |
| 5007 | (org-todo-list string)) | 5824 | (org-todo-list string)) |
| 5008 | ((eq type 'tags-tree) | 5825 | ((eq type 'tags-tree) |
| @@ -5159,12 +5976,13 @@ dates." | |||
| 5159 | (beg (if (org-region-active-p) (region-beginning) (point-min))) | 5976 | (beg (if (org-region-active-p) (region-beginning) (point-min))) |
| 5160 | (end (if (org-region-active-p) (region-end) (point-max))) | 5977 | (end (if (org-region-active-p) (region-end) (point-max))) |
| 5161 | (day-numbers (org-get-all-dates beg end 'no-ranges | 5978 | (day-numbers (org-get-all-dates beg end 'no-ranges |
| 5162 | t doclosed)) ; always include today | 5979 | t doclosed ; always include today |
| 5980 | org-timeline-show-empty-dates)) | ||
| 5163 | (today (time-to-days (current-time))) | 5981 | (today (time-to-days (current-time))) |
| 5164 | (org-respect-restriction t) | 5982 | (org-respect-restriction t) |
| 5165 | (past t) | 5983 | (past t) |
| 5166 | args | 5984 | args |
| 5167 | s e rtn d) | 5985 | s e rtn d emptyp) |
| 5168 | (setq org-agenda-redo-command | 5986 | (setq org-agenda-redo-command |
| 5169 | (list 'progn | 5987 | (list 'progn |
| 5170 | (list 'switch-to-buffer-other-window (current-buffer)) | 5988 | (list 'switch-to-buffer-other-window (current-buffer)) |
| @@ -5184,28 +6002,35 @@ dates." | |||
| 5184 | (push :timestamp args) | 6002 | (push :timestamp args) |
| 5185 | (if dotodo (push :todo args)) | 6003 | (if dotodo (push :todo args)) |
| 5186 | (while (setq d (pop day-numbers)) | 6004 | (while (setq d (pop day-numbers)) |
| 5187 | (if (and (>= d today) | 6005 | (if (and (listp d) (eq (car d) :omitted)) |
| 5188 | dopast | ||
| 5189 | past) | ||
| 5190 | (progn | 6006 | (progn |
| 5191 | (setq past nil) | 6007 | (setq s (point)) |
| 5192 | (insert (make-string 79 ?-) "\n"))) | 6008 | (insert (format "\n[... %d empty days omitted]\n\n" (cdr d))) |
| 5193 | (setq date (calendar-gregorian-from-absolute d)) | 6009 | (put-text-property s (1- (point)) 'face 'org-level-3)) |
| 5194 | (setq s (point)) | 6010 | (if (listp d) (setq d (car d) emptyp t) (setq emptyp nil)) |
| 5195 | (setq rtn (apply 'org-agenda-get-day-entries | 6011 | (if (and (>= d today) |
| 5196 | entry date args)) | 6012 | dopast |
| 5197 | (if (or rtn (equal d today)) | 6013 | past) |
| 5198 | (progn | 6014 | (progn |
| 5199 | (insert (calendar-day-name date) " " | 6015 | (setq past nil) |
| 5200 | (number-to-string (extract-calendar-day date)) " " | 6016 | (insert (make-string 79 ?-) "\n"))) |
| 5201 | (calendar-month-name (extract-calendar-month date)) " " | 6017 | (setq date (calendar-gregorian-from-absolute d)) |
| 5202 | (number-to-string (extract-calendar-year date)) "\n") | 6018 | (setq s (point)) |
| 5203 | (put-text-property s (1- (point)) 'face | 6019 | (setq rtn (and (not emptyp) |
| 5204 | 'org-level-3) | 6020 | (apply 'org-agenda-get-day-entries |
| 5205 | (if (equal d today) | 6021 | entry date args))) |
| 5206 | (put-text-property s (1- (point)) 'org-today t)) | 6022 | (if (or rtn (equal d today) org-timeline-show-empty-dates) |
| 5207 | (insert (org-finalize-agenda-entries rtn) "\n") | 6023 | (progn |
| 5208 | (put-text-property s (1- (point)) 'day d)))) | 6024 | (insert (calendar-day-name date) " " |
| 6025 | (number-to-string (extract-calendar-day date)) " " | ||
| 6026 | (calendar-month-name (extract-calendar-month date)) " " | ||
| 6027 | (number-to-string (extract-calendar-year date)) "\n") | ||
| 6028 | (put-text-property s (1- (point)) 'face | ||
| 6029 | 'org-level-3) | ||
| 6030 | (if (equal d today) | ||
| 6031 | (put-text-property s (1- (point)) 'org-today t)) | ||
| 6032 | (and rtn (insert (org-finalize-agenda-entries rtn) "\n")) | ||
| 6033 | (put-text-property s (1- (point)) 'day d))))) | ||
| 5209 | (goto-char (point-min)) | 6034 | (goto-char (point-min)) |
| 5210 | (setq buffer-read-only t) | 6035 | (setq buffer-read-only t) |
| 5211 | (goto-char (or (text-property-any (point-min) (point-max) 'org-today t) | 6036 | (goto-char (or (text-property-any (point-min) (point-max) 'org-today t) |
| @@ -5432,7 +6257,7 @@ If ERROR is non-nil, throw an error, otherwise just return nil." | |||
| 5432 | (if (memq org-agenda-type types) | 6257 | (if (memq org-agenda-type types) |
| 5433 | t | 6258 | t |
| 5434 | (if error | 6259 | (if error |
| 5435 | (error "Now allowed in %s-type agenda buffers" org-agenda-type) | 6260 | (error "Not allowed in %s-type agenda buffers" org-agenda-type) |
| 5436 | nil))) | 6261 | nil))) |
| 5437 | 6262 | ||
| 5438 | (defun org-agenda-quit () | 6263 | (defun org-agenda-quit () |
| @@ -5768,14 +6593,15 @@ Optional argument FILE means, use this file instead of the current." | |||
| 5768 | (defun org-file-menu-entry (file) | 6593 | (defun org-file-menu-entry (file) |
| 5769 | (vector file (list 'find-file file) t)) | 6594 | (vector file (list 'find-file file) t)) |
| 5770 | 6595 | ||
| 5771 | (defun org-get-all-dates (beg end &optional no-ranges force-today inactive) | 6596 | (defun org-get-all-dates (beg end &optional no-ranges force-today inactive empty) |
| 5772 | "Return a list of all relevant day numbers from BEG to END buffer positions. | 6597 | "Return a list of all relevant day numbers from BEG to END buffer positions. |
| 5773 | If NO-RANGES is non-nil, include only the start and end dates of a range, | 6598 | If NO-RANGES is non-nil, include only the start and end dates of a range, |
| 5774 | not every single day in the range. If FORCE-TODAY is non-nil, make | 6599 | not every single day in the range. If FORCE-TODAY is non-nil, make |
| 5775 | sure that TODAY is included in the list. If INACTIVE is non-nil, also | 6600 | sure that TODAY is included in the list. If INACTIVE is non-nil, also |
| 5776 | inactive time stamps (those in square brackets) are included." | 6601 | inactive time stamps (those in square brackets) are included. |
| 6602 | When EMPTY is non-nil, also include days without any entries." | ||
| 5777 | (let ((re (if inactive org-ts-regexp-both org-ts-regexp)) | 6603 | (let ((re (if inactive org-ts-regexp-both org-ts-regexp)) |
| 5778 | dates date day day1 day2 ts1 ts2) | 6604 | dates dates1 date day day1 day2 ts1 ts2) |
| 5779 | (if force-today | 6605 | (if force-today |
| 5780 | (setq dates (list (time-to-days (current-time))))) | 6606 | (setq dates (list (time-to-days (current-time))))) |
| 5781 | (save-excursion | 6607 | (save-excursion |
| @@ -5793,7 +6619,19 @@ inactive time stamps (those in square brackets) are included." | |||
| 5793 | day2 (time-to-days (org-time-string-to-time ts2))) | 6619 | day2 (time-to-days (org-time-string-to-time ts2))) |
| 5794 | (while (< (setq day1 (1+ day1)) day2) | 6620 | (while (< (setq day1 (1+ day1)) day2) |
| 5795 | (or (memq day1 dates) (push day1 dates))))) | 6621 | (or (memq day1 dates) (push day1 dates))))) |
| 5796 | (sort dates '<)))) | 6622 | (setq dates (sort dates '<)) |
| 6623 | (when empty | ||
| 6624 | (while (setq day (pop dates)) | ||
| 6625 | (setq day2 (car dates)) | ||
| 6626 | (push day dates1) | ||
| 6627 | (when (and day2 empty) | ||
| 6628 | (if (or (eq empty t) | ||
| 6629 | (and (numberp empty) (<= (- day2 day) empty))) | ||
| 6630 | (while (< (setq day (1+ day)) day2) | ||
| 6631 | (push (list day) dates1)) | ||
| 6632 | (push (cons :omitted (- day2 day)) dates1)))) | ||
| 6633 | (setq dates (nreverse dates1))) | ||
| 6634 | dates))) | ||
| 5797 | 6635 | ||
| 5798 | ;;;###autoload | 6636 | ;;;###autoload |
| 5799 | (defun org-diary (&rest args) | 6637 | (defun org-diary (&rest args) |
| @@ -5977,27 +6815,32 @@ the documentation of `org-diary'." | |||
| 5977 | "\\)\\>") | 6815 | "\\)\\>") |
| 5978 | org-not-done-regexp) | 6816 | org-not-done-regexp) |
| 5979 | "[^\n\r]*\\)")) | 6817 | "[^\n\r]*\\)")) |
| 6818 | (sched-re (concat ".*\n?.*?" org-scheduled-time-regexp)) | ||
| 5980 | marker priority category tags | 6819 | marker priority category tags |
| 5981 | ee txt) | 6820 | ee txt) |
| 5982 | (goto-char (point-min)) | 6821 | (goto-char (point-min)) |
| 5983 | (while (re-search-forward regexp nil t) | 6822 | (while (re-search-forward regexp nil t) |
| 5984 | (goto-char (match-beginning 1)) | 6823 | (when (not (and org-agenda-todo-ignore-scheduled |
| 5985 | (setq marker (org-agenda-new-marker (1+ (match-beginning 0))) | 6824 | (save-match-data (looking-at sched-re)))) |
| 5986 | category (org-get-category) | 6825 | (goto-char (match-beginning 1)) |
| 5987 | tags (org-get-tags-at (point)) | 6826 | (setq marker (org-agenda-new-marker (1+ (match-beginning 0))) |
| 5988 | txt (org-format-agenda-item "" (match-string 1) category tags) | 6827 | category (org-get-category) |
| 5989 | priority | 6828 | tags (org-get-tags-at (point)) |
| 5990 | (+ (org-get-priority txt) | 6829 | txt (org-format-agenda-item "" (match-string 1) category tags) |
| 5991 | (if org-todo-kwd-priority-p | 6830 | priority |
| 5992 | (- org-todo-kwd-max-priority -2 | 6831 | (+ (org-get-priority txt) |
| 5993 | (length | 6832 | (if org-todo-kwd-priority-p |
| 5994 | (member (match-string 2) org-todo-keywords))) | 6833 | (- org-todo-kwd-max-priority -2 |
| 5995 | 1))) | 6834 | (length |
| 5996 | (org-add-props txt props | 6835 | (member (match-string 2) org-todo-keywords))) |
| 5997 | 'org-marker marker 'org-hd-marker marker | 6836 | 1))) |
| 5998 | 'priority priority 'category category) | 6837 | (org-add-props txt props |
| 5999 | (push txt ee) | 6838 | 'org-marker marker 'org-hd-marker marker |
| 6000 | (goto-char (match-end 1))) | 6839 | 'priority priority 'category category) |
| 6840 | (push txt ee)) | ||
| 6841 | (if org-agenda-todo-list-sublevels | ||
| 6842 | (goto-char (match-end 1)) | ||
| 6843 | (org-end-of-subtree 'invisible))) | ||
| 6001 | (nreverse ee))) | 6844 | (nreverse ee))) |
| 6002 | 6845 | ||
| 6003 | (defconst org-agenda-no-heading-message | 6846 | (defconst org-agenda-no-heading-message |
| @@ -6078,7 +6921,7 @@ the documentation of `org-diary'." | |||
| 6078 | (format "mouse-2 or RET jump to org file %s" | 6921 | (format "mouse-2 or RET jump to org file %s" |
| 6079 | (abbreviate-file-name buffer-file-name)))) | 6922 | (abbreviate-file-name buffer-file-name)))) |
| 6080 | (regexp (concat | 6923 | (regexp (concat |
| 6081 | "\\<" org-closed-string " *\\[" | 6924 | "\\<\\(" org-closed-string "\\|" org-clock-string "\\) *\\[" |
| 6082 | (regexp-quote | 6925 | (regexp-quote |
| 6083 | (substring | 6926 | (substring |
| 6084 | (format-time-string | 6927 | (format-time-string |
| @@ -6086,13 +6929,14 @@ the documentation of `org-diary'." | |||
| 6086 | (apply 'encode-time ; DATE bound by calendar | 6929 | (apply 'encode-time ; DATE bound by calendar |
| 6087 | (list 0 0 0 (nth 1 date) (car date) (nth 2 date)))) | 6930 | (list 0 0 0 (nth 1 date) (car date) (nth 2 date)))) |
| 6088 | 1 11)))) | 6931 | 1 11)))) |
| 6089 | marker hdmarker priority category tags | 6932 | marker hdmarker priority category tags closedp |
| 6090 | ee txt timestr) | 6933 | ee txt timestr) |
| 6091 | (goto-char (point-min)) | 6934 | (goto-char (point-min)) |
| 6092 | (while (re-search-forward regexp nil t) | 6935 | (while (re-search-forward regexp nil t) |
| 6093 | (if (not (save-match-data (org-at-date-range-p))) | 6936 | (if (not (save-match-data (org-at-date-range-p))) |
| 6094 | (progn | 6937 | (progn |
| 6095 | (setq marker (org-agenda-new-marker (match-beginning 0)) | 6938 | (setq marker (org-agenda-new-marker (match-beginning 0)) |
| 6939 | closedp (equal (match-string 1) org-closed-string) | ||
| 6096 | category (org-get-category (match-beginning 0)) | 6940 | category (org-get-category (match-beginning 0)) |
| 6097 | timestr (buffer-substring (match-beginning 0) (point-at-eol)) | 6941 | timestr (buffer-substring (match-beginning 0) (point-at-eol)) |
| 6098 | ;; donep (org-entry-is-done-p) | 6942 | ;; donep (org-entry-is-done-p) |
| @@ -6108,7 +6952,7 @@ the documentation of `org-diary'." | |||
| 6108 | tags (org-get-tags-at)) | 6952 | tags (org-get-tags-at)) |
| 6109 | (looking-at "\\*+[ \t]*\\([^\r\n]+\\)") | 6953 | (looking-at "\\*+[ \t]*\\([^\r\n]+\\)") |
| 6110 | (setq txt (org-format-agenda-item | 6954 | (setq txt (org-format-agenda-item |
| 6111 | "Closed: " | 6955 | (if closedp "Closed: " "Clocked: ") |
| 6112 | (match-string 1) category tags timestr))) | 6956 | (match-string 1) category tags timestr))) |
| 6113 | (setq txt org-agenda-no-heading-message)) | 6957 | (setq txt org-agenda-no-heading-message)) |
| 6114 | (setq priority 100000) | 6958 | (setq priority 100000) |
| @@ -6133,7 +6977,7 @@ the documentation of `org-diary'." | |||
| 6133 | (todayp (equal date (calendar-current-date))) ; DATE bound by calendar | 6977 | (todayp (equal date (calendar-current-date))) ; DATE bound by calendar |
| 6134 | (d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar | 6978 | (d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar |
| 6135 | d2 diff pos pos1 category tags | 6979 | d2 diff pos pos1 category tags |
| 6136 | ee txt head) | 6980 | ee txt head face) |
| 6137 | (goto-char (point-min)) | 6981 | (goto-char (point-min)) |
| 6138 | (while (re-search-forward regexp nil t) | 6982 | (while (re-search-forward regexp nil t) |
| 6139 | (setq pos (1- (match-beginning 1)) | 6983 | (setq pos (1- (match-beginning 1)) |
| @@ -6161,19 +7005,15 @@ the documentation of `org-diary'." | |||
| 6161 | (format "In %3d d.: " diff) head category tags)))) | 7005 | (format "In %3d d.: " diff) head category tags)))) |
| 6162 | (setq txt org-agenda-no-heading-message)) | 7006 | (setq txt org-agenda-no-heading-message)) |
| 6163 | (when txt | 7007 | (when txt |
| 7008 | (setq face (cond ((<= diff 0) 'org-warning) | ||
| 7009 | ((<= diff 5) 'org-upcoming-deadline) | ||
| 7010 | (t nil))) | ||
| 6164 | (org-add-props txt props | 7011 | (org-add-props txt props |
| 6165 | 'org-marker (org-agenda-new-marker pos) | 7012 | 'org-marker (org-agenda-new-marker pos) |
| 6166 | 'org-hd-marker (org-agenda-new-marker pos1) | 7013 | 'org-hd-marker (org-agenda-new-marker pos1) |
| 6167 | 'priority (+ (- 10 diff) (org-get-priority txt)) | 7014 | 'priority (+ (- 10 diff) (org-get-priority txt)) |
| 6168 | 'category category | 7015 | 'category category |
| 6169 | 'face (cond ((<= diff 0) 'org-warning) | 7016 | 'face face 'undone-face face 'done-face 'org-done) |
| 6170 | ((<= diff 5) 'org-scheduled-previously) | ||
| 6171 | (t nil)) | ||
| 6172 | 'undone-face (cond | ||
| 6173 | ((<= diff 0) 'org-warning) | ||
| 6174 | ((<= diff 5) 'org-scheduled-previously) | ||
| 6175 | (t nil)) | ||
| 6176 | 'done-face 'org-done) | ||
| 6177 | (push txt ee))))) | 7017 | (push txt ee))))) |
| 6178 | ee)) | 7018 | ee)) |
| 6179 | 7019 | ||
| @@ -6351,14 +7191,19 @@ only the correctly processes TXT should be returned - this is used by | |||
| 6351 | t)) | 7191 | t)) |
| 6352 | (setq txt (replace-match "" nil nil txt)))) | 7192 | (setq txt (replace-match "" nil nil txt)))) |
| 6353 | ;; Normalize the time(s) to 24 hour | 7193 | ;; Normalize the time(s) to 24 hour |
| 6354 | (if s1 (setq s1 (org-get-time-of-day s1 'string))) | 7194 | (if s1 (setq s1 (org-get-time-of-day s1 'string t))) |
| 6355 | (if s2 (setq s2 (org-get-time-of-day s2 'string)))) | 7195 | (if s2 (setq s2 (org-get-time-of-day s2 'string t)))) |
| 6356 | 7196 | ||
| 6357 | (when (and (or (eq org-agenda-remove-tags-when-in-prefix t) | 7197 | (when (string-match "\\([ \t]+\\)\\(:[a-zA-Z_@0-9:]+:\\)[ \t]*$" txt) |
| 6358 | (and org-agenda-remove-tags-when-in-prefix | 7198 | ;; Tags are in the string |
| 6359 | org-prefix-has-tag)) | 7199 | (if (or (eq org-agenda-remove-tags-when-in-prefix t) |
| 6360 | (string-match ":[a-zA-Z_@0-9:]+:[ \t]*$" txt)) | 7200 | (and org-agenda-remove-tags-when-in-prefix |
| 6361 | (setq txt (replace-match "" t t txt))) | 7201 | org-prefix-has-tag)) |
| 7202 | (setq txt (replace-match "" t t txt)) | ||
| 7203 | (setq txt (replace-match | ||
| 7204 | (concat (make-string (max (- 50 (length txt)) 1) ?\ ) | ||
| 7205 | (match-string 2 txt)) | ||
| 7206 | t t txt)))) | ||
| 6362 | 7207 | ||
| 6363 | ;; Create the final string | 7208 | ;; Create the final string |
| 6364 | (if noprefix | 7209 | (if noprefix |
| @@ -6438,7 +7283,7 @@ The resulting form is returned and stored in the variable | |||
| 6438 | (setq vars (nreverse vars)) | 7283 | (setq vars (nreverse vars)) |
| 6439 | (setq org-prefix-format-compiled `(format ,s ,@vars)))) | 7284 | (setq org-prefix-format-compiled `(format ,s ,@vars)))) |
| 6440 | 7285 | ||
| 6441 | (defun org-get-time-of-day (s &optional string) | 7286 | (defun org-get-time-of-day (s &optional string mod24) |
| 6442 | "Check string S for a time of day. | 7287 | "Check string S for a time of day. |
| 6443 | If found, return it as a military time number between 0 and 2400. | 7288 | If found, return it as a military time number between 0 and 2400. |
| 6444 | If not found, return nil. | 7289 | If not found, return nil. |
| @@ -6451,16 +7296,19 @@ HH:MM." | |||
| 6451 | "\\<\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)\\([AaPp][Mm]\\)?\\> *" s) | 7296 | "\\<\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)\\([AaPp][Mm]\\)?\\> *" s) |
| 6452 | (string-match | 7297 | (string-match |
| 6453 | "\\<\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)?\\([AaPp][Mm]\\)\\> *" s)) | 7298 | "\\<\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)?\\([AaPp][Mm]\\)\\> *" s)) |
| 6454 | (let* ((t0 (+ (* 100 | 7299 | (let* ((h (string-to-number (match-string 1 s))) |
| 6455 | (+ (string-to-number (match-string 1 s)) | 7300 | (m (if (match-end 3) (string-to-number (match-string 3 s)) 0)) |
| 6456 | (if (and (match-beginning 4) | 7301 | (ampm (if (match-end 4) (downcase (match-string 4 s)))) |
| 6457 | (equal (downcase (match-string 4 s)) "pm")) | 7302 | (am-p (equal ampm "am")) |
| 6458 | 12 0))) | 7303 | (h1 (cond ((not ampm) h) |
| 6459 | (if (match-beginning 3) | 7304 | ((= h 12) (if am-p 0 12)) |
| 6460 | (string-to-number (match-string 3 s)) | 7305 | (t (+ h (if am-p 0 12))))) |
| 6461 | 0))) | 7306 | (h2 (if (and string mod24 (not (and (= m 0) (= h1 24)))) |
| 6462 | (t1 (concat " " | 7307 | (mod h1 24) h1)) |
| 6463 | (if (< t0 100) "0" "") (if (< t0 10) "0" "") | 7308 | (t0 (+ (* 100 h2) m)) |
| 7309 | (t1 (concat (if (>= h1 24) "+" " ") | ||
| 7310 | (if (< t0 100) "0" "") | ||
| 7311 | (if (< t0 10) "0" "") | ||
| 6464 | (int-to-string t0)))) | 7312 | (int-to-string t0)))) |
| 6465 | (if string (concat (substring t1 -4 -2) ":" (substring t1 -2)) t0))))) | 7313 | (if string (concat (substring t1 -4 -2) ":" (substring t1 -2)) t0))))) |
| 6466 | 7314 | ||
| @@ -6470,7 +7318,7 @@ HH:MM." | |||
| 6470 | (mapconcat 'identity (sort list 'org-entries-lessp) "\n")) | 7318 | (mapconcat 'identity (sort list 'org-entries-lessp) "\n")) |
| 6471 | 7319 | ||
| 6472 | (defun org-agenda-highlight-todo (x) | 7320 | (defun org-agenda-highlight-todo (x) |
| 6473 | (let (re) | 7321 | (let (re pl) |
| 6474 | (if (eq x 'line) | 7322 | (if (eq x 'line) |
| 6475 | (save-excursion | 7323 | (save-excursion |
| 6476 | (beginning-of-line 1) | 7324 | (beginning-of-line 1) |
| @@ -6479,8 +7327,9 @@ HH:MM." | |||
| 6479 | (and (looking-at (concat "[ \t]*" re)) | 7327 | (and (looking-at (concat "[ \t]*" re)) |
| 6480 | (add-text-properties (match-beginning 0) (match-end 0) | 7328 | (add-text-properties (match-beginning 0) (match-end 0) |
| 6481 | '(face org-todo)))) | 7329 | '(face org-todo)))) |
| 6482 | (setq re (get-text-property 0 'org-not-done-regexp x)) | 7330 | (setq re (get-text-property 0 'org-not-done-regexp x) |
| 6483 | (and re (string-match re x) | 7331 | pl (get-text-property 0 'prefix-length x)) |
| 7332 | (and re (equal (string-match re x pl) pl) | ||
| 6484 | (add-text-properties (match-beginning 0) (match-end 0) | 7333 | (add-text-properties (match-beginning 0) (match-end 0) |
| 6485 | '(face org-todo) x)) | 7334 | '(face org-todo) x)) |
| 6486 | x))) | 7335 | x))) |
| @@ -6503,7 +7352,7 @@ HH:MM." | |||
| 6503 | 7352 | ||
| 6504 | (defsubst org-cmp-time (a b) | 7353 | (defsubst org-cmp-time (a b) |
| 6505 | "Compare the time-of-day values of strings A and B." | 7354 | "Compare the time-of-day values of strings A and B." |
| 6506 | (let* ((def (if org-sort-agenda-notime-is-late 2401 -1)) | 7355 | (let* ((def (if org-sort-agenda-notime-is-late 9901 -1)) |
| 6507 | (ta (or (get-text-property 1 'time-of-day a) def)) | 7356 | (ta (or (get-text-property 1 'time-of-day a) def)) |
| 6508 | (tb (or (get-text-property 1 'time-of-day b) def))) | 7357 | (tb (or (get-text-property 1 'time-of-day b) def))) |
| 6509 | (cond ((< ta tb) -1) | 7358 | (cond ((< ta tb) -1) |
| @@ -6537,7 +7386,8 @@ and by additional input from the age of a schedules or deadline entry." | |||
| 6537 | (interactive) | 7386 | (interactive) |
| 6538 | (let* ((tags (get-text-property (point-at-bol) 'tags))) | 7387 | (let* ((tags (get-text-property (point-at-bol) 'tags))) |
| 6539 | (if tags | 7388 | (if tags |
| 6540 | (message "Tags are :%s:" (mapconcat 'identity tags ":")) | 7389 | (message "Tags are :%s:" |
| 7390 | (org-no-properties (mapconcat 'identity tags ":"))) | ||
| 6541 | (message "No tags associated with this line")))) | 7391 | (message "No tags associated with this line")))) |
| 6542 | 7392 | ||
| 6543 | (defun org-agenda-goto (&optional highlight) | 7393 | (defun org-agenda-goto (&optional highlight) |
| @@ -6723,7 +7573,7 @@ the same tree node, and the headline of the tree node in the Org-mode file." | |||
| 6723 | (beginning-of-line 1))) | 7573 | (beginning-of-line 1))) |
| 6724 | 7574 | ||
| 6725 | (defun org-get-tags-at (&optional pos) | 7575 | (defun org-get-tags-at (&optional pos) |
| 6726 | "Get a list of all headline targs applicable at POS. | 7576 | "Get a list of all headline tags applicable at POS. |
| 6727 | POS defaults to point. If tags are inherited, the list contains | 7577 | POS defaults to point. If tags are inherited, the list contains |
| 6728 | the targets in the same sequence as the headlines appear, i.e. | 7578 | the targets in the same sequence as the headlines appear, i.e. |
| 6729 | the tags of the current headline come last." | 7579 | the tags of the current headline come last." |
| @@ -6736,7 +7586,9 @@ the tags of the current headline come last." | |||
| 6736 | (condition-case nil | 7586 | (condition-case nil |
| 6737 | (while t | 7587 | (while t |
| 6738 | (if (looking-at "[^\r\n]+?:\\([a-zA-Z_@0-9:]+\\):[ \t]*\\([\n\r]\\|\\'\\)") | 7588 | (if (looking-at "[^\r\n]+?:\\([a-zA-Z_@0-9:]+\\):[ \t]*\\([\n\r]\\|\\'\\)") |
| 6739 | (setq tags (append (org-split-string (match-string 1) ":") tags))) | 7589 | (setq tags (append (org-split-string |
| 7590 | (org-match-string-no-properties 1) ":") | ||
| 7591 | tags))) | ||
| 6740 | (or org-use-tag-inheritance (error "")) | 7592 | (or org-use-tag-inheritance (error "")) |
| 6741 | (org-up-heading-all 1)) | 7593 | (org-up-heading-all 1)) |
| 6742 | (error nil)))) | 7594 | (error nil)))) |
| @@ -6808,6 +7660,40 @@ be used to request time specification in the time stamp." | |||
| 6808 | (org-time-stamp arg) | 7660 | (org-time-stamp arg) |
| 6809 | (message "Time stamp changed to %s" org-last-changed-timestamp)))) | 7661 | (message "Time stamp changed to %s" org-last-changed-timestamp)))) |
| 6810 | 7662 | ||
| 7663 | (defun org-agenda-schedule (arg) | ||
| 7664 | "Schedule the item at point." | ||
| 7665 | (interactive "P") | ||
| 7666 | (org-agenda-check-type t 'agenda 'timeline 'todo 'tags) | ||
| 7667 | (org-agenda-check-no-diary) | ||
| 7668 | (let* ((marker (or (get-text-property (point) 'org-marker) | ||
| 7669 | (org-agenda-error))) | ||
| 7670 | (buffer (marker-buffer marker)) | ||
| 7671 | (pos (marker-position marker)) | ||
| 7672 | (org-insert-labeled-timestamps-at-point nil) | ||
| 7673 | ts) | ||
| 7674 | (with-current-buffer buffer | ||
| 7675 | (widen) | ||
| 7676 | (goto-char pos) | ||
| 7677 | (setq ts (org-schedule)) | ||
| 7678 | (message "Item scheduled for %s" ts)))) | ||
| 7679 | |||
| 7680 | (defun org-agenda-deadline (arg) | ||
| 7681 | "Schedule the item at point." | ||
| 7682 | (interactive "P") | ||
| 7683 | (org-agenda-check-type t 'agenda 'timeline 'todo 'tags) | ||
| 7684 | (org-agenda-check-no-diary) | ||
| 7685 | (let* ((marker (or (get-text-property (point) 'org-marker) | ||
| 7686 | (org-agenda-error))) | ||
| 7687 | (buffer (marker-buffer marker)) | ||
| 7688 | (pos (marker-position marker)) | ||
| 7689 | (org-insert-labeled-timestamps-at-point nil) | ||
| 7690 | ts) | ||
| 7691 | (with-current-buffer buffer | ||
| 7692 | (widen) | ||
| 7693 | (goto-char pos) | ||
| 7694 | (setq ts (org-deadline)) | ||
| 7695 | (message "Deadline for this item set to %s" ts)))) | ||
| 7696 | |||
| 6811 | (defun org-get-heading () | 7697 | (defun org-get-heading () |
| 6812 | "Return the heading of the current entry, without the stars." | 7698 | "Return the heading of the current entry, without the stars." |
| 6813 | (save-excursion | 7699 | (save-excursion |
| @@ -6817,6 +7703,20 @@ be used to request time specification in the time stamp." | |||
| 6817 | (match-string 1) | 7703 | (match-string 1) |
| 6818 | ""))) | 7704 | ""))) |
| 6819 | 7705 | ||
| 7706 | (defun org-agenda-clock-in (&optional arg) | ||
| 7707 | "Start the clock on the currently selected item." | ||
| 7708 | (interactive "P") | ||
| 7709 | (org-agenda-check-no-diary) | ||
| 7710 | (let* ((marker (or (get-text-property (point) 'org-marker) | ||
| 7711 | (org-agenda-error))) | ||
| 7712 | (buffer (marker-buffer marker)) | ||
| 7713 | (pos (marker-position marker)) | ||
| 7714 | (hdmarker (get-text-property (point) 'org-hd-marker))) | ||
| 7715 | (with-current-buffer (marker-buffer marker) | ||
| 7716 | (widen) | ||
| 7717 | (goto-char pos) | ||
| 7718 | (org-clock-in)))) | ||
| 7719 | |||
| 6820 | (defun org-agenda-diary-entry () | 7720 | (defun org-agenda-diary-entry () |
| 6821 | "Make a diary entry, like the `i' command from the calendar. | 7721 | "Make a diary entry, like the `i' command from the calendar. |
| 6822 | All the standard commands work: block, weekly etc." | 7722 | All the standard commands work: block, weekly etc." |
| @@ -6980,7 +7880,7 @@ are included in the output." | |||
| 6980 | 7880 | ||
| 6981 | (save-excursion | 7881 | (save-excursion |
| 6982 | (goto-char (point-min)) | 7882 | (goto-char (point-min)) |
| 6983 | (when (eq action 'sparse-tree) (hide-sublevels 1)) | 7883 | (when (eq action 'sparse-tree) (org-overview)) |
| 6984 | (while (re-search-forward re nil t) | 7884 | (while (re-search-forward re nil t) |
| 6985 | (setq todo (if (match-end 1) (match-string 2)) | 7885 | (setq todo (if (match-end 1) (match-string 2)) |
| 6986 | tags (if (match-end 4) (match-string 4))) | 7886 | tags (if (match-end 4) (match-string 4))) |
| @@ -7108,6 +8008,7 @@ The prefix arg TODO-ONLY limits the search to TODO entries." | |||
| 7108 | (with-current-buffer buffer | 8008 | (with-current-buffer buffer |
| 7109 | (unless (eq major-mode 'org-mode) | 8009 | (unless (eq major-mode 'org-mode) |
| 7110 | (error "Agenda file %s is not in `org-mode'" file)) | 8010 | (error "Agenda file %s is not in `org-mode'" file)) |
| 8011 | (setq org-category-table (org-get-category-table)) | ||
| 7111 | (save-excursion | 8012 | (save-excursion |
| 7112 | (save-restriction | 8013 | (save-restriction |
| 7113 | (if org-respect-restriction | 8014 | (if org-respect-restriction |
| @@ -7139,11 +8040,11 @@ The prefix arg TODO-ONLY limits the search to TODO entries." | |||
| 7139 | (defun org-set-tags (&optional arg just-align) | 8040 | (defun org-set-tags (&optional arg just-align) |
| 7140 | "Set the tags for the current headline. | 8041 | "Set the tags for the current headline. |
| 7141 | With prefix ARG, realign all tags in headings in the current buffer." | 8042 | With prefix ARG, realign all tags in headings in the current buffer." |
| 7142 | (interactive) | 8043 | (interactive "P") |
| 7143 | (let* (;(inherit (org-get-inherited-tags)) | 8044 | (let* ((re (concat "^" outline-regexp)) |
| 7144 | (re (concat "^" outline-regexp)) | ||
| 7145 | (col (current-column)) | 8045 | (col (current-column)) |
| 7146 | (current (org-get-tags)) | 8046 | (current (org-get-tags)) |
| 8047 | table current-tags inherited-tags ; computed below when needed | ||
| 7147 | tags hd empty invis) | 8048 | tags hd empty invis) |
| 7148 | (if arg | 8049 | (if arg |
| 7149 | (save-excursion | 8050 | (save-excursion |
| @@ -7153,16 +8054,23 @@ With prefix ARG, realign all tags in headings in the current buffer." | |||
| 7153 | (message "All tags realigned to column %d" org-tags-column)) | 8054 | (message "All tags realigned to column %d" org-tags-column)) |
| 7154 | (if just-align | 8055 | (if just-align |
| 7155 | (setq tags current) | 8056 | (setq tags current) |
| 7156 | (setq org-last-tags-completion-table | 8057 | (setq table (or org-tag-alist (org-get-buffer-tags)) |
| 7157 | (or (org-get-buffer-tags) | 8058 | org-last-tags-completion-table table |
| 7158 | org-last-tags-completion-table)) | 8059 | current-tags (org-split-string current ":") |
| 7159 | (setq tags | 8060 | inherited-tags (nreverse |
| 7160 | (let ((org-add-colon-after-tag-completion t)) | 8061 | (nthcdr (length current-tags) |
| 7161 | (completing-read "Tags: " 'org-tags-completion-function | 8062 | (nreverse (org-get-tags-at)))) |
| 7162 | nil nil current 'org-tags-history))) | 8063 | tags |
| 8064 | (if (or (eq t org-use-fast-tag-selection) | ||
| 8065 | (and org-use-fast-tag-selection | ||
| 8066 | (delq nil (mapcar 'cdr table)))) | ||
| 8067 | (org-fast-tag-selection current-tags inherited-tags table) | ||
| 8068 | (let ((org-add-colon-after-tag-completion t)) | ||
| 8069 | (completing-read "Tags: " 'org-tags-completion-function | ||
| 8070 | nil nil current 'org-tags-history)))) | ||
| 7163 | (while (string-match "[-+&]+" tags) | 8071 | (while (string-match "[-+&]+" tags) |
| 7164 | (setq tags (replace-match ":" t t tags)))) | 8072 | (setq tags (replace-match ":" t t tags)))) |
| 7165 | ;; FIXME: still optimize this by not checking when JUST-ALIGN? | 8073 | |
| 7166 | (unless (setq empty (string-match "\\`[\t ]*\\'" tags)) | 8074 | (unless (setq empty (string-match "\\`[\t ]*\\'" tags)) |
| 7167 | (unless (string-match ":$" tags) (setq tags (concat tags ":"))) | 8075 | (unless (string-match ":$" tags) (setq tags (concat tags ":"))) |
| 7168 | (unless (string-match "^:" tags) (setq tags (concat ":" tags)))) | 8076 | (unless (string-match "^:" tags) (setq tags (concat ":" tags)))) |
| @@ -7188,7 +8096,8 @@ With prefix ARG, realign all tags in headings in the current buffer." | |||
| 7188 | (move-to-column col)))) | 8096 | (move-to-column col)))) |
| 7189 | 8097 | ||
| 7190 | (defun org-tags-completion-function (string predicate &optional flag) | 8098 | (defun org-tags-completion-function (string predicate &optional flag) |
| 7191 | (let (s1 s2 rtn (ctable org-last-tags-completion-table)) | 8099 | (let (s1 s2 rtn (ctable org-last-tags-completion-table) |
| 8100 | (confirm (lambda (x) (stringp (car x))))) | ||
| 7192 | (if (string-match "^\\(.*[-+:&|]\\)\\([^-+:&|]*\\)$" string) | 8101 | (if (string-match "^\\(.*[-+:&|]\\)\\([^-+:&|]*\\)$" string) |
| 7193 | (setq s1 (match-string 1 string) | 8102 | (setq s1 (match-string 1 string) |
| 7194 | s2 (match-string 2 string)) | 8103 | s2 (match-string 2 string)) |
| @@ -7196,7 +8105,7 @@ With prefix ARG, realign all tags in headings in the current buffer." | |||
| 7196 | (cond | 8105 | (cond |
| 7197 | ((eq flag nil) | 8106 | ((eq flag nil) |
| 7198 | ;; try completion | 8107 | ;; try completion |
| 7199 | (setq rtn (try-completion s2 ctable)) | 8108 | (setq rtn (try-completion s2 ctable confirm)) |
| 7200 | (if (stringp rtn) | 8109 | (if (stringp rtn) |
| 7201 | (concat s1 s2 (substring rtn (length s2)) | 8110 | (concat s1 s2 (substring rtn (length s2)) |
| 7202 | (if (and org-add-colon-after-tag-completion | 8111 | (if (and org-add-colon-after-tag-completion |
| @@ -7205,13 +8114,133 @@ With prefix ARG, realign all tags in headings in the current buffer." | |||
| 7205 | ) | 8114 | ) |
| 7206 | ((eq flag t) | 8115 | ((eq flag t) |
| 7207 | ;; all-completions | 8116 | ;; all-completions |
| 7208 | (all-completions s2 ctable) | 8117 | (all-completions s2 ctable confirm) |
| 7209 | ) | 8118 | ) |
| 7210 | ((eq flag 'lambda) | 8119 | ((eq flag 'lambda) |
| 7211 | ;; exact match? | 8120 | ;; exact match? |
| 7212 | (assoc s2 ctable))) | 8121 | (assoc s2 ctable))) |
| 7213 | )) | 8122 | )) |
| 7214 | 8123 | ||
| 8124 | (defun org-fast-tag-insert (kwd tags face &optional end) | ||
| 8125 | "Insert KDW, and the TAGS, the latter with face FACE. Also inser END." | ||
| 8126 | (insert (format "%-12s" (concat kwd ":")) | ||
| 8127 | (org-add-props (mapconcat 'identity tags " ") nil 'face face) | ||
| 8128 | (or end ""))) | ||
| 8129 | |||
| 8130 | (defun org-fast-tag-selection (current inherited table) | ||
| 8131 | "Fast tag selection with single keys. | ||
| 8132 | CURRENT is the current list of tags in the headline, INHERITED is the | ||
| 8133 | list of inherited tags, and TABLE is an alist of tags and corresponding keys, | ||
| 8134 | possibly with grouping information. | ||
| 8135 | If the keys are nil, a-z are automatically assigned. | ||
| 8136 | Returns the new tags string, or nil to not change the current settings." | ||
| 8137 | (let* ((maxlen (apply 'max (mapcar | ||
| 8138 | (lambda (x) | ||
| 8139 | (if (stringp (car x)) (string-width (car x)) 0)) | ||
| 8140 | table))) | ||
| 8141 | (fwidth (+ maxlen 3 1 3)) | ||
| 8142 | (ncol (/ (- (window-width) 4) fwidth)) | ||
| 8143 | (i-face 'org-done) | ||
| 8144 | (c-face 'org-tag) | ||
| 8145 | tg cnt e c char c1 c2 ntable tbl rtn | ||
| 8146 | groups ingroup) | ||
| 8147 | (save-window-excursion | ||
| 8148 | (delete-other-windows) | ||
| 8149 | (split-window-vertically) | ||
| 8150 | (switch-to-buffer-other-window (get-buffer-create " *Org tags*")) | ||
| 8151 | (erase-buffer) | ||
| 8152 | (org-fast-tag-insert "Inherited" inherited i-face "\n") | ||
| 8153 | (org-fast-tag-insert "Current" current c-face "\n\n") | ||
| 8154 | (setq tbl table char ?a cnt 0) | ||
| 8155 | (while (setq e (pop tbl)) | ||
| 8156 | (cond | ||
| 8157 | ((equal e '(:startgroup)) | ||
| 8158 | (push '() groups) (setq ingroup t) | ||
| 8159 | (when (not (= cnt 0)) | ||
| 8160 | (setq cnt 0) | ||
| 8161 | (insert "\n")) | ||
| 8162 | (insert "{ ")) | ||
| 8163 | ((equal e '(:endgroup)) | ||
| 8164 | (setq ingroup nil cnt 0) | ||
| 8165 | (insert "}\n")) | ||
| 8166 | (t | ||
| 8167 | (setq tg (car e) c2 nil) | ||
| 8168 | (if (cdr e) | ||
| 8169 | (setq c (cdr e)) | ||
| 8170 | ;; automatically assign a character. | ||
| 8171 | (setq c1 (string-to-char | ||
| 8172 | (downcase (substring | ||
| 8173 | tg (if (= (string-to-char tg) ?@) 1 0))))) | ||
| 8174 | (if (or (rassoc c1 ntable) (rassoc c1 table)) | ||
| 8175 | (while (or (rassoc char ntable) (rassoc char table)) | ||
| 8176 | (setq char (1+ char))) | ||
| 8177 | (setq c2 c1)) | ||
| 8178 | (setq c (or c2 char))) | ||
| 8179 | (if ingroup (push tg (car groups))) | ||
| 8180 | (setq tg (org-add-props tg nil 'face | ||
| 8181 | (cond | ||
| 8182 | ((member tg current) c-face) | ||
| 8183 | ((member tg inherited) i-face) | ||
| 8184 | (t nil)))) | ||
| 8185 | (if (and (= cnt 0) (not ingroup)) (insert " ")) | ||
| 8186 | (insert "[" c "] " tg (make-string | ||
| 8187 | (- fwidth 4 (length tg)) ?\ )) | ||
| 8188 | (push (cons tg c) ntable) | ||
| 8189 | (when (= (setq cnt (1+ cnt)) ncol) | ||
| 8190 | (insert "\n") | ||
| 8191 | (if ingroup (insert " ")) | ||
| 8192 | (setq cnt 0))))) | ||
| 8193 | (setq ntable (nreverse ntable)) | ||
| 8194 | (insert "\n") | ||
| 8195 | (goto-char (point-min)) | ||
| 8196 | (if (fboundp 'fit-window-to-buffer) (fit-window-to-buffer)) | ||
| 8197 | (setq rtn | ||
| 8198 | (catch 'exit | ||
| 8199 | (while t | ||
| 8200 | (message "[key]:Toggle SPC: clear current RET accept%s" | ||
| 8201 | (if groups " [!] ignore goups" "")) | ||
| 8202 | (setq c (read-char-exclusive)) | ||
| 8203 | (cond | ||
| 8204 | ((= c ?\r) (throw 'exit t)) | ||
| 8205 | ((= c ?!) | ||
| 8206 | (setq groups nil) | ||
| 8207 | (goto-char (point-min)) | ||
| 8208 | (while (re-search-forward "[{}]" nil t) (replace-match " "))) | ||
| 8209 | ((or (= c ?\C-g) | ||
| 8210 | (and (= c ?q) (not (rassoc c ntable)))) | ||
| 8211 | (setq quit-flag t)) | ||
| 8212 | ((= c ?\ ) (setq current nil)) | ||
| 8213 | ((setq e (rassoc c ntable) tg (car e)) | ||
| 8214 | (if (member tg current) | ||
| 8215 | (setq current (delete tg current)) | ||
| 8216 | (loop for g in groups do | ||
| 8217 | (if (member tg g) | ||
| 8218 | (mapcar (lambda (x) | ||
| 8219 | (setq current (delete x current))) | ||
| 8220 | g))) | ||
| 8221 | (setq current (cons tg current))))) | ||
| 8222 | ;; Create a sorted list | ||
| 8223 | (setq current | ||
| 8224 | (sort current | ||
| 8225 | (lambda (a b) | ||
| 8226 | (assoc b (cdr (memq (assoc a ntable) ntable)))))) | ||
| 8227 | (goto-char (point-min)) | ||
| 8228 | (beginning-of-line 2) | ||
| 8229 | (delete-region (point) (point-at-eol)) | ||
| 8230 | (org-fast-tag-insert "Current" current c-face) | ||
| 8231 | (while (re-search-forward "\\[.\\] \\([a-zA-Z0-9_@]+\\)" nil t) | ||
| 8232 | (setq tg (match-string 1)) | ||
| 8233 | (add-text-properties (match-beginning 1) (match-end 1) | ||
| 8234 | (list 'face | ||
| 8235 | (cond | ||
| 8236 | ((member tg current) c-face) | ||
| 8237 | ((member tg inherited) i-face) | ||
| 8238 | (t nil))))) | ||
| 8239 | (goto-char (point-min))))) | ||
| 8240 | (if rtn | ||
| 8241 | (mapconcat 'identity current ":") | ||
| 8242 | nil)))) | ||
| 8243 | |||
| 7215 | (defun org-get-tags () | 8244 | (defun org-get-tags () |
| 7216 | "Get the TAGS string in the current headline." | 8245 | "Get the TAGS string in the current headline." |
| 7217 | (unless (org-on-heading-p) | 8246 | (unless (org-on-heading-p) |
| @@ -7234,6 +8263,50 @@ With prefix ARG, realign all tags in headings in the current buffer." | |||
| 7234 | 8263 | ||
| 7235 | ;;; Link Stuff | 8264 | ;;; Link Stuff |
| 7236 | 8265 | ||
| 8266 | (defvar org-create-file-search-functions nil | ||
| 8267 | "List of functions to construct the right search string for a file link. | ||
| 8268 | These functions are called in turn with point at the location to | ||
| 8269 | which the link should point. | ||
| 8270 | |||
| 8271 | A function in the hook should first test if it would like to | ||
| 8272 | handle this file type, for example by checking the major-mode or | ||
| 8273 | the file extension. If it decides not to handle this file, it | ||
| 8274 | should just return nil to give other functions a chance. If it | ||
| 8275 | does handle the file, it must return the search string to be used | ||
| 8276 | when following the link. The search string will be part of the | ||
| 8277 | file link, given after a double colon, and `org-open-at-point' | ||
| 8278 | will automatically search for it. If special measures must be | ||
| 8279 | taken to make the search successful, another function should be | ||
| 8280 | added to the companion hook `org-execute-file-search-functions', | ||
| 8281 | which see. | ||
| 8282 | |||
| 8283 | A function in this hook may also use `setq' to set the variable | ||
| 8284 | `description' to provide a suggestion for the descriptive text to | ||
| 8285 | be used for this link when it gets inserted into an Org-mode | ||
| 8286 | buffer with \\[org-insert-link].") | ||
| 8287 | |||
| 8288 | (defvar org-execute-file-search-functions nil | ||
| 8289 | "List of functions to execute a file search triggered by a link. | ||
| 8290 | |||
| 8291 | Functions added to this hook must accept a single argument, the | ||
| 8292 | search string that was part of the file link, the part after the | ||
| 8293 | double colon. The function must first check if it would like to | ||
| 8294 | handle this search, for example by checking the major-mode or the | ||
| 8295 | file extension. If it decides not to handle this search, it | ||
| 8296 | should just return nil to give other functions a chance. If it | ||
| 8297 | does handle the search, it must return a non-nil value to keep | ||
| 8298 | other functions from trying. | ||
| 8299 | |||
| 8300 | Each function can access the current prefix argument through the | ||
| 8301 | variable `current-prefix-argument'. Note that a single prefix is | ||
| 8302 | used to force opening a link in Emacs, so it may be good to only | ||
| 8303 | use a numeric or double prefix to guide the search function. | ||
| 8304 | |||
| 8305 | In case this is needed, a function in this hook can also restore | ||
| 8306 | the window configuration before `org-open-at-point' was called using: | ||
| 8307 | |||
| 8308 | (set-window-configuration org-window-config-before-follow-link)") | ||
| 8309 | |||
| 7237 | (defun org-find-file-at-mouse (ev) | 8310 | (defun org-find-file-at-mouse (ev) |
| 7238 | "Open file link or URL at mouse." | 8311 | "Open file link or URL at mouse." |
| 7239 | (interactive "e") | 8312 | (interactive "e") |
| @@ -7246,6 +8319,10 @@ With prefix ARG, realign all tags in headings in the current buffer." | |||
| 7246 | (mouse-set-point ev) | 8319 | (mouse-set-point ev) |
| 7247 | (org-open-at-point)) | 8320 | (org-open-at-point)) |
| 7248 | 8321 | ||
| 8322 | (defvar org-window-config-before-follow-link nil | ||
| 8323 | "The window configuration before following a link. | ||
| 8324 | This is saved in case the need arises to restore it.") | ||
| 8325 | |||
| 7249 | (defun org-open-at-point (&optional in-emacs) | 8326 | (defun org-open-at-point (&optional in-emacs) |
| 7250 | "Open link at or after point. | 8327 | "Open link at or after point. |
| 7251 | If there is no link at point, this function will search forward up to | 8328 | If there is no link at point, this function will search forward up to |
| @@ -7253,6 +8330,7 @@ the end of the current subtree. | |||
| 7253 | Normally, files will be opened by an appropriate application. If the | 8330 | Normally, files will be opened by an appropriate application. If the |
| 7254 | optional argument IN-EMACS is non-nil, Emacs will visit the file." | 8331 | optional argument IN-EMACS is non-nil, Emacs will visit the file." |
| 7255 | (interactive "P") | 8332 | (interactive "P") |
| 8333 | (setq org-window-config-before-follow-link (current-window-configuration)) | ||
| 7256 | (org-remove-occur-highlights nil nil t) | 8334 | (org-remove-occur-highlights nil nil t) |
| 7257 | (if (org-at-timestamp-p) | 8335 | (if (org-at-timestamp-p) |
| 7258 | (org-agenda-list nil (time-to-days (org-time-string-to-time | 8336 | (org-agenda-list nil (time-to-days (org-time-string-to-time |
| @@ -7336,7 +8414,7 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file." | |||
| 7336 | (t nil)))) | 8414 | (t nil)))) |
| 7337 | 8415 | ||
| 7338 | ((string= type "file") | 8416 | ((string= type "file") |
| 7339 | (if (string-match "::?\\([0-9]+\\)\\'" path) ;; second : optional | 8417 | (if (string-match "::\\([0-9]+\\)\\'" path) |
| 7340 | (setq line (string-to-number (match-string 1 path)) | 8418 | (setq line (string-to-number (match-string 1 path)) |
| 7341 | path (substring path 0 (match-beginning 0))) | 8419 | path (substring path 0 (match-beginning 0))) |
| 7342 | (if (string-match "::\\(.+\\)\\'" path) | 8420 | (if (string-match "::\\(.+\\)\\'" path) |
| @@ -7350,6 +8428,9 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file." | |||
| 7350 | ((string= type "bbdb") | 8428 | ((string= type "bbdb") |
| 7351 | (org-follow-bbdb-link path)) | 8429 | (org-follow-bbdb-link path)) |
| 7352 | 8430 | ||
| 8431 | ((string= type "info") | ||
| 8432 | (org-follow-info-link path)) | ||
| 8433 | |||
| 7353 | ((string= type "gnus") | 8434 | ((string= type "gnus") |
| 7354 | (let (group article) | 8435 | (let (group article) |
| 7355 | (if (not (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" path)) | 8436 | (if (not (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" path)) |
| @@ -7397,8 +8478,8 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file." | |||
| 7397 | (setq cmd (replace-match "<" t t cmd))) | 8478 | (setq cmd (replace-match "<" t t cmd))) |
| 7398 | (while (string-match "@}" cmd) | 8479 | (while (string-match "@}" cmd) |
| 7399 | (setq cmd (replace-match ">" t t cmd))) | 8480 | (setq cmd (replace-match ">" t t cmd))) |
| 7400 | (if (or (not org-confirm-shell-links) | 8481 | (if (or (not org-confirm-shell-link-function) |
| 7401 | (funcall org-confirm-shell-links | 8482 | (funcall org-confirm-shell-link-function |
| 7402 | (format "Execute \"%s\" in shell? " | 8483 | (format "Execute \"%s\" in shell? " |
| 7403 | (org-add-props cmd nil | 8484 | (org-add-props cmd nil |
| 7404 | 'face 'org-warning)))) | 8485 | 'face 'org-warning)))) |
| @@ -7407,6 +8488,16 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file." | |||
| 7407 | (shell-command cmd)) | 8488 | (shell-command cmd)) |
| 7408 | (error "Abort")))) | 8489 | (error "Abort")))) |
| 7409 | 8490 | ||
| 8491 | ((string= type "elisp") | ||
| 8492 | (let ((cmd path)) | ||
| 8493 | (if (or (not org-confirm-elisp-link-function) | ||
| 8494 | (funcall org-confirm-elisp-link-function | ||
| 8495 | (format "Execute \"%s\" as elisp? " | ||
| 8496 | (org-add-props cmd nil | ||
| 8497 | 'face 'org-warning)))) | ||
| 8498 | (message "%s => %s" cmd (eval (read cmd))) | ||
| 8499 | (error "Abort")))) | ||
| 8500 | |||
| 7410 | (t | 8501 | (t |
| 7411 | (browse-url-at-point)))))) | 8502 | (browse-url-at-point)))))) |
| 7412 | 8503 | ||
| @@ -7423,73 +8514,77 @@ in all files." | |||
| 7423 | (pos (point)) | 8514 | (pos (point)) |
| 7424 | (pre "") (post "") | 8515 | (pre "") (post "") |
| 7425 | words re0 re1 re2 re3 re4 re5 re2a reall camel) | 8516 | words re0 re1 re2 re3 re4 re5 re2a reall camel) |
| 7426 | (cond ((save-excursion | 8517 | (cond |
| 7427 | (goto-char (point-min)) | 8518 | ;; First check if there are any special |
| 7428 | (and | 8519 | ((run-hook-with-args-until-success 'org-execute-file-search-functions s)) |
| 7429 | (re-search-forward | 8520 | ;; Now try the builtin stuff |
| 7430 | (concat "<<" (regexp-quote s0) ">>") nil t) | 8521 | ((save-excursion |
| 7431 | (setq pos (match-beginning 0)))) | 8522 | (goto-char (point-min)) |
| 7432 | ;; There is an exact target for this | 8523 | (and |
| 7433 | (goto-char pos)) | 8524 | (re-search-forward |
| 7434 | ((string-match "^/\\(.*\\)/$" s) | 8525 | (concat "<<" (regexp-quote s0) ">>") nil t) |
| 7435 | ;; A regular expression | 8526 | (setq pos (match-beginning 0)))) |
| 7436 | (cond | 8527 | ;; There is an exact target for this |
| 7437 | ((eq major-mode 'org-mode) | 8528 | (goto-char pos)) |
| 7438 | (org-occur (match-string 1 s))) | 8529 | ((string-match "^/\\(.*\\)/$" s) |
| 7439 | ;;((eq major-mode 'dired-mode) | 8530 | ;; A regular expression |
| 7440 | ;; (grep (concat "grep -n -e '" (match-string 1 s) "' *"))) | 8531 | (cond |
| 7441 | (t (org-do-occur (match-string 1 s))))) | 8532 | ((eq major-mode 'org-mode) |
| 7442 | ((or (setq camel (string-match (concat "^" org-camel-regexp "$") s)) | 8533 | (org-occur (match-string 1 s))) |
| 7443 | t) | 8534 | ;;((eq major-mode 'dired-mode) |
| 7444 | ;; A camel or a normal search string | 8535 | ;; (grep (concat "grep -n -e '" (match-string 1 s) "' *"))) |
| 7445 | (when (equal (string-to-char s) ?*) | 8536 | (t (org-do-occur (match-string 1 s))))) |
| 7446 | ;; Anchor on headlines, post may include tags. | 8537 | ((or (setq camel (string-match (concat "^" org-camel-regexp "$") s)) |
| 7447 | (setq pre "^\\*+[ \t]*\\(\\sw+\\)?[ \t]*" | 8538 | t) |
| 7448 | post "[ \t]*\\([ \t]+:[a-zA-Z_@0-9:+]:[ \t]*\\)?$" | 8539 | ;; A camel or a normal search string |
| 7449 | s (substring s 1))) | 8540 | (when (equal (string-to-char s) ?*) |
| 7450 | (remove-text-properties | 8541 | ;; Anchor on headlines, post may include tags. |
| 7451 | 0 (length s) | 8542 | (setq pre "^\\*+[ \t]*\\(?:\\sw+\\)?[ \t]*" |
| 7452 | '(face nil mouse-face nil keymap nil fontified nil) s) | 8543 | post "[ \t]*\\(?:[ \t]+:[a-zA-Z_@0-9:+]:[ \t]*\\)?$" |
| 7453 | ;; Make a series of regular expressions to find a match | 8544 | s (substring s 1))) |
| 7454 | (setq words | 8545 | (remove-text-properties |
| 7455 | (if camel | 8546 | 0 (length s) |
| 7456 | (org-camel-to-words s) | 8547 | '(face nil mouse-face nil keymap nil fontified nil) s) |
| 7457 | (org-split-string s "[ \n\r\t]+")) | 8548 | ;; Make a series of regular expressions to find a match |
| 7458 | re0 (concat "<<" (regexp-quote s0) ">>") | 8549 | (setq words |
| 7459 | re2 (concat "\\<" (mapconcat 'downcase words "[ \t]+") "\\>") | 8550 | (if camel |
| 7460 | re2a (concat "\\<" (mapconcat 'downcase words "[ \t\r\n]+") "\\>") | 8551 | (org-camel-to-words s) |
| 7461 | re4 (concat "\\<" (mapconcat 'downcase words "[^a-zA-Z_\r\n]+") "\\>") | 8552 | (org-split-string s "[ \n\r\t]+")) |
| 7462 | re1 (concat pre re2 post) | 8553 | re0 (concat "\\(<<" (regexp-quote s0) ">>\\)") |
| 7463 | re3 (concat pre re4 post) | 8554 | re2 (concat "[ \t\r\n]\\(" (mapconcat 'downcase words "[ \t]+") "\\)[ \t\r\n]") |
| 7464 | re5 (concat pre ".*" re4) | 8555 | re2a (concat "[ \t\r\n]\\(" (mapconcat 'downcase words "[ \t\r\n]+") "\\)[ \t\r\n]") |
| 7465 | re2 (concat pre re2) | 8556 | re4 (concat "[^a-zA-Z_]\\(" (mapconcat 'downcase words "[^a-zA-Z_\r\n]+") "\\)[^a-zA-Z_]") |
| 7466 | re2a (concat pre re2a) | 8557 | re1 (concat pre re2 post) |
| 7467 | re4 (concat pre re4) | 8558 | re3 (concat pre re4 post) |
| 7468 | reall (concat "\\(" re0 "\\)\\|\\(" re1 "\\)\\|\\(" re2 | 8559 | re5 (concat pre ".*" re4) |
| 7469 | "\\)\\|\\(" re3 "\\)\\|\\(" re4 "\\)\\|\\(" | 8560 | re2 (concat pre re2) |
| 7470 | re5 "\\)" | 8561 | re2a (concat pre re2a) |
| 7471 | )) | 8562 | re4 (concat pre re4) |
| 7472 | (cond | 8563 | reall (concat "\\(" re0 "\\)\\|\\(" re1 "\\)\\|\\(" re2 |
| 7473 | ((eq type 'org-occur) (org-occur reall)) | 8564 | "\\)\\|\\(" re3 "\\)\\|\\(" re4 "\\)\\|\\(" |
| 7474 | ((eq type 'occur) (org-do-occur (downcase reall) 'cleanup)) | 8565 | re5 "\\)" |
| 7475 | (t (goto-char (point-min)) | 8566 | )) |
| 7476 | (if (or (org-search-not-link re0 nil t) | 8567 | (cond |
| 7477 | (org-search-not-link re1 nil t) | 8568 | ((eq type 'org-occur) (org-occur reall)) |
| 7478 | (org-search-not-link re2 nil t) | 8569 | ((eq type 'occur) (org-do-occur (downcase reall) 'cleanup)) |
| 7479 | (org-search-not-link re2a nil t) | 8570 | (t (goto-char (point-min)) |
| 7480 | (org-search-not-link re3 nil t) | 8571 | (if (or (org-search-not-link re0 nil t) |
| 7481 | (org-search-not-link re4 nil t) | 8572 | (org-search-not-link re1 nil t) |
| 7482 | (org-search-not-link re5 nil t) | 8573 | (org-search-not-link re2 nil t) |
| 7483 | ) | 8574 | (org-search-not-link re2a nil t) |
| 7484 | (goto-char (match-beginning 0)) | 8575 | (org-search-not-link re3 nil t) |
| 7485 | (goto-char pos) | 8576 | (org-search-not-link re4 nil t) |
| 7486 | (error "No match"))))) | 8577 | (org-search-not-link re5 nil t) |
| 7487 | (t | 8578 | ) |
| 7488 | ;; Normal string-search | 8579 | (goto-char (match-beginning 1)) |
| 7489 | (goto-char (point-min)) | 8580 | (goto-char pos) |
| 7490 | (if (search-forward s nil t) | 8581 | (error "No match"))))) |
| 7491 | (goto-char (match-beginning 0)) | 8582 | (t |
| 7492 | (error "No match")))) | 8583 | ;; Normal string-search |
| 8584 | (goto-char (point-min)) | ||
| 8585 | (if (search-forward s nil t) | ||
| 8586 | (goto-char (match-beginning 0)) | ||
| 8587 | (error "No match")))) | ||
| 7493 | (and (eq major-mode 'org-mode) (org-show-hierarchy-above)))) | 8588 | (and (eq major-mode 'org-mode) (org-show-hierarchy-above)))) |
| 7494 | 8589 | ||
| 7495 | (defun org-search-not-link (&rest args) | 8590 | (defun org-search-not-link (&rest args) |
| @@ -7609,6 +8704,18 @@ onto the ring." | |||
| 7609 | (delete-window (get-buffer-window "*BBDB*")) | 8704 | (delete-window (get-buffer-window "*BBDB*")) |
| 7610 | (error "No matching BBDB record"))))) | 8705 | (error "No matching BBDB record"))))) |
| 7611 | 8706 | ||
| 8707 | |||
| 8708 | (defun org-follow-info-link (name) | ||
| 8709 | "Follow an info file & node link to NAME." | ||
| 8710 | (if (or (string-match "\\(.*\\)::?\\(.*\\)" name) | ||
| 8711 | (string-match "\\(.*\\)" name)) | ||
| 8712 | (progn | ||
| 8713 | (require 'info) | ||
| 8714 | (if (match-string 2 name) ; If there isn't a node, choose "Top" | ||
| 8715 | (Info-find-node (match-string 1 name) (match-string 2 name)) | ||
| 8716 | (Info-find-node (match-string 1 name) "Top"))) | ||
| 8717 | (message (concat "Could not open: " name)))) | ||
| 8718 | |||
| 7612 | (defun org-follow-gnus-link (&optional group article) | 8719 | (defun org-follow-gnus-link (&optional group article) |
| 7613 | "Follow a Gnus link to GROUP and ARTICLE." | 8720 | "Follow a Gnus link to GROUP and ARTICLE." |
| 7614 | (require 'gnus) | 8721 | (require 'gnus) |
| @@ -7792,6 +8899,61 @@ folders." | |||
| 7792 | (kill-this-buffer) | 8899 | (kill-this-buffer) |
| 7793 | (error "Message not found")))) | 8900 | (error "Message not found")))) |
| 7794 | 8901 | ||
| 8902 | ;; BibTeX links | ||
| 8903 | |||
| 8904 | ;; Use the custom search meachnism to construct and use search strings for | ||
| 8905 | ;; file links to BibTeX database entries. | ||
| 8906 | |||
| 8907 | (defun org-create-file-search-in-bibtex () | ||
| 8908 | "Create the search string and description for a BibTeX database entry." | ||
| 8909 | (when (eq major-mode 'bibtex-mode) | ||
| 8910 | ;; yes, we want to construct this search string. | ||
| 8911 | ;; Make a good description for this entry, using names, year and the title | ||
| 8912 | ;; Put it into the `description' variable which is dynamically scoped. | ||
| 8913 | (let ((bibtex-autokey-names 1) | ||
| 8914 | (bibtex-autokey-names-stretch 1) | ||
| 8915 | (bibtex-autokey-name-case-convert-function 'identity) | ||
| 8916 | (bibtex-autokey-name-separator " & ") | ||
| 8917 | (bibtex-autokey-additional-names " et al.") | ||
| 8918 | (bibtex-autokey-year-length 4) | ||
| 8919 | (bibtex-autokey-name-year-separator " ") | ||
| 8920 | (bibtex-autokey-titlewords 3) | ||
| 8921 | (bibtex-autokey-titleword-separator " ") | ||
| 8922 | (bibtex-autokey-titleword-case-convert-function 'identity) | ||
| 8923 | (bibtex-autokey-titleword-length 'infty) | ||
| 8924 | (bibtex-autokey-year-title-separator ": ")) | ||
| 8925 | (setq description (bibtex-generate-autokey))) | ||
| 8926 | ;; Now parse the entry, get the key and return it. | ||
| 8927 | (save-excursion | ||
| 8928 | (bibtex-beginning-of-entry) | ||
| 8929 | (cdr (assoc "=key=" (bibtex-parse-entry)))))) | ||
| 8930 | |||
| 8931 | (defun org-execute-file-search-in-bibtex (s) | ||
| 8932 | "Find the link search string S as a key for a database entry." | ||
| 8933 | (when (eq major-mode 'bibtex-mode) | ||
| 8934 | ;; Yes, we want to do the search in this file. | ||
| 8935 | ;; We construct a regexp that searches for "@entrytype{" followed by the key | ||
| 8936 | (goto-char (point-min)) | ||
| 8937 | (and (re-search-forward (concat "@[a-zA-Z]+[ \t\n]*{[ \t\n]*" | ||
| 8938 | (regexp-quote s) "[ \t\n]*,") nil t) | ||
| 8939 | (goto-char (match-beginning 0))) | ||
| 8940 | (if (and (match-beginning 0) (equal current-prefix-arg '(16))) | ||
| 8941 | ;; Use double prefix to indicate that any web link should be browsed | ||
| 8942 | (let ((b (current-buffer)) (p (point))) | ||
| 8943 | ;; Restore the window configuration because we just use the web link | ||
| 8944 | (set-window-configuration org-window-config-before-follow-link) | ||
| 8945 | (save-excursion (set-buffer b) (goto-char p) | ||
| 8946 | (bibtex-url))) | ||
| 8947 | (recenter 0)) ; Move entry start to beginning of window | ||
| 8948 | ;; return t to indicate that the search is done. | ||
| 8949 | t)) | ||
| 8950 | |||
| 8951 | ;; Finally add the functions to the right hooks. | ||
| 8952 | (add-hook 'org-create-file-search-functions 'org-create-file-search-in-bibtex) | ||
| 8953 | (add-hook 'org-execute-file-search-functions 'org-execute-file-search-in-bibtex) | ||
| 8954 | |||
| 8955 | ;; end of Bibtex link setup | ||
| 8956 | |||
| 7795 | (defun org-upgrade-old-links (&optional query-description) | 8957 | (defun org-upgrade-old-links (&optional query-description) |
| 7796 | "Transfer old <...> style links to new [[...]] style links. | 8958 | "Transfer old <...> style links to new [[...]] style links. |
| 7797 | With arg query-description, ask at each match for a description text to use | 8959 | With arg query-description, ask at each match for a description text to use |
| @@ -7799,8 +8961,8 @@ for this link." | |||
| 7799 | (interactive (list (y-or-n-p "Would you like to be queried for a description at each link?"))) | 8961 | (interactive (list (y-or-n-p "Would you like to be queried for a description at each link?"))) |
| 7800 | (save-excursion | 8962 | (save-excursion |
| 7801 | (goto-char (point-min)) | 8963 | (goto-char (point-min)) |
| 7802 | (let ((re (concat "\\([^[]\\)<\\(" | 8964 | (let ((re (concat "\\([^[]\\)<\\(" |
| 7803 | "\\(" (mapconcat 'identity org-link-types "\\|") | 8965 | "\\(" (mapconcat 'identity org-link-types "\\|") |
| 7804 | "\\):" | 8966 | "\\):" |
| 7805 | "[^" org-non-link-chars "]+\\)>")) | 8967 | "[^" org-non-link-chars "]+\\)>")) |
| 7806 | l1 l2 (cnt 0)) | 8968 | l1 l2 (cnt 0)) |
| @@ -7907,7 +9069,7 @@ For some link types, a prefix arg is interpreted: | |||
| 7907 | For links to usenet articles, arg negates `org-usenet-links-prefer-google'. | 9069 | For links to usenet articles, arg negates `org-usenet-links-prefer-google'. |
| 7908 | For file links, arg negates `org-context-in-file-links'." | 9070 | For file links, arg negates `org-context-in-file-links'." |
| 7909 | (interactive "P") | 9071 | (interactive "P") |
| 7910 | (let (link cpltxt desc txt (pos (point))) | 9072 | (let (link cpltxt desc description search txt (pos (point))) |
| 7911 | (cond | 9073 | (cond |
| 7912 | 9074 | ||
| 7913 | ((eq major-mode 'bbdb-mode) | 9075 | ((eq major-mode 'bbdb-mode) |
| @@ -7917,6 +9079,13 @@ For file links, arg negates `org-context-in-file-links'." | |||
| 7917 | (bbdb-record-company (bbdb-current-record)))) | 9079 | (bbdb-record-company (bbdb-current-record)))) |
| 7918 | link (org-make-link cpltxt))) | 9080 | link (org-make-link cpltxt))) |
| 7919 | 9081 | ||
| 9082 | ((eq major-mode 'Info-mode) | ||
| 9083 | (setq link (org-make-link "info:" | ||
| 9084 | (file-name-nondirectory Info-current-file) | ||
| 9085 | ":" Info-current-node)) | ||
| 9086 | (setq cpltxt (concat (file-name-nondirectory Info-current-file) | ||
| 9087 | ":" Info-current-node))) | ||
| 9088 | |||
| 7920 | ((eq major-mode 'calendar-mode) | 9089 | ((eq major-mode 'calendar-mode) |
| 7921 | (let ((cd (calendar-cursor-to-date))) | 9090 | (let ((cd (calendar-cursor-to-date))) |
| 7922 | (setq link | 9091 | (setq link |
| @@ -8020,6 +9189,12 @@ For file links, arg negates `org-context-in-file-links'." | |||
| 8020 | (setq cpltxt w3m-current-url | 9189 | (setq cpltxt w3m-current-url |
| 8021 | link (org-make-link cpltxt))) | 9190 | link (org-make-link cpltxt))) |
| 8022 | 9191 | ||
| 9192 | ((setq search (run-hook-with-args-until-success | ||
| 9193 | 'org-create-file-search-functions)) | ||
| 9194 | (setq link (concat "file:" (abbreviate-file-name buffer-file-name) | ||
| 9195 | "::" search)) | ||
| 9196 | (setq cpltxt (or description link))) | ||
| 9197 | |||
| 8023 | ((eq major-mode 'org-mode) | 9198 | ((eq major-mode 'org-mode) |
| 8024 | ;; Just link to current headline | 9199 | ;; Just link to current headline |
| 8025 | (setq cpltxt (concat "file:" | 9200 | (setq cpltxt (concat "file:" |
| @@ -8039,12 +9214,13 @@ For file links, arg negates `org-context-in-file-links'." | |||
| 8039 | ((org-region-active-p) | 9214 | ((org-region-active-p) |
| 8040 | (buffer-substring (region-beginning) (region-end))) | 9215 | (buffer-substring (region-beginning) (region-end))) |
| 8041 | (t (buffer-substring (point-at-bol) (point-at-eol))))) | 9216 | (t (buffer-substring (point-at-bol) (point-at-eol))))) |
| 8042 | (setq cpltxt | 9217 | (when (or (null txt) (string-match "\\S-" txt)) |
| 8043 | (concat cpltxt "::" | 9218 | (setq cpltxt |
| 8044 | (if org-file-link-context-use-camel-case | 9219 | (concat cpltxt "::" |
| 8045 | (org-make-org-heading-camel txt) | 9220 | (if org-file-link-context-use-camel-case |
| 8046 | (org-make-org-heading-search-string txt))) | 9221 | (org-make-org-heading-camel txt) |
| 8047 | desc "NONE"))) | 9222 | (org-make-org-heading-search-string txt))) |
| 9223 | desc "NONE")))) | ||
| 8048 | (if (string-match "::\\'" cpltxt) | 9224 | (if (string-match "::\\'" cpltxt) |
| 8049 | (setq cpltxt (substring cpltxt 0 -2))) | 9225 | (setq cpltxt (substring cpltxt 0 -2))) |
| 8050 | (setq link (org-make-link cpltxt))) | 9226 | (setq link (org-make-link cpltxt))) |
| @@ -8058,12 +9234,14 @@ For file links, arg negates `org-context-in-file-links'." | |||
| 8058 | (setq txt (if (org-region-active-p) | 9234 | (setq txt (if (org-region-active-p) |
| 8059 | (buffer-substring (region-beginning) (region-end)) | 9235 | (buffer-substring (region-beginning) (region-end)) |
| 8060 | (buffer-substring (point-at-bol) (point-at-eol)))) | 9236 | (buffer-substring (point-at-bol) (point-at-eol)))) |
| 8061 | (setq cpltxt | 9237 | ;; Only use search option if there is some text. |
| 8062 | (concat cpltxt "::" | 9238 | (when (string-match "\\S-" txt) |
| 8063 | (if org-file-link-context-use-camel-case | 9239 | (setq cpltxt |
| 8064 | (org-make-org-heading-camel txt) | 9240 | (concat cpltxt "::" |
| 8065 | (org-make-org-heading-search-string txt))) | 9241 | (if org-file-link-context-use-camel-case |
| 8066 | desc "NONE")) | 9242 | (org-make-org-heading-camel txt) |
| 9243 | (org-make-org-heading-search-string txt))) | ||
| 9244 | desc "NONE"))) | ||
| 8067 | (setq link (org-make-link cpltxt))) | 9245 | (setq link (org-make-link cpltxt))) |
| 8068 | 9246 | ||
| 8069 | ((interactive-p) | 9247 | ((interactive-p) |
| @@ -8249,8 +9427,8 @@ is in the current directory or below." | |||
| 8249 | ;; We do have a link at point, and we are going to edit it. | 9427 | ;; We do have a link at point, and we are going to edit it. |
| 8250 | (setq remove (list (match-beginning 0) (match-end 0))) | 9428 | (setq remove (list (match-beginning 0) (match-end 0))) |
| 8251 | (setq desc (if (match-end 3) (org-match-string-no-properties 3))) | 9429 | (setq desc (if (match-end 3) (org-match-string-no-properties 3))) |
| 8252 | (setq link (read-string "Link: " | 9430 | (setq link (read-string "Link: " |
| 8253 | (org-link-unescape | 9431 | (org-link-unescape |
| 8254 | (org-match-string-no-properties 1))))) | 9432 | (org-match-string-no-properties 1))))) |
| 8255 | (complete-file | 9433 | (complete-file |
| 8256 | ;; Completing read for file names. | 9434 | ;; Completing read for file names. |
| @@ -8287,23 +9465,46 @@ is in the current directory or below." | |||
| 8287 | ;; URL-like link, normalize the use of angular brackets. | 9465 | ;; URL-like link, normalize the use of angular brackets. |
| 8288 | (setq link (org-make-link (org-remove-angle-brackets link)))) | 9466 | (setq link (org-make-link (org-remove-angle-brackets link)))) |
| 8289 | 9467 | ||
| 8290 | ;; Check if we are linking to the current file. If yes, simplify the link. | 9468 | ;; Check if we are linking to the current file with a search option |
| 9469 | ;; If yes, simplify the link by using only the search option. | ||
| 8291 | (when (string-match "\\<file:\\(.+?\\)::\\([^>]+\\)" link) | 9470 | (when (string-match "\\<file:\\(.+?\\)::\\([^>]+\\)" link) |
| 8292 | (let* ((path (match-string 1 link)) | 9471 | (let* ((path (match-string 1 link)) |
| 8293 | (case-fold-search nil) | 9472 | (case-fold-search nil) |
| 8294 | (search (match-string 2 link))) | 9473 | (search (match-string 2 link))) |
| 8295 | (when (save-match-data | 9474 | (save-match-data |
| 8296 | (equal (file-truename buffer-file-name) | 9475 | (if (equal (file-truename buffer-file-name) (file-truename path)) |
| 8297 | (file-truename path))) | 9476 | ;; We are linking to this same file, with a search option |
| 8298 | ;; We are linking to this same file, with a search option | 9477 | (setq link search))))) |
| 8299 | (setq link search)))) | 9478 | |
| 9479 | ;; Check if we can/should use a relative path. If yes, simplify the link | ||
| 9480 | (when (string-match "\\<file:\\(.*\\)" link) | ||
| 9481 | (let* ((path (match-string 1 link)) | ||
| 9482 | (case-fold-search nil)) | ||
| 9483 | (cond | ||
| 9484 | ((eq org-link-file-path-type 'absolute) | ||
| 9485 | (setq path (abbreviate-file-name (expand-file-name path)))) | ||
| 9486 | ((eq org-link-file-path-type 'noabbrev) | ||
| 9487 | (setq path (expand-file-name path))) | ||
| 9488 | ((eq org-link-file-path-type 'relative) | ||
| 9489 | (setq path (file-relative-name path))) | ||
| 9490 | (t | ||
| 9491 | (save-match-data | ||
| 9492 | (if (string-match (concat "^" (regexp-quote | ||
| 9493 | (file-name-as-directory | ||
| 9494 | (expand-file-name ".")))) | ||
| 9495 | (expand-file-name path)) | ||
| 9496 | ;; We are linking a file with relative path name. | ||
| 9497 | (setq path (substring (expand-file-name path) | ||
| 9498 | (match-end 0))))))) | ||
| 9499 | (setq link (concat "file:" path)))) | ||
| 9500 | |||
| 8300 | (setq desc (read-string "Description: " desc)) | 9501 | (setq desc (read-string "Description: " desc)) |
| 8301 | (unless (string-match "\\S-" desc) (setq desc nil)) | 9502 | (unless (string-match "\\S-" desc) (setq desc nil)) |
| 8302 | (if remove (apply 'delete-region remove)) | 9503 | (if remove (apply 'delete-region remove)) |
| 8303 | (insert (org-make-link-string link desc)))) | 9504 | (insert (org-make-link-string link desc)))) |
| 8304 | 9505 | ||
| 8305 | (defun org-completing-read (&rest args) | 9506 | (defun org-completing-read (&rest args) |
| 8306 | (let ((minibuffer-local-completion-map | 9507 | (let ((minibuffer-local-completion-map |
| 8307 | (copy-keymap minibuffer-local-completion-map))) | 9508 | (copy-keymap minibuffer-local-completion-map))) |
| 8308 | (define-key minibuffer-local-completion-map " " 'self-insert-command) | 9509 | (define-key minibuffer-local-completion-map " " 'self-insert-command) |
| 8309 | (apply 'completing-read args))) | 9510 | (apply 'completing-read args))) |
| @@ -8329,48 +9530,52 @@ RET on headline -> Store as sublevel entry to current headline | |||
| 8329 | 9530 | ||
| 8330 | ;;;###autoload | 9531 | ;;;###autoload |
| 8331 | (defun org-remember-apply-template () | 9532 | (defun org-remember-apply-template () |
| 8332 | "Initialize *remember* buffer with template, invode `org-mode'. | 9533 | "Initialize *remember* buffer with template, invoke `org-mode'. |
| 8333 | This function should be placed into `remember-mode-hook' and in fact requires | 9534 | This function should be placed into `remember-mode-hook' and in fact requires |
| 8334 | to be run from that hook to fucntion properly." | 9535 | to be run from that hook to fucntion properly." |
| 8335 | (when org-remember-templates | 9536 | (if org-remember-templates |
| 8336 | (let* ((entry (if (= (length org-remember-templates) 1) | 9537 | |
| 8337 | (cdar org-remember-templates) | 9538 | (let* ((entry (if (= (length org-remember-templates) 1) |
| 8338 | (message "Select template: %s" | 9539 | (cdar org-remember-templates) |
| 8339 | (mapconcat | 9540 | (message "Select template: %s" |
| 8340 | (lambda (x) (char-to-string (car x))) | 9541 | (mapconcat |
| 8341 | org-remember-templates " ")) | 9542 | (lambda (x) (char-to-string (car x))) |
| 8342 | (cdr (assoc (read-char-exclusive) org-remember-templates)))) | 9543 | org-remember-templates " ")) |
| 8343 | (tpl (if (consp (cdr entry)) (cadr entry) (cdr entry))) | 9544 | (cdr (assoc (read-char-exclusive) org-remember-templates)))) |
| 8344 | (file (if (consp (cdr entry)) (nth 2 entry))) | 9545 | (tpl (car entry)) |
| 8345 | (v-t (format-time-string (car org-time-stamp-formats) (org-current-time))) | 9546 | (file (if (consp (cdr entry)) (nth 1 entry))) |
| 8346 | (v-T (format-time-string (cdr org-time-stamp-formats) (org-current-time))) | 9547 | (v-t (format-time-string (car org-time-stamp-formats) (org-current-time))) |
| 8347 | (v-u (concat "[" (substring v-t 1 -1) "]")) | 9548 | (v-T (format-time-string (cdr org-time-stamp-formats) (org-current-time))) |
| 8348 | (v-U (concat "[" (substring v-T 1 -1) "]")) | 9549 | (v-u (concat "[" (substring v-t 1 -1) "]")) |
| 8349 | (v-a annotation) ; defined in `remember-mode' | 9550 | (v-U (concat "[" (substring v-T 1 -1) "]")) |
| 8350 | (v-i initial) ; defined in `remember-mode' | 9551 | (v-a annotation) ; defined in `remember-mode' |
| 8351 | (v-n user-full-name) | 9552 | (v-i initial) ; defined in `remember-mode' |
| 8352 | ) | 9553 | (v-n user-full-name) |
| 8353 | (unless tpl (setq tpl "") (message "No template") (ding)) | 9554 | ) |
| 8354 | (insert tpl) (goto-char (point-min)) | 9555 | (unless tpl (setq tpl "") (message "No template") (ding)) |
| 8355 | (while (re-search-forward "%\\([tTuTai]\\)" nil t) | 9556 | (insert tpl) (goto-char (point-min)) |
| 8356 | (when (and initial (equal (match-string 0) "%i")) | 9557 | (while (re-search-forward "%\\([tTuTai]\\)" nil t) |
| 8357 | (save-match-data | 9558 | (when (and initial (equal (match-string 0) "%i")) |
| 8358 | (let* ((lead (buffer-substring | 9559 | (save-match-data |
| 8359 | (point-at-bol) (match-beginning 0)))) | 9560 | (let* ((lead (buffer-substring |
| 8360 | (setq v-i (mapconcat 'identity | 9561 | (point-at-bol) (match-beginning 0)))) |
| 9562 | (setq v-i (mapconcat 'identity | ||
| 8361 | (org-split-string initial "\n") | 9563 | (org-split-string initial "\n") |
| 8362 | (concat "\n" lead)))))) | 9564 | (concat "\n" lead)))))) |
| 8363 | (replace-match | 9565 | (replace-match |
| 8364 | (or (eval (intern (concat "v-" (match-string 1)))) "") | 9566 | (or (eval (intern (concat "v-" (match-string 1)))) "") |
| 8365 | t t)) | 9567 | t t)) |
| 8366 | (let ((org-startup-folded nil) | 9568 | (let ((org-startup-folded nil) |
| 8367 | (org-startup-with-deadline-check nil)) | 9569 | (org-startup-with-deadline-check nil)) |
| 8368 | (org-mode)) | 9570 | (org-mode)) |
| 8369 | (if (and file (string-match "\\S-" file) (not (file-directory-p file))) | 9571 | (if (and file (string-match "\\S-" file) (not (file-directory-p file))) |
| 8370 | (set (make-local-variable 'org-default-notes-file) file)) | 9572 | (set (make-local-variable 'org-default-notes-file) file)) |
| 8371 | (goto-char (point-min)) | 9573 | (goto-char (point-min)) |
| 8372 | (if (re-search-forward "%\\?" nil t) (replace-match "")) | 9574 | (if (re-search-forward "%\\?" nil t) (replace-match ""))) |
| 8373 | (set (make-local-variable 'org-finish-function) 'remember-buffer)))) | 9575 | (let ((org-startup-folded nil) |
| 9576 | (org-startup-with-deadline-check nil)) | ||
| 9577 | (org-mode))) | ||
| 9578 | (set (make-local-variable 'org-finish-function) 'remember-buffer)) | ||
| 8374 | 9579 | ||
| 8375 | ;;;###autoload | 9580 | ;;;###autoload |
| 8376 | (defun org-remember-handler () | 9581 | (defun org-remember-handler () |
| @@ -8439,6 +9644,9 @@ See also the variable `org-reverse-note-order'." | |||
| 8439 | (if (not visiting) | 9644 | (if (not visiting) |
| 8440 | (find-file-noselect file)) | 9645 | (find-file-noselect file)) |
| 8441 | (with-current-buffer (get-file-buffer file) | 9646 | (with-current-buffer (get-file-buffer file) |
| 9647 | (save-excursion (and (goto-char (point-min)) | ||
| 9648 | (not (re-search-forward "^\\* " nil t)) | ||
| 9649 | (insert "\n* Notes\n"))) | ||
| 8442 | (setq reversed (org-notes-order-reversed-p)) | 9650 | (setq reversed (org-notes-order-reversed-p)) |
| 8443 | (save-excursion | 9651 | (save-excursion |
| 8444 | (save-restriction | 9652 | (save-restriction |
| @@ -8717,7 +9925,7 @@ This is being used to correctly align a single field after TAB or RET.") | |||
| 8717 | ;; Check if we have links | 9925 | ;; Check if we have links |
| 8718 | (goto-char beg) | 9926 | (goto-char beg) |
| 8719 | (setq links (re-search-forward org-bracket-link-regexp end t)) | 9927 | (setq links (re-search-forward org-bracket-link-regexp end t)) |
| 8720 | ;; Make sure the link properties are right FIXME: Can this be optimized???? | 9928 | ;; Make sure the link properties are right |
| 8721 | (when links (goto-char beg) (while (org-activate-bracket-links end))) | 9929 | (when links (goto-char beg) (while (org-activate-bracket-links end))) |
| 8722 | ;; Check if we are narrowing any columns | 9930 | ;; Check if we are narrowing any columns |
| 8723 | (goto-char beg) | 9931 | (goto-char beg) |
| @@ -8776,7 +9984,7 @@ This is being used to correctly align a single field after TAB or RET.") | |||
| 8776 | (error "Cannot narrow field starting with wide link \"%s\"" | 9984 | (error "Cannot narrow field starting with wide link \"%s\"" |
| 8777 | (match-string 0 xx))) | 9985 | (match-string 0 xx))) |
| 8778 | (add-text-properties f1 (length xx) (list 'org-cwidth t) xx) | 9986 | (add-text-properties f1 (length xx) (list 'org-cwidth t) xx) |
| 8779 | (add-text-properties (- f1 2) f1 | 9987 | (add-text-properties (- f1 2) f1 |
| 8780 | (list 'display org-narrow-column-arrow) | 9988 | (list 'display org-narrow-column-arrow) |
| 8781 | xx))))) | 9989 | xx))))) |
| 8782 | ;; Get the maximum width for each column | 9990 | ;; Get the maximum width for each column |
| @@ -8866,7 +10074,7 @@ With argument TABLE-TYPE, go to the beginning of a table.el-type table." | |||
| 8866 | (if table-type org-table-any-border-regexp | 10074 | (if table-type org-table-any-border-regexp |
| 8867 | org-table-border-regexp) | 10075 | org-table-border-regexp) |
| 8868 | nil t)) | 10076 | nil t)) |
| 8869 | (error "Can't find beginning of table") | 10077 | (progn (goto-char (point-min)) (point)) |
| 8870 | (goto-char (match-beginning 0)) | 10078 | (goto-char (match-beginning 0)) |
| 8871 | (beginning-of-line 2) | 10079 | (beginning-of-line 2) |
| 8872 | (point)))) | 10080 | (point)))) |
| @@ -8914,7 +10122,7 @@ Optional argument NEW may specify text to replace the current field content." | |||
| 8914 | n (format f s)) | 10122 | n (format f s)) |
| 8915 | (if new | 10123 | (if new |
| 8916 | (if (<= (length new) l) ;; FIXME: length -> str-width? | 10124 | (if (<= (length new) l) ;; FIXME: length -> str-width? |
| 8917 | (setq n (format f new t t)) ;; FIXME: t t? | 10125 | (setq n (format f new)) |
| 8918 | (setq n (concat new "|") org-table-may-need-update t))) | 10126 | (setq n (concat new "|") org-table-may-need-update t))) |
| 8919 | (or (equal n o) | 10127 | (or (equal n o) |
| 8920 | (let (org-table-may-need-update) | 10128 | (let (org-table-may-need-update) |
| @@ -9213,7 +10421,7 @@ If TABLE-TYPE is non-nil, also check for table.el-type tables." | |||
| 9213 | "Please position cursor in a data line for column operations"))))) | 10421 | "Please position cursor in a data line for column operations"))))) |
| 9214 | 10422 | ||
| 9215 | (defun org-table-delete-column () | 10423 | (defun org-table-delete-column () |
| 9216 | "Delete a column into the table." | 10424 | "Delete a column from the table." |
| 9217 | (interactive) | 10425 | (interactive) |
| 9218 | (if (not (org-at-table-p)) | 10426 | (if (not (org-at-table-p)) |
| 9219 | (error "Not at a table")) | 10427 | (error "Not at a table")) |
| @@ -9338,7 +10546,7 @@ With prefix ARG, insert above the current line." | |||
| 9338 | (buffer-substring (point-at-bol) (point-at-eol)))) | 10546 | (buffer-substring (point-at-bol) (point-at-eol)))) |
| 9339 | (col (current-column))) | 10547 | (col (current-column))) |
| 9340 | (while (string-match "|\\( +\\)|" line) | 10548 | (while (string-match "|\\( +\\)|" line) |
| 9341 | (setq line (replace-match | 10549 | (setq line (replace-match |
| 9342 | (concat "+" (make-string (- (match-end 1) (match-beginning 1)) | 10550 | (concat "+" (make-string (- (match-end 1) (match-beginning 1)) |
| 9343 | ?-) "|") t t line))) | 10551 | ?-) "|") t t line))) |
| 9344 | (and (string-match "\\+" line) (setq line (replace-match "|" t t line))) | 10552 | (and (string-match "\\+" line) (setq line (replace-match "|" t t line))) |
| @@ -9352,7 +10560,7 @@ With prefix ARG, insert above the current line." | |||
| 9352 | In particular, this does handle wide and invisible characters." | 10560 | In particular, this does handle wide and invisible characters." |
| 9353 | (if (string-match "^[ \t]*|-" s) | 10561 | (if (string-match "^[ \t]*|-" s) |
| 9354 | ;; It's a hline, just map the characters | 10562 | ;; It's a hline, just map the characters |
| 9355 | (setq s (mapcar (lambda (x) (if (member x '(?| ?+)) ?| ?\ )) s)) | 10563 | (setq s (mapconcat (lambda (x) (if (member x '(?| ?+)) "|" " ")) s "")) |
| 9356 | (while (string-match "|\\([ \t]*?[^ \t\r\n|][^\r\n|]*\\)|" s) | 10564 | (while (string-match "|\\([ \t]*?[^ \t\r\n|][^\r\n|]*\\)|" s) |
| 9357 | (setq s (replace-match | 10565 | (setq s (replace-match |
| 9358 | (concat "|" (make-string (org-string-width (match-string 1 s)) | 10566 | (concat "|" (make-string (org-string-width (match-string 1 s)) |
| @@ -9401,7 +10609,7 @@ also in table column 3. The command will prompt for the sorting method | |||
| 9401 | (lambda (a b) (< (car a) (car b))) | 10609 | (lambda (a b) (< (car a) (car b))) |
| 9402 | (lambda (a b) (string< (car a) (car b))))) | 10610 | (lambda (a b) (string< (car a) (car b))))) |
| 9403 | (setq lns (mapcar (lambda(x) (cons (org-trim (substring x bcol ecol)) x)) | 10611 | (setq lns (mapcar (lambda(x) (cons (org-trim (substring x bcol ecol)) x)) |
| 9404 | (split-string (buffer-substring beg end) "\n"))) | 10612 | (org-split-string (buffer-substring beg end) "\n"))) |
| 9405 | (if numericp | 10613 | (if numericp |
| 9406 | (setq lns (mapcar (lambda(x) | 10614 | (setq lns (mapcar (lambda(x) |
| 9407 | (cons (string-to-number (car x)) (cdr x))) | 10615 | (cons (string-to-number (car x)) (cdr x))) |
| @@ -9937,7 +11145,7 @@ the current column, to avoid unnecessary parsing." | |||
| 9937 | "\n"))) | 11145 | "\n"))) |
| 9938 | 11146 | ||
| 9939 | (defun org-table-get-stored-formulas () | 11147 | (defun org-table-get-stored-formulas () |
| 9940 | "Return an alist with the t=stored formulas directly after current table." | 11148 | "Return an alist with the stored formulas directly after current table." |
| 9941 | (interactive) | 11149 | (interactive) |
| 9942 | (let (scol eq eq-alist strings string seen) | 11150 | (let (scol eq eq-alist strings string seen) |
| 9943 | (save-excursion | 11151 | (save-excursion |
| @@ -10217,7 +11425,7 @@ not overwrite the stored one." | |||
| 10217 | (org-table-get-formula equation (equal arg '(4))))) | 11425 | (org-table-get-formula equation (equal arg '(4))))) |
| 10218 | (n0 (org-table-current-column)) | 11426 | (n0 (org-table-current-column)) |
| 10219 | (modes (copy-sequence org-calc-default-modes)) | 11427 | (modes (copy-sequence org-calc-default-modes)) |
| 10220 | n form fmt x ev orig c) | 11428 | n form fmt x ev orig c lispp) |
| 10221 | ;; Parse the format string. Since we have a lot of modes, this is | 11429 | ;; Parse the format string. Since we have a lot of modes, this is |
| 10222 | ;; a lot of work. However, I think calc still uses most of the time. | 11430 | ;; a lot of work. However, I think calc still uses most of the time. |
| 10223 | (if (string-match ";" formula) | 11431 | (if (string-match ";" formula) |
| @@ -10252,7 +11460,8 @@ not overwrite the stored one." | |||
| 10252 | (lambda (x) (number-to-string (string-to-number x))) | 11460 | (lambda (x) (number-to-string (string-to-number x))) |
| 10253 | fields))) | 11461 | fields))) |
| 10254 | (setq ndown (1- ndown)) | 11462 | (setq ndown (1- ndown)) |
| 10255 | (setq form (copy-sequence formula)) | 11463 | (setq form (copy-sequence formula) |
| 11464 | lispp (equal (substring form 0 2) "'(")) | ||
| 10256 | ;; Insert the references to fields in same row | 11465 | ;; Insert the references to fields in same row |
| 10257 | (while (string-match "\\$\\([0-9]+\\)?" form) | 11466 | (while (string-match "\\$\\([0-9]+\\)?" form) |
| 10258 | (setq n (if (match-beginning 1) | 11467 | (setq n (if (match-beginning 1) |
| @@ -10262,7 +11471,9 @@ not overwrite the stored one." | |||
| 10262 | (unless x (error "Invalid field specifier \"%s\"" | 11471 | (unless x (error "Invalid field specifier \"%s\"" |
| 10263 | (match-string 0 form))) | 11472 | (match-string 0 form))) |
| 10264 | (if (equal x "") (setq x "0")) | 11473 | (if (equal x "") (setq x "0")) |
| 10265 | (setq form (replace-match (concat "(" x ")") t t form))) | 11474 | (setq form (replace-match |
| 11475 | (if lispp x (concat "(" x ")")) | ||
| 11476 | t t form))) | ||
| 10266 | ;; Insert ranges in current column | 11477 | ;; Insert ranges in current column |
| 10267 | (while (string-match "\\&[-I0-9]+" form) | 11478 | (while (string-match "\\&[-I0-9]+" form) |
| 10268 | (setq form (replace-match | 11479 | (setq form (replace-match |
| @@ -10270,8 +11481,11 @@ not overwrite the stored one." | |||
| 10270 | (org-table-get-vertical-vector (match-string 0 form) | 11481 | (org-table-get-vertical-vector (match-string 0 form) |
| 10271 | nil n0)) | 11482 | nil n0)) |
| 10272 | t t form))) | 11483 | t t form))) |
| 10273 | (setq ev (calc-eval (cons form modes) | 11484 | (if lispp |
| 10274 | (if org-table-formula-numbers-only 'num))) | 11485 | (setq ev (eval (eval (read form))) |
| 11486 | ev (if (numberp ev) (number-to-string ev) ev)) | ||
| 11487 | (setq ev (calc-eval (cons form modes) | ||
| 11488 | (if org-table-formula-numbers-only 'num)))) | ||
| 10275 | 11489 | ||
| 10276 | (when org-table-formula-debug | 11490 | (when org-table-formula-debug |
| 10277 | (with-output-to-temp-buffer "*Help*" | 11491 | (with-output-to-temp-buffer "*Help*" |
| @@ -10827,6 +12041,109 @@ overwritten, and the table is not marked as requiring realignment." | |||
| 10827 | 12041 | ||
| 10828 | (defconst org-level-max 20) | 12042 | (defconst org-level-max 20) |
| 10829 | 12043 | ||
| 12044 | (defvar org-export-html-preamble nil | ||
| 12045 | "Preamble, to be inserted just after <body>. Set by publishing functions.") | ||
| 12046 | (defvar org-export-html-postamble nil | ||
| 12047 | "Preamble, to be inserted just before </body>. Set by publishing functions.") | ||
| 12048 | (defvar org-export-html-auto-preamble t | ||
| 12049 | "Should default preamble be inserted? Set by publishing functions.") | ||
| 12050 | (defvar org-export-html-auto-postamble t | ||
| 12051 | "Should default postamble be inserted? Set by publishing functions.") | ||
| 12052 | |||
| 12053 | (defconst org-export-plist-vars | ||
| 12054 | '((:language . org-export-default-language) | ||
| 12055 | (:headline-levels . org-export-headline-levels) | ||
| 12056 | (:section-numbers . org-export-with-section-numbers) | ||
| 12057 | (:table-of-contents . org-export-with-toc) | ||
| 12058 | (:emphasize . org-export-with-emphasize) | ||
| 12059 | (:sub-superscript . org-export-with-sub-superscripts) | ||
| 12060 | (:TeX-macros . org-export-with-TeX-macros) | ||
| 12061 | (:fixed-width . org-export-with-fixed-width) | ||
| 12062 | (:timestamps . org-export-with-timestamps) | ||
| 12063 | (:tables . org-export-with-tables) | ||
| 12064 | (:table-auto-headline . org-export-highlight-first-table-line) | ||
| 12065 | (:style . org-export-html-style) | ||
| 12066 | (:convert-org-links . org-export-html-link-org-files-as-html) | ||
| 12067 | (:inline-images . org-export-html-inline-images) | ||
| 12068 | (:expand-quoted-html . org-export-html-expand) | ||
| 12069 | (:timestamp . org-export-html-with-timestamp) | ||
| 12070 | (:publishing-directory . org-export-publishing-directory) | ||
| 12071 | (:preamble . org-export-html-preamble) | ||
| 12072 | (:postamble . org-export-html-postamble) | ||
| 12073 | (:auto-preamble . org-export-html-auto-preamble) | ||
| 12074 | (:auto-postamble . org-export-html-auto-postamble) | ||
| 12075 | (:author . user-full-name) | ||
| 12076 | (:email . user-mail-address))) | ||
| 12077 | |||
| 12078 | (defun org-default-export-plist () | ||
| 12079 | "Return the property list with default settings for the export variables." | ||
| 12080 | (let ((l org-export-plist-vars) rtn e) | ||
| 12081 | (while (setq e (pop l)) | ||
| 12082 | (setq rtn (cons (car e) (cons (symbol-value (cdr e)) rtn)))) | ||
| 12083 | rtn)) | ||
| 12084 | |||
| 12085 | (defun org-infile-export-plist () | ||
| 12086 | "Return the property list with file-local settings for export." | ||
| 12087 | (save-excursion | ||
| 12088 | (goto-char 0) | ||
| 12089 | (let ((re (org-make-options-regexp | ||
| 12090 | '("TITLE" "AUTHOR" "EMAIL" "TEXT" "OPTIONS" "LANGUAGE"))) | ||
| 12091 | (text nil) | ||
| 12092 | p key val text options) | ||
| 12093 | (while (re-search-forward re nil t) | ||
| 12094 | (setq key (org-match-string-no-properties 1) | ||
| 12095 | val (org-match-string-no-properties 2)) | ||
| 12096 | (cond | ||
| 12097 | ((string-equal key "TITLE") (setq p (plist-put p :title val))) | ||
| 12098 | ((string-equal key "AUTHOR")(setq p (plist-put p :author val))) | ||
| 12099 | ((string-equal key "EMAIL") (setq p (plist-put p :email val))) | ||
| 12100 | ((string-equal key "LANGUAGE") (setq p (plist-put p :language val))) | ||
| 12101 | ((string-equal key "TEXT") | ||
| 12102 | (setq text (if text (concat text "\n" val) val))) | ||
| 12103 | ((string-equal key "OPTIONS") (setq options val)))) | ||
| 12104 | (setq p (plist-put p :text text)) | ||
| 12105 | (when options | ||
| 12106 | (let ((op '(("H" . :headline-levels) | ||
| 12107 | ("num" . :section-numbers) | ||
| 12108 | ("toc" . :table-of-contents) | ||
| 12109 | ("\\n" . :preserve-breaks) | ||
| 12110 | ("@" . :expand-quoted-html) | ||
| 12111 | (":" . :fixed-width) | ||
| 12112 | ("|" . :tables) | ||
| 12113 | ("^" . :sub-superscript) | ||
| 12114 | ("*" . :emphasize) | ||
| 12115 | ("TeX" . :TeX-macros))) | ||
| 12116 | o) | ||
| 12117 | (while (setq o (pop op)) | ||
| 12118 | (if (string-match (concat (regexp-quote (car o)) | ||
| 12119 | ":\\([^ \t\n\r;,.]*\\)") | ||
| 12120 | options) | ||
| 12121 | (setq p (plist-put p (cdr o) | ||
| 12122 | (car (read-from-string | ||
| 12123 | (match-string 1 options))))))))) | ||
| 12124 | p))) | ||
| 12125 | |||
| 12126 | (defun org-combine-plists (&rest plists) | ||
| 12127 | "Create a single property list from all plists in PLISTS. | ||
| 12128 | The process starts by copying the last list, and then setting properties | ||
| 12129 | from the other lists. Settings in the first list are the most significant | ||
| 12130 | ones and overrule settings in the other lists." | ||
| 12131 | (let ((rtn (copy-sequence (pop plists))) | ||
| 12132 | p v ls) | ||
| 12133 | (while plists | ||
| 12134 | (setq ls (pop plists)) | ||
| 12135 | (while ls | ||
| 12136 | (setq p (pop ls) v (pop ls)) | ||
| 12137 | (setq rtn (plist-put rtn p v)))) | ||
| 12138 | rtn)) | ||
| 12139 | |||
| 12140 | (defun org-export-directory (type plist) | ||
| 12141 | (let* ((val (plist-get plist :publishing-directory)) | ||
| 12142 | (dir (if (listp val) | ||
| 12143 | (or (cdr (assoc type val)) ".") | ||
| 12144 | val))) | ||
| 12145 | dir)) | ||
| 12146 | |||
| 10830 | (defun org-export-find-first-heading-line (list) | 12147 | (defun org-export-find-first-heading-line (list) |
| 10831 | "Remove all lines from LIST which are before the first headline." | 12148 | "Remove all lines from LIST which are before the first headline." |
| 10832 | (let ((orig-list list) | 12149 | (let ((orig-list list) |
| @@ -10854,16 +12171,59 @@ overwritten, and the table is not marked as requiring realignment." | |||
| 10854 | ;; an ordinary comment line | 12171 | ;; an ordinary comment line |
| 10855 | ) | 12172 | ) |
| 10856 | ((and org-export-table-remove-special-lines | 12173 | ((and org-export-table-remove-special-lines |
| 10857 | (string-match "^[ \t]*| *[!_^] *|" line)) | 12174 | (string-match "^[ \t]*|" line) |
| 12175 | (or (string-match "^[ \t]*| *[!_^] *|" line) | ||
| 12176 | (and (string-match "| *<[0-9]+> *|" line) | ||
| 12177 | (not (string-match "| *[^ <|]" line))))) | ||
| 10858 | ;; a special table line that should be removed | 12178 | ;; a special table line that should be removed |
| 10859 | ) | 12179 | ) |
| 10860 | (t (setq rtn (cons line rtn))))) | 12180 | (t (setq rtn (cons line rtn))))) |
| 10861 | (nreverse rtn))) | 12181 | (nreverse rtn))) |
| 10862 | 12182 | ||
| 10863 | ;; ASCII | 12183 | (defun org-export (&optional arg) |
| 12184 | (interactive) | ||
| 12185 | (let ((help "[t] insert the export option template | ||
| 12186 | \[v] limit export to visible part of outline tree | ||
| 12187 | |||
| 12188 | \[a] export as ASCII | ||
| 12189 | \[h] export as HTML | ||
| 12190 | \[b] export as HTML and browse immediately | ||
| 12191 | \[x] export as XOXO | ||
| 12192 | |||
| 12193 | \[i] export current file as iCalendar file | ||
| 12194 | \[I] export all agenda files as iCalendar files | ||
| 12195 | \[c] export agenda files into combined iCalendar file | ||
| 12196 | |||
| 12197 | \[F] publish current file | ||
| 12198 | \[P] publish current project | ||
| 12199 | \[X] publish... (project will be prompted for) | ||
| 12200 | \[A] publish all projects") | ||
| 12201 | (cmds | ||
| 12202 | '((?v . org-export-visible) | ||
| 12203 | (?a . org-export-as-ascii) | ||
| 12204 | (?h . org-export-as-html) | ||
| 12205 | (?b . org-export-as-html-and-open) | ||
| 12206 | (?x . org-export-as-xoxo) | ||
| 12207 | (?i . org-export-icalendar-this-file) | ||
| 12208 | (?I . org-export-icalendar-all-agenda-files) | ||
| 12209 | (?c . org-export-icalendar-combine-agenda-files) | ||
| 12210 | (?F . org-publish-current-file) | ||
| 12211 | (?P . org-publish-current-project) | ||
| 12212 | (?X . org-publish) | ||
| 12213 | (?A . org-publish-all))) | ||
| 12214 | r1 r2 ass) | ||
| 12215 | (save-window-excursion | ||
| 12216 | (delete-other-windows) | ||
| 12217 | (with-output-to-temp-buffer "*Org Export/Publishing Help*" | ||
| 12218 | (princ help)) | ||
| 12219 | (message "Select command: ") | ||
| 12220 | (setq r1 (read-char-exclusive))) | ||
| 12221 | (setq r2 (if (< r1 27) (+ r1 96) r1)) | ||
| 12222 | (if (setq ass (assq r2 cmds)) | ||
| 12223 | (call-interactively (cdr ass)) | ||
| 12224 | (error "No command associated with key %c" r1)))) | ||
| 10864 | 12225 | ||
| 10865 | (defconst org-ascii-underline '(?\$ ?\# ?^ ?\~ ?\= ?\-) | 12226 | ;; ASCII |
| 10866 | "Characters for underlining headings in ASCII export.") | ||
| 10867 | 12227 | ||
| 10868 | (defconst org-html-entities | 12228 | (defconst org-html-entities |
| 10869 | '(("nbsp") | 12229 | '(("nbsp") |
| @@ -11163,7 +12523,7 @@ The list contains HTML entities for Latin-1, Greek and other symbols. | |||
| 11163 | It is supplemented by a number of commonly used TeX macros with appropriate | 12523 | It is supplemented by a number of commonly used TeX macros with appropriate |
| 11164 | translations. There is currently no way for users to extend this.") | 12524 | translations. There is currently no way for users to extend this.") |
| 11165 | 12525 | ||
| 11166 | (defun org-cleaned-string-for-export (string) | 12526 | (defun org-cleaned-string-for-export (string &rest parameters) |
| 11167 | "Cleanup a buffer substring so that links can be created safely." | 12527 | "Cleanup a buffer substring so that links can be created safely." |
| 11168 | (interactive) | 12528 | (interactive) |
| 11169 | (let* ((cb (current-buffer)) | 12529 | (let* ((cb (current-buffer)) |
| @@ -11196,15 +12556,21 @@ translations. There is currently no way for users to extend this.") | |||
| 11196 | (goto-char (point-min)) | 12556 | (goto-char (point-min)) |
| 11197 | (while (re-search-forward re-plain-link nil t) | 12557 | (while (re-search-forward re-plain-link nil t) |
| 11198 | (replace-match | 12558 | (replace-match |
| 11199 | (concat | 12559 | (concat |
| 11200 | (match-string 1) "[[" (match-string 2) ":" (match-string 3) "]]") | 12560 | (match-string 1) "[[" (match-string 2) ":" (match-string 3) "]]") |
| 11201 | t t)) | 12561 | t t)) |
| 11202 | (goto-char (point-min)) | 12562 | (goto-char (point-min)) |
| 11203 | (while (re-search-forward re-angle-link nil t) | 12563 | (while (re-search-forward re-angle-link nil t) |
| 11204 | (replace-match | 12564 | (replace-match |
| 11205 | (concat | 12565 | (concat |
| 11206 | (match-string 1) "[[" (match-string 2) ":" (match-string 3) "]]") | 12566 | (match-string 1) "[[" (match-string 2) ":" (match-string 3) "]]") |
| 11207 | t t)) | 12567 | t t)) |
| 12568 | ;; Find multiline emphasis and put them into single line | ||
| 12569 | (when (assq :emph-multiline parameters) | ||
| 12570 | (goto-char (point-min)) | ||
| 12571 | (while (re-search-forward org-emph-re nil t) | ||
| 12572 | (subst-char-in-region (match-beginning 0) (match-end 0) ?\n ?\ t) | ||
| 12573 | (goto-char (1- (match-end 0))))) | ||
| 11208 | 12574 | ||
| 11209 | ;; Remove comments | 12575 | ;; Remove comments |
| 11210 | (goto-char (point-min)) | 12576 | (goto-char (point-min)) |
| @@ -11266,6 +12632,7 @@ is signaled in this case." | |||
| 11266 | (if org-odd-levels-only (1+ (/ n 2)) n)) | 12632 | (if org-odd-levels-only (1+ (/ n 2)) n)) |
| 11267 | 12633 | ||
| 11268 | (defvar org-last-level nil) ; dynamically scoped variable | 12634 | (defvar org-last-level nil) ; dynamically scoped variable |
| 12635 | (defvar org-ascii-current-indentation nil) ; For communication | ||
| 11269 | 12636 | ||
| 11270 | (defun org-export-as-ascii (arg) | 12637 | (defun org-export-as-ascii (arg) |
| 11271 | "Export the outline as a pretty ASCII file. | 12638 | "Export the outline as a pretty ASCII file. |
| @@ -11274,7 +12641,9 @@ The prefix ARG specifies how many levels of the outline should become | |||
| 11274 | underlined headlines. The default is 3." | 12641 | underlined headlines. The default is 3." |
| 11275 | (interactive "P") | 12642 | (interactive "P") |
| 11276 | (setq-default org-todo-line-regexp org-todo-line-regexp) | 12643 | (setq-default org-todo-line-regexp org-todo-line-regexp) |
| 11277 | (let* ((region | 12644 | (let* ((opt-plist (org-combine-plists (org-default-export-plist) |
| 12645 | (org-infile-export-plist))) | ||
| 12646 | (region | ||
| 11278 | (buffer-substring | 12647 | (buffer-substring |
| 11279 | (if (org-region-active-p) (region-beginning) (point-min)) | 12648 | (if (org-region-active-p) (region-beginning) (point-min)) |
| 11280 | (if (org-region-active-p) (region-end) (point-max)))) | 12649 | (if (org-region-active-p) (region-end) (point-max)))) |
| @@ -11283,21 +12652,28 @@ underlined headlines. The default is 3." | |||
| 11283 | (org-split-string | 12652 | (org-split-string |
| 11284 | (org-cleaned-string-for-export region) | 12653 | (org-cleaned-string-for-export region) |
| 11285 | "[\r\n]")))) | 12654 | "[\r\n]")))) |
| 12655 | (org-ascii-current-indentation '(0 . 0)) | ||
| 11286 | (org-startup-with-deadline-check nil) | 12656 | (org-startup-with-deadline-check nil) |
| 11287 | (level 0) line txt | 12657 | (level 0) line txt |
| 11288 | (umax nil) | 12658 | (umax nil) |
| 11289 | (case-fold-search nil) | 12659 | (case-fold-search nil) |
| 11290 | (filename (concat (file-name-sans-extension buffer-file-name) | 12660 | (filename (concat (file-name-as-directory |
| 12661 | (org-export-directory :ascii opt-plist)) | ||
| 12662 | (file-name-sans-extension | ||
| 12663 | (file-name-nondirectory buffer-file-name)) | ||
| 11291 | ".txt")) | 12664 | ".txt")) |
| 11292 | (buffer (find-file-noselect filename)) | 12665 | (buffer (find-file-noselect filename)) |
| 11293 | (levels-open (make-vector org-level-max nil)) | 12666 | (levels-open (make-vector org-level-max nil)) |
| 12667 | (odd org-odd-levels-only) | ||
| 11294 | (date (format-time-string "%Y/%m/%d" (current-time))) | 12668 | (date (format-time-string "%Y/%m/%d" (current-time))) |
| 11295 | (time (format-time-string "%X" (org-current-time))) | 12669 | (time (format-time-string "%X" (org-current-time))) |
| 11296 | (author user-full-name) | 12670 | (author (plist-get opt-plist :author)) |
| 11297 | (title (buffer-name)) | 12671 | (title (or (plist-get opt-plist :title) |
| 12672 | (file-name-sans-extension | ||
| 12673 | (file-name-nondirectory buffer-file-name)))) | ||
| 11298 | (options nil) | 12674 | (options nil) |
| 11299 | (email user-mail-address) | 12675 | (email (plist-get opt-plist :email)) |
| 11300 | (language org-export-default-language) | 12676 | (language (plist-get opt-plist :language)) |
| 11301 | (text nil) | 12677 | (text nil) |
| 11302 | (todo nil) | 12678 | (todo nil) |
| 11303 | (lang-words nil)) | 12679 | (lang-words nil)) |
| @@ -11307,9 +12683,6 @@ underlined headlines. The default is 3." | |||
| 11307 | 12683 | ||
| 11308 | (find-file-noselect filename) | 12684 | (find-file-noselect filename) |
| 11309 | 12685 | ||
| 11310 | ;; Search for the export key lines | ||
| 11311 | (org-parse-key-lines) | ||
| 11312 | |||
| 11313 | (setq lang-words (or (assoc language org-export-language-setup) | 12686 | (setq lang-words (or (assoc language org-export-language-setup) |
| 11314 | (assoc "en" org-export-language-setup))) | 12687 | (assoc "en" org-export-language-setup))) |
| 11315 | (if org-export-ascii-show-new-buffer | 12688 | (if org-export-ascii-show-new-buffer |
| @@ -11317,7 +12690,13 @@ underlined headlines. The default is 3." | |||
| 11317 | (set-buffer buffer)) | 12690 | (set-buffer buffer)) |
| 11318 | (erase-buffer) | 12691 | (erase-buffer) |
| 11319 | (fundamental-mode) | 12692 | (fundamental-mode) |
| 11320 | (if options (org-parse-export-options options)) | 12693 | ;; create local variables for all options, to make sure all called |
| 12694 | ;; functions get the correct information | ||
| 12695 | (mapcar (lambda (x) | ||
| 12696 | (set (make-local-variable (cdr x)) | ||
| 12697 | (plist-get opt-plist (car x)))) | ||
| 12698 | org-export-plist-vars) | ||
| 12699 | (set (make-local-variable 'org-odd-levels-only) odd) | ||
| 11321 | (setq umax (if arg (prefix-numeric-value arg) | 12700 | (setq umax (if arg (prefix-numeric-value arg) |
| 11322 | org-export-headline-levels)) | 12701 | org-export-headline-levels)) |
| 11323 | 12702 | ||
| @@ -11347,7 +12726,8 @@ underlined headlines. The default is 3." | |||
| 11347 | level (org-tr-level level) | 12726 | level (org-tr-level level) |
| 11348 | txt (match-string 3 line) | 12727 | txt (match-string 3 line) |
| 11349 | todo | 12728 | todo |
| 11350 | (or (and (match-beginning 2) | 12729 | (or (and org-export-mark-todo-in-toc |
| 12730 | (match-beginning 2) | ||
| 11351 | (not (equal (match-string 2 line) | 12731 | (not (equal (match-string 2 line) |
| 11352 | org-done-string))) | 12732 | org-done-string))) |
| 11353 | ; TODO, not DONE | 12733 | ; TODO, not DONE |
| @@ -11386,10 +12766,24 @@ underlined headlines. The default is 3." | |||
| 11386 | ;; a Headline | 12766 | ;; a Headline |
| 11387 | (setq level (org-tr-level (- (match-end 1) (match-beginning 1))) | 12767 | (setq level (org-tr-level (- (match-end 1) (match-beginning 1))) |
| 11388 | txt (match-string 2 line)) | 12768 | txt (match-string 2 line)) |
| 11389 | (org-ascii-level-start level txt umax)) | 12769 | (org-ascii-level-start level txt umax lines)) |
| 11390 | (t (insert line "\n")))) | 12770 | (t |
| 12771 | (insert (org-fix-indentation line org-ascii-current-indentation) "\n")))) | ||
| 11391 | (normal-mode) | 12772 | (normal-mode) |
| 11392 | (save-buffer) | 12773 | (save-buffer) |
| 12774 | ;; remove display and invisible chars | ||
| 12775 | (let (beg end s) | ||
| 12776 | (goto-char (point-min)) | ||
| 12777 | (while (setq beg (next-single-property-change (point) 'display)) | ||
| 12778 | (setq end (next-single-property-change beg 'display)) | ||
| 12779 | (delete-region beg end) | ||
| 12780 | (goto-char beg) | ||
| 12781 | (insert "=>")) | ||
| 12782 | (goto-char (point-min)) | ||
| 12783 | (while (setq beg (next-single-property-change (point) 'org-cwidth)) | ||
| 12784 | (setq end (next-single-property-change beg 'org-cwidth)) | ||
| 12785 | (delete-region beg end) | ||
| 12786 | (goto-char beg))) | ||
| 11393 | (goto-char (point-min)))) | 12787 | (goto-char (point-min)))) |
| 11394 | 12788 | ||
| 11395 | (defun org-search-todo-below (line lines level) | 12789 | (defun org-search-todo-below (line lines level) |
| @@ -11409,8 +12803,6 @@ underlined headlines. The default is 3." | |||
| 11409 | (if (<= lv level) (throw 'exit nil)) | 12803 | (if (<= lv level) (throw 'exit nil)) |
| 11410 | (if todo (throw 'exit t)))))))) | 12804 | (if todo (throw 'exit t)))))))) |
| 11411 | 12805 | ||
| 11412 | ;; FIXME: Try to handle <b> and <i> as faces via text properties. | ||
| 11413 | ;; We could also implement *bold*,/italic/ and _underline_ for ASCII export | ||
| 11414 | (defun org-html-expand-for-ascii (line) | 12806 | (defun org-html-expand-for-ascii (line) |
| 11415 | "Handle quoted HTML for ASCII export." | 12807 | "Handle quoted HTML for ASCII export." |
| 11416 | (if org-export-html-expand | 12808 | (if org-export-html-expand |
| @@ -11428,51 +12820,81 @@ underlined headlines. The default is 3." | |||
| 11428 | (make-string (string-width s) underline) | 12820 | (make-string (string-width s) underline) |
| 11429 | "\n")))) | 12821 | "\n")))) |
| 11430 | 12822 | ||
| 11431 | (defun org-ascii-level-start (level title umax) | 12823 | (defun org-ascii-level-start (level title umax &optional lines) |
| 11432 | "Insert a new level in ASCII export." | 12824 | "Insert a new level in ASCII export." |
| 11433 | (let (char) | 12825 | (let (char (n (- level umax 1)) (ind 0)) |
| 11434 | (if (> level umax) | 12826 | (if (> level umax) |
| 11435 | (insert (make-string (* 2 (- level umax 1)) ?\ ) "* " title "\n") | 12827 | (progn |
| 12828 | (insert (make-string (* 2 n) ?\ ) | ||
| 12829 | (char-to-string (nth (% n (length org-export-ascii-bullets)) | ||
| 12830 | org-export-ascii-bullets)) | ||
| 12831 | " " title "\n") | ||
| 12832 | ;; find the indentation of the next non-empty line | ||
| 12833 | (catch 'stop | ||
| 12834 | (while lines | ||
| 12835 | (if (string-match "^\\*" (car lines)) (throw 'stop nil)) | ||
| 12836 | (if (string-match "^\\([ \t]*\\)\\S-" (car lines)) | ||
| 12837 | (throw 'stop (setq ind (org-get-indentation (car lines))))) | ||
| 12838 | (pop lines))) | ||
| 12839 | (setq org-ascii-current-indentation (cons (* 2 (1+ n)) ind))) | ||
| 11436 | (if (or (not (equal (char-before) ?\n)) | 12840 | (if (or (not (equal (char-before) ?\n)) |
| 11437 | (not (equal (char-before (1- (point))) ?\n))) | 12841 | (not (equal (char-before (1- (point))) ?\n))) |
| 11438 | (insert "\n")) | 12842 | (insert "\n")) |
| 11439 | (setq char (nth (- umax level) (reverse org-ascii-underline))) | 12843 | (setq char (nth (- umax level) (reverse org-export-ascii-underline))) |
| 11440 | (if org-export-with-section-numbers | 12844 | (if org-export-with-section-numbers |
| 11441 | (setq title (concat (org-section-number level) " " title))) | 12845 | (setq title (concat (org-section-number level) " " title))) |
| 11442 | (insert title "\n" (make-string (string-width title) char) "\n")))) | 12846 | (insert title "\n" (make-string (string-width title) char) "\n") |
| 11443 | 12847 | (setq org-ascii-current-indentation '(0 . 0))))) | |
| 11444 | (defun org-export-copy-visible () | 12848 | |
| 11445 | "Copy the visible part of the buffer to another buffer, for printing. | 12849 | (defun org-export-visible (type arg) |
| 11446 | Also removes the first line of the buffer if it specifies a mode, | 12850 | "Create a copy of the visible part of the current buffer, and export it. |
| 11447 | and all options lines." | 12851 | The copy is created in a temporary buffer and removed after use. |
| 11448 | (interactive) | 12852 | TYPE is the final key (as a string) of the `C-c C-x' key sequence that will |
| 11449 | (let* ((filename (concat (file-name-sans-extension buffer-file-name) | 12853 | run the export command - in interactive use, the command prompts for this |
| 11450 | ".txt")) | 12854 | key. As a special case, if the you type SPC at the prompt, the temporary |
| 11451 | (buffer (find-file-noselect filename)) | 12855 | org-mode file will not be removed but presented to you so that you can |
| 11452 | (ore (concat | 12856 | continue to use it. The prefix arg ARG is passed through to the exporting |
| 11453 | (org-make-options-regexp | 12857 | command." |
| 11454 | '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO" | 12858 | (interactive |
| 11455 | "STARTUP" "ARCHIVE" | 12859 | (list (progn |
| 11456 | "TITLE" "AUTHOR" "EMAIL" "TEXT" "OPTIONS" "LANGUAGE")) | 12860 | (message "Export visible: [a]SCII [h]tml [b]rowse HTML [x]OXO [ ]keep buffer") |
| 11457 | (if org-noutline-p "\\(\n\\|$\\)" ""))) | 12861 | (char-to-string (read-char-exclusive))) |
| 12862 | current-prefix-arg)) | ||
| 12863 | (if (not (member type '("a" "\C-a" "b" "\C-b" "h" "x" " "))) | ||
| 12864 | (error "Invalid export key")) | ||
| 12865 | ;; FIXME: do this more explicit? | ||
| 12866 | (let* ((binding (key-binding (concat "\C-c\C-x" type))) | ||
| 12867 | (keepp (equal type " ")) | ||
| 12868 | (file buffer-file-name) | ||
| 12869 | (buffer (get-buffer-create "*Org Export Visible*")) | ||
| 11458 | s e) | 12870 | s e) |
| 11459 | (with-current-buffer buffer | 12871 | (with-current-buffer buffer (erase-buffer)) |
| 11460 | (erase-buffer) | ||
| 11461 | (text-mode)) | ||
| 11462 | (save-excursion | 12872 | (save-excursion |
| 11463 | (setq s (goto-char (point-min))) | 12873 | (setq s (goto-char (point-min))) |
| 11464 | (while (not (= (point) (point-max))) | 12874 | (while (not (= (point) (point-max))) |
| 11465 | (goto-char (org-find-invisible)) | 12875 | (goto-char (org-find-invisible)) |
| 11466 | (append-to-buffer buffer s (point)) | 12876 | (append-to-buffer buffer s (point)) |
| 11467 | (setq s (goto-char (org-find-visible))))) | 12877 | (setq s (goto-char (org-find-visible)))) |
| 11468 | (switch-to-buffer-other-window buffer) | 12878 | (goto-char (point-min)) |
| 11469 | (newline) | 12879 | (unless keepp |
| 11470 | (goto-char (point-min)) | 12880 | ;; Copy all comment lines to the end, to make sure #+ settings are |
| 11471 | (if (looking-at ".*-\\*- mode:.*\n") | 12881 | ;; still available for the second export step. Kind of a hack, but |
| 11472 | (replace-match "")) | 12882 | ;; does do the trick. |
| 11473 | (while (re-search-forward ore nil t) | 12883 | (if (looking-at "#[^\r\n]*") |
| 11474 | (replace-match "")) | 12884 | (append-to-buffer buffer (match-beginning 0) (1+ (match-end 0)))) |
| 11475 | (goto-char (point-min)))) | 12885 | (while (re-search-forward "[\n\r]#[^\n\r]*" nil t) |
| 12886 | (append-to-buffer buffer (1+ (match-beginning 0)) | ||
| 12887 | (min (point-max) (1+ (match-end 0)))))) | ||
| 12888 | (set-buffer buffer) | ||
| 12889 | (let ((buffer-file-name file) | ||
| 12890 | (org-inhibit-startup t)) | ||
| 12891 | (org-mode) | ||
| 12892 | (show-all) | ||
| 12893 | (unless keepp (funcall binding arg)))) | ||
| 12894 | (if (not keepp) | ||
| 12895 | (kill-buffer buffer) | ||
| 12896 | (switch-to-buffer-other-window buffer) | ||
| 12897 | (goto-char (point-min))))) | ||
| 11476 | 12898 | ||
| 11477 | (defun org-find-visible () | 12899 | (defun org-find-visible () |
| 11478 | (if (featurep 'noutline) | 12900 | (if (featurep 'noutline) |
| @@ -11491,6 +12913,7 @@ and all options lines." | |||
| 11491 | (skip-chars-forward "^\r") | 12913 | (skip-chars-forward "^\r") |
| 11492 | (point))) | 12914 | (point))) |
| 11493 | 12915 | ||
| 12916 | |||
| 11494 | ;; HTML | 12917 | ;; HTML |
| 11495 | 12918 | ||
| 11496 | (defun org-get-current-options () | 12919 | (defun org-get-current-options () |
| @@ -11506,7 +12929,8 @@ Does include HTML export options as well as TODO and CATEGORY stuff." | |||
| 11506 | #+CATEGORY: %s | 12929 | #+CATEGORY: %s |
| 11507 | #+SEQ_TODO: %s | 12930 | #+SEQ_TODO: %s |
| 11508 | #+TYP_TODO: %s | 12931 | #+TYP_TODO: %s |
| 11509 | #+STARTUP: %s %s %s %s %s | 12932 | #+STARTUP: %s %s %s %s %s %s |
| 12933 | #+TAGS: %s | ||
| 11510 | #+ARCHIVE: %s | 12934 | #+ARCHIVE: %s |
| 11511 | " | 12935 | " |
| 11512 | (buffer-name) (user-full-name) user-mail-address org-export-default-language | 12936 | (buffer-name) (user-full-name) user-mail-address org-export-default-language |
| @@ -11533,6 +12957,8 @@ Does include HTML export options as well as TODO and CATEGORY stuff." | |||
| 11533 | (if org-odd-levels-only "odd" "oddeven") | 12957 | (if org-odd-levels-only "odd" "oddeven") |
| 11534 | (if org-hide-leading-stars "hidestars" "showstars") | 12958 | (if org-hide-leading-stars "hidestars" "showstars") |
| 11535 | (if org-startup-align-all-tables "align" "noalign") | 12959 | (if org-startup-align-all-tables "align" "noalign") |
| 12960 | (if org-log-done "logging" "nologging") | ||
| 12961 | (if org-tag-alist (mapconcat 'car org-tag-alist " ") "") | ||
| 11536 | org-archive-location | 12962 | org-archive-location |
| 11537 | )) | 12963 | )) |
| 11538 | 12964 | ||
| @@ -11606,16 +13032,23 @@ emacs --batch | |||
| 11606 | --visit=MyFile --funcall org-export-as-html-batch" | 13032 | --visit=MyFile --funcall org-export-as-html-batch" |
| 11607 | (org-export-as-html org-export-headline-levels 'hidden)) | 13033 | (org-export-as-html org-export-headline-levels 'hidden)) |
| 11608 | 13034 | ||
| 11609 | (defun org-export-as-html (arg &optional hidden) | 13035 | (defun org-export-as-html (arg &optional hidden ext-plist) |
| 11610 | "Export the outline as a pretty HTML file. | 13036 | "Export the outline as a pretty HTML file. |
| 11611 | If there is an active region, export only the region. | 13037 | If there is an active region, export only the region. |
| 11612 | The prefix ARG specifies how many levels of the outline should become | 13038 | The prefix ARG specifies how many levels of the outline should become |
| 11613 | headlines. The default is 3. Lower levels will become bulleted lists." | 13039 | headlines. The default is 3. Lower levels will become bulleted lists. |
| 13040 | When HIDDEN is non-nil, don't display the HTML buffer. | ||
| 13041 | EXT-PLIST is a property list with external parameters overriding | ||
| 13042 | org-mode's default settings, but still inferior to file-local settings." | ||
| 11614 | (interactive "P") | 13043 | (interactive "P") |
| 11615 | (setq-default org-todo-line-regexp org-todo-line-regexp) | 13044 | (setq-default org-todo-line-regexp org-todo-line-regexp) |
| 11616 | (setq-default org-deadline-line-regexp org-deadline-line-regexp) | 13045 | (setq-default org-deadline-line-regexp org-deadline-line-regexp) |
| 11617 | (setq-default org-done-string org-done-string) | 13046 | (setq-default org-done-string org-done-string) |
| 11618 | (let* ((style org-export-html-style) | 13047 | (let* ((opt-plist (org-combine-plists (org-default-export-plist) |
| 13048 | ext-plist | ||
| 13049 | (org-infile-export-plist))) | ||
| 13050 | |||
| 13051 | (style (plist-get opt-plist :style)) | ||
| 11619 | (odd org-odd-levels-only) | 13052 | (odd org-odd-levels-only) |
| 11620 | (region-p (org-region-active-p)) | 13053 | (region-p (org-region-active-p)) |
| 11621 | (region | 13054 | (region |
| @@ -11624,35 +13057,40 @@ headlines. The default is 3. Lower levels will become bulleted lists." | |||
| 11624 | (if region-p (region-end) (point-max)))) | 13057 | (if region-p (region-end) (point-max)))) |
| 11625 | (all_lines | 13058 | (all_lines |
| 11626 | (org-skip-comments (org-split-string | 13059 | (org-skip-comments (org-split-string |
| 11627 | (org-cleaned-string-for-export region) | 13060 | (org-cleaned-string-for-export |
| 13061 | region :emph-multiline) | ||
| 11628 | "[\r\n]"))) | 13062 | "[\r\n]"))) |
| 11629 | (lines (org-export-find-first-heading-line all_lines)) | 13063 | (lines (org-export-find-first-heading-line all_lines)) |
| 11630 | (level 0) (line "") (origline "") txt todo | 13064 | (level 0) (line "") (origline "") txt todo |
| 11631 | (umax nil) | 13065 | (umax nil) |
| 11632 | (filename (concat (file-name-sans-extension buffer-file-name) | 13066 | (filename (concat (file-name-as-directory |
| 11633 | ".html")) | 13067 | (org-export-directory :html opt-plist)) |
| 13068 | (file-name-sans-extension | ||
| 13069 | (file-name-nondirectory buffer-file-name)) | ||
| 13070 | ".html")) | ||
| 11634 | (buffer (find-file-noselect filename)) | 13071 | (buffer (find-file-noselect filename)) |
| 11635 | (levels-open (make-vector org-level-max nil)) | 13072 | (levels-open (make-vector org-level-max nil)) |
| 11636 | (date (format-time-string "%Y/%m/%d" (current-time))) | 13073 | (date (format-time-string "%Y/%m/%d" (current-time))) |
| 11637 | (time (format-time-string "%X" (org-current-time))) | 13074 | (time (format-time-string "%X" (org-current-time))) |
| 11638 | (author user-full-name) | 13075 | (author (plist-get opt-plist :author)) |
| 11639 | (title (buffer-name)) | 13076 | (title (or (plist-get opt-plist :title) |
| 11640 | (options nil) | 13077 | (file-name-sans-extension |
| 11641 | (quote-re (concat "^\\*+[ \t]*" org-quote-string "\\>")) | 13078 | (file-name-nondirectory buffer-file-name)))) |
| 13079 | (quote-re0 (concat "^[ \t]*" org-quote-string "\\>")) | ||
| 13080 | (quote-re (concat "^\\(\\*+\\)\\([ \t]*" org-quote-string "\\>\\)")) | ||
| 11642 | (inquote nil) | 13081 | (inquote nil) |
| 11643 | (infixed nil) | 13082 | (infixed nil) |
| 11644 | (in-local-list nil) | 13083 | (in-local-list nil) |
| 11645 | (local-list-num nil) | 13084 | (local-list-num nil) |
| 11646 | (local-list-indent nil) | 13085 | (local-list-indent nil) |
| 11647 | (llt org-plain-list-ordered-item-terminator) | 13086 | (llt org-plain-list-ordered-item-terminator) |
| 11648 | (email user-mail-address) | 13087 | (email (plist-get opt-plist :email)) |
| 11649 | (language org-export-default-language) | 13088 | (language (plist-get opt-plist :language)) |
| 11650 | (text nil) | 13089 | (text (plist-get opt-plist :text)) |
| 11651 | (lang-words nil) | 13090 | (lang-words nil) |
| 11652 | (target-alist nil) tg | 13091 | (target-alist nil) tg |
| 11653 | (head-count 0) cnt | 13092 | (head-count 0) cnt |
| 11654 | (start 0) | 13093 | (start 0) |
| 11655 | ;; FIXME: The following returns always nil under XEmacs | ||
| 11656 | (coding-system (and (fboundp 'coding-system-get) | 13094 | (coding-system (and (fboundp 'coding-system-get) |
| 11657 | (boundp 'buffer-file-coding-system) | 13095 | (boundp 'buffer-file-coding-system) |
| 11658 | buffer-file-coding-system)) | 13096 | buffer-file-coding-system)) |
| @@ -11663,15 +13101,14 @@ headlines. The default is 3. Lower levels will become bulleted lists." | |||
| 11663 | table-open type | 13101 | table-open type |
| 11664 | table-buffer table-orig-buffer | 13102 | table-buffer table-orig-buffer |
| 11665 | ind start-is-num starter | 13103 | ind start-is-num starter |
| 11666 | rpl path desc desc1 desc2 link | 13104 | rpl path desc descp desc1 desc2 link |
| 11667 | ) | 13105 | ) |
| 11668 | (message "Exporting...") | 13106 | (message "Exporting...") |
| 11669 | 13107 | ||
| 11670 | (setq org-last-level 1) | 13108 | (setq org-last-level 1) |
| 11671 | (org-init-section-numbers) | 13109 | (org-init-section-numbers) |
| 11672 | 13110 | ||
| 11673 | ;; Search for the export key lines | 13111 | ;; Get the language-dependent settings |
| 11674 | (org-parse-key-lines) | ||
| 11675 | (setq lang-words (or (assoc language org-export-language-setup) | 13112 | (setq lang-words (or (assoc language org-export-language-setup) |
| 11676 | (assoc "en" org-export-language-setup))) | 13113 | (assoc "en" org-export-language-setup))) |
| 11677 | 13114 | ||
| @@ -11683,38 +13120,46 @@ headlines. The default is 3. Lower levels will become bulleted lists." | |||
| 11683 | (fundamental-mode) | 13120 | (fundamental-mode) |
| 11684 | (let ((case-fold-search nil) | 13121 | (let ((case-fold-search nil) |
| 11685 | (org-odd-levels-only odd)) | 13122 | (org-odd-levels-only odd)) |
| 11686 | (if options (org-parse-export-options options)) | 13123 | ;; create local variables for all options, to make sure all called |
| 13124 | ;; functions get the correct information | ||
| 13125 | (mapcar (lambda (x) | ||
| 13126 | (set (make-local-variable (cdr x)) | ||
| 13127 | (plist-get opt-plist (car x)))) | ||
| 13128 | org-export-plist-vars) | ||
| 11687 | (setq umax (if arg (prefix-numeric-value arg) | 13129 | (setq umax (if arg (prefix-numeric-value arg) |
| 11688 | org-export-headline-levels)) | 13130 | org-export-headline-levels)) |
| 11689 | 13131 | ||
| 11690 | ;; File header | 13132 | ;; File header |
| 11691 | (insert (format | 13133 | (insert (format |
| 11692 | "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" | 13134 | "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" |
| 11693 | \"http://www.w3.org/TR/REC-html40/loose.dtd\"> | 13135 | \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"> |
| 11694 | <html lang=\"%s\"><head> | 13136 | <html xmlns=\"http://www.w3.org/1999/xhtml\" |
| 13137 | lang=\"%s\" xml:lang=\"%s\"> | ||
| 13138 | <head> | ||
| 11695 | <title>%s</title> | 13139 | <title>%s</title> |
| 11696 | <meta http-equiv=\"Content-Type\" content=\"text/html;charset=%s\"> | 13140 | <meta http-equiv=\"Content-Type\" content=\"text/html;charset=%s\"/> |
| 11697 | <meta name=generator content=\"Org-mode\"> | 13141 | <meta name=\"generator\" content=\"Org-mode\"/> |
| 11698 | <meta name=generated content=\"%s %s\"> | 13142 | <meta name=\"generated\" content=\"%s %s\"/> |
| 11699 | <meta name=author content=\"%s\"> | 13143 | <meta name=\"author\" content=\"%s\"/> |
| 11700 | %s | 13144 | %s |
| 11701 | </head><body> | 13145 | </head><body> |
| 11702 | " | 13146 | " |
| 11703 | language (org-html-expand title) (or charset "iso-8859-1") | 13147 | language language (org-html-expand title) (or charset "iso-8859-1") |
| 11704 | date time author style)) | 13148 | date time author style)) |
| 11705 | (if title (insert (concat "<H1 class=\"title\">" | 13149 | |
| 11706 | (org-html-expand title) "</H1>\n"))) | 13150 | |
| 11707 | (if author (insert (concat (nth 1 lang-words) ": " author "\n"))) | 13151 | (insert (or (plist-get opt-plist :preamble) "")) |
| 11708 | (if email (insert (concat "<a href=\"mailto:" email "\"><" | 13152 | |
| 11709 | email "></a>\n"))) | 13153 | (when (plist-get opt-plist :auto-preamble) |
| 11710 | (if (or author email) (insert "<br>\n")) | 13154 | (if title (insert (concat "<h1 class=\"title\">" |
| 11711 | (if (and date time) (insert (concat (nth 2 lang-words) ": " | 13155 | (org-html-expand title) "</h1>\n"))) |
| 11712 | date " " time "<br>\n"))) | 13156 | |
| 11713 | (if text (insert (concat "<p>\n" (org-html-expand text)))) | 13157 | (if text (insert "<p>\n" (org-html-expand text) "</p>"))) |
| 13158 | |||
| 11714 | (if org-export-with-toc | 13159 | (if org-export-with-toc |
| 11715 | (progn | 13160 | (progn |
| 11716 | (insert (format "<H2>%s</H2>\n" (nth 3 lang-words))) | 13161 | (insert (format "<h2>%s</h2>\n" (nth 3 lang-words))) |
| 11717 | (insert "<ul>\n") | 13162 | (insert "<ul>\n<li>") |
| 11718 | (setq lines | 13163 | (setq lines |
| 11719 | (mapcar '(lambda (line) | 13164 | (mapcar '(lambda (line) |
| 11720 | (if (string-match org-todo-line-regexp line) | 13165 | (if (string-match org-todo-line-regexp line) |
| @@ -11724,9 +13169,11 @@ headlines. The default is 3. Lower levels will become bulleted lists." | |||
| 11724 | level (org-tr-level level) | 13169 | level (org-tr-level level) |
| 11725 | txt (save-match-data | 13170 | txt (save-match-data |
| 11726 | (org-html-expand | 13171 | (org-html-expand |
| 11727 | (match-string 3 line))) | 13172 | (org-html-cleanup-toc-line |
| 13173 | (match-string 3 line)))) | ||
| 11728 | todo | 13174 | todo |
| 11729 | (or (and (match-beginning 2) | 13175 | (or (and org-export-mark-todo-in-toc |
| 13176 | (match-beginning 2) | ||
| 11730 | (not (equal (match-string 2 line) | 13177 | (not (equal (match-string 2 line) |
| 11731 | org-done-string))) | 13178 | org-done-string))) |
| 11732 | ; TODO, not DONE | 13179 | ; TODO, not DONE |
| @@ -11744,13 +13191,13 @@ headlines. The default is 3. Lower levels will become bulleted lists." | |||
| 11744 | (progn | 13191 | (progn |
| 11745 | (setq cnt (- level org-last-level)) | 13192 | (setq cnt (- level org-last-level)) |
| 11746 | (while (>= (setq cnt (1- cnt)) 0) | 13193 | (while (>= (setq cnt (1- cnt)) 0) |
| 11747 | (insert "<ul>")) | 13194 | (insert "\n<ul>\n<li>")) |
| 11748 | (insert "\n"))) | 13195 | (insert "\n"))) |
| 11749 | (if (< level org-last-level) | 13196 | (if (< level org-last-level) |
| 11750 | (progn | 13197 | (progn |
| 11751 | (setq cnt (- org-last-level level)) | 13198 | (setq cnt (- org-last-level level)) |
| 11752 | (while (>= (setq cnt (1- cnt)) 0) | 13199 | (while (>= (setq cnt (1- cnt)) 0) |
| 11753 | (insert "</ul>")) | 13200 | (insert "</li>\n</ul>")) |
| 11754 | (insert "\n"))) | 13201 | (insert "\n"))) |
| 11755 | ;; Check for targets | 13202 | ;; Check for targets |
| 11756 | (while (string-match org-target-regexp line) | 13203 | (while (string-match org-target-regexp line) |
| @@ -11766,8 +13213,8 @@ headlines. The default is 3. Lower levels will become bulleted lists." | |||
| 11766 | (insert | 13213 | (insert |
| 11767 | (format | 13214 | (format |
| 11768 | (if todo | 13215 | (if todo |
| 11769 | "<li><a href=\"#sec-%d\"><span class=\"todo\">%s</span></a>\n" | 13216 | "</li>\n<li><a href=\"#sec-%d\"><span class=\"todo\">%s</span></a>" |
| 11770 | "<li><a href=\"#sec-%d\">%s</a>\n") | 13217 | "</li>\n<li><a href=\"#sec-%d\">%s</a>") |
| 11771 | head-count txt)) | 13218 | head-count txt)) |
| 11772 | 13219 | ||
| 11773 | (setq org-last-level level)) | 13220 | (setq org-last-level level)) |
| @@ -11776,7 +13223,7 @@ headlines. The default is 3. Lower levels will become bulleted lists." | |||
| 11776 | lines)) | 13223 | lines)) |
| 11777 | (while (> org-last-level 0) | 13224 | (while (> org-last-level 0) |
| 11778 | (setq org-last-level (1- org-last-level)) | 13225 | (setq org-last-level (1- org-last-level)) |
| 11779 | (insert "</ul>\n")) | 13226 | (insert "</li>\n</ul>\n")) |
| 11780 | )) | 13227 | )) |
| 11781 | (setq head-count 0) | 13228 | (setq head-count 0) |
| 11782 | (org-init-section-numbers) | 13229 | (org-init-section-numbers) |
| @@ -11785,7 +13232,7 @@ headlines. The default is 3. Lower levels will become bulleted lists." | |||
| 11785 | (catch 'nextline | 13232 | (catch 'nextline |
| 11786 | 13233 | ||
| 11787 | ;; end of quote section? | 13234 | ;; end of quote section? |
| 11788 | (when (and inquote (string-match "^\\*+" line)) | 13235 | (when (and inquote (string-match "^\\*+" line)) |
| 11789 | (insert "</pre>\n") | 13236 | (insert "</pre>\n") |
| 11790 | (setq inquote nil)) | 13237 | (setq inquote nil)) |
| 11791 | ;; inside a quote section? | 13238 | ;; inside a quote section? |
| @@ -11829,8 +13276,11 @@ headlines. The default is 3. Lower levels will become bulleted lists." | |||
| 11829 | "\" class=\"target\">" (match-string 1 line) "@</a> ") | 13276 | "\" class=\"target\">" (match-string 1 line) "@</a> ") |
| 11830 | t t line))))) | 13277 | t t line))))) |
| 11831 | 13278 | ||
| 13279 | (setq line (org-html-handle-time-stamps line)) | ||
| 13280 | |||
| 11832 | ;; replace "&" by "&", "<" and ">" by "<" and ">" | 13281 | ;; replace "&" by "&", "<" and ">" by "<" and ">" |
| 11833 | ;; handle @<..> HTML tags (replace "@>..<" by "<..>") | 13282 | ;; handle @<..> HTML tags (replace "@>..<" by "<..>") |
| 13283 | ;; Also handle sub_superscripts and checkboxes | ||
| 11834 | (setq line (org-html-expand line)) | 13284 | (setq line (org-html-expand line)) |
| 11835 | 13285 | ||
| 11836 | ;; Format the links | 13286 | ;; Format the links |
| @@ -11841,7 +13291,9 @@ headlines. The default is 3. Lower levels will become bulleted lists." | |||
| 11841 | (setq path (match-string 3 line)) | 13291 | (setq path (match-string 3 line)) |
| 11842 | (setq desc1 (if (match-end 5) (match-string 5 line)) | 13292 | (setq desc1 (if (match-end 5) (match-string 5 line)) |
| 11843 | desc2 (if (match-end 2) (concat type ":" path) path) | 13293 | desc2 (if (match-end 2) (concat type ":" path) path) |
| 13294 | descp (and desc1 (not (equal desc1 desc2))) | ||
| 11844 | desc (or desc1 desc2)) | 13295 | desc (or desc1 desc2)) |
| 13296 | ;; FIXME: do we need to unescape here somewhere? | ||
| 11845 | (cond | 13297 | (cond |
| 11846 | ((equal type "internal") | 13298 | ((equal type "internal") |
| 11847 | (setq rpl | 13299 | (setq rpl |
| @@ -11861,8 +13313,8 @@ headlines. The default is 3. Lower levels will become bulleted lists." | |||
| 11861 | (save-match-data | 13313 | (save-match-data |
| 11862 | (if (string-match "::\\(.*\\)" filename) | 13314 | (if (string-match "::\\(.*\\)" filename) |
| 11863 | (setq search (match-string 1 filename) | 13315 | (setq search (match-string 1 filename) |
| 11864 | filename (replace-match "" nil nil filename))) | 13316 | filename (replace-match "" t nil filename))) |
| 11865 | (setq file-is-image-p | 13317 | (setq file-is-image-p |
| 11866 | (string-match (org-image-file-name-regexp) filename)) | 13318 | (string-match (org-image-file-name-regexp) filename)) |
| 11867 | (setq thefile (if abs-p (expand-file-name filename) filename)) | 13319 | (setq thefile (if abs-p (expand-file-name filename) filename)) |
| 11868 | (when (and org-export-html-link-org-files-as-html | 13320 | (when (and org-export-html-link-org-files-as-html |
| @@ -11875,14 +13327,20 @@ headlines. The default is 3. Lower levels will become bulleted lists." | |||
| 11875 | (not (string-match "^[0-9]*$" search)) | 13327 | (not (string-match "^[0-9]*$" search)) |
| 11876 | (not (string-match "^\\*" search)) | 13328 | (not (string-match "^\\*" search)) |
| 11877 | (not (string-match "^/.*/$" search))) | 13329 | (not (string-match "^/.*/$" search))) |
| 11878 | (setq thefile (concat thefile "#" | 13330 | (setq thefile (concat thefile "#" |
| 11879 | (org-solidify-link-text | 13331 | (org-solidify-link-text |
| 11880 | (org-link-unescape search))))))) | 13332 | (org-link-unescape search))))) |
| 11881 | (setq rpl (if (and org-export-html-inline-images | 13333 | (when (string-match "^file:" desc) |
| 11882 | file-is-image-p) | 13334 | (setq desc (replace-match "" t t desc)) |
| 13335 | (if (string-match "\\.org$" desc) | ||
| 13336 | (setq desc (replace-match "" t t desc)))))) | ||
| 13337 | (setq rpl (if (and file-is-image-p | ||
| 13338 | (or (eq t org-export-html-inline-images) | ||
| 13339 | (and org-export-html-inline-images | ||
| 13340 | (not descp)))) | ||
| 11883 | (concat "<img src=\"" thefile "\"/>") | 13341 | (concat "<img src=\"" thefile "\"/>") |
| 11884 | (concat "<a href=\"" thefile "\">" desc "</a>"))))) | 13342 | (concat "<a href=\"" thefile "\">" desc "</a>"))))) |
| 11885 | ((member type '("bbdb" "vm" "wl" "mhe" "rmail" "gnus" "shell")) | 13343 | ((member type '("bbdb" "vm" "wl" "mhe" "rmail" "gnus" "shell" "info" "elisp")) |
| 11886 | (setq rpl (concat "<i><" type ":" | 13344 | (setq rpl (concat "<i><" type ":" |
| 11887 | (save-match-data (org-link-unescape path)) | 13345 | (save-match-data (org-link-unescape path)) |
| 11888 | "></i>")))) | 13346 | "></i>")))) |
| @@ -11894,28 +13352,22 @@ headlines. The default is 3. Lower levels will become bulleted lists." | |||
| 11894 | (if (equal (match-string 2 line) org-done-string) | 13352 | (if (equal (match-string 2 line) org-done-string) |
| 11895 | (setq line (replace-match | 13353 | (setq line (replace-match |
| 11896 | "<span class=\"done\">\\2</span>" | 13354 | "<span class=\"done\">\\2</span>" |
| 11897 | nil nil line 2)) | 13355 | t nil line 2)) |
| 11898 | (setq line (replace-match "<span class=\"todo\">\\2</span>" | 13356 | (setq line (replace-match "<span class=\"todo\">\\2</span>" |
| 11899 | nil nil line 2)))) | 13357 | t nil line 2)))) |
| 11900 | 13358 | ||
| 11901 | ;; DEADLINES | ||
| 11902 | (if (string-match org-deadline-line-regexp line) | ||
| 11903 | (progn | ||
| 11904 | (if (save-match-data | ||
| 11905 | (string-match "<a href" | ||
| 11906 | (substring line 0 (match-beginning 0)))) | ||
| 11907 | nil ; Don't do the replacement - it is inside a link | ||
| 11908 | (setq line (replace-match "<span class=\"deadline\">\\&</span>" | ||
| 11909 | nil nil line 1))))) | ||
| 11910 | (cond | 13359 | (cond |
| 11911 | ((string-match "^\\(\\*+\\)[ \t]*\\(.*\\)" line) | 13360 | ((string-match "^\\(\\*+\\)[ \t]*\\(.*\\)" line) |
| 11912 | ;; This is a headline | 13361 | ;; This is a headline |
| 11913 | (setq level (org-tr-level (- (match-end 1) (match-beginning 1))) | 13362 | (setq level (org-tr-level (- (match-end 1) (match-beginning 1))) |
| 11914 | txt (match-string 2 line)) | 13363 | txt (match-string 2 line)) |
| 13364 | (if (string-match quote-re0 txt) | ||
| 13365 | (setq txt (replace-match "" t t txt))) | ||
| 11915 | (if (<= level umax) (setq head-count (+ head-count 1))) | 13366 | (if (<= level umax) (setq head-count (+ head-count 1))) |
| 11916 | (when in-local-list | 13367 | (when in-local-list |
| 11917 | ;; Close any local lists before inserting a new header line | 13368 | ;; Close any local lists before inserting a new header line |
| 11918 | (while local-list-num | 13369 | (while local-list-num |
| 13370 | (org-close-li) | ||
| 11919 | (insert (if (car local-list-num) "</ol>\n" "</ul>")) | 13371 | (insert (if (car local-list-num) "</ol>\n" "</ul>")) |
| 11920 | (pop local-list-num)) | 13372 | (pop local-list-num)) |
| 11921 | (setq local-list-indent nil | 13373 | (setq local-list-indent nil |
| @@ -11942,19 +13394,21 @@ headlines. The default is 3. Lower levels will become bulleted lists." | |||
| 11942 | (setq table-open nil | 13394 | (setq table-open nil |
| 11943 | table-buffer (nreverse table-buffer) | 13395 | table-buffer (nreverse table-buffer) |
| 11944 | table-orig-buffer (nreverse table-orig-buffer)) | 13396 | table-orig-buffer (nreverse table-orig-buffer)) |
| 13397 | (org-close-par-maybe) | ||
| 11945 | (insert (org-format-table-html table-buffer table-orig-buffer)))) | 13398 | (insert (org-format-table-html table-buffer table-orig-buffer)))) |
| 11946 | (t | 13399 | (t |
| 11947 | ;; Normal lines | 13400 | ;; Normal lines |
| 11948 | (when (and (string-match | 13401 | (when (string-match |
| 11949 | (cond | 13402 | (cond |
| 11950 | ((eq llt t) "^\\([ \t]*\\)\\(\\([-+*]\\)\\|\\([0-9]+[.)]\\)\\)?\\( +[^ \t\n\r]\\|[ \t]*$\\)") | 13403 | ((eq llt t) "^\\([ \t]*\\)\\(\\([-+*]\\)\\|\\([0-9]+[.)]\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") |
| 11951 | ((= llt ?.) "^\\([ \t]*\\)\\(\\([-+*]\\)\\|\\([0-9]+\\.\\)\\)?\\( +[^ \t\n\r]\\|[ \t]*$\\)") | 13404 | ((= llt ?.) "^\\([ \t]*\\)\\(\\([-+*]\\)\\|\\([0-9]+\\.\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") |
| 11952 | ((= llt ?\)) "^\\( \t]*\\)\\(\\([-+*]\\)\\|\\([0-9]+)\\)\\)?\\( +[^ \t\n\r]\\|[ \t]*$\\)") | 13405 | ((= llt ?\)) "^\\( \t]*\\)\\(\\([-+*]\\)\\|\\([0-9]+)\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") |
| 11953 | (t (error "Invalid value of `org-plain-list-ordered-item-terminator'"))) | 13406 | (t (error "Invalid value of `org-plain-list-ordered-item-terminator'"))) |
| 11954 | line)) | 13407 | line) |
| 11955 | (setq ind (org-get-string-indentation line) | 13408 | (setq ind (org-get-string-indentation line) |
| 11956 | start-is-num (match-beginning 4) | 13409 | start-is-num (match-beginning 4) |
| 11957 | starter (if (match-beginning 2) (match-string 2 line)) | 13410 | starter (if (match-beginning 2) |
| 13411 | (substring (match-string 2 line) 0 -1)) | ||
| 11958 | line (substring line (match-beginning 5))) | 13412 | line (substring line (match-beginning 5))) |
| 11959 | (unless (string-match "[^ \t]" line) | 13413 | (unless (string-match "[^ \t]" line) |
| 11960 | ;; empty line. Pretend indentation is large. | 13414 | ;; empty line. Pretend indentation is large. |
| @@ -11963,6 +13417,7 @@ headlines. The default is 3. Lower levels will become bulleted lists." | |||
| 11963 | (or (and (= ind (car local-list-indent)) | 13417 | (or (and (= ind (car local-list-indent)) |
| 11964 | (not starter)) | 13418 | (not starter)) |
| 11965 | (< ind (car local-list-indent)))) | 13419 | (< ind (car local-list-indent)))) |
| 13420 | (org-close-li) | ||
| 11966 | (insert (if (car local-list-num) "</ol>\n" "</ul>")) | 13421 | (insert (if (car local-list-num) "</ol>\n" "</ul>")) |
| 11967 | (pop local-list-num) (pop local-list-indent) | 13422 | (pop local-list-num) (pop local-list-indent) |
| 11968 | (setq in-local-list local-list-indent)) | 13423 | (setq in-local-list local-list-indent)) |
| @@ -11971,23 +13426,76 @@ headlines. The default is 3. Lower levels will become bulleted lists." | |||
| 11971 | (or (not in-local-list) | 13426 | (or (not in-local-list) |
| 11972 | (> ind (car local-list-indent)))) | 13427 | (> ind (car local-list-indent)))) |
| 11973 | ;; Start new (level of ) list | 13428 | ;; Start new (level of ) list |
| 13429 | (org-close-par-maybe) | ||
| 11974 | (insert (if start-is-num "<ol>\n<li>\n" "<ul>\n<li>\n")) | 13430 | (insert (if start-is-num "<ol>\n<li>\n" "<ul>\n<li>\n")) |
| 11975 | (push start-is-num local-list-num) | 13431 | (push start-is-num local-list-num) |
| 11976 | (push ind local-list-indent) | 13432 | (push ind local-list-indent) |
| 11977 | (setq in-local-list t)) | 13433 | (setq in-local-list t)) |
| 11978 | (starter | 13434 | (starter |
| 11979 | ;; continue current list | 13435 | ;; continue current list |
| 11980 | (insert "<li>\n")))) | 13436 | (org-close-li) |
| 13437 | (insert "<li>\n"))) | ||
| 13438 | (if (string-match "^[ \t]*\\[\\([X ]\\)\\]" line) | ||
| 13439 | (setq line | ||
| 13440 | (replace-match | ||
| 13441 | (if (equal (match-string 1 line) "X") | ||
| 13442 | "<b>[X]</b>" | ||
| 13443 | "<b>[<span style=\"visibility:hidden;\">X</span>]</b>") | ||
| 13444 | t t line)))) | ||
| 13445 | |||
| 11981 | ;; Empty lines start a new paragraph. If hand-formatted lists | 13446 | ;; Empty lines start a new paragraph. If hand-formatted lists |
| 11982 | ;; are not fully interpreted, lines starting with "-", "+", "*" | 13447 | ;; are not fully interpreted, lines starting with "-", "+", "*" |
| 11983 | ;; also start a new paragraph. | 13448 | ;; also start a new paragraph. |
| 11984 | (if (string-match "^ [-+*]-\\|^[ \t]*$" line) (insert "<p>")) | 13449 | (if (string-match "^ [-+*]-\\|^[ \t]*$" line) (org-open-par)) |
| 11985 | (insert line (if org-export-preserve-breaks "<br>\n" "\n")))) | 13450 | |
| 11986 | )) | 13451 | ;; Check if the line break needs to be conserved |
| 13452 | (cond | ||
| 13453 | ((string-match "\\\\\\\\[ \t]*$" line) | ||
| 13454 | (setq line (replace-match "<br/>" t t line))) | ||
| 13455 | (org-export-preserve-breaks | ||
| 13456 | (setq line (concat line "<br/>")))) | ||
| 13457 | |||
| 13458 | (insert line "\n"))))) | ||
| 13459 | |||
| 13460 | ;; Properly close all local lists and other lists | ||
| 13461 | (when inquote (insert "</pre>\n")) | ||
| 13462 | (when in-local-list | ||
| 13463 | ;; Close any local lists before inserting a new header line | ||
| 13464 | (while local-list-num | ||
| 13465 | (org-close-li) | ||
| 13466 | (insert (if (car local-list-num) "</ol>\n" "</ul>\n")) | ||
| 13467 | (pop local-list-num)) | ||
| 13468 | (setq local-list-indent nil | ||
| 13469 | in-local-list nil)) | ||
| 13470 | (org-html-level-start 1 nil umax | ||
| 13471 | (and org-export-with-toc (<= level umax)) | ||
| 13472 | head-count) | ||
| 13473 | |||
| 13474 | (when (plist-get opt-plist :auto-postamble) | ||
| 13475 | (when author | ||
| 13476 | (insert "<p class=\"author\"> " | ||
| 13477 | (nth 1 lang-words) ": " author "\n") | ||
| 13478 | (when email | ||
| 13479 | (insert "<a href=\"mailto:" email "\"><" | ||
| 13480 | email "></a>\n")) | ||
| 13481 | (insert "</p>\n")) | ||
| 13482 | (when (and date time) | ||
| 13483 | (insert "<p class=\"date\"> " | ||
| 13484 | (nth 2 lang-words) ": " | ||
| 13485 | date " " time "</p>\n"))) | ||
| 13486 | |||
| 11987 | (if org-export-html-with-timestamp | 13487 | (if org-export-html-with-timestamp |
| 11988 | (insert org-export-html-html-helper-timestamp)) | 13488 | (insert org-export-html-html-helper-timestamp)) |
| 13489 | (insert (or (plist-get opt-plist :postamble) "")) | ||
| 11989 | (insert "</body>\n</html>\n") | 13490 | (insert "</body>\n</html>\n") |
| 11990 | (normal-mode) | 13491 | (normal-mode) |
| 13492 | ;; remove empty paragraphs and lists | ||
| 13493 | (goto-char (point-min)) | ||
| 13494 | (while (re-search-forward "<p>[ \r\n\t]*</p>" nil t) | ||
| 13495 | (replace-match "")) | ||
| 13496 | (goto-char (point-min)) | ||
| 13497 | (while (re-search-forward "<li>[ \r\n\t]*</li>\n?" nil t) | ||
| 13498 | (replace-match "")) | ||
| 11991 | (save-buffer) | 13499 | (save-buffer) |
| 11992 | (goto-char (point-min))))) | 13500 | (goto-char (point-min))))) |
| 11993 | 13501 | ||
| @@ -12091,7 +13599,7 @@ But it has the disadvantage, that no cell- or row-spanning is allowed." | |||
| 12091 | fields html empty) | 13599 | fields html empty) |
| 12092 | (setq html (concat org-export-html-table-tag "\n")) | 13600 | (setq html (concat org-export-html-table-tag "\n")) |
| 12093 | (while (setq line (pop lines)) | 13601 | (while (setq line (pop lines)) |
| 12094 | (setq empty " ") | 13602 | (setq empty " ") |
| 12095 | (catch 'next-line | 13603 | (catch 'next-line |
| 12096 | (if (string-match "^[ \t]*\\+-" line) | 13604 | (if (string-match "^[ \t]*\\+-" line) |
| 12097 | (progn | 13605 | (progn |
| @@ -12117,7 +13625,7 @@ But it has the disadvantage, that no cell- or row-spanning is allowed." | |||
| 12117 | (if field-buffer | 13625 | (if field-buffer |
| 12118 | (setq field-buffer (mapcar | 13626 | (setq field-buffer (mapcar |
| 12119 | (lambda (x) | 13627 | (lambda (x) |
| 12120 | (concat x "<br>" (pop fields))) | 13628 | (concat x "<br/>" (pop fields))) |
| 12121 | field-buffer)) | 13629 | field-buffer)) |
| 12122 | (setq field-buffer fields)))) | 13630 | (setq field-buffer fields)))) |
| 12123 | (setq html (concat html "</table>\n")) | 13631 | (setq html (concat html "</table>\n")) |
| @@ -12140,6 +13648,30 @@ But it has the disadvantage, that Org-mode's HTML conversions cannot be used." | |||
| 12140 | (set-buffer " org-tmp2 ") | 13648 | (set-buffer " org-tmp2 ") |
| 12141 | (buffer-substring (point-min) (point-max)))) | 13649 | (buffer-substring (point-min) (point-max)))) |
| 12142 | 13650 | ||
| 13651 | (defun org-html-handle-time-stamps (s) | ||
| 13652 | "Format time stamps in string S, or remove them." | ||
| 13653 | (let (r b) | ||
| 13654 | (while (string-match org-maybe-keyword-time-regexp s) | ||
| 13655 | (or b (setq b (substring s 0 (match-beginning 0)))) | ||
| 13656 | (if (not org-export-with-timestamps) | ||
| 13657 | (setq r (concat r (substring s 0 (match-beginning 0))) | ||
| 13658 | s (substring s (match-end 0))) | ||
| 13659 | (setq r (concat | ||
| 13660 | r (substring s 0 (match-beginning 0)) | ||
| 13661 | (if (match-end 1) | ||
| 13662 | (format "@<span class=\"timestamp-kwd\">%s @</span>" | ||
| 13663 | (match-string 1 s))) | ||
| 13664 | (format " @<span class=\"timestamp\">%s@</span>" | ||
| 13665 | (substring (match-string 3 s) 1 -1))) | ||
| 13666 | s (substring s (match-end 0))))) | ||
| 13667 | ;; Line break of line started and ended with time stamp stuff | ||
| 13668 | (if (not r) | ||
| 13669 | s | ||
| 13670 | (setq r (concat r s)) | ||
| 13671 | (unless (string-match "\\S-" (concat b s)) | ||
| 13672 | (setq r (concat r "@<br/>"))) | ||
| 13673 | r))) | ||
| 13674 | |||
| 12143 | (defun org-html-protect (s) | 13675 | (defun org-html-protect (s) |
| 12144 | ;; convert & to &, < to < and > to > | 13676 | ;; convert & to &, < to < and > to > |
| 12145 | (let ((start 0)) | 13677 | (let ((start 0)) |
| @@ -12152,6 +13684,14 @@ But it has the disadvantage, that Org-mode's HTML conversions cannot be used." | |||
| 12152 | (setq s (replace-match ">" t t s)))) | 13684 | (setq s (replace-match ">" t t s)))) |
| 12153 | s) | 13685 | s) |
| 12154 | 13686 | ||
| 13687 | (defun org-html-cleanup-toc-line (s) | ||
| 13688 | "Remove tags and time staps from lines going into the toc." | ||
| 13689 | (if (string-match " +:[a-zA-Z0-9_@:]+: *$" s) | ||
| 13690 | (setq s (replace-match "" t t s))) | ||
| 13691 | (while (string-match org-maybe-keyword-time-regexp s) | ||
| 13692 | (setq s (replace-match "" t t s))) | ||
| 13693 | s) | ||
| 13694 | |||
| 12155 | (defun org-html-expand (string) | 13695 | (defun org-html-expand (string) |
| 12156 | "Prepare STRING for HTML export. Applies all active conversions. | 13696 | "Prepare STRING for HTML export. Applies all active conversions. |
| 12157 | If there are links in the string, don't modify these." | 13697 | If there are links in the string, don't modify these." |
| @@ -12170,7 +13710,7 @@ If there are links in the string, don't modify these." | |||
| 12170 | (setq s (org-html-protect s)) | 13710 | (setq s (org-html-protect s)) |
| 12171 | (if org-export-html-expand | 13711 | (if org-export-html-expand |
| 12172 | (while (string-match "@<\\([^&]*\\)>" s) | 13712 | (while (string-match "@<\\([^&]*\\)>" s) |
| 12173 | (setq s (replace-match "<\\1>" nil nil s)))) | 13713 | (setq s (replace-match "<\\1>" t nil s)))) |
| 12174 | (if org-export-with-emphasize | 13714 | (if org-export-with-emphasize |
| 12175 | (setq s (org-export-html-convert-emphasize s))) | 13715 | (setq s (org-export-html-convert-emphasize s))) |
| 12176 | (if org-export-with-sub-superscripts | 13716 | (if org-export-with-sub-superscripts |
| @@ -12231,57 +13771,35 @@ stacked delimiters is N. Escaping delimiters is not possible." | |||
| 12231 | string) | 13771 | string) |
| 12232 | 13772 | ||
| 12233 | (defun org-export-html-convert-emphasize (string) | 13773 | (defun org-export-html-convert-emphasize (string) |
| 12234 | (while (string-match org-italic-re string) | 13774 | "Apply emphasis." |
| 12235 | (setq string (replace-match "\\1<i>\\3</i>\\4" t nil string))) | 13775 | (while (string-match org-emph-re string) |
| 12236 | (while (string-match org-bold-re string) | 13776 | (setq string (replace-match (concat "\\1" (nth 2 (assoc (match-string 3 string) org-emphasis-alist)) "\\4" (nth 3 (assoc (match-string 3 string) org-emphasis-alist)) "\\5") t nil string))) |
| 12237 | (setq string (replace-match "\\1<b>\\3</b>\\4" t nil string))) | ||
| 12238 | (while (string-match org-underline-re string) | ||
| 12239 | (setq string (replace-match "\\1<u>\\3</u>\\4" t nil string))) | ||
| 12240 | string) | 13777 | string) |
| 12241 | 13778 | ||
| 12242 | (defun org-parse-key-lines () | 13779 | (defvar org-par-open nil) |
| 12243 | "Find the special key lines with the information for exporters." | 13780 | (defun org-open-par () |
| 12244 | (save-excursion | 13781 | "Insert <p>, but first close previous paragraph if any." |
| 12245 | (goto-char 0) | 13782 | (org-close-par-maybe) |
| 12246 | (let ((re (org-make-options-regexp | 13783 | (insert "\n<p>") |
| 12247 | '("TITLE" "AUTHOR" "EMAIL" "TEXT" "OPTIONS" "LANGUAGE"))) | 13784 | (setq org-par-open t)) |
| 12248 | key) | 13785 | (defun org-close-par-maybe () |
| 12249 | (while (re-search-forward re nil t) | 13786 | "Close paragraph if there is one open." |
| 12250 | (setq key (match-string 1)) | 13787 | (when org-par-open |
| 12251 | (cond ((string-equal key "TITLE") | 13788 | (insert "</p>") |
| 12252 | (setq title (match-string 2))) | 13789 | (setq org-par-open nil))) |
| 12253 | ((string-equal key "AUTHOR") | 13790 | (defun org-close-li () |
| 12254 | (setq author (match-string 2))) | 13791 | "Close <li> if necessary." |
| 12255 | ((string-equal key "EMAIL") | 13792 | (org-close-par-maybe) |
| 12256 | (setq email (match-string 2))) | 13793 | (insert "</li>\n")) |
| 12257 | ((string-equal key "LANGUAGE") | 13794 | ; (when (save-excursion |
| 12258 | (setq language (match-string 2))) | 13795 | ; (re-search-backward "</?\\(ul\\|ol\\|li\\|[hH][0-9]\\)>" nil t)) |
| 12259 | ((string-equal key "TEXT") | 13796 | ; (if (member (match-string 0) '("</ul>" "</ol>" "<li>")) |
| 12260 | (setq text (concat text "\n" (match-string 2)))) | 13797 | ; (insert "</li>")))) |
| 12261 | ((string-equal key "OPTIONS") | ||
| 12262 | (setq options (match-string 2)))))))) | ||
| 12263 | |||
| 12264 | (defun org-parse-export-options (s) | ||
| 12265 | "Parse the export options line." | ||
| 12266 | (let ((op '(("H" . org-export-headline-levels) | ||
| 12267 | ("num" . org-export-with-section-numbers) | ||
| 12268 | ("toc" . org-export-with-toc) | ||
| 12269 | ("\\n" . org-export-preserve-breaks) | ||
| 12270 | ("@" . org-export-html-expand) | ||
| 12271 | (":" . org-export-with-fixed-width) | ||
| 12272 | ("|" . org-export-with-tables) | ||
| 12273 | ("^" . org-export-with-sub-superscripts) | ||
| 12274 | ("*" . org-export-with-emphasize) | ||
| 12275 | ("TeX" . org-export-with-TeX-macros))) | ||
| 12276 | o) | ||
| 12277 | (while (setq o (pop op)) | ||
| 12278 | (if (string-match (concat (regexp-quote (car o)) ":\\([^ \t\n\r;,.]*\\)") | ||
| 12279 | s) | ||
| 12280 | (set (make-local-variable (cdr o)) | ||
| 12281 | (car (read-from-string (match-string 1 s)))))))) | ||
| 12282 | 13798 | ||
| 12283 | (defun org-html-level-start (level title umax with-toc head-count) | 13799 | (defun org-html-level-start (level title umax with-toc head-count) |
| 12284 | "Insert a new level in HTML export." | 13800 | "Insert a new level in HTML export. |
| 13801 | When TITLE is nil, just close all open levels." | ||
| 13802 | (org-close-par-maybe) | ||
| 12285 | (let ((l (1+ (max level umax)))) | 13803 | (let ((l (1+ (max level umax)))) |
| 12286 | (while (<= l org-level-max) | 13804 | (while (<= l org-level-max) |
| 12287 | (if (aref levels-open (1- l)) | 13805 | (if (aref levels-open (1- l)) |
| @@ -12289,22 +13807,42 @@ stacked delimiters is N. Escaping delimiters is not possible." | |||
| 12289 | (org-html-level-close l) | 13807 | (org-html-level-close l) |
| 12290 | (aset levels-open (1- l) nil))) | 13808 | (aset levels-open (1- l) nil))) |
| 12291 | (setq l (1+ l))) | 13809 | (setq l (1+ l))) |
| 12292 | (if (> level umax) | 13810 | (when title |
| 12293 | (progn | 13811 | ;; If title is nil, this means this function is called to close |
| 12294 | (if (aref levels-open (1- level)) | 13812 | ;; all levels, so the rest is done only if title is given |
| 12295 | (insert "<li>" title "<p>\n") | 13813 | (when (string-match "\\(:[a-zA-Z0-9_@:]+:\\)[ \t]*$" title) |
| 12296 | (aset levels-open (1- level) t) | 13814 | (setq title (replace-match |
| 12297 | (insert "<ul><li>" title "<p>\n"))) | 13815 | (if org-export-with-tags |
| 12298 | (if org-export-with-section-numbers | 13816 | (save-match-data |
| 12299 | (setq title (concat (org-section-number level) " " title))) | 13817 | (concat |
| 12300 | (setq level (+ level 1)) | 13818 | " <span class=\"tag\">" |
| 12301 | (if with-toc | 13819 | (mapconcat 'identity (org-split-string |
| 12302 | (insert (format "\n<H%d><a name=\"sec-%d\">%s</a></H%d>\n" | 13820 | (match-string 1 title) ":") |
| 12303 | level head-count title level)) | 13821 | " ") |
| 12304 | (insert (format "\n<H%d>%s</H%d>\n" level title level)))))) | 13822 | "</span>")) |
| 13823 | "") | ||
| 13824 | t t title))) | ||
| 13825 | (if (> level umax) | ||
| 13826 | (progn | ||
| 13827 | (if (aref levels-open (1- level)) | ||
| 13828 | (progn | ||
| 13829 | (org-close-li) | ||
| 13830 | (insert "<li>" title "<br/>\n")) | ||
| 13831 | (aset levels-open (1- level) t) | ||
| 13832 | (org-close-par-maybe) | ||
| 13833 | (insert "<ul>\n<li>" title "<br/>\n"))) | ||
| 13834 | (if org-export-with-section-numbers | ||
| 13835 | (setq title (concat (org-section-number level) " " title))) | ||
| 13836 | (setq level (+ level 1)) | ||
| 13837 | (if with-toc | ||
| 13838 | (insert (format "\n<h%d><a name=\"sec-%d\">%s</a></h%d>\n" | ||
| 13839 | level head-count title level)) | ||
| 13840 | (insert (format "\n<h%d>%s</h%d>\n" level title level))) | ||
| 13841 | (org-open-par))))) | ||
| 12305 | 13842 | ||
| 12306 | (defun org-html-level-close (&rest args) | 13843 | (defun org-html-level-close (&rest args) |
| 12307 | "Terminate one level in HTML export." | 13844 | "Terminate one level in HTML export." |
| 13845 | (org-close-li) | ||
| 12308 | (insert "</ul>")) | 13846 | (insert "</ul>")) |
| 12309 | 13847 | ||
| 12310 | ;; Variable holding the vector with section numbers | 13848 | ;; Variable holding the vector with section numbers |
| @@ -12348,12 +13886,13 @@ When LEVEL is non-nil, increase section numbers on that level." | |||
| 12348 | (setq idx (1+ idx))) | 13886 | (setq idx (1+ idx))) |
| 12349 | (save-match-data | 13887 | (save-match-data |
| 12350 | (if (string-match "\\`\\([@0]\\.\\)+" string) | 13888 | (if (string-match "\\`\\([@0]\\.\\)+" string) |
| 12351 | (setq string (replace-match "" nil nil string))) | 13889 | (setq string (replace-match "" t nil string))) |
| 12352 | (if (string-match "\\(\\.0\\)+\\'" string) | 13890 | (if (string-match "\\(\\.0\\)+\\'" string) |
| 12353 | (setq string (replace-match "" nil nil string)))) | 13891 | (setq string (replace-match "" t nil string)))) |
| 12354 | string)) | 13892 | string)) |
| 12355 | 13893 | ||
| 12356 | 13894 | ||
| 13895 | ;;;###autoload | ||
| 12357 | (defun org-export-icalendar-this-file () | 13896 | (defun org-export-icalendar-this-file () |
| 12358 | "Export current file as an iCalendar file. | 13897 | "Export current file as an iCalendar file. |
| 12359 | The iCalendar file will be located in the same directory as the Org-mode | 13898 | The iCalendar file will be located in the same directory as the Org-mode |
| @@ -12361,12 +13900,6 @@ file, but with extension `.ics'." | |||
| 12361 | (interactive) | 13900 | (interactive) |
| 12362 | (org-export-icalendar nil buffer-file-name)) | 13901 | (org-export-icalendar nil buffer-file-name)) |
| 12363 | 13902 | ||
| 12364 | (defun org-export-as-xml () | ||
| 12365 | "Export current buffer as XOXO XML buffer." | ||
| 12366 | (interactive) | ||
| 12367 | (cond ((eq org-export-xml-type 'xoxo) | ||
| 12368 | (org-export-as-xoxo (current-buffer))))) | ||
| 12369 | |||
| 12370 | (defun org-export-as-xoxo-insert-into (buffer &rest output) | 13903 | (defun org-export-as-xoxo-insert-into (buffer &rest output) |
| 12371 | (with-current-buffer buffer | 13904 | (with-current-buffer buffer |
| 12372 | (apply 'insert output))) | 13905 | (apply 'insert output))) |
| @@ -12380,8 +13913,13 @@ The XOXO buffer is named *xoxo-<source buffer name>*" | |||
| 12380 | ;; Output everything as XOXO | 13913 | ;; Output everything as XOXO |
| 12381 | (with-current-buffer (get-buffer buffer) | 13914 | (with-current-buffer (get-buffer buffer) |
| 12382 | (goto-char (point-min)) ;; CD: beginning-of-buffer is not allowed. | 13915 | (goto-char (point-min)) ;; CD: beginning-of-buffer is not allowed. |
| 12383 | (let* ((filename (concat (file-name-sans-extension buffer-file-name) | 13916 | (let* ((opt-plist (org-combine-plists (org-default-export-plist) |
| 12384 | ".xml")) | 13917 | (org-infile-export-plist))) |
| 13918 | (filename (concat (file-name-as-directory | ||
| 13919 | (org-export-directory :xoxo opt-plist)) | ||
| 13920 | (file-name-sans-extension | ||
| 13921 | (file-name-nondirectory buffer-file-name)) | ||
| 13922 | ".html")) | ||
| 12385 | (out (find-file-noselect filename)) | 13923 | (out (find-file-noselect filename)) |
| 12386 | (last-level 1) | 13924 | (last-level 1) |
| 12387 | (hanging-li nil)) | 13925 | (hanging-li nil)) |
| @@ -12464,19 +14002,29 @@ The file is stored under the name `org-combined-agenda-icalendar-file'." | |||
| 12464 | If COMBINE is non-nil, combine all calendar entries into a single large | 14002 | If COMBINE is non-nil, combine all calendar entries into a single large |
| 12465 | file and store it under the name `org-combined-agenda-icalendar-file'." | 14003 | file and store it under the name `org-combined-agenda-icalendar-file'." |
| 12466 | (save-excursion | 14004 | (save-excursion |
| 12467 | (let* (file ical-file ical-buffer category started org-agenda-new-buffers) | 14005 | (let* ((dir (org-export-directory |
| 14006 | :ical (list :publishing-directory | ||
| 14007 | org-export-publishing-directory))) | ||
| 14008 | file ical-file ical-buffer category started org-agenda-new-buffers) | ||
| 14009 | |||
| 12468 | (when combine | 14010 | (when combine |
| 12469 | (setq ical-file org-combined-agenda-icalendar-file | 14011 | (setq ical-file |
| 14012 | (if (file-name-absolute-p org-combined-agenda-icalendar-file) | ||
| 14013 | org-combined-agenda-icalendar-file | ||
| 14014 | (expand-file-name org-combined-agenda-icalendar-file dir)) | ||
| 12470 | ical-buffer (org-get-agenda-file-buffer ical-file)) | 14015 | ical-buffer (org-get-agenda-file-buffer ical-file)) |
| 12471 | (set-buffer ical-buffer) (erase-buffer)) | 14016 | (set-buffer ical-buffer) (erase-buffer)) |
| 12472 | (while (setq file (pop files)) | 14017 | (while (setq file (pop files)) |
| 12473 | (catch 'nextfile | 14018 | (catch 'nextfile |
| 12474 | (org-check-agenda-file file) | 14019 | (org-check-agenda-file file) |
| 14020 | (set-buffer (org-get-agenda-file-buffer file)) | ||
| 12475 | (unless combine | 14021 | (unless combine |
| 12476 | (setq ical-file (concat (file-name-sans-extension file) ".ics")) | 14022 | (setq ical-file (concat (file-name-as-directory dir) |
| 14023 | (file-name-sans-extension | ||
| 14024 | (file-name-nondirectory buffer-file-name)) | ||
| 14025 | ".ics")) | ||
| 12477 | (setq ical-buffer (org-get-agenda-file-buffer ical-file)) | 14026 | (setq ical-buffer (org-get-agenda-file-buffer ical-file)) |
| 12478 | (set-buffer ical-buffer) (erase-buffer)) | 14027 | (with-current-buffer ical-buffer (erase-buffer))) |
| 12479 | (set-buffer (org-get-agenda-file-buffer file)) | ||
| 12480 | (setq category (or org-category | 14028 | (setq category (or org-category |
| 12481 | (file-name-sans-extension | 14029 | (file-name-sans-extension |
| 12482 | (file-name-nondirectory buffer-file-name)))) | 14030 | (file-name-nondirectory buffer-file-name)))) |
| @@ -12706,30 +14254,48 @@ a time), or the day by one (if it does not contain a time)." | |||
| 12706 | (define-key org-mode-map [(control ?#)] 'org-table-rotate-recalc-marks) | 14254 | (define-key org-mode-map [(control ?#)] 'org-table-rotate-recalc-marks) |
| 12707 | (define-key org-mode-map "\C-c~" 'org-table-create-with-table.el) | 14255 | (define-key org-mode-map "\C-c~" 'org-table-create-with-table.el) |
| 12708 | (define-key org-mode-map "\C-c\C-q" 'org-table-wrap-region) | 14256 | (define-key org-mode-map "\C-c\C-q" 'org-table-wrap-region) |
| 12709 | (define-key org-mode-map "\C-c\C-xa" 'org-export-as-ascii) | 14257 | (define-key org-mode-map "\C-c\C-e" 'org-export) |
| 12710 | (define-key org-mode-map "\C-c\C-x\C-a" 'org-export-as-ascii) | 14258 | ;(define-key org-mode-map "\C-c\C-xa" 'org-export-as-ascii) |
| 12711 | (define-key org-mode-map "\C-c\C-xv" 'org-export-copy-visible) | 14259 | ;(define-key org-mode-map "\C-c\C-x\C-a" 'org-export-as-ascii) |
| 12712 | (define-key org-mode-map "\C-c\C-x\C-v" 'org-export-copy-visible) | 14260 | ;(define-key org-mode-map "\C-c\C-xv" 'org-export-visible) |
| 14261 | ;(define-key org-mode-map "\C-c\C-x\C-v" 'org-export-visible) | ||
| 12713 | ;; OPML support is only an option for the future | 14262 | ;; OPML support is only an option for the future |
| 12714 | ;(define-key org-mode-map "\C-c\C-xo" 'org-export-as-opml) | 14263 | ;(define-key org-mode-map "\C-c\C-xo" 'org-export-as-opml) |
| 12715 | ;(define-key org-mode-map "\C-c\C-x\C-o" 'org-export-as-opml) | 14264 | ;(define-key org-mode-map "\C-c\C-x\C-o" 'org-export-as-opml) |
| 12716 | (define-key org-mode-map "\C-c\C-xi" 'org-export-icalendar-this-file) | 14265 | ;(define-key org-mode-map "\C-c\C-xi" 'org-export-icalendar-this-file) |
| 12717 | (define-key org-mode-map "\C-c\C-x\C-i" 'org-export-icalendar-all-agenda-files) | 14266 | ;(define-key org-mode-map "\C-c\C-x\C-i" 'org-export-icalendar-all-agenda-files) |
| 12718 | (define-key org-mode-map "\C-c\C-xc" 'org-export-icalendar-combine-agenda-files) | 14267 | ;(define-key org-mode-map "\C-c\C-xc" 'org-export-icalendar-combine-agenda-files) |
| 12719 | (define-key org-mode-map "\C-c\C-x\C-c" 'org-export-icalendar-combine-agenda-files) | 14268 | ;(define-key org-mode-map "\C-c\C-x\C-c" 'org-export-icalendar-combine-agenda-files) |
| 12720 | (define-key org-mode-map "\C-c\C-xt" 'org-insert-export-options-template) | 14269 | ;(define-key org-mode-map "\C-c\C-xt" 'org-insert-export-options-template) |
| 12721 | (define-key org-mode-map "\C-c:" 'org-toggle-fixed-width-section) | 14270 | (define-key org-mode-map "\C-c:" 'org-toggle-fixed-width-section) |
| 12722 | (define-key org-mode-map "\C-c\C-xh" 'org-export-as-html) | 14271 | ;(define-key org-mode-map "\C-c\C-xh" 'org-export-as-html) |
| 12723 | (define-key org-mode-map "\C-c\C-xx" 'org-export-as-xml) | 14272 | ;(define-key org-mode-map "\C-c\C-xx" 'org-export-as-xoxo) |
| 12724 | (define-key org-mode-map "\C-c\C-x\C-x" 'org-export-as-xml) | 14273 | ;(define-key org-mode-map "\C-c\C-x\C-x" 'org-export-as-xoxo) |
| 12725 | (define-key org-mode-map "\C-c\C-xb" 'org-export-as-html-and-open) | 14274 | ;(define-key org-mode-map "\C-c\C-xb" 'org-export-as-html-and-open) |
| 12726 | (define-key org-mode-map "\C-c\C-x\C-b" 'org-export-as-html-and-open) | 14275 | ;(define-key org-mode-map "\C-c\C-x\C-b" 'org-export-as-html-and-open) |
| 12727 | 14276 | ||
| 12728 | (define-key org-mode-map "\C-c\C-x\C-k" 'org-cut-special) | 14277 | (define-key org-mode-map "\C-c\C-x\C-k" 'org-cut-special) |
| 12729 | (define-key org-mode-map "\C-c\C-x\C-w" 'org-cut-special) | 14278 | (define-key org-mode-map "\C-c\C-x\C-w" 'org-cut-special) |
| 12730 | (define-key org-mode-map "\C-c\C-x\M-w" 'org-copy-special) | 14279 | (define-key org-mode-map "\C-c\C-x\M-w" 'org-copy-special) |
| 12731 | (define-key org-mode-map "\C-c\C-x\C-y" 'org-paste-special) | 14280 | (define-key org-mode-map "\C-c\C-x\C-y" 'org-paste-special) |
| 12732 | 14281 | ||
| 14282 | (define-key org-mode-map "\C-c\C-x\C-i" 'org-clock-in) | ||
| 14283 | (define-key org-mode-map "\C-c\C-x\C-o" 'org-clock-out) | ||
| 14284 | (define-key org-mode-map "\C-c\C-x\C-x" 'org-clock-cancel) | ||
| 14285 | (define-key org-mode-map "\C-c\C-x\C-d" 'org-clock-display) | ||
| 14286 | |||
| 14287 | ;(define-key org-mode-map "\C-c\C-ef" 'org-publish-current-file) | ||
| 14288 | ;(define-key org-mode-map "\C-c\C-ep" 'org-publish-current-project) | ||
| 14289 | ;(define-key org-mode-map "\C-c\C-ec" 'org-publish) | ||
| 14290 | ;(define-key org-mode-map "\C-c\C-ea" 'org-publish-all) | ||
| 14291 | ;(define-key org-mode-map "\C-c\C-e\C-f" 'org-publish-current-file) | ||
| 14292 | ;(define-key org-mode-map "\C-c\C-e\C-p" 'org-publish-current-project) | ||
| 14293 | ;(define-key org-mode-map "\C-c\C-e\C-c" 'org-publish) | ||
| 14294 | ;(define-key org-mode-map "\C-c\C-e\C-a" 'org-publish-all) | ||
| 14295 | |||
| 14296 | (when (featurep 'xemacs) | ||
| 14297 | (define-key org-mode-map 'button3 'popup-mode-menu)) | ||
| 14298 | |||
| 12733 | (defsubst org-table-p () (org-at-table-p)) | 14299 | (defsubst org-table-p () (org-at-table-p)) |
| 12734 | 14300 | ||
| 12735 | (defun org-self-insert-command (N) | 14301 | (defun org-self-insert-command (N) |
| @@ -12770,7 +14336,7 @@ because, in this case the deletion might narrow the column." | |||
| 12770 | (eq N 1) | 14336 | (eq N 1) |
| 12771 | (string-match "|" (buffer-substring (point-at-bol) (point))) | 14337 | (string-match "|" (buffer-substring (point-at-bol) (point))) |
| 12772 | (looking-at ".*?|")) | 14338 | (looking-at ".*?|")) |
| 12773 | (let ((pos (point)) | 14339 | (let ((pos (point)) |
| 12774 | (noalign (looking-at "[^|\n\r]* |")) | 14340 | (noalign (looking-at "[^|\n\r]* |")) |
| 12775 | (c org-table-may-need-update)) | 14341 | (c org-table-may-need-update)) |
| 12776 | (backward-delete-char N) | 14342 | (backward-delete-char N) |
| @@ -12803,7 +14369,8 @@ because, in this case the deletion might narrow the column." | |||
| 12803 | (goto-char pos) | 14369 | (goto-char pos) |
| 12804 | ;; noalign: if there were two spaces at the end, this field | 14370 | ;; noalign: if there were two spaces at the end, this field |
| 12805 | ;; does not determine the width of the column. | 14371 | ;; does not determine the width of the column. |
| 12806 | (if noalign (setq org-table-may-need-update c)))) | 14372 | (if noalign (setq org-table-may-need-update c))) |
| 14373 | (delete-char N)) | ||
| 12807 | (delete-char N))) | 14374 | (delete-char N))) |
| 12808 | 14375 | ||
| 12809 | ;; How to do this: Measure non-white length of current string | 14376 | ;; How to do this: Measure non-white length of current string |
| @@ -12832,14 +14399,15 @@ COMMANDS is a list of alternating OLDDEF NEWDEF command names." | |||
| 12832 | "Throw an error because Shift-Cursor command was applied in wrong context." | 14399 | "Throw an error because Shift-Cursor command was applied in wrong context." |
| 12833 | (error "This command is active in special context like tables, headlines or timestamps")) | 14400 | (error "This command is active in special context like tables, headlines or timestamps")) |
| 12834 | 14401 | ||
| 12835 | (defun org-shifttab () | 14402 | (defun org-shifttab (&optional arg) |
| 12836 | "Global visibility cycling or move to previous table field. | 14403 | "Global visibility cycling or move to previous table field. |
| 12837 | Calls `(org-cycle t)' or `org-table-previous-field', depending on context. | 14404 | Calls `org-cycle' with argument t, or `org-table-previous-field', depending |
| 14405 | on context. | ||
| 12838 | See the individual commands for more information." | 14406 | See the individual commands for more information." |
| 12839 | (interactive) | 14407 | (interactive "P") |
| 12840 | (cond | 14408 | (cond |
| 12841 | ((org-at-table-p) (org-table-previous-field)) | 14409 | ((org-at-table-p) (call-interactively 'org-table-previous-field)) |
| 12842 | (t (org-cycle '(4))))) | 14410 | (t (call-interactively 'org-global-cycle)))) |
| 12843 | 14411 | ||
| 12844 | (defun org-shiftmetaleft () | 14412 | (defun org-shiftmetaleft () |
| 12845 | "Promote subtree or delete table column. | 14413 | "Promote subtree or delete table column. |
| @@ -12847,8 +14415,8 @@ Calls `org-promote-subtree' or `org-table-delete-column', depending on context. | |||
| 12847 | See the individual commands for more information." | 14415 | See the individual commands for more information." |
| 12848 | (interactive) | 14416 | (interactive) |
| 12849 | (cond | 14417 | (cond |
| 12850 | ((org-at-table-p) (org-table-delete-column)) | 14418 | ((org-at-table-p) (call-interactively 'org-table-delete-column)) |
| 12851 | ((org-on-heading-p) (org-promote-subtree)) | 14419 | ((org-on-heading-p) (call-interactively 'org-promote-subtree)) |
| 12852 | ((org-at-item-p) (call-interactively 'org-outdent-item)) | 14420 | ((org-at-item-p) (call-interactively 'org-outdent-item)) |
| 12853 | (t (org-shiftcursor-error)))) | 14421 | (t (org-shiftcursor-error)))) |
| 12854 | 14422 | ||
| @@ -12858,8 +14426,8 @@ Calls `org-demote-subtree' or `org-table-insert-column', depending on context. | |||
| 12858 | See the individual commands for more information." | 14426 | See the individual commands for more information." |
| 12859 | (interactive) | 14427 | (interactive) |
| 12860 | (cond | 14428 | (cond |
| 12861 | ((org-at-table-p) (org-table-insert-column)) | 14429 | ((org-at-table-p) (call-interactively 'org-table-insert-column)) |
| 12862 | ((org-on-heading-p) (org-demote-subtree)) | 14430 | ((org-on-heading-p) (call-interactively 'org-demote-subtree)) |
| 12863 | ((org-at-item-p) (call-interactively 'org-indent-item)) | 14431 | ((org-at-item-p) (call-interactively 'org-indent-item)) |
| 12864 | (t (org-shiftcursor-error)))) | 14432 | (t (org-shiftcursor-error)))) |
| 12865 | 14433 | ||
| @@ -12870,9 +14438,9 @@ Calls `org-move-subtree-up' or `org-table-kill-row' or | |||
| 12870 | for more information." | 14438 | for more information." |
| 12871 | (interactive "P") | 14439 | (interactive "P") |
| 12872 | (cond | 14440 | (cond |
| 12873 | ((org-at-table-p) (org-table-kill-row)) | 14441 | ((org-at-table-p) (call-interactively 'org-table-kill-row)) |
| 12874 | ((org-on-heading-p) (org-move-subtree-up arg)) | 14442 | ((org-on-heading-p) (call-interactively 'org-move-subtree-up)) |
| 12875 | ((org-at-item-p) (org-move-item-up arg)) | 14443 | ((org-at-item-p) (call-interactively 'org-move-item-up)) |
| 12876 | (t (org-shiftcursor-error)))) | 14444 | (t (org-shiftcursor-error)))) |
| 12877 | (defun org-shiftmetadown (&optional arg) | 14445 | (defun org-shiftmetadown (&optional arg) |
| 12878 | "Move subtree down or insert table row. | 14446 | "Move subtree down or insert table row. |
| @@ -12881,9 +14449,9 @@ Calls `org-move-subtree-down' or `org-table-insert-row' or | |||
| 12881 | commands for more information." | 14449 | commands for more information." |
| 12882 | (interactive "P") | 14450 | (interactive "P") |
| 12883 | (cond | 14451 | (cond |
| 12884 | ((org-at-table-p) (org-table-insert-row arg)) | 14452 | ((org-at-table-p) (call-interactively 'org-table-insert-row)) |
| 12885 | ((org-on-heading-p) (org-move-subtree-down arg)) | 14453 | ((org-on-heading-p) (call-interactively 'org-move-subtree-down)) |
| 12886 | ((org-at-item-p) (org-move-item-down arg)) | 14454 | ((org-at-item-p) (call-interactively 'org-move-item-down)) |
| 12887 | (t (org-shiftcursor-error)))) | 14455 | (t (org-shiftcursor-error)))) |
| 12888 | 14456 | ||
| 12889 | (defun org-metaleft (&optional arg) | 14457 | (defun org-metaleft (&optional arg) |
| @@ -12893,9 +14461,10 @@ With no specific context, calls the Emacs default `backward-word'. | |||
| 12893 | See the individual commands for more information." | 14461 | See the individual commands for more information." |
| 12894 | (interactive "P") | 14462 | (interactive "P") |
| 12895 | (cond | 14463 | (cond |
| 12896 | ((org-at-table-p) (org-table-move-column 'left)) | 14464 | ((org-at-table-p) (org-call-with-arg 'org-table-move-column 'left)) |
| 12897 | ((or (org-on-heading-p) (org-region-active-p)) (org-do-promote)) | 14465 | ((or (org-on-heading-p) (org-region-active-p)) |
| 12898 | (t (backward-word (prefix-numeric-value arg))))) | 14466 | (call-interactively 'org-do-promote)) |
| 14467 | (t (call-interactively 'backward-word)))) | ||
| 12899 | 14468 | ||
| 12900 | (defun org-metaright (&optional arg) | 14469 | (defun org-metaright (&optional arg) |
| 12901 | "Demote subtree or move table column to right. | 14470 | "Demote subtree or move table column to right. |
| @@ -12904,9 +14473,10 @@ With no specific context, calls the Emacs default `forward-word'. | |||
| 12904 | See the individual commands for more information." | 14473 | See the individual commands for more information." |
| 12905 | (interactive "P") | 14474 | (interactive "P") |
| 12906 | (cond | 14475 | (cond |
| 12907 | ((org-at-table-p) (org-table-move-column nil)) | 14476 | ((org-at-table-p) (call-interactively 'org-table-move-column)) |
| 12908 | ((or (org-on-heading-p) (org-region-active-p)) (org-do-demote)) | 14477 | ((or (org-on-heading-p) (org-region-active-p)) |
| 12909 | (t (forward-word (prefix-numeric-value arg))))) | 14478 | (call-interactively 'org-do-demote)) |
| 14479 | (t (call-interactively 'forward-word)))) | ||
| 12910 | 14480 | ||
| 12911 | (defun org-metaup (&optional arg) | 14481 | (defun org-metaup (&optional arg) |
| 12912 | "Move subtree up or move table row up. | 14482 | "Move subtree up or move table row up. |
| @@ -12915,9 +14485,9 @@ Calls `org-move-subtree-up' or `org-table-move-row' or | |||
| 12915 | for more information." | 14485 | for more information." |
| 12916 | (interactive "P") | 14486 | (interactive "P") |
| 12917 | (cond | 14487 | (cond |
| 12918 | ((org-at-table-p) (org-table-move-row 'up)) | 14488 | ((org-at-table-p) (org-call-with-arg 'org-table-move-row 'up)) |
| 12919 | ((org-on-heading-p) (org-move-subtree-up arg)) | 14489 | ((org-on-heading-p) (call-interactively 'org-move-subtree-up)) |
| 12920 | ((org-at-item-p) (org-move-item-up arg)) | 14490 | ((org-at-item-p) (call-interactively 'org-move-item-up)) |
| 12921 | (t (org-shiftcursor-error)))) | 14491 | (t (org-shiftcursor-error)))) |
| 12922 | 14492 | ||
| 12923 | (defun org-metadown (&optional arg) | 14493 | (defun org-metadown (&optional arg) |
| @@ -12927,43 +14497,46 @@ Calls `org-move-subtree-down' or `org-table-move-row' or | |||
| 12927 | commands for more information." | 14497 | commands for more information." |
| 12928 | (interactive "P") | 14498 | (interactive "P") |
| 12929 | (cond | 14499 | (cond |
| 12930 | ((org-at-table-p) (org-table-move-row nil)) | 14500 | ((org-at-table-p) (call-interactively 'org-table-move-row)) |
| 12931 | ((org-on-heading-p) (org-move-subtree-down arg)) | 14501 | ((org-on-heading-p) (call-interactively 'org-move-subtree-down)) |
| 12932 | ((org-at-item-p) (org-move-item-down arg)) | 14502 | ((org-at-item-p) (call-interactively 'org-move-item-down)) |
| 12933 | (t (org-shiftcursor-error)))) | 14503 | (t (org-shiftcursor-error)))) |
| 12934 | 14504 | ||
| 12935 | (defun org-shiftup (&optional arg) | 14505 | (defun org-shiftup (&optional arg) |
| 12936 | "Increase item in timestamp or increase priority of current item. | 14506 | "Increase item in timestamp or increase priority of current headline. |
| 12937 | Calls `org-timestamp-up' or `org-priority-up', depending on context. | 14507 | Calls `org-timestamp-up' or `org-priority-up', depending on context. |
| 12938 | See the individual commands for more information." | 14508 | See the individual commands for more information." |
| 12939 | (interactive "P") | 14509 | (interactive "P") |
| 12940 | (cond | 14510 | (cond |
| 12941 | ((org-at-timestamp-p) (org-timestamp-up arg)) | 14511 | ((org-at-timestamp-p) (call-interactively 'org-timestamp-up)) |
| 12942 | (t (org-priority-up)))) | 14512 | ((org-on-heading-p) (call-interactively 'org-priority-up)) |
| 14513 | ((org-at-item-p) (call-interactively 'org-previous-item)) | ||
| 14514 | (t (call-interactively 'org-beginning-of-item) (beginning-of-line 1)))) | ||
| 12943 | 14515 | ||
| 12944 | (defun org-shiftdown (&optional arg) | 14516 | (defun org-shiftdown (&optional arg) |
| 12945 | "Decrease item in timestamp or decrease priority of current item. | 14517 | "Decrease item in timestamp or decrease priority of current headline. |
| 12946 | Calls `org-timestamp-down' or `org-priority-down', depending on context. | 14518 | Calls `org-timestamp-down' or `org-priority-down', depending on context. |
| 12947 | See the individual commands for more information." | 14519 | See the individual commands for more information." |
| 12948 | (interactive "P") | 14520 | (interactive "P") |
| 12949 | (cond | 14521 | (cond |
| 12950 | ((org-at-timestamp-p) (org-timestamp-down arg)) | 14522 | ((org-at-timestamp-p) (call-interactively 'org-timestamp-down)) |
| 12951 | (t (org-priority-down)))) | 14523 | ((org-on-heading-p) (call-interactively 'org-priority-down)) |
| 14524 | (t (call-interactively 'org-next-item)))) | ||
| 12952 | 14525 | ||
| 12953 | (defun org-shiftright () | 14526 | (defun org-shiftright () |
| 12954 | "Next TODO keyword or timestamp one day later, depending on context." | 14527 | "Next TODO keyword or timestamp one day later, depending on context." |
| 12955 | (interactive) | 14528 | (interactive) |
| 12956 | (cond | 14529 | (cond |
| 12957 | ((org-at-timestamp-p) (org-timestamp-up-day)) | 14530 | ((org-at-timestamp-p) (call-interactively 'org-timestamp-up-day)) |
| 12958 | ((org-on-heading-p) (org-todo 'right)) | 14531 | ((org-on-heading-p) (org-call-with-arg 'org-todo 'right)) |
| 12959 | (t (org-shiftcursor-error)))) | 14532 | (t (org-shiftcursor-error)))) |
| 12960 | 14533 | ||
| 12961 | (defun org-shiftleft () | 14534 | (defun org-shiftleft () |
| 12962 | "Previous TODO keyword or timestamp one day earlier, depending on context." | 14535 | "Previous TODO keyword or timestamp one day earlier, depending on context." |
| 12963 | (interactive) | 14536 | (interactive) |
| 12964 | (cond | 14537 | (cond |
| 12965 | ((org-at-timestamp-p) (org-timestamp-down-day)) | 14538 | ((org-at-timestamp-p) (call-interactively 'org-timestamp-down-day)) |
| 12966 | ((org-on-heading-p) (org-todo 'left)) | 14539 | ((org-on-heading-p) (org-call-with-arg 'org-todo 'left)) |
| 12967 | (t (org-shiftcursor-error)))) | 14540 | (t (org-shiftcursor-error)))) |
| 12968 | 14541 | ||
| 12969 | (defun org-copy-special () | 14542 | (defun org-copy-special () |
| @@ -13002,7 +14575,7 @@ This command does many different things, depending on context: | |||
| 13002 | 14575 | ||
| 13003 | - If the cursor is in one of the special #+KEYWORD lines, this | 14576 | - If the cursor is in one of the special #+KEYWORD lines, this |
| 13004 | triggers scanning the buffer for these lines and updating the | 14577 | triggers scanning the buffer for these lines and updating the |
| 13005 | information. | 14578 | information. |
| 13006 | 14579 | ||
| 13007 | - If the cursor is inside a table, realign the table. This command | 14580 | - If the cursor is inside a table, realign the table. This command |
| 13008 | works even if the automatic table editor has been turned off. | 14581 | works even if the automatic table editor has been turned off. |
| @@ -13025,24 +14598,32 @@ This command does many different things, depending on context: | |||
| 13025 | (interactive "P") | 14598 | (interactive "P") |
| 13026 | (let ((org-enable-table-editor t)) | 14599 | (let ((org-enable-table-editor t)) |
| 13027 | (cond | 14600 | (cond |
| 14601 | (org-clock-overlays | ||
| 14602 | (org-remove-clock-overlays) | ||
| 14603 | (message "Clock overlays removed")) | ||
| 14604 | (org-occur-highlights | ||
| 14605 | (org-remove-occur-highlights) | ||
| 14606 | (message "occur highlights removed")) | ||
| 13028 | ((and (local-variable-p 'org-finish-function (current-buffer)) | 14607 | ((and (local-variable-p 'org-finish-function (current-buffer)) |
| 13029 | (fboundp org-finish-function)) | 14608 | (fboundp org-finish-function)) |
| 13030 | (funcall org-finish-function)) | 14609 | (funcall org-finish-function)) |
| 13031 | ((org-on-target-p) (org-update-radio-target-regexp)) | 14610 | ((org-on-target-p) (call-interactively 'org-update-radio-target-regexp)) |
| 13032 | ((org-on-heading-p) (org-set-tags arg)) | 14611 | ((org-on-heading-p) (call-interactively 'org-set-tags)) |
| 13033 | ((org-at-table.el-p) | 14612 | ((org-at-table.el-p) |
| 13034 | (require 'table) | 14613 | (require 'table) |
| 13035 | (beginning-of-line 1) | 14614 | (beginning-of-line 1) |
| 13036 | (re-search-forward "|" (save-excursion (end-of-line 2) (point))) | 14615 | (re-search-forward "|" (save-excursion (end-of-line 2) (point))) |
| 13037 | (table-recognize-table)) | 14616 | (call-interactively 'table-recognize-table)) |
| 13038 | ((org-at-table-p) | 14617 | ((org-at-table-p) |
| 13039 | (org-table-maybe-eval-formula) | 14618 | (org-table-maybe-eval-formula) |
| 13040 | (if arg | 14619 | (if arg |
| 13041 | (org-table-recalculate t) | 14620 | (call-interactively 'org-table-recalculate) |
| 13042 | (org-table-maybe-recalculate-line)) | 14621 | (org-table-maybe-recalculate-line)) |
| 13043 | (org-table-align)) | 14622 | (call-interactively 'org-table-align)) |
| 14623 | ((org-at-item-checkbox-p) | ||
| 14624 | (call-interactively 'org-toggle-checkbox)) | ||
| 13044 | ((org-at-item-p) | 14625 | ((org-at-item-p) |
| 13045 | (org-renumber-ordered-list (prefix-numeric-value arg))) | 14626 | (call-interactively 'org-renumber-ordered-list)) |
| 13046 | ((save-excursion (beginning-of-line 1) (looking-at "#\\+\\([A-Z]+\\)")) | 14627 | ((save-excursion (beginning-of-line 1) (looking-at "#\\+\\([A-Z]+\\)")) |
| 13047 | (cond | 14628 | (cond |
| 13048 | ((equal (match-string 1) "TBLFM") | 14629 | ((equal (match-string 1) "TBLFM") |
| @@ -13050,9 +14631,10 @@ This command does many different things, depending on context: | |||
| 13050 | (save-excursion | 14631 | (save-excursion |
| 13051 | (beginning-of-line 1) | 14632 | (beginning-of-line 1) |
| 13052 | (skip-chars-backward " \r\n\t") | 14633 | (skip-chars-backward " \r\n\t") |
| 13053 | (if (org-at-table-p) (org-table-recalculate t)))) | 14634 | (if (org-at-table-p) |
| 14635 | (org-call-with-arg 'org-table-recalculate t)))) | ||
| 13054 | (t | 14636 | (t |
| 13055 | (org-mode-restart)))) | 14637 | (call-interactively 'org-mode-restart)))) |
| 13056 | (t (error "C-c C-c can do nothing useful at this location."))))) | 14638 | (t (error "C-c C-c can do nothing useful at this location."))))) |
| 13057 | 14639 | ||
| 13058 | (defun org-mode-restart () | 14640 | (defun org-mode-restart () |
| @@ -13070,7 +14652,7 @@ See the individual commands for more information." | |||
| 13070 | (cond | 14652 | (cond |
| 13071 | ((org-at-table-p) | 14653 | ((org-at-table-p) |
| 13072 | (org-table-justify-field-maybe) | 14654 | (org-table-justify-field-maybe) |
| 13073 | (org-table-next-row)) | 14655 | (call-interactively 'org-table-next-row)) |
| 13074 | (t (newline)))) | 14656 | (t (newline)))) |
| 13075 | 14657 | ||
| 13076 | (defun org-meta-return (&optional arg) | 14658 | (defun org-meta-return (&optional arg) |
| @@ -13080,8 +14662,8 @@ See the individual commands for more information." | |||
| 13080 | (interactive "P") | 14662 | (interactive "P") |
| 13081 | (cond | 14663 | (cond |
| 13082 | ((org-at-table-p) | 14664 | ((org-at-table-p) |
| 13083 | (org-table-wrap-region arg)) | 14665 | (call-interactively 'org-table-wrap-region)) |
| 13084 | (t (org-insert-heading arg)))) | 14666 | (t (call-interactively 'org-insert-heading)))) |
| 13085 | 14667 | ||
| 13086 | ;;; Menu entries | 14668 | ;;; Menu entries |
| 13087 | 14669 | ||
| @@ -13198,6 +14780,18 @@ See the individual commands for more information." | |||
| 13198 | "--" | 14780 | "--" |
| 13199 | ["Goto Calendar" org-goto-calendar t] | 14781 | ["Goto Calendar" org-goto-calendar t] |
| 13200 | ["Date from Calendar" org-date-from-calendar t]) | 14782 | ["Date from Calendar" org-date-from-calendar t]) |
| 14783 | ("Logging work" | ||
| 14784 | ["Clock in" org-clock-in t] | ||
| 14785 | ["Clock out" org-clock-out t] | ||
| 14786 | ["Clock cancel" org-clock-cancel t] | ||
| 14787 | ["Display times" org-clock-display t] | ||
| 14788 | "--" | ||
| 14789 | ["Record DONE time" | ||
| 14790 | (progn (setq org-log-done (not org-log-done)) | ||
| 14791 | (message "Switching to %s will %s record a timestamp" | ||
| 14792 | org-done-string | ||
| 14793 | (if org-log-done "automatically" "not"))) | ||
| 14794 | :style toggle :selected org-log-done]) | ||
| 13201 | "--" | 14795 | "--" |
| 13202 | ["Agenda Command" org-agenda t] | 14796 | ["Agenda Command" org-agenda t] |
| 13203 | ("File List for Agenda") | 14797 | ("File List for Agenda") |
| @@ -13221,23 +14815,10 @@ See the individual commands for more information." | |||
| 13221 | :style radio :selected (not (member '(org-link) buffer-invisibility-spec))] | 14815 | :style radio :selected (not (member '(org-link) buffer-invisibility-spec))] |
| 13222 | "--" | 14816 | "--" |
| 13223 | ["Upgrade all <link> to [[link][desc]]" org-upgrade-old-links | 14817 | ["Upgrade all <link> to [[link][desc]]" org-upgrade-old-links |
| 13224 | (save-excursion (goto-char (point-min)) | 14818 | (save-excursion (goto-char (point-min)) |
| 13225 | (re-search-forward "<[a-z]+:" nil t))]) | 14819 | (re-search-forward "<[a-z]+:" nil t))]) |
| 13226 | "--" | 14820 | "--" |
| 13227 | ("Export" | 14821 | ["Export/Publish" org-export t] |
| 13228 | ["ASCII" org-export-as-ascii t] | ||
| 13229 | ["Extract Visible Text" org-export-copy-visible t] | ||
| 13230 | ["HTML" org-export-as-html t] | ||
| 13231 | ["HTML and Open" org-export-as-html-and-open t] | ||
| 13232 | ["XML (XOXO)" org-export-as-xml t] | ||
| 13233 | "--" | ||
| 13234 | ["iCalendar this file" org-export-icalendar-this-file t] | ||
| 13235 | ["iCalendar all agenda files" org-export-icalendar-all-agenda-files | ||
| 13236 | :active t :keys "C-c C-x C-i"] | ||
| 13237 | ["iCalendar combined" org-export-icalendar-combine-agenda-files t] | ||
| 13238 | "--" | ||
| 13239 | ["Option Template" org-insert-export-options-template t] | ||
| 13240 | ["Toggle Fixed Width" org-toggle-fixed-width-section t]) | ||
| 13241 | "--" | 14822 | "--" |
| 13242 | ("Documentation" | 14823 | ("Documentation" |
| 13243 | ["Show Version" org-version t] | 14824 | ["Show Version" org-version t] |
| @@ -13303,6 +14884,100 @@ With optional NODE, go directly to that node." | |||
| 13303 | 14884 | ||
| 13304 | ;;; Miscellaneous stuff | 14885 | ;;; Miscellaneous stuff |
| 13305 | 14886 | ||
| 14887 | (defun org-context () | ||
| 14888 | "Return a list of contexts of the current cursor position. | ||
| 14889 | If several contexts apply, all are returned. | ||
| 14890 | Each context entry is a list with a symbol naming the context, and | ||
| 14891 | two positions indicating start and end of the context. Possible | ||
| 14892 | contexts are: | ||
| 14893 | |||
| 14894 | :headline anywhere in a headline | ||
| 14895 | :headline-stars on the leading stars in a headline | ||
| 14896 | :todo-keyword on a TODO keyword (including DONE) in a headline | ||
| 14897 | :tags on the TAGS in a headline | ||
| 14898 | :priority on the priority cookie in a headline | ||
| 14899 | :item on the first line of a plain list item | ||
| 14900 | :checkbox on the checkbox in a plain list item | ||
| 14901 | :table in an org-mode table | ||
| 14902 | :table-special on a special filed in a table | ||
| 14903 | :table-table in a table.el table | ||
| 14904 | :link on a hyperline | ||
| 14905 | :keyword on a keyword: SCHEDULED, DEADLINE, CLOSE,COMMENT, QUOTE. | ||
| 14906 | :target on a <<target>> | ||
| 14907 | :radio-target on a <<<radio-target>>> | ||
| 14908 | |||
| 14909 | This function expects the position to be visible because it uses font-lock | ||
| 14910 | faces as a help to recognize the following contexts: :table-special, :link, | ||
| 14911 | and :keyword." | ||
| 14912 | (let* ((f (get-text-property (point) 'face)) | ||
| 14913 | (faces (if (listp f) f (list f))) | ||
| 14914 | (p (point)) clist) | ||
| 14915 | ;; First the large context | ||
| 14916 | (cond | ||
| 14917 | ((org-on-heading-p) | ||
| 14918 | (push (list :headline (point-at-bol) (point-at-eol)) clist) | ||
| 14919 | (when (progn | ||
| 14920 | (beginning-of-line 1) | ||
| 14921 | (looking-at org-todo-line-tags-regexp)) | ||
| 14922 | (push (org-point-in-group p 1 :headline-stars) clist) | ||
| 14923 | (push (org-point-in-group p 2 :todo-keyword) clist) | ||
| 14924 | (push (org-point-in-group p 4 :tags) clist)) | ||
| 14925 | (goto-char p) | ||
| 14926 | (skip-chars-backward "^[\n\r \t") (or (eobp) (backward-char 1)) | ||
| 14927 | (if (looking-at "\\[#[A-Z]\\]") | ||
| 14928 | (push (org-point-in-group p 0 :priority) clist))) | ||
| 14929 | |||
| 14930 | ((org-at-item-p) | ||
| 14931 | (push (list :item (point-at-bol) | ||
| 14932 | (save-excursion (org-end-of-item) (point))) | ||
| 14933 | clist) | ||
| 14934 | (and (org-at-item-checkbox-p) | ||
| 14935 | (push (org-point-in-group p 0 :checkbox) clist))) | ||
| 14936 | |||
| 14937 | ((org-at-table-p) | ||
| 14938 | (push (list :table (org-table-begin) (org-table-end)) clist) | ||
| 14939 | (if (memq 'org-formula faces) | ||
| 14940 | (push (list :table-special | ||
| 14941 | (previous-single-property-change p 'face) | ||
| 14942 | (next-single-property-change p 'face)) clist))) | ||
| 14943 | ((org-at-table-p 'any) | ||
| 14944 | (push (list :table-table) clist))) | ||
| 14945 | (goto-char p) | ||
| 14946 | |||
| 14947 | ;; Now the small context | ||
| 14948 | (cond | ||
| 14949 | ((org-at-timestamp-p) | ||
| 14950 | (push (org-point-in-group p 0 :timestamp) clist)) | ||
| 14951 | ((memq 'org-link faces) | ||
| 14952 | (push (list :link | ||
| 14953 | (previous-single-property-change p 'face) | ||
| 14954 | (next-single-property-change p 'face)) clist)) | ||
| 14955 | ((memq 'org-special-keyword faces) | ||
| 14956 | (push (list :keyword | ||
| 14957 | (previous-single-property-change p 'face) | ||
| 14958 | (next-single-property-change p 'face)) clist)) | ||
| 14959 | ((org-on-target-p) | ||
| 14960 | (push (org-point-in-group p 0 :target) clist) | ||
| 14961 | (goto-char (1- (match-beginning 0))) | ||
| 14962 | (if (looking-at org-radio-target-regexp) | ||
| 14963 | (push (org-point-in-group p 0 :radio-target) clist)) | ||
| 14964 | (goto-char p))) | ||
| 14965 | |||
| 14966 | (setq clist (nreverse (delq nil clist))) | ||
| 14967 | clist)) | ||
| 14968 | |||
| 14969 | (defun org-point-in-group (point group &optional context) | ||
| 14970 | "Check if POINT is in match-group GROUP. | ||
| 14971 | If CONTEXT is non-nil, return a list with CONTEXT and the boundaries of the | ||
| 14972 | match. If the match group does ot exist or point is not inside it, | ||
| 14973 | return nil." | ||
| 14974 | (and (match-beginning group) | ||
| 14975 | (>= point (match-beginning group)) | ||
| 14976 | (<= point (match-end group)) | ||
| 14977 | (if context | ||
| 14978 | (list context (match-beginning group) (match-end group)) | ||
| 14979 | t))) | ||
| 14980 | |||
| 13306 | (defun org-move-line-down (arg) | 14981 | (defun org-move-line-down (arg) |
| 13307 | "Move the current line down. With prefix argument, move it past ARG lines." | 14982 | "Move the current line down. With prefix argument, move it past ARG lines." |
| 13308 | (interactive "p") | 14983 | (interactive "p") |
| @@ -13331,8 +15006,6 @@ With optional NODE, go directly to that node." | |||
| 13331 | 15006 | ||
| 13332 | ;; Paragraph filling stuff. | 15007 | ;; Paragraph filling stuff. |
| 13333 | ;; We want this to be just right, so use the full arsenal. | 15008 | ;; We want this to be just right, so use the full arsenal. |
| 13334 | ;; FIXME: This very likely does not work correctly for XEmacs, because the | ||
| 13335 | ;; filladapt package works slightly differently. | ||
| 13336 | 15009 | ||
| 13337 | (defun org-set-autofill-regexps () | 15010 | (defun org-set-autofill-regexps () |
| 13338 | (interactive) | 15011 | (interactive) |
| @@ -13347,6 +15020,7 @@ With optional NODE, go directly to that node." | |||
| 13347 | ;; But only if the user has not turned off tables or fixed-width regions | 15020 | ;; But only if the user has not turned off tables or fixed-width regions |
| 13348 | (set (make-local-variable 'auto-fill-inhibit-regexp) | 15021 | (set (make-local-variable 'auto-fill-inhibit-regexp) |
| 13349 | (concat "\\*\\|#" | 15022 | (concat "\\*\\|#" |
| 15023 | "\\|[ \t]*" org-keyword-time-regexp | ||
| 13350 | (if (or org-enable-table-editor org-enable-fixed-width-editor) | 15024 | (if (or org-enable-table-editor org-enable-fixed-width-editor) |
| 13351 | (concat | 15025 | (concat |
| 13352 | "\\|[ \t]*[" | 15026 | "\\|[ \t]*[" |
| @@ -13451,7 +15125,7 @@ that can be added." | |||
| 13451 | ;; The following functions capture almost the entire compatibility code | 15125 | ;; The following functions capture almost the entire compatibility code |
| 13452 | ;; between the different versions of outline-mode. The only other | 15126 | ;; between the different versions of outline-mode. The only other |
| 13453 | ;; places where this is important are the font-lock-keywords, and in | 15127 | ;; places where this is important are the font-lock-keywords, and in |
| 13454 | ;; `org-export-copy-visible'. Search for `org-noutline-p' to find them. | 15128 | ;; `org-export-visible'. Search for `org-noutline-p' to find them. |
| 13455 | 15129 | ||
| 13456 | ;; C-a should go to the beginning of a *visible* line, also in the | 15130 | ;; C-a should go to the beginning of a *visible* line, also in the |
| 13457 | ;; new outline.el. I guess this should be patched into Emacs? | 15131 | ;; new outline.el. I guess this should be patched into Emacs? |
| @@ -13471,8 +15145,6 @@ to a visible line beginning. This makes the function of C-a more intuitive." | |||
| 13471 | 15145 | ||
| 13472 | (when org-noutline-p | 15146 | (when org-noutline-p |
| 13473 | (define-key org-mode-map "\C-a" 'org-beginning-of-line)) | 15147 | (define-key org-mode-map "\C-a" 'org-beginning-of-line)) |
| 13474 | ;; FIXME: should I use substitute-key-definition to reach other bindings | ||
| 13475 | ;; of beginning-of-line? | ||
| 13476 | 15148 | ||
| 13477 | (defun org-invisible-p () | 15149 | (defun org-invisible-p () |
| 13478 | "Check if point is at a character currently not visible." | 15150 | "Check if point is at a character currently not visible." |
| @@ -13503,15 +15175,15 @@ to a visible line beginning. This makes the function of C-a more intuitive." | |||
| 13503 | Only visible heading lines are considered, unless INVISIBLE-OK is non-nil." | 15175 | Only visible heading lines are considered, unless INVISIBLE-OK is non-nil." |
| 13504 | (if org-noutline-p | 15176 | (if org-noutline-p |
| 13505 | (outline-back-to-heading invisible-ok) | 15177 | (outline-back-to-heading invisible-ok) |
| 13506 | (if (and (memq (char-before) '(?\n ?\r)) | 15178 | (if (and (or (bobp) (memq (char-before) '(?\n ?\r))) |
| 13507 | (looking-at outline-regexp)) | 15179 | (looking-at outline-regexp)) |
| 13508 | t | 15180 | t |
| 13509 | (if (re-search-backward (concat (if invisible-ok "\\([\r\n]\\|^\\)" "^") | 15181 | (if (re-search-backward (concat (if invisible-ok "\\([\r\n]\\|^\\)" "^") |
| 13510 | outline-regexp) | 15182 | outline-regexp) |
| 13511 | nil t) | 15183 | nil t) |
| 13512 | (if invisible-ok | 15184 | (if invisible-ok |
| 13513 | (progn (goto-char (match-end 1)) | 15185 | (progn (goto-char (or (match-end 1) (match-beginning 0))) |
| 13514 | (looking-at outline-regexp))) | 15186 | (looking-at outline-regexp))) |
| 13515 | (error "Before first heading"))))) | 15187 | (error "Before first heading"))))) |
| 13516 | 15188 | ||
| 13517 | (defun org-on-heading-p (&optional invisible-ok) | 15189 | (defun org-on-heading-p (&optional invisible-ok) |
| @@ -13585,10 +15257,9 @@ When ENTRY is non-nil, show the entire entry." | |||
| 13585 | (if entry | 15257 | (if entry |
| 13586 | (progn | 15258 | (progn |
| 13587 | (org-show-entry) | 15259 | (org-show-entry) |
| 13588 | (save-excursion ;; FIXME: Is this the fix for points in the -| | 15260 | (save-excursion |
| 13589 | ;; middle of text? | | 15261 | (and (outline-next-heading) |
| 13590 | (and (outline-next-heading) ;; | | 15262 | (org-flag-heading nil)))) |
| 13591 | (org-flag-heading nil)))) ; show the next heading _| | ||
| 13592 | (outline-flag-region (max 1 (1- (point))) | 15263 | (outline-flag-region (max 1 (1- (point))) |
| 13593 | (save-excursion (outline-end-of-heading) (point)) | 15264 | (save-excursion (outline-end-of-heading) (point)) |
| 13594 | (if org-noutline-p | 15265 | (if org-noutline-p |
| @@ -13630,7 +15301,7 @@ Show the heading too, if it is currently invisible." | |||
| 13630 | (save-excursion | 15301 | (save-excursion |
| 13631 | (org-back-to-heading t) | 15302 | (org-back-to-heading t) |
| 13632 | (outline-flag-region | 15303 | (outline-flag-region |
| 13633 | (1- (point)) | 15304 | (max 1 (1- (point))) |
| 13634 | (save-excursion | 15305 | (save-excursion |
| 13635 | (re-search-forward (concat "[\r\n]\\(" outline-regexp "\\)") nil 'move) | 15306 | (re-search-forward (concat "[\r\n]\\(" outline-regexp "\\)") nil 'move) |
| 13636 | (or (match-beginning 1) (point-max))) | 15307 | (or (match-beginning 1) (point-max))) |
| @@ -13671,4 +15342,3 @@ Show the heading too, if it is currently invisible." | |||
| 13671 | 15342 | ||
| 13672 | ;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd | 15343 | ;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd |
| 13673 | ;;; org.el ends here | 15344 | ;;; org.el ends here |
| 13674 | |||
diff --git a/lisp/textmodes/page-ext.el b/lisp/textmodes/page-ext.el index 280a8d28020..24282872f67 100644 --- a/lisp/textmodes/page-ext.el +++ b/lisp/textmodes/page-ext.el | |||
| @@ -777,7 +777,9 @@ directory." | |||
| 777 | (or filename pages-addresses-file-name)))) | 777 | (or filename pages-addresses-file-name)))) |
| 778 | (widen) | 778 | (widen) |
| 779 | (pages-directory t nil nil) | 779 | (pages-directory t nil nil) |
| 780 | (pages-directory-address-mode) | 780 | ;; by RJC, 2006 Jun 11: including this causes failure; it results in |
| 781 | ;; the message "Buffer in which pages were found is deleted" | ||
| 782 | ;; (pages-directory-address-mode) | ||
| 781 | (setq pages-directory-buffer-narrowing-p | 783 | (setq pages-directory-buffer-narrowing-p |
| 782 | pages-directory-for-addresses-goto-narrowing-p) | 784 | pages-directory-for-addresses-goto-narrowing-p) |
| 783 | (or pages-directory-for-addresses-buffer-keep-windows-p | 785 | (or pages-directory-for-addresses-buffer-keep-windows-p |
diff --git a/lisp/textmodes/po.el b/lisp/textmodes/po.el index 07b9ba1a2b1..eac1cb94105 100644 --- a/lisp/textmodes/po.el +++ b/lisp/textmodes/po.el | |||
| @@ -41,15 +41,21 @@ | |||
| 41 | Contains canonical charset names that don't correspond to coding systems.") | 41 | Contains canonical charset names that don't correspond to coding systems.") |
| 42 | 42 | ||
| 43 | (defun po-find-charset (filename) | 43 | (defun po-find-charset (filename) |
| 44 | "Return PO charset value for FILENAME." | 44 | "Return PO charset value for FILENAME. |
| 45 | If FILENAME is a cons, the cdr part is a buffer that already contains | ||
| 46 | the PO file (but not yet decoded)." | ||
| 45 | (let ((charset-regexp | 47 | (let ((charset-regexp |
| 46 | "^\"Content-Type:[ \t]*text/plain;[ \t]*charset=\\(.*\\)\\\\n\"") | 48 | "^\"Content-Type:[ \t]*text/plain;[ \t]*charset=\\(.*\\)\\\\n\"") |
| 49 | (buf (and (consp filename) (cdr filename))) | ||
| 47 | (short-read nil)) | 50 | (short-read nil)) |
| 51 | (when buf | ||
| 52 | (set-buffer buf) | ||
| 53 | (goto-char (point-min))) | ||
| 48 | ;; Try the first 4096 bytes. In case we cannot find the charset value | 54 | ;; Try the first 4096 bytes. In case we cannot find the charset value |
| 49 | ;; within the first 4096 bytes (the PO file might start with a long | 55 | ;; within the first 4096 bytes (the PO file might start with a long |
| 50 | ;; comment) try the next 4096 bytes repeatedly until we'll know for sure | 56 | ;; comment) try the next 4096 bytes repeatedly until we'll know for sure |
| 51 | ;; we've checked the empty header entry entirely. | 57 | ;; we've checked the empty header entry entirely. |
| 52 | (while (not (or short-read (re-search-forward "^msgid" nil t))) | 58 | (while (not (or short-read (re-search-forward "^msgid" nil t) buf)) |
| 53 | (save-excursion | 59 | (save-excursion |
| 54 | (goto-char (point-max)) | 60 | (goto-char (point-max)) |
| 55 | (let ((pair (insert-file-contents-literally filename nil | 61 | (let ((pair (insert-file-contents-literally filename nil |
| @@ -57,7 +63,7 @@ Contains canonical charset names that don't correspond to coding systems.") | |||
| 57 | (1- (+ (point) 4096))))) | 63 | (1- (+ (point) 4096))))) |
| 58 | (setq short-read (< (nth 1 pair) 4096))))) | 64 | (setq short-read (< (nth 1 pair) 4096))))) |
| 59 | (cond ((re-search-forward charset-regexp nil t) (match-string 1)) | 65 | (cond ((re-search-forward charset-regexp nil t) (match-string 1)) |
| 60 | (short-read nil) | 66 | ((or short-read buf) nil) |
| 61 | ;; We've found the first msgid; maybe, only a part of the msgstr | 67 | ;; We've found the first msgid; maybe, only a part of the msgstr |
| 62 | ;; value was loaded. Load the next 1024 bytes; if charset still | 68 | ;; value was loaded. Load the next 1024 bytes; if charset still |
| 63 | ;; isn't available, give up. | 69 | ;; isn't available, give up. |
| @@ -71,10 +77,13 @@ Contains canonical charset names that don't correspond to coding systems.") | |||
| 71 | 77 | ||
| 72 | (defun po-find-file-coding-system-guts (operation filename) | 78 | (defun po-find-file-coding-system-guts (operation filename) |
| 73 | "Return a (DECODING . ENCODING) pair for OPERATION on PO file FILENAME. | 79 | "Return a (DECODING . ENCODING) pair for OPERATION on PO file FILENAME. |
| 74 | Do so according to FILENAME's declared charset." | 80 | Do so according to FILENAME's declared charset. |
| 81 | FILENAME may be a cons (NAME . BUFFER). In that case, detect charset | ||
| 82 | in BUFFER." | ||
| 75 | (and | 83 | (and |
| 76 | (eq operation 'insert-file-contents) | 84 | (eq operation 'insert-file-contents) |
| 77 | (file-exists-p filename) | 85 | (or (if (consp filename) (buffer-live-p (cdr filename))) |
| 86 | (file-exists-p filename)) | ||
| 78 | (with-temp-buffer | 87 | (with-temp-buffer |
| 79 | (let* ((coding-system-for-read 'no-conversion) | 88 | (let* ((coding-system-for-read 'no-conversion) |
| 80 | (charset (or (po-find-charset filename) "ascii")) | 89 | (charset (or (po-find-charset filename) "ascii")) |
diff --git a/lisp/textmodes/table.el b/lisp/textmodes/table.el index 6c9463fe11e..dab08902769 100644 --- a/lisp/textmodes/table.el +++ b/lisp/textmodes/table.el | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | ;; Keywords: wp, convenience | 6 | ;; Keywords: wp, convenience |
| 7 | ;; Author: Takaaki Ota <Takaaki.Ota@am.sony.com> | 7 | ;; Author: Takaaki Ota <Takaaki.Ota@am.sony.com> |
| 8 | ;; Created: Sat Jul 08 2000 13:28:45 (PST) | 8 | ;; Created: Sat Jul 08 2000 13:28:45 (PST) |
| 9 | ;; Revised: Sat Aug 06 2005 19:42:54 (CEST) | 9 | ;; Revised: Tue May 30 2006 10:01:43 (PDT) |
| 10 | 10 | ||
| 11 | ;; This file is part of GNU Emacs. | 11 | ;; This file is part of GNU Emacs. |
| 12 | 12 | ||
| @@ -3104,10 +3104,10 @@ CALS (DocBook DTD): | |||
| 3104 | (cond | 3104 | (cond |
| 3105 | ((eq language 'html) | 3105 | ((eq language 'html) |
| 3106 | (insert (format "<!-- This HTML table template is generated by emacs %s -->\n" emacs-version) | 3106 | (insert (format "<!-- This HTML table template is generated by emacs %s -->\n" emacs-version) |
| 3107 | (format "<TABLE %s>\n" table-html-table-attribute) | 3107 | (format "<table %s>\n" table-html-table-attribute) |
| 3108 | (if (and (stringp caption) | 3108 | (if (and (stringp caption) |
| 3109 | (not (string= caption ""))) | 3109 | (not (string= caption ""))) |
| 3110 | (format " <CAPTION>%s</CAPTION>\n" caption) | 3110 | (format " <caption>%s</caption>\n" caption) |
| 3111 | ""))) | 3111 | ""))) |
| 3112 | ((eq language 'latex) | 3112 | ((eq language 'latex) |
| 3113 | (insert (format "%% This LaTeX table template is generated by emacs %s\n" emacs-version) | 3113 | (insert (format "%% This LaTeX table template is generated by emacs %s\n" emacs-version) |
| @@ -3131,7 +3131,7 @@ CALS (DocBook DTD): | |||
| 3131 | (with-current-buffer dest-buffer | 3131 | (with-current-buffer dest-buffer |
| 3132 | (cond | 3132 | (cond |
| 3133 | ((eq language 'html) | 3133 | ((eq language 'html) |
| 3134 | (insert "</TABLE>\n")) | 3134 | (insert "</table>\n")) |
| 3135 | ((eq language 'latex) | 3135 | ((eq language 'latex) |
| 3136 | (insert "\\end{tabular}\n")) | 3136 | (insert "\\end{tabular}\n")) |
| 3137 | ((eq language 'cals) | 3137 | ((eq language 'cals) |
| @@ -3152,7 +3152,7 @@ CALS (DocBook DTD): | |||
| 3152 | (with-current-buffer dest-buffer | 3152 | (with-current-buffer dest-buffer |
| 3153 | (cond | 3153 | (cond |
| 3154 | ((eq language 'html) | 3154 | ((eq language 'html) |
| 3155 | (insert " <TR>\n")) | 3155 | (insert " <tr>\n")) |
| 3156 | ((eq language 'cals) | 3156 | ((eq language 'cals) |
| 3157 | (insert " <row>\n")) | 3157 | (insert " <row>\n")) |
| 3158 | )) | 3158 | )) |
| @@ -3160,7 +3160,7 @@ CALS (DocBook DTD): | |||
| 3160 | (with-current-buffer dest-buffer | 3160 | (with-current-buffer dest-buffer |
| 3161 | (cond | 3161 | (cond |
| 3162 | ((eq language 'html) | 3162 | ((eq language 'html) |
| 3163 | (insert " </TR>\n")) | 3163 | (insert " </tr>\n")) |
| 3164 | ((eq language 'cals) | 3164 | ((eq language 'cals) |
| 3165 | (insert " </row>\n") | 3165 | (insert " </row>\n") |
| 3166 | (unless (/= (table-get-source-info 'current-row) table-cals-thead-rows) | 3166 | (unless (/= (table-get-source-info 'current-row) table-cals-thead-rows) |
| @@ -3207,7 +3207,7 @@ CALS (DocBook DTD): | |||
| 3207 | 'cell-type | 3207 | 'cell-type |
| 3208 | (if (or (<= (table-get-source-info 'current-row) table-html-th-rows) | 3208 | (if (or (<= (table-get-source-info 'current-row) table-html-th-rows) |
| 3209 | (<= (table-get-source-info 'current-column) table-html-th-columns)) | 3209 | (<= (table-get-source-info 'current-column) table-html-th-columns)) |
| 3210 | "TH" "TD")))) | 3210 | "th" "td")))) |
| 3211 | (if (and table-html-cell-attribute (not (string= table-html-cell-attribute ""))) | 3211 | (if (and table-html-cell-attribute (not (string= table-html-cell-attribute ""))) |
| 3212 | (insert " " table-html-cell-attribute)) | 3212 | (insert " " table-html-cell-attribute)) |
| 3213 | (if (> colspan 1) (insert (format " colspan=\"%d\"" colspan))) | 3213 | (if (> colspan 1) (insert (format " colspan=\"%d\"" colspan))) |
| @@ -3266,7 +3266,7 @@ CALS (DocBook DTD): | |||
| 3266 | (goto-char (point-min)) | 3266 | (goto-char (point-min)) |
| 3267 | (while (and (re-search-forward "$" nil t) | 3267 | (while (and (re-search-forward "$" nil t) |
| 3268 | (not (eobp))) | 3268 | (not (eobp))) |
| 3269 | (insert "<BR />") | 3269 | (insert "<br />") |
| 3270 | (forward-char 1))) | 3270 | (forward-char 1))) |
| 3271 | (unless (and table-html-delegate-spacing-to-user-agent | 3271 | (unless (and table-html-delegate-spacing-to-user-agent |
| 3272 | (progn | 3272 | (progn |
diff --git a/lisp/textmodes/text-mode.el b/lisp/textmodes/text-mode.el index a4b67057676..9263c48f18b 100644 --- a/lisp/textmodes/text-mode.el +++ b/lisp/textmodes/text-mode.el | |||
| @@ -33,7 +33,7 @@ | |||
| 33 | (defcustom text-mode-hook nil | 33 | (defcustom text-mode-hook nil |
| 34 | "Normal hook run when entering Text mode and many related modes." | 34 | "Normal hook run when entering Text mode and many related modes." |
| 35 | :type 'hook | 35 | :type 'hook |
| 36 | :options '(turn-on-auto-fill flyspell-mode) | 36 | :options '(turn-on-auto-fill turn-on-flyspell) |
| 37 | :group 'data) | 37 | :group 'data) |
| 38 | 38 | ||
| 39 | (defvar text-mode-variant nil | 39 | (defvar text-mode-variant nil |
diff --git a/lisp/tumme.el b/lisp/tumme.el index 8f6e43e9cd6..d6420bf33d7 100644 --- a/lisp/tumme.el +++ b/lisp/tumme.el | |||
| @@ -84,46 +84,13 @@ | |||
| 84 | ;; USAGE | 84 | ;; USAGE |
| 85 | ;; ===== | 85 | ;; ===== |
| 86 | ;; | 86 | ;; |
| 87 | ;; If you plan to use tumme much, setting up key bindings for it in | 87 | ;; This information has been moved to the manual. Type `C-h r' to open |
| 88 | ;; dired is a good idea: | 88 | ;; the Emacs manual and go to the node Thumbnails by typing `g |
| 89 | ;; Thumbnails RET'. | ||
| 89 | ;; | 90 | ;; |
| 90 | ;; (tumme-setup-dired-keybindings) | 91 | ;; Quickstart: M-x tumme RET DIRNAME RET |
| 91 | ;; | ||
| 92 | ;; Next, do M-x tumme-dired RET. This will ask you for a directory | ||
| 93 | ;; where image files are stored, setup a useful window configuration | ||
| 94 | ;; and enable the two special modes that tumme provides. NOTE: If you | ||
| 95 | ;; do not want tumme to split your windows, call it with a prefix | ||
| 96 | ;; argument. | ||
| 97 | ;; | ||
| 98 | ;; Start viewing thumbnails by doing C-S-n and C-S-p to go up and down | ||
| 99 | ;; in the dired buffer while at the same time displaying a thumbnail | ||
| 100 | ;; image. The thumbnail images will be created on the fly, and | ||
| 101 | ;; cached. This means that the first time you browse your images, it | ||
| 102 | ;; will be a bit slow because the thumbnails are created. If you want | ||
| 103 | ;; to avoid this, you can pre-create the thumbnail images by marking | ||
| 104 | ;; all images in dired (% m \.jpg$ RET) and then do M-x | ||
| 105 | ;; tumme-create-thumbs. | ||
| 106 | ;; | ||
| 107 | ;; Next, try `tumme-display-thumbs' (C-t d). If no file is marked, a | ||
| 108 | ;; thumbnail for the file at point will show up in | ||
| 109 | ;; `tumme-thumbnail-buffer'. If one or more files are marked, | ||
| 110 | ;; thumbnails for those files will be displayed. | ||
| 111 | ;; | ||
| 112 | ;; Pressing TAB will switch to the window containing the | ||
| 113 | ;; `tumme-thumbnail-buffer' buffer. In there you can move between | ||
| 114 | ;; thumbnail images and display a semi-sized version in an Emacs | ||
| 115 | ;; buffer (RET), or the original image in an external viewer | ||
| 116 | ;; (C-RET). By pressing SPC or DEL you will navigate back and fort | ||
| 117 | ;; while at the same time displaying each image in Emacs. You can also | ||
| 118 | ;; navigate using arrow keys. Comment a file by pressing "c". Press | ||
| 119 | ;; TAB to get back to dired. | ||
| 120 | ;; | ||
| 121 | ;; While in dired mode, you can tag and comment files, you can tell | ||
| 122 | ;; `tumme' to mark files with a certain tag (using a regexp) etc. | ||
| 123 | ;; | ||
| 124 | ;; The easiest way to see the available commands is to use the Tumme | ||
| 125 | ;; menus added in tumme-thumbnail-mode and dired-mode. | ||
| 126 | ;; | 92 | ;; |
| 93 | ;; where DIRNAME is a directory containing image files. | ||
| 127 | ;; | 94 | ;; |
| 128 | ;; LIMITATIONS | 95 | ;; LIMITATIONS |
| 129 | ;; =========== | 96 | ;; =========== |
| @@ -488,7 +455,7 @@ completely fit)." | |||
| 488 | :type 'integer | 455 | :type 'integer |
| 489 | :group 'tumme) | 456 | :group 'tumme) |
| 490 | 457 | ||
| 491 | (defcustom tumme-track-movement nil | 458 | (defcustom tumme-track-movement t |
| 492 | "The current state of the tracking and mirroring. | 459 | "The current state of the tracking and mirroring. |
| 493 | For more information, see the documentation for | 460 | For more information, see the documentation for |
| 494 | `tumme-toggle-movement-tracking'." | 461 | `tumme-toggle-movement-tracking'." |
| @@ -541,13 +508,13 @@ Used by `tumme-copy-with-exif-file-name'." | |||
| 541 | :group 'tumme) | 508 | :group 'tumme) |
| 542 | 509 | ||
| 543 | (defcustom tumme-show-all-from-dir-max-files 50 | 510 | (defcustom tumme-show-all-from-dir-max-files 50 |
| 544 | "*Maximum number of files to show using`tumme-show-all-from-dir'. | 511 | "*Maximum number of files to show using `tumme-show-all-from-dir'. |
| 545 | before warning the user." | 512 | before warning the user." |
| 546 | :type 'integer | 513 | :type 'integer |
| 547 | :group 'tumme) | 514 | :group 'tumme) |
| 548 | 515 | ||
| 549 | (defun tumme-dir () | 516 | (defun tumme-dir () |
| 550 | "Return the current thumbnails directory (from `tumme-dir'). | 517 | "Return the current thumbnails directory (from variable `tumme-dir'). |
| 551 | Create the thumbnails directory if it does not exist." | 518 | Create the thumbnails directory if it does not exist." |
| 552 | (let ((tumme-dir (file-name-as-directory | 519 | (let ((tumme-dir (file-name-as-directory |
| 553 | (expand-file-name tumme-dir)))) | 520 | (expand-file-name tumme-dir)))) |
| @@ -701,7 +668,7 @@ Otherwise, delete overlays." | |||
| 701 | (interactive) | 668 | (interactive) |
| 702 | (dired-next-line 1) | 669 | (dired-next-line 1) |
| 703 | (tumme-display-thumbs | 670 | (tumme-display-thumbs |
| 704 | t (or tumme-append-when-browsing nil)) | 671 | t (or tumme-append-when-browsing nil) t) |
| 705 | (if tumme-dired-disp-props | 672 | (if tumme-dired-disp-props |
| 706 | (tumme-dired-display-properties))) | 673 | (tumme-dired-display-properties))) |
| 707 | 674 | ||
| @@ -710,7 +677,7 @@ Otherwise, delete overlays." | |||
| 710 | (interactive) | 677 | (interactive) |
| 711 | (dired-previous-line 1) | 678 | (dired-previous-line 1) |
| 712 | (tumme-display-thumbs | 679 | (tumme-display-thumbs |
| 713 | t (or tumme-append-when-browsing nil)) | 680 | t (or tumme-append-when-browsing nil) t) |
| 714 | (if tumme-dired-disp-props | 681 | (if tumme-dired-disp-props |
| 715 | (tumme-dired-display-properties))) | 682 | (tumme-dired-display-properties))) |
| 716 | 683 | ||
| @@ -729,7 +696,7 @@ Otherwise, delete overlays." | |||
| 729 | (interactive) | 696 | (interactive) |
| 730 | (dired-mark 1) | 697 | (dired-mark 1) |
| 731 | (tumme-display-thumbs | 698 | (tumme-display-thumbs |
| 732 | t (or tumme-append-when-browsing nil)) | 699 | t (or tumme-append-when-browsing nil) t) |
| 733 | (if tumme-dired-disp-props | 700 | (if tumme-dired-disp-props |
| 734 | (tumme-dired-display-properties))) | 701 | (tumme-dired-display-properties))) |
| 735 | 702 | ||
| @@ -818,7 +785,7 @@ Restore any changes to the window configuration made by calling | |||
| 818 | (message "No saved window configuration"))) | 785 | (message "No saved window configuration"))) |
| 819 | 786 | ||
| 820 | ;;;###autoload | 787 | ;;;###autoload |
| 821 | (defun tumme-display-thumbs (&optional arg append) | 788 | (defun tumme-display-thumbs (&optional arg append do-not-pop) |
| 822 | "Display thumbnails of all marked files, in `tumme-thumbnail-buffer'. | 789 | "Display thumbnails of all marked files, in `tumme-thumbnail-buffer'. |
| 823 | If a thumbnail image does not exist for a file, it is created on the | 790 | If a thumbnail image does not exist for a file, it is created on the |
| 824 | fly. With prefix argument ARG, display only thumbnail for file at | 791 | fly. With prefix argument ARG, display only thumbnail for file at |
| @@ -830,7 +797,14 @@ you have the dired buffer in the left window and the | |||
| 830 | `tumme-thumbnail-buffer' buffer in the right window. | 797 | `tumme-thumbnail-buffer' buffer in the right window. |
| 831 | 798 | ||
| 832 | With optional argument APPEND, append thumbnail to thumbnail buffer | 799 | With optional argument APPEND, append thumbnail to thumbnail buffer |
| 833 | instead of erasing it first." | 800 | instead of erasing it first. |
| 801 | |||
| 802 | Option argument DO-NOT-POP controls if `pop-to-buffer' should be | ||
| 803 | used or not. If non-nil, use `display-buffer' instead of | ||
| 804 | `pop-to-buffer'. This is used from functions like | ||
| 805 | `tumme-next-line-and-display' and | ||
| 806 | `tumme-previous-line-and-display' where we do not want the | ||
| 807 | thumbnail buffer to be selected." | ||
| 834 | (interactive "P") | 808 | (interactive "P") |
| 835 | (let ((buf (tumme-create-thumbnail-buffer)) | 809 | (let ((buf (tumme-create-thumbnail-buffer)) |
| 836 | curr-file thumb-name files count dired-buf beg) | 810 | curr-file thumb-name files count dired-buf beg) |
| @@ -862,8 +836,11 @@ instead of erasing it first." | |||
| 862 | nil) | 836 | nil) |
| 863 | (t | 837 | (t |
| 864 | (tumme-line-up-dynamic)))) | 838 | (tumme-line-up-dynamic)))) |
| 865 | (pop-to-buffer tumme-thumbnail-buffer))) | 839 | (if do-not-pop |
| 840 | (display-buffer tumme-thumbnail-buffer) | ||
| 841 | (pop-to-buffer tumme-thumbnail-buffer)))) | ||
| 866 | 842 | ||
| 843 | ;;;###autoload | ||
| 867 | (defun tumme-show-all-from-dir (dir) | 844 | (defun tumme-show-all-from-dir (dir) |
| 868 | "Make a preview buffer for all images in DIR and display it. | 845 | "Make a preview buffer for all images in DIR and display it. |
| 869 | If the number of files in DIR matching `image-file-name-regexp' | 846 | If the number of files in DIR matching `image-file-name-regexp' |
| @@ -905,10 +882,9 @@ displayed." | |||
| 905 | (end-of-line) | 882 | (end-of-line) |
| 906 | (setq end (point)) | 883 | (setq end (point)) |
| 907 | (beginning-of-line) | 884 | (beginning-of-line) |
| 908 | (if (not (search-forward (format ";%s" tag) end t)) | 885 | (when (not (search-forward (format ";%s" tag) end t)) |
| 909 | (progn | 886 | (end-of-line) |
| 910 | (end-of-line) | 887 | (insert (format ";%s" tag)))) |
| 911 | (insert (format ";%s" tag))))) | ||
| 912 | (goto-char (point-max)) | 888 | (goto-char (point-max)) |
| 913 | (insert (format "\n%s;%s" file tag)))) | 889 | (insert (format "\n%s;%s" file tag)))) |
| 914 | files) | 890 | files) |
| @@ -927,27 +903,24 @@ displayed." | |||
| 927 | (mapcar | 903 | (mapcar |
| 928 | (lambda (file) | 904 | (lambda (file) |
| 929 | (goto-char (point-min)) | 905 | (goto-char (point-min)) |
| 930 | (if (search-forward-regexp | 906 | (when (search-forward-regexp |
| 931 | (format "^%s" file) nil t) | 907 | (format "^%s" file) nil t) |
| 932 | (progn | 908 | (end-of-line) |
| 933 | (end-of-line) | 909 | (setq end (point)) |
| 934 | (setq end (point)) | 910 | (beginning-of-line) |
| 935 | (beginning-of-line) | 911 | (when (search-forward-regexp (format "\\(;%s\\)" tag) end t) |
| 936 | (if (search-forward-regexp (format "\\(;%s\\)" tag) end t) | 912 | (delete-region (match-beginning 1) (match-end 1)) |
| 937 | (progn | 913 | ;; Check if file should still be in the database. If |
| 938 | (delete-region (match-beginning 1) (match-end 1)) | 914 | ;; it has no tags or comments, it will be removed. |
| 939 | ;; Check if file should still be in the database. If | 915 | (end-of-line) |
| 940 | ;; it has no tags or comments, it will be removed. | 916 | (setq end (point)) |
| 941 | (end-of-line) | 917 | (beginning-of-line) |
| 942 | (setq end (point)) | 918 | (when (not (search-forward ";" end t)) |
| 943 | (beginning-of-line) | 919 | (kill-line 1) |
| 944 | (if (not (search-forward ";" end t)) | 920 | ;; If on empty line at end of buffer |
| 945 | (progn | 921 | (when (and (eobp) |
| 946 | (kill-line 1) | 922 | (looking-at "^$")) |
| 947 | ;; If on empty line at end of buffer | 923 | (delete-backward-char 1)))))) |
| 948 | (if (and (eobp) | ||
| 949 | (looking-at "^$")) | ||
| 950 | (delete-backward-char 1))))))))) | ||
| 951 | files) | 924 | files) |
| 952 | (save-buffer) | 925 | (save-buffer) |
| 953 | (kill-buffer buf)))) | 926 | (kill-buffer buf)))) |
| @@ -958,17 +931,16 @@ displayed." | |||
| 958 | (let (end buf (tags "")) | 931 | (let (end buf (tags "")) |
| 959 | (setq buf (find-file tumme-db-file)) | 932 | (setq buf (find-file tumme-db-file)) |
| 960 | (goto-char (point-min)) | 933 | (goto-char (point-min)) |
| 961 | (if (search-forward-regexp | 934 | (when (search-forward-regexp |
| 962 | (format "^%s" file) nil t) | 935 | (format "^%s" file) nil t) |
| 963 | (progn | 936 | (end-of-line) |
| 964 | (end-of-line) | 937 | (setq end (point)) |
| 965 | (setq end (point)) | 938 | (beginning-of-line) |
| 966 | (beginning-of-line) | 939 | (if (search-forward ";" end t) |
| 967 | (if (search-forward ";" end t) | 940 | (if (search-forward "comment:" end t) |
| 968 | (if (search-forward "comment:" end t) | 941 | (if (search-forward ";" end t) |
| 969 | (if (search-forward ";" end t) | 942 | (setq tags (buffer-substring (point) end))) |
| 970 | (setq tags (buffer-substring (point) end))) | 943 | (setq tags (buffer-substring (point) end))))) |
| 971 | (setq tags (buffer-substring (point) end)))))) | ||
| 972 | (kill-buffer buf) | 944 | (kill-buffer buf) |
| 973 | (split-string tags ";")))) | 945 | (split-string tags ";")))) |
| 974 | 946 | ||
| @@ -992,7 +964,7 @@ displayed." | |||
| 992 | 'tags (tumme-list-tags (tumme-original-file-name)))) | 964 | 'tags (tumme-list-tags (tumme-original-file-name)))) |
| 993 | 965 | ||
| 994 | ;;;###autoload | 966 | ;;;###autoload |
| 995 | (defun tumme-tag-remove (arg) | 967 | (defun tumme-delete-tag (arg) |
| 996 | "Remove tag for selected file(s). | 968 | "Remove tag for selected file(s). |
| 997 | With prefix argument ARG, remove tag from file at point." | 969 | With prefix argument ARG, remove tag from file at point." |
| 998 | (interactive "P") | 970 | (interactive "P") |
| @@ -1034,17 +1006,16 @@ use only useful if `tumme-track-movement' is nil." | |||
| 1034 | (let ((old-buf (current-buffer)) | 1006 | (let ((old-buf (current-buffer)) |
| 1035 | (dired-buf (tumme-associated-dired-buffer)) | 1007 | (dired-buf (tumme-associated-dired-buffer)) |
| 1036 | (file-name (tumme-original-file-name))) | 1008 | (file-name (tumme-original-file-name))) |
| 1037 | (if (and dired-buf file-name) | 1009 | (when (and dired-buf file-name) |
| 1038 | (progn | 1010 | (setq file-name (file-name-nondirectory file-name)) |
| 1039 | (setq file-name (file-name-nondirectory file-name)) | 1011 | (set-buffer dired-buf) |
| 1040 | (set-buffer dired-buf) | 1012 | (goto-char (point-min)) |
| 1041 | (goto-char (point-min)) | 1013 | (if (not (search-forward file-name nil t)) |
| 1042 | (if (not (search-forward file-name nil t)) | 1014 | (message "Could not track file") |
| 1043 | (message "Could not track file") | 1015 | (dired-move-to-filename) |
| 1044 | (dired-move-to-filename) | 1016 | (set-window-point |
| 1045 | (set-window-point | 1017 | (tumme-get-buffer-window dired-buf) (point))) |
| 1046 | (tumme-get-buffer-window dired-buf) (point))) | 1018 | (set-buffer old-buf)))) |
| 1047 | (set-buffer old-buf))))) | ||
| 1048 | 1019 | ||
| 1049 | (defun tumme-toggle-movement-tracking () | 1020 | (defun tumme-toggle-movement-tracking () |
| 1050 | "Turn on and off `tumme-track-movement'. | 1021 | "Turn on and off `tumme-track-movement'. |
| @@ -1063,24 +1034,22 @@ the other way around." | |||
| 1063 | (let ((file (dired-get-filename)) | 1034 | (let ((file (dired-get-filename)) |
| 1064 | (old-buf (current-buffer)) | 1035 | (old-buf (current-buffer)) |
| 1065 | prop-val found) | 1036 | prop-val found) |
| 1066 | (if (get-buffer tumme-thumbnail-buffer) | 1037 | (when (get-buffer tumme-thumbnail-buffer) |
| 1067 | (progn | 1038 | (set-buffer tumme-thumbnail-buffer) |
| 1068 | (set-buffer tumme-thumbnail-buffer) | 1039 | (goto-char (point-min)) |
| 1069 | (goto-char (point-min)) | 1040 | (while (and (not (eobp)) |
| 1070 | (while (and (not (eobp)) | 1041 | (not found)) |
| 1071 | (not found)) | 1042 | (if (and (setq prop-val |
| 1072 | (if (and (setq prop-val | 1043 | (get-text-property (point) 'original-file-name)) |
| 1073 | (get-text-property (point) 'original-file-name)) | 1044 | (string= prop-val file)) |
| 1074 | (string= prop-val file)) | 1045 | (setq found t)) |
| 1075 | (setq found t)) | 1046 | (if (not found) |
| 1076 | (if (not found) | 1047 | (forward-char 1))) |
| 1077 | (forward-char 1))) | 1048 | (when found |
| 1078 | (if found | 1049 | (set-window-point |
| 1079 | (progn | 1050 | (tumme-thumbnail-window) (point)) |
| 1080 | (set-window-point | 1051 | (tumme-display-thumb-properties)) |
| 1081 | (tumme-thumbnail-window) (point)) | 1052 | (set-buffer old-buf)))) |
| 1082 | (tumme-display-thumb-properties))) | ||
| 1083 | (set-buffer old-buf))))) | ||
| 1084 | 1053 | ||
| 1085 | (defun tumme-dired-next-line (&optional arg) | 1054 | (defun tumme-dired-next-line (&optional arg) |
| 1086 | "Call `dired-next-line', then track thumbnail. | 1055 | "Call `dired-next-line', then track thumbnail. |
| @@ -1105,29 +1074,27 @@ move ARG lines." | |||
| 1105 | (interactive) | 1074 | (interactive) |
| 1106 | ;; Before we move, make sure that there is an image two positions | 1075 | ;; Before we move, make sure that there is an image two positions |
| 1107 | ;; forward. | 1076 | ;; forward. |
| 1108 | (if (save-excursion | 1077 | (when (save-excursion |
| 1109 | (forward-char 2) | 1078 | (forward-char 2) |
| 1110 | (tumme-image-at-point-p)) | 1079 | (tumme-image-at-point-p)) |
| 1111 | (progn | 1080 | (forward-char) |
| 1112 | (forward-char) | 1081 | (while (and (not (eobp)) |
| 1113 | (while (and (not (eobp)) | 1082 | (not (tumme-image-at-point-p))) |
| 1114 | (not (tumme-image-at-point-p))) | 1083 | (forward-char)) |
| 1115 | (forward-char)) | 1084 | (if tumme-track-movement |
| 1116 | (if tumme-track-movement | 1085 | (tumme-track-original-file))) |
| 1117 | (tumme-track-original-file)))) | ||
| 1118 | (tumme-display-thumb-properties)) | 1086 | (tumme-display-thumb-properties)) |
| 1119 | 1087 | ||
| 1120 | (defun tumme-backward-char () | 1088 | (defun tumme-backward-char () |
| 1121 | "Move to previous image and display properties." | 1089 | "Move to previous image and display properties." |
| 1122 | (interactive) | 1090 | (interactive) |
| 1123 | (if (not (bobp)) | 1091 | (when (not (bobp)) |
| 1124 | (progn | 1092 | (backward-char) |
| 1125 | (backward-char) | 1093 | (while (and (not (bobp)) |
| 1126 | (while (and (not (bobp)) | 1094 | (not (tumme-image-at-point-p))) |
| 1127 | (not (tumme-image-at-point-p))) | 1095 | (backward-char)) |
| 1128 | (backward-char)) | 1096 | (if tumme-track-movement |
| 1129 | (if tumme-track-movement | 1097 | (tumme-track-original-file))) |
| 1130 | (tumme-track-original-file)))) | ||
| 1131 | (tumme-display-thumb-properties)) | 1098 | (tumme-display-thumb-properties)) |
| 1132 | 1099 | ||
| 1133 | (defun tumme-next-line () | 1100 | (defun tumme-next-line () |
| @@ -1515,9 +1482,9 @@ Note that n, p and <down> and <up> will be hijacked and bound to | |||
| 1515 | 1482 | ||
| 1516 | (define-key dired-mode-map "\C-td" 'tumme-display-thumbs) | 1483 | (define-key dired-mode-map "\C-td" 'tumme-display-thumbs) |
| 1517 | (define-key dired-mode-map "\C-tt" 'tumme-tag-files) | 1484 | (define-key dired-mode-map "\C-tt" 'tumme-tag-files) |
| 1518 | (define-key dired-mode-map "\C-tr" 'tumme-tag-remove) | 1485 | (define-key dired-mode-map "\C-tr" 'tumme-delete-tag) |
| 1519 | (define-key dired-mode-map [tab] 'tumme-jump-thumbnail-buffer) | 1486 | (define-key dired-mode-map [tab] 'tumme-jump-thumbnail-buffer) |
| 1520 | (define-key dired-mode-map "\C-ti" 'tumme-display-dired-image) | 1487 | (define-key dired-mode-map "\C-ti" 'tumme-dired-display-image) |
| 1521 | (define-key dired-mode-map "\C-tx" 'tumme-dired-display-external) | 1488 | (define-key dired-mode-map "\C-tx" 'tumme-dired-display-external) |
| 1522 | (define-key dired-mode-map "\C-ta" 'tumme-display-thumbs-append) | 1489 | (define-key dired-mode-map "\C-ta" 'tumme-display-thumbs-append) |
| 1523 | (define-key dired-mode-map "\C-t." 'tumme-display-thumb) | 1490 | (define-key dired-mode-map "\C-t." 'tumme-display-thumb) |
| @@ -1537,8 +1504,8 @@ Note that n, p and <down> and <up> will be hijacked and bound to | |||
| 1537 | (define-key dired-mode-map [menu-bar tumme tumme-mark-tagged-files] | 1504 | (define-key dired-mode-map [menu-bar tumme tumme-mark-tagged-files] |
| 1538 | '("Mark tagged files" . tumme-mark-tagged-files)) | 1505 | '("Mark tagged files" . tumme-mark-tagged-files)) |
| 1539 | 1506 | ||
| 1540 | (define-key dired-mode-map [menu-bar tumme tumme-tag-remove] | 1507 | (define-key dired-mode-map [menu-bar tumme tumme-delete-tag] |
| 1541 | '("Remove tag from files" . tumme-tag-remove)) | 1508 | '("Remove tag from files" . tumme-delete-tag)) |
| 1542 | 1509 | ||
| 1543 | (define-key dired-mode-map [menu-bar tumme tumme-tag-files] | 1510 | (define-key dired-mode-map [menu-bar tumme tumme-tag-files] |
| 1544 | '("Tag files" . tumme-tag-files)) | 1511 | '("Tag files" . tumme-tag-files)) |
| @@ -1561,8 +1528,8 @@ Note that n, p and <down> and <up> will be hijacked and bound to | |||
| 1561 | [menu-bar tumme tumme-dired-display-external] | 1528 | [menu-bar tumme tumme-dired-display-external] |
| 1562 | '("Display in external viewer" . tumme-dired-display-external)) | 1529 | '("Display in external viewer" . tumme-dired-display-external)) |
| 1563 | (define-key dired-mode-map | 1530 | (define-key dired-mode-map |
| 1564 | [menu-bar tumme tumme-display-dired-image] | 1531 | [menu-bar tumme tumme-dired-display-image] |
| 1565 | '("Display image" . tumme-display-dired-image)) | 1532 | '("Display image" . tumme-dired-display-image)) |
| 1566 | (define-key dired-mode-map | 1533 | (define-key dired-mode-map |
| 1567 | [menu-bar tumme tumme-display-thumb] | 1534 | [menu-bar tumme tumme-display-thumb] |
| 1568 | '("Display this thumbnail" . tumme-display-thumb)) | 1535 | '("Display this thumbnail" . tumme-display-thumb)) |
| @@ -1658,13 +1625,13 @@ Ask user for number of images to show and the delay in between." | |||
| 1658 | (defun tumme-display-thumbs-append () | 1625 | (defun tumme-display-thumbs-append () |
| 1659 | "Append thumbnails to `tumme-thumbnail-buffer'." | 1626 | "Append thumbnails to `tumme-thumbnail-buffer'." |
| 1660 | (interactive) | 1627 | (interactive) |
| 1661 | (tumme-display-thumbs nil t)) | 1628 | (tumme-display-thumbs nil t t)) |
| 1662 | 1629 | ||
| 1663 | ;;;###autoload | 1630 | ;;;###autoload |
| 1664 | (defun tumme-display-thumb () | 1631 | (defun tumme-display-thumb () |
| 1665 | "Shorthard for `tumme-display-thumbs' with prefix argument." | 1632 | "Shorthard for `tumme-display-thumbs' with prefix argument." |
| 1666 | (interactive) | 1633 | (interactive) |
| 1667 | (tumme-display-thumbs t)) | 1634 | (tumme-display-thumbs t nil t)) |
| 1668 | 1635 | ||
| 1669 | (defun tumme-line-up () | 1636 | (defun tumme-line-up () |
| 1670 | "Line up thumbnails according to `tumme-thumbs-per-row'. | 1637 | "Line up thumbnails according to `tumme-thumbs-per-row'. |
| @@ -1688,11 +1655,10 @@ See also `tumme-line-up-dynamic'." | |||
| 1688 | (insert "\n") | 1655 | (insert "\n") |
| 1689 | (insert " ") | 1656 | (insert " ") |
| 1690 | (setq count (1+ count)) | 1657 | (setq count (1+ count)) |
| 1691 | (if (= count (- tumme-thumbs-per-row 1)) | 1658 | (when (= count (- tumme-thumbs-per-row 1)) |
| 1692 | (progn | 1659 | (forward-char) |
| 1693 | (forward-char) | 1660 | (insert "\n") |
| 1694 | (insert "\n") | 1661 | (setq count 0))))) |
| 1695 | (setq count 0)))))) | ||
| 1696 | (goto-char (point-min)))) | 1662 | (goto-char (point-min)))) |
| 1697 | 1663 | ||
| 1698 | (defun tumme-line-up-dynamic () | 1664 | (defun tumme-line-up-dynamic () |
| @@ -1786,13 +1752,11 @@ Ask user how many thumbnails should be displayed per row." | |||
| 1786 | 1752 | ||
| 1787 | (defun tumme-display-image (file &optional original-size) | 1753 | (defun tumme-display-image (file &optional original-size) |
| 1788 | "Display image FILE in image buffer. | 1754 | "Display image FILE in image buffer. |
| 1789 | Use this when you want to display the image, semi sized, in a window | 1755 | Use this when you want to display the image, semi sized, in a new |
| 1790 | next to the thumbnail window - typically a three-window configuration | 1756 | window. The image is sized to fit the display window (using a |
| 1791 | with dired to the left, thumbnail window to the upper right and image | 1757 | temporary file, don't worry). Because of this, it will not be as |
| 1792 | window to the lower right. The image is sized to fit the display | 1758 | quick as opening it directly, but on most modern systems it |
| 1793 | window (using a temporary file, don't worry). Because of this, it | 1759 | should feel snappy enough. |
| 1794 | will not be as quick as opening it directly, but on most modern | ||
| 1795 | systems it should feel snappy enough. | ||
| 1796 | 1760 | ||
| 1797 | If optional argument ORIGINAL-SIZE is non-nil, display image in its | 1761 | If optional argument ORIGINAL-SIZE is non-nil, display image in its |
| 1798 | original size." | 1762 | original size." |
| @@ -1841,12 +1805,13 @@ With prefix argument ARG, display image in its original size." | |||
| 1841 | (display-buffer tumme-display-image-buffer)))))) | 1805 | (display-buffer tumme-display-image-buffer)))))) |
| 1842 | 1806 | ||
| 1843 | ;;;###autoload | 1807 | ;;;###autoload |
| 1844 | (defun tumme-display-dired-image (&optional arg) | 1808 | (defun tumme-dired-display-image (&optional arg) |
| 1845 | "Display current image file. | 1809 | "Display current image file. |
| 1846 | See documentation for `tumme-display-image' for more information. | 1810 | See documentation for `tumme-display-image' for more information. |
| 1847 | With prefix argument ARG, display image in its original size." | 1811 | With prefix argument ARG, display image in its original size." |
| 1848 | (interactive "P") | 1812 | (interactive "P") |
| 1849 | (tumme-display-image (dired-get-filename) arg)) | 1813 | (tumme-display-image (dired-get-filename) arg) |
| 1814 | (display-buffer tumme-display-image-buffer)) | ||
| 1850 | 1815 | ||
| 1851 | (defun tumme-image-at-point-p () | 1816 | (defun tumme-image-at-point-p () |
| 1852 | "Return true if there is a tumme thumbnail at point." | 1817 | "Return true if there is a tumme thumbnail at point." |
| @@ -2122,19 +2087,18 @@ as initial value." | |||
| 2122 | (let (end buf comment-beg comment (base-name (file-name-nondirectory file))) | 2087 | (let (end buf comment-beg comment (base-name (file-name-nondirectory file))) |
| 2123 | (setq buf (find-file tumme-db-file)) | 2088 | (setq buf (find-file tumme-db-file)) |
| 2124 | (goto-char (point-min)) | 2089 | (goto-char (point-min)) |
| 2125 | (if (search-forward-regexp | 2090 | (when (search-forward-regexp |
| 2126 | (format "^%s" base-name) nil t) | 2091 | (format "^%s" base-name) nil t) |
| 2127 | (progn | 2092 | (end-of-line) |
| 2128 | (end-of-line) | 2093 | (setq end (point)) |
| 2129 | (setq end (point)) | 2094 | (beginning-of-line) |
| 2130 | (beginning-of-line) | 2095 | (cond ((search-forward ";comment:" end t) |
| 2131 | (cond ((search-forward ";comment:" end t) | 2096 | (setq comment-beg (point)) |
| 2132 | (setq comment-beg (point)) | 2097 | (if (search-forward ";" end t) |
| 2133 | (if (search-forward ";" end t) | 2098 | (setq comment-end (- (point) 1)) |
| 2134 | (setq comment-end (- (point) 1)) | 2099 | (setq comment-end end)) |
| 2135 | (setq comment-end end)) | 2100 | (setq comment (buffer-substring |
| 2136 | (setq comment (buffer-substring | 2101 | comment-beg comment-end))))) |
| 2137 | comment-beg comment-end)))))) | ||
| 2138 | (kill-buffer buf) | 2102 | (kill-buffer buf) |
| 2139 | comment))) | 2103 | comment))) |
| 2140 | 2104 | ||
diff --git a/lisp/vc.el b/lisp/vc.el index 61b8aa05a4b..54237800e3c 100644 --- a/lisp/vc.el +++ b/lisp/vc.el | |||
| @@ -894,10 +894,12 @@ However, before executing BODY, find FILE, and after BODY, save buffer." | |||
| 894 | 894 | ||
| 895 | (defun vc-process-filter (p s) | 895 | (defun vc-process-filter (p s) |
| 896 | "An alternative output filter for async process P. | 896 | "An alternative output filter for async process P. |
| 897 | The only difference with the default filter is to insert S after markers." | 897 | One difference with the default filter is that this inserts S after markers. |
| 898 | Another is that undo information is not kept." | ||
| 898 | (with-current-buffer (process-buffer p) | 899 | (with-current-buffer (process-buffer p) |
| 899 | (save-excursion | 900 | (save-excursion |
| 900 | (let ((inhibit-read-only t)) | 901 | (let ((buffer-undo-list t) |
| 902 | (inhibit-read-only t)) | ||
| 901 | (goto-char (process-mark p)) | 903 | (goto-char (process-mark p)) |
| 902 | (insert s) | 904 | (insert s) |
| 903 | (set-marker (process-mark p) (point)))))) | 905 | (set-marker (process-mark p) (point)))))) |
| @@ -914,7 +916,8 @@ BUF defaults to \"*vc*\", can be a string and will be created if necessary." | |||
| 914 | (set (make-local-variable 'vc-parent-buffer-name) | 916 | (set (make-local-variable 'vc-parent-buffer-name) |
| 915 | (concat " from " (buffer-name camefrom))) | 917 | (concat " from " (buffer-name camefrom))) |
| 916 | (setq default-directory olddir) | 918 | (setq default-directory olddir) |
| 917 | (let ((inhibit-read-only t)) | 919 | (let ((buffer-undo-list t) |
| 920 | (inhibit-read-only t)) | ||
| 918 | (erase-buffer)))) | 921 | (erase-buffer)))) |
| 919 | 922 | ||
| 920 | (defun vc-exec-after (code) | 923 | (defun vc-exec-after (code) |
| @@ -1003,7 +1006,8 @@ that is inserted into the command line before the filename." | |||
| 1003 | (vc-exec-after | 1006 | (vc-exec-after |
| 1004 | `(unless (active-minibuffer-window) | 1007 | `(unless (active-minibuffer-window) |
| 1005 | (message "Running %s in the background... done" ',command)))) | 1008 | (message "Running %s in the background... done" ',command)))) |
| 1006 | (setq status (apply 'process-file command nil t nil squeezed)) | 1009 | (let ((buffer-undo-list t)) |
| 1010 | (setq status (apply 'process-file command nil t nil squeezed))) | ||
| 1007 | (when (and (not (eq t okstatus)) | 1011 | (when (and (not (eq t okstatus)) |
| 1008 | (or (not (integerp status)) | 1012 | (or (not (integerp status)) |
| 1009 | (and okstatus (< okstatus status)))) | 1013 | (and okstatus (< okstatus status)))) |
diff --git a/lisp/whitespace.el b/lisp/whitespace.el index 7f3cbd913ca..449606607f6 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el | |||
| @@ -430,7 +430,7 @@ and: | |||
| 430 | (if buffer-read-only | 430 | (if buffer-read-only |
| 431 | (if (not quiet) | 431 | (if (not quiet) |
| 432 | (message "Can't cleanup: %s is read-only" (buffer-name))) | 432 | (message "Can't cleanup: %s is read-only" (buffer-name))) |
| 433 | (whitespace-cleanup)) | 433 | (whitespace-cleanup-internal)) |
| 434 | (let ((whitespace-leading (if whitespace-check-buffer-leading | 434 | (let ((whitespace-leading (if whitespace-check-buffer-leading |
| 435 | (whitespace-buffer-leading) | 435 | (whitespace-buffer-leading) |
| 436 | nil)) | 436 | nil)) |
| @@ -520,6 +520,11 @@ and: | |||
| 520 | "Cleanup the five different kinds of whitespace problems. | 520 | "Cleanup the five different kinds of whitespace problems. |
| 521 | See `whitespace-buffer' docstring for a summary of the problems." | 521 | See `whitespace-buffer' docstring for a summary of the problems." |
| 522 | (interactive) | 522 | (interactive) |
| 523 | (if (and transient-mark-mode mark-active) | ||
| 524 | (whitespace-cleanup-region (region-beginning) (region-end)) | ||
| 525 | (whitespace-cleanup-internal))) | ||
| 526 | |||
| 527 | (defun whitespace-cleanup-internal () | ||
| 523 | ;; If this buffer really contains a file, then run, else quit. | 528 | ;; If this buffer really contains a file, then run, else quit. |
| 524 | (whitespace-check-whitespace-mode current-prefix-arg) | 529 | (whitespace-check-whitespace-mode current-prefix-arg) |
| 525 | (if (and buffer-file-name whitespace-mode) | 530 | (if (and buffer-file-name whitespace-mode) |
| @@ -563,7 +568,7 @@ See `whitespace-buffer' docstring for a summary of the problems." | |||
| 563 | 568 | ||
| 564 | ;; Call this recursively till everything is taken care of | 569 | ;; Call this recursively till everything is taken care of |
| 565 | (if whitespace-any | 570 | (if whitespace-any |
| 566 | (whitespace-cleanup) | 571 | (whitespace-cleanup-internal) |
| 567 | (progn | 572 | (progn |
| 568 | (if (not whitespace-silent) | 573 | (if (not whitespace-silent) |
| 569 | (message "%s clean" buffer-file-name)) | 574 | (message "%s clean" buffer-file-name)) |
| @@ -577,7 +582,7 @@ See `whitespace-buffer' docstring for a summary of the problems." | |||
| 577 | (save-excursion | 582 | (save-excursion |
| 578 | (save-restriction | 583 | (save-restriction |
| 579 | (narrow-to-region s e) | 584 | (narrow-to-region s e) |
| 580 | (whitespace-cleanup)) | 585 | (whitespace-cleanup-internal)) |
| 581 | (whitespace-buffer t))) | 586 | (whitespace-buffer t))) |
| 582 | 587 | ||
| 583 | (defun whitespace-buffer-leading () | 588 | (defun whitespace-buffer-leading () |
| @@ -760,7 +765,7 @@ If timer is not set, then set it to scan the files in | |||
| 760 | (if whitespace-auto-cleanup | 765 | (if whitespace-auto-cleanup |
| 761 | (progn | 766 | (progn |
| 762 | ;;(message "cleaning up whitespace in %s" bufname) | 767 | ;;(message "cleaning up whitespace in %s" bufname) |
| 763 | (whitespace-cleanup)) | 768 | (whitespace-cleanup-internal)) |
| 764 | (progn | 769 | (progn |
| 765 | ;;(message "whitespace-buffer %s." (buffer-name)) | 770 | ;;(message "whitespace-buffer %s." (buffer-name)) |
| 766 | (whitespace-buffer t)))) | 771 | (whitespace-buffer t)))) |
| @@ -806,7 +811,7 @@ This is meant to be added buffer-locally to `write-file-functions'." | |||
| 806 | (interactive) | 811 | (interactive) |
| 807 | (let ((werr nil)) | 812 | (let ((werr nil)) |
| 808 | (if whitespace-auto-cleanup | 813 | (if whitespace-auto-cleanup |
| 809 | (whitespace-cleanup) | 814 | (whitespace-cleanup-internal) |
| 810 | (setq werr (whitespace-buffer))) | 815 | (setq werr (whitespace-buffer))) |
| 811 | (if (and whitespace-abort-on-error werr) | 816 | (if (and whitespace-abort-on-error werr) |
| 812 | (error (concat "Abort write due to whitespaces in " | 817 | (error (concat "Abort write due to whitespaces in " |
diff --git a/lisp/window.el b/lisp/window.el index 4d02390be16..ef9dd5d896d 100644 --- a/lisp/window.el +++ b/lisp/window.el | |||
| @@ -597,7 +597,7 @@ in some window." | |||
| 597 | (1+ (vertical-motion (buffer-size) window)))))) | 597 | (1+ (vertical-motion (buffer-size) window)))))) |
| 598 | 598 | ||
| 599 | (defun fit-window-to-buffer (&optional window max-height min-height) | 599 | (defun fit-window-to-buffer (&optional window max-height min-height) |
| 600 | "Make WINDOW the right size to display its contents exactly. | 600 | "Make WINDOW the right height to display its contents exactly. |
| 601 | If WINDOW is omitted or nil, it defaults to the selected window. | 601 | If WINDOW is omitted or nil, it defaults to the selected window. |
| 602 | If the optional argument MAX-HEIGHT is supplied, it is the maximum height | 602 | If the optional argument MAX-HEIGHT is supplied, it is the maximum height |
| 603 | the window is allowed to be, defaulting to the frame height. | 603 | the window is allowed to be, defaulting to the frame height. |