diff options
| author | Miles Bader | 2007-10-19 00:00:21 +0000 |
|---|---|---|
| committer | Miles Bader | 2007-10-19 00:00:21 +0000 |
| commit | 9c8020a8df03dc67a56d7df15664dcf7ace54bf0 (patch) | |
| tree | 09b0646addff3c39f9e96ba89c04bdcc038a87a7 /lisp | |
| parent | dfc3268dfa133a2e0a677f1af7c1ee548eae065d (diff) | |
| parent | bd3164743080f3eb5fc316aca7cc5322ca58fe33 (diff) | |
| download | emacs-9c8020a8df03dc67a56d7df15664dcf7ace54bf0.tar.gz emacs-9c8020a8df03dc67a56d7df15664dcf7ace54bf0.zip | |
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 890-898)
- Update from CVS
- Merge from emacs--rel--22
* emacs--rel--22 (patch 122-128)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 257-258)
- Merge from emacs--rel--22
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-270
Diffstat (limited to 'lisp')
39 files changed, 1139 insertions, 702 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d3fde16c4fa..4fe538b3bd4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,269 @@ | |||
| 1 | 2007-10-18 Johan Bockg,Ae(Brd <bojohan@gnu.org> | ||
| 2 | |||
| 3 | * net/tramp.el (tramp-rfn-eshadow-update-overlay): Save excursion. | ||
| 4 | Use `save-restriction' rather than `widen'. | ||
| 5 | |||
| 6 | 2007-10-18 Richard Stallman <rms@gnu.org> | ||
| 7 | |||
| 8 | * time.el (display-time-world-time-format): Display day # not month #. | ||
| 9 | |||
| 10 | 2007-10-18 Reiner Steib <Reiner.Steib@gmx.de> | ||
| 11 | |||
| 12 | * files.el (auto-mode-alist): Don't use doc-view for PS and EPS. | ||
| 13 | |||
| 14 | * doc-view.el: Remove version keyword. | ||
| 15 | (doc-view-ghostscript-program, doc-view-dvipdfm-program) | ||
| 16 | (doc-view-ps2pdf-program): Use executable-find. Simplify custom type. | ||
| 17 | (doc-view-ghostscript-options): Improve custom type. | ||
| 18 | (doc-view-cache-directory, doc-view-conversion-buffer) | ||
| 19 | (doc-view-conversion-refresh-interval): Simplify custom type. | ||
| 20 | |||
| 21 | 2007-10-18 Tassilo Horn <tassilo@member.fsf.org> | ||
| 22 | |||
| 23 | * doc-view.el (doc-view-dvi->pdf-sentinel, doc-view-dvi->pdf) | ||
| 24 | (doc-view-pdf/ps->png-sentinel, doc-view-pdf/ps->png) | ||
| 25 | (doc-view-pdf->txt-sentinel, doc-view-pdf->txt) | ||
| 26 | (doc-view-ps->pdf-sentinel, doc-view-ps->pdf): Remove superfluous | ||
| 27 | messages. | ||
| 28 | (doc-view-mode-map): Use the image-mode scrolling commands. Don't | ||
| 29 | rebind C-x k. | ||
| 30 | |||
| 31 | 2007-10-18 Reiner Steib <Reiner.Steib@gmx.de> | ||
| 32 | |||
| 33 | * doc-view.el (doc-view-ghostscript-options, doc-view-ps->pdf): | ||
| 34 | Add comment about "-dSAFER". | ||
| 35 | |||
| 36 | 2007-10-18 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 37 | |||
| 38 | * term/xterm.el: Don't require xt-mouse. | ||
| 39 | (terminal-init-xterm): Run terminal-init-xterm-hook rather than | ||
| 40 | calling turn-on-xterm-mouse-tracking-on-terminal directly. | ||
| 41 | |||
| 42 | * xt-mouse.el: Don't change the global function-key-map anny more. | ||
| 43 | (xterm-mouse-mode): Use terminal-init-xterm-hook. | ||
| 44 | Don't use after-make-frame-functions now that term/xterm.el calls | ||
| 45 | us directly. | ||
| 46 | (turn-on-xterm-mouse-tracking, turn-off-xterm-mouse-tracking): | ||
| 47 | Use turn-*-xterm-mouse-tracking-on-terminal. Only once per terminal. | ||
| 48 | (turn-on-xterm-mouse-tracking-on-terminal): Make param optional. | ||
| 49 | Setup input-decode-map and remember that xterm-mouse-mode was | ||
| 50 | enabled in this terminal. | ||
| 51 | (turn-off-xterm-mouse-tracking-on-terminal): Only disable on those | ||
| 52 | terminals where it has been enabled. | ||
| 53 | |||
| 54 | * faces.el (tty-create-frame-with-faces): Make sure not only | ||
| 55 | tty-run-terminal-initialization but also set-locale-environment | ||
| 56 | are run only once per terminal. | ||
| 57 | (tty-run-terminal-initialization): Don't check if the terminal was | ||
| 58 | already initted. | ||
| 59 | |||
| 60 | * international/encoded-kb.el (encoded-kbd-setup-display): Be careful | ||
| 61 | not to remove keymaps that just happen to inherit from one of ours. | ||
| 62 | When setting up our keymap, make sure it won't be accidentally | ||
| 63 | modified by someone else. | ||
| 64 | |||
| 65 | 2007-10-18 Thien-Thi Nguyen <ttn@gnuvola.org> | ||
| 66 | |||
| 67 | * textmodes/artist.el (artist-previous-line, artist-next-line): | ||
| 68 | * dired.el (dired-next-line, dired-previous-line): | ||
| 69 | * progmodes/delphi.el (delphi-newline): | ||
| 70 | * textmodes/org.el (org-columns-eval): | ||
| 71 | Use forward-line. | ||
| 72 | |||
| 73 | * emerge.el (emerge-setup): Use insert-buffer-substring. | ||
| 74 | (emerge-prepare-error-list, emerge-setup-with-ancestor): Likewise. | ||
| 75 | |||
| 76 | 2007-10-18 Juanma Barranquero <lekktu@gmail.com> | ||
| 77 | |||
| 78 | * textmodes/fill.el (fill-individual-paragraphs): Doc fix. | ||
| 79 | (adaptive-fill-function): Doc fix. Remove * from docstring. | ||
| 80 | |||
| 81 | 2007-10-18 Tom Horsley <tom.horsley@att.net> | ||
| 82 | |||
| 83 | * simple.el (interprogram-paste-function): Doc fix. | ||
| 84 | (current-kill): Accept list of strings as well | ||
| 85 | as single string from `interprogram-paste-function'. | ||
| 86 | |||
| 87 | 2007-10-18 Glenn Morris <rgm@gnu.org> | ||
| 88 | |||
| 89 | * ibuf-ext.el (ibuffer-saved-filter-groups): Doc fix. | ||
| 90 | |||
| 91 | 2007-10-18 Drew Adams <drew.adams@oracle.com> | ||
| 92 | |||
| 93 | * bindings.el (mode-line-minor-mode-keymap): | ||
| 94 | Add mouse-minor-mode-menu on mouse-1. | ||
| 95 | (mode-line-modes): Add mouse-1 to help-echo text. | ||
| 96 | (mouse-minor-mode-menu, minor-mode-menu-from-indicator): | ||
| 97 | New functions. | ||
| 98 | (mode-line-minor-mode-help): Doc fix. | ||
| 99 | |||
| 100 | 2007-10-17 Juri Linkov <juri@jurta.org> | ||
| 101 | |||
| 102 | * textmodes/fill.el (fill-paragraph-or-region): Remove function | ||
| 103 | at the request of RMS. | ||
| 104 | (fill-paragraph): Change `arg' to optional `justify'. Add interactive | ||
| 105 | arg `region'. Fix docstring. At the first `or' branch add call to | ||
| 106 | `fill-region' if it the region is active in transient-mark-mode. | ||
| 107 | |||
| 108 | * bindings.el (esc-map): Bind M-q to fill-paragraph | ||
| 109 | instead of fill-paragraph-or-region. | ||
| 110 | |||
| 111 | * tutorial.el (tutorial--default-keys): Replace fill-paragraph-or-region | ||
| 112 | with fill-paragraph. | ||
| 113 | |||
| 114 | * textmodes/ispell.el (ispell-word): Add interactive arg `region'. | ||
| 115 | Fix docstring. | ||
| 116 | |||
| 117 | * indent.el (indent-for-tab-command): Change interactive spec from | ||
| 118 | "P" to "p". Add check for interactive arg before indenting the | ||
| 119 | active region. | ||
| 120 | |||
| 121 | * files.el (auto-mode-alist): Add \\. before PDF/PS/DVI extensions. | ||
| 122 | Regroup. | ||
| 123 | |||
| 124 | 2007-10-17 Juanma Barranquero <lekktu@gmail.com> | ||
| 125 | |||
| 126 | * emacs-lisp/find-func.el: Don't require loadhist. | ||
| 127 | |||
| 128 | * loadhist.el (feature-symbols, file-provides, file-requires) | ||
| 129 | (file-set-intersect, file-dependents): Simplify. | ||
| 130 | (unload-feature-special-hooks): Update list of special hooks. | ||
| 131 | |||
| 132 | 2007-10-17 Tassilo Horn <tassilo@member.fsf.org> | ||
| 133 | |||
| 134 | * bindings.el (completion-ignored-extensions): Remove pdf and dvi | ||
| 135 | extensions since they can be viewed with doc-view. | ||
| 136 | |||
| 137 | * files.el (auto-mode-alist): Make doc-view-mode the default mode | ||
| 138 | for pdf, ps and dvi files. | ||
| 139 | |||
| 140 | * doc-view.el: Make doc-view-mode the standard mode for viewing | ||
| 141 | pdf, [e]ps and dvi files and add binding C-c C-c to toggle between | ||
| 142 | text and image display. Add binding C-c C-e to switch to an | ||
| 143 | editing mode. | ||
| 144 | (doc-view-ghostscript-options, doc-view-ps->pdf): Add "-dSAFER" to | ||
| 145 | avoid security problems when rendering files from untrusted sources. | ||
| 146 | |||
| 147 | 2007-10-17 Aaron Hawley <aaronh@garden.org> | ||
| 148 | |||
| 149 | * tutorial.el (tutorial--save-tutorial): Display message when tutorial | ||
| 150 | position is not saved. | ||
| 151 | |||
| 152 | 2007-10-17 Reiner Steib <Reiner.Steib@gmx.de> | ||
| 153 | |||
| 154 | * doc-view.el: Mention xpdf. Fix spelling of Ghostscript. | ||
| 155 | (doc-view-ghostscript-options): Fix typo in doc string. | ||
| 156 | |||
| 157 | 2007-10-17 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 158 | |||
| 159 | * progmodes/compile.el (compilation-next-error-function): Fix timestamp | ||
| 160 | handling, so compilation-fake-loc works again. | ||
| 161 | |||
| 162 | * server.el (server-select-display): Nop if we do not support m-f-o-d. | ||
| 163 | (server-process-filter): Revert last change. | ||
| 164 | |||
| 165 | * vc.el (vc-diff-sentinel, vc-diff-internal): Revert some change in the | ||
| 166 | behavior unrelated to filesets. | ||
| 167 | |||
| 168 | 2007-10-17 Chong Yidong <cyd@stupidchicken.com> | ||
| 169 | |||
| 170 | * longlines.el (longlines-wrap-follows-window-size): Integer value | ||
| 171 | specifies wrapping margin. | ||
| 172 | (longlines-mode, longlines-window-change-function): | ||
| 173 | Set window-specific wrapping margin based on the above. | ||
| 174 | |||
| 175 | 2007-10-17 John Wiegley <johnw@newartisans.com> | ||
| 176 | |||
| 177 | * eshell/esh-cmd.el (eshell-complex-commands): Add "ls". | ||
| 178 | |||
| 179 | 2007-10-17 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 180 | |||
| 181 | * server.el (server-process-filter): Only set display if X11 is | ||
| 182 | supported. | ||
| 183 | |||
| 184 | 2007-10-17 Glenn Morris <rgm@gnu.org> | ||
| 185 | |||
| 186 | * progmodes/cc-menus.el (cc-imenu-c++-generic-expression): | ||
| 187 | Tweak regexp to avoid stack overflow. | ||
| 188 | |||
| 189 | 2007-10-16 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 190 | |||
| 191 | * simple.el (reindent-then-newline-and-indent): Don't assume that | ||
| 192 | indent-according-to-mode preserves point. | ||
| 193 | |||
| 194 | 2007-10-16 Juanma Barranquero <lekktu@gmail.com> | ||
| 195 | |||
| 196 | * bs.el (bs--make-header-match-string, bs-show-in-buffer) | ||
| 197 | (bs--nth-wrapper): Simplify. | ||
| 198 | (bs-select, bs--insert-one-entry): Simplify. Use `when'. | ||
| 199 | (bs-buffer-list): Simplify. Use `when'. Use `string-match-p'. | ||
| 200 | (bs-sort-buffer-interns-are-last): Use `string-match-p'. | ||
| 201 | (bs-attributes-list, bs-max-window-height, bs-must-always-show-regexp) | ||
| 202 | (bs-maximal-buffer-name-column, bs-minimal-buffer-name-column) | ||
| 203 | (bs-configurations, bs-default-configuration) | ||
| 204 | (bs-alternative-configuration, bs-cycle-configuration-name) | ||
| 205 | (bs-string-show-always, bs-string-show-never, bs-string-current) | ||
| 206 | (bs-string-current-marked, bs-string-marked, bs-string-show-normally) | ||
| 207 | (bs-sort-functions, bs-default-sort-name): Remove * in docstrings. | ||
| 208 | (bs--redisplay, bs--goto-current-buffer, bs--current-buffer, bs-delete) | ||
| 209 | (bs-apply-sort-faces, bs-next-config-aux): Use `when'. | ||
| 210 | (bs--window-config-coming-from): Revert 2006-11-09 change. | ||
| 211 | (bs--restore-window-config): Keep the selected frame. | ||
| 212 | (bs--track-window-changes, bs--remove-hooks): New functions. | ||
| 213 | (bs-mode): Use `define-derived-mode'. Set hook to track window changes. | ||
| 214 | (bs--create-header): Remove. | ||
| 215 | (bs--create-header-line): New function, based on `bs--create-header'. | ||
| 216 | (bs--show-header): Use `bs--create-header-line'. | ||
| 217 | (bs--show-with-configuration): Revert 2006-11-09 change. | ||
| 218 | Don't reuse window unless it is visible on the selected frame. | ||
| 219 | Restore window configuration (possibly in a different frame) | ||
| 220 | before creating any window. | ||
| 221 | |||
| 222 | 2007-10-16 Glenn Morris <rgm@gnu.org> | ||
| 223 | |||
| 224 | * simple.el (blink-matching-open): Don't report false errors with | ||
| 225 | the `$' syntax class. | ||
| 226 | |||
| 227 | 2007-10-16 Richard Stallman <rms@gnu.org> | ||
| 228 | |||
| 229 | * emacs-lisp/advice.el (ad-get-advice-info): Change to a function. | ||
| 230 | (ad-get-advice-info-macro): New macro, like old ad-get-advice-info. | ||
| 231 | (ad-is-advised, ad-get-advice-info-field) | ||
| 232 | (ad-set-advice-info-field): Use ad-get-advice-info-macro. | ||
| 233 | |||
| 234 | 2007-10-15 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 235 | |||
| 236 | * vc-hooks.el (vc-workfile-version): Compatibility alias. | ||
| 237 | (vc-default-working-revision): Compatibility for backends. | ||
| 238 | |||
| 239 | 2007-10-15 Juanma Barranquero <lekktu@gmail.com> | ||
| 240 | |||
| 241 | * filesets.el (filesets-alist-get): Use `let' rather than `let*'. | ||
| 242 | (filesets-ormap, filesets-sort-case-sensitive-flag) | ||
| 243 | (filesets-remake-shortcut, filesets-ingroup-collect-files): | ||
| 244 | Fix typos in docstrings. | ||
| 245 | (filesets-conditional-sort, filesets-find-or-display-file) | ||
| 246 | (filesets-data-get-name, filesets-data-get-data) | ||
| 247 | (filesets-data-set, filesets-cmd-query-replace-getargs) | ||
| 248 | (filesets-ingroup-collect): Doc fixes. | ||
| 249 | |||
| 250 | 2007-10-15 Sam Steingold <sds@gnu.org> | ||
| 251 | |||
| 252 | * mail/sendmail.el (sendmail-error-reporting-interactive) | ||
| 253 | (sendmail-error-reporting-non-interactive): New variables for | ||
| 254 | sendmail error reporting options to simplify support for imperfect | ||
| 255 | sendmail emulators. | ||
| 256 | (sendmail-send-it): Use them instead of list literals. | ||
| 257 | |||
| 258 | 2007-10-15 Juanma Barranquero <lekktu@gmail.com> | ||
| 259 | |||
| 260 | * help-fns.el: Revert previous change; it creates a | ||
| 261 | dependency loop between advice.el and help-fns.el. | ||
| 262 | |||
| 263 | 2007-10-15 Juanma Barranquero <lekktu@gmail.com> | ||
| 264 | |||
| 265 | * help-fns.el: Require advice when compiling. | ||
| 266 | |||
| 1 | 2007-10-14 Drew Adams <drew.adams@oracle.com> | 267 | 2007-10-14 Drew Adams <drew.adams@oracle.com> |
| 2 | 268 | ||
| 3 | * emacs-lisp/ring.el (ring-convert-sequence-to-ring) | 269 | * emacs-lisp/ring.el (ring-convert-sequence-to-ring) |
| @@ -99,8 +365,8 @@ | |||
| 99 | 365 | ||
| 100 | 2007-10-13 Dan Nicolaescu <dann@ics.uci.edu> | 366 | 2007-10-13 Dan Nicolaescu <dann@ics.uci.edu> |
| 101 | 367 | ||
| 102 | * frame.el (select-frame-set-input-focus): Fix typo | 368 | * frame.el (select-frame-set-input-focus): Fix typo "max" -> "mac". |
| 103 | "max" -> "mac". Do not use a single clause cond. | 369 | Do not use a single clause cond. |
| 104 | 370 | ||
| 105 | * cus-start.el (all): Use test that does not match the X11 version | 371 | * cus-start.el (all): Use test that does not match the X11 version |
| 106 | for mac. | 372 | for mac. |
| @@ -148,7 +414,7 @@ | |||
| 148 | (idlwave-complete-in-buffer): | 414 | (idlwave-complete-in-buffer): |
| 149 | * textmodes/org.el (org-export-as-html, org-export-as-ascii) | 415 | * textmodes/org.el (org-export-as-html, org-export-as-ascii) |
| 150 | (org-fast-tag-selection): | 416 | (org-fast-tag-selection): |
| 151 | * textmodes/reftex-sel.el (reftex-select-item): Use mapc rather | 417 | * textmodes/reftex-sel.el (reftex-select-item): Use mapc rather |
| 152 | than mapcar. | 418 | than mapcar. |
| 153 | 419 | ||
| 154 | 2007-10-13 Dan Nicolaescu <dann@ics.uci.edu> | 420 | 2007-10-13 Dan Nicolaescu <dann@ics.uci.edu> |
| @@ -170,9 +436,8 @@ | |||
| 170 | and some leftover logic regarding dedicated frames. If showing | 436 | and some leftover logic regarding dedicated frames. If showing |
| 171 | concise startup screen, fit window to buffer. | 437 | concise startup screen, fit window to buffer. |
| 172 | (command-line-1): If we will be using the splash screen, use | 438 | (command-line-1): If we will be using the splash screen, use |
| 173 | find-file instead of find-file-other-window to find additional | 439 | find-file instead of find-file-other-window to find additional files. |
| 174 | files. Comment out unused code for coping with the old sit-for | 440 | Comment out unused code for coping with the old sit-for behavior. |
| 175 | behavior. | ||
| 176 | 441 | ||
| 177 | 2007-10-12 Stefan Monnier <monnier@iro.umontreal.ca> | 442 | 2007-10-12 Stefan Monnier <monnier@iro.umontreal.ca> |
| 178 | 443 | ||
diff --git a/lisp/bindings.el b/lisp/bindings.el index 0e7bd15a494..19819c15d60 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el | |||
| @@ -289,6 +289,7 @@ Keymap to display on major mode.") | |||
| 289 | 289 | ||
| 290 | (defvar mode-line-minor-mode-keymap | 290 | (defvar mode-line-minor-mode-keymap |
| 291 | (let ((map (make-sparse-keymap))) | 291 | (let ((map (make-sparse-keymap))) |
| 292 | (define-key map [mode-line down-mouse-1] 'mouse-minor-mode-menu) | ||
| 292 | (define-key map [mode-line mouse-2] 'mode-line-minor-mode-help) | 293 | (define-key map [mode-line mouse-2] 'mode-line-minor-mode-help) |
| 293 | (define-key map [mode-line down-mouse-3] 'mode-line-mode-menu-1) | 294 | (define-key map [mode-line down-mouse-3] 'mode-line-mode-menu-1) |
| 294 | (define-key map [header-line down-mouse-3] 'mode-line-mode-menu-1) | 295 | (define-key map [header-line down-mouse-3] 'mode-line-mode-menu-1) |
| @@ -331,7 +332,7 @@ Keymap to display on minor modes.") | |||
| 331 | '("" mode-line-process) | 332 | '("" mode-line-process) |
| 332 | `(:propertize ("" minor-mode-alist) | 333 | `(:propertize ("" minor-mode-alist) |
| 333 | mouse-face mode-line-highlight | 334 | mouse-face mode-line-highlight |
| 334 | help-echo "mouse-2: minor mode help, mouse-3: toggle minor modes" | 335 | help-echo "mouse-1: minor mode, mouse-2: minor mode help, mouse-3: toggle minor modes" |
| 335 | local-map ,mode-line-minor-mode-keymap) | 336 | local-map ,mode-line-minor-mode-keymap) |
| 336 | (propertize "%n" 'help-echo "mouse-2: widen" | 337 | (propertize "%n" 'help-echo "mouse-2: widen" |
| 337 | 'mouse-face 'mode-line-highlight | 338 | 'mouse-face 'mode-line-highlight |
| @@ -492,8 +493,28 @@ Menu of mode operations in the mode line.") | |||
| 492 | (interactive "@e") | 493 | (interactive "@e") |
| 493 | (x-popup-menu event mode-line-mode-menu)) | 494 | (x-popup-menu event mode-line-mode-menu)) |
| 494 | 495 | ||
| 496 | (defun mouse-minor-mode-menu (event) | ||
| 497 | "Show minor-mode menu for EVENT on minor modes area of the mode line." | ||
| 498 | (interactive "@e") | ||
| 499 | (let ((indicator (car (nth 4 (car (cdr event)))))) | ||
| 500 | (minor-mode-menu-from-indicator indicator))) | ||
| 501 | |||
| 502 | (defun minor-mode-menu-from-indicator (indicator) | ||
| 503 | "Show menu, if any, for minor mode specified by INDICATOR. | ||
| 504 | Interactively, INDICATOR is read using completion." | ||
| 505 | (interactive (list (completing-read "Minor mode indicator: " | ||
| 506 | (describe-minor-mode-completion-table-for-indicator)))) | ||
| 507 | (let ((minor-mode (lookup-minor-mode-from-indicator indicator))) | ||
| 508 | (if minor-mode | ||
| 509 | (let* ((map (cdr-safe (assq minor-mode minor-mode-map-alist))) | ||
| 510 | (menu (and (keymapp map) (lookup-key map [menu-bar])))) | ||
| 511 | (if menu | ||
| 512 | (popup-menu menu) | ||
| 513 | (message "No menu for minor mode `%s'" minor-mode))) | ||
| 514 | (error "Cannot find minor mode for `%s'" indicator)))) | ||
| 515 | |||
| 495 | (defun mode-line-minor-mode-help (event) | 516 | (defun mode-line-minor-mode-help (event) |
| 496 | "Describe minor mode for EVENT occurred on minor modes area of the mode line." | 517 | "Describe minor mode for EVENT on minor modes area of the mode line." |
| 497 | (interactive "@e") | 518 | (interactive "@e") |
| 498 | (let ((indicator (car (nth 4 (car (cdr event)))))) | 519 | (let ((indicator (car (nth 4 (car (cdr event)))))) |
| 499 | (describe-minor-mode-from-indicator indicator))) | 520 | (describe-minor-mode-from-indicator indicator))) |
| @@ -536,7 +557,7 @@ is okay. See `mode-line-format'.") | |||
| 536 | '(".elc" ".lof" | 557 | '(".elc" ".lof" |
| 537 | ".glo" ".idx" ".lot" | 558 | ".glo" ".idx" ".lot" |
| 538 | ;; TeX-related | 559 | ;; TeX-related |
| 539 | ".dvi" ".fmt" ".tfm" ".pdf" | 560 | ".fmt" ".tfm" |
| 540 | ;; Java compiled | 561 | ;; Java compiled |
| 541 | ".class" | 562 | ".class" |
| 542 | ;; CLISP | 563 | ;; CLISP |
| @@ -1035,7 +1056,7 @@ language you are using." | |||
| 1035 | (define-key ctl-x-map "rw" 'window-configuration-to-register) | 1056 | (define-key ctl-x-map "rw" 'window-configuration-to-register) |
| 1036 | (define-key ctl-x-map "rf" 'frame-configuration-to-register) | 1057 | (define-key ctl-x-map "rf" 'frame-configuration-to-register) |
| 1037 | 1058 | ||
| 1038 | (define-key esc-map "q" 'fill-paragraph-or-region) | 1059 | (define-key esc-map "q" 'fill-paragraph) |
| 1039 | (define-key ctl-x-map "." 'set-fill-prefix) | 1060 | (define-key ctl-x-map "." 'set-fill-prefix) |
| 1040 | 1061 | ||
| 1041 | (define-key esc-map "{" 'backward-paragraph) | 1062 | (define-key esc-map "{" 'backward-paragraph) |
diff --git a/lisp/bs.el b/lisp/bs.el index 6390bd2dd81..bb2dbae83c0 100644 --- a/lisp/bs.el +++ b/lisp/bs.el | |||
| @@ -158,7 +158,7 @@ | |||
| 158 | ("" 2 2 left " ") | 158 | ("" 2 2 left " ") |
| 159 | ("File" 12 12 left bs--get-file-name) | 159 | ("File" 12 12 left bs--get-file-name) |
| 160 | ("" 2 2 left " ")) | 160 | ("" 2 2 left " ")) |
| 161 | "*List specifying the layout of a Buffer Selection Menu buffer. | 161 | "List specifying the layout of a Buffer Selection Menu buffer. |
| 162 | Each entry specifies a column and is a list of the form of: | 162 | Each entry specifies a column and is a list of the form of: |
| 163 | \(HEADER MINIMUM-LENGTH MAXIMUM-LENGTH ALIGNMENT FUN-OR-STRING) | 163 | \(HEADER MINIMUM-LENGTH MAXIMUM-LENGTH ALIGNMENT FUN-OR-STRING) |
| 164 | 164 | ||
| @@ -180,12 +180,7 @@ return a string representing the column's value." | |||
| 180 | 180 | ||
| 181 | (defun bs--make-header-match-string () | 181 | (defun bs--make-header-match-string () |
| 182 | "Return a regexp matching the first line of a Buffer Selection Menu buffer." | 182 | "Return a regexp matching the first line of a Buffer Selection Menu buffer." |
| 183 | (let ((res "^\\(") | 183 | (concat "^\\(" (mapconcat #'car bs-attributes-list " *") " *$\\)")) |
| 184 | (ele bs-attributes-list)) | ||
| 185 | (while ele | ||
| 186 | (setq res (concat res (car (car ele)) " *")) | ||
| 187 | (setq ele (cdr ele))) | ||
| 188 | (concat res "$\\)"))) | ||
| 189 | 184 | ||
| 190 | ;; Font-Lock-Settings | 185 | ;; Font-Lock-Settings |
| 191 | (defvar bs-mode-font-lock-keywords | 186 | (defvar bs-mode-font-lock-keywords |
| @@ -206,7 +201,7 @@ return a string representing the column's value." | |||
| 206 | "Default font lock expressions for Buffer Selection Menu.") | 201 | "Default font lock expressions for Buffer Selection Menu.") |
| 207 | 202 | ||
| 208 | (defcustom bs-max-window-height 20 | 203 | (defcustom bs-max-window-height 20 |
| 209 | "*Maximal window height of Buffer Selection Menu." | 204 | "Maximal window height of Buffer Selection Menu." |
| 210 | :group 'bs-appearance | 205 | :group 'bs-appearance |
| 211 | :type 'integer) | 206 | :type 'integer) |
| 212 | 207 | ||
| @@ -224,7 +219,7 @@ it is reset to nil. Use `bs-must-always-show-regexp' to specify buffers | |||
| 224 | that must always be shown regardless of the configuration.") | 219 | that must always be shown regardless of the configuration.") |
| 225 | 220 | ||
| 226 | (defcustom bs-must-always-show-regexp nil | 221 | (defcustom bs-must-always-show-regexp nil |
| 227 | "*Regular expression for specifying buffers to show always. | 222 | "Regular expression for specifying buffers to show always. |
| 228 | A buffer whose name matches this regular expression will | 223 | A buffer whose name matches this regular expression will |
| 229 | be shown regardless of current configuration of Buffer Selection Menu." | 224 | be shown regardless of current configuration of Buffer Selection Menu." |
| 230 | :group 'bs | 225 | :group 'bs |
| @@ -246,7 +241,7 @@ The function gets two arguments - the buffers to compare. | |||
| 246 | It must return non-nil if the first buffer should sort before the second.") | 241 | It must return non-nil if the first buffer should sort before the second.") |
| 247 | 242 | ||
| 248 | (defcustom bs-maximal-buffer-name-column 45 | 243 | (defcustom bs-maximal-buffer-name-column 45 |
| 249 | "*Maximum column width for buffer names. | 244 | "Maximum column width for buffer names. |
| 250 | The column for buffer names has dynamic width. The width depends on | 245 | The column for buffer names has dynamic width. The width depends on |
| 251 | maximal and minimal length of names of buffers to show. The maximal | 246 | maximal and minimal length of names of buffers to show. The maximal |
| 252 | width is bounded by `bs-maximal-buffer-name-column'. | 247 | width is bounded by `bs-maximal-buffer-name-column'. |
| @@ -255,7 +250,7 @@ See also `bs-minimal-buffer-name-column'." | |||
| 255 | :type 'integer) | 250 | :type 'integer) |
| 256 | 251 | ||
| 257 | (defcustom bs-minimal-buffer-name-column 15 | 252 | (defcustom bs-minimal-buffer-name-column 15 |
| 258 | "*Minimum column width for buffer names. | 253 | "Minimum column width for buffer names. |
| 259 | The column for buffer names has dynamic width. The width depends on | 254 | The column for buffer names has dynamic width. The width depends on |
| 260 | maximal and minimal length of names of buffers to show. The minimal | 255 | maximal and minimal length of names of buffers to show. The minimal |
| 261 | width is bounded by `bs-minimal-buffer-name-column'. | 256 | width is bounded by `bs-minimal-buffer-name-column'. |
| @@ -272,7 +267,7 @@ See also `bs-maximal-buffer-name-column'." | |||
| 272 | ("files-and-scratch" "^\\*scratch\\*$" nil nil bs-visits-non-file | 267 | ("files-and-scratch" "^\\*scratch\\*$" nil nil bs-visits-non-file |
| 273 | bs-sort-buffer-interns-are-last) | 268 | bs-sort-buffer-interns-are-last) |
| 274 | ("all-intern-last" nil nil nil nil bs-sort-buffer-interns-are-last)) | 269 | ("all-intern-last" nil nil nil nil bs-sort-buffer-interns-are-last)) |
| 275 | "*List of all configurations you can use in the Buffer Selection Menu. | 270 | "List of all configurations you can use in the Buffer Selection Menu. |
| 276 | A configuration describes which buffers appear in Buffer Selection Menu | 271 | A configuration describes which buffers appear in Buffer Selection Menu |
| 277 | and also the order of buffers. A configuration is a list with | 272 | and also the order of buffers. A configuration is a list with |
| 278 | six elements. The first element is a string and describes the configuration. | 273 | six elements. The first element is a string and describes the configuration. |
| @@ -284,7 +279,7 @@ By setting these variables you define a configuration." | |||
| 284 | :type '(repeat sexp)) | 279 | :type '(repeat sexp)) |
| 285 | 280 | ||
| 286 | (defcustom bs-default-configuration "files" | 281 | (defcustom bs-default-configuration "files" |
| 287 | "*Name of default configuration used by the Buffer Selection Menu. | 282 | "Name of default configuration used by the Buffer Selection Menu. |
| 288 | \\<bs-mode-map> | 283 | \\<bs-mode-map> |
| 289 | Will be changed using key \\[bs-select-next-configuration]. | 284 | Will be changed using key \\[bs-select-next-configuration]. |
| 290 | Must be a string used in `bs-configurations' for naming a configuration." | 285 | Must be a string used in `bs-configurations' for naming a configuration." |
| @@ -292,7 +287,7 @@ Must be a string used in `bs-configurations' for naming a configuration." | |||
| 292 | :type 'string) | 287 | :type 'string) |
| 293 | 288 | ||
| 294 | (defcustom bs-alternative-configuration "all" | 289 | (defcustom bs-alternative-configuration "all" |
| 295 | "*Name of configuration used when calling `bs-show' with \ | 290 | "Name of configuration used when calling `bs-show' with \ |
| 296 | \\[universal-argument] as prefix key. | 291 | \\[universal-argument] as prefix key. |
| 297 | Must be a string used in `bs-configurations' for naming a configuration." | 292 | Must be a string used in `bs-configurations' for naming a configuration." |
| 298 | :group 'bs | 293 | :group 'bs |
| @@ -303,7 +298,7 @@ Must be a string used in `bs-configurations' for naming a configuration." | |||
| 303 | Must be a string used in `bs-configurations' for naming a configuration.") | 298 | Must be a string used in `bs-configurations' for naming a configuration.") |
| 304 | 299 | ||
| 305 | (defcustom bs-cycle-configuration-name nil | 300 | (defcustom bs-cycle-configuration-name nil |
| 306 | "*Name of configuration used when cycling through the buffer list. | 301 | "Name of configuration used when cycling through the buffer list. |
| 307 | A value of nil means to use current configuration `bs-default-configuration'. | 302 | A value of nil means to use current configuration `bs-default-configuration'. |
| 308 | Must be a string used in `bs-configurations' for naming a configuration." | 303 | Must be a string used in `bs-configurations' for naming a configuration." |
| 309 | :group 'bs | 304 | :group 'bs |
| @@ -311,32 +306,32 @@ Must be a string used in `bs-configurations' for naming a configuration." | |||
| 311 | string)) | 306 | string)) |
| 312 | 307 | ||
| 313 | (defcustom bs-string-show-always "+" | 308 | (defcustom bs-string-show-always "+" |
| 314 | "*String added in column 1 indicating a buffer will always be shown." | 309 | "String added in column 1 indicating a buffer will always be shown." |
| 315 | :group 'bs-appearance | 310 | :group 'bs-appearance |
| 316 | :type 'string) | 311 | :type 'string) |
| 317 | 312 | ||
| 318 | (defcustom bs-string-show-never "-" | 313 | (defcustom bs-string-show-never "-" |
| 319 | "*String added in column 1 indicating a buffer will never be shown." | 314 | "String added in column 1 indicating a buffer will never be shown." |
| 320 | :group 'bs-appearance | 315 | :group 'bs-appearance |
| 321 | :type 'string) | 316 | :type 'string) |
| 322 | 317 | ||
| 323 | (defcustom bs-string-current "." | 318 | (defcustom bs-string-current "." |
| 324 | "*String added in column 1 indicating the current buffer." | 319 | "String added in column 1 indicating the current buffer." |
| 325 | :group 'bs-appearance | 320 | :group 'bs-appearance |
| 326 | :type 'string) | 321 | :type 'string) |
| 327 | 322 | ||
| 328 | (defcustom bs-string-current-marked "#" | 323 | (defcustom bs-string-current-marked "#" |
| 329 | "*String added in column 1 indicating the current buffer when it is marked." | 324 | "String added in column 1 indicating the current buffer when it is marked." |
| 330 | :group 'bs-appearance | 325 | :group 'bs-appearance |
| 331 | :type 'string) | 326 | :type 'string) |
| 332 | 327 | ||
| 333 | (defcustom bs-string-marked ">" | 328 | (defcustom bs-string-marked ">" |
| 334 | "*String added in column 1 indicating a marked buffer." | 329 | "String added in column 1 indicating a marked buffer." |
| 335 | :group 'bs-appearance | 330 | :group 'bs-appearance |
| 336 | :type 'string) | 331 | :type 'string) |
| 337 | 332 | ||
| 338 | (defcustom bs-string-show-normally " " | 333 | (defcustom bs-string-show-normally " " |
| 339 | "*String added in column 1 indicating an unmarked buffer." | 334 | "String added in column 1 indicating an unmarked buffer." |
| 340 | :group 'bs-appearance | 335 | :group 'bs-appearance |
| 341 | :type 'string) | 336 | :type 'string) |
| 342 | 337 | ||
| @@ -390,7 +385,7 @@ A value of `always' means to show buffer regardless of the configuration.") | |||
| 390 | ("by mode" bs--sort-by-mode "Mode" region) | 385 | ("by mode" bs--sort-by-mode "Mode" region) |
| 391 | ("by filename" bs--sort-by-filename "File" region) | 386 | ("by filename" bs--sort-by-filename "File" region) |
| 392 | ("by nothing" nil nil nil)) | 387 | ("by nothing" nil nil nil)) |
| 393 | "*List of all possible sorting aspects for Buffer Selection Menu. | 388 | "List of all possible sorting aspects for Buffer Selection Menu. |
| 394 | You can add a new entry with a call to `bs-define-sort-function'. | 389 | You can add a new entry with a call to `bs-define-sort-function'. |
| 395 | Each element is a list of four elements (NAME FUNCTION REGEXP-FOR-SORTING FACE). | 390 | Each element is a list of four elements (NAME FUNCTION REGEXP-FOR-SORTING FACE). |
| 396 | NAME specifies the sort order defined by function FUNCTION. | 391 | NAME specifies the sort order defined by function FUNCTION. |
| @@ -425,7 +420,7 @@ The new sort aspect will be inserted into list `bs-sort-functions'." | |||
| 425 | This is an element of `bs-sort-functions'.") | 420 | This is an element of `bs-sort-functions'.") |
| 426 | 421 | ||
| 427 | (defcustom bs-default-sort-name "by nothing" | 422 | (defcustom bs-default-sort-name "by nothing" |
| 428 | "*Name of default sort behavior. | 423 | "Name of default sort behavior. |
| 429 | Must be \"by nothing\" or a string used in `bs-sort-functions' for | 424 | Must be \"by nothing\" or a string used in `bs-sort-functions' for |
| 430 | naming a sort behavior. Default is \"by nothing\" which means no sorting." | 425 | naming a sort behavior. Default is \"by nothing\" which means no sorting." |
| 431 | :group 'bs | 426 | :group 'bs |
| @@ -445,7 +440,6 @@ defined by current configuration `bs-current-configuration'.") | |||
| 445 | 440 | ||
| 446 | (defvar bs--window-config-coming-from nil | 441 | (defvar bs--window-config-coming-from nil |
| 447 | "Window configuration before starting Buffer Selection Menu.") | 442 | "Window configuration before starting Buffer Selection Menu.") |
| 448 | (make-variable-frame-local 'bs--window-config-coming-from) | ||
| 449 | 443 | ||
| 450 | (defvar bs--intern-show-never "^ \\|\\*buffer-selection\\*" | 444 | (defvar bs--intern-show-never "^ \\|\\*buffer-selection\\*" |
| 451 | "Regular expression specifying which buffers never to show. | 445 | "Regular expression specifying which buffers never to show. |
| @@ -529,45 +523,43 @@ a special function. SORT-DESCRIPTION is an element of `bs-sort-functions'." | |||
| 529 | (setq sort-description (or sort-description bs--current-sort-function) | 523 | (setq sort-description (or sort-description bs--current-sort-function) |
| 530 | list (or list (buffer-list))) | 524 | list (or list (buffer-list))) |
| 531 | (let ((result nil)) | 525 | (let ((result nil)) |
| 532 | (while list | 526 | (dolist (buf list) |
| 533 | (let* ((buffername (buffer-name (car list))) | 527 | (let* ((buffername (buffer-name buf)) |
| 534 | (int-show-never (string-match bs--intern-show-never buffername)) | 528 | (int-show-never (string-match-p bs--intern-show-never buffername)) |
| 535 | (ext-show-never (and bs-dont-show-regexp | 529 | (ext-show-never (and bs-dont-show-regexp |
| 536 | (string-match bs-dont-show-regexp | 530 | (string-match-p bs-dont-show-regexp |
| 537 | buffername))) | 531 | buffername))) |
| 538 | (extern-must-show (or (and bs-must-always-show-regexp | 532 | (extern-must-show (or (and bs-must-always-show-regexp |
| 539 | (string-match | 533 | (string-match-p |
| 540 | bs-must-always-show-regexp | 534 | bs-must-always-show-regexp |
| 541 | buffername)) | 535 | buffername)) |
| 542 | (and bs-must-show-regexp | 536 | (and bs-must-show-regexp |
| 543 | (string-match bs-must-show-regexp | 537 | (string-match-p bs-must-show-regexp |
| 544 | buffername)))) | 538 | buffername)))) |
| 545 | (extern-show-never-from-fun (and bs-dont-show-function | 539 | (extern-show-never-from-fun (and bs-dont-show-function |
| 546 | (funcall bs-dont-show-function | 540 | (funcall bs-dont-show-function |
| 547 | (car list)))) | 541 | buf))) |
| 548 | (extern-must-show-from-fun (and bs-must-show-function | 542 | (extern-must-show-from-fun (and bs-must-show-function |
| 549 | (funcall bs-must-show-function | 543 | (funcall bs-must-show-function |
| 550 | (car list)))) | 544 | buf))) |
| 551 | (show-flag (buffer-local-value 'bs-buffer-show-mark (car list)))) | 545 | (show-flag (buffer-local-value 'bs-buffer-show-mark buf))) |
| 552 | (if (or (eq show-flag 'always) | 546 | (when (or (eq show-flag 'always) |
| 553 | (and (or bs--show-all (not (eq show-flag 'never))) | 547 | (and (or bs--show-all (not (eq show-flag 'never))) |
| 554 | (not int-show-never) | 548 | (not int-show-never) |
| 555 | (or bs--show-all | 549 | (or bs--show-all |
| 556 | extern-must-show | 550 | extern-must-show |
| 557 | extern-must-show-from-fun | 551 | extern-must-show-from-fun |
| 558 | (and (not ext-show-never) | 552 | (and (not ext-show-never) |
| 559 | (not extern-show-never-from-fun))))) | 553 | (not extern-show-never-from-fun))))) |
| 560 | (setq result (cons (car list) | 554 | (setq result (cons buf result))))) |
| 561 | result))) | ||
| 562 | (setq list (cdr list)))) | ||
| 563 | (setq result (reverse result)) | 555 | (setq result (reverse result)) |
| 564 | ;; The current buffer which was the start point of bs should be an element | 556 | ;; The current buffer which was the start point of bs should be an element |
| 565 | ;; of result list, so that we can leave with space and be back in the | 557 | ;; of result list, so that we can leave with space and be back in the |
| 566 | ;; buffer we started bs-show. | 558 | ;; buffer we started bs-show. |
| 567 | (if (and bs--buffer-coming-from | 559 | (when (and bs--buffer-coming-from |
| 568 | (buffer-live-p bs--buffer-coming-from) | 560 | (buffer-live-p bs--buffer-coming-from) |
| 569 | (not (memq bs--buffer-coming-from result))) | 561 | (not (memq bs--buffer-coming-from result))) |
| 570 | (setq result (cons bs--buffer-coming-from result))) | 562 | (setq result (cons bs--buffer-coming-from result))) |
| 571 | ;; sorting | 563 | ;; sorting |
| 572 | (if (and sort-description | 564 | (if (and sort-description |
| 573 | (nth 1 sort-description)) | 565 | (nth 1 sort-description)) |
| @@ -587,8 +579,8 @@ If KEEP-LINE-P is non-nil the point will stay on current line. | |||
| 587 | SORT-DESCRIPTION is an element of `bs-sort-functions'." | 579 | SORT-DESCRIPTION is an element of `bs-sort-functions'." |
| 588 | (let ((line (1+ (count-lines 1 (point))))) | 580 | (let ((line (1+ (count-lines 1 (point))))) |
| 589 | (bs-show-in-buffer (bs-buffer-list nil sort-description)) | 581 | (bs-show-in-buffer (bs-buffer-list nil sort-description)) |
| 590 | (if keep-line-p | 582 | (when keep-line-p |
| 591 | (goto-line line)) | 583 | (goto-line line)) |
| 592 | (beginning-of-line))) | 584 | (beginning-of-line))) |
| 593 | 585 | ||
| 594 | (defun bs--goto-current-buffer () | 586 | (defun bs--goto-current-buffer () |
| @@ -602,10 +594,10 @@ actually the line which begins with character in `bs-string-current' or | |||
| 602 | point) | 594 | point) |
| 603 | (save-excursion | 595 | (save-excursion |
| 604 | (goto-char (point-min)) | 596 | (goto-char (point-min)) |
| 605 | (if (search-forward-regexp regexp nil t) | 597 | (when (search-forward-regexp regexp nil t) |
| 606 | (setq point (- (point) 1)))) | 598 | (setq point (1- (point))))) |
| 607 | (if point | 599 | (when point |
| 608 | (goto-char point)))) | 600 | (goto-char point)))) |
| 609 | 601 | ||
| 610 | (defun bs--current-config-message () | 602 | (defun bs--current-config-message () |
| 611 | "Return a string describing the current `bs-mode' configuration." | 603 | "Return a string describing the current `bs-mode' configuration." |
| @@ -614,7 +606,23 @@ actually the line which begins with character in `bs-string-current' or | |||
| 614 | (format "Show buffer by configuration %S" | 606 | (format "Show buffer by configuration %S" |
| 615 | bs-current-configuration))) | 607 | bs-current-configuration))) |
| 616 | 608 | ||
| 617 | (defun bs-mode () | 609 | (defun bs--track-window-changes (frame) |
| 610 | "Track window changes to refresh the buffer list. | ||
| 611 | Used from `window-size-change-functions'." | ||
| 612 | (let ((win (get-buffer-window "*buffer-selection*" frame))) | ||
| 613 | (when win | ||
| 614 | (with-selected-window win | ||
| 615 | (bs-refresh) | ||
| 616 | (bs--set-window-height))))) | ||
| 617 | |||
| 618 | (defun bs--remove-hooks () | ||
| 619 | "Remove `bs--track-window-changes' and auxiliary hooks." | ||
| 620 | (remove-hook 'window-size-change-functions 'bs--track-window-changes) | ||
| 621 | ;; Remove itself | ||
| 622 | (remove-hook 'kill-buffer-hook 'bs--remove-hooks t) | ||
| 623 | (remove-hook 'change-major-mode-hook 'bs--remove-hooks t)) | ||
| 624 | |||
| 625 | (define-derived-mode bs-mode nil "Buffer-Selection-Menu" | ||
| 618 | "Major mode for editing a subset of Emacs' buffers. | 626 | "Major mode for editing a subset of Emacs' buffers. |
| 619 | \\<bs-mode-map> | 627 | \\<bs-mode-map> |
| 620 | Aside from two header lines each line describes one buffer. | 628 | Aside from two header lines each line describes one buffer. |
| @@ -647,27 +655,27 @@ available Buffer Selection Menu configuration. | |||
| 647 | to show always. | 655 | to show always. |
| 648 | \\[bs-visit-tags-table] -- call `visit-tags-table' on current line's buffer. | 656 | \\[bs-visit-tags-table] -- call `visit-tags-table' on current line's buffer. |
| 649 | \\[bs-help] -- display this help text." | 657 | \\[bs-help] -- display this help text." |
| 650 | (interactive) | ||
| 651 | (kill-all-local-variables) | ||
| 652 | (use-local-map bs-mode-map) | ||
| 653 | (make-local-variable 'font-lock-defaults) | 658 | (make-local-variable 'font-lock-defaults) |
| 654 | (make-local-variable 'font-lock-verbose) | 659 | (make-local-variable 'font-lock-verbose) |
| 655 | (make-local-variable 'font-lock-global-modes) | 660 | (make-local-variable 'font-lock-global-modes) |
| 656 | (buffer-disable-undo) | 661 | (buffer-disable-undo) |
| 657 | (setq major-mode 'bs-mode | 662 | (setq buffer-read-only t |
| 658 | mode-name "Buffer-Selection-Menu" | ||
| 659 | buffer-read-only t | ||
| 660 | truncate-lines t | 663 | truncate-lines t |
| 661 | show-trailing-whitespace nil | 664 | show-trailing-whitespace nil |
| 662 | font-lock-global-modes '(not bs-mode) | 665 | font-lock-global-modes '(not bs-mode) |
| 663 | font-lock-defaults '(bs-mode-font-lock-keywords t) | 666 | font-lock-defaults '(bs-mode-font-lock-keywords t) |
| 664 | font-lock-verbose nil) | 667 | font-lock-verbose nil) |
| 665 | (run-mode-hooks 'bs-mode-hook)) | 668 | (add-hook 'window-size-change-functions 'bs--track-window-changes) |
| 669 | (add-hook 'kill-buffer-hook 'bs--remove-hooks nil t) | ||
| 670 | (add-hook 'change-major-mode-hook 'bs--remove-hooks nil t)) | ||
| 666 | 671 | ||
| 667 | (defun bs--restore-window-config () | 672 | (defun bs--restore-window-config () |
| 668 | "Restore window configuration on the current frame." | 673 | "Restore window configuration on the current frame." |
| 669 | (when bs--window-config-coming-from | 674 | (when bs--window-config-coming-from |
| 670 | (set-window-configuration bs--window-config-coming-from) | 675 | (let ((frame (selected-frame))) |
| 676 | (unwind-protect | ||
| 677 | (set-window-configuration bs--window-config-coming-from) | ||
| 678 | (select-frame frame))) | ||
| 671 | (setq bs--window-config-coming-from nil))) | 679 | (setq bs--window-config-coming-from nil))) |
| 672 | 680 | ||
| 673 | (defun bs-kill () | 681 | (defun bs-kill () |
| @@ -705,8 +713,8 @@ Raise an error if not on a buffer line." | |||
| 705 | (beginning-of-line) | 713 | (beginning-of-line) |
| 706 | (let ((line (+ (- bs-header-lines-length) | 714 | (let ((line (+ (- bs-header-lines-length) |
| 707 | (count-lines 1 (point))))) | 715 | (count-lines 1 (point))))) |
| 708 | (if (< line 0) | 716 | (when (< line 0) |
| 709 | (error "You are on a header row")) | 717 | (error "You are on a header row")) |
| 710 | (nth line bs-current-list))) | 718 | (nth line bs-current-list))) |
| 711 | 719 | ||
| 712 | (defun bs--update-current-line () | 720 | (defun bs--update-current-line () |
| @@ -736,19 +744,18 @@ Leave Buffer Selection Menu." | |||
| 736 | (bury-buffer (current-buffer)) | 744 | (bury-buffer (current-buffer)) |
| 737 | (bs--restore-window-config) | 745 | (bs--restore-window-config) |
| 738 | (switch-to-buffer buffer) | 746 | (switch-to-buffer buffer) |
| 739 | (if bs--marked-buffers | 747 | (when bs--marked-buffers |
| 740 | ;; Some marked buffers for selection | 748 | ;; Some marked buffers for selection |
| 741 | (let* ((all (delq buffer bs--marked-buffers)) | 749 | (let* ((all (delq buffer bs--marked-buffers)) |
| 742 | (height (/ (1- (frame-height)) (1+ (length all))))) | 750 | (height (/ (1- (frame-height)) (1+ (length all))))) |
| 743 | (delete-other-windows) | 751 | (delete-other-windows) |
| 744 | (switch-to-buffer buffer) | 752 | (switch-to-buffer buffer) |
| 745 | (while all | 753 | (dolist (buf all) |
| 746 | (split-window nil height) | 754 | (split-window nil height) |
| 747 | (other-window 1) | 755 | (other-window 1) |
| 748 | (switch-to-buffer (car all)) | 756 | (switch-to-buffer buf)) |
| 749 | (setq all (cdr all))) | 757 | ;; goto window we have started bs. |
| 750 | ;; goto window we have started bs. | 758 | (other-window 1))))) |
| 751 | (other-window 1))))) | ||
| 752 | 759 | ||
| 753 | (defun bs-select-other-window () | 760 | (defun bs-select-other-window () |
| 754 | "Select current line's buffer by `switch-to-buffer-other-window'. | 761 | "Select current line's buffer by `switch-to-buffer-other-window'. |
| @@ -912,11 +919,10 @@ WHAT is a value of nil, `never', or `always'." | |||
| 912 | (delete-region (point) (save-excursion | 919 | (delete-region (point) (save-excursion |
| 913 | (end-of-line) | 920 | (end-of-line) |
| 914 | (if (eobp) (point) (1+ (point))))) | 921 | (if (eobp) (point) (1+ (point))))) |
| 915 | (if (eobp) | 922 | (when (eobp) |
| 916 | (progn | 923 | (backward-delete-char 1) |
| 917 | (backward-delete-char 1) | 924 | (beginning-of-line) |
| 918 | (beginning-of-line) | 925 | (recenter -1)) |
| 919 | (recenter -1))) | ||
| 920 | (bs--set-window-height))) | 926 | (bs--set-window-height))) |
| 921 | 927 | ||
| 922 | (defun bs-delete-backward () | 928 | (defun bs-delete-backward () |
| @@ -945,14 +951,14 @@ Default is `bs--current-sort-function'." | |||
| 945 | bs--current-sort-function))) | 951 | bs--current-sort-function))) |
| 946 | (save-excursion | 952 | (save-excursion |
| 947 | (goto-char (point-min)) | 953 | (goto-char (point-min)) |
| 948 | (if (and (nth 2 sort-description) | 954 | (when (and (nth 2 sort-description) |
| 949 | (search-forward-regexp (nth 2 sort-description) nil t)) | 955 | (search-forward-regexp (nth 2 sort-description) nil t)) |
| 950 | (let ((inhibit-read-only t)) | 956 | (let ((inhibit-read-only t)) |
| 951 | (put-text-property (match-beginning 0) | 957 | (put-text-property (match-beginning 0) |
| 952 | (match-end 0) | 958 | (match-end 0) |
| 953 | 'face | 959 | 'face |
| 954 | (or (nth 3 sort-description) | 960 | (or (nth 3 sort-description) |
| 955 | 'region))))))) | 961 | 'region))))))) |
| 956 | 962 | ||
| 957 | (defun bs-toggle-show-all () | 963 | (defun bs-toggle-show-all () |
| 958 | "Toggle show all buffers / show buffers with current configuration." | 964 | "Toggle show all buffers / show buffers with current configuration." |
| @@ -983,10 +989,8 @@ Uses function `vc-toggle-read-only'." | |||
| 983 | 989 | ||
| 984 | (defun bs--nth-wrapper (count fun &rest args) | 990 | (defun bs--nth-wrapper (count fun &rest args) |
| 985 | "Call COUNT times function FUN with arguments ARGS." | 991 | "Call COUNT times function FUN with arguments ARGS." |
| 986 | (setq count (or count 1)) | 992 | (dotimes (i (or count 1)) |
| 987 | (while (> count 0) | 993 | (apply fun args))) |
| 988 | (apply fun args) | ||
| 989 | (setq count (1- count)))) | ||
| 990 | 994 | ||
| 991 | (defun bs-up (arg) | 995 | (defun bs-up (arg) |
| 992 | "Move cursor vertically up ARG lines in Buffer Selection Menu." | 996 | "Move cursor vertically up ARG lines in Buffer Selection Menu." |
| @@ -1026,7 +1030,7 @@ A value of nil means BUFFER belongs to a file." | |||
| 1026 | 1030 | ||
| 1027 | (defun bs-sort-buffer-interns-are-last (b1 b2) | 1031 | (defun bs-sort-buffer-interns-are-last (b1 b2) |
| 1028 | "Function for sorting internal buffers at the end of all buffers." | 1032 | "Function for sorting internal buffers at the end of all buffers." |
| 1029 | (string-match "^\\*" (buffer-name b2))) | 1033 | (string-match-p "^\\*" (buffer-name b2))) |
| 1030 | 1034 | ||
| 1031 | ;; ---------------------------------------------------------------------- | 1035 | ;; ---------------------------------------------------------------------- |
| 1032 | ;; Configurations: | 1036 | ;; Configurations: |
| @@ -1108,8 +1112,8 @@ Will return the first if START-NAME is at end." | |||
| 1108 | (length (length list)) | 1112 | (length (length list)) |
| 1109 | pos) | 1113 | pos) |
| 1110 | (while (and assocs (not pos)) | 1114 | (while (and assocs (not pos)) |
| 1111 | (if (string= (car (car assocs)) start-name) | 1115 | (when (string= (car (car assocs)) start-name) |
| 1112 | (setq pos (- length (length assocs)))) | 1116 | (setq pos (- length (length assocs)))) |
| 1113 | (setq assocs (cdr assocs))) | 1117 | (setq assocs (cdr assocs))) |
| 1114 | (setq pos (1+ pos)) | 1118 | (setq pos (1+ pos)) |
| 1115 | (if (eq pos length) | 1119 | (if (eq pos length) |
| @@ -1151,10 +1155,9 @@ and move point to current buffer." | |||
| 1151 | (erase-buffer) | 1155 | (erase-buffer) |
| 1152 | (setq bs--name-entry-length name-entry-length) | 1156 | (setq bs--name-entry-length name-entry-length) |
| 1153 | (bs--show-header) | 1157 | (bs--show-header) |
| 1154 | (while list | 1158 | (dolist (buffer list) |
| 1155 | (bs--insert-one-entry (car list)) | 1159 | (bs--insert-one-entry buffer) |
| 1156 | (insert "\n") | 1160 | (insert "\n")) |
| 1157 | (setq list (cdr list))) | ||
| 1158 | (delete-backward-char 1) | 1161 | (delete-backward-char 1) |
| 1159 | (bs--set-window-height) | 1162 | (bs--set-window-height) |
| 1160 | (bs--goto-current-buffer) | 1163 | (bs--goto-current-buffer) |
| @@ -1348,27 +1351,21 @@ It goes over all columns described in `bs-attributes-list' | |||
| 1348 | and evaluates corresponding string. Inserts string in current buffer; | 1351 | and evaluates corresponding string. Inserts string in current buffer; |
| 1349 | normally *buffer-selection*." | 1352 | normally *buffer-selection*." |
| 1350 | (let ((string "") | 1353 | (let ((string "") |
| 1351 | (columns bs-attributes-list) | ||
| 1352 | (to-much 0) | 1354 | (to-much 0) |
| 1353 | (apply-args (append (list bs--buffer-coming-from bs-current-list)))) | 1355 | (apply-args (append (list bs--buffer-coming-from bs-current-list)))) |
| 1354 | (save-excursion | 1356 | (save-excursion |
| 1355 | (while columns | 1357 | (set-buffer buffer) |
| 1356 | (set-buffer buffer) | 1358 | (dolist (column bs-attributes-list) |
| 1357 | (let ((min (bs--get-value (nth 1 (car columns)))) | 1359 | (let* ((min (bs--get-value (nth 1 column))) |
| 1358 | ;;(max (bs--get-value (nth 2 (car columns)))) refered no more | 1360 | (new-string (bs--format-aux (bs--get-value (nth 4 column) ; fun |
| 1359 | (align (nth 3 (car columns))) | 1361 | apply-args) |
| 1360 | (fun (nth 4 (car columns))) | 1362 | (nth 3 column) ; align |
| 1361 | (val nil) | 1363 | (- min to-much))) |
| 1362 | new-string) | 1364 | (len (length new-string))) |
| 1363 | (setq val (bs--get-value fun apply-args)) | ||
| 1364 | (setq new-string (bs--format-aux val align (- min to-much))) | ||
| 1365 | (setq string (concat string new-string)) | 1365 | (setq string (concat string new-string)) |
| 1366 | (if (> (length new-string) min) | 1366 | (when (> len min) |
| 1367 | (setq to-much (- (length new-string) min))) | 1367 | (setq to-much (- len min)))))) |
| 1368 | ) ; let | 1368 | (insert string))) |
| 1369 | (setq columns (cdr columns)))) | ||
| 1370 | (insert string) | ||
| 1371 | string)) | ||
| 1372 | 1369 | ||
| 1373 | (defun bs--format-aux (string align len) | 1370 | (defun bs--format-aux (string align len) |
| 1374 | "Pad STRING to length LEN with alignment ALIGN. | 1371 | "Pad STRING to length LEN with alignment ALIGN. |
| @@ -1382,28 +1379,26 @@ ALIGN is one of the symbols `left', `middle', or `right'." | |||
| 1382 | 1379 | ||
| 1383 | (defun bs--show-header () | 1380 | (defun bs--show-header () |
| 1384 | "Insert header for Buffer Selection Menu in current buffer." | 1381 | "Insert header for Buffer Selection Menu in current buffer." |
| 1385 | (dolist (string (bs--create-header)) | 1382 | (insert (bs--create-header-line #'identity) |
| 1386 | (insert string "\n"))) | 1383 | "\n" |
| 1384 | (bs--create-header-line (lambda (title) | ||
| 1385 | (make-string (length title) ?-))) | ||
| 1386 | "\n")) | ||
| 1387 | 1387 | ||
| 1388 | (defun bs--get-name-length () | 1388 | (defun bs--get-name-length () |
| 1389 | "Return value of `bs--name-entry-length'." | 1389 | "Return value of `bs--name-entry-length'." |
| 1390 | bs--name-entry-length) | 1390 | bs--name-entry-length) |
| 1391 | 1391 | ||
| 1392 | (defun bs--create-header () | 1392 | (defun bs--create-header-line (col) |
| 1393 | "Return all header lines used in Buffer Selection Menu as a list of strings." | 1393 | "Generate a line for the header. |
| 1394 | (list (mapconcat (lambda (column) | 1394 | COL is called for each column in `bs-attributes-list' as a |
| 1395 | (bs--format-aux (bs--get-value (car column)) | 1395 | function of one argument, the string heading for the column." |
| 1396 | (nth 3 column) ; align | 1396 | (mapconcat (lambda (column) |
| 1397 | (bs--get-value (nth 1 column)))) | 1397 | (bs--format-aux (funcall col (bs--get-value (car column))) |
| 1398 | bs-attributes-list | 1398 | (nth 3 column) ; align |
| 1399 | "") | 1399 | (bs--get-value (nth 1 column)))) |
| 1400 | (mapconcat (lambda (column) | 1400 | bs-attributes-list |
| 1401 | (let ((length (length (bs--get-value (car column))))) | 1401 | "")) |
| 1402 | (bs--format-aux (make-string length ?-) | ||
| 1403 | (nth 3 column) ; align | ||
| 1404 | (bs--get-value (nth 1 column))))) | ||
| 1405 | bs-attributes-list | ||
| 1406 | ""))) | ||
| 1407 | 1402 | ||
| 1408 | (defun bs--show-with-configuration (name &optional arg) | 1403 | (defun bs--show-with-configuration (name &optional arg) |
| 1409 | "Display buffer list of configuration with name NAME. | 1404 | "Display buffer list of configuration with name NAME. |
| @@ -1424,14 +1419,14 @@ for buffer selection." | |||
| 1424 | (setq bs--buffer-coming-from (current-buffer))) | 1419 | (setq bs--buffer-coming-from (current-buffer))) |
| 1425 | (let ((liste (bs-buffer-list)) | 1420 | (let ((liste (bs-buffer-list)) |
| 1426 | (active-window (get-window-with-predicate | 1421 | (active-window (get-window-with-predicate |
| 1427 | (lambda (w) | 1422 | (lambda (w) |
| 1428 | (string= (buffer-name (window-buffer w)) | 1423 | (string= (buffer-name (window-buffer w)) |
| 1429 | "*buffer-selection*"))))) | 1424 | "*buffer-selection*")) |
| 1425 | nil (selected-frame)))) | ||
| 1430 | (if active-window | 1426 | (if active-window |
| 1431 | (select-window active-window) | 1427 | (select-window active-window) |
| 1432 | (modify-frame-parameters nil | 1428 | (bs--restore-window-config) |
| 1433 | (list (cons 'bs--window-config-coming-from | 1429 | (setq bs--window-config-coming-from (current-window-configuration)) |
| 1434 | (current-window-configuration)))) | ||
| 1435 | (when (> (window-height (selected-window)) 7) | 1430 | (when (> (window-height (selected-window)) 7) |
| 1436 | (split-window-vertically) | 1431 | (split-window-vertically) |
| 1437 | (other-window 1))) | 1432 | (other-window 1))) |
diff --git a/lisp/dired.el b/lisp/dired.el index 7bdb195543a..16b53acb6da 100644 --- a/lisp/dired.el +++ b/lisp/dired.el | |||
| @@ -1682,14 +1682,14 @@ Otherwise, for buffers inheriting from dired-mode, call `toggle-read-only'." | |||
| 1682 | "Move down lines then position at filename. | 1682 | "Move down lines then position at filename. |
| 1683 | Optional prefix ARG says how many lines to move; default is one line." | 1683 | Optional prefix ARG says how many lines to move; default is one line." |
| 1684 | (interactive "p") | 1684 | (interactive "p") |
| 1685 | (next-line arg) | 1685 | (forward-line arg) |
| 1686 | (dired-move-to-filename)) | 1686 | (dired-move-to-filename)) |
| 1687 | 1687 | ||
| 1688 | (defun dired-previous-line (arg) | 1688 | (defun dired-previous-line (arg) |
| 1689 | "Move up lines then position at filename. | 1689 | "Move up lines then position at filename. |
| 1690 | Optional prefix ARG says how many lines to move; default is one line." | 1690 | Optional prefix ARG says how many lines to move; default is one line." |
| 1691 | (interactive "p") | 1691 | (interactive "p") |
| 1692 | (previous-line arg) | 1692 | (forward-line (- arg)) |
| 1693 | (dired-move-to-filename)) | 1693 | (dired-move-to-filename)) |
| 1694 | 1694 | ||
| 1695 | (defun dired-next-dirline (arg &optional opoint) | 1695 | (defun dired-next-dirline (arg &optional opoint) |
diff --git a/lisp/doc-view.el b/lisp/doc-view.el index d7d2bb47abb..d93a8ca316d 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el | |||
| @@ -5,7 +5,6 @@ | |||
| 5 | ;; Author: Tassilo Horn <tassilo@member.fsf.org> | 5 | ;; Author: Tassilo Horn <tassilo@member.fsf.org> |
| 6 | ;; Maintainer: Tassilo Horn <tassilo@member.fsf.org> | 6 | ;; Maintainer: Tassilo Horn <tassilo@member.fsf.org> |
| 7 | ;; Keywords: files, pdf, ps, dvi | 7 | ;; Keywords: files, pdf, ps, dvi |
| 8 | ;; Version: <2007-10-02 Tue 18:21> | ||
| 9 | 8 | ||
| 10 | ;; This file is part of GNU Emacs. | 9 | ;; This file is part of GNU Emacs. |
| 11 | 10 | ||
| @@ -26,9 +25,9 @@ | |||
| 26 | 25 | ||
| 27 | ;;; Requirements: | 26 | ;;; Requirements: |
| 28 | 27 | ||
| 29 | ;; doc-view.el requires GNU Emacs 22.1 or newer. You also need GhostScript, | 28 | ;; doc-view.el requires GNU Emacs 22.1 or newer. You also need Ghostscript, |
| 30 | ;; `dvipdfm' which comes with TeTeX and `pdftotext', which comes with poppler | 29 | ;; `dvipdfm' which comes with teTeX and `pdftotext', which comes with xpdf |
| 31 | ;; (http://poppler.freedesktop.org/). | 30 | ;; (http://www.foolabs.com/xpdf/) or poppler (http://poppler.freedesktop.org/). |
| 32 | 31 | ||
| 33 | ;;; Commentary: | 32 | ;;; Commentary: |
| 34 | 33 | ||
| @@ -37,16 +36,19 @@ | |||
| 37 | ;; inside an Emacs buffer. This buffer uses `doc-view-mode' which provides | 36 | ;; inside an Emacs buffer. This buffer uses `doc-view-mode' which provides |
| 38 | ;; convenient key bindings for browsing the document. | 37 | ;; convenient key bindings for browsing the document. |
| 39 | ;; | 38 | ;; |
| 40 | ;; To use it simply do | 39 | ;; To use it simply open a document file with |
| 41 | ;; | 40 | ;; |
| 42 | ;; M-x doc-view RET | 41 | ;; C-x C-f ~/path/to/document RET |
| 43 | ;; | 42 | ;; |
| 44 | ;; and you'll be queried for a document to open. | 43 | ;; and the document will be converted and displayed, if your emacs supports png |
| 44 | ;; images. With `C-c C-c' you can toggle between the rendered images | ||
| 45 | ;; representation and the source text representation of the document. With | ||
| 46 | ;; `C-c C-e' you can switch to an appropriate editing mode for the document. | ||
| 45 | ;; | 47 | ;; |
| 46 | ;; Since conversion may take some time all the PNG images are cached in a | 48 | ;; Since conversion may take some time all the PNG images are cached in a |
| 47 | ;; subdirectory of `doc-view-cache-directory' and reused when you want to view | 49 | ;; subdirectory of `doc-view-cache-directory' and reused when you want to view |
| 48 | ;; that file again. This reusing can be omitted if you provide a prefx | 50 | ;; that file again. To reconvert a document hit `g' (`doc-view-reconvert-doc') |
| 49 | ;; argument to `doc-view'. To delete all cached files use | 51 | ;; when displaying the document. To delete all cached files use |
| 50 | ;; `doc-view-clear-cache'. To open the cache with dired, so that you can tidy | 52 | ;; `doc-view-clear-cache'. To open the cache with dired, so that you can tidy |
| 51 | ;; it out use `doc-view-dired-cache'. | 53 | ;; it out use `doc-view-dired-cache'. |
| 52 | ;; | 54 | ;; |
| @@ -67,8 +69,6 @@ | |||
| 67 | ;; bottom-right corner of the desired slice. To reset the slice use | 69 | ;; bottom-right corner of the desired slice. To reset the slice use |
| 68 | ;; `doc-view-reset-slice' (bound to `s r'). | 70 | ;; `doc-view-reset-slice' (bound to `s r'). |
| 69 | ;; | 71 | ;; |
| 70 | ;; Dired users should have a look at `doc-view-dired'. | ||
| 71 | ;; | ||
| 72 | ;; You can also search within the document. The command `doc-view-search' | 72 | ;; You can also search within the document. The command `doc-view-search' |
| 73 | ;; (bound to `C-s') queries for a search regexp and initializes a list of all | 73 | ;; (bound to `C-s') queries for a search regexp and initializes a list of all |
| 74 | ;; matching pages and messages how many match-pages were found. After that you | 74 | ;; matching pages and messages how many match-pages were found. After that you |
| @@ -80,17 +80,16 @@ | |||
| 80 | ;; conversion. When that finishes and you're still viewing the document | 80 | ;; conversion. When that finishes and you're still viewing the document |
| 81 | ;; (i.e. you didn't switch to another buffer) you're queried for the regexp | 81 | ;; (i.e. you didn't switch to another buffer) you're queried for the regexp |
| 82 | ;; then. | 82 | ;; then. |
| 83 | ;; | ||
| 84 | ;; Dired users can simply hit `v' on a document file. If it's a PS, PDF or DVI | ||
| 85 | ;; it will be opened using `doc-view-mode'. | ||
| 86 | ;; | ||
| 83 | 87 | ||
| 84 | ;;; Configuration: | 88 | ;;; Configuration: |
| 85 | 89 | ||
| 86 | ;; Basically doc-view should be quite usable with its standard settings, so | 90 | ;; If the images are too small or too big you should set the "-rXXX" option in |
| 87 | ;; putting | 91 | ;; `doc-view-ghostscript-options' to another value. (The bigger your screen, |
| 88 | ;; | 92 | ;; the higher the value.) |
| 89 | ;; (require 'doc-view) | ||
| 90 | ;; | ||
| 91 | ;; into your `user-init-file' should be enough. If the images are too small or | ||
| 92 | ;; too big you should set the "-rXXX" option in `doc-view-ghostscript-options' | ||
| 93 | ;; to another value. (The bigger your screen, the higher the value.) | ||
| 94 | ;; | 93 | ;; |
| 95 | ;; This and all other options can be set with the customization interface. | 94 | ;; This and all other options can be set with the customization interface. |
| 96 | ;; Simply do | 95 | ;; Simply do |
| @@ -102,6 +101,7 @@ | |||
| 102 | ;;; Code: | 101 | ;;; Code: |
| 103 | 102 | ||
| 104 | (require 'dired) | 103 | (require 'dired) |
| 104 | (require 'image-mode) | ||
| 105 | (eval-when-compile (require 'cl)) | 105 | (eval-when-compile (require 'cl)) |
| 106 | 106 | ||
| 107 | ;;;; Customization Options | 107 | ;;;; Customization Options |
| @@ -114,50 +114,51 @@ | |||
| 114 | :group 'multimedia | 114 | :group 'multimedia |
| 115 | :prefix "doc-view-") | 115 | :prefix "doc-view-") |
| 116 | 116 | ||
| 117 | (defcustom doc-view-ghostscript-program "gs" | 117 | (defcustom doc-view-ghostscript-program (executable-find "gs") |
| 118 | "Program to convert PS and PDF files to PNG." | 118 | "Program to convert PS and PDF files to PNG." |
| 119 | :type '(file) | 119 | :type 'file |
| 120 | :group 'doc-view) | 120 | :group 'doc-view) |
| 121 | 121 | ||
| 122 | (defcustom doc-view-ghostscript-options | 122 | (defcustom doc-view-ghostscript-options |
| 123 | '("-dNOPAUSE" "-sDEVICE=png16m" "-dTextAlphaBits=4" | 123 | '("-dSAFER" ;; Avoid security problems when rendering files from untrusted |
| 124 | "-dBATCH" "-dGraphicsAlphaBits=4" "-dQUIET" | 124 | ;; sources. |
| 125 | "-r100") | 125 | "-dNOPAUSE" "-sDEVICE=png16m" "-dTextAlphaBits=4" |
| 126 | "A list of options to give to ghostview." | 126 | "-dBATCH" "-dGraphicsAlphaBits=4" "-dQUIET" "-r100") |
| 127 | :type '(sexp) | 127 | "A list of options to give to ghostscript." |
| 128 | :type '(repeat string) | ||
| 128 | :group 'doc-view) | 129 | :group 'doc-view) |
| 129 | 130 | ||
| 130 | (defcustom doc-view-dvipdfm-program "dvipdfm" | 131 | (defcustom doc-view-dvipdfm-program (executable-find "dvipdfm") |
| 131 | "Program to convert DVI files to PDF. | 132 | "Program to convert DVI files to PDF. |
| 132 | 133 | ||
| 133 | DVI file will be converted to PDF before the resulting PDF is | 134 | DVI file will be converted to PDF before the resulting PDF is |
| 134 | converted to PNG." | 135 | converted to PNG." |
| 135 | :type '(file) | 136 | :type 'file |
| 136 | :group 'doc-view) | 137 | :group 'doc-view) |
| 137 | 138 | ||
| 138 | (defcustom doc-view-ps2pdf-program "ps2pdf" | 139 | (defcustom doc-view-ps2pdf-program (executable-find "ps2pdf") |
| 139 | "Program to convert PS files to PDF. | 140 | "Program to convert PS files to PDF. |
| 140 | 141 | ||
| 141 | PS files will be converted to PDF before searching is possible." | 142 | PS files will be converted to PDF before searching is possible." |
| 142 | :type '(file) | 143 | :type 'file |
| 143 | :group 'doc-view) | 144 | :group 'doc-view) |
| 144 | 145 | ||
| 145 | (defcustom doc-view-pdftotext-program "pdftotext" | 146 | (defcustom doc-view-pdftotext-program (executable-find "pdftotext") |
| 146 | "Program to convert PDF files to plain text. | 147 | "Program to convert PDF files to plain text. |
| 147 | 148 | ||
| 148 | Needed for searching." | 149 | Needed for searching." |
| 149 | :type '(file) | 150 | :type 'file |
| 150 | :group 'doc-view) | 151 | :group 'doc-view) |
| 151 | 152 | ||
| 152 | (defcustom doc-view-cache-directory (concat temporary-file-directory | 153 | (defcustom doc-view-cache-directory (concat temporary-file-directory |
| 153 | "doc-view") | 154 | "doc-view") |
| 154 | "The base directory, where the PNG images will be saved." | 155 | "The base directory, where the PNG images will be saved." |
| 155 | :type '(directory) | 156 | :type 'directory |
| 156 | :group 'doc-view) | 157 | :group 'doc-view) |
| 157 | 158 | ||
| 158 | (defcustom doc-view-conversion-buffer "*doc-view conversion output*" | 159 | (defcustom doc-view-conversion-buffer "*doc-view conversion output*" |
| 159 | "The buffer where messages from the converter programs go to." | 160 | "The buffer where messages from the converter programs go to." |
| 160 | :type '(string) | 161 | :type 'string |
| 161 | :group 'doc-view) | 162 | :group 'doc-view) |
| 162 | 163 | ||
| 163 | (defcustom doc-view-conversion-refresh-interval 3 | 164 | (defcustom doc-view-conversion-refresh-interval 3 |
| @@ -166,7 +167,7 @@ After such an refresh newly converted pages will be available for | |||
| 166 | viewing. If set to nil there won't be any refreshes and the | 167 | viewing. If set to nil there won't be any refreshes and the |
| 167 | pages won't be displayed before conversion of the whole document | 168 | pages won't be displayed before conversion of the whole document |
| 168 | has finished." | 169 | has finished." |
| 169 | :type '(string) | 170 | :type 'integer |
| 170 | :group 'doc-view) | 171 | :group 'doc-view) |
| 171 | 172 | ||
| 172 | ;;;; Internal Variables | 173 | ;;;; Internal Variables |
| @@ -201,7 +202,10 @@ has finished." | |||
| 201 | (defvar doc-view-current-info nil | 202 | (defvar doc-view-current-info nil |
| 202 | "Only used internally.") | 203 | "Only used internally.") |
| 203 | 204 | ||
| 204 | ;;;; DocView Keymap | 205 | (defvar doc-view-current-display nil |
| 206 | "Only used internally.") | ||
| 207 | |||
| 208 | ;;;; DocView Keymaps | ||
| 205 | 209 | ||
| 206 | (defvar doc-view-mode-map | 210 | (defvar doc-view-mode-map |
| 207 | (let ((map (make-sparse-keymap))) | 211 | (let ((map (make-sparse-keymap))) |
| @@ -218,7 +222,6 @@ has finished." | |||
| 218 | ;; Killing/burying the buffer (and the process) | 222 | ;; Killing/burying the buffer (and the process) |
| 219 | (define-key map (kbd "q") 'bury-buffer) | 223 | (define-key map (kbd "q") 'bury-buffer) |
| 220 | (define-key map (kbd "k") 'doc-view-kill-proc-and-buffer) | 224 | (define-key map (kbd "k") 'doc-view-kill-proc-and-buffer) |
| 221 | (define-key map (kbd "C-x k") 'doc-view-kill-proc-and-buffer) | ||
| 222 | ;; Slicing the image | 225 | ;; Slicing the image |
| 223 | (define-key map (kbd "s s") 'doc-view-set-slice) | 226 | (define-key map (kbd "s s") 'doc-view-set-slice) |
| 224 | (define-key map (kbd "s m") 'doc-view-set-slice-using-mouse) | 227 | (define-key map (kbd "s m") 'doc-view-set-slice-using-mouse) |
| @@ -229,15 +232,40 @@ has finished." | |||
| 229 | (define-key map (kbd "C-S-n") 'doc-view-search-next-match) | 232 | (define-key map (kbd "C-S-n") 'doc-view-search-next-match) |
| 230 | (define-key map (kbd "C-S-p") 'doc-view-search-previous-match) | 233 | (define-key map (kbd "C-S-p") 'doc-view-search-previous-match) |
| 231 | ;; Scrolling | 234 | ;; Scrolling |
| 235 | (define-key map (kbd "<right>") 'image-forward-hscroll) | ||
| 236 | (define-key map (kbd "<left>") 'image-backward-hscroll) | ||
| 237 | (define-key map (kbd "<down>") 'image-next-line) | ||
| 238 | (define-key map (kbd "<up>") 'image-previous-line) | ||
| 239 | (define-key map (kbd "C-f") 'image-forward-hscroll) | ||
| 240 | (define-key map (kbd "C-b") 'image-backward-hscroll) | ||
| 241 | (define-key map (kbd "C-n") 'image-next-line) | ||
| 242 | (define-key map (kbd "C-p") 'image-previous-line) | ||
| 232 | (define-key map (kbd "C-v") 'scroll-up) | 243 | (define-key map (kbd "C-v") 'scroll-up) |
| 233 | (define-key map (kbd "<mouse-4>") 'mwheel-scroll) | 244 | (define-key map (kbd "<mouse-4>") 'mwheel-scroll) |
| 234 | (define-key map (kbd "<mouse-5>") 'mwheel-scroll) | 245 | (define-key map (kbd "<mouse-5>") 'mwheel-scroll) |
| 235 | (define-key map (kbd "M-v") 'scroll-down) | 246 | (define-key map (kbd "M-v") 'scroll-down) |
| 236 | ;; Show the tooltip | 247 | ;; Show the tooltip |
| 237 | (define-key map (kbd "C-t") 'doc-view-show-tooltip) | 248 | (define-key map (kbd "C-t") 'doc-view-show-tooltip) |
| 249 | ;; Toggle between text and image display or editing | ||
| 250 | (define-key map (kbd "C-c C-c") 'doc-view-toggle-display) | ||
| 251 | (define-key map (kbd "C-c C-e") 'doc-view-edit-doc) | ||
| 252 | ;; Reconvert the current document | ||
| 253 | (define-key map (kbd "g") 'doc-view-reconvert-doc) | ||
| 238 | (suppress-keymap map) | 254 | (suppress-keymap map) |
| 239 | map) | 255 | map) |
| 240 | "Keymap used by `doc-view-mode'.") | 256 | "Keymap used by `doc-view-mode' when displaying a doc as a set of images.") |
| 257 | |||
| 258 | (defvar doc-view-mode-text-map | ||
| 259 | (let ((map (make-sparse-keymap))) | ||
| 260 | ;; Toggle between text and image display or editing | ||
| 261 | (define-key map (kbd "C-c C-c") 'doc-view-toggle-display) | ||
| 262 | (define-key map (kbd "C-c C-e") 'doc-view-edit-doc) | ||
| 263 | ;; Killing/burying the buffer (and the process) | ||
| 264 | (define-key map (kbd "q") 'bury-buffer) | ||
| 265 | (define-key map (kbd "k") 'doc-view-kill-proc-and-buffer) | ||
| 266 | (define-key map (kbd "C-x k") 'doc-view-kill-proc-and-buffer) | ||
| 267 | map) | ||
| 268 | "Keymap used by `doc-view-mode' when displaying a document as text.") | ||
| 241 | 269 | ||
| 242 | ;;;; Navigation Commands | 270 | ;;;; Navigation Commands |
| 243 | 271 | ||
| @@ -271,16 +299,16 @@ has finished." | |||
| 271 | (setq contexts (concat contexts " - \"" m "\"\n"))) | 299 | (setq contexts (concat contexts " - \"" m "\"\n"))) |
| 272 | contexts))))) | 300 | contexts))))) |
| 273 | ;; Update the buffer | 301 | ;; Update the buffer |
| 274 | (setq inhibit-read-only t) | 302 | (let ((inhibit-read-only t)) |
| 275 | (erase-buffer) | 303 | (erase-buffer) |
| 276 | (let ((beg (point))) | 304 | (let ((beg (point))) |
| 277 | (doc-view-insert-image (nth (1- page) doc-view-current-files) | 305 | (doc-view-insert-image (nth (1- page) doc-view-current-files) |
| 278 | :pointer 'arrow) | 306 | :pointer 'arrow) |
| 279 | (put-text-property beg (point) 'help-echo doc-view-current-info)) | 307 | (put-text-property beg (point) 'help-echo doc-view-current-info)) |
| 280 | (insert "\n" doc-view-current-info) | 308 | (insert "\n" doc-view-current-info) |
| 281 | (goto-char (point-min)) | 309 | (goto-char (point-min)) |
| 282 | (forward-char) | 310 | (forward-char)) |
| 283 | (setq inhibit-read-only nil))) | 311 | (set-buffer-modified-p nil))) |
| 284 | 312 | ||
| 285 | (defun doc-view-next-page (&optional arg) | 313 | (defun doc-view-next-page (&optional arg) |
| 286 | "Browse ARG pages forward." | 314 | "Browse ARG pages forward." |
| @@ -317,52 +345,71 @@ has finished." | |||
| 317 | (error (doc-view-previous-page) | 345 | (error (doc-view-previous-page) |
| 318 | (goto-char (point-max))))) | 346 | (goto-char (point-max))))) |
| 319 | 347 | ||
| 348 | (defun doc-view-kill-proc () | ||
| 349 | "Kill the current converter process." | ||
| 350 | (interactive) | ||
| 351 | (when doc-view-current-converter-process | ||
| 352 | (kill-process doc-view-current-converter-process)) | ||
| 353 | (when doc-view-current-timer | ||
| 354 | (cancel-timer doc-view-current-timer) | ||
| 355 | (setq doc-view-current-timer nil)) | ||
| 356 | (setq mode-line-process nil)) | ||
| 357 | |||
| 320 | (defun doc-view-kill-proc-and-buffer () | 358 | (defun doc-view-kill-proc-and-buffer () |
| 321 | "Kill the current converter process and buffer." | 359 | "Kill the current converter process and buffer." |
| 322 | (interactive) | 360 | (interactive) |
| 361 | (doc-view-kill-proc) | ||
| 323 | (when (eq major-mode 'doc-view-mode) | 362 | (when (eq major-mode 'doc-view-mode) |
| 324 | (when doc-view-current-converter-process | ||
| 325 | (kill-process doc-view-current-converter-process)) | ||
| 326 | (when doc-view-current-timer | ||
| 327 | (cancel-timer doc-view-current-timer) | ||
| 328 | (setq doc-view-current-timer nil)) | ||
| 329 | (kill-buffer (current-buffer)))) | 363 | (kill-buffer (current-buffer)))) |
| 330 | 364 | ||
| 331 | ;;;; Conversion Functions | 365 | ;;;; Conversion Functions |
| 332 | 366 | ||
| 333 | (defun doc-view-file-name-to-directory-name (file) | 367 | (defun doc-view-reconvert-doc (&rest args) |
| 334 | "Return the directory where the png files of FILE should be saved. | 368 | "Reconvert the current document. |
| 335 | 369 | Should be invoked when the cached images aren't up-to-date." | |
| 336 | It'a a subdirectory of `doc-view-cache-directory'." | 370 | (interactive) |
| 371 | (let ((inhibit-read-only t) | ||
| 372 | (doc doc-view-current-doc)) | ||
| 373 | (doc-view-kill-proc) | ||
| 374 | ;; Clear the old cached files | ||
| 375 | (when (file-exists-p (doc-view-current-cache-dir)) | ||
| 376 | (dired-delete-file (doc-view-current-cache-dir) 'always)) | ||
| 377 | (doc-view-kill-proc-and-buffer) | ||
| 378 | (find-file doc))) | ||
| 379 | |||
| 380 | (defun doc-view-current-cache-dir () | ||
| 381 | "Return the directory where the png files of the current doc should be saved. | ||
| 382 | It's a subdirectory of `doc-view-cache-directory'." | ||
| 337 | (if doc-view-current-cache-dir | 383 | (if doc-view-current-cache-dir |
| 338 | doc-view-current-cache-dir | 384 | doc-view-current-cache-dir |
| 339 | (file-name-as-directory | 385 | (setq doc-view-current-cache-dir |
| 340 | (concat (file-name-as-directory doc-view-cache-directory) | 386 | (file-name-as-directory |
| 341 | (with-temp-buffer | 387 | (concat (file-name-as-directory doc-view-cache-directory) |
| 342 | (insert-file-contents-literally file) | 388 | (let ((doc doc-view-current-doc)) |
| 343 | (md5 (current-buffer))))))) | 389 | (with-temp-buffer |
| 390 | (insert-file-contents-literally doc) | ||
| 391 | (md5 (current-buffer))))))))) | ||
| 344 | 392 | ||
| 345 | (defun doc-view-dvi->pdf-sentinel (proc event) | 393 | (defun doc-view-dvi->pdf-sentinel (proc event) |
| 346 | "If DVI->PDF conversion was successful, convert the PDF to PNG now." | 394 | "If DVI->PDF conversion was successful, convert the PDF to PNG now." |
| 347 | (if (not (string-match "finished" event)) | 395 | (if (not (string-match "finished" event)) |
| 348 | (message "DocView: dvi->pdf process changed status to %s." event) | 396 | (message "DocView: dvi->pdf process changed status to %s." event) |
| 349 | (set-buffer (process-get proc 'buffer)) | 397 | (set-buffer (process-get proc 'buffer)) |
| 350 | (setq doc-view-current-converter-process nil) | 398 | (setq doc-view-current-converter-process nil |
| 351 | (message "DocView: finished conversion from DVI to PDF!") | 399 | mode-line-process nil) |
| 352 | ;; Now go on converting this PDF to a set of PNG files. | 400 | ;; Now go on converting this PDF to a set of PNG files. |
| 353 | (let* ((pdf (process-get proc 'pdf-file)) | 401 | (let* ((pdf (process-get proc 'pdf-file)) |
| 354 | (png (concat (doc-view-file-name-to-directory-name | 402 | (png (concat (doc-view-current-cache-dir) |
| 355 | doc-view-current-doc) | ||
| 356 | "page-%d.png"))) | 403 | "page-%d.png"))) |
| 357 | (doc-view-pdf/ps->png pdf png)))) | 404 | (doc-view-pdf/ps->png pdf png)))) |
| 358 | 405 | ||
| 359 | (defun doc-view-dvi->pdf (dvi pdf) | 406 | (defun doc-view-dvi->pdf (dvi pdf) |
| 360 | "Convert DVI to PDF asynchrounously." | 407 | "Convert DVI to PDF asynchrounously." |
| 361 | (message "DocView: converting DVI to PDF now!") | ||
| 362 | (setq doc-view-current-converter-process | 408 | (setq doc-view-current-converter-process |
| 363 | (start-process "doc-view-dvi->pdf" doc-view-conversion-buffer | 409 | (start-process "dvi->pdf" doc-view-conversion-buffer |
| 364 | doc-view-dvipdfm-program | 410 | doc-view-dvipdfm-program |
| 365 | "-o" pdf dvi)) | 411 | "-o" pdf dvi) |
| 412 | mode-line-process (list (format ":%s" doc-view-current-converter-process))) | ||
| 366 | (set-process-sentinel doc-view-current-converter-process | 413 | (set-process-sentinel doc-view-current-converter-process |
| 367 | 'doc-view-dvi->pdf-sentinel) | 414 | 'doc-view-dvi->pdf-sentinel) |
| 368 | (process-put doc-view-current-converter-process 'buffer (current-buffer)) | 415 | (process-put doc-view-current-converter-process 'buffer (current-buffer)) |
| @@ -373,24 +420,24 @@ It'a a subdirectory of `doc-view-cache-directory'." | |||
| 373 | (if (not (string-match "finished" event)) | 420 | (if (not (string-match "finished" event)) |
| 374 | (message "DocView: converter process changed status to %s." event) | 421 | (message "DocView: converter process changed status to %s." event) |
| 375 | (set-buffer (process-get proc 'buffer)) | 422 | (set-buffer (process-get proc 'buffer)) |
| 376 | (setq doc-view-current-converter-process nil) | 423 | (setq doc-view-current-converter-process nil |
| 424 | mode-line-process nil) | ||
| 377 | (when doc-view-current-timer | 425 | (when doc-view-current-timer |
| 378 | (cancel-timer doc-view-current-timer) | 426 | (cancel-timer doc-view-current-timer) |
| 379 | (setq doc-view-current-timer nil)) | 427 | (setq doc-view-current-timer nil)) |
| 380 | (message "DocView: finished conversion from PDF/PS to PNG!") | ||
| 381 | ;; Yippie, finished. Update the display! | 428 | ;; Yippie, finished. Update the display! |
| 382 | (doc-view-display doc-view-current-doc))) | 429 | (doc-view-display doc-view-current-doc))) |
| 383 | 430 | ||
| 384 | (defun doc-view-pdf/ps->png (pdf-ps png) | 431 | (defun doc-view-pdf/ps->png (pdf-ps png) |
| 385 | "Convert PDF-PS to PNG asynchrounously." | 432 | "Convert PDF-PS to PNG asynchrounously." |
| 386 | (message "DocView: converting PDF or PS to PNG now!") | ||
| 387 | (setq doc-view-current-converter-process | 433 | (setq doc-view-current-converter-process |
| 388 | (apply 'start-process | 434 | (apply 'start-process |
| 389 | (append (list "doc-view-pdf/ps->png" doc-view-conversion-buffer | 435 | (append (list "pdf/ps->png" doc-view-conversion-buffer |
| 390 | doc-view-ghostscript-program) | 436 | doc-view-ghostscript-program) |
| 391 | doc-view-ghostscript-options | 437 | doc-view-ghostscript-options |
| 392 | (list (concat "-sOutputFile=" png)) | 438 | (list (concat "-sOutputFile=" png)) |
| 393 | (list pdf-ps)))) | 439 | (list pdf-ps))) |
| 440 | mode-line-process (list (format ":%s" doc-view-current-converter-process))) | ||
| 394 | (process-put doc-view-current-converter-process | 441 | (process-put doc-view-current-converter-process |
| 395 | 'buffer (current-buffer)) | 442 | 'buffer (current-buffer)) |
| 396 | (set-process-sentinel doc-view-current-converter-process | 443 | (set-process-sentinel doc-view-current-converter-process |
| @@ -398,7 +445,7 @@ It'a a subdirectory of `doc-view-cache-directory'." | |||
| 398 | (when doc-view-conversion-refresh-interval | 445 | (when doc-view-conversion-refresh-interval |
| 399 | (setq doc-view-current-timer | 446 | (setq doc-view-current-timer |
| 400 | (run-at-time "1 secs" doc-view-conversion-refresh-interval | 447 | (run-at-time "1 secs" doc-view-conversion-refresh-interval |
| 401 | 'doc-view-display | 448 | 'doc-view-display-maybe |
| 402 | doc-view-current-doc)))) | 449 | doc-view-current-doc)))) |
| 403 | 450 | ||
| 404 | (defun doc-view-pdf->txt-sentinel (proc event) | 451 | (defun doc-view-pdf->txt-sentinel (proc event) |
| @@ -407,8 +454,8 @@ It'a a subdirectory of `doc-view-cache-directory'." | |||
| 407 | (let ((current-buffer (current-buffer)) | 454 | (let ((current-buffer (current-buffer)) |
| 408 | (proc-buffer (process-get proc 'buffer))) | 455 | (proc-buffer (process-get proc 'buffer))) |
| 409 | (set-buffer proc-buffer) | 456 | (set-buffer proc-buffer) |
| 410 | (setq doc-view-current-converter-process nil) | 457 | (setq doc-view-current-converter-process nil |
| 411 | (message "DocView: finished conversion from PDF to TXT!") | 458 | mode-line-process nil) |
| 412 | ;; If the user looks at the DocView buffer where the conversion was | 459 | ;; If the user looks at the DocView buffer where the conversion was |
| 413 | ;; performed, search anew. This time it will be queried for a regexp. | 460 | ;; performed, search anew. This time it will be queried for a regexp. |
| 414 | (when (eq current-buffer proc-buffer) | 461 | (when (eq current-buffer proc-buffer) |
| @@ -416,11 +463,11 @@ It'a a subdirectory of `doc-view-cache-directory'." | |||
| 416 | 463 | ||
| 417 | (defun doc-view-pdf->txt (pdf txt) | 464 | (defun doc-view-pdf->txt (pdf txt) |
| 418 | "Convert PDF to TXT asynchrounously." | 465 | "Convert PDF to TXT asynchrounously." |
| 419 | (message "DocView: converting PDF to TXT now!") | ||
| 420 | (setq doc-view-current-converter-process | 466 | (setq doc-view-current-converter-process |
| 421 | (start-process "doc-view-pdf->txt" doc-view-conversion-buffer | 467 | (start-process "pdf->txt" doc-view-conversion-buffer |
| 422 | doc-view-pdftotext-program "-raw" | 468 | doc-view-pdftotext-program "-raw" |
| 423 | pdf txt)) | 469 | pdf txt) |
| 470 | mode-line-process (list (format ":%s" doc-view-current-converter-process))) | ||
| 424 | (set-process-sentinel doc-view-current-converter-process | 471 | (set-process-sentinel doc-view-current-converter-process |
| 425 | 'doc-view-pdf->txt-sentinel) | 472 | 'doc-view-pdf->txt-sentinel) |
| 426 | (process-put doc-view-current-converter-process 'buffer (current-buffer))) | 473 | (process-put doc-view-current-converter-process 'buffer (current-buffer))) |
| @@ -429,65 +476,45 @@ It'a a subdirectory of `doc-view-cache-directory'." | |||
| 429 | (if (not (string-match "finished" event)) | 476 | (if (not (string-match "finished" event)) |
| 430 | (message "DocView: converter process changed status to %s." event) | 477 | (message "DocView: converter process changed status to %s." event) |
| 431 | (set-buffer (process-get proc 'buffer)) | 478 | (set-buffer (process-get proc 'buffer)) |
| 432 | (setq doc-view-current-converter-process nil) | 479 | (setq doc-view-current-converter-process nil |
| 433 | (message "DocView: finished conversion from PS to PDF!") | 480 | mode-line-process nil) |
| 434 | ;; Now we can transform to plain text. | 481 | ;; Now we can transform to plain text. |
| 435 | (doc-view-pdf->txt (process-get proc 'pdf-file) | 482 | (doc-view-pdf->txt (process-get proc 'pdf-file) |
| 436 | (concat (doc-view-file-name-to-directory-name | 483 | (concat (doc-view-current-cache-dir) |
| 437 | doc-view-current-doc) | ||
| 438 | "doc.txt")))) | 484 | "doc.txt")))) |
| 439 | 485 | ||
| 440 | (defun doc-view-ps->pdf (ps pdf) | 486 | (defun doc-view-ps->pdf (ps pdf) |
| 441 | "Convert PS to PDF asynchronously." | 487 | "Convert PS to PDF asynchronously." |
| 442 | (message "DocView: converting PS to PDF now!") | ||
| 443 | (setq doc-view-current-converter-process | 488 | (setq doc-view-current-converter-process |
| 444 | (start-process "doc-view-ps->pdf" doc-view-conversion-buffer | 489 | (start-process "ps->pdf" doc-view-conversion-buffer |
| 445 | doc-view-ps2pdf-program | 490 | doc-view-ps2pdf-program |
| 446 | ps pdf)) | 491 | ps pdf |
| 492 | ;; Avoid security problems when rendering files from | ||
| 493 | ;; untrusted sources. | ||
| 494 | "-dSAFER") | ||
| 495 | mode-line-process (list (format ":%s" doc-view-current-converter-process))) | ||
| 447 | (set-process-sentinel doc-view-current-converter-process | 496 | (set-process-sentinel doc-view-current-converter-process |
| 448 | 'doc-view-ps->pdf-sentinel) | 497 | 'doc-view-ps->pdf-sentinel) |
| 449 | (process-put doc-view-current-converter-process 'buffer (current-buffer)) | 498 | (process-put doc-view-current-converter-process 'buffer (current-buffer)) |
| 450 | (process-put doc-view-current-converter-process 'pdf-file pdf)) | 499 | (process-put doc-view-current-converter-process 'pdf-file pdf)) |
| 451 | 500 | ||
| 452 | (defun doc-view-convert-doc (doc) | 501 | (defun doc-view-convert-current-doc () |
| 453 | "Convert DOC to a set of png files, one file per page. | 502 | "Convert `doc-view-current-doc' to a set of png files, one file per page. |
| 454 | 503 | Those files are saved in the directory given by the function | |
| 455 | Those files are saved in the directory given by | 504 | `doc-view-current-cache-dir'." |
| 456 | `doc-view-file-name-to-directory-name'." | ||
| 457 | (clear-image-cache) | 505 | (clear-image-cache) |
| 458 | (let* ((dir (doc-view-file-name-to-directory-name doc)) | 506 | (let ((png-file (concat (doc-view-current-cache-dir) |
| 459 | (png-file (concat (file-name-as-directory dir) "page-%d.png"))) | 507 | "page-%d.png"))) |
| 460 | (when (file-exists-p dir) | 508 | (make-directory doc-view-current-cache-dir t) |
| 461 | (dired-delete-file dir 'always)) | 509 | (if (not (string= (file-name-extension doc-view-current-doc) "dvi")) |
| 462 | (make-directory dir t) | ||
| 463 | (if (not (string= (file-name-extension doc) "dvi")) | ||
| 464 | ;; Convert to PNG images. | 510 | ;; Convert to PNG images. |
| 465 | (doc-view-pdf/ps->png doc png-file) | 511 | (doc-view-pdf/ps->png doc-view-current-doc png-file) |
| 466 | ;; DVI files have to be converted to PDF before GhostScript can process | 512 | ;; DVI files have to be converted to PDF before Ghostscript can process |
| 467 | ;; it. | 513 | ;; it. |
| 468 | (doc-view-dvi->pdf doc | 514 | (doc-view-dvi->pdf doc-view-current-doc |
| 469 | (concat (file-name-as-directory dir) | 515 | (concat (file-name-as-directory doc-view-current-cache-dir) |
| 470 | "doc.pdf"))))) | 516 | "doc.pdf"))))) |
| 471 | 517 | ||
| 472 | ;;;; DocView Mode | ||
| 473 | |||
| 474 | (define-derived-mode doc-view-mode nil "DocView" | ||
| 475 | "Major mode in DocView buffers. | ||
| 476 | |||
| 477 | \\{doc-view-mode-map}" | ||
| 478 | :group 'doc-view | ||
| 479 | (setq buffer-read-only t) | ||
| 480 | (make-local-variable 'doc-view-current-files) | ||
| 481 | (make-local-variable 'doc-view-current-doc) | ||
| 482 | (make-local-variable 'doc-view-current-image) | ||
| 483 | (make-local-variable 'doc-view-current-page) | ||
| 484 | (make-local-variable 'doc-view-current-converter-process) | ||
| 485 | (make-local-variable 'doc-view-current-timer) | ||
| 486 | (make-local-variable 'doc-view-current-slice) | ||
| 487 | (make-local-variable 'doc-view-current-cache-dir) | ||
| 488 | (make-local-variable 'doc-view-current-info) | ||
| 489 | (make-local-variable 'doc-view-current-search-matches)) | ||
| 490 | |||
| 491 | ;;;; Slicing | 518 | ;;;; Slicing |
| 492 | 519 | ||
| 493 | (defun doc-view-set-slice (x y width height) | 520 | (defun doc-view-set-slice (x y width height) |
| @@ -555,19 +582,22 @@ Predicate for sorting `doc-view-current-files'." | |||
| 555 | nil | 582 | nil |
| 556 | (string< a b)))) | 583 | (string< a b)))) |
| 557 | 584 | ||
| 585 | (defun doc-view-display-maybe (doc) | ||
| 586 | "Call `doc-view-display' iff we're in the image display." | ||
| 587 | (when (eq doc-view-current-display 'image) | ||
| 588 | (doc-view-display doc))) | ||
| 589 | |||
| 558 | (defun doc-view-display (doc) | 590 | (defun doc-view-display (doc) |
| 559 | "Start viewing the document DOC." | 591 | "Start viewing the document DOC." |
| 560 | (let ((dir (doc-view-file-name-to-directory-name doc))) | 592 | (set-buffer (get-file-buffer doc)) |
| 561 | (set-buffer (format "*DocView: %s*" doc)) | 593 | (setq doc-view-current-files |
| 562 | (setq doc-view-current-files | 594 | (sort (directory-files (doc-view-current-cache-dir) t |
| 563 | (sort (directory-files dir t "page-[0-9]+\\.png" t) | 595 | "page-[0-9]+\\.png" t) |
| 564 | 'doc-view-sort)) | 596 | 'doc-view-sort)) |
| 565 | (when (> (length doc-view-current-files) 0) | 597 | (when (> (length doc-view-current-files) 0) |
| 566 | (doc-view-goto-page doc-view-current-page)))) | 598 | (doc-view-goto-page doc-view-current-page))) |
| 567 | 599 | ||
| 568 | (defun doc-view-buffer-message () | 600 | (defun doc-view-buffer-message () |
| 569 | (setq inhibit-read-only t) | ||
| 570 | (erase-buffer) | ||
| 571 | (insert (propertize "Welcome to DocView!" 'face 'bold) | 601 | (insert (propertize "Welcome to DocView!" 'face 'bold) |
| 572 | "\n" | 602 | "\n" |
| 573 | " | 603 | " |
| @@ -580,12 +610,58 @@ For now these keys are useful: | |||
| 580 | 610 | ||
| 581 | `q' : Bury this buffer. Conversion will go on in background. | 611 | `q' : Bury this buffer. Conversion will go on in background. |
| 582 | `k' : Kill the conversion process and this buffer.\n") | 612 | `k' : Kill the conversion process and this buffer.\n") |
| 583 | (setq inhibit-read-only nil)) | 613 | (set-buffer-modified-p nil)) |
| 584 | 614 | ||
| 585 | (defun doc-view-show-tooltip () | 615 | (defun doc-view-show-tooltip () |
| 586 | (interactive) | 616 | (interactive) |
| 587 | (tooltip-show doc-view-current-info)) | 617 | (tooltip-show doc-view-current-info)) |
| 588 | 618 | ||
| 619 | ;;;;; Toggle between text and image display | ||
| 620 | |||
| 621 | (defun doc-view-toggle-display () | ||
| 622 | "Start or stop displaying a document file as a set of images. | ||
| 623 | This command toggles between showing the text of the document | ||
| 624 | file and showing the document as a set of images." | ||
| 625 | (interactive) | ||
| 626 | (if (get-text-property (point-min) 'display) | ||
| 627 | ;; Switch to text display | ||
| 628 | (let ((inhibit-read-only t)) | ||
| 629 | (erase-buffer) | ||
| 630 | (insert-file-contents doc-view-current-doc) | ||
| 631 | (use-local-map doc-view-mode-text-map) | ||
| 632 | (setq mode-name "DocView[text]" | ||
| 633 | doc-view-current-display 'text) | ||
| 634 | (if (called-interactively-p) | ||
| 635 | (message "Repeat this command to go back to displaying the file as images"))) | ||
| 636 | ;; Switch to image display | ||
| 637 | (let ((inhibit-read-only t)) | ||
| 638 | (erase-buffer) | ||
| 639 | (doc-view-buffer-message) | ||
| 640 | (setq doc-view-current-page (or doc-view-current-page 1)) | ||
| 641 | (if (file-exists-p (doc-view-current-cache-dir)) | ||
| 642 | (progn | ||
| 643 | (message "DocView: using cached files!") | ||
| 644 | (doc-view-display doc-view-current-doc)) | ||
| 645 | (doc-view-convert-current-doc)) | ||
| 646 | (use-local-map doc-view-mode-map) | ||
| 647 | (setq mode-name (format "DocView") | ||
| 648 | doc-view-current-display 'image) | ||
| 649 | (if (called-interactively-p) | ||
| 650 | (message "Repeat this command to go back to displaying the file as text")))) | ||
| 651 | (set-buffer-modified-p nil)) | ||
| 652 | |||
| 653 | ;;;;; Leave doc-view-mode and open the file for edit | ||
| 654 | |||
| 655 | (defun doc-view-edit-doc () | ||
| 656 | "Leave `doc-view-mode' and open the current doc with an appropriate editing mode." | ||
| 657 | (interactive) | ||
| 658 | (let ((filename doc-view-current-doc) | ||
| 659 | (auto-mode-alist (append '(("\\.[eE]?[pP][sS]\\'" . ps-mode) | ||
| 660 | ("\\.\\(pdf\\|PDF\\|dvi\\|DVI\\)$" . fundamental-mode)) | ||
| 661 | auto-mode-alist))) | ||
| 662 | (kill-buffer (current-buffer)) | ||
| 663 | (find-file filename))) | ||
| 664 | |||
| 589 | ;;;; Searching | 665 | ;;;; Searching |
| 590 | 666 | ||
| 591 | (defun doc-view-search-internal (regexp file) | 667 | (defun doc-view-search-internal (regexp file) |
| @@ -636,8 +712,7 @@ conversion finished." | |||
| 636 | (interactive) | 712 | (interactive) |
| 637 | ;; New search, so forget the old results. | 713 | ;; New search, so forget the old results. |
| 638 | (setq doc-view-current-search-matches nil) | 714 | (setq doc-view-current-search-matches nil) |
| 639 | (let ((txt (concat (doc-view-file-name-to-directory-name | 715 | (let ((txt (concat (doc-view-current-cache-dir) |
| 640 | doc-view-current-doc) | ||
| 641 | "doc.txt"))) | 716 | "doc.txt"))) |
| 642 | (if (file-readable-p txt) | 717 | (if (file-readable-p txt) |
| 643 | (progn | 718 | (progn |
| @@ -660,14 +735,12 @@ conversion finished." | |||
| 660 | ;; Doc is a PS, so convert it to PDF (which will be converted to | 735 | ;; Doc is a PS, so convert it to PDF (which will be converted to |
| 661 | ;; TXT thereafter). | 736 | ;; TXT thereafter). |
| 662 | (doc-view-ps->pdf doc-view-current-doc | 737 | (doc-view-ps->pdf doc-view-current-doc |
| 663 | (concat (doc-view-file-name-to-directory-name | 738 | (concat (doc-view-current-cache-dir) |
| 664 | doc-view-current-doc) | ||
| 665 | "doc.pdf"))) | 739 | "doc.pdf"))) |
| 666 | ((string= ext "dvi") | 740 | ((string= ext "dvi") |
| 667 | ;; Doc is a DVI. This means that a doc.pdf already exists in its | 741 | ;; Doc is a DVI. This means that a doc.pdf already exists in its |
| 668 | ;; cache subdirectory. | 742 | ;; cache subdirectory. |
| 669 | (doc-view-pdf->txt (concat (doc-view-file-name-to-directory-name | 743 | (doc-view-pdf->txt (concat (doc-view-current-cache-dir) |
| 670 | doc-view-current-doc) | ||
| 671 | "doc.pdf") | 744 | "doc.pdf") |
| 672 | txt)) | 745 | txt)) |
| 673 | (t (error "DocView doesn't know what to do")))))))) | 746 | (t (error "DocView doesn't know what to do")))))))) |
| @@ -698,52 +771,42 @@ conversion finished." | |||
| 698 | (y-or-n-p "No more matches before current page. Wrap to last match? ")) | 771 | (y-or-n-p "No more matches before current page. Wrap to last match? ")) |
| 699 | (doc-view-goto-page (caar (last doc-view-current-search-matches))))))) | 772 | (doc-view-goto-page (caar (last doc-view-current-search-matches))))))) |
| 700 | 773 | ||
| 701 | ;;;; User Interface Commands | 774 | ;;;; User interface commands and the mode |
| 702 | 775 | ||
| 703 | ;;;###autoload | 776 | (put 'doc-view-mode 'mode-class 'special) |
| 704 | (defun doc-view (no-cache &optional file) | ||
| 705 | "Convert FILE to png and start viewing it. | ||
| 706 | If no FILE is given, query for on. | ||
| 707 | If this FILE is still in the cache, don't convert and use the | ||
| 708 | existing page files. With prefix arg NO-CACHE, don't use the | ||
| 709 | cached files and convert anew." | ||
| 710 | (interactive "P") | ||
| 711 | (if (not (and (image-type-available-p 'png) | ||
| 712 | (display-images-p))) | ||
| 713 | (message "DocView: your emacs or display doesn't support png images.") | ||
| 714 | (let* ((doc (or file | ||
| 715 | (expand-file-name | ||
| 716 | (let ((completion-ignored-extensions | ||
| 717 | ;; Don't hide files doc-view can display | ||
| 718 | (remove-if (lambda (str) | ||
| 719 | (string-match "\\.\\(ps\\|pdf\\|dvi\\)$" | ||
| 720 | str)) | ||
| 721 | completion-ignored-extensions))) | ||
| 722 | (read-file-name "File: " nil nil t))))) | ||
| 723 | (buffer (get-buffer-create (format "*DocView: %s*" doc))) | ||
| 724 | (dir (doc-view-file-name-to-directory-name doc))) | ||
| 725 | (switch-to-buffer buffer) | ||
| 726 | (doc-view-buffer-message) | ||
| 727 | (doc-view-mode) | ||
| 728 | (setq doc-view-current-doc doc) | ||
| 729 | (setq doc-view-current-page 1) | ||
| 730 | (if (not (and (file-exists-p dir) | ||
| 731 | (not no-cache))) | ||
| 732 | (progn | ||
| 733 | (setq doc-view-current-cache-dir nil) | ||
| 734 | (doc-view-convert-doc doc-view-current-doc)) | ||
| 735 | (message "DocView: using cached files!") | ||
| 736 | (doc-view-display doc-view-current-doc))))) | ||
| 737 | 777 | ||
| 738 | (defun doc-view-dired (no-cache) | 778 | ;;;###autoload |
| 739 | "View the current dired file with doc-view. | 779 | (define-derived-mode doc-view-mode nil "DocView" |
| 740 | NO-CACHE is the same as in `doc-view'. | 780 | "Major mode in DocView buffers. |
| 741 | 781 | You can use \\<doc-view-mode-map>\\[doc-view-toggle-display] to | |
| 742 | You might want to bind this command to a dired key, e.g. | 782 | toggle between display as a set of images and display as text." |
| 743 | 783 | :group 'doc-view | |
| 744 | (define-key dired-mode-map (kbd \"C-c d\") 'doc-view-dired)" | 784 | (make-local-variable 'doc-view-current-files) |
| 745 | (interactive "P") | 785 | (make-local-variable 'doc-view-current-doc) |
| 746 | (doc-view no-cache (dired-get-file-for-visit))) | 786 | (make-local-variable 'doc-view-current-image) |
| 787 | (make-local-variable 'doc-view-current-page) | ||
| 788 | (make-local-variable 'doc-view-current-converter-process) | ||
| 789 | (make-local-variable 'doc-view-current-timer) | ||
| 790 | (make-local-variable 'doc-view-current-slice) | ||
| 791 | (make-local-variable 'doc-view-current-cache-dir) | ||
| 792 | (make-local-variable 'doc-view-current-info) | ||
| 793 | (make-local-variable 'doc-view-current-search-matches) | ||
| 794 | (setq doc-view-current-doc (buffer-file-name)) | ||
| 795 | (insert-file-contents doc-view-current-doc) | ||
| 796 | (use-local-map doc-view-mode-text-map) | ||
| 797 | (setq mode-name "DocView[text]" | ||
| 798 | doc-view-current-display 'text | ||
| 799 | buffer-read-only t | ||
| 800 | revert-buffer-function 'doc-view-reconvert-doc) | ||
| 801 | ;; Switch to image display if possible | ||
| 802 | (if (and (display-images-p) | ||
| 803 | (image-type-available-p 'png) | ||
| 804 | (not (get-text-property (point-min) 'display))) | ||
| 805 | (doc-view-toggle-display)) | ||
| 806 | (message | ||
| 807 | "%s" | ||
| 808 | (substitute-command-keys | ||
| 809 | "Type \\[doc-view-toggle-display] to toggle between image and text display."))) | ||
| 747 | 810 | ||
| 748 | (defun doc-view-clear-cache () | 811 | (defun doc-view-clear-cache () |
| 749 | "Delete the whole cache (`doc-view-cache-directory')." | 812 | "Delete the whole cache (`doc-view-cache-directory')." |
diff --git a/lisp/emacs-lisp/advice.el b/lisp/emacs-lisp/advice.el index cabd0dd391e..4a5c9149a43 100644 --- a/lisp/emacs-lisp/advice.el +++ b/lisp/emacs-lisp/advice.el | |||
| @@ -2013,7 +2013,10 @@ On each iteration VAR will be bound to the name of an advised function | |||
| 2013 | (if (not (get 'ad-do-advised-functions 'lisp-indent-hook)) | 2013 | (if (not (get 'ad-do-advised-functions 'lisp-indent-hook)) |
| 2014 | (put 'ad-do-advised-functions 'lisp-indent-hook 1)) | 2014 | (put 'ad-do-advised-functions 'lisp-indent-hook 1)) |
| 2015 | 2015 | ||
| 2016 | (defmacro ad-get-advice-info (function) | 2016 | (defun ad-get-advice-info (function) |
| 2017 | (get function 'ad-advice-info)) | ||
| 2018 | |||
| 2019 | (defmacro ad-get-advice-info-macro (function) | ||
| 2017 | `(get ,function 'ad-advice-info)) | 2020 | `(get ,function 'ad-advice-info)) |
| 2018 | 2021 | ||
| 2019 | (defmacro ad-set-advice-info (function advice-info) | 2022 | (defmacro ad-set-advice-info (function advice-info) |
| @@ -2025,7 +2028,7 @@ On each iteration VAR will be bound to the name of an advised function | |||
| 2025 | (defmacro ad-is-advised (function) | 2028 | (defmacro ad-is-advised (function) |
| 2026 | "Return non-nil if FUNCTION has any advice info associated with it. | 2029 | "Return non-nil if FUNCTION has any advice info associated with it. |
| 2027 | This does not mean that the advice is also active." | 2030 | This does not mean that the advice is also active." |
| 2028 | (list 'ad-get-advice-info function)) | 2031 | (list 'ad-get-advice-info-macro function)) |
| 2029 | 2032 | ||
| 2030 | (defun ad-initialize-advice-info (function) | 2033 | (defun ad-initialize-advice-info (function) |
| 2031 | "Initialize the advice info for FUNCTION. | 2034 | "Initialize the advice info for FUNCTION. |
| @@ -2035,16 +2038,16 @@ Assumes that FUNCTION has not yet been advised." | |||
| 2035 | 2038 | ||
| 2036 | (defmacro ad-get-advice-info-field (function field) | 2039 | (defmacro ad-get-advice-info-field (function field) |
| 2037 | "Retrieve the value of the advice info FIELD of FUNCTION." | 2040 | "Retrieve the value of the advice info FIELD of FUNCTION." |
| 2038 | `(cdr (assq ,field (ad-get-advice-info ,function)))) | 2041 | `(cdr (assq ,field (ad-get-advice-info-macro ,function)))) |
| 2039 | 2042 | ||
| 2040 | (defun ad-set-advice-info-field (function field value) | 2043 | (defun ad-set-advice-info-field (function field value) |
| 2041 | "Destructively modify VALUE of the advice info FIELD of FUNCTION." | 2044 | "Destructively modify VALUE of the advice info FIELD of FUNCTION." |
| 2042 | (and (ad-is-advised function) | 2045 | (and (ad-is-advised function) |
| 2043 | (cond ((assq field (ad-get-advice-info function)) | 2046 | (cond ((assq field (ad-get-advice-info-macro function)) |
| 2044 | ;; A field with that name is already present: | 2047 | ;; A field with that name is already present: |
| 2045 | (rplacd (assq field (ad-get-advice-info function)) value)) | 2048 | (rplacd (assq field (ad-get-advice-info-macro function)) value)) |
| 2046 | (t;; otherwise, create a new field with that name: | 2049 | (t;; otherwise, create a new field with that name: |
| 2047 | (nconc (ad-get-advice-info function) | 2050 | (nconc (ad-get-advice-info-macro function) |
| 2048 | (list (cons field value))))))) | 2051 | (list (cons field value))))))) |
| 2049 | 2052 | ||
| 2050 | ;; Don't make this a macro so we can use it as a predicate: | 2053 | ;; Don't make this a macro so we can use it as a predicate: |
diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index 6a259ffd4f7..20b91b10547 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el | |||
| @@ -46,8 +46,6 @@ | |||
| 46 | 46 | ||
| 47 | ;;; Code: | 47 | ;;; Code: |
| 48 | 48 | ||
| 49 | (require 'loadhist) | ||
| 50 | |||
| 51 | ;;; User variables: | 49 | ;;; User variables: |
| 52 | 50 | ||
| 53 | (defgroup find-function nil | 51 | (defgroup find-function nil |
diff --git a/lisp/emerge.el b/lisp/emerge.el index 0c1b3b170cd..fd002409a7f 100644 --- a/lisp/emerge.el +++ b/lisp/emerge.el | |||
| @@ -633,7 +633,7 @@ This is *not* a user option, since Emerge uses it for its own processing.") | |||
| 633 | (if output-file | 633 | (if output-file |
| 634 | (concat "Output to file: " output-file) | 634 | (concat "Output to file: " output-file) |
| 635 | (concat "Output to buffer: " (buffer-name merge-buffer)))) | 635 | (concat "Output to buffer: " (buffer-name merge-buffer)))) |
| 636 | (insert-buffer emerge-A-buffer) | 636 | (save-excursion (insert-buffer-substring emerge-A-buffer)) |
| 637 | (emerge-set-keys) | 637 | (emerge-set-keys) |
| 638 | (setq emerge-difference-list (emerge-make-diff-list file-A file-B)) | 638 | (setq emerge-difference-list (emerge-make-diff-list file-A file-B)) |
| 639 | (setq emerge-number-of-differences (length emerge-difference-list)) | 639 | (setq emerge-number-of-differences (length emerge-difference-list)) |
| @@ -712,7 +712,7 @@ This is *not* a user option, since Emerge uses it for its own processing.") | |||
| 712 | (emerge-eval-in-buffer | 712 | (emerge-eval-in-buffer |
| 713 | emerge-diff-error-buffer | 713 | emerge-diff-error-buffer |
| 714 | (erase-buffer) | 714 | (erase-buffer) |
| 715 | (insert-buffer emerge-diff-buffer) | 715 | (save-excursion (insert-buffer-substring emerge-diff-buffer)) |
| 716 | (delete-matching-lines ok-regexp))) | 716 | (delete-matching-lines ok-regexp))) |
| 717 | 717 | ||
| 718 | ;;; Top-level and setup functions for three-file mode. | 718 | ;;; Top-level and setup functions for three-file mode. |
| @@ -802,7 +802,7 @@ This is *not* a user option, since Emerge uses it for its own processing.") | |||
| 802 | (if output-file | 802 | (if output-file |
| 803 | (concat "Output to file: " output-file) | 803 | (concat "Output to file: " output-file) |
| 804 | (concat "Output to buffer: " (buffer-name merge-buffer)))) | 804 | (concat "Output to buffer: " (buffer-name merge-buffer)))) |
| 805 | (insert-buffer emerge-A-buffer) | 805 | (save-excursion (insert-buffer-substring emerge-A-buffer)) |
| 806 | (emerge-set-keys) | 806 | (emerge-set-keys) |
| 807 | (setq emerge-difference-list | 807 | (setq emerge-difference-list |
| 808 | (emerge-make-diff3-list file-A file-B file-ancestor)) | 808 | (emerge-make-diff3-list file-A file-B file-ancestor)) |
diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el index d3194f3625a..f999bdcdf6d 100644 --- a/lisp/eshell/esh-cmd.el +++ b/lisp/eshell/esh-cmd.el | |||
| @@ -204,7 +204,7 @@ which may be modified directly. Any return value is ignored." | |||
| 204 | :type 'hook | 204 | :type 'hook |
| 205 | :group 'eshell-cmd) | 205 | :group 'eshell-cmd) |
| 206 | 206 | ||
| 207 | (defcustom eshell-complex-commands nil | 207 | (defcustom eshell-complex-commands '("ls") |
| 208 | "*A list of commands names or functions, that determine complexity. | 208 | "*A list of commands names or functions, that determine complexity. |
| 209 | That is, if a command is defined by a function named eshell/NAME, | 209 | That is, if a command is defined by a function named eshell/NAME, |
| 210 | and NAME is part of this list, it is invoked as a complex command. | 210 | and NAME is part of this list, it is invoked as a complex command. |
diff --git a/lisp/faces.el b/lisp/faces.el index 8a0ba7d221f..1ced221692d 100644 --- a/lisp/faces.el +++ b/lisp/faces.el | |||
| @@ -1947,8 +1947,10 @@ created." | |||
| 1947 | (modify-frame-parameters frame '((interprogram-cut-function . nil))) | 1947 | (modify-frame-parameters frame '((interprogram-cut-function . nil))) |
| 1948 | (modify-frame-parameters frame '((interprogram-paste-function . nil))) | 1948 | (modify-frame-parameters frame '((interprogram-paste-function . nil))) |
| 1949 | 1949 | ||
| 1950 | (set-locale-environment nil frame) | 1950 | (unless (terminal-parameter frame 'terminal-initted) |
| 1951 | (tty-run-terminal-initialization frame) | 1951 | (set-terminal-parameter frame 'terminal-initted t) |
| 1952 | (set-locale-environment nil frame) | ||
| 1953 | (tty-run-terminal-initialization frame)) | ||
| 1952 | (frame-set-background-mode frame) | 1954 | (frame-set-background-mode frame) |
| 1953 | (face-set-after-frame-default frame) | 1955 | (face-set-after-frame-default frame) |
| 1954 | (setq success t)) | 1956 | (setq success t)) |
| @@ -1981,10 +1983,7 @@ terminal type to a different value." | |||
| 1981 | ;; Load library for our terminal type. | 1983 | ;; Load library for our terminal type. |
| 1982 | ;; User init file can set term-file-prefix to nil to prevent this. | 1984 | ;; User init file can set term-file-prefix to nil to prevent this. |
| 1983 | (with-selected-frame frame | 1985 | (with-selected-frame frame |
| 1984 | (unless (or (null term-file-prefix) | 1986 | (unless (null term-file-prefix) |
| 1985 | ;; Don't reinitialize the terminal each time a new | ||
| 1986 | ;; frame is opened on it. | ||
| 1987 | (terminal-parameter frame 'terminal-initted)) | ||
| 1988 | (let* (term-init-func) | 1987 | (let* (term-init-func) |
| 1989 | ;; First, load the terminal initialization file, if it is | 1988 | ;; First, load the terminal initialization file, if it is |
| 1990 | ;; available and it hasn't been loaded already. | 1989 | ;; available and it hasn't been loaded already. |
diff --git a/lisp/files.el b/lisp/files.el index be28dec4c40..6d03ad24dbe 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -2060,6 +2060,7 @@ ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\)\\'" . archive-mode) | |||
| 2060 | ("\\.\\(diffs?\\|patch\\|rej\\)\\'" . diff-mode) | 2060 | ("\\.\\(diffs?\\|patch\\|rej\\)\\'" . diff-mode) |
| 2061 | ("\\.\\(dif\\|pat\\)\\'" . diff-mode) ; for MSDOG | 2061 | ("\\.\\(dif\\|pat\\)\\'" . diff-mode) ; for MSDOG |
| 2062 | ("\\.[eE]?[pP][sS]\\'" . ps-mode) | 2062 | ("\\.[eE]?[pP][sS]\\'" . ps-mode) |
| 2063 | ("\\.\\(?:PDF\\|DVI\\|pdf\\|dvi\\)" . doc-view-mode) | ||
| 2063 | ("configure\\.\\(ac\\|in\\)\\'" . autoconf-mode) | 2064 | ("configure\\.\\(ac\\|in\\)\\'" . autoconf-mode) |
| 2064 | ("BROWSE\\'" . ebrowse-tree-mode) | 2065 | ("BROWSE\\'" . ebrowse-tree-mode) |
| 2065 | ("\\.ebrowse\\'" . ebrowse-tree-mode) | 2066 | ("\\.ebrowse\\'" . ebrowse-tree-mode) |
diff --git a/lisp/filesets.el b/lisp/filesets.el index e5dde847853..d7a7dc9efa0 100644 --- a/lisp/filesets.el +++ b/lisp/filesets.el | |||
| @@ -158,7 +158,7 @@ COND-FN takes one argument: the current element." | |||
| 158 | (setq rv (append rv (list elt))))))) | 158 | (setq rv (append rv (list elt))))))) |
| 159 | 159 | ||
| 160 | (defun filesets-ormap (fsom-pred lst) | 160 | (defun filesets-ormap (fsom-pred lst) |
| 161 | "Return the tail of FSOM-LST for the head of which FSOM-PRED is non-nil." | 161 | "Return the tail of LST for the head of which FSOM-PRED is non-nil." |
| 162 | (let ((fsom-lst lst) | 162 | (let ((fsom-lst lst) |
| 163 | (fsom-rv nil)) | 163 | (fsom-rv nil)) |
| 164 | (while (and (not (null fsom-lst)) | 164 | (while (and (not (null fsom-lst)) |
| @@ -535,7 +535,7 @@ computer environments." | |||
| 535 | :group 'filesets) | 535 | :group 'filesets) |
| 536 | 536 | ||
| 537 | (defcustom filesets-sort-case-sensitive-flag t | 537 | (defcustom filesets-sort-case-sensitive-flag t |
| 538 | "Non-nil means sorting of the filesete menu is case sensitive." | 538 | "Non-nil means sorting of the filesets menu is case sensitive." |
| 539 | :set (function filesets-set-default) | 539 | :set (function filesets-set-default) |
| 540 | :type 'boolean | 540 | :type 'boolean |
| 541 | :group 'filesets) | 541 | :group 'filesets) |
| @@ -1091,10 +1091,7 @@ If NEGATIVE is non-nil, remove all directory names." | |||
| 1091 | "Return a sorted copy of LST, LST being a list of strings. | 1091 | "Return a sorted copy of LST, LST being a list of strings. |
| 1092 | If `filesets-sort-menu-flag' is nil, return LST itself. | 1092 | If `filesets-sort-menu-flag' is nil, return LST itself. |
| 1093 | 1093 | ||
| 1094 | ACCESS-FN ... function to get the string value of LST's elements. | 1094 | ACCESS-FN ... function to get the string value of LST's elements." |
| 1095 | |||
| 1096 | If SIMPLY-DO-IT is non-nil, the list is sorted regardless of | ||
| 1097 | `filesets-sort-menu-flag'." | ||
| 1098 | (if filesets-sort-menu-flag | 1095 | (if filesets-sort-menu-flag |
| 1099 | (let* ((fni (or access-fn | 1096 | (let* ((fni (or access-fn |
| 1100 | (function identity))) | 1097 | (function identity))) |
| @@ -1363,7 +1360,7 @@ not be opened." | |||
| 1363 | (find-file file))) | 1360 | (find-file file))) |
| 1364 | 1361 | ||
| 1365 | (defun filesets-find-or-display-file (&optional file viewer) | 1362 | (defun filesets-find-or-display-file (&optional file viewer) |
| 1366 | "Visit FILE using an external viewer or open it in an Emacs buffer." | 1363 | "Visit FILE using an external VIEWER or open it in an Emacs buffer." |
| 1367 | (interactive) | 1364 | (interactive) |
| 1368 | (let* ((file (or file | 1365 | (let* ((file (or file |
| 1369 | (read-file-name "Find file: " nil nil viewer))) | 1366 | (read-file-name "Find file: " nil nil viewer))) |
| @@ -1414,24 +1411,24 @@ not be opened." | |||
| 1414 | something))) | 1411 | something))) |
| 1415 | 1412 | ||
| 1416 | (defun filesets-data-get-name (entry) | 1413 | (defun filesets-data-get-name (entry) |
| 1417 | "Access to `filesets-data'. Get the entry's name." | 1414 | "Access to `filesets-data'. Get the ENTRY's name." |
| 1418 | (car entry)) | 1415 | (car entry)) |
| 1419 | 1416 | ||
| 1420 | (defun filesets-data-get-data (entry) | 1417 | (defun filesets-data-get-data (entry) |
| 1421 | "Access to `filesets-data'. Get the entry's data section." | 1418 | "Access to `filesets-data'. Get the ENTRY's data section." |
| 1422 | (cdr entry)) | 1419 | (cdr entry)) |
| 1423 | 1420 | ||
| 1424 | (defun filesets-alist-get (alist key &optional default carp) | 1421 | (defun filesets-alist-get (alist key &optional default carp) |
| 1425 | "Get KEY's value in the association list ALIST. | 1422 | "Get KEY's value in the association list ALIST. |
| 1426 | Return DEFAULT if not found. Return (car VALUE) if CARP is non-nil." | 1423 | Return DEFAULT if not found. Return (car VALUE) if CARP is non-nil." |
| 1427 | (let* ((elt (assoc key alist))) | 1424 | (let ((elt (assoc key alist))) |
| 1428 | (cond | 1425 | (cond |
| 1429 | (elt | 1426 | (elt |
| 1430 | (if carp | 1427 | (if carp |
| 1431 | (cadr elt) | 1428 | (cadr elt) |
| 1432 | (cdr elt))) | 1429 | (cdr elt))) |
| 1433 | (default default) | 1430 | (default default) |
| 1434 | (t nil)))) | 1431 | (t nil)))) |
| 1435 | 1432 | ||
| 1436 | (defun filesets-data-get (entry key &optional default carp) | 1433 | (defun filesets-data-get (entry key &optional default carp) |
| 1437 | "Extract the value for KEY in the data part of fileset ENTRY. | 1434 | "Extract the value for KEY in the data part of fileset ENTRY. |
| @@ -1439,7 +1436,7 @@ Return DEFAULT if not found. Return (car VALUE) if CARP is non-nil." | |||
| 1439 | (filesets-alist-get (filesets-data-get-data entry) key default carp)) | 1436 | (filesets-alist-get (filesets-data-get-data entry) key default carp)) |
| 1440 | 1437 | ||
| 1441 | (defun filesets-data-set (entry key value) | 1438 | (defun filesets-data-set (entry key value) |
| 1442 | "Set the value for KEY in the data part of fileset ENTRY." | 1439 | "Set the VALUE for KEY in the data part of fileset ENTRY." |
| 1443 | (let* ((alist (filesets-data-get-data entry)) | 1440 | (let* ((alist (filesets-data-get-data entry)) |
| 1444 | (elt (assoc key alist))) | 1441 | (elt (assoc key alist))) |
| 1445 | (if elt | 1442 | (if elt |
| @@ -1666,9 +1663,9 @@ Replace <file-name> or <<file-name>> with filename." | |||
| 1666 | filesets-commands))) | 1663 | filesets-commands))) |
| 1667 | 1664 | ||
| 1668 | 1665 | ||
| 1669 | ;;; sampe commands | 1666 | ;;; sample commands |
| 1670 | (defun filesets-cmd-query-replace-getargs () | 1667 | (defun filesets-cmd-query-replace-getargs () |
| 1671 | "Get arguments for `filesets-cmd-query-replace'." | 1668 | "Get arguments for `query-replace' and `query-replace-regexp'." |
| 1672 | (let* ((from-string (read-string "Filesets query replace: " | 1669 | (let* ((from-string (read-string "Filesets query replace: " |
| 1673 | "" | 1670 | "" |
| 1674 | 'query-replace-history)) | 1671 | 'query-replace-history)) |
| @@ -1875,7 +1872,7 @@ User will be queried, if no fileset name is provided." | |||
| 1875 | (browse-url filesets-homepage)) | 1872 | (browse-url filesets-homepage)) |
| 1876 | 1873 | ||
| 1877 | (defun filesets-remake-shortcut (count submenu) | 1874 | (defun filesets-remake-shortcut (count submenu) |
| 1878 | "Remake a submenus shortcut when wrapping long menus." | 1875 | "Remake a submenu's shortcut when wrapping long menus." |
| 1879 | (let* ((name (concat (filesets-get-shortcut count) | 1876 | (let* ((name (concat (filesets-get-shortcut count) |
| 1880 | (substring (elt submenu 0) 2)))) | 1877 | (substring (elt submenu 0) 2)))) |
| 1881 | (if (listp submenu) | 1878 | (if (listp submenu) |
| @@ -2032,7 +2029,7 @@ LOOKUP-NAME is used as lookup name for retrieving fileset specific settings." | |||
| 2032 | (lax-plist-put filesets-ingroup-cache emaster this)))) | 2029 | (lax-plist-put filesets-ingroup-cache emaster this)))) |
| 2033 | 2030 | ||
| 2034 | (defun filesets-ingroup-collect-files (fs &optional remdupl-flag master depth) | 2031 | (defun filesets-ingroup-collect-files (fs &optional remdupl-flag master depth) |
| 2035 | "Helper function for `filesets-ingroup-collect'. Collect file names." | 2032 | "Helper function for `filesets-ingroup-collect'. Collect file names." |
| 2036 | (let* ((master (or master | 2033 | (let* ((master (or master |
| 2037 | (filesets-entry-get-master fs))) | 2034 | (filesets-entry-get-master fs))) |
| 2038 | (remdupl-flag (or remdupl-flag | 2035 | (remdupl-flag (or remdupl-flag |
| @@ -2146,7 +2143,7 @@ FS is a fileset's name. FLIST is a list returned by | |||
| 2146 | `([,nm (filesets-file-open nil ',master ',fsn)]))))))))) | 2143 | `([,nm (filesets-file-open nil ',master ',fsn)]))))))))) |
| 2147 | 2144 | ||
| 2148 | (defun filesets-ingroup-collect (fs remdupl-flag master) | 2145 | (defun filesets-ingroup-collect (fs remdupl-flag master) |
| 2149 | "Collect names of included files & build submenu." | 2146 | "Collect names of included files and build submenu." |
| 2150 | (filesets-ingroup-cache-put master nil) | 2147 | (filesets-ingroup-cache-put master nil) |
| 2151 | (filesets-message 2 "Filesets: parsing %S" master) | 2148 | (filesets-message 2 "Filesets: parsing %S" master) |
| 2152 | (filesets-ingroup-collect-build-menu | 2149 | (filesets-ingroup-collect-build-menu |
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 89d9d75c60e..59a32921dc5 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,15 @@ | |||
| 1 | 2007-10-15 Katsumi Yamaoka <yamaoka@jpl.org> | ||
| 2 | |||
| 3 | * gnus-util.el (gnus-string<): New function. | ||
| 4 | |||
| 5 | * gnus-sum.el (gnus-article-sort-by-author) | ||
| 6 | (gnus-article-sort-by-subject): Use it. | ||
| 7 | |||
| 8 | 2007-10-15 Katsumi Yamaoka <yamaoka@jpl.org> | ||
| 9 | |||
| 10 | * gnus-win.el (gnus-configure-windows): Focus on the frame for which | ||
| 11 | the frame-focus tag is set in gnus-buffer-configuration. | ||
| 12 | |||
| 1 | 2007-10-04 Juanma Barranquero <lekktu@gmail.com> | 13 | 2007-10-04 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 14 | ||
| 3 | * sieve-manage.el (sieve-manage-interactive-login): Doc fix. | 15 | * sieve-manage.el (sieve-manage-interactive-login): Doc fix. |
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 36e93796a63..8fb18d3a990 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el | |||
| @@ -4674,7 +4674,7 @@ using some other form will lead to serious barfage." | |||
| 4674 | 4674 | ||
| 4675 | (defsubst gnus-article-sort-by-author (h1 h2) | 4675 | (defsubst gnus-article-sort-by-author (h1 h2) |
| 4676 | "Sort articles by root author." | 4676 | "Sort articles by root author." |
| 4677 | (string-lessp | 4677 | (gnus-string< |
| 4678 | (let ((extract (funcall | 4678 | (let ((extract (funcall |
| 4679 | gnus-extract-address-components | 4679 | gnus-extract-address-components |
| 4680 | (mail-header-from h1)))) | 4680 | (mail-header-from h1)))) |
| @@ -4691,7 +4691,7 @@ using some other form will lead to serious barfage." | |||
| 4691 | 4691 | ||
| 4692 | (defsubst gnus-article-sort-by-subject (h1 h2) | 4692 | (defsubst gnus-article-sort-by-subject (h1 h2) |
| 4693 | "Sort articles by root subject." | 4693 | "Sort articles by root subject." |
| 4694 | (string-lessp | 4694 | (gnus-string< |
| 4695 | (downcase (gnus-simplify-subject-re (mail-header-subject h1))) | 4695 | (downcase (gnus-simplify-subject-re (mail-header-subject h1))) |
| 4696 | (downcase (gnus-simplify-subject-re (mail-header-subject h2))))) | 4696 | (downcase (gnus-simplify-subject-re (mail-header-subject h2))))) |
| 4697 | 4697 | ||
diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el index 74aacdd2860..3d3e4148c2d 100644 --- a/lisp/gnus/gnus-util.el +++ b/lisp/gnus/gnus-util.el | |||
| @@ -290,6 +290,15 @@ is slower." | |||
| 290 | (not (or (string< s1 s2) | 290 | (not (or (string< s1 s2) |
| 291 | (string= s1 s2)))) | 291 | (string= s1 s2)))) |
| 292 | 292 | ||
| 293 | (defun gnus-string< (s1 s2) | ||
| 294 | "Return t if first arg string is less than second in lexicographic order. | ||
| 295 | Case is significant if and only if `case-fold-search' is nil. | ||
| 296 | Symbols are also allowed; their print names are used instead." | ||
| 297 | (if case-fold-search | ||
| 298 | (string-lessp (downcase (if (symbolp s1) (symbol-name s1) s1)) | ||
| 299 | (downcase (if (symbolp s2) (symbol-name s2) s2))) | ||
| 300 | (string-lessp s1 s2))) | ||
| 301 | |||
| 293 | ;;; Time functions. | 302 | ;;; Time functions. |
| 294 | 303 | ||
| 295 | (defun gnus-file-newer-than (file date) | 304 | (defun gnus-file-newer-than (file date) |
diff --git a/lisp/gnus/gnus-win.el b/lisp/gnus/gnus-win.el index 5c57aaa1886..7e1609cc196 100644 --- a/lisp/gnus/gnus-win.el +++ b/lisp/gnus/gnus-win.el | |||
| @@ -471,7 +471,8 @@ See the Gnus manual for an explanation of the syntax used.") | |||
| 471 | (gnus-configure-frame split) | 471 | (gnus-configure-frame split) |
| 472 | (run-hooks 'gnus-configure-windows-hook) | 472 | (run-hooks 'gnus-configure-windows-hook) |
| 473 | (when gnus-window-frame-focus | 473 | (when gnus-window-frame-focus |
| 474 | (select-frame (window-frame gnus-window-frame-focus)))))))) | 474 | (gnus-select-frame-set-input-focus |
| 475 | (window-frame gnus-window-frame-focus)))))))) | ||
| 475 | 476 | ||
| 476 | (defun gnus-delete-windows-in-gnusey-frames () | 477 | (defun gnus-delete-windows-in-gnusey-frames () |
| 477 | "Do a `delete-other-windows' in all frames that have Gnus windows." | 478 | "Do a `delete-other-windows' in all frames that have Gnus windows." |
diff --git a/lisp/help-fns.el b/lisp/help-fns.el index bf8d5f9a209..befd83c76ef 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el | |||
| @@ -239,7 +239,7 @@ face (according to `face-differs-from-default-p')." | |||
| 239 | ".elc")) | 239 | ".elc")) |
| 240 | load-path)) | 240 | load-path)) |
| 241 | (str (if (and elc-file (file-readable-p elc-file)) | 241 | (str (if (and elc-file (file-readable-p elc-file)) |
| 242 | (with-temp-buffer | 242 | (with-temp-buffer |
| 243 | (insert-file-contents-literally elc-file nil 0 256) | 243 | (insert-file-contents-literally elc-file nil 0 256) |
| 244 | (buffer-string)))) | 244 | (buffer-string)))) |
| 245 | (src-file (and str | 245 | (src-file (and str |
diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el index 7847bed6f2d..2c39b736097 100644 --- a/lisp/ibuf-ext.el +++ b/lisp/ibuf-ext.el | |||
| @@ -180,8 +180,8 @@ QUALIFIERS is a list of the same form as | |||
| 180 | 180 | ||
| 181 | See also the variables `ibuffer-filter-groups', | 181 | See also the variables `ibuffer-filter-groups', |
| 182 | `ibuffer-filtering-qualifiers', `ibuffer-filtering-alist', and the | 182 | `ibuffer-filtering-qualifiers', `ibuffer-filtering-alist', and the |
| 183 | functions `ibuffer-switch-to-saved-filter-group', | 183 | functions `ibuffer-switch-to-saved-filter-groups', |
| 184 | `ibuffer-save-filter-group'." | 184 | `ibuffer-save-filter-groups'." |
| 185 | :type '(repeat sexp) | 185 | :type '(repeat sexp) |
| 186 | :group 'ibuffer) | 186 | :group 'ibuffer) |
| 187 | 187 | ||
diff --git a/lisp/indent.el b/lisp/indent.el index db8958bd1ca..77354444cfa 100644 --- a/lisp/indent.el +++ b/lisp/indent.el | |||
| @@ -86,10 +86,10 @@ If `transient-mark-mode' is turned on the region is active, | |||
| 86 | indent the region. | 86 | indent the region. |
| 87 | The function actually called to indent the line is determined by the value of | 87 | The function actually called to indent the line is determined by the value of |
| 88 | `indent-line-function'." | 88 | `indent-line-function'." |
| 89 | (interactive "P") | 89 | (interactive "p") |
| 90 | (cond | 90 | (cond |
| 91 | ;; The region is active, indent it. | 91 | ;; The region is active, indent it. |
| 92 | ((and transient-mark-mode mark-active | 92 | ((and arg transient-mark-mode mark-active |
| 93 | (not (eq (region-beginning) (region-end)))) | 93 | (not (eq (region-beginning) (region-end)))) |
| 94 | (indent-region (region-beginning) (region-end))) | 94 | (indent-region (region-beginning) (region-end))) |
| 95 | ((or ;; indent-to-left-margin is only meant for indenting, | 95 | ((or ;; indent-to-left-margin is only meant for indenting, |
diff --git a/lisp/international/encoded-kb.el b/lisp/international/encoded-kb.el index 1ebdcd5cabd..d482b465250 100644 --- a/lisp/international/encoded-kb.el +++ b/lisp/international/encoded-kb.el | |||
| @@ -338,38 +338,63 @@ DISPLAY may be a display id, a frame, or nil for the selected frame's display." | |||
| 338 | (when frame | 338 | (when frame |
| 339 | (with-selected-frame frame | 339 | (with-selected-frame frame |
| 340 | ;; Remove any previous encoded-kb keymap from input-decode-map. | 340 | ;; Remove any previous encoded-kb keymap from input-decode-map. |
| 341 | (let ((m input-decode-map)) | 341 | (let ((m input-decode-map) |
| 342 | (if (equal (keymap-prompt m) "encoded-kb") | 342 | (child nil)) |
| 343 | (setq input-decode-map (keymap-parent m)) | 343 | (while (keymapp m) |
| 344 | (while (keymap-parent m) | 344 | (if (not (equal (keymap-prompt m) "encoded-kb")) |
| 345 | (if (equal (keymap-prompt (keymap-parent m)) "encoded-kb") | 345 | (progn |
| 346 | (set-keymap-parent m (keymap-parent (keymap-parent m)))) | 346 | (setq child m) |
| 347 | (setq m (keymap-parent m))))) | 347 | (setq m (keymap-parent m))) |
| 348 | 348 | ;; We've found an encoded-kb map, but maybe the prompt we get | |
| 349 | (if (keyboard-coding-system) | 349 | ;; is really inherited from the encoded-kb map. |
| 350 | ;; We are turning on Encoded-kbd mode. | 350 | (let (mp) |
| 351 | (let ((coding (keyboard-coding-system)) | 351 | (while (and (keymapp (setq mp (keymap-parent m))) |
| 352 | (keymap (make-sparse-keymap "encoded-kb")) | 352 | (equal (keymap-prompt mp) "encoded-kb")) |
| 353 | (cim (current-input-mode)) | 353 | (setq child m) |
| 354 | result) | 354 | (setq m mp)) |
| 355 | (set-keymap-parent keymap input-decode-map) | 355 | ;; (assert (equal (keymap-prompt m) "encoded-kb")) |
| 356 | (setq input-decode-map keymap) | 356 | ;; (assert (eq mp (keymap-parent m))) |
| 357 | (unless (terminal-parameter nil 'encoded-kbd-saved-input-meta-mode) | 357 | ;; (assert (not (and (keymapp mp) |
| 358 | (set-terminal-parameter nil 'encoded-kbd-saved-input-mode (nth 2 cim))) | 358 | ;; (equal (keymap-prompt mp) "encoded-kb")))) |
| 359 | (setq result (and coding (encoded-kbd-setup-keymap keymap coding))) | 359 | ;; (assert (eq m (if child |
| 360 | (if result | 360 | ;; (keymap-parent child) input-decode-map))) |
| 361 | (when (and (eq result 8) | 361 | ;; We can finally do the actual removal. |
| 362 | (memq (nth 2 cim) '(t nil))) | 362 | (if child |
| 363 | (set-input-meta-mode 'use-8th-bit)) | 363 | (set-keymap-parent child mp) |
| 364 | (set-terminal-parameter nil 'encoded-kbd-saved-input-meta-mode nil) | 364 | (setq input-decode-map mp)) |
| 365 | (error "Unsupported coding system in Encoded-kbd mode: %S" | 365 | (setq m mp)))))) |
| 366 | coding))) | 366 | |
| 367 | ;; We are turning off Encoded-kbd mode. | 367 | (if (keyboard-coding-system) |
| 368 | (when (and (terminal-parameter nil 'encoded-kbd-saved-input-meta-mode) | 368 | ;; We are turning on Encoded-kbd mode. |
| 369 | (not (equal (nth 2 (current-input-mode)) | 369 | (let ((coding (keyboard-coding-system)) |
| 370 | (terminal-parameter nil 'encoded-kbd-saved-input-meta-mode)))) | 370 | (keymap (make-sparse-keymap "encoded-kb")) |
| 371 | (set-input-meta-mode (terminal-parameter nil 'encoded-kbd-saved-input-meta-mode))) | 371 | (cim (current-input-mode)) |
| 372 | (set-terminal-parameter nil 'saved-input-meta-mode nil)))))) | 372 | result) |
| 373 | ;; Place `keymap' as the immediate parent of input-decode-map | ||
| 374 | ;; rather than on top, so that later `define-key' on | ||
| 375 | ;; input-decode-map don't end up accidentally changing our | ||
| 376 | ;; part of the keymap, which would lead to bugs when/if we later | ||
| 377 | ;; on remove that part. | ||
| 378 | (set-keymap-parent keymap (keymap-parent input-decode-map)) | ||
| 379 | (set-keymap-parent input-decode-map keymap) | ||
| 380 | (unless (terminal-parameter nil 'encoded-kbd-saved-input-meta-mode) | ||
| 381 | (set-terminal-parameter nil 'encoded-kbd-saved-input-mode | ||
| 382 | (nth 2 cim))) | ||
| 383 | (setq result (and coding (encoded-kbd-setup-keymap keymap coding))) | ||
| 384 | (if result | ||
| 385 | (when (and (eq result 8) | ||
| 386 | (memq (nth 2 cim) '(t nil))) | ||
| 387 | (set-input-meta-mode 'use-8th-bit)) | ||
| 388 | (set-terminal-parameter | ||
| 389 | nil 'encoded-kbd-saved-input-meta-mode nil) | ||
| 390 | (error "Unsupported coding system in Encoded-kbd mode: %S" | ||
| 391 | coding))) | ||
| 392 | ;; We are turning off Encoded-kbd mode. | ||
| 393 | (let ((old (terminal-parameter nil 'encoded-kbd-saved-input-meta-mode))) | ||
| 394 | (when (and old (not (equal (nth 2 (current-input-mode)) old))) | ||
| 395 | (set-input-meta-mode old)) | ||
| 396 | (set-terminal-parameter | ||
| 397 | nil 'encoded-kbd-saved-input-meta-mode nil)))))) | ||
| 373 | 398 | ||
| 374 | (provide 'encoded-kb) | 399 | (provide 'encoded-kb) |
| 375 | 400 | ||
diff --git a/lisp/loadhist.el b/lisp/loadhist.el index 4e9ee480d65..95de0d822a3 100644 --- a/lisp/loadhist.el +++ b/lisp/loadhist.el | |||
| @@ -38,12 +38,11 @@ | |||
| 38 | "Return the file and list of definitions associated with FEATURE. | 38 | "Return the file and list of definitions associated with FEATURE. |
| 39 | The value is actually the element of `load-history' | 39 | The value is actually the element of `load-history' |
| 40 | for the file that did (provide FEATURE)." | 40 | for the file that did (provide FEATURE)." |
| 41 | (catch 'foundit | 41 | (catch 'foundit |
| 42 | (mapc (lambda (x) | 42 | (let ((element (cons 'provide feature))) |
| 43 | (if (member (cons 'provide feature) (cdr x)) | 43 | (dolist (x load-history nil) |
| 44 | (throw 'foundit x))) | 44 | (when (member element (cdr x)) |
| 45 | load-history) | 45 | (throw 'foundit x)))))) |
| 46 | nil)) | ||
| 47 | 46 | ||
| 48 | (defun feature-file (feature) | 47 | (defun feature-file (feature) |
| 49 | "Return the file name from which a given FEATURE was loaded. | 48 | "Return the file name from which a given FEATURE was loaded. |
| @@ -72,32 +71,25 @@ A library name is equivalent to the file name that `load-library' would load." | |||
| 72 | "Return the list of features provided by FILE as it was loaded. | 71 | "Return the list of features provided by FILE as it was loaded. |
| 73 | FILE can be a file name, or a library name. | 72 | FILE can be a file name, or a library name. |
| 74 | A library name is equivalent to the file name that `load-library' would load." | 73 | A library name is equivalent to the file name that `load-library' would load." |
| 75 | (let ((symbols (file-loadhist-lookup file)) | 74 | (let (provides) |
| 76 | provides) | 75 | (dolist (x (file-loadhist-lookup file) provides) |
| 77 | (mapc (lambda (x) | 76 | (when (eq (car-safe x) 'provide) |
| 78 | (if (and (consp x) (eq (car x) 'provide)) | 77 | (push x provides))))) |
| 79 | (setq provides (cons (cdr x) provides)))) | ||
| 80 | symbols) | ||
| 81 | provides)) | ||
| 82 | 78 | ||
| 83 | (defun file-requires (file) | 79 | (defun file-requires (file) |
| 84 | "Return the list of features required by FILE as it was loaded. | 80 | "Return the list of features required by FILE as it was loaded. |
| 85 | FILE can be a file name, or a library name. | 81 | FILE can be a file name, or a library name. |
| 86 | A library name is equivalent to the file name that `load-library' would load." | 82 | A library name is equivalent to the file name that `load-library' would load." |
| 87 | (let ((symbols (file-loadhist-lookup file)) | 83 | (let (requires) |
| 88 | requires) | 84 | (dolist (x (file-loadhist-lookup file) requires) |
| 89 | (mapc (lambda (x) | 85 | (when (eq (car-safe x) 'require) |
| 90 | (if (and (consp x) (eq (car x) 'require)) | 86 | (push x requires))))) |
| 91 | (setq requires (cons (cdr x) requires)))) | ||
| 92 | symbols) | ||
| 93 | requires)) | ||
| 94 | 87 | ||
| 95 | (defsubst file-set-intersect (p q) | 88 | (defsubst file-set-intersect (p q) |
| 96 | "Return the set intersection of two lists." | 89 | "Return the set intersection of two lists." |
| 97 | (let ((ret nil)) | 90 | (let (ret) |
| 98 | (dolist (x p ret) | 91 | (dolist (x p ret) |
| 99 | (if (memq x q) (setq ret (cons x ret)))) | 92 | (when (memq x q) (push x ret))))) |
| 100 | ret)) | ||
| 101 | 93 | ||
| 102 | (defun file-dependents (file) | 94 | (defun file-dependents (file) |
| 103 | "Return the list of loaded libraries that depend on FILE. | 95 | "Return the list of loaded libraries that depend on FILE. |
| @@ -107,9 +99,8 @@ A library name is equivalent to the file name that `load-library' would load." | |||
| 107 | (let ((provides (file-provides file)) | 99 | (let ((provides (file-provides file)) |
| 108 | (dependents nil)) | 100 | (dependents nil)) |
| 109 | (dolist (x load-history dependents) | 101 | (dolist (x load-history dependents) |
| 110 | (if (file-set-intersect provides (file-requires (car x))) | 102 | (when (file-set-intersect provides (file-requires (car x))) |
| 111 | (setq dependents (cons (car x) dependents)))) | 103 | (push (car x) dependents))))) |
| 112 | dependents)) | ||
| 113 | 104 | ||
| 114 | (defun read-feature (prompt &optional loaded-p) | 105 | (defun read-feature (prompt &optional loaded-p) |
| 115 | "Read feature name from the minibuffer, prompting with string PROMPT. | 106 | "Read feature name from the minibuffer, prompting with string PROMPT. |
| @@ -126,15 +117,19 @@ from a file." | |||
| 126 | 117 | ||
| 127 | (defvaralias 'loadhist-hook-functions 'unload-feature-special-hooks) | 118 | (defvaralias 'loadhist-hook-functions 'unload-feature-special-hooks) |
| 128 | (defvar unload-feature-special-hooks | 119 | (defvar unload-feature-special-hooks |
| 129 | '(after-change-functions | 120 | '(after-change-functions after-insert-file-functions |
| 130 | after-insert-file-functions auto-fill-function | 121 | after-make-frame-functions auto-fill-function before-change-functions |
| 131 | before-change-functions blink-paren-function | 122 | blink-paren-function buffer-access-fontify-functions command-line-functions |
| 132 | buffer-access-fontify-functions command-line-functions | 123 | comment-indent-function compilation-finish-functions |
| 133 | comment-indent-function kill-buffer-query-functions | 124 | disabled-command-function find-file-not-found-functions |
| 134 | kill-emacs-query-functions lisp-indent-function | 125 | font-lock-beginning-of-syntax-function font-lock-fontify-buffer-function |
| 135 | mouse-position-function | 126 | font-lock-fontify-region-function font-lock-mark-block-function |
| 127 | font-lock-syntactic-face-function font-lock-unfontify-buffer-function | ||
| 128 | font-lock-unfontify-region-function kill-buffer-query-functions | ||
| 129 | kill-emacs-query-functions lisp-indent-function mouse-position-function | ||
| 136 | redisplay-end-trigger-functions temp-buffer-show-function | 130 | redisplay-end-trigger-functions temp-buffer-show-function |
| 137 | window-scroll-functions window-size-change-functions | 131 | window-scroll-functions window-size-change-functions |
| 132 | write-contents-functions write-file-functions | ||
| 138 | write-region-annotate-functions) | 133 | write-region-annotate-functions) |
| 139 | "A list of special hooks from Info node `(elisp)Standard Hooks'. | 134 | "A list of special hooks from Info node `(elisp)Standard Hooks'. |
| 140 | 135 | ||
diff --git a/lisp/longlines.el b/lisp/longlines.el index 07977910a22..c820150c27a 100644 --- a/lisp/longlines.el +++ b/lisp/longlines.el | |||
| @@ -55,7 +55,11 @@ when the file is saved to disk." | |||
| 55 | "Non-nil means wrapping and filling happen at the edge of the window. | 55 | "Non-nil means wrapping and filling happen at the edge of the window. |
| 56 | Otherwise, `fill-column' is used, regardless of the window size. This | 56 | Otherwise, `fill-column' is used, regardless of the window size. This |
| 57 | does not work well when the buffer is displayed in multiple windows | 57 | does not work well when the buffer is displayed in multiple windows |
| 58 | with differing widths." | 58 | with differing widths. |
| 59 | |||
| 60 | If the value is an integer, that specifies the distance from the | ||
| 61 | right edge of the window at which wrapping occurs. For any other | ||
| 62 | non-nil value, wrapping occurs 2 characters from the right edge." | ||
| 59 | :group 'longlines | 63 | :group 'longlines |
| 60 | :type 'boolean) | 64 | :type 'boolean) |
| 61 | 65 | ||
| @@ -117,8 +121,14 @@ are indicated with a symbol." | |||
| 117 | 'longlines-search-function) | 121 | 'longlines-search-function) |
| 118 | (add-to-list 'buffer-substring-filters 'longlines-encode-string) | 122 | (add-to-list 'buffer-substring-filters 'longlines-encode-string) |
| 119 | (when longlines-wrap-follows-window-size | 123 | (when longlines-wrap-follows-window-size |
| 120 | (set (make-local-variable 'fill-column) | 124 | (let ((dw (if (and (integerp longlines-wrap-follows-window-size) |
| 121 | (- (window-width) window-min-width)) | 125 | (>= longlines-wrap-follows-window-size 0) |
| 126 | (< longlines-wrap-follows-window-size | ||
| 127 | (window-width))) | ||
| 128 | longlines-wrap-follows-window-size | ||
| 129 | 2))) | ||
| 130 | (set (make-local-variable 'fill-column) | ||
| 131 | (- (window-width) dw))) | ||
| 122 | (add-hook 'window-configuration-change-hook | 132 | (add-hook 'window-configuration-change-hook |
| 123 | 'longlines-window-change-function nil t)) | 133 | 'longlines-window-change-function nil t)) |
| 124 | (let ((buffer-undo-list t) | 134 | (let ((buffer-undo-list t) |
| @@ -415,9 +425,14 @@ This is called by `post-command-hook' after each command." | |||
| 415 | (defun longlines-window-change-function () | 425 | (defun longlines-window-change-function () |
| 416 | "Re-wrap the buffer if the window width has changed. | 426 | "Re-wrap the buffer if the window width has changed. |
| 417 | This is called by `window-configuration-change-hook'." | 427 | This is called by `window-configuration-change-hook'." |
| 418 | (when (/= fill-column (- (window-width) window-min-width)) | 428 | (let ((dw (if (and (integerp longlines-wrap-follows-window-size) |
| 419 | (setq fill-column (- (window-width) window-min-width)) | 429 | (>= longlines-wrap-follows-window-size 0) |
| 420 | (longlines-wrap-region (point-min) (point-max)))) | 430 | (< longlines-wrap-follows-window-size (window-width))) |
| 431 | longlines-wrap-follows-window-size | ||
| 432 | 2))) | ||
| 433 | (when (/= fill-column (- (window-width) dw)) | ||
| 434 | (setq fill-column (- (window-width) dw)) | ||
| 435 | (longlines-wrap-region (point-min) (point-max))))) | ||
| 421 | 436 | ||
| 422 | ;; Isearch | 437 | ;; Isearch |
| 423 | 438 | ||
diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el index 34a0aa0ad82..e8d896be246 100644 --- a/lisp/mail/sendmail.el +++ b/lisp/mail/sendmail.el | |||
| @@ -991,6 +991,19 @@ See also the function `select-message-coding-system'.") | |||
| 991 | nil) | 991 | nil) |
| 992 | (t (error "Invalid value for `mail-from-style'"))))) | 992 | (t (error "Invalid value for `mail-from-style'"))))) |
| 993 | 993 | ||
| 994 | ;; Normally you will not need to modify these options unless you are | ||
| 995 | ;; using some non-genuine substitute for sendmail which does not | ||
| 996 | ;; implement each and every option that the original supports. | ||
| 997 | ;; E.g., ssmtp does not support "-odb", so, if your site uses it, | ||
| 998 | ;; you will need to modify `sendmail-error-reporting-non-interactive' | ||
| 999 | ;; in your site-init.el. | ||
| 1000 | (defvar sendmail-error-reporting-interactive | ||
| 1001 | ;; These mean "report errors to terminal" and "deliver interactively" | ||
| 1002 | '("-oep" "-odi")) | ||
| 1003 | (defvar sendmail-error-reporting-non-interactive | ||
| 1004 | ;; These mean "report errors by mail" and "deliver in background". | ||
| 1005 | '("-oem" "-odb")) | ||
| 1006 | |||
| 994 | (defun sendmail-send-it () | 1007 | (defun sendmail-send-it () |
| 995 | "Send the current mail buffer using the Sendmail package. | 1008 | "Send the current mail buffer using the Sendmail package. |
| 996 | This is a suitable value for `send-mail-function'. It sends using the | 1009 | This is a suitable value for `send-mail-function'. It sends using the |
| @@ -1135,12 +1148,8 @@ external program defined by `sendmail-program'." | |||
| 1135 | (and mail-alias-file | 1148 | (and mail-alias-file |
| 1136 | (list (concat "-oA" mail-alias-file))) | 1149 | (list (concat "-oA" mail-alias-file))) |
| 1137 | (if mail-interactive | 1150 | (if mail-interactive |
| 1138 | ;; These mean "report errors to terminal" | 1151 | sendmail-error-reporting-interactive |
| 1139 | ;; and "deliver interactively" | 1152 | sendmail-error-reporting-non-interactive) |
| 1140 | '("-oep" "-odi") | ||
| 1141 | ;; These mean "report errors by mail" | ||
| 1142 | ;; and "deliver in background". | ||
| 1143 | '("-oem" "-odb")) | ||
| 1144 | ;; Get the addresses from the message | 1153 | ;; Get the addresses from the message |
| 1145 | ;; unless this is a resend. | 1154 | ;; unless this is a resend. |
| 1146 | ;; We must not do that for a resend | 1155 | ;; We must not do that for a resend |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index c8b2a72aad0..0af9c457995 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -2092,12 +2092,13 @@ been set up by `rfn-eshadow-setup-minibuffer'." | |||
| 2092 | (symbol-value 'rfn-eshadow-overlay)) | 2092 | (symbol-value 'rfn-eshadow-overlay)) |
| 2093 | (funcall (symbol-function 'minibuffer-prompt-end))))) | 2093 | (funcall (symbol-function 'minibuffer-prompt-end))))) |
| 2094 | (when (file-remote-p (buffer-substring-no-properties end (point-max))) | 2094 | (when (file-remote-p (buffer-substring-no-properties end (point-max))) |
| 2095 | (narrow-to-region | 2095 | (save-excursion |
| 2096 | (1+ (or (string-match "/" (buffer-string) end) end)) (point-max)) | 2096 | (save-restriction |
| 2097 | (let ((rfn-eshadow-overlay tramp-rfn-eshadow-overlay) | 2097 | (narrow-to-region |
| 2098 | (rfn-eshadow-update-overlay-hook nil)) | 2098 | (1+ (or (string-match "/" (buffer-string) end) end)) (point-max)) |
| 2099 | (funcall (symbol-function 'rfn-eshadow-update-overlay))) | 2099 | (let ((rfn-eshadow-overlay tramp-rfn-eshadow-overlay) |
| 2100 | (widen)))) | 2100 | (rfn-eshadow-update-overlay-hook nil)) |
| 2101 | (funcall (symbol-function 'rfn-eshadow-update-overlay)))))))) | ||
| 2101 | 2102 | ||
| 2102 | (when (boundp 'rfn-eshadow-update-overlay-hook) | 2103 | (when (boundp 'rfn-eshadow-update-overlay-hook) |
| 2103 | (add-hook 'rfn-eshadow-update-overlay-hook | 2104 | (add-hook 'rfn-eshadow-update-overlay-hook |
diff --git a/lisp/progmodes/cc-menus.el b/lisp/progmodes/cc-menus.el index 95359689b9f..eced014d4e6 100644 --- a/lisp/progmodes/cc-menus.el +++ b/lisp/progmodes/cc-menus.el | |||
| @@ -106,7 +106,9 @@ A sample value might look like: `\\(_P\\|_PROTO\\)'.") | |||
| 106 | (nil | 106 | (nil |
| 107 | ,(concat | 107 | ,(concat |
| 108 | "^\\<" ; line MUST start with word char | 108 | "^\\<" ; line MUST start with word char |
| 109 | "[^()]*" ; no parentheses before | 109 | ;; \n added to prevent overflow in regexp matcher. |
| 110 | ;; http://lists.gnu.org/archive/html/emacs-pretest-bug/2007-02/msg00021.html | ||
| 111 | "[^()\n]*" ; no parentheses before | ||
| 110 | "[^" c-alnum "_:<>~]" ; match any non-identifier char | 112 | "[^" c-alnum "_:<>~]" ; match any non-identifier char |
| 111 | "\\([" c-alpha "_][" c-alnum "_:<>~]*\\)" ; match function name | 113 | "\\([" c-alpha "_][" c-alnum "_:<>~]*\\)" ; match function name |
| 112 | "\\([ \t\n]\\|\\\\\n\\)*(" ; see above, BUT the arg list | 114 | "\\([ \t\n]\\|\\\\\n\\)*(" ; see above, BUT the arg list |
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 9ed7ba09de9..482cfee1b9b 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el | |||
| @@ -1658,10 +1658,15 @@ This is the value of `next-error-function' in Compilation buffers." | |||
| 1658 | ;; in the same process and buffer). | 1658 | ;; in the same process and buffer). |
| 1659 | ;; So, recalculate all markers for that file. | 1659 | ;; So, recalculate all markers for that file. |
| 1660 | (unless (and (nth 3 loc) (marker-buffer (nth 3 loc)) | 1660 | (unless (and (nth 3 loc) (marker-buffer (nth 3 loc)) |
| 1661 | (equal (nth 4 loc) | 1661 | ;; There may be no timestamp info if the loc is a `fake-loc'. |
| 1662 | (setq timestamp | 1662 | ;; So we skip the time-check here, although we should maybe |
| 1663 | (with-current-buffer (marker-buffer (nth 3 loc)) | 1663 | ;; change `compilation-fake-loc' to add timestamp info. |
| 1664 | (visited-file-modtime))))) | 1664 | (or (null (nth 4 loc)) |
| 1665 | (equal (nth 4 loc) | ||
| 1666 | (setq timestamp | ||
| 1667 | (with-current-buffer | ||
| 1668 | (marker-buffer (nth 3 loc)) | ||
| 1669 | (visited-file-modtime)))))) | ||
| 1665 | (with-current-buffer (compilation-find-file marker (caar (nth 2 loc)) | 1670 | (with-current-buffer (compilation-find-file marker (caar (nth 2 loc)) |
| 1666 | (cadr (car (nth 2 loc)))) | 1671 | (cadr (car (nth 2 loc)))) |
| 1667 | (save-restriction | 1672 | (save-restriction |
| @@ -1711,7 +1716,7 @@ region and the first line of the next region." | |||
| 1711 | (or (consp file) (setq file (list file))) | 1716 | (or (consp file) (setq file (list file))) |
| 1712 | (setq file (compilation-get-file-structure file)) | 1717 | (setq file (compilation-get-file-structure file)) |
| 1713 | ;; Between the current call to compilation-fake-loc and the first occurrence | 1718 | ;; Between the current call to compilation-fake-loc and the first occurrence |
| 1714 | ;; of an error message referring to `file', the data is only kept is the | 1719 | ;; of an error message referring to `file', the data is only kept in the |
| 1715 | ;; weak hash-table compilation-locs, so we need to prevent this entry | 1720 | ;; weak hash-table compilation-locs, so we need to prevent this entry |
| 1716 | ;; in compilation-locs from being GC'd away. --Stef | 1721 | ;; in compilation-locs from being GC'd away. --Stef |
| 1717 | (push file compilation-gcpro) | 1722 | (push file compilation-gcpro) |
diff --git a/lisp/progmodes/delphi.el b/lisp/progmodes/delphi.el index 6cbef6f426d..7c2417fde1a 100644 --- a/lisp/progmodes/delphi.el +++ b/lisp/progmodes/delphi.el | |||
| @@ -1642,7 +1642,7 @@ before the indent, the point is moved to the indent." | |||
| 1642 | (when delphi-newline-always-indents | 1642 | (when delphi-newline-always-indents |
| 1643 | ;; Indent both the (now) previous and current line first. | 1643 | ;; Indent both the (now) previous and current line first. |
| 1644 | (save-excursion | 1644 | (save-excursion |
| 1645 | (previous-line 1) | 1645 | (forward-line -1) |
| 1646 | (delphi-indent-line)) | 1646 | (delphi-indent-line)) |
| 1647 | (delphi-indent-line))) | 1647 | (delphi-indent-line))) |
| 1648 | 1648 | ||
diff --git a/lisp/server.el b/lisp/server.el index 22b947ea9f8..70d2283b0eb 100644 --- a/lisp/server.el +++ b/lisp/server.el | |||
| @@ -325,7 +325,10 @@ message." | |||
| 325 | 325 | ||
| 326 | (defun server-select-display (display) | 326 | (defun server-select-display (display) |
| 327 | ;; If the current frame is on `display' we're all set. | 327 | ;; If the current frame is on `display' we're all set. |
| 328 | (unless (equal (frame-parameter (selected-frame) 'display) display) | 328 | ;; Similarly if we are unable to open a frames on other displays, there's |
| 329 | ;; nothing more we can do. | ||
| 330 | (unless (or (not (fboundp 'make-frame-on-display)) | ||
| 331 | (equal (frame-parameter (selected-frame) 'display) display)) | ||
| 329 | ;; Otherwise, look for an existing frame there and select it. | 332 | ;; Otherwise, look for an existing frame there and select it. |
| 330 | (dolist (frame (frame-list)) | 333 | (dolist (frame (frame-list)) |
| 331 | (when (equal (frame-parameter frame 'display) display) | 334 | (when (equal (frame-parameter frame 'display) display) |
| @@ -505,11 +508,11 @@ kill any existing server communications subprocess." | |||
| 505 | (when server-use-tcp | 508 | (when server-use-tcp |
| 506 | (let ((auth-key | 509 | (let ((auth-key |
| 507 | (loop | 510 | (loop |
| 508 | ;; The auth key is a 64-byte string of random chars in the | 511 | ;; The auth key is a 64-byte string of random chars in the |
| 509 | ;; range `!'..`~'. | 512 | ;; range `!'..`~'. |
| 510 | for i below 64 | 513 | for i below 64 |
| 511 | collect (+ 33 (random 94)) into auth | 514 | collect (+ 33 (random 94)) into auth |
| 512 | finally return (concat auth)))) | 515 | finally return (concat auth)))) |
| 513 | (process-put server-process :auth-key auth-key) | 516 | (process-put server-process :auth-key auth-key) |
| 514 | (with-temp-file server-file | 517 | (with-temp-file server-file |
| 515 | (set-buffer-multibyte nil) | 518 | (set-buffer-multibyte nil) |
| @@ -831,8 +834,8 @@ The following commands are accepted by the client: | |||
| 831 | ;; Open X frames on the given display instead of the default. | 834 | ;; Open X frames on the given display instead of the default. |
| 832 | ((and (equal "-display" arg) | 835 | ((and (equal "-display" arg) |
| 833 | (string-match "\\([^ ]*\\) " request)) | 836 | (string-match "\\([^ ]*\\) " request)) |
| 834 | (setq display (match-string 1 request) | 837 | (setq display (match-string 1 request)) |
| 835 | request (substring request (match-end 0)))) | 838 | (setq request (substring request (match-end 0)))) |
| 836 | 839 | ||
| 837 | ;; -window-system: Open a new X frame. | 840 | ;; -window-system: Open a new X frame. |
| 838 | ((equal "-window-system" arg) | 841 | ((equal "-window-system" arg) |
diff --git a/lisp/simple.el b/lisp/simple.el index f2055faf385..5c3b55edd7b 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -1,7 +1,8 @@ | |||
| 1 | ;;; simple.el --- basic editing commands for Emacs | 1 | ;;; simple.el --- basic editing commands for Emacs |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1996, 1997, 1998, 1999, | 3 | ;; Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1996, 1997, 1998, 1999, |
| 4 | ;; 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. | 4 | ;; 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 |
| 5 | ;; Free Software Foundation, Inc. | ||
| 5 | 6 | ||
| 6 | ;; Maintainer: FSF | 7 | ;; Maintainer: FSF |
| 7 | ;; Keywords: internal | 8 | ;; Keywords: internal |
| @@ -632,7 +633,9 @@ column specified by the function `current-left-margin'." | |||
| 632 | (newline) | 633 | (newline) |
| 633 | (save-excursion | 634 | (save-excursion |
| 634 | (goto-char pos) | 635 | (goto-char pos) |
| 635 | (indent-according-to-mode) | 636 | ;; Usually indent-according-to-mode should "preserve" point, but it is |
| 637 | ;; not guaranteed; e.g. indent-to-left-margin doesn't. | ||
| 638 | (save-excursion (indent-according-to-mode)) | ||
| 636 | (delete-horizontal-space t)) | 639 | (delete-horizontal-space t)) |
| 637 | (indent-according-to-mode))) | 640 | (indent-according-to-mode))) |
| 638 | 641 | ||
| @@ -2561,6 +2564,11 @@ of the Emacs kill ring should be used. If the function returns a | |||
| 2561 | string, then the caller of the function \(usually `current-kill') | 2564 | string, then the caller of the function \(usually `current-kill') |
| 2562 | should put this string in the kill ring as the latest kill. | 2565 | should put this string in the kill ring as the latest kill. |
| 2563 | 2566 | ||
| 2567 | This function may also return a list of strings if the window | ||
| 2568 | system supports multiple selections. The first string will be | ||
| 2569 | used as the pasted text, but the other will be placed in the | ||
| 2570 | kill ring for easy access via `yank-pop'. | ||
| 2571 | |||
| 2564 | Note that the function should return a string only if a program other | 2572 | Note that the function should return a string only if a program other |
| 2565 | than Emacs has provided a string for pasting; if Emacs provided the | 2573 | than Emacs has provided a string for pasting; if Emacs provided the |
| 2566 | most recent string, the function should return nil. If it is | 2574 | most recent string, the function should return nil. If it is |
| @@ -2644,11 +2652,11 @@ If `interprogram-cut-function' is set, pass the resulting kill to it." | |||
| 2644 | 2652 | ||
| 2645 | (defun current-kill (n &optional do-not-move) | 2653 | (defun current-kill (n &optional do-not-move) |
| 2646 | "Rotate the yanking point by N places, and then return that kill. | 2654 | "Rotate the yanking point by N places, and then return that kill. |
| 2647 | If N is zero, `interprogram-paste-function' is set, and calling it | 2655 | If N is zero, `interprogram-paste-function' is set, and calling it returns a |
| 2648 | returns a string, then that string is added to the front of the | 2656 | string or list of strings, then that string (or list) is added to the front |
| 2649 | kill ring and returned as the latest kill. | 2657 | of the kill ring and the string (or first string in the list) is returned as |
| 2650 | If optional arg DO-NOT-MOVE is non-nil, then don't actually move the | 2658 | the latest kill. If optional arg DO-NOT-MOVE is non-nil, then don't |
| 2651 | yanking point; just return the Nth kill forward." | 2659 | actually move the yanking point; just return the Nth kill forward." |
| 2652 | (let ((interprogram-paste (and (= n 0) | 2660 | (let ((interprogram-paste (and (= n 0) |
| 2653 | interprogram-paste-function | 2661 | interprogram-paste-function |
| 2654 | (funcall interprogram-paste-function)))) | 2662 | (funcall interprogram-paste-function)))) |
| @@ -2658,8 +2666,10 @@ yanking point; just return the Nth kill forward." | |||
| 2658 | ;; text to the kill ring, so Emacs doesn't try to own the | 2666 | ;; text to the kill ring, so Emacs doesn't try to own the |
| 2659 | ;; selection, with identical text. | 2667 | ;; selection, with identical text. |
| 2660 | (let ((interprogram-cut-function nil)) | 2668 | (let ((interprogram-cut-function nil)) |
| 2661 | (kill-new interprogram-paste)) | 2669 | (if (listp interprogram-paste) |
| 2662 | interprogram-paste) | 2670 | (mapc 'kill-new (nreverse interprogram-paste)) |
| 2671 | (kill-new interprogram-paste))) | ||
| 2672 | (car kill-ring)) | ||
| 2663 | (or kill-ring (error "Kill ring is empty")) | 2673 | (or kill-ring (error "Kill ring is empty")) |
| 2664 | (let ((ARGth-kill-element | 2674 | (let ((ARGth-kill-element |
| 2665 | (nthcdr (mod (- n (length kill-ring-yank-pointer)) | 2675 | (nthcdr (mod (- n (length kill-ring-yank-pointer)) |
| @@ -4657,6 +4667,8 @@ it skips the contents of comments that end before point." | |||
| 4657 | (point)))))) | 4667 | (point)))))) |
| 4658 | (let* ((oldpos (point)) | 4668 | (let* ((oldpos (point)) |
| 4659 | (message-log-max nil) ; Don't log messages about paren matching. | 4669 | (message-log-max nil) ; Don't log messages about paren matching. |
| 4670 | (atdollar (eq (syntax-class (syntax-after (1- oldpos))) 8)) | ||
| 4671 | (isdollar) | ||
| 4660 | (blinkpos | 4672 | (blinkpos |
| 4661 | (save-excursion | 4673 | (save-excursion |
| 4662 | (save-restriction | 4674 | (save-restriction |
| @@ -4674,20 +4686,28 @@ it skips the contents of comments that end before point." | |||
| 4674 | (matching-paren | 4686 | (matching-paren |
| 4675 | (and blinkpos | 4687 | (and blinkpos |
| 4676 | ;; Not syntax '$'. | 4688 | ;; Not syntax '$'. |
| 4677 | (not (eq (syntax-class (syntax-after blinkpos)) 8)) | 4689 | (not (setq isdollar |
| 4690 | (eq (syntax-class (syntax-after blinkpos)) 8))) | ||
| 4678 | (let ((syntax (syntax-after blinkpos))) | 4691 | (let ((syntax (syntax-after blinkpos))) |
| 4679 | (and (consp syntax) | 4692 | (and (consp syntax) |
| 4680 | (eq (syntax-class syntax) 4) | 4693 | (eq (syntax-class syntax) 4) |
| 4681 | (cdr syntax)))))) | 4694 | (cdr syntax)))))) |
| 4682 | (cond | 4695 | (cond |
| 4683 | ((not (or (eq matching-paren (char-before oldpos)) | 4696 | ;; isdollar is for: |
| 4697 | ;; http://lists.gnu.org/archive/html/emacs-devel/2007-10/msg00871.html | ||
| 4698 | ((not (or (and isdollar blinkpos) | ||
| 4699 | (and atdollar (not blinkpos)) ; see below | ||
| 4700 | (eq matching-paren (char-before oldpos)) | ||
| 4684 | ;; The cdr might hold a new paren-class info rather than | 4701 | ;; The cdr might hold a new paren-class info rather than |
| 4685 | ;; a matching-char info, in which case the two CDRs | 4702 | ;; a matching-char info, in which case the two CDRs |
| 4686 | ;; should match. | 4703 | ;; should match. |
| 4687 | (eq matching-paren (cdr (syntax-after (1- oldpos)))))) | 4704 | (eq matching-paren (cdr (syntax-after (1- oldpos)))))) |
| 4688 | (message "Mismatched parentheses")) | 4705 | (message "Mismatched parentheses")) |
| 4689 | ((not blinkpos) | 4706 | ((not blinkpos) |
| 4690 | (if (not blink-matching-paren-distance) | 4707 | (or blink-matching-paren-distance |
| 4708 | ;; Don't complain when `$' with no blinkpos, because it | ||
| 4709 | ;; could just be the first one typed in the buffer. | ||
| 4710 | atdollar | ||
| 4691 | (message "Unmatched parenthesis"))) | 4711 | (message "Unmatched parenthesis"))) |
| 4692 | ((pos-visible-in-window-p blinkpos) | 4712 | ((pos-visible-in-window-p blinkpos) |
| 4693 | ;; Matching open within window, temporarily move to blinkpos but only | 4713 | ;; Matching open within window, temporarily move to blinkpos but only |
diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el index 1c4b60706aa..a60aa90255f 100644 --- a/lisp/term/xterm.el +++ b/lisp/term/xterm.el | |||
| @@ -27,8 +27,6 @@ | |||
| 27 | 27 | ||
| 28 | ;;; Code: | 28 | ;;; Code: |
| 29 | 29 | ||
| 30 | (eval-when-compile (require 'xt-mouse)) | ||
| 31 | |||
| 32 | (defvar xterm-function-map | 30 | (defvar xterm-function-map |
| 33 | (let ((map (make-sparse-keymap))) | 31 | (let ((map (make-sparse-keymap))) |
| 34 | 32 | ||
| @@ -469,12 +467,8 @@ | |||
| 469 | ;; This recomputes all the default faces given the colors we've just set up. | 467 | ;; This recomputes all the default faces given the colors we've just set up. |
| 470 | (tty-set-up-initial-frame-faces) | 468 | (tty-set-up-initial-frame-faces) |
| 471 | 469 | ||
| 472 | (when xterm-mouse-mode | ||
| 473 | (turn-on-xterm-mouse-tracking-on-terminal | ||
| 474 | (frame-terminal (selected-frame)))) | ||
| 475 | |||
| 476 | ;; Try to turn on the modifyOtherKeys feature on modern xterms. | 470 | ;; Try to turn on the modifyOtherKeys feature on modern xterms. |
| 477 | ;; When it is turned on much more key bindings work: things like | 471 | ;; When it is turned on many more key bindings work: things like |
| 478 | ;; C-. C-, etc. | 472 | ;; C-. C-, etc. |
| 479 | ;; To do that we need to find out if the current terminal supports | 473 | ;; To do that we need to find out if the current terminal supports |
| 480 | ;; modifyOtherKeys. At this time only xterm does. | 474 | ;; modifyOtherKeys. At this time only xterm does. |
| @@ -506,7 +500,9 @@ | |||
| 506 | ;; need to deal with modify-other-keys. | 500 | ;; need to deal with modify-other-keys. |
| 507 | (push (frame-terminal (selected-frame)) | 501 | (push (frame-terminal (selected-frame)) |
| 508 | xterm-modify-other-keys-terminal-list) | 502 | xterm-modify-other-keys-terminal-list) |
| 509 | (xterm-turn-on-modify-other-keys))))))) | 503 | (xterm-turn-on-modify-other-keys)))))) |
| 504 | |||
| 505 | (run-hooks 'terminal-init-xterm-hook)) | ||
| 510 | 506 | ||
| 511 | ;; Set up colors, for those versions of xterm that support it. | 507 | ;; Set up colors, for those versions of xterm that support it. |
| 512 | (defvar xterm-standard-colors | 508 | (defvar xterm-standard-colors |
diff --git a/lisp/textmodes/artist.el b/lisp/textmodes/artist.el index bc0434e151a..f0442904185 100644 --- a/lisp/textmodes/artist.el +++ b/lisp/textmodes/artist.el | |||
| @@ -4383,13 +4383,10 @@ With non-nil ARG, set the last point." | |||
| 4383 | If N is negative, move cursor down." | 4383 | If N is negative, move cursor down." |
| 4384 | (interactive "p") | 4384 | (interactive "p") |
| 4385 | (let ((col (artist-current-column))) | 4385 | (let ((col (artist-current-column))) |
| 4386 | (if (not artist-key-is-drawing) | 4386 | (forward-line (- n)) |
| 4387 | (progn | 4387 | (move-to-column col t)) |
| 4388 | (previous-line n) | 4388 | (when artist-key-is-drawing |
| 4389 | (move-to-column col t)) | 4389 | (artist-key-do-continously-common))) |
| 4390 | (previous-line n) | ||
| 4391 | (move-to-column col t) | ||
| 4392 | (artist-key-do-continously-common)))) | ||
| 4393 | 4390 | ||
| 4394 | 4391 | ||
| 4395 | (defun artist-next-line (&optional n) | 4392 | (defun artist-next-line (&optional n) |
| @@ -4397,13 +4394,10 @@ If N is negative, move cursor down." | |||
| 4397 | If N is negative, move cursor up." | 4394 | If N is negative, move cursor up." |
| 4398 | (interactive "p") | 4395 | (interactive "p") |
| 4399 | (let ((col (artist-current-column))) | 4396 | (let ((col (artist-current-column))) |
| 4400 | (if (not artist-key-is-drawing) | 4397 | (forward-line n) |
| 4401 | (progn | 4398 | (move-to-column col t)) |
| 4402 | (next-line n) | 4399 | (when artist-key-is-drawing |
| 4403 | (move-to-column col t)) | 4400 | (artist-key-do-continously-common))) |
| 4404 | (next-line n) | ||
| 4405 | (move-to-column col t) | ||
| 4406 | (artist-key-do-continously-common)))) | ||
| 4407 | 4401 | ||
| 4408 | (defun artist-backward-char (&optional n) | 4402 | (defun artist-backward-char (&optional n) |
| 4409 | "Move cursor backward optional N chars (default is 1), updating curr shape. | 4403 | "Move cursor backward optional N chars (default is 1), updating curr shape. |
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el index e0f80b1b118..9cbdca0de87 100644 --- a/lisp/textmodes/fill.el +++ b/lisp/textmodes/fill.el | |||
| @@ -117,8 +117,8 @@ if it would act as a paragraph-starter on the second line." | |||
| 117 | :group 'fill) | 117 | :group 'fill) |
| 118 | 118 | ||
| 119 | (defcustom adaptive-fill-function nil | 119 | (defcustom adaptive-fill-function nil |
| 120 | "*Function to call to choose a fill prefix for a paragraph, or nil. | 120 | "Function to call to choose a fill prefix for a paragraph, or nil. |
| 121 | nil means the function has not determined the fill prefix." | 121 | A nil value means the function has not determined the fill prefix." |
| 122 | :type '(choice (const nil) function) | 122 | :type '(choice (const nil) function) |
| 123 | :group 'fill) | 123 | :group 'fill) |
| 124 | 124 | ||
| @@ -757,10 +757,10 @@ space does not end a sentence, so don't break a line there." | |||
| 757 | (narrow-to-region (minibuffer-prompt-end) (point-max)) | 757 | (narrow-to-region (minibuffer-prompt-end) (point-max)) |
| 758 | (fill-paragraph arg))) | 758 | (fill-paragraph arg))) |
| 759 | 759 | ||
| 760 | (defun fill-paragraph (arg) | 760 | (defun fill-paragraph (&optional justify region) |
| 761 | "Fill paragraph at or after point. | 761 | "Fill paragraph at or after point. |
| 762 | 762 | ||
| 763 | If ARG is non-nil (interactively, with prefix argument), justify as well. | 763 | If JUSTIFY is non-nil (interactively, with prefix argument), justify as well. |
| 764 | If `sentence-end-double-space' is non-nil, then period followed by one | 764 | If `sentence-end-double-space' is non-nil, then period followed by one |
| 765 | space does not end a sentence, so don't break a line there. | 765 | space does not end a sentence, so don't break a line there. |
| 766 | the variable `fill-column' controls the width for filling. | 766 | the variable `fill-column' controls the width for filling. |
| @@ -768,64 +768,73 @@ the variable `fill-column' controls the width for filling. | |||
| 768 | If `fill-paragraph-function' is non-nil, we call it (passing our | 768 | If `fill-paragraph-function' is non-nil, we call it (passing our |
| 769 | argument to it), and if it returns non-nil, we simply return its value. | 769 | argument to it), and if it returns non-nil, we simply return its value. |
| 770 | 770 | ||
| 771 | If `fill-paragraph-function' is nil, return the `fill-prefix' used for filling." | 771 | If `fill-paragraph-function' is nil, return the `fill-prefix' used for filling. |
| 772 | |||
| 773 | Interactively (when `region' is non-nil) in Transient Mark mode when | ||
| 774 | the mark is active, call `fill-region' to fill each of the paragraphs | ||
| 775 | in the active region." | ||
| 772 | (interactive (progn | 776 | (interactive (progn |
| 773 | (barf-if-buffer-read-only) | 777 | (barf-if-buffer-read-only) |
| 774 | (list (if current-prefix-arg 'full)))) | 778 | (list (if current-prefix-arg 'full) t))) |
| 775 | ;; First try fill-paragraph-function. | 779 | (or |
| 776 | (or (and (not (eq fill-paragraph-function t)) | 780 | ;; 1. Fill the region if it is active when called interactively. |
| 777 | (or fill-paragraph-function | 781 | (and region transient-mark-mode mark-active |
| 778 | (and (minibufferp (current-buffer)) | 782 | (not (eq (region-beginning) (region-end))) |
| 779 | (= 1 (point-min)))) | 783 | (fill-region (region-beginning) (region-end) justify)) |
| 780 | (let ((function (or fill-paragraph-function | 784 | ;; 2. Try fill-paragraph-function. |
| 781 | ;; In the minibuffer, don't count the width | 785 | (and (not (eq fill-paragraph-function t)) |
| 782 | ;; of the prompt. | 786 | (or fill-paragraph-function |
| 783 | 'fill-minibuffer-function)) | 787 | (and (minibufferp (current-buffer)) |
| 784 | ;; If fill-paragraph-function is set, it probably takes care | 788 | (= 1 (point-min)))) |
| 785 | ;; of comments and stuff. If not, it will have to set | 789 | (let ((function (or fill-paragraph-function |
| 786 | ;; fill-paragraph-handle-comment back to t explicitly or | 790 | ;; In the minibuffer, don't count the width |
| 787 | ;; return nil. | 791 | ;; of the prompt. |
| 788 | (fill-paragraph-handle-comment nil) | 792 | 'fill-minibuffer-function)) |
| 789 | (fill-paragraph-function t)) | 793 | ;; If fill-paragraph-function is set, it probably takes care |
| 790 | (funcall function arg))) | 794 | ;; of comments and stuff. If not, it will have to set |
| 791 | ;; Then try our syntax-aware filling code. | 795 | ;; fill-paragraph-handle-comment back to t explicitly or |
| 792 | (and fill-paragraph-handle-comment | 796 | ;; return nil. |
| 793 | ;; Our code only handles \n-terminated comments right now. | 797 | (fill-paragraph-handle-comment nil) |
| 794 | comment-start (equal comment-end "") | 798 | (fill-paragraph-function t)) |
| 795 | (let ((fill-paragraph-handle-comment nil)) | 799 | (funcall function justify))) |
| 796 | (fill-comment-paragraph arg))) | 800 | ;; 3. Try our syntax-aware filling code. |
| 797 | ;; If it all fails, default to the good ol' text paragraph filling. | 801 | (and fill-paragraph-handle-comment |
| 798 | (let ((before (point)) | 802 | ;; Our code only handles \n-terminated comments right now. |
| 799 | (paragraph-start paragraph-start) | 803 | comment-start (equal comment-end "") |
| 800 | ;; Fill prefix used for filling the paragraph. | 804 | (let ((fill-paragraph-handle-comment nil)) |
| 801 | fill-pfx) | 805 | (fill-comment-paragraph justify))) |
| 802 | ;; Try to prevent code sections and comment sections from being | 806 | ;; 4. If it all fails, default to the good ol' text paragraph filling. |
| 803 | ;; filled together. | 807 | (let ((before (point)) |
| 804 | (when (and fill-paragraph-handle-comment comment-start-skip) | 808 | (paragraph-start paragraph-start) |
| 805 | (setq paragraph-start | 809 | ;; Fill prefix used for filling the paragraph. |
| 806 | (concat paragraph-start "\\|[ \t]*\\(?:" | 810 | fill-pfx) |
| 807 | comment-start-skip "\\)"))) | 811 | ;; Try to prevent code sections and comment sections from being |
| 808 | (save-excursion | 812 | ;; filled together. |
| 809 | ;; To make sure the return value of forward-paragraph is meaningful, | 813 | (when (and fill-paragraph-handle-comment comment-start-skip) |
| 810 | ;; we have to start from the beginning of line, otherwise skipping | 814 | (setq paragraph-start |
| 811 | ;; past the last few chars of a paragraph-separator would count as | 815 | (concat paragraph-start "\\|[ \t]*\\(?:" |
| 812 | ;; a paragraph (and not skipping any chars at EOB would not count | 816 | comment-start-skip "\\)"))) |
| 813 | ;; as a paragraph even if it is). | 817 | (save-excursion |
| 814 | (move-to-left-margin) | 818 | ;; To make sure the return value of forward-paragraph is meaningful, |
| 815 | (if (not (zerop (forward-paragraph))) | 819 | ;; we have to start from the beginning of line, otherwise skipping |
| 816 | ;; There's no paragraph at or after point: give up. | 820 | ;; past the last few chars of a paragraph-separator would count as |
| 817 | (setq fill-pfx "") | 821 | ;; a paragraph (and not skipping any chars at EOB would not count |
| 818 | (let ((end (point)) | 822 | ;; as a paragraph even if it is). |
| 819 | (beg (progn (backward-paragraph) (point)))) | 823 | (move-to-left-margin) |
| 820 | (goto-char before) | 824 | (if (not (zerop (forward-paragraph))) |
| 821 | (setq fill-pfx | 825 | ;; There's no paragraph at or after point: give up. |
| 822 | (if use-hard-newlines | 826 | (setq fill-pfx "") |
| 823 | ;; Can't use fill-region-as-paragraph, since this | 827 | (let ((end (point)) |
| 824 | ;; paragraph may still contain hard newlines. See | 828 | (beg (progn (backward-paragraph) (point)))) |
| 825 | ;; fill-region. | 829 | (goto-char before) |
| 826 | (fill-region beg end arg) | 830 | (setq fill-pfx |
| 827 | (fill-region-as-paragraph beg end arg)))))) | 831 | (if use-hard-newlines |
| 828 | fill-pfx))) | 832 | ;; Can't use fill-region-as-paragraph, since this |
| 833 | ;; paragraph may still contain hard newlines. See | ||
| 834 | ;; fill-region. | ||
| 835 | (fill-region beg end justify) | ||
| 836 | (fill-region-as-paragraph beg end justify)))))) | ||
| 837 | fill-pfx))) | ||
| 829 | 838 | ||
| 830 | (defun fill-comment-paragraph (&optional justify) | 839 | (defun fill-comment-paragraph (&optional justify) |
| 831 | "Fill current comment. | 840 | "Fill current comment. |
| @@ -1012,18 +1021,6 @@ space does not end a sentence, so don't break a line there." | |||
| 1012 | (goto-char end)))) | 1021 | (goto-char end)))) |
| 1013 | fill-pfx)) | 1022 | fill-pfx)) |
| 1014 | 1023 | ||
| 1015 | (defun fill-paragraph-or-region (arg) | ||
| 1016 | "Fill the active region or current paragraph. | ||
| 1017 | In Transient Mark mode, when the mark is active, it calls `fill-region' | ||
| 1018 | on the active region. Otherwise, it calls `fill-paragraph'." | ||
| 1019 | (interactive (progn | ||
| 1020 | (barf-if-buffer-read-only) | ||
| 1021 | (list (if current-prefix-arg 'full)))) | ||
| 1022 | (if (and transient-mark-mode mark-active | ||
| 1023 | (not (eq (region-beginning) (region-end)))) | ||
| 1024 | (fill-region (region-beginning) (region-end) arg) | ||
| 1025 | (fill-paragraph arg))) | ||
| 1026 | |||
| 1027 | 1024 | ||
| 1028 | (defcustom default-justification 'left | 1025 | (defcustom default-justification 'left |
| 1029 | "*Method of justifying text not otherwise specified. | 1026 | "*Method of justifying text not otherwise specified. |
| @@ -1367,8 +1364,8 @@ These lines are filled together. | |||
| 1367 | When calling from a program, pass the range to fill | 1364 | When calling from a program, pass the range to fill |
| 1368 | as the first two arguments. | 1365 | as the first two arguments. |
| 1369 | 1366 | ||
| 1370 | Optional third and fourth arguments JUSTIFY and MAIL-FLAG: | 1367 | Optional third and fourth arguments JUSTIFY and CITATION-REGEXP: |
| 1371 | JUSTIFY to justify paragraphs (prefix arg), | 1368 | JUSTIFY to justify paragraphs (prefix arg). |
| 1372 | When filling a mail message, pass a regexp for CITATION-REGEXP | 1369 | When filling a mail message, pass a regexp for CITATION-REGEXP |
| 1373 | which will match the prefix of a line which is a citation marker | 1370 | which will match the prefix of a line which is a citation marker |
| 1374 | plus whitespace, but no other kind of prefix. | 1371 | plus whitespace, but no other kind of prefix. |
| @@ -1456,6 +1453,7 @@ Also, if CITATION-REGEXP is non-nil, don't fill header lines." | |||
| 1456 | (fill-region-as-paragraph start (point) justify) | 1453 | (fill-region-as-paragraph start (point) justify) |
| 1457 | (if (and (bolp) (not had-newline)) | 1454 | (if (and (bolp) (not had-newline)) |
| 1458 | (delete-char -1)))))))) | 1455 | (delete-char -1)))))))) |
| 1456 | |||
| 1459 | (defun fill-individual-paragraphs-prefix (citation-regexp) | 1457 | (defun fill-individual-paragraphs-prefix (citation-regexp) |
| 1460 | (let* ((adaptive-fill-first-line-regexp ".*") | 1458 | (let* ((adaptive-fill-first-line-regexp ".*") |
| 1461 | (just-one-line-prefix | 1459 | (just-one-line-prefix |
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index 253c29f408e..926e0debda1 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el | |||
| @@ -1536,7 +1536,7 @@ This allows it to improve the suggestion list based on actual mispellings." | |||
| 1536 | (translate-region pos (point) translation-table-for-input)))) | 1536 | (translate-region pos (point) translation-table-for-input)))) |
| 1537 | 1537 | ||
| 1538 | ;;;###autoload | 1538 | ;;;###autoload |
| 1539 | (defun ispell-word (&optional following quietly continue) | 1539 | (defun ispell-word (&optional following quietly continue region) |
| 1540 | "Check spelling of word under or before the cursor. | 1540 | "Check spelling of word under or before the cursor. |
| 1541 | If the word is not found in dictionary, display possible corrections | 1541 | If the word is not found in dictionary, display possible corrections |
| 1542 | in a window allowing you to choose one. | 1542 | in a window allowing you to choose one. |
| @@ -1550,6 +1550,9 @@ when called interactively, non-corrective messages are suppressed. | |||
| 1550 | With a prefix argument (or if CONTINUE is non-nil), | 1550 | With a prefix argument (or if CONTINUE is non-nil), |
| 1551 | resume interrupted spell-checking of a buffer or region. | 1551 | resume interrupted spell-checking of a buffer or region. |
| 1552 | 1552 | ||
| 1553 | Interactively, in Transient Mark mode when the mark is active, call | ||
| 1554 | `ispell-region' to check the active region for spelling errors. | ||
| 1555 | |||
| 1553 | Word syntax is controlled by the definition of the chosen dictionary, | 1556 | Word syntax is controlled by the definition of the chosen dictionary, |
| 1554 | which is in `ispell-local-dictionary-alist' or `ispell-dictionary-alist'. | 1557 | which is in `ispell-local-dictionary-alist' or `ispell-dictionary-alist'. |
| 1555 | 1558 | ||
| @@ -1562,10 +1565,9 @@ nil word is correct or spelling is accepted. | |||
| 1562 | \"word\" word corrected from word list. | 1565 | \"word\" word corrected from word list. |
| 1563 | \(\"word\" arg\) word is hand entered. | 1566 | \(\"word\" arg\) word is hand entered. |
| 1564 | quit spell session exited." | 1567 | quit spell session exited." |
| 1565 | 1568 | (interactive (list ispell-following-word ispell-quietly current-prefix-arg t)) | |
| 1566 | (interactive (list ispell-following-word ispell-quietly current-prefix-arg)) | ||
| 1567 | (cond | 1569 | (cond |
| 1568 | ((and transient-mark-mode mark-active | 1570 | ((and region transient-mark-mode mark-active |
| 1569 | (not (eq (region-beginning) (region-end)))) | 1571 | (not (eq (region-beginning) (region-end)))) |
| 1570 | (ispell-region (region-beginning) (region-end))) | 1572 | (ispell-region (region-beginning) (region-end))) |
| 1571 | (continue (ispell-continue)) | 1573 | (continue (ispell-continue)) |
diff --git a/lisp/textmodes/org.el b/lisp/textmodes/org.el index 6c48c47d3ad..5487609343b 100644 --- a/lisp/textmodes/org.el +++ b/lisp/textmodes/org.el | |||
| @@ -129,7 +129,7 @@ | |||
| 129 | (progn | 129 | (progn |
| 130 | (if pc-mode (partial-completion-mode -1)) | 130 | (if pc-mode (partial-completion-mode -1)) |
| 131 | ,@body) | 131 | ,@body) |
| 132 | (if pc-mode (partial-completion-mode 1))))) | 132 | (if pc-mode (partial-completion-mode 1))))) |
| 133 | 133 | ||
| 134 | ;;; The custom variables | 134 | ;;; The custom variables |
| 135 | 135 | ||
| @@ -1399,7 +1399,7 @@ When this variable is nil, `C-c C-c' give you the prompts, and | |||
| 1399 | `C-u C-c C-c' trigger the fasttrack." | 1399 | `C-u C-c C-c' trigger the fasttrack." |
| 1400 | :group 'org-remember | 1400 | :group 'org-remember |
| 1401 | :type 'boolean) | 1401 | :type 'boolean) |
| 1402 | 1402 | ||
| 1403 | (defcustom org-remember-default-headline "" | 1403 | (defcustom org-remember-default-headline "" |
| 1404 | "The headline that should be the default location in the notes file. | 1404 | "The headline that should be the default location in the notes file. |
| 1405 | When filing remember notes, the cursor will start at that position. | 1405 | When filing remember notes, the cursor will start at that position. |
| @@ -2702,7 +2702,7 @@ directory where the exported Org-mode files lives." | |||
| 2702 | (repeat | 2702 | (repeat |
| 2703 | (cons | 2703 | (cons |
| 2704 | (choice :tag "Type" | 2704 | (choice :tag "Type" |
| 2705 | (const :html) (const :LaTeX) | 2705 | (const :html) (const :LaTeX) |
| 2706 | (const :ascii) (const :ical) (const :xoxo)) | 2706 | (const :ascii) (const :ical) (const :xoxo)) |
| 2707 | (directory))))) | 2707 | (directory))))) |
| 2708 | 2708 | ||
| @@ -3516,7 +3516,7 @@ color of the frame." | |||
| 3516 | ;; Make sure that a fixed-width face is used when we have a column table. | 3516 | ;; Make sure that a fixed-width face is used when we have a column table. |
| 3517 | (set-face-attribute 'org-column nil | 3517 | (set-face-attribute 'org-column nil |
| 3518 | :height (face-attribute 'default :height) | 3518 | :height (face-attribute 'default :height) |
| 3519 | :family (face-attribute 'default :family))) | 3519 | :family (face-attribute 'default :family))) |
| 3520 | 3520 | ||
| 3521 | (defface org-warning | 3521 | (defface org-warning |
| 3522 | (org-compatible-face | 3522 | (org-compatible-face |
| @@ -5544,7 +5544,7 @@ Works for outline headings and for plain lists alike." | |||
| 5544 | (cond | 5544 | (cond |
| 5545 | ((org-on-heading-p) (org-do-demote)) | 5545 | ((org-on-heading-p) (org-do-demote)) |
| 5546 | ((org-at-item-p) (org-indent-item 1)))) | 5546 | ((org-at-item-p) (org-indent-item 1)))) |
| 5547 | 5547 | ||
| 5548 | ;;; Promotion and Demotion | 5548 | ;;; Promotion and Demotion |
| 5549 | 5549 | ||
| 5550 | (defun org-promote-subtree () | 5550 | (defun org-promote-subtree () |
| @@ -6064,7 +6064,7 @@ If WITH-CASE is non-nil, the sorting will be case-sensitive." | |||
| 6064 | (if (string-match org-priority-regexp x) | 6064 | (if (string-match org-priority-regexp x) |
| 6065 | (string-to-char (match-string 2 x)) | 6065 | (string-to-char (match-string 2 x)) |
| 6066 | org-default-priority)) | 6066 | org-default-priority)) |
| 6067 | comparefun (if (= dcst sorting-type) '< '>))) | 6067 | comparefun (if (= dcst sorting-type) '< '>))) |
| 6068 | (t (error "Invalid sorting type `%c'" sorting-type))) | 6068 | (t (error "Invalid sorting type `%c'" sorting-type))) |
| 6069 | 6069 | ||
| 6070 | (sort (mapcar (lambda (x) (cons (funcall extractfun (car x)) (cdr x))) | 6070 | (sort (mapcar (lambda (x) (cons (funcall extractfun (car x)) (cdr x))) |
| @@ -6778,7 +6778,7 @@ off orgstruct-mode will *not* remove these additonal settings." | |||
| 6778 | (orgstruct-make-binding 'org-cycle 102 [(tab)] "\C-i")) | 6778 | (orgstruct-make-binding 'org-cycle 102 [(tab)] "\C-i")) |
| 6779 | (org-defkey orgstruct-mode-map "\C-i" | 6779 | (org-defkey orgstruct-mode-map "\C-i" |
| 6780 | (orgstruct-make-binding 'org-cycle 103 "\C-i" [(tab)])) | 6780 | (orgstruct-make-binding 'org-cycle 103 "\C-i" [(tab)])) |
| 6781 | 6781 | ||
| 6782 | (org-defkey orgstruct-mode-map "\M-\C-m" | 6782 | (org-defkey orgstruct-mode-map "\M-\C-m" |
| 6783 | (orgstruct-make-binding 'org-insert-heading 105 | 6783 | (orgstruct-make-binding 'org-insert-heading 105 |
| 6784 | "\M-\C-m" [(meta return)])) | 6784 | "\M-\C-m" [(meta return)])) |
| @@ -6789,10 +6789,10 @@ off orgstruct-mode will *not* remove these additonal settings." | |||
| 6789 | (org-defkey orgstruct-mode-map [(shift meta return)] | 6789 | (org-defkey orgstruct-mode-map [(shift meta return)] |
| 6790 | (orgstruct-make-binding 'org-insert-todo-heading 107 | 6790 | (orgstruct-make-binding 'org-insert-todo-heading 107 |
| 6791 | [(meta return)] "\M-\C-m")) | 6791 | [(meta return)] "\M-\C-m")) |
| 6792 | 6792 | ||
| 6793 | (unless org-local-vars | 6793 | (unless org-local-vars |
| 6794 | (setq org-local-vars (org-get-local-variables))) | 6794 | (setq org-local-vars (org-get-local-variables))) |
| 6795 | 6795 | ||
| 6796 | t)) | 6796 | t)) |
| 6797 | 6797 | ||
| 6798 | (defun orgstruct-make-binding (fun n &rest keys) | 6798 | (defun orgstruct-make-binding (fun n &rest keys) |
| @@ -6843,7 +6843,7 @@ Possible values in the list of contexts are `table', `headline', and `item'." | |||
| 6843 | (kill-buffer "*Org tmp*") | 6843 | (kill-buffer "*Org tmp*") |
| 6844 | (delq nil | 6844 | (delq nil |
| 6845 | (mapcar | 6845 | (mapcar |
| 6846 | (lambda (x) | 6846 | (lambda (x) |
| 6847 | (setq x | 6847 | (setq x |
| 6848 | (if (symbolp x) | 6848 | (if (symbolp x) |
| 6849 | (list x) | 6849 | (list x) |
| @@ -11258,12 +11258,12 @@ according to FMT (default from `org-email-link-description-format')." | |||
| 11258 | (if description (concat "[" description "]") "") | 11258 | (if description (concat "[" description "]") "") |
| 11259 | "]")) | 11259 | "]")) |
| 11260 | 11260 | ||
| 11261 | (defconst org-link-escape-chars | 11261 | (defconst org-link-escape-chars |
| 11262 | '((" " . "%20") | 11262 | '((" " . "%20") |
| 11263 | ("[" . "%5B") | 11263 | ("[" . "%5B") |
| 11264 | ("]" . "%5d") | 11264 | ("]" . "%5d") |
| 11265 | ("\340" . "%E0") ; `a | 11265 | ("\340" . "%E0") ; `a |
| 11266 | ("\342" . "%E2") ; ^a | 11266 | ("\342" . "%E2") ; ^a |
| 11267 | ("\347" . "%E7") ; ,c | 11267 | ("\347" . "%E7") ; ,c |
| 11268 | ("\350" . "%E8") ; `e | 11268 | ("\350" . "%E8") ; `e |
| 11269 | ("\351" . "%E9") ; 'e | 11269 | ("\351" . "%E9") ; 'e |
| @@ -11280,7 +11280,7 @@ according to FMT (default from `org-email-link-description-format')." | |||
| 11280 | "Association list of escapes for some characters problematic in links. | 11280 | "Association list of escapes for some characters problematic in links. |
| 11281 | This is the list that is used for internal purposes.") | 11281 | This is the list that is used for internal purposes.") |
| 11282 | 11282 | ||
| 11283 | (defconst org-link-escape-chars-browser | 11283 | (defconst org-link-escape-chars-browser |
| 11284 | '((" " . "%20")) | 11284 | '((" " . "%20")) |
| 11285 | "Association list of escapes for some characters problematic in links. | 11285 | "Association list of escapes for some characters problematic in links. |
| 11286 | This is the list that is used before handing over to the browser.") | 11286 | This is the list that is used before handing over to the browser.") |
| @@ -11459,7 +11459,7 @@ With three \\[universal-argument] prefixes, negate the meaning of | |||
| 11459 | (setq org-stored-links (delq (assoc link org-stored-links) | 11459 | (setq org-stored-links (delq (assoc link org-stored-links) |
| 11460 | org-stored-links))) | 11460 | org-stored-links))) |
| 11461 | (setq desc (or desc (nth 1 entry))))) | 11461 | (setq desc (or desc (nth 1 entry))))) |
| 11462 | 11462 | ||
| 11463 | (if (string-match org-plain-link-re link) | 11463 | (if (string-match org-plain-link-re link) |
| 11464 | ;; URL-like link, normalize the use of angular brackets. | 11464 | ;; URL-like link, normalize the use of angular brackets. |
| 11465 | (setq link (org-make-link (org-remove-angle-brackets link)))) | 11465 | (setq link (org-make-link (org-remove-angle-brackets link)))) |
| @@ -12537,7 +12537,7 @@ to be run from that hook to fucntion properly." | |||
| 12537 | (when (string-match "\\S-" ins) | 12537 | (when (string-match "\\S-" ins) |
| 12538 | (or (equal (char-before) ?:) (insert ":")) | 12538 | (or (equal (char-before) ?:) (insert ":")) |
| 12539 | (insert ins) | 12539 | (insert ins) |
| 12540 | (or (equal (char-after) ?:) (insert ":"))))) | 12540 | (or (equal (char-after) ?:) (insert ":"))))) |
| 12541 | (char | 12541 | (char |
| 12542 | (setq org-time-was-given (equal (upcase char) char)) | 12542 | (setq org-time-was-given (equal (upcase char) char)) |
| 12543 | (setq time (org-read-date (equal (upcase char) "U") t nil | 12543 | (setq time (org-read-date (equal (upcase char) "U") t nil |
| @@ -12710,7 +12710,7 @@ See also the variable `org-reverse-note-order'." | |||
| 12710 | (org-end-of-subtree t) | 12710 | (org-end-of-subtree t) |
| 12711 | (org-paste-subtree level txt)) | 12711 | (org-paste-subtree level txt)) |
| 12712 | (t (error "This should not happen")))) | 12712 | (t (error "This should not happen")))) |
| 12713 | 12713 | ||
| 12714 | ((and (bobp) (not reversed)) | 12714 | ((and (bobp) (not reversed)) |
| 12715 | ;; Put it at the end, one level below level 1 | 12715 | ;; Put it at the end, one level below level 1 |
| 12716 | (save-restriction | 12716 | (save-restriction |
| @@ -12718,7 +12718,7 @@ See also the variable `org-reverse-note-order'." | |||
| 12718 | (goto-char (point-max)) | 12718 | (goto-char (point-max)) |
| 12719 | (if (not (bolp)) (newline)) | 12719 | (if (not (bolp)) (newline)) |
| 12720 | (org-paste-subtree (org-get-legal-level 1 1) txt))) | 12720 | (org-paste-subtree (org-get-legal-level 1 1) txt))) |
| 12721 | 12721 | ||
| 12722 | ((and (bobp) reversed) | 12722 | ((and (bobp) reversed) |
| 12723 | ;; Put it at the start, as level 1 | 12723 | ;; Put it at the start, as level 1 |
| 12724 | (save-restriction | 12724 | (save-restriction |
| @@ -13834,7 +13834,7 @@ also TODO lines." | |||
| 13834 | (setq match (completing-read | 13834 | (setq match (completing-read |
| 13835 | "Match: " 'org-tags-completion-function nil nil nil | 13835 | "Match: " 'org-tags-completion-function nil nil nil |
| 13836 | 'org-tags-history)))) | 13836 | 'org-tags-history)))) |
| 13837 | 13837 | ||
| 13838 | ;; Parse the string and create a lisp form | 13838 | ;; Parse the string and create a lisp form |
| 13839 | (let ((match0 match) | 13839 | (let ((match0 match) |
| 13840 | (re (org-re "^&?\\([-+:]\\)?\\({[^}]+}\\|LEVEL=\\([0-9]+\\)\\|\\([[:alnum:]]+\\)=\\({[^}]+}\\|\"[^\"]+\"\\)\\|[[:alnum:]_@]+\\)")) | 13840 | (re (org-re "^&?\\([-+:]\\)?\\({[^}]+}\\|LEVEL=\\([0-9]+\\)\\|\\([[:alnum:]]+\\)=\\({[^}]+}\\|\"[^\"]+\"\\)\\|[[:alnum:]_@]+\\)")) |
| @@ -13997,12 +13997,12 @@ With prefix ARG, realign all tags in headings in the current buffer." | |||
| 13997 | (while (string-match "[-+&]+" tags) | 13997 | (while (string-match "[-+&]+" tags) |
| 13998 | ;; No boolean logic, just a list | 13998 | ;; No boolean logic, just a list |
| 13999 | (setq tags (replace-match ":" t t tags)))) | 13999 | (setq tags (replace-match ":" t t tags)))) |
| 14000 | 14000 | ||
| 14001 | (if (string-match "\\`[\t ]*\\'" tags) | 14001 | (if (string-match "\\`[\t ]*\\'" tags) |
| 14002 | (setq tags "") | 14002 | (setq tags "") |
| 14003 | (unless (string-match ":$" tags) (setq tags (concat tags ":"))) | 14003 | (unless (string-match ":$" tags) (setq tags (concat tags ":"))) |
| 14004 | (unless (string-match "^:" tags) (setq tags (concat ":" tags)))) | 14004 | (unless (string-match "^:" tags) (setq tags (concat ":" tags)))) |
| 14005 | 14005 | ||
| 14006 | ;; Insert new tags at the correct column | 14006 | ;; Insert new tags at the correct column |
| 14007 | (beginning-of-line 1) | 14007 | (beginning-of-line 1) |
| 14008 | (cond | 14008 | (cond |
| @@ -14321,7 +14321,7 @@ Returns the new tags string, or nil to not change the current settings." | |||
| 14321 | (let (tags) | 14321 | (let (tags) |
| 14322 | (save-excursion | 14322 | (save-excursion |
| 14323 | (goto-char (point-min)) | 14323 | (goto-char (point-min)) |
| 14324 | (while (re-search-forward | 14324 | (while (re-search-forward |
| 14325 | (org-re "[ \t]:\\([[:alnum:]_@:]+\\):[ \t\r\n]") nil t) | 14325 | (org-re "[ \t]:\\([[:alnum:]_@:]+\\):[ \t\r\n]") nil t) |
| 14326 | (when (equal (char-after (point-at-bol 0)) ?*) | 14326 | (when (equal (char-after (point-at-bol 0)) ?*) |
| 14327 | (mapc (lambda (x) (add-to-list 'tags x)) | 14327 | (mapc (lambda (x) (add-to-list 'tags x)) |
| @@ -14469,7 +14469,7 @@ If WHICH is nil or `all', get all properties. If WHICH is | |||
| 14469 | (unless (member key excluded) | 14469 | (unless (member key excluded) |
| 14470 | (push (cons key (or value "")) props))))) | 14470 | (push (cons key (or value "")) props))))) |
| 14471 | (append sum-props (nreverse props))))))) | 14471 | (append sum-props (nreverse props))))))) |
| 14472 | 14472 | ||
| 14473 | (defun org-entry-get (pom property &optional inherit) | 14473 | (defun org-entry-get (pom property &optional inherit) |
| 14474 | "Get value of PROPERTY for entry at point-or-marker POM. | 14474 | "Get value of PROPERTY for entry at point-or-marker POM. |
| 14475 | If INHERIT is non-nil and the entry does not have the property, | 14475 | If INHERIT is non-nil and the entry does not have the property, |
| @@ -14636,7 +14636,7 @@ internally: ARCHIVE, CATEGORY, SUMMARY, DESCRIPTION, LOCATION, and LOGGING." | |||
| 14636 | (defun org-set-property (property value) | 14636 | (defun org-set-property (property value) |
| 14637 | "In the current entry, set PROPERTY to VALUE." | 14637 | "In the current entry, set PROPERTY to VALUE." |
| 14638 | (interactive | 14638 | (interactive |
| 14639 | (let* ((prop (completing-read "Property: " | 14639 | (let* ((prop (completing-read "Property: " |
| 14640 | (mapcar 'list (org-buffer-property-keys)))) | 14640 | (mapcar 'list (org-buffer-property-keys)))) |
| 14641 | (cur (org-entry-get nil prop)) | 14641 | (cur (org-entry-get nil prop)) |
| 14642 | (allowed (org-property-get-allowed-values nil prop 'table)) | 14642 | (allowed (org-property-get-allowed-values nil prop 'table)) |
| @@ -14657,7 +14657,7 @@ internally: ARCHIVE, CATEGORY, SUMMARY, DESCRIPTION, LOCATION, and LOGGING." | |||
| 14657 | (let* ((prop (completing-read | 14657 | (let* ((prop (completing-read |
| 14658 | "Property: " (org-entry-properties nil 'standard)))) | 14658 | "Property: " (org-entry-properties nil 'standard)))) |
| 14659 | (list prop))) | 14659 | (list prop))) |
| 14660 | (message (concat "Property " property | 14660 | (message (concat "Property " property |
| 14661 | (if (org-entry-delete nil property) | 14661 | (if (org-entry-delete nil property) |
| 14662 | " deleted" | 14662 | " deleted" |
| 14663 | " was not present in the entry")))) | 14663 | " was not present in the entry")))) |
| @@ -14666,7 +14666,7 @@ internally: ARCHIVE, CATEGORY, SUMMARY, DESCRIPTION, LOCATION, and LOGGING." | |||
| 14666 | "Remove PROPERTY globally, from all entries." | 14666 | "Remove PROPERTY globally, from all entries." |
| 14667 | (interactive | 14667 | (interactive |
| 14668 | (let* ((prop (completing-read | 14668 | (let* ((prop (completing-read |
| 14669 | "Globally remove property: " | 14669 | "Globally remove property: " |
| 14670 | (mapcar 'list (org-buffer-property-keys))))) | 14670 | (mapcar 'list (org-buffer-property-keys))))) |
| 14671 | (list prop))) | 14671 | (list prop))) |
| 14672 | (save-excursion | 14672 | (save-excursion |
| @@ -14703,7 +14703,7 @@ completion." | |||
| 14703 | (let (vals) | 14703 | (let (vals) |
| 14704 | (cond | 14704 | (cond |
| 14705 | ((equal property "TODO") | 14705 | ((equal property "TODO") |
| 14706 | (setq vals (org-with-point-at pom | 14706 | (setq vals (org-with-point-at pom |
| 14707 | (append org-todo-keywords-1 '(""))))) | 14707 | (append org-todo-keywords-1 '(""))))) |
| 14708 | ((equal property "PRIORITY") | 14708 | ((equal property "PRIORITY") |
| 14709 | (let ((n org-lowest-priority)) | 14709 | (let ((n org-lowest-priority)) |
| @@ -14713,7 +14713,7 @@ completion." | |||
| 14713 | ((member property org-special-properties)) | 14713 | ((member property org-special-properties)) |
| 14714 | (t | 14714 | (t |
| 14715 | (setq vals (org-entry-get pom (concat property "_ALL") 'inherit)) | 14715 | (setq vals (org-entry-get pom (concat property "_ALL") 'inherit)) |
| 14716 | 14716 | ||
| 14717 | (when (and vals (string-match "\\S-" vals)) | 14717 | (when (and vals (string-match "\\S-" vals)) |
| 14718 | (setq vals (car (read-from-string (concat "(" vals ")")))) | 14718 | (setq vals (car (read-from-string (concat "(" vals ")")))) |
| 14719 | (setq vals (mapcar (lambda (x) | 14719 | (setq vals (mapcar (lambda (x) |
| @@ -14843,7 +14843,7 @@ This is the compiled version of the format.") | |||
| 14843 | (beginning-of-line 1) | 14843 | (beginning-of-line 1) |
| 14844 | (and (looking-at "\\(\\**\\)\\(\\* \\)") | 14844 | (and (looking-at "\\(\\**\\)\\(\\* \\)") |
| 14845 | (org-get-level-face 2)))) | 14845 | (org-get-level-face 2)))) |
| 14846 | (color (list :foreground | 14846 | (color (list :foreground |
| 14847 | (face-attribute (or level-face 'default) :foreground))) | 14847 | (face-attribute (or level-face 'default) :foreground))) |
| 14848 | props pom property ass width f string ov column) | 14848 | props pom property ass width f string ov column) |
| 14849 | ;; Check if the entry is in another buffer. | 14849 | ;; Check if the entry is in another buffer. |
| @@ -14988,7 +14988,7 @@ Where possible, use the standard interface for changing this line." | |||
| 14988 | nval eval allowed) | 14988 | nval eval allowed) |
| 14989 | (when (equal key "ITEM") | 14989 | (when (equal key "ITEM") |
| 14990 | (error "Cannot edit item headline from here")) | 14990 | (error "Cannot edit item headline from here")) |
| 14991 | 14991 | ||
| 14992 | (cond | 14992 | (cond |
| 14993 | ((equal key "TODO") | 14993 | ((equal key "TODO") |
| 14994 | (setq eval '(org-with-point-at pom | 14994 | (setq eval '(org-with-point-at pom |
| @@ -15021,7 +15021,7 @@ Where possible, use the standard interface for changing this line." | |||
| 15021 | (remove-text-properties (1- bol) eol '(read-only t)) | 15021 | (remove-text-properties (1- bol) eol '(read-only t)) |
| 15022 | (unwind-protect | 15022 | (unwind-protect |
| 15023 | (progn | 15023 | (progn |
| 15024 | (setq org-columns-overlays | 15024 | (setq org-columns-overlays |
| 15025 | (org-delete-all line-overlays org-columns-overlays)) | 15025 | (org-delete-all line-overlays org-columns-overlays)) |
| 15026 | (mapc 'org-delete-overlay line-overlays) | 15026 | (mapc 'org-delete-overlay line-overlays) |
| 15027 | (org-columns-eval eval)) | 15027 | (org-columns-eval eval)) |
| @@ -15040,7 +15040,7 @@ Where possible, use the standard interface for changing this line." | |||
| 15040 | (allowed (org-entry-get (point) key1 t)) | 15040 | (allowed (org-entry-get (point) key1 t)) |
| 15041 | nval) | 15041 | nval) |
| 15042 | (setq nval (read-string "Allowed: " allowed)) | 15042 | (setq nval (read-string "Allowed: " allowed)) |
| 15043 | (org-entry-put | 15043 | (org-entry-put |
| 15044 | (cond ((marker-position org-entry-property-inherited-from) | 15044 | (cond ((marker-position org-entry-property-inherited-from) |
| 15045 | org-entry-property-inherited-from) | 15045 | org-entry-property-inherited-from) |
| 15046 | ((marker-position org-columns-top-level-marker) | 15046 | ((marker-position org-columns-top-level-marker) |
| @@ -15050,8 +15050,7 @@ Where possible, use the standard interface for changing this line." | |||
| 15050 | (defun org-columns-eval (form) | 15050 | (defun org-columns-eval (form) |
| 15051 | (let (hidep) | 15051 | (let (hidep) |
| 15052 | (save-excursion | 15052 | (save-excursion |
| 15053 | (beginning-of-line 1) | 15053 | (forward-line 1) |
| 15054 | (next-line 1) | ||
| 15055 | (setq hidep (org-on-heading-p 1))) | 15054 | (setq hidep (org-on-heading-p 1))) |
| 15056 | (eval form) | 15055 | (eval form) |
| 15057 | (and hidep (hide-entry)))) | 15056 | (and hidep (hide-entry)))) |
| @@ -15099,7 +15098,7 @@ Where possible, use the standard interface for changing this line." | |||
| 15099 | (remove-text-properties (1- bol) eol '(read-only t)) | 15098 | (remove-text-properties (1- bol) eol '(read-only t)) |
| 15100 | (unwind-protect | 15099 | (unwind-protect |
| 15101 | (progn | 15100 | (progn |
| 15102 | (setq org-columns-overlays | 15101 | (setq org-columns-overlays |
| 15103 | (org-delete-all line-overlays org-columns-overlays)) | 15102 | (org-delete-all line-overlays org-columns-overlays)) |
| 15104 | (mapc 'org-delete-overlay line-overlays) | 15103 | (mapc 'org-delete-overlay line-overlays) |
| 15105 | (org-columns-eval '(org-entry-put pom key nval))) | 15104 | (org-columns-eval '(org-entry-put pom key nval))) |
| @@ -15250,7 +15249,7 @@ Where possible, use the standard interface for changing this line." | |||
| 15250 | (error "Cannot shift this column further to the left")) | 15249 | (error "Cannot shift this column further to the left")) |
| 15251 | (backward-char 1) | 15250 | (backward-char 1) |
| 15252 | (org-columns-move-right) | 15251 | (org-columns-move-right) |
| 15253 | (backward-char 1))) | 15252 | (backward-char 1))) |
| 15254 | 15253 | ||
| 15255 | (defun org-columns-store-format () | 15254 | (defun org-columns-store-format () |
| 15256 | "Store the text version of the current columns format in appropriate place. | 15255 | "Store the text version of the current columns format in appropriate place. |
| @@ -15348,7 +15347,7 @@ display, or in the #+COLUMNS line of the current buffer." | |||
| 15348 | (setq pos (org-overlay-start ov)) | 15347 | (setq pos (org-overlay-start ov)) |
| 15349 | (goto-char pos) | 15348 | (goto-char pos) |
| 15350 | (when (setq val (cdr (assoc property | 15349 | (when (setq val (cdr (assoc property |
| 15351 | (get-text-property | 15350 | (get-text-property |
| 15352 | (point-at-bol) 'org-summaries)))) | 15351 | (point-at-bol) 'org-summaries)))) |
| 15353 | (setq fmt (org-overlay-get ov 'org-columns-format)) | 15352 | (setq fmt (org-overlay-get ov 'org-columns-format)) |
| 15354 | (org-overlay-put ov 'org-columns-value val) | 15353 | (org-overlay-put ov 'org-columns-value val) |
| @@ -15404,7 +15403,7 @@ display, or in the #+COLUMNS line of the current buffer." | |||
| 15404 | (if flag str val) format)))) | 15403 | (if flag str val) format)))) |
| 15405 | (aset lflag level t)) | 15404 | (aset lflag level t)) |
| 15406 | ;; clear accumulators for deeper levels | 15405 | ;; clear accumulators for deeper levels |
| 15407 | (loop for l from (1+ level) to (1- lmax) do | 15406 | (loop for l from (1+ level) to (1- lmax) do |
| 15408 | (aset lsum l 0) | 15407 | (aset lsum l 0) |
| 15409 | (aset lflag l nil))) | 15408 | (aset lflag l nil))) |
| 15410 | ((>= level last-level) | 15409 | ((>= level last-level) |
| @@ -15720,7 +15719,7 @@ user." | |||
| 15720 | minute (if (match-end 3) | 15719 | minute (if (match-end 3) |
| 15721 | (string-to-number (match-string 3 ans)) | 15720 | (string-to-number (match-string 3 ans)) |
| 15722 | 0) | 15721 | 0) |
| 15723 | pm (equal ?p | 15722 | pm (equal ?p |
| 15724 | (string-to-char (downcase (match-string 4 ans))))) | 15723 | (string-to-char (downcase (match-string 4 ans))))) |
| 15725 | (if (and (= hour 12) (not pm)) | 15724 | (if (and (= hour 12) (not pm)) |
| 15726 | (setq hour 0) | 15725 | (setq hour 0) |
| @@ -16354,7 +16353,7 @@ in the timestamp determines what will be changed." | |||
| 16354 | (setq ng 6 new (car (rassoc (+ n (cdr (assoc (match-string 6 s) idx))) idx)))) | 16353 | (setq ng 6 new (car (rassoc (+ n (cdr (assoc (match-string 6 s) idx))) idx)))) |
| 16355 | ((org-pos-in-match-range pos 5) | 16354 | ((org-pos-in-match-range pos 5) |
| 16356 | (setq ng 5 new (format "%d" (max 1 (+ n (string-to-number (match-string 5 s)))))))) | 16355 | (setq ng 5 new (format "%d" (max 1 (+ n (string-to-number (match-string 5 s)))))))) |
| 16357 | 16356 | ||
| 16358 | (when ng | 16357 | (when ng |
| 16359 | (setq s (concat | 16358 | (setq s (concat |
| 16360 | (substring s 0 (match-beginning ng)) | 16359 | (substring s 0 (match-beginning ng)) |
| @@ -16421,28 +16420,28 @@ belonging to the category \"Work\"." | |||
| 16421 | (require 'org) | 16420 | (require 'org) |
| 16422 | (if (equal filter '(4)) | 16421 | (if (equal filter '(4)) |
| 16423 | (setq filter (read-from-minibuffer "Regexp filter: "))) | 16422 | (setq filter (read-from-minibuffer "Regexp filter: "))) |
| 16424 | (let* ((today (org-date-to-gregorian | 16423 | (let* ((today (org-date-to-gregorian |
| 16425 | (time-to-days (current-time)))) | 16424 | (time-to-days (current-time)))) |
| 16426 | (files org-agenda-files) entries file) | 16425 | (files org-agenda-files) entries file) |
| 16427 | (while (setq file (pop files)) | 16426 | (while (setq file (pop files)) |
| 16428 | (setq entries (append entries (org-agenda-get-day-entries | 16427 | (setq entries (append entries (org-agenda-get-day-entries |
| 16429 | file today :timestamp)))) | 16428 | file today :timestamp)))) |
| 16430 | (setq entries (delq nil entries)) | 16429 | (setq entries (delq nil entries)) |
| 16431 | (mapc | 16430 | (mapc |
| 16432 | (lambda(x) | 16431 | (lambda(x) |
| 16433 | (let* ((evt (org-trim (get-text-property 1 'txt x))) | 16432 | (let* ((evt (org-trim (get-text-property 1 'txt x))) |
| 16434 | (cat (get-text-property 1 'org-category x)) | 16433 | (cat (get-text-property 1 'org-category x)) |
| 16435 | (tod (get-text-property 1 'time-of-day x)) | 16434 | (tod (get-text-property 1 'time-of-day x)) |
| 16436 | (ok (or (and (stringp filter) (string-match filter evt)) | 16435 | (ok (or (and (stringp filter) (string-match filter evt)) |
| 16437 | (and (not (null filter)) (listp filter) | 16436 | (and (not (null filter)) (listp filter) |
| 16438 | (or (string-match | 16437 | (or (string-match |
| 16439 | (cadr (assoc 'category filter)) cat) | 16438 | (cadr (assoc 'category filter)) cat) |
| 16440 | (string-match | 16439 | (string-match |
| 16441 | (cadr (assoc 'headline filter)) evt)))))) | 16440 | (cadr (assoc 'headline filter)) evt)))))) |
| 16442 | ;; (setq evt (set-text-properties 0 (length event) nil evt)) | 16441 | ;; (setq evt (set-text-properties 0 (length event) nil evt)) |
| 16443 | (when (and ok tod) | 16442 | (when (and ok tod) |
| 16444 | (setq tod (number-to-string tod) | 16443 | (setq tod (number-to-string tod) |
| 16445 | tod (when (string-match | 16444 | tod (when (string-match |
| 16446 | "\\([0-9]\\{1,2\\}\\)\\([0-9]\\{2\\}\\)" tod) | 16445 | "\\([0-9]\\{1,2\\}\\)\\([0-9]\\{2\\}\\)" tod) |
| 16447 | (concat (match-string 1 tod) ":" | 16446 | (concat (match-string 1 tod) ":" |
| 16448 | (match-string 2 tod)))) | 16447 | (match-string 2 tod)))) |
| @@ -16923,7 +16922,7 @@ the returned times will be formatted strings." | |||
| 16923 | (setq total-time (+ (or total-time 0) | 16922 | (setq total-time (+ (or total-time 0) |
| 16924 | org-clock-file-total-minutes))))))) | 16923 | org-clock-file-total-minutes))))))) |
| 16925 | (goto-char pos) | 16924 | (goto-char pos) |
| 16926 | 16925 | ||
| 16927 | (unless (eq scope 'agenda) | 16926 | (unless (eq scope 'agenda) |
| 16928 | (org-clock-sum ts te) | 16927 | (org-clock-sum ts te) |
| 16929 | (goto-char (point-min)) | 16928 | (goto-char (point-min)) |
| @@ -16968,7 +16967,7 @@ the returned times will be formatted strings." | |||
| 16968 | (insert-before-markers | 16967 | (insert-before-markers |
| 16969 | "|-\n|" | 16968 | "|-\n|" |
| 16970 | (if (eq scope 'agenda) "|" "") | 16969 | (if (eq scope 'agenda) "|" "") |
| 16971 | "|" | 16970 | "|" |
| 16972 | "*Total time*| " | 16971 | "*Total time*| " |
| 16973 | (format "*%d:%02d*" h m) | 16972 | (format "*%d:%02d*" h m) |
| 16974 | "|\n|-\n") | 16973 | "|\n|-\n") |
| @@ -19766,7 +19765,7 @@ With prefix ARG, go forward that many times the current span." | |||
| 19766 | (list (car org-agenda-last-arguments) sd nd t))) | 19765 | (list (car org-agenda-last-arguments) sd nd t))) |
| 19767 | (org-agenda-redo) | 19766 | (org-agenda-redo) |
| 19768 | (org-agenda-find-today-or-agenda)))) | 19767 | (org-agenda-find-today-or-agenda)))) |
| 19769 | 19768 | ||
| 19770 | (defun org-agenda-earlier (arg) | 19769 | (defun org-agenda-earlier (arg) |
| 19771 | "Go backward in time by the current span. | 19770 | "Go backward in time by the current span. |
| 19772 | With prefix ARG, go backward that many times the current span." | 19771 | With prefix ARG, go backward that many times the current span." |
| @@ -20480,7 +20479,7 @@ be used to request time specification in the time stamp." | |||
| 20480 | (save-excursion | 20479 | (save-excursion |
| 20481 | (org-back-to-heading t) | 20480 | (org-back-to-heading t) |
| 20482 | (if (looking-at | 20481 | (if (looking-at |
| 20483 | (if no-tags | 20482 | (if no-tags |
| 20484 | (org-re "\\*+[ \t]+\\([^\n\r]*?\\)\\([ \t]+:[[:alnum:]:_@]+:[ \t]*\\)?$") | 20483 | (org-re "\\*+[ \t]+\\([^\n\r]*?\\)\\([ \t]+:[[:alnum:]:_@]+:[ \t]*\\)?$") |
| 20485 | "\\*+[ \t]+\\([^\r\n]*\\)")) | 20484 | "\\*+[ \t]+\\([^\r\n]*\\)")) |
| 20486 | (match-string 1) ""))) | 20485 | (match-string 1) ""))) |
| @@ -21530,7 +21529,7 @@ translations. There is currently no way for users to extend this.") | |||
| 21530 | (setq fmt (pop formatters)) | 21529 | (setq fmt (pop formatters)) |
| 21531 | (when (car fmt) | 21530 | (when (car fmt) |
| 21532 | (goto-char (point-min)) | 21531 | (goto-char (point-min)) |
| 21533 | (while (re-search-forward (concat "^#\\+" (cadr fmt) | 21532 | (while (re-search-forward (concat "^#\\+" (cadr fmt) |
| 21534 | ":[ \t]*\\(.*\\)") nil t) | 21533 | ":[ \t]*\\(.*\\)") nil t) |
| 21535 | (replace-match "\\1" t) | 21534 | (replace-match "\\1" t) |
| 21536 | (add-text-properties | 21535 | (add-text-properties |
| @@ -21538,7 +21537,7 @@ translations. There is currently no way for users to extend this.") | |||
| 21538 | '(org-protected t)))) | 21537 | '(org-protected t)))) |
| 21539 | (goto-char (point-min)) | 21538 | (goto-char (point-min)) |
| 21540 | (while (re-search-forward | 21539 | (while (re-search-forward |
| 21541 | (concat "^#\\+" | 21540 | (concat "^#\\+" |
| 21542 | (caddr fmt) "\\>.*\\(\\(\n.*\\)*?\n\\)#\\+" | 21541 | (caddr fmt) "\\>.*\\(\\(\n.*\\)*?\n\\)#\\+" |
| 21543 | (cadddr fmt) "\\>.*\n?") nil t) | 21542 | (cadddr fmt) "\\>.*\n?") nil t) |
| 21544 | (if (car fmt) | 21543 | (if (car fmt) |
| @@ -21689,7 +21688,7 @@ translations. There is currently no way for users to extend this.") | |||
| 21689 | (add-text-properties (point) (1+ (point-at-eol)) | 21688 | (add-text-properties (point) (1+ (point-at-eol)) |
| 21690 | (list :org-license-to-kill t))))) | 21689 | (list :org-license-to-kill t))))) |
| 21691 | title)) | 21690 | title)) |
| 21692 | 21691 | ||
| 21693 | (defun org-solidify-link-text (s &optional alist) | 21692 | (defun org-solidify-link-text (s &optional alist) |
| 21694 | "Take link text and make a safe target out of it." | 21693 | "Take link text and make a safe target out of it." |
| 21695 | (save-match-data | 21694 | (save-match-data |
| @@ -22778,7 +22777,7 @@ lang=\"%s\" xml:lang=\"%s\"> | |||
| 22778 | (if (and (string-match org-todo-line-regexp line) | 22777 | (if (and (string-match org-todo-line-regexp line) |
| 22779 | (match-beginning 2)) | 22778 | (match-beginning 2)) |
| 22780 | 22779 | ||
| 22781 | (setq line | 22780 | (setq line |
| 22782 | (concat (substring line 0 (match-beginning 2)) | 22781 | (concat (substring line 0 (match-beginning 2)) |
| 22783 | "<span class=\"" | 22782 | "<span class=\"" |
| 22784 | (if (member (match-string 2 line) | 22783 | (if (member (match-string 2 line) |
| @@ -23112,14 +23111,14 @@ lang=\"%s\" xml:lang=\"%s\"> | |||
| 23112 | (lambda (x) | 23111 | (lambda (x) |
| 23113 | (setq gr (pop org-table-colgroup-info)) | 23112 | (setq gr (pop org-table-colgroup-info)) |
| 23114 | (format "%s<COL align=\"%s\"></COL>%s" | 23113 | (format "%s<COL align=\"%s\"></COL>%s" |
| 23115 | (if (memq gr '(:start :startend)) | 23114 | (if (memq gr '(:start :startend)) |
| 23116 | (prog1 | 23115 | (prog1 |
| 23117 | (if colgropen "</colgroup>\n<colgroup>" "<colgroup>") | 23116 | (if colgropen "</colgroup>\n<colgroup>" "<colgroup>") |
| 23118 | (setq colgropen t)) | 23117 | (setq colgropen t)) |
| 23119 | "") | 23118 | "") |
| 23120 | (if (> (/ (float x) nlines) org-table-number-fraction) | 23119 | (if (> (/ (float x) nlines) org-table-number-fraction) |
| 23121 | "right" "left") | 23120 | "right" "left") |
| 23122 | (if (memq gr '(:end :startend)) | 23121 | (if (memq gr '(:end :startend)) |
| 23123 | (progn (setq colgropen nil) "</colgroup>") | 23122 | (progn (setq colgropen nil) "</colgroup>") |
| 23124 | ""))) | 23123 | ""))) |
| 23125 | fnum "") | 23124 | fnum "") |
diff --git a/lisp/time.el b/lisp/time.el index 8bc14974315..4d94fb7aeb3 100644 --- a/lisp/time.el +++ b/lisp/time.el | |||
| @@ -127,7 +127,7 @@ LABEL is a string to display to label that zone's time." | |||
| 127 | :type '(repeat (list string string)) | 127 | :type '(repeat (list string string)) |
| 128 | :version "23.1") | 128 | :version "23.1") |
| 129 | 129 | ||
| 130 | (defcustom display-time-world-time-format "%A %m %B %R %Z" | 130 | (defcustom display-time-world-time-format "%A %d %B %R %Z" |
| 131 | "Format of the time displayed, see `format-time-string'." | 131 | "Format of the time displayed, see `format-time-string'." |
| 132 | :group 'display-time | 132 | :group 'display-time |
| 133 | :type 'string | 133 | :type 'string |
diff --git a/lisp/tutorial.el b/lisp/tutorial.el index 26fb0e503f7..336593891ab 100644 --- a/lisp/tutorial.el +++ b/lisp/tutorial.el | |||
| @@ -291,7 +291,7 @@ LEFT and RIGHT are the elements to compare." | |||
| 291 | ;; * MODE LINE | 291 | ;; * MODE LINE |
| 292 | (describe-mode [?\C-h ?m]) | 292 | (describe-mode [?\C-h ?m]) |
| 293 | (set-fill-column [?\C-x ?f]) | 293 | (set-fill-column [?\C-x ?f]) |
| 294 | (fill-paragraph-or-region [?\M-q]) | 294 | (fill-paragraph [?\M-q]) |
| 295 | 295 | ||
| 296 | ;; * SEARCHING | 296 | ;; * SEARCHING |
| 297 | (isearch-forward [?\C-s]) | 297 | (isearch-forward [?\C-s]) |
| @@ -665,7 +665,8 @@ position where the display of changed bindings was inserted." | |||
| 665 | ;; This runs in a hook so protect it: | 665 | ;; This runs in a hook so protect it: |
| 666 | (condition-case err | 666 | (condition-case err |
| 667 | (if (y-or-n-p "Save your position in the tutorial? ") | 667 | (if (y-or-n-p "Save your position in the tutorial? ") |
| 668 | (tutorial--save-tutorial-to (tutorial--saved-file))) | 668 | (tutorial--save-tutorial-to (tutorial--saved-file)) |
| 669 | (message "Tutorial position not saved")) | ||
| 669 | (error (message "Error saving tutorial state: %s" | 670 | (error (message "Error saving tutorial state: %s" |
| 670 | (error-message-string err))))) | 671 | (error-message-string err))))) |
| 671 | 672 | ||
diff --git a/lisp/vc-hooks.el b/lisp/vc-hooks.el index 92c6c734483..e28a01d35e6 100644 --- a/lisp/vc-hooks.el +++ b/lisp/vc-hooks.el | |||
| @@ -556,6 +556,13 @@ If FILE is not registered, this function always returns nil." | |||
| 556 | (if (vc-backend file) | 556 | (if (vc-backend file) |
| 557 | (vc-file-setprop file 'vc-working-revision | 557 | (vc-file-setprop file 'vc-working-revision |
| 558 | (vc-call working-revision file))))) | 558 | (vc-call working-revision file))))) |
| 559 | ;; Backward compatibility. | ||
| 560 | (define-obsolete-function-alias | ||
| 561 | 'vc-workfile-version 'vc-working-revision "23.1") | ||
| 562 | (defun vc-default-working-revision (backend file) | ||
| 563 | (message | ||
| 564 | "`working-revision' not found: using the old `workfile-version' instead") | ||
| 565 | (vc-call-backend backend 'workfile-version file)) | ||
| 559 | 566 | ||
| 560 | (defun vc-default-registered (backend file) | 567 | (defun vc-default-registered (backend file) |
| 561 | "Check if FILE is registered in BACKEND using vc-BACKEND-master-templates." | 568 | "Check if FILE is registered in BACKEND using vc-BACKEND-master-templates." |
diff --git a/lisp/vc.el b/lisp/vc.el index a0db56ce6d7..0cf800c2ddd 100644 --- a/lisp/vc.el +++ b/lisp/vc.el | |||
| @@ -1873,24 +1873,17 @@ The meaning of REV1 and REV2 is the same as for `vc-revision-diff'." | |||
| 1873 | (make-obsolete 'vc-diff-switches-list 'vc-switches "22.1") | 1873 | (make-obsolete 'vc-diff-switches-list 'vc-switches "22.1") |
| 1874 | 1874 | ||
| 1875 | (defun vc-diff-sentinel (verbose rev1-name rev2-name) | 1875 | (defun vc-diff-sentinel (verbose rev1-name rev2-name) |
| 1876 | ;; Did changes get generated into the buffer? | 1876 | ;; The empty sync output case has already been handled, so the only |
| 1877 | (if (not (zerop (buffer-size (get-buffer "*vc-diff*")))) | 1877 | ;; possibility of an empty output is for an async process, in which case |
| 1878 | (progn | 1878 | ;; it's important to insert the "diffs end here" message in the buffer |
| 1879 | (pop-to-buffer "*vc-diff*") | 1879 | ;; since the user may miss a message in the echo area. |
| 1880 | ;; Gnus-5.8.5 sets up an autoload for diff-mode, even if it's | 1880 | (when verbose |
| 1881 | ;; not available. Work around that. | 1881 | (let ((inhibit-read-only t)) |
| 1882 | (if (require 'diff-mode nil t) (diff-mode)) | 1882 | (if (eq (buffer-size) 0) |
| 1883 | (when verbose | 1883 | (insert "No differences found.\n") |
| 1884 | (let (buffer-read-only) | 1884 | (insert (format "\n\nDiffs between %s and %s end here." rev1-name rev2-name))))) |
| 1885 | (goto-char (point-max)) | 1885 | (goto-char (point-min)) |
| 1886 | (insert (format "\n\nDiffs between %s and %s end here." rev1-name rev2-name)) | 1886 | (shrink-window-if-larger-than-buffer)) |
| 1887 | (goto-char (point-min)) | ||
| 1888 | (insert (format "Diffs between %s and %s:\n\n" rev1-name rev2-name)))) | ||
| 1889 | (shrink-window-if-larger-than-buffer) | ||
| 1890 | t) | ||
| 1891 | (progn | ||
| 1892 | (message "No changes between %s and %s" rev1-name rev2-name) | ||
| 1893 | nil))) | ||
| 1894 | 1887 | ||
| 1895 | (defun vc-diff-internal (backend async files rev1 rev2 &optional verbose) | 1888 | (defun vc-diff-internal (backend async files rev1 rev2 &optional verbose) |
| 1896 | "Report diffs between two revisions of a fileset. | 1889 | "Report diffs between two revisions of a fileset. |
| @@ -1927,12 +1920,20 @@ returns t if the buffer had changes, nil otherwise." | |||
| 1927 | (let ((vc-disable-async-diff (not async))) | 1920 | (let ((vc-disable-async-diff (not async))) |
| 1928 | (vc-call-backend backend 'diff filtered rev1 rev2 "*vc-diff*"))) | 1921 | (vc-call-backend backend 'diff filtered rev1 rev2 "*vc-diff*"))) |
| 1929 | (set-buffer "*vc-diff*") | 1922 | (set-buffer "*vc-diff*") |
| 1930 | ;; This odd-looking code is because in the non-async case we | 1923 | (if (and (zerop (buffer-size)) |
| 1931 | ;; actually want to pass the return value from vc-diff-sentinel | 1924 | (not (get-buffer-process (current-buffer)))) |
| 1932 | ;; back to the caller. | 1925 | ;; Treat this case specially so as not to pop the buffer. |
| 1933 | (if async | 1926 | (progn |
| 1934 | (vc-exec-after `(vc-diff-sentinel ,verbose ,rev1-name ,rev2-name)) | 1927 | (message "No changes between %s and %s" rev1-name rev2-name) |
| 1935 | (vc-diff-sentinel verbose rev1-name rev2-name)))) | 1928 | nil) |
| 1929 | (pop-to-buffer (current-buffer)) | ||
| 1930 | ;; Gnus-5.8.5 sets up an autoload for diff-mode, even if it's | ||
| 1931 | ;; not available. Work around that. | ||
| 1932 | (if (require 'diff-mode nil t) (diff-mode)) | ||
| 1933 | (vc-exec-after `(vc-diff-sentinel ,verbose ,rev1-name ,rev2-name)) | ||
| 1934 | ;; In the async case, we return t even if there are no differences | ||
| 1935 | ;; because we don't know that yet. | ||
| 1936 | t))) | ||
| 1936 | 1937 | ||
| 1937 | ;;;###autoload | 1938 | ;;;###autoload |
| 1938 | (defun vc-history-diff (backend files rev1 rev2) | 1939 | (defun vc-history-diff (backend files rev1 rev2) |
| @@ -3031,10 +3032,7 @@ to provide the `find-revision' operation instead." | |||
| 3031 | (vc-register))) | 3032 | (vc-register))) |
| 3032 | 3033 | ||
| 3033 | (defalias 'vc-default-logentry-check 'ignore) | 3034 | (defalias 'vc-default-logentry-check 'ignore) |
| 3034 | 3035 | (defalias 'vc-default-check-headers 'ignore) | |
| 3035 | (defun vc-default-check-headers (backend) | ||
| 3036 | "Default implementation of check-headers; always returns nil." | ||
| 3037 | nil) | ||
| 3038 | 3036 | ||
| 3039 | (defun vc-default-log-view-mode (backend) (log-view-mode)) | 3037 | (defun vc-default-log-view-mode (backend) (log-view-mode)) |
| 3040 | 3038 | ||
| @@ -3116,7 +3114,7 @@ to provide the `find-revision' operation instead." | |||
| 3116 | (and (not vc-make-backup-files) (delete-file backup-name)))))) | 3114 | (and (not vc-make-backup-files) (delete-file backup-name)))))) |
| 3117 | (message "Checking out %s...done" file)))) | 3115 | (message "Checking out %s...done" file)))) |
| 3118 | 3116 | ||
| 3119 | (defun vc-default-revision-completion-table (backend file) nil) | 3117 | (defalias 'vc-default-revision-completion-table 'ignore) |
| 3120 | 3118 | ||
| 3121 | (defun vc-check-headers () | 3119 | (defun vc-check-headers () |
| 3122 | "Check if the current file has any headers in it." | 3120 | "Check if the current file has any headers in it." |
diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el index 15aebb08ab2..adb6f08943c 100644 --- a/lisp/xt-mouse.el +++ b/lisp/xt-mouse.el | |||
| @@ -45,9 +45,6 @@ | |||
| 45 | 45 | ||
| 46 | (defvar xterm-mouse-debug-buffer nil) | 46 | (defvar xterm-mouse-debug-buffer nil) |
| 47 | 47 | ||
| 48 | ;; XXX Perhaps this should be terminal-local instead. --lorentey | ||
| 49 | (define-key function-key-map "\e[M" 'xterm-mouse-translate) | ||
| 50 | |||
| 51 | (defvar xterm-mouse-last) | 48 | (defvar xterm-mouse-last) |
| 52 | 49 | ||
| 53 | ;; Mouse events symbols must have an 'event-kind property with | 50 | ;; Mouse events symbols must have an 'event-kind property with |
| @@ -78,7 +75,7 @@ | |||
| 78 | (error "Unexpected escape sequence from XTerm"))) | 75 | (error "Unexpected escape sequence from XTerm"))) |
| 79 | 76 | ||
| 80 | (let* ((click (if is-click down (xterm-mouse-event))) | 77 | (let* ((click (if is-click down (xterm-mouse-event))) |
| 81 | (click-command (nth 0 click)) | 78 | ;; (click-command (nth 0 click)) |
| 82 | (click-data (nth 1 click)) | 79 | (click-data (nth 1 click)) |
| 83 | (click-where (nth 1 click-data))) | 80 | (click-where (nth 1 click-data))) |
| 84 | (if (memq down-binding '(nil ignore)) | 81 | (if (memq down-binding '(nil ignore)) |
| @@ -209,14 +206,15 @@ down the SHIFT key while pressing the mouse button." | |||
| 209 | ;; Turn it on | 206 | ;; Turn it on |
| 210 | (progn | 207 | (progn |
| 211 | ;; Frame creation and deletion. | 208 | ;; Frame creation and deletion. |
| 212 | (add-hook 'after-make-frame-functions | 209 | (add-hook 'terminal-init-xterm-hook |
| 213 | 'turn-on-xterm-mouse-tracking-on-terminal) | 210 | 'turn-on-xterm-mouse-tracking-on-terminal) |
| 211 | |||
| 214 | (add-hook 'delete-frame-functions 'xterm-mouse-handle-delete-frame) | 212 | (add-hook 'delete-frame-functions 'xterm-mouse-handle-delete-frame) |
| 215 | 213 | ||
| 216 | ;; Restore normal mouse behaviour outside Emacs. | 214 | ;; Restore normal mouse behaviour outside Emacs. |
| 217 | (add-hook 'suspend-tty-functions | 215 | (add-hook 'suspend-tty-functions |
| 218 | 'turn-off-xterm-mouse-tracking-on-terminal) | 216 | 'turn-off-xterm-mouse-tracking-on-terminal) |
| 219 | (add-hook 'resume-tty-functions | 217 | (add-hook 'resume-tty-functions |
| 220 | 'turn-on-xterm-mouse-tracking-on-terminal) | 218 | 'turn-on-xterm-mouse-tracking-on-terminal) |
| 221 | (add-hook 'suspend-hook 'turn-off-xterm-mouse-tracking) | 219 | (add-hook 'suspend-hook 'turn-off-xterm-mouse-tracking) |
| 222 | (add-hook 'suspend-resume-hook 'turn-on-xterm-mouse-tracking) | 220 | (add-hook 'suspend-resume-hook 'turn-on-xterm-mouse-tracking) |
| @@ -224,8 +222,6 @@ down the SHIFT key while pressing the mouse button." | |||
| 224 | (setq mouse-position-function #'xterm-mouse-position-function) | 222 | (setq mouse-position-function #'xterm-mouse-position-function) |
| 225 | (turn-on-xterm-mouse-tracking)) | 223 | (turn-on-xterm-mouse-tracking)) |
| 226 | ;; Turn it off | 224 | ;; Turn it off |
| 227 | (remove-hook 'after-make-frame-functions | ||
| 228 | 'turn-on-xterm-mouse-tracking-on-terminal) | ||
| 229 | (remove-hook 'delete-frame-functions 'xterm-mouse-handle-delete-frame) | 225 | (remove-hook 'delete-frame-functions 'xterm-mouse-handle-delete-frame) |
| 230 | (remove-hook 'suspend-tty-functions | 226 | (remove-hook 'suspend-tty-functions |
| 231 | 'turn-off-xterm-mouse-tracking-on-terminal) | 227 | 'turn-off-xterm-mouse-tracking-on-terminal) |
| @@ -239,28 +235,35 @@ down the SHIFT key while pressing the mouse button." | |||
| 239 | 235 | ||
| 240 | (defun turn-on-xterm-mouse-tracking () | 236 | (defun turn-on-xterm-mouse-tracking () |
| 241 | "Enable Emacs mouse tracking in xterm." | 237 | "Enable Emacs mouse tracking in xterm." |
| 242 | (dolist (f (frame-list)) | 238 | (dolist (terminal (delete-dups (mapcar 'frame-terminal (frame-list)))) |
| 243 | (when (eq t (frame-live-p f)) | 239 | (turn-on-xterm-mouse-tracking-on-terminal terminal))) |
| 244 | (with-selected-frame f | ||
| 245 | (when xterm-mouse-mode | ||
| 246 | (send-string-to-terminal "\e[?1000h")))))) | ||
| 247 | 240 | ||
| 248 | (defun turn-off-xterm-mouse-tracking (&optional force) | 241 | (defun turn-off-xterm-mouse-tracking (&optional force) |
| 249 | "Disable Emacs mouse tracking in xterm." | 242 | "Disable Emacs mouse tracking in xterm." |
| 250 | (dolist (f (frame-list)) | 243 | (dolist (terminal (delete-dups (mapcar 'frame-terminal (frame-list)))) |
| 251 | (when (eq t (frame-live-p f)) | 244 | (turn-off-xterm-mouse-tracking-on-terminal terminal))) |
| 252 | (with-selected-frame f | ||
| 253 | (when (or force xterm-mouse-mode) | ||
| 254 | (send-string-to-terminal "\e[?1000l")))))) | ||
| 255 | 245 | ||
| 256 | (defun turn-on-xterm-mouse-tracking-on-terminal (terminal) | 246 | (defun turn-on-xterm-mouse-tracking-on-terminal (&optional terminal) |
| 257 | "Enable xterm mouse tracking on TERMINAL." | 247 | "Enable xterm mouse tracking on TERMINAL." |
| 258 | (when (and xterm-mouse-mode (eq t (terminal-live-p terminal))) | 248 | (when (and xterm-mouse-mode (eq t (terminal-live-p terminal))) |
| 249 | (unless (terminal-parameter terminal 'xterm-mouse-mode) | ||
| 250 | ;; Simulate selecting a terminal by selecting one of its frames ;-( | ||
| 251 | (with-selected-frame (car (frames-on-display-list terminal)) | ||
| 252 | (define-key input-decode-map "\e[M" 'xterm-mouse-translate)) | ||
| 253 | (set-terminal-parameter terminal 'xterm-mouse-mode t)) | ||
| 259 | (send-string-to-terminal "\e[?1000h" terminal))) | 254 | (send-string-to-terminal "\e[?1000h" terminal))) |
| 260 | 255 | ||
| 261 | (defun turn-off-xterm-mouse-tracking-on-terminal (terminal) | 256 | (defun turn-off-xterm-mouse-tracking-on-terminal (terminal) |
| 262 | "Disable xterm mouse tracking on TERMINAL." | 257 | "Disable xterm mouse tracking on TERMINAL." |
| 263 | (when (and xterm-mouse-mode (eq t (terminal-live-p terminal))) | 258 | ;; Only send the disable command to those terminals to which we've already |
| 259 | ;; sent the enable command. | ||
| 260 | (when (and (terminal-parameter terminal 'xterm-mouse-mode) | ||
| 261 | (eq t (terminal-live-p terminal))) | ||
| 262 | ;; We could remove the key-binding and unset the `xterm-mouse-mode' | ||
| 263 | ;; terminal parameter, but it seems less harmful to send this escape | ||
| 264 | ;; command too many times (or to catch an unintended key sequence), than | ||
| 265 | ;; to send it too few times (or to fail to let xterm-mouse events | ||
| 266 | ;; pass by untranslated). | ||
| 264 | (send-string-to-terminal "\e[?1000l" terminal))) | 267 | (send-string-to-terminal "\e[?1000l" terminal))) |
| 265 | 268 | ||
| 266 | (defun xterm-mouse-handle-delete-frame (frame) | 269 | (defun xterm-mouse-handle-delete-frame (frame) |