diff options
| author | Kenichi Handa | 2010-08-25 14:15:20 +0900 |
|---|---|---|
| committer | Kenichi Handa | 2010-08-25 14:15:20 +0900 |
| commit | 4e603db3429957e6b26953c177f00a9c9d1c8766 (patch) | |
| tree | 8206240e3006468bff9dfda5fb3696f80fbcb9f0 /lisp | |
| parent | b60f961f6cdc1095e778ad624657bb57788512af (diff) | |
| parent | f6aa6ec68ed936800ef2c3aefa42102e60b654cb (diff) | |
| download | emacs-4e603db3429957e6b26953c177f00a9c9d1c8766.tar.gz emacs-4e603db3429957e6b26953c177f00a9c9d1c8766.zip | |
merge trunk
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 230 | ||||
| -rw-r--r-- | lisp/Makefile.in | 5 | ||||
| -rw-r--r-- | lisp/align.el | 6 | ||||
| -rw-r--r-- | lisp/calendar/diary-lib.el | 4 | ||||
| -rw-r--r-- | lisp/cus-edit.el | 4 | ||||
| -rw-r--r-- | lisp/emacs-lisp/easy-mmode.el | 30 | ||||
| -rw-r--r-- | lisp/emacs-lisp/package.el | 3 | ||||
| -rw-r--r-- | lisp/facemenu.el | 105 | ||||
| -rw-r--r-- | lisp/files.el | 46 | ||||
| -rw-r--r-- | lisp/ido.el | 67 | ||||
| -rw-r--r-- | lisp/image-mode.el | 83 | ||||
| -rw-r--r-- | lisp/image.el | 21 | ||||
| -rw-r--r-- | lisp/international/mule.el | 10 | ||||
| -rw-r--r-- | lisp/iswitchb.el | 10 | ||||
| -rw-r--r-- | lisp/mail/rmail.el | 13 | ||||
| -rw-r--r-- | lisp/makefile.w32-in | 5 | ||||
| -rw-r--r-- | lisp/menu-bar.el | 3 | ||||
| -rw-r--r-- | lisp/mouse.el | 716 | ||||
| -rw-r--r-- | lisp/net/dbus.el | 55 | ||||
| -rw-r--r-- | lisp/progmodes/flymake.el | 3 | ||||
| -rw-r--r-- | lisp/progmodes/make-mode.el | 8 | ||||
| -rw-r--r-- | lisp/progmodes/python.el | 95 | ||||
| -rw-r--r-- | lisp/progmodes/ruby-mode.el | 5 | ||||
| -rw-r--r-- | lisp/simple.el | 41 | ||||
| -rw-r--r-- | lisp/startup.el | 24 | ||||
| -rw-r--r-- | lisp/subr.el | 9 | ||||
| -rw-r--r-- | lisp/textmodes/flyspell.el | 6 | ||||
| -rw-r--r-- | lisp/vc/add-log.el | 12 | ||||
| -rw-r--r-- | lisp/whitespace.el | 356 | ||||
| -rw-r--r-- | lisp/woman.el | 5 |
30 files changed, 1123 insertions, 857 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 962b1618fbd..868667e4103 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -6,6 +6,205 @@ | |||
| 6 | * international/fontset.el (setup-default-fontset): Fix typo for | 6 | * international/fontset.el (setup-default-fontset): Fix typo for |
| 7 | arabic OTF spec (fini->fina). | 7 | arabic OTF spec (fini->fina). |
| 8 | 8 | ||
| 9 | 2010-08-24 Vinicius Jose Latorre <viniciusjl@ig.com.br> | ||
| 10 | |||
| 11 | * whitespace.el: Allow cleaning up blanks without blank | ||
| 12 | visualization (Bug#6651). Adjust help window for | ||
| 13 | whitespace-toggle-options (Bug#6479). Allow to use fill-column | ||
| 14 | instead of whitespace-line-column (from EmacsWiki). New version | ||
| 15 | 13.1. | ||
| 16 | (whitespace-style): Added new value 'face. Adjust docstring. | ||
| 17 | (whitespace-space, whitespace-hspace, whitespace-tab): Adjust | ||
| 18 | foreground property face. | ||
| 19 | (whitespace-line-column): Adjust docstring and type declaration. | ||
| 20 | (whitespace-style-value-list, whitespace-toggle-option-alist) | ||
| 21 | (whitespace-help-text): Adjust const initialization. | ||
| 22 | (whitespace-toggle-options, global-whitespace-toggle-options): | ||
| 23 | Adjust docstring. | ||
| 24 | (whitespace-display-window, whitespace-interactive-char) | ||
| 25 | (whitespace-style-face-p, whitespace-color-on): Adjust code. | ||
| 26 | (whitespace-help-scroll): New fun. | ||
| 27 | |||
| 28 | 2010-08-24 Chong Yidong <cyd@stupidchicken.com> | ||
| 29 | |||
| 30 | * emacs-lisp/package.el (list-packages): Alias for | ||
| 31 | package-list-packages. | ||
| 32 | |||
| 33 | 2010-08-24 Kevin Ryde <user42@zip.com.au> | ||
| 34 | |||
| 35 | * textmodes/flyspell.el (flyspell-check-tex-math-command): Doc fix | ||
| 36 | (Bug#5651). | ||
| 37 | |||
| 38 | * progmodes/ruby-mode.el (ruby): Add defgroup. | ||
| 39 | |||
| 40 | 2010-08-24 Chong Yidong <cyd@stupidchicken.com> | ||
| 41 | |||
| 42 | * progmodes/python.el: Add Ipython support (Bug#5390). | ||
| 43 | (python-shell-prompt-alist) | ||
| 44 | (python-shell-continuation-prompt-alist): New options. | ||
| 45 | (python--set-prompt-regexp): New function. | ||
| 46 | (inferior-python-mode, run-python, python-shell): Require | ||
| 47 | ansi-color. Use python--set-prompt-regexp to set the comint | ||
| 48 | prompt based on the Python interpreter. | ||
| 49 | (python--prompt-regexp): New var. | ||
| 50 | (python-check-comint-prompt) | ||
| 51 | (python-comint-output-filter-function): Use it. | ||
| 52 | (run-python): Use a pipe (Bug#5694). | ||
| 53 | |||
| 54 | 2010-08-24 Fabian Ezequiel Gallina <galli.87@gmail.com> (tiny change) | ||
| 55 | |||
| 56 | * progmodes/python.el (python-send-region): Send a different | ||
| 57 | Python command if Ipython is in use. | ||
| 58 | (python-check-version): Use a Python command to find the version. | ||
| 59 | |||
| 60 | 2010-08-24 Chong Yidong <cyd@stupidchicken.com> | ||
| 61 | |||
| 62 | * mouse.el (mouse-yank-primary): Avoid setting primary when | ||
| 63 | deactivating the mark (Bug#6872). | ||
| 64 | |||
| 65 | 2010-08-23 Michael Albinus <michael.albinus@gmx.de> | ||
| 66 | |||
| 67 | * net/dbus.el: Accept UNIX domain sockets as bus address. | ||
| 68 | (top): Don't initialize `dbus-registered-objects-table' anymore, | ||
| 69 | this is done in dbusbind,c. | ||
| 70 | (dbus-check-event): Adapt test for bus. | ||
| 71 | (dbus-return-values-table, dbus-unregister-service) | ||
| 72 | (dbus-event-bus-name, dbus-introspect, dbus-register-property): | ||
| 73 | Adapt doc string. | ||
| 74 | |||
| 75 | 2010-08-23 Juanma Barranquero <lekktu@gmail.com> | ||
| 76 | |||
| 77 | * ido.el (ido-use-virtual-buffers): Fix typo in docstring. | ||
| 78 | |||
| 79 | 2010-08-22 Juri Linkov <juri@jurta.org> | ||
| 80 | |||
| 81 | * simple.el (read-extended-command): New function with the logic | ||
| 82 | for `completing-read' moved to Elisp from `execute-extended-command'. | ||
| 83 | Use `function-called-at-point' in `minibuffer-default-add-function' | ||
| 84 | to get a command name for M-n (bug#5364, bug#5214). | ||
| 85 | |||
| 86 | 2010-08-22 Chong Yidong <cyd@stupidchicken.com> | ||
| 87 | |||
| 88 | * startup.el (command-line-1): Issue warning for ignored arguments | ||
| 89 | --unibyte, etc (Bug#6886). | ||
| 90 | |||
| 91 | 2010-08-22 Chong Yidong <cyd@stupidchicken.com> | ||
| 92 | |||
| 93 | * emacs-lisp/easy-mmode.el (define-minor-mode): Doc fix (Bug#6880). | ||
| 94 | |||
| 95 | 2010-08-22 Leo <sdl.web@gmail.com> | ||
| 96 | |||
| 97 | Fix buffer-list rename&refresh after after killing a buffer in ido. | ||
| 98 | * lisp/ido.el: Revert Óscar's. | ||
| 99 | (ido-kill-buffer-at-head): Exit the minibuffer with ido-exit=refresh. | ||
| 100 | Remember the buffers at head, rather than their name. | ||
| 101 | * lisp/iswitchb.el (iswitchb-kill-buffer): Re-make the list. | ||
| 102 | |||
| 103 | 2010-08-22 Kirk Kelsey <kirk.kelsey@0x4b.net> (tiny change) | ||
| 104 | Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 105 | |||
| 106 | * progmodes/make-mode.el (makefile-fill-paragraph): Account for the | ||
| 107 | extra backslash added to each line (bug#6890). | ||
| 108 | |||
| 109 | 2010-08-22 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 110 | |||
| 111 | * subr.el (read-key): Don't echo keystrokes (bug#6883). | ||
| 112 | |||
| 113 | 2010-08-22 Glenn Morris <rgm@gnu.org> | ||
| 114 | |||
| 115 | * menu-bar.el (menu-bar-games-menu): Add landmark. | ||
| 116 | |||
| 117 | 2010-08-22 Glenn Morris <rgm@gnu.org> | ||
| 118 | |||
| 119 | * align.el (align-regexp): Make group and spacing arguments | ||
| 120 | use the interactive defaults when non-interactive. (Bug#6698) | ||
| 121 | |||
| 122 | * mail/rmail.el (rmail-forward): Replace mail-text-start with its | ||
| 123 | expansion, so as not to need sendmail. | ||
| 124 | (mail-text-start): Remove declaration. | ||
| 125 | (rmail-retry-failure): Require sendmail. | ||
| 126 | |||
| 127 | 2010-08-22 Chong Yidong <cyd@stupidchicken.com> | ||
| 128 | |||
| 129 | * subr.el (read-key): Don't hide the menu-bar entries (bug#6881). | ||
| 130 | |||
| 131 | 2010-08-22 Michael Albinus <michael.albinus@gmx.de> | ||
| 132 | |||
| 133 | * progmodes/flymake.el (flymake-start-syntax-check-process): | ||
| 134 | Use `start-file-process' in order to let it run also on remote hosts. | ||
| 135 | |||
| 136 | 2010-08-22 Kenichi Handa <handa@m17n.org> | ||
| 137 | |||
| 138 | * files.el: Add `word-wrap' as safe local variable. | ||
| 139 | |||
| 140 | 2010-08-22 Glenn Morris <rgm@gnu.org> | ||
| 141 | |||
| 142 | * woman.el (woman-translate): Case matters. (Bug#6849) | ||
| 143 | |||
| 144 | 2010-08-22 Chong Yidong <cyd@stupidchicken.com> | ||
| 145 | |||
| 146 | * simple.el (kill-region): Doc fix (Bug#6787). | ||
| 147 | |||
| 148 | 2010-08-22 Glenn Morris <rgm@gnu.org> | ||
| 149 | |||
| 150 | * calendar/diary-lib.el (diary-header-line-format): | ||
| 151 | Fit it to the window, not the frame. | ||
| 152 | |||
| 153 | 2010-08-22 Andreas Schwab <schwab@linux-m68k.org> | ||
| 154 | |||
| 155 | * subr.el (ignore-errors): Add debug declaration. | ||
| 156 | |||
| 157 | 2010-08-22 Geoff Gole <geoffgole@gmail.com> (tiny change) | ||
| 158 | |||
| 159 | * whitespace.el (whitespace-color-off): Remove post-command-hook | ||
| 160 | locally. | ||
| 161 | |||
| 162 | 2010-08-21 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 163 | |||
| 164 | * vc/add-log.el (add-log-file-name): Don't get confused by symlinks. | ||
| 165 | |||
| 166 | 2010-08-21 Chong Yidong <cyd@stupidchicken.com> | ||
| 167 | |||
| 168 | * cus-edit.el (custom-group-value-create): Add extra newline | ||
| 169 | before end line (Bug#6876). | ||
| 170 | |||
| 171 | 2010-08-21 Chong Yidong <cyd@stupidchicken.com> | ||
| 172 | |||
| 173 | * mouse.el (mouse-save-then-kill): Don't save region to kill ring | ||
| 174 | when extending it. Before killing on the second click, check if | ||
| 175 | the buffer is the correct one. Doc fix. | ||
| 176 | (mouse-secondary-save-then-kill): Allow usage without first | ||
| 177 | calling mouse-start-secondary, by defaulting to point. Don't save | ||
| 178 | an empty secondary selection. Doc fix. | ||
| 179 | |||
| 180 | 2010-08-21 Vinicius Jose Latorre <viniciusjl@ig.com.br> | ||
| 181 | |||
| 182 | * whitespace.el: Fix slow cursor movement (Bug#6172). Reported by | ||
| 183 | Christoph Groth <cwg@falma.de> and Liu Xin <x_liu@neusoft.com>. | ||
| 184 | New version 13.0. | ||
| 185 | (whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp): | ||
| 186 | Adjust initialization. | ||
| 187 | (whitespace-bob-marker, whitespace-eob-marker) | ||
| 188 | (whitespace-buffer-changed): New vars. | ||
| 189 | (whitespace-cleanup, whitespace-color-on, whitespace-color-off) | ||
| 190 | (whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp) | ||
| 191 | (whitespace-post-command-hook, whitespace-display-char-on): | ||
| 192 | Adjust code. | ||
| 193 | (whitespace-looking-back, whitespace-buffer-changed): New funs. | ||
| 194 | (whitespace-space-regexp, whitespace-tab-regexp): Fun eliminated. | ||
| 195 | |||
| 196 | 2010-08-19 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 197 | |||
| 198 | * files.el (locate-file-completion-table): Only list the .el and .elc | ||
| 199 | extensions if there's no other choice (bug#5955). | ||
| 200 | |||
| 201 | * facemenu.el (facemenu-self-insert-data): New var. | ||
| 202 | (facemenu-post-self-insert-function, facemenu-set-self-insert-face): | ||
| 203 | New functions. | ||
| 204 | (facemenu-add-face): Use them. | ||
| 205 | |||
| 206 | * simple.el (blink-matching-open): Obey forward-sexp-function. | ||
| 207 | |||
| 9 | 2010-08-18 Stefan Monnier <monnier@iro.umontreal.ca> | 208 | 2010-08-18 Stefan Monnier <monnier@iro.umontreal.ca> |
| 10 | 209 | ||
| 11 | * simple.el (prog-mode-map): New var. | 210 | * simple.el (prog-mode-map): New var. |
| @@ -34,6 +233,17 @@ | |||
| 34 | * emacs-lisp/autoload.el (make-autoload): Preload the macros's | 233 | * emacs-lisp/autoload.el (make-autoload): Preload the macros's |
| 35 | declarations that are useful before running the macro. | 234 | declarations that are useful before running the macro. |
| 36 | 235 | ||
| 236 | 2010-08-18 Joakim Verona <joakim@verona.se> | ||
| 237 | |||
| 238 | * image.el (imagemagick-types-inhibit): New variable. | ||
| 239 | (imagemagick-register-types): New function. | ||
| 240 | * image-mode.el (image-transform-properties): New function. | ||
| 241 | (image-transform-set-scale, image-transform-fit-to-height) | ||
| 242 | (image-transform-set-rotation, image-transform-set-resize) | ||
| 243 | (image-transform-fit-to-width, image-transform-fit-to-height): | ||
| 244 | New functions. | ||
| 245 | (image-toggle-display-image): Support image transforms. | ||
| 246 | |||
| 37 | 2010-08-18 Katsumi Yamaoka <yamaoka@jpl.org> | 247 | 2010-08-18 Katsumi Yamaoka <yamaoka@jpl.org> |
| 38 | 248 | ||
| 39 | * image.el (create-animated-image): Don't add heuristic mask to image | 249 | * image.el (create-animated-image): Don't add heuristic mask to image |
| @@ -297,7 +507,7 @@ | |||
| 297 | (ctext-standard-encodings): New variable. | 507 | (ctext-standard-encodings): New variable. |
| 298 | (ctext-non-standard-encodings-table): List only elements for | 508 | (ctext-non-standard-encodings-table): List only elements for |
| 299 | non-standard encodings. | 509 | non-standard encodings. |
| 300 | (ctext-pre-write-conversion): Adjusted for the above change. | 510 | (ctext-pre-write-conversion): Adjust for the above change. |
| 301 | Check ctext-standard-encodings. | 511 | Check ctext-standard-encodings. |
| 302 | 512 | ||
| 303 | * international/mule-conf.el (compound-text): Doc fix. | 513 | * international/mule-conf.el (compound-text): Doc fix. |
| @@ -3186,7 +3396,8 @@ | |||
| 3186 | * minibuffer.el (tags-completion-at-point-function): New function. | 3396 | * minibuffer.el (tags-completion-at-point-function): New function. |
| 3187 | (completion-at-point-functions): Use it. | 3397 | (completion-at-point-functions): Use it. |
| 3188 | 3398 | ||
| 3189 | * cedet/semantic.el (semantic-completion-at-point-function): New function. | 3399 | * cedet/semantic.el (semantic-completion-at-point-function): |
| 3400 | New function. | ||
| 3190 | (semantic-mode): Use semantic-completion-at-point-function for | 3401 | (semantic-mode): Use semantic-completion-at-point-function for |
| 3191 | completion-at-point-functions instead. | 3402 | completion-at-point-functions instead. |
| 3192 | 3403 | ||
| @@ -3236,8 +3447,8 @@ | |||
| 3236 | 3447 | ||
| 3237 | 2010-04-28 Chong Yidong <cyd@stupidchicken.com> | 3448 | 2010-04-28 Chong Yidong <cyd@stupidchicken.com> |
| 3238 | 3449 | ||
| 3239 | * progmodes/bug-reference.el (bug-reference-url-format): Revert | 3450 | * progmodes/bug-reference.el (bug-reference-url-format): |
| 3240 | 2010-04-27 change due to security risk. | 3451 | Revert 2010-04-27 change due to security risk. |
| 3241 | 3452 | ||
| 3242 | 2010-04-28 Stefan Monnier <monnier@iro.umontreal.ca> | 3453 | 2010-04-28 Stefan Monnier <monnier@iro.umontreal.ca> |
| 3243 | 3454 | ||
| @@ -3412,8 +3623,7 @@ | |||
| 3412 | 3623 | ||
| 3413 | * ido.el (ido-init-completion-maps): For ido-switch-buffer, C-o | 3624 | * ido.el (ido-init-completion-maps): For ido-switch-buffer, C-o |
| 3414 | toggles the use of virtual buffers. | 3625 | toggles the use of virtual buffers. |
| 3415 | (ido-buffer-internal): Guard `ido-use-virtual-buffers' global | 3626 | (ido-buffer-internal): Guard `ido-use-virtual-buffers' global value. |
| 3416 | value. | ||
| 3417 | (ido-toggle-virtual-buffers): New function. | 3627 | (ido-toggle-virtual-buffers): New function. |
| 3418 | 3628 | ||
| 3419 | 2010-04-21 Juanma Barranquero <lekktu@gmail.com> | 3629 | 2010-04-21 Juanma Barranquero <lekktu@gmail.com> |
| @@ -3990,7 +4200,7 @@ | |||
| 3990 | 4200 | ||
| 3991 | Enable recentf-mode if using virtual buffers. | 4201 | Enable recentf-mode if using virtual buffers. |
| 3992 | * ido.el (recentf-list): Declare for byte-compiler. | 4202 | * ido.el (recentf-list): Declare for byte-compiler. |
| 3993 | (ido-virtual-buffers): Move up to silence byte-compiler. Add docstring. | 4203 | (ido-virtual-buffers): Move up to silence byte-compiler. Add docstring. |
| 3994 | (ido-make-buffer-list): Simplify. | 4204 | (ido-make-buffer-list): Simplify. |
| 3995 | (ido-add-virtual-buffers-to-list): Simplify. Enable recentf-mode. | 4205 | (ido-add-virtual-buffers-to-list): Simplify. Enable recentf-mode. |
| 3996 | 4206 | ||
| @@ -5501,8 +5711,8 @@ | |||
| 5501 | 2010-01-21 Alan Mackenzie <acm@muc.de> | 5711 | 2010-01-21 Alan Mackenzie <acm@muc.de> |
| 5502 | 5712 | ||
| 5503 | Fix a situation where deletion of a cpp construct throws an error. | 5713 | Fix a situation where deletion of a cpp construct throws an error. |
| 5504 | * progmodes/cc-engine.el (c-invalidate-state-cache): Before | 5714 | * progmodes/cc-engine.el (c-invalidate-state-cache): |
| 5505 | invoking c-with-all-but-one-cpps-commented-out, check that the | 5715 | Before invoking c-with-all-but-one-cpps-commented-out, check that the |
| 5506 | special cpp construct is still in the buffer. | 5716 | special cpp construct is still in the buffer. |
| 5507 | (c-parse-state): Record the special cpp with markers, not numbers. | 5717 | (c-parse-state): Record the special cpp with markers, not numbers. |
| 5508 | 5718 | ||
| @@ -6229,7 +6439,7 @@ | |||
| 6229 | 6439 | ||
| 6230 | * ps-print.el (ps-face-attributes): It was not returning the | 6440 | * ps-print.el (ps-face-attributes): It was not returning the |
| 6231 | attribute face for faces specified as string. Reported by harven | 6441 | attribute face for faces specified as string. Reported by harven |
| 6232 | <harven@free.fr>. | 6442 | <harven@free.fr>. (Bug#5254) |
| 6233 | (ps-print-version): New version 7.3.5. | 6443 | (ps-print-version): New version 7.3.5. |
| 6234 | 6444 | ||
| 6235 | 2009-12-18 Ulf Jasper <ulf.jasper@web.de> | 6445 | 2009-12-18 Ulf Jasper <ulf.jasper@web.de> |
diff --git a/lisp/Makefile.in b/lisp/Makefile.in index 4effdddff6a..8d681b4f673 100644 --- a/lisp/Makefile.in +++ b/lisp/Makefile.in | |||
| @@ -33,10 +33,9 @@ VPATH = $(srcdir) | |||
| 33 | # to use an absolute file name. | 33 | # to use an absolute file name. |
| 34 | EMACS = ${abs_top_builddir}/src/emacs | 34 | EMACS = ${abs_top_builddir}/src/emacs |
| 35 | 35 | ||
| 36 | # Command line flags for Emacs. This must include --multibyte, | 36 | # Command line flags for Emacs. |
| 37 | # otherwise some files will not compile. | ||
| 38 | 37 | ||
| 39 | EMACSOPT = -batch --no-site-file --multibyte | 38 | EMACSOPT = -batch --no-site-file |
| 40 | 39 | ||
| 41 | # Extra flags to pass to the byte compiler | 40 | # Extra flags to pass to the byte compiler |
| 42 | BYTE_COMPILE_EXTRA_FLAGS = | 41 | BYTE_COMPILE_EXTRA_FLAGS = |
diff --git a/lisp/align.el b/lisp/align.el index 9d811327021..0812d362875 100644 --- a/lisp/align.el +++ b/lisp/align.el | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | ;;; align.el --- align text to a specific column, by regexp | 1 | ;;; align.el --- align text to a specific column, by regexp |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, | 3 | ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, |
| 4 | ;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. | 4 | ;; 2008, 2009, 2010 Free Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | ;; Author: John Wiegley <johnw@gnu.org> | 6 | ;; Author: John Wiegley <johnw@gnu.org> |
| 7 | ;; Maintainer: FSF | 7 | ;; Maintainer: FSF |
| @@ -944,6 +944,8 @@ region, call `align-regexp' and type in that regular expression." | |||
| 944 | (list (concat "\\(\\s-*\\)" | 944 | (list (concat "\\(\\s-*\\)" |
| 945 | (read-string "Align regexp: ")) | 945 | (read-string "Align regexp: ")) |
| 946 | 1 align-default-spacing nil)))) | 946 | 1 align-default-spacing nil)))) |
| 947 | (or group (setq group 1)) | ||
| 948 | (or spacing (setq spacing align-default-spacing)) | ||
| 947 | (let ((rule | 949 | (let ((rule |
| 948 | (list (list nil (cons 'regexp regexp) | 950 | (list (list nil (cons 'regexp regexp) |
| 949 | (cons 'group (abs group)) | 951 | (cons 'group (abs group)) |
diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el index 8fb464aa7e6..39354bd31e3 100644 --- a/lisp/calendar/diary-lib.el +++ b/lisp/calendar/diary-lib.el | |||
| @@ -383,14 +383,14 @@ The format of the header is specified by `diary-header-line-format'." | |||
| 383 | "Some text is hidden - press \"s\" in calendar \ | 383 | "Some text is hidden - press \"s\" in calendar \ |
| 384 | before edit/copy" | 384 | before edit/copy" |
| 385 | "Diary")) | 385 | "Diary")) |
| 386 | ?\s (frame-width))) | 386 | ?\s (window-width))) |
| 387 | "Format of the header line displayed by `diary-simple-display'. | 387 | "Format of the header line displayed by `diary-simple-display'. |
| 388 | Only used if `diary-header-line-flag' is non-nil." | 388 | Only used if `diary-header-line-flag' is non-nil." |
| 389 | :group 'diary | 389 | :group 'diary |
| 390 | :type 'sexp | 390 | :type 'sexp |
| 391 | :initialize 'custom-initialize-default | 391 | :initialize 'custom-initialize-default |
| 392 | :set 'diary-set-header | 392 | :set 'diary-set-header |
| 393 | :version "22.1") | 393 | :version "23.3") ; frame-width -> window-width |
| 394 | 394 | ||
| 395 | ;; The first version of this also checked for diary-selective-display | 395 | ;; The first version of this also checked for diary-selective-display |
| 396 | ;; in the non-fancy case. This was an attempt to distinguish between | 396 | ;; in the non-fancy case. This was an attempt to distinguish between |
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index 9fa817bd102..e4cb29b50f2 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el | |||
| @@ -4097,8 +4097,8 @@ If GROUPS-ONLY non-nil, return only those members that are groups." | |||
| 4097 | (custom-group-state-update widget) | 4097 | (custom-group-state-update widget) |
| 4098 | (progress-reporter-done reporter)) | 4098 | (progress-reporter-done reporter)) |
| 4099 | ;; End line | 4099 | ;; End line |
| 4100 | (let ((p (point))) | 4100 | (let ((p (1+ (point)))) |
| 4101 | (insert "\n") | 4101 | (insert "\n\n") |
| 4102 | (put-text-property p (1+ p) 'face '(:underline t)) | 4102 | (put-text-property p (1+ p) 'face '(:underline t)) |
| 4103 | (overlay-put (make-overlay p (1+ p)) | 4103 | (overlay-put (make-overlay p (1+ p)) |
| 4104 | 'before-string | 4104 | 'before-string |
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index 5a21946183e..337f1d6c402 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el | |||
| @@ -86,25 +86,23 @@ replacing its case-insensitive matches with the literal string in LIGHTER." | |||
| 86 | ;;;###autoload | 86 | ;;;###autoload |
| 87 | (defmacro define-minor-mode (mode doc &optional init-value lighter keymap &rest body) | 87 | (defmacro define-minor-mode (mode doc &optional init-value lighter keymap &rest body) |
| 88 | "Define a new minor mode MODE. | 88 | "Define a new minor mode MODE. |
| 89 | This function defines the associated control variable MODE, keymap MODE-map, | 89 | This defines the control variable MODE and the toggle command MODE. |
| 90 | and toggle command MODE. | ||
| 91 | |||
| 92 | DOC is the documentation for the mode toggle command. | 90 | DOC is the documentation for the mode toggle command. |
| 91 | |||
| 93 | Optional INIT-VALUE is the initial value of the mode's variable. | 92 | Optional INIT-VALUE is the initial value of the mode's variable. |
| 94 | Optional LIGHTER is displayed in the modeline when the mode is on. | 93 | Optional LIGHTER is displayed in the modeline when the mode is on. |
| 95 | Optional KEYMAP is the default (defvar) keymap bound to the mode keymap. | 94 | Optional KEYMAP is the default keymap bound to the mode keymap. |
| 96 | If it is a list, it is passed to `easy-mmode-define-keymap' | 95 | If non-nil, it should be a variable name (whose value is a keymap), |
| 97 | in order to build a valid keymap. It's generally better to use | 96 | a keymap, or a list of arguments for `easy-mmode-define-keymap'. |
| 98 | a separate MODE-map variable than to use this argument. | 97 | If KEYMAP is a keymap or list, this also defines the variable MODE-map. |
| 99 | The above three arguments can be skipped if keyword arguments are | 98 | |
| 100 | used (see below). | 99 | BODY contains code to execute each time the mode is enabled or disabled. |
| 101 | 100 | It is executed after toggling the mode, and before running MODE-hook. | |
| 102 | BODY contains code to execute each time the mode is activated or deactivated. | 101 | Before the actual body code, you can write keyword arguments, i.e. |
| 103 | It is executed after toggling the mode, | 102 | alternating keywords and values. These following special keywords |
| 104 | and before running the hook variable `MODE-hook'. | 103 | are supported (other keywords are passed to `defcustom' if the minor |
| 105 | Before the actual body code, you can write keyword arguments (alternating | 104 | mode is global): |
| 106 | keywords and values). These following keyword arguments are supported (other | 105 | |
| 107 | keywords will be passed to `defcustom' if the minor mode is global): | ||
| 108 | :group GROUP Custom group name to use in all generated `defcustom' forms. | 106 | :group GROUP Custom group name to use in all generated `defcustom' forms. |
| 109 | Defaults to MODE without the possible trailing \"-mode\". | 107 | Defaults to MODE without the possible trailing \"-mode\". |
| 110 | Don't use this default group name unless you have written a | 108 | Don't use this default group name unless you have written a |
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 2e8c7dc7d4f..634a05df15e 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el | |||
| @@ -1557,6 +1557,9 @@ The list is displayed in a buffer named `*Packages*'." | |||
| 1557 | (package-refresh-contents) | 1557 | (package-refresh-contents) |
| 1558 | (package--list-packages)) | 1558 | (package--list-packages)) |
| 1559 | 1559 | ||
| 1560 | ;;;###autoload | ||
| 1561 | (defalias 'list-packages 'package-list-packages) | ||
| 1562 | |||
| 1560 | (defun package-list-packages-no-fetch () | 1563 | (defun package-list-packages-no-fetch () |
| 1561 | "Display a list of packages. | 1564 | "Display a list of packages. |
| 1562 | Does not fetch the updated list of packages before displaying. | 1565 | Does not fetch the updated list of packages before displaying. |
diff --git a/lisp/facemenu.el b/lisp/facemenu.el index 20b86676ea9..992c6418d45 100644 --- a/lisp/facemenu.el +++ b/lisp/facemenu.el | |||
| @@ -699,6 +699,22 @@ determine the correct answer." | |||
| 699 | (cond ((equal a b) t) | 699 | (cond ((equal a b) t) |
| 700 | ((equal (color-values a) (color-values b))))) | 700 | ((equal (color-values a) (color-values b))))) |
| 701 | 701 | ||
| 702 | |||
| 703 | (defvar facemenu-self-insert-data nil) | ||
| 704 | |||
| 705 | (defun facemenu-post-self-insert-function () | ||
| 706 | (when (and (car facemenu-self-insert-data) | ||
| 707 | (eq last-command (cdr facemenu-self-insert-data))) | ||
| 708 | (put-text-property (1- (point)) (point) | ||
| 709 | 'face (car facemenu-self-insert-data)) | ||
| 710 | (setq facemenu-self-insert-data nil)) | ||
| 711 | (remove-hook 'post-self-insert-hook 'facemenu-post-self-insert-function)) | ||
| 712 | |||
| 713 | (defun facemenu-set-self-insert-face (face) | ||
| 714 | "Arrange for the next self-inserted char to have face `face'." | ||
| 715 | (setq facemenu-self-insert-data (cons face this-command)) | ||
| 716 | (add-hook 'post-self-insert-hook 'facemenu-post-self-insert-function)) | ||
| 717 | |||
| 702 | (defun facemenu-add-face (face &optional start end) | 718 | (defun facemenu-add-face (face &optional start end) |
| 703 | "Add FACE to text between START and END. | 719 | "Add FACE to text between START and END. |
| 704 | If START is nil or START to END is empty, add FACE to next typed character | 720 | If START is nil or START to END is empty, add FACE to next typed character |
| @@ -712,51 +728,52 @@ As a special case, if FACE is `default', then the region is left with NO face | |||
| 712 | text property. Otherwise, selecting the default face would not have any | 728 | text property. Otherwise, selecting the default face would not have any |
| 713 | effect. See `facemenu-remove-face-function'." | 729 | effect. See `facemenu-remove-face-function'." |
| 714 | (interactive "*xFace: \nr") | 730 | (interactive "*xFace: \nr") |
| 715 | (if (and (eq face 'default) | 731 | (cond |
| 716 | (not (eq facemenu-remove-face-function t))) | 732 | ((and (eq face 'default) |
| 717 | (if facemenu-remove-face-function | 733 | (not (eq facemenu-remove-face-function t))) |
| 718 | (funcall facemenu-remove-face-function start end) | 734 | (if facemenu-remove-face-function |
| 719 | (if (and start (< start end)) | 735 | (funcall facemenu-remove-face-function start end) |
| 720 | (remove-text-properties start end '(face default)) | ||
| 721 | (setq self-insert-face 'default | ||
| 722 | self-insert-face-command this-command))) | ||
| 723 | (if facemenu-add-face-function | ||
| 724 | (save-excursion | ||
| 725 | (if end (goto-char end)) | ||
| 726 | (save-excursion | ||
| 727 | (if start (goto-char start)) | ||
| 728 | (insert-before-markers | ||
| 729 | (funcall facemenu-add-face-function face end))) | ||
| 730 | (if facemenu-end-add-face | ||
| 731 | (insert (if (stringp facemenu-end-add-face) | ||
| 732 | facemenu-end-add-face | ||
| 733 | (funcall facemenu-end-add-face face))))) | ||
| 734 | (if (and start (< start end)) | 736 | (if (and start (< start end)) |
| 735 | (let ((part-start start) part-end) | 737 | (remove-text-properties start end '(face default)) |
| 736 | (while (not (= part-start end)) | 738 | (facemenu-set-self-insert-face 'default)))) |
| 737 | (setq part-end (next-single-property-change part-start 'face | 739 | (facemenu-add-face-function |
| 738 | nil end)) | 740 | (save-excursion |
| 739 | (let ((prev (get-text-property part-start 'face))) | 741 | (if end (goto-char end)) |
| 740 | (put-text-property part-start part-end 'face | 742 | (save-excursion |
| 741 | (if (null prev) | 743 | (if start (goto-char start)) |
| 742 | face | 744 | (insert-before-markers |
| 743 | (facemenu-active-faces | 745 | (funcall facemenu-add-face-function face end))) |
| 744 | (cons face | 746 | (if facemenu-end-add-face |
| 745 | (if (listp prev) | 747 | (insert (if (stringp facemenu-end-add-face) |
| 746 | prev | 748 | facemenu-end-add-face |
| 747 | (list prev))) | 749 | (funcall facemenu-end-add-face face)))))) |
| 748 | ;; Specify the selected frame | 750 | ((and start (< start end)) |
| 749 | ;; because nil would mean to use | 751 | (let ((part-start start) part-end) |
| 750 | ;; the new-frame default settings, | 752 | (while (not (= part-start end)) |
| 751 | ;; and those are usually nil. | 753 | (setq part-end (next-single-property-change part-start 'face |
| 752 | (selected-frame))))) | 754 | nil end)) |
| 753 | (setq part-start part-end))) | 755 | (let ((prev (get-text-property part-start 'face))) |
| 754 | (setq self-insert-face (if (eq last-command self-insert-face-command) | 756 | (put-text-property part-start part-end 'face |
| 755 | (cons face (if (listp self-insert-face) | 757 | (if (null prev) |
| 756 | self-insert-face | 758 | face |
| 757 | (list self-insert-face))) | 759 | (facemenu-active-faces |
| 758 | face) | 760 | (cons face |
| 759 | self-insert-face-command this-command)))) | 761 | (if (listp prev) |
| 762 | prev | ||
| 763 | (list prev))) | ||
| 764 | ;; Specify the selected frame | ||
| 765 | ;; because nil would mean to use | ||
| 766 | ;; the new-frame default settings, | ||
| 767 | ;; and those are usually nil. | ||
| 768 | (selected-frame))))) | ||
| 769 | (setq part-start part-end)))) | ||
| 770 | (t | ||
| 771 | (facemenu-set-self-insert-face | ||
| 772 | (if (eq last-command (cdr facemenu-self-insert-data)) | ||
| 773 | (cons face (if (listp (car facemenu-self-insert-data)) | ||
| 774 | (car facemenu-self-insert-data) | ||
| 775 | (list (car facemenu-self-insert-data)))) | ||
| 776 | face)))) | ||
| 760 | (unless (facemenu-enable-faces-p) | 777 | (unless (facemenu-enable-faces-p) |
| 761 | (message "Font-lock mode will override any faces you set in this buffer"))) | 778 | (message "Font-lock mode will override any faces you set in this buffer"))) |
| 762 | 779 | ||
diff --git a/lisp/files.el b/lisp/files.el index 8b131e04ebc..3d9dd9065c2 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -757,21 +757,44 @@ one or more of those symbols." | |||
| 757 | (let ((x (file-name-directory suffix))) | 757 | (let ((x (file-name-directory suffix))) |
| 758 | (if x (1- (length x)) (length suffix)))))) | 758 | (if x (1- (length x)) (length suffix)))))) |
| 759 | (t | 759 | (t |
| 760 | (let ((names nil) | 760 | (let ((names '()) |
| 761 | ;; If we have files like "foo.el" and "foo.elc", we could load one of | ||
| 762 | ;; them with "foo.el", "foo.elc", or "foo", where just "foo" is the | ||
| 763 | ;; preferred way. So if we list all 3, that gives a lot of redundant | ||
| 764 | ;; entries for the poor soul looking just for "foo". OTOH, sometimes | ||
| 765 | ;; the user does want to pay attention to the extension. We try to | ||
| 766 | ;; diffuse this tension by stripping the suffix, except when the | ||
| 767 | ;; result is a single element (i.e. usually we only list "foo" unless | ||
| 768 | ;; it's the only remaining element in the list, in which case we do | ||
| 769 | ;; list "foo", "foo.elc" and "foo.el"). | ||
| 770 | (fullnames '()) | ||
| 761 | (suffix (concat (regexp-opt suffixes t) "\\'")) | 771 | (suffix (concat (regexp-opt suffixes t) "\\'")) |
| 762 | (string-dir (file-name-directory string)) | 772 | (string-dir (file-name-directory string)) |
| 763 | (string-file (file-name-nondirectory string))) | 773 | (string-file (file-name-nondirectory string))) |
| 764 | (dolist (dir dirs) | 774 | (dolist (dir dirs) |
| 765 | (unless dir | 775 | (unless dir |
| 766 | (setq dir default-directory)) | 776 | (setq dir default-directory)) |
| 767 | (if string-dir (setq dir (expand-file-name string-dir dir))) | 777 | (if string-dir (setq dir (expand-file-name string-dir dir))) |
| 768 | (when (file-directory-p dir) | 778 | (when (file-directory-p dir) |
| 769 | (dolist (file (file-name-all-completions | 779 | (dolist (file (file-name-all-completions |
| 770 | string-file dir)) | 780 | string-file dir)) |
| 771 | (push file names) | 781 | (if (not (string-match suffix file)) |
| 772 | (when (string-match suffix file) | 782 | (push file names) |
| 773 | (setq file (substring file 0 (match-beginning 0))) | 783 | (push file fullnames) |
| 774 | (push file names))))) | 784 | (push (substring file 0 (match-beginning 0)) names))))) |
| 785 | ;; Switching from names to names+fullnames creates a non-monotonicity | ||
| 786 | ;; which can cause problems with things like partial-completion. | ||
| 787 | ;; To minimize the problem, filter out completion-regexp-list, so that | ||
| 788 | ;; M-x load-library RET t/x.e TAB finds some files. | ||
| 789 | (if completion-regexp-list | ||
| 790 | (setq names (all-completions "" names))) | ||
| 791 | ;; Remove duplicates of the first element, so that we can easily check | ||
| 792 | ;; if `names' really only contains a single element. | ||
| 793 | (when (cdr names) (setcdr names (delete (car names) (cdr names)))) | ||
| 794 | (unless (cdr names) | ||
| 795 | ;; There's no more than one matching non-suffixed element, so expand | ||
| 796 | ;; the list by adding the suffixed elements as well. | ||
| 797 | (setq names (nconc names fullnames))) | ||
| 775 | (completion-table-with-context | 798 | (completion-table-with-context |
| 776 | string-dir names string-file pred action))))) | 799 | string-dir names string-file pred action))))) |
| 777 | 800 | ||
| @@ -2782,6 +2805,7 @@ asking you for confirmation." | |||
| 2782 | (no-update-autoloads . booleanp) | 2805 | (no-update-autoloads . booleanp) |
| 2783 | (tab-width . integerp) ;; C source code | 2806 | (tab-width . integerp) ;; C source code |
| 2784 | (truncate-lines . booleanp) ;; C source code | 2807 | (truncate-lines . booleanp) ;; C source code |
| 2808 | (word-wrap . booleanp) ;; C source code | ||
| 2785 | (bidi-display-reordering . booleanp))) ;; C source code | 2809 | (bidi-display-reordering . booleanp))) ;; C source code |
| 2786 | 2810 | ||
| 2787 | (put 'bidi-paragraph-direction 'safe-local-variable | 2811 | (put 'bidi-paragraph-direction 'safe-local-variable |
diff --git a/lisp/ido.el b/lisp/ido.el index d34893d708b..858ee3ed5b0 100644 --- a/lisp/ido.el +++ b/lisp/ido.el | |||
| @@ -780,7 +780,7 @@ Essentially it works as follows: Say you are visiting a file and | |||
| 780 | the buffer gets cleaned up by mignight.el. Later, you want to | 780 | the buffer gets cleaned up by mignight.el. Later, you want to |
| 781 | switch to that buffer, but find it's no longer open. With | 781 | switch to that buffer, but find it's no longer open. With |
| 782 | virtual buffers enabled, the buffer name stays in the buffer | 782 | virtual buffers enabled, the buffer name stays in the buffer |
| 783 | list (using the ido-virtual face, and always at the end), and if | 783 | list (using the `ido-virtual' face, and always at the end), and if |
| 784 | you select it, it opens the file back up again. This allows you | 784 | you select it, it opens the file back up again. This allows you |
| 785 | to think less about whether recently opened files are still open | 785 | to think less about whether recently opened files are still open |
| 786 | or not. Most of the time you can quit Emacs, restart, and then | 786 | or not. Most of the time you can quit Emacs, restart, and then |
| @@ -1070,11 +1070,11 @@ Only used if `ido-use-virtual-buffers' is non-nil.") | |||
| 1070 | ;; Stores the current list of items that will be searched through. | 1070 | ;; Stores the current list of items that will be searched through. |
| 1071 | ;; The list is ordered, so that the most interesting item comes first, | 1071 | ;; The list is ordered, so that the most interesting item comes first, |
| 1072 | ;; although by default, the files visible in the current frame are put | 1072 | ;; although by default, the files visible in the current frame are put |
| 1073 | ;; at the end of the list. | 1073 | ;; at the end of the list. Created by `ido-make-item-list'. |
| 1074 | (defvar ido-cur-list nil) | 1074 | (defvar ido-cur-list) |
| 1075 | 1075 | ||
| 1076 | ;; Stores the choice list for ido-completing-read | 1076 | ;; Stores the choice list for ido-completing-read |
| 1077 | (defvar ido-choice-list nil) | 1077 | (defvar ido-choice-list) |
| 1078 | 1078 | ||
| 1079 | ;; Stores the list of items which are ignored when building | 1079 | ;; Stores the list of items which are ignored when building |
| 1080 | ;; `ido-cur-list'. It is in no specific order. | 1080 | ;; `ido-cur-list'. It is in no specific order. |
| @@ -3400,11 +3400,9 @@ for first matching file." | |||
| 3400 | (if ido-temp-list | 3400 | (if ido-temp-list |
| 3401 | (nconc ido-temp-list ido-current-buffers) | 3401 | (nconc ido-temp-list ido-current-buffers) |
| 3402 | (setq ido-temp-list ido-current-buffers)) | 3402 | (setq ido-temp-list ido-current-buffers)) |
| 3403 | (when (and default (buffer-live-p (get-buffer default))) | 3403 | (if default |
| 3404 | (setq ido-temp-list | 3404 | (setq ido-temp-list |
| 3405 | (cons default (delete default ido-temp-list)))) | 3405 | (cons default (delete default ido-temp-list)))) |
| 3406 | (if ido-use-virtual-buffers | ||
| 3407 | (ido-add-virtual-buffers-to-list)) | ||
| 3408 | (run-hooks 'ido-make-buffer-list-hook) | 3406 | (run-hooks 'ido-make-buffer-list-hook) |
| 3409 | ido-temp-list)) | 3407 | ido-temp-list)) |
| 3410 | 3408 | ||
| @@ -3672,7 +3670,6 @@ This is to make them appear as if they were \"virtual buffers\"." | |||
| 3672 | ;; Used by `ido-get-buffers-in-frames' to walk through all windows | 3670 | ;; Used by `ido-get-buffers-in-frames' to walk through all windows |
| 3673 | (let ((buf (buffer-name (window-buffer win)))) | 3671 | (let ((buf (buffer-name (window-buffer win)))) |
| 3674 | (unless (or (member buf ido-bufs-in-frame) | 3672 | (unless (or (member buf ido-bufs-in-frame) |
| 3675 | (minibufferp buf) | ||
| 3676 | (member buf ido-ignore-item-temp-list)) | 3673 | (member buf ido-ignore-item-temp-list)) |
| 3677 | ;; Only add buf if it is not already in list. | 3674 | ;; Only add buf if it is not already in list. |
| 3678 | ;; This prevents same buf in two different windows being | 3675 | ;; This prevents same buf in two different windows being |
| @@ -3913,27 +3910,6 @@ This is to make them appear as if they were \"virtual buffers\"." | |||
| 3913 | ;;(add-hook 'completion-setup-hook 'completion-setup-function) | 3910 | ;;(add-hook 'completion-setup-hook 'completion-setup-function) |
| 3914 | (display-completion-list completion-list))))))) | 3911 | (display-completion-list completion-list))))))) |
| 3915 | 3912 | ||
| 3916 | (defun ido-kill-buffer-internal (buf) | ||
| 3917 | "Kill buffer BUF and rebuild ido's buffer list if needed." | ||
| 3918 | (if (not (kill-buffer buf)) | ||
| 3919 | ;; buffer couldn't be killed. | ||
| 3920 | (setq ido-rescan t) | ||
| 3921 | ;; else buffer was killed so remove name from list. | ||
| 3922 | (setq ido-cur-list (delq buf ido-cur-list)) | ||
| 3923 | ;; Some packages, like uniquify.el, may rename buffers when one | ||
| 3924 | ;; is killed, so we need to test this condition to avoid using | ||
| 3925 | ;; an outdated list of buffer names. We don't want to always | ||
| 3926 | ;; rebuild the list of buffers, as this alters the previous | ||
| 3927 | ;; buffer order that the user was seeing on the prompt. However, | ||
| 3928 | ;; when we rebuild the list, we try to keep the previous second | ||
| 3929 | ;; buffer as the first one. | ||
| 3930 | (catch 'update | ||
| 3931 | (dolist (b ido-cur-list) | ||
| 3932 | (unless (get-buffer b) | ||
| 3933 | (setq ido-cur-list (ido-make-buffer-list (cadr ido-matches))) | ||
| 3934 | (setq ido-rescan t) | ||
| 3935 | (throw 'update nil)))))) | ||
| 3936 | |||
| 3937 | ;;; KILL CURRENT BUFFER | 3913 | ;;; KILL CURRENT BUFFER |
| 3938 | (defun ido-kill-buffer-at-head () | 3914 | (defun ido-kill-buffer-at-head () |
| 3939 | "Kill the buffer at the head of `ido-matches'. | 3915 | "Kill the buffer at the head of `ido-matches'. |
| @@ -3942,15 +3918,26 @@ If cursor is not at the end of the user input, delete to end of input." | |||
| 3942 | (if (not (eobp)) | 3918 | (if (not (eobp)) |
| 3943 | (delete-region (point) (line-end-position)) | 3919 | (delete-region (point) (line-end-position)) |
| 3944 | (let ((enable-recursive-minibuffers t) | 3920 | (let ((enable-recursive-minibuffers t) |
| 3945 | (buf (ido-name (car ido-matches)))) | 3921 | (buf (ido-name (car ido-matches))) |
| 3946 | (when buf | 3922 | (nextbuf (cadr ido-matches))) |
| 3947 | (ido-kill-buffer-internal buf) | 3923 | (when (get-buffer buf) |
| 3948 | ;; Check if buffer still exists. | 3924 | ;; If next match names a buffer use the buffer object; buffer |
| 3949 | (if (get-buffer buf) | 3925 | ;; name may be changed by packages such as uniquify; mindful |
| 3950 | ;; buffer couldn't be killed. | 3926 | ;; of virtual buffers. |
| 3927 | (when (and nextbuf (get-buffer nextbuf)) | ||
| 3928 | (setq nextbuf (get-buffer nextbuf))) | ||
| 3929 | (if (null (kill-buffer buf)) | ||
| 3930 | ;; Buffer couldn't be killed. | ||
| 3951 | (setq ido-rescan t) | 3931 | (setq ido-rescan t) |
| 3952 | ;; else buffer was killed so remove name from list. | 3932 | ;; Else `kill-buffer' succeeds so re-make the buffer list |
| 3953 | (setq ido-cur-list (delq buf ido-cur-list))))))) | 3933 | ;; taking into account packages like uniquify may rename |
| 3934 | ;; buffers. | ||
| 3935 | (if (bufferp nextbuf) | ||
| 3936 | (setq nextbuf (buffer-name nextbuf))) | ||
| 3937 | (setq ido-default-item nextbuf | ||
| 3938 | ido-text-init ido-text | ||
| 3939 | ido-exit 'refresh) | ||
| 3940 | (exit-minibuffer)))))) | ||
| 3954 | 3941 | ||
| 3955 | ;;; DELETE CURRENT FILE | 3942 | ;;; DELETE CURRENT FILE |
| 3956 | (defun ido-delete-file-at-head () | 3943 | (defun ido-delete-file-at-head () |
| @@ -3988,7 +3975,7 @@ Record command in `command-history' if optional RECORD is non-nil." | |||
| 3988 | ((eq method 'kill) | 3975 | ((eq method 'kill) |
| 3989 | (if record | 3976 | (if record |
| 3990 | (ido-record-command 'kill-buffer buffer)) | 3977 | (ido-record-command 'kill-buffer buffer)) |
| 3991 | (ido-kill-buffer-internal buffer)) | 3978 | (kill-buffer buffer)) |
| 3992 | 3979 | ||
| 3993 | ((eq method 'other-window) | 3980 | ((eq method 'other-window) |
| 3994 | (if record | 3981 | (if record |
diff --git a/lisp/image-mode.el b/lisp/image-mode.el index a34989171bb..5bda540fdfe 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el | |||
| @@ -493,7 +493,10 @@ was inserted." | |||
| 493 | (buffer-substring-no-properties (point-min) (point-max))) | 493 | (buffer-substring-no-properties (point-min) (point-max))) |
| 494 | filename)) | 494 | filename)) |
| 495 | (type (image-type file-or-data nil data-p)) | 495 | (type (image-type file-or-data nil data-p)) |
| 496 | (image (create-animated-image file-or-data type data-p)) | 496 | (image0 (create-animated-image file-or-data type data-p)) |
| 497 | (image (append image0 | ||
| 498 | (image-transform-properties image0) | ||
| 499 | )) | ||
| 497 | (props | 500 | (props |
| 498 | `(display ,image | 501 | `(display ,image |
| 499 | intangible ,image | 502 | intangible ,image |
| @@ -556,6 +559,84 @@ the image file and `image-mode' showing the image as an image." | |||
| 556 | (when (not (string= image-type (bookmark-prop-get bmk 'image-type))) | 559 | (when (not (string= image-type (bookmark-prop-get bmk 'image-type))) |
| 557 | (image-toggle-display)))) | 560 | (image-toggle-display)))) |
| 558 | 561 | ||
| 562 | |||
| 563 | (defvar image-transform-minor-mode-map | ||
| 564 | (let ((map (make-sparse-keymap))) | ||
| 565 | ; (define-key map [(control ?+)] 'image-scale-in) | ||
| 566 | ; (define-key map [(control ?-)] 'image-scale-out) | ||
| 567 | ; (define-key map [(control ?=)] 'image-scale-none) | ||
| 568 | ;; (define-key map "c f h" 'image-scale-fit-height) | ||
| 569 | ;; (define-key map "c ]" 'image-rotate-right) | ||
| 570 | map) | ||
| 571 | "Minor mode keymap for transforming the view of images Image mode.") | ||
| 572 | |||
| 573 | (define-minor-mode image-transform-mode | ||
| 574 | "minor mode for scaleing and rotation" | ||
| 575 | nil "image-transform" | ||
| 576 | image-transform-minor-mode-map) | ||
| 577 | |||
| 578 | (defvar image-transform-resize nil | ||
| 579 | "The image resize operation. See the command | ||
| 580 | `image-transform-set-scale' for more information." ) | ||
| 581 | |||
| 582 | (defvar image-transform-rotation 0.0) | ||
| 583 | |||
| 584 | |||
| 585 | (defun image-transform-properties (display) | ||
| 586 | "Calculate the display properties for transformations; scaling | ||
| 587 | and rotation. " | ||
| 588 | (let* | ||
| 589 | ((size (image-size display t)) | ||
| 590 | (height | ||
| 591 | (cond | ||
| 592 | ((and (numberp image-transform-resize) (eq 100 image-transform-resize)) | ||
| 593 | nil) | ||
| 594 | ((numberp image-transform-resize) | ||
| 595 | (* image-transform-resize (cdr size))) | ||
| 596 | ((eq image-transform-resize 'fit-height) | ||
| 597 | (- (nth 3 (window-inside-pixel-edges)) (nth 1 (window-inside-pixel-edges)))) | ||
| 598 | (t nil))) | ||
| 599 | (width (if (eq image-transform-resize 'fit-width) | ||
| 600 | (- (nth 2 (window-inside-pixel-edges)) (nth 0 (window-inside-pixel-edges)))))) | ||
| 601 | |||
| 602 | `(,@(if height (list :height height)) | ||
| 603 | ,@(if width (list :width width)) | ||
| 604 | ,@(if (not (equal 0.0 image-transform-rotation)) | ||
| 605 | (list :rotation image-transform-rotation)) | ||
| 606 | ;;TODO fit-to-* should consider the rotation angle | ||
| 607 | ))) | ||
| 608 | |||
| 609 | (defun image-transform-set-scale (scale) | ||
| 610 | "SCALE sets the scaling for images. " | ||
| 611 | (interactive "nscale:") | ||
| 612 | (image-transform-set-resize (float scale))) | ||
| 613 | |||
| 614 | (defun image-transform-fit-to-height () | ||
| 615 | "Fit image height to window height. " | ||
| 616 | (interactive) | ||
| 617 | (image-transform-set-resize 'fit-height)) | ||
| 618 | |||
| 619 | (defun image-transform-fit-to-width () | ||
| 620 | "Fit image width to window width. " | ||
| 621 | (interactive) | ||
| 622 | (image-transform-set-resize 'fit-width)) | ||
| 623 | |||
| 624 | (defun image-transform-set-resize (resize) | ||
| 625 | "Set the resize mode for images. The RESIZE value can be the | ||
| 626 | symbol fit-height which fits the image to the window height. The | ||
| 627 | symbol fit-width fits the image to the window width. A number | ||
| 628 | indicates a scaling factor. nil indicates scale to 100%. " | ||
| 629 | (setq image-transform-resize resize) | ||
| 630 | (if (eq 'image-mode major-mode) (image-toggle-display-image))) | ||
| 631 | |||
| 632 | (defun image-transform-set-rotation (rotation) | ||
| 633 | "Set the image ROTATION angle. " | ||
| 634 | (interactive "nrotation:") | ||
| 635 | ;;TODO 0 90 180 270 degrees are the only reasonable angles here | ||
| 636 | ;;otherwise combining with rescaling will get very awkward | ||
| 637 | (setq image-transform-rotation (float rotation)) | ||
| 638 | (if (eq major-mode 'image-mode) (image-toggle-display-image))) | ||
| 639 | |||
| 559 | (provide 'image-mode) | 640 | (provide 'image-mode) |
| 560 | 641 | ||
| 561 | ;; arch-tag: b5b2b7e6-26a7-4b79-96e3-1546b5c4c6cb | 642 | ;; arch-tag: b5b2b7e6-26a7-4b79-96e3-1546b5c4c6cb |
diff --git a/lisp/image.el b/lisp/image.el index 4a68b4999ea..93cc92ef264 100644 --- a/lisp/image.el +++ b/lisp/image.el | |||
| @@ -694,6 +694,27 @@ shall be displayed." | |||
| 694 | (cons images tmo)))))) | 694 | (cons images tmo)))))) |
| 695 | 695 | ||
| 696 | 696 | ||
| 697 | (defcustom imagemagick-types-inhibit | ||
| 698 | '(C HTML HTM TXT PDF) | ||
| 699 | "Types the imagemagick loader should not try to handle.") | ||
| 700 | |||
| 701 | ;;;###autoload | ||
| 702 | (defun imagemagick-register-types () | ||
| 703 | "Register file types that imagemagick is able to handle." | ||
| 704 | (let ((im-types (imagemagick-types))) | ||
| 705 | (dolist (im-inhibit imagemagick-types-inhibit) | ||
| 706 | (setq im-types (remove im-inhibit im-types))) | ||
| 707 | (dolist (im-type im-types) | ||
| 708 | (let ((extension (downcase (symbol-name im-type)))) | ||
| 709 | (push | ||
| 710 | (cons (concat "\\." extension "\\'") 'image-mode) | ||
| 711 | auto-mode-alist) | ||
| 712 | (push | ||
| 713 | (cons (concat "\\." extension "\\'") 'imagemagick) | ||
| 714 | image-type-file-name-regexps))))) | ||
| 715 | |||
| 716 | |||
| 717 | |||
| 697 | (provide 'image) | 718 | (provide 'image) |
| 698 | 719 | ||
| 699 | ;; arch-tag: 8e76a07b-eb48-4f3e-a7a0-1a7ba9f096b3 | 720 | ;; arch-tag: 8e76a07b-eb48-4f3e-a7a0-1a7ba9f096b3 |
diff --git a/lisp/international/mule.el b/lisp/international/mule.el index 59d6ff42c97..84b8db3e9ca 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el | |||
| @@ -326,8 +326,7 @@ Return t if file exists." | |||
| 326 | (with-current-buffer buffer | 326 | (with-current-buffer buffer |
| 327 | ;; So that we don't get completely screwed if the | 327 | ;; So that we don't get completely screwed if the |
| 328 | ;; file is encoded in some complicated character set, | 328 | ;; file is encoded in some complicated character set, |
| 329 | ;; read it with real decoding, as a multibyte buffer, | 329 | ;; read it with real decoding, as a multibyte buffer. |
| 330 | ;; even if this is a --unibyte Emacs session. | ||
| 331 | (set-buffer-multibyte t) | 330 | (set-buffer-multibyte t) |
| 332 | ;; Don't let deactivate-mark remain set. | 331 | ;; Don't let deactivate-mark remain set. |
| 333 | (let (deactivate-mark) | 332 | (let (deactivate-mark) |
| @@ -346,12 +345,7 @@ Return t if file exists." | |||
| 346 | (eval-buffer buffer nil | 345 | (eval-buffer buffer nil |
| 347 | ;; This is compatible with what `load' does. | 346 | ;; This is compatible with what `load' does. |
| 348 | (if purify-flag file fullname) | 347 | (if purify-flag file fullname) |
| 349 | ;; If this Emacs is running with --unibyte, | 348 | nil t)) |
| 350 | ;; convert multibyte strings to unibyte | ||
| 351 | ;; after reading them. | ||
| 352 | ;; (not (default-value 'enable-multibyte-characters)) | ||
| 353 | nil t | ||
| 354 | )) | ||
| 355 | (let (kill-buffer-hook kill-buffer-query-functions) | 349 | (let (kill-buffer-hook kill-buffer-query-functions) |
| 356 | (kill-buffer buffer))) | 350 | (kill-buffer buffer))) |
| 357 | (do-after-load-evaluation fullname) | 351 | (do-after-load-evaluation fullname) |
diff --git a/lisp/iswitchb.el b/lisp/iswitchb.el index ea4b00dc90d..081897a89b3 100644 --- a/lisp/iswitchb.el +++ b/lisp/iswitchb.el | |||
| @@ -1027,8 +1027,8 @@ Return the modified list with the last element prepended to it." | |||
| 1027 | (defun iswitchb-kill-buffer () | 1027 | (defun iswitchb-kill-buffer () |
| 1028 | "Kill the buffer at the head of `iswitchb-matches'." | 1028 | "Kill the buffer at the head of `iswitchb-matches'." |
| 1029 | (interactive) | 1029 | (interactive) |
| 1030 | (let ( (enable-recursive-minibuffers t) | 1030 | (let ((enable-recursive-minibuffers t) |
| 1031 | buf) | 1031 | buf) |
| 1032 | 1032 | ||
| 1033 | (setq buf (car iswitchb-matches)) | 1033 | (setq buf (car iswitchb-matches)) |
| 1034 | ;; check to see if buf is non-nil. | 1034 | ;; check to see if buf is non-nil. |
| @@ -1042,8 +1042,10 @@ Return the modified list with the last element prepended to it." | |||
| 1042 | (if (get-buffer buf) | 1042 | (if (get-buffer buf) |
| 1043 | ;; buffer couldn't be killed. | 1043 | ;; buffer couldn't be killed. |
| 1044 | (setq iswitchb-rescan t) | 1044 | (setq iswitchb-rescan t) |
| 1045 | ;; else buffer was killed so remove name from list. | 1045 | ;; Else `kill-buffer' succeeds so re-make the buffer list |
| 1046 | (setq iswitchb-buflist (delq buf iswitchb-buflist))))))) | 1046 | ;; taking into account packages like uniquify may rename |
| 1047 | ;; buffers | ||
| 1048 | (iswitchb-make-buflist iswitchb-default)))))) | ||
| 1047 | 1049 | ||
| 1048 | ;;; VISIT CHOSEN BUFFER | 1050 | ;;; VISIT CHOSEN BUFFER |
| 1049 | (defun iswitchb-visit-buffer (buffer) | 1051 | (defun iswitchb-visit-buffer (buffer) |
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index fbf5c534a28..fa0b7bef207 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el | |||
| @@ -191,8 +191,6 @@ please report it with \\[report-emacs-bug].") | |||
| 191 | :group 'rmail-retrieve | 191 | :group 'rmail-retrieve |
| 192 | :type '(repeat (directory))) | 192 | :type '(repeat (directory))) |
| 193 | 193 | ||
| 194 | (declare-function mail-position-on-field "sendmail" (field &optional soft)) | ||
| 195 | (declare-function mail-text-start "sendmail" ()) | ||
| 196 | (declare-function rmail-dont-reply-to "mail-utils" (destinations)) | 194 | (declare-function rmail-dont-reply-to "mail-utils" (destinations)) |
| 197 | (declare-function rmail-update-summary "rmailsum" (&rest ignore)) | 195 | (declare-function rmail-update-summary "rmailsum" (&rest ignore)) |
| 198 | 196 | ||
| @@ -1643,8 +1641,6 @@ The duplicate copy goes into the Rmail file just after the original." | |||
| 1643 | (declare-function rmail-summary-mark-deleted "rmailsum" (&optional n undel)) | 1641 | (declare-function rmail-summary-mark-deleted "rmailsum" (&optional n undel)) |
| 1644 | (declare-function rfc822-addresses "rfc822" (header-text)) | 1642 | (declare-function rfc822-addresses "rfc822" (header-text)) |
| 1645 | (declare-function mail-abbrev-make-syntax-table "mailabbrev.el" ()) | 1643 | (declare-function mail-abbrev-make-syntax-table "mailabbrev.el" ()) |
| 1646 | (declare-function mail-sendmail-delimit-header "sendmail" ()) | ||
| 1647 | (declare-function mail-header-end "sendmail" ()) | ||
| 1648 | 1644 | ||
| 1649 | ;; RLK feature not added in this version: | 1645 | ;; RLK feature not added in this version: |
| 1650 | ;; argument specifies inbox file or files in various ways. | 1646 | ;; argument specifies inbox file or files in various ways. |
| @@ -3686,7 +3682,8 @@ see the documentation of `rmail-resend'." | |||
| 3686 | ;; The mail buffer is now current. | 3682 | ;; The mail buffer is now current. |
| 3687 | (save-excursion | 3683 | (save-excursion |
| 3688 | ;; Insert after header separator--before signature if any. | 3684 | ;; Insert after header separator--before signature if any. |
| 3689 | (goto-char (mail-text-start)) | 3685 | (rfc822-goto-eoh) |
| 3686 | (forward-line 1) | ||
| 3690 | (if (or rmail-enable-mime rmail-enable-mime-composing) | 3687 | (if (or rmail-enable-mime rmail-enable-mime-composing) |
| 3691 | (funcall rmail-insert-mime-forwarded-message-function | 3688 | (funcall rmail-insert-mime-forwarded-message-function |
| 3692 | forward-buffer) | 3689 | forward-buffer) |
| @@ -3841,6 +3838,10 @@ The message should be narrowed to just the headers." | |||
| 3841 | (1- (point)) | 3838 | (1- (point)) |
| 3842 | (point-max))))))) | 3839 | (point-max))))))) |
| 3843 | 3840 | ||
| 3841 | (declare-function mail-sendmail-delimit-header "sendmail" ()) | ||
| 3842 | (declare-function mail-header-end "sendmail" ()) | ||
| 3843 | (declare-function mail-position-on-field "sendmail" (field &optional soft)) | ||
| 3844 | |||
| 3844 | (defun rmail-retry-failure () | 3845 | (defun rmail-retry-failure () |
| 3845 | "Edit a mail message which is based on the contents of the current message. | 3846 | "Edit a mail message which is based on the contents of the current message. |
| 3846 | For a message rejected by the mail system, extract the interesting headers and | 3847 | For a message rejected by the mail system, extract the interesting headers and |
| @@ -3932,6 +3933,8 @@ specifying headers which should not be copied into the new message." | |||
| 3932 | (goto-char (point-min)) | 3933 | (goto-char (point-min)) |
| 3933 | (if bounce-indent | 3934 | (if bounce-indent |
| 3934 | (indent-rigidly (point-min) (point-max) bounce-indent)) | 3935 | (indent-rigidly (point-min) (point-max) bounce-indent)) |
| 3936 | ;; FIXME better to replace sendmail functions. | ||
| 3937 | (require 'sendmail) | ||
| 3935 | (mail-sendmail-delimit-header) | 3938 | (mail-sendmail-delimit-header) |
| 3936 | (save-restriction | 3939 | (save-restriction |
| 3937 | (narrow-to-region (point-min) (mail-header-end)) | 3940 | (narrow-to-region (point-min) (mail-header-end)) |
diff --git a/lisp/makefile.w32-in b/lisp/makefile.w32-in index 871b690f007..df997b76585 100644 --- a/lisp/makefile.w32-in +++ b/lisp/makefile.w32-in | |||
| @@ -32,10 +32,9 @@ srcdir = $(CURDIR)/.. | |||
| 32 | 32 | ||
| 33 | EMACS = $(THISDIR)/../bin/emacs.exe | 33 | EMACS = $(THISDIR)/../bin/emacs.exe |
| 34 | 34 | ||
| 35 | # Command line flags for Emacs. This must include --multibyte, | 35 | # Command line flags for Emacs. |
| 36 | # otherwise some files will not compile. | ||
| 37 | 36 | ||
| 38 | EMACSOPT = -batch --no-init-file --no-site-file --multibyte | 37 | EMACSOPT = -batch --no-init-file --no-site-file |
| 39 | 38 | ||
| 40 | # Extra flags to pass to the byte compiler | 39 | # Extra flags to pass to the byte compiler |
| 41 | BYTE_COMPILE_EXTRA_FLAGS = | 40 | BYTE_COMPILE_EXTRA_FLAGS = |
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 3c1241237f1..ed5c189252b 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el | |||
| @@ -1272,6 +1272,9 @@ mail status in mode line")) | |||
| 1272 | (define-key menu-bar-games-menu [life] | 1272 | (define-key menu-bar-games-menu [life] |
| 1273 | `(menu-item ,(purecopy "Life") life | 1273 | `(menu-item ,(purecopy "Life") life |
| 1274 | :help ,(purecopy "Watch how John Conway's cellular automaton evolves"))) | 1274 | :help ,(purecopy "Watch how John Conway's cellular automaton evolves"))) |
| 1275 | (define-key menu-bar-games-menu [land] | ||
| 1276 | `(menu-item ,(purecopy "Landmark") landmark | ||
| 1277 | :help ,(purecopy "Watch a neural-network robot learn landmarks"))) | ||
| 1275 | (define-key menu-bar-games-menu [hanoi] | 1278 | (define-key menu-bar-games-menu [hanoi] |
| 1276 | `(menu-item ,(purecopy "Towers of Hanoi") hanoi | 1279 | `(menu-item ,(purecopy "Towers of Hanoi") hanoi |
| 1277 | :help ,(purecopy "Watch Towers-of-Hanoi puzzle solved by Emacs"))) | 1280 | :help ,(purecopy "Watch Towers-of-Hanoi puzzle solved by Emacs"))) |
diff --git a/lisp/mouse.el b/lisp/mouse.el index f404de98ce3..a2a0191ce79 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el | |||
| @@ -1268,10 +1268,11 @@ regardless of where you click." | |||
| 1268 | (interactive "e") | 1268 | (interactive "e") |
| 1269 | ;; Give temporary modes such as isearch a chance to turn off. | 1269 | ;; Give temporary modes such as isearch a chance to turn off. |
| 1270 | (run-hooks 'mouse-leave-buffer-hook) | 1270 | (run-hooks 'mouse-leave-buffer-hook) |
| 1271 | ;; Without this, confusing things happen upon e.g. inserting into | ||
| 1272 | ;; the middle of an active region. | ||
| 1271 | (when select-active-regions | 1273 | (when select-active-regions |
| 1272 | ;; Without this, confusing things happen upon e.g. inserting into | 1274 | (let (select-active-regions) |
| 1273 | ;; the middle of an active region. | 1275 | (deactivate-mark))) |
| 1274 | (deactivate-mark)) | ||
| 1275 | (or mouse-yank-at-point (mouse-set-point click)) | 1276 | (or mouse-yank-at-point (mouse-set-point click)) |
| 1276 | (let ((primary | 1277 | (let ((primary |
| 1277 | (cond | 1278 | (cond |
| @@ -1297,8 +1298,7 @@ This does not delete the region; it acts like \\[kill-ring-save]." | |||
| 1297 | ;; whenever it was equal to the front of the kill ring, but some | 1298 | ;; whenever it was equal to the front of the kill ring, but some |
| 1298 | ;; people found that confusing. | 1299 | ;; people found that confusing. |
| 1299 | 1300 | ||
| 1300 | ;; A list (TEXT START END), describing the text and position of the last | 1301 | ;; The position of the last invocation of `mouse-save-then-kill'. |
| 1301 | ;; invocation of mouse-save-then-kill. | ||
| 1302 | (defvar mouse-save-then-kill-posn nil) | 1302 | (defvar mouse-save-then-kill-posn nil) |
| 1303 | 1303 | ||
| 1304 | (defun mouse-save-then-kill-delete-region (beg end) | 1304 | (defun mouse-save-then-kill-delete-region (beg end) |
| @@ -1336,111 +1336,76 @@ This does not delete the region; it acts like \\[kill-ring-save]." | |||
| 1336 | (undo-boundary)) | 1336 | (undo-boundary)) |
| 1337 | 1337 | ||
| 1338 | (defun mouse-save-then-kill (click) | 1338 | (defun mouse-save-then-kill (click) |
| 1339 | "Set the region according to CLICK; the second time, kill the region. | 1339 | "Set the region according to CLICK; the second time, kill it. |
| 1340 | Assuming this command is bound to a mouse button, CLICK is the | 1340 | CLICK should be a mouse click event. |
| 1341 | corresponding input event. | 1341 | |
| 1342 | 1342 | If the region is inactive, activate it temporarily. Set mark at | |
| 1343 | If the region is already active, adjust it. Normally, this | 1343 | the original point, and move point to the position of CLICK. |
| 1344 | happens by moving either point or mark, whichever is closer, to | 1344 | |
| 1345 | the position of CLICK. But if you have selected words or lines, | 1345 | If the region is already active, adjust it. Normally, do this by |
| 1346 | the region is adjusted by moving point or mark to the word or | 1346 | moving point or mark, whichever is closer, to CLICK. But if you |
| 1347 | line boundary closest to CLICK. | 1347 | have selected whole words or lines, move point or mark to the |
| 1348 | 1348 | word or line boundary closest to CLICK instead. | |
| 1349 | If the region is inactive, activate it temporarily; set mark at | 1349 | |
| 1350 | the original point, and move click to the position of CLICK. | 1350 | If this command is called a second consecutive time with the same |
| 1351 | 1351 | CLICK position, kill the region." | |
| 1352 | However, if this command is being called a second time (i.e. the | ||
| 1353 | value of `last-command' is `mouse-save-then-kill'), kill the | ||
| 1354 | region instead. If the text in the region is the same as the | ||
| 1355 | text in the front of the kill ring, just delete it." | ||
| 1356 | (interactive "e") | 1352 | (interactive "e") |
| 1357 | (let ((before-scroll | 1353 | (mouse-minibuffer-check click) |
| 1358 | (with-current-buffer (window-buffer (posn-window (event-start click))) | 1354 | (let* ((posn (event-start click)) |
| 1359 | point-before-scroll))) | 1355 | (click-pt (posn-point posn)) |
| 1360 | (mouse-minibuffer-check click) | 1356 | (window (posn-window posn)) |
| 1361 | (let ((click-posn (posn-point (event-start click))) | 1357 | (buf (window-buffer window)) |
| 1362 | ;; Don't let a subsequent kill command append to this one: | 1358 | ;; Don't let a subsequent kill command append to this one. |
| 1363 | ;; prevent setting this-command to kill-region. | 1359 | (this-command this-command) |
| 1364 | (this-command this-command)) | 1360 | ;; Check if the user has multi-clicked to select words/lines. |
| 1365 | (if (and (with-current-buffer | 1361 | (click-count |
| 1366 | (window-buffer (posn-window (event-start click))) | 1362 | (if (and (eq mouse-selection-click-count-buffer buf) |
| 1367 | (and (mark t) | 1363 | (with-current-buffer buf (mark t))) |
| 1368 | (> (mod mouse-selection-click-count 3) 0) | 1364 | mouse-selection-click-count |
| 1369 | ;; Don't be fooled by a recent click in some other buffer. | 1365 | 0))) |
| 1370 | (eq mouse-selection-click-count-buffer | 1366 | (cond |
| 1371 | (current-buffer))))) | 1367 | ((not (numberp click-pt)) nil) |
| 1372 | (if (and (eq last-command 'mouse-save-then-kill) | 1368 | ;; If the user clicked without moving point, kill the region. |
| 1373 | (equal click-posn (nth 2 mouse-save-then-kill-posn))) | 1369 | ;; This also resets `mouse-selection-click-count'. |
| 1374 | ;; If we click this button again without moving it, kill. | 1370 | ((and (eq last-command 'mouse-save-then-kill) |
| 1375 | (progn | 1371 | (eq click-pt mouse-save-then-kill-posn) |
| 1376 | ;; Call `deactivate-mark' to save the primary selection. | 1372 | (eq window (selected-window))) |
| 1377 | (deactivate-mark) | 1373 | (kill-region (mark t) (point)) |
| 1378 | (mouse-save-then-kill-delete-region (mark) (point)) | 1374 | (setq mouse-selection-click-count 0) |
| 1379 | (setq mouse-selection-click-count 0) | 1375 | (setq mouse-save-then-kill-posn nil)) |
| 1380 | (setq mouse-save-then-kill-posn nil)) | 1376 | |
| 1381 | ;; Find both ends of the object selected by this click. | 1377 | ;; Otherwise, if there is a suitable region, adjust it by moving |
| 1382 | (let* ((range | 1378 | ;; one end (whichever is closer) to CLICK-PT. |
| 1383 | (mouse-start-end click-posn click-posn | 1379 | ((or (with-current-buffer buf (region-active-p)) |
| 1384 | mouse-selection-click-count))) | 1380 | (and (eq window (selected-window)) |
| 1385 | ;; Move whichever end is closer to the click. | 1381 | (mark t) |
| 1386 | ;; That's what xterm does, and it seems reasonable. | 1382 | (or (and (eq last-command 'mouse-save-then-kill) |
| 1387 | (if (< (abs (- click-posn (mark t))) | 1383 | mouse-save-then-kill-posn) |
| 1388 | (abs (- click-posn (point)))) | 1384 | (and (memq last-command '(mouse-drag-region |
| 1389 | (set-mark (car range)) | 1385 | mouse-set-region)) |
| 1390 | (goto-char (nth 1 range))) | 1386 | (or mark-even-if-inactive |
| 1391 | ;; We have already put the old region in the kill ring. | 1387 | (not transient-mark-mode)))))) |
| 1392 | ;; Replace it with the extended region. | 1388 | (select-window window) |
| 1393 | ;; (It would be annoying to make a separate entry.) | 1389 | (let* ((range (mouse-start-end click-pt click-pt click-count))) |
| 1394 | (kill-new (buffer-substring (point) (mark t)) t) | 1390 | (if (< (abs (- click-pt (mark t))) |
| 1395 | (mouse-set-region-1) | 1391 | (abs (- click-pt (point)))) |
| 1396 | ;; Arrange for a repeated mouse-3 to kill this region. | 1392 | (set-mark (car range)) |
| 1397 | (setq mouse-save-then-kill-posn | 1393 | (goto-char (nth 1 range))) |
| 1398 | (list (car kill-ring) (point) click-posn)))) | 1394 | (setq deactivate-mark nil) |
| 1399 | 1395 | (mouse-set-region-1) | |
| 1400 | (if (and (eq last-command 'mouse-save-then-kill) | 1396 | ;; Arrange for a repeated mouse-3 to kill the region. |
| 1401 | mouse-save-then-kill-posn | 1397 | (setq mouse-save-then-kill-posn click-pt))) |
| 1402 | (eq (car mouse-save-then-kill-posn) (car kill-ring)) | 1398 | |
| 1403 | (equal (cdr mouse-save-then-kill-posn) | 1399 | ;; Otherwise, set the mark where point is and move to CLICK-PT. |
| 1404 | (list (point) click-posn))) | 1400 | (t |
| 1405 | ;; If this is the second time we've called | 1401 | (select-window window) |
| 1406 | ;; mouse-save-then-kill, delete the text from the buffer. | 1402 | (mouse-set-mark-fast click) |
| 1407 | (progn | 1403 | (let ((before-scroll (with-current-buffer buf point-before-scroll))) |
| 1408 | ;; Call `deactivate-mark' to save the primary selection. | 1404 | (if before-scroll (goto-char before-scroll))) |
| 1409 | (deactivate-mark) | 1405 | (exchange-point-and-mark) |
| 1410 | (mouse-save-then-kill-delete-region (point) (mark t)) | 1406 | (mouse-set-region-1) |
| 1411 | ;; After we kill, another click counts as "the first time". | 1407 | (setq mouse-save-then-kill-posn click-pt))))) |
| 1412 | (setq mouse-save-then-kill-posn nil)) | 1408 | |
| 1413 | ;; This is not a repetition. | ||
| 1414 | ;; We are adjusting an old selection or creating a new one. | ||
| 1415 | (if (or (and (eq last-command 'mouse-save-then-kill) | ||
| 1416 | mouse-save-then-kill-posn) | ||
| 1417 | (and mark-active transient-mark-mode) | ||
| 1418 | (and (memq last-command | ||
| 1419 | '(mouse-drag-region mouse-set-region)) | ||
| 1420 | (or mark-even-if-inactive | ||
| 1421 | (not transient-mark-mode)))) | ||
| 1422 | ;; We have a selection or suitable region, so adjust it. | ||
| 1423 | (let* ((posn (event-start click)) | ||
| 1424 | (new (posn-point posn))) | ||
| 1425 | (select-window (posn-window posn)) | ||
| 1426 | (if (numberp new) | ||
| 1427 | (progn | ||
| 1428 | ;; Move whichever end of the region is closer to the click. | ||
| 1429 | ;; That is what xterm does, and it seems reasonable. | ||
| 1430 | (if (<= (abs (- new (point))) (abs (- new (mark t)))) | ||
| 1431 | (goto-char new) | ||
| 1432 | (set-mark new)) | ||
| 1433 | (setq deactivate-mark nil))) | ||
| 1434 | (kill-new (buffer-substring (point) (mark t)) t)) | ||
| 1435 | ;; Set the mark where point is, then move where clicked. | ||
| 1436 | (mouse-set-mark-fast click) | ||
| 1437 | (if before-scroll | ||
| 1438 | (goto-char before-scroll)) | ||
| 1439 | (exchange-point-and-mark) ;Why??? --Stef | ||
| 1440 | (kill-new (buffer-substring (point) (mark t)))) | ||
| 1441 | (mouse-set-region-1) | ||
| 1442 | (setq mouse-save-then-kill-posn | ||
| 1443 | (list (car kill-ring) (point) click-posn))))))) | ||
| 1444 | 1409 | ||
| 1445 | (global-set-key [M-mouse-1] 'mouse-start-secondary) | 1410 | (global-set-key [M-mouse-1] 'mouse-start-secondary) |
| 1446 | (global-set-key [M-drag-mouse-1] 'mouse-set-secondary) | 1411 | (global-set-key [M-drag-mouse-1] 'mouse-set-secondary) |
| @@ -1520,9 +1485,6 @@ The function returns a non-nil value if it creates a secondary selection." | |||
| 1520 | ;; of one word or line. | 1485 | ;; of one word or line. |
| 1521 | (let ((range (mouse-start-end start-point start-point click-count))) | 1486 | (let ((range (mouse-start-end start-point start-point click-count))) |
| 1522 | (set-marker mouse-secondary-start nil) | 1487 | (set-marker mouse-secondary-start nil) |
| 1523 | ;; Why the double move? --Stef | ||
| 1524 | ;; (move-overlay mouse-secondary-overlay 1 1 | ||
| 1525 | ;; (window-buffer start-window)) | ||
| 1526 | (move-overlay mouse-secondary-overlay (car range) (nth 1 range) | 1488 | (move-overlay mouse-secondary-overlay (car range) (nth 1 range) |
| 1527 | (window-buffer start-window))) | 1489 | (window-buffer start-window))) |
| 1528 | ;; Single-press: cancel any preexisting secondary selection. | 1490 | ;; Single-press: cancel any preexisting secondary selection. |
| @@ -1616,117 +1578,99 @@ is to prevent accidents." | |||
| 1616 | (delete-overlay mouse-secondary-overlay)) | 1578 | (delete-overlay mouse-secondary-overlay)) |
| 1617 | 1579 | ||
| 1618 | (defun mouse-secondary-save-then-kill (click) | 1580 | (defun mouse-secondary-save-then-kill (click) |
| 1619 | "Save text to point in kill ring; the second time, kill the text. | 1581 | "Set the secondary selection and save it to the kill ring. |
| 1620 | You must use this in a buffer where you have recently done \\[mouse-start-secondary]. | 1582 | The second time, kill it. CLICK should be a mouse click event. |
| 1621 | If the text between where you did \\[mouse-start-secondary] and where | 1583 | |
| 1622 | you use this command matches the text at the front of the kill ring, | 1584 | If you have not called `mouse-start-secondary' in the clicked |
| 1623 | this command deletes the text. | 1585 | buffer, activate the secondary selection and set it between point |
| 1624 | Otherwise, it adds the text to the kill ring, like \\[kill-ring-save], | 1586 | and the click position CLICK. |
| 1625 | which prepares for a second click with this command to delete the text. | 1587 | |
| 1626 | 1588 | Otherwise, adjust the bounds of the secondary selection. | |
| 1627 | If you have already made a secondary selection in that buffer, | 1589 | Normally, do this by moving its beginning or end, whichever is |
| 1628 | this command extends or retracts the selection to where you click. | 1590 | closer, to CLICK. But if you have selected whole words or lines, |
| 1629 | If you do this again in a different position, it extends or retracts | 1591 | adjust to the word or line boundary closest to CLICK instead. |
| 1630 | again. If you do this twice in the same position, it kills the selection." | 1592 | |
| 1593 | If this command is called a second consecutive time with the same | ||
| 1594 | CLICK position, kill the secondary selection." | ||
| 1631 | (interactive "e") | 1595 | (interactive "e") |
| 1632 | (mouse-minibuffer-check click) | 1596 | (mouse-minibuffer-check click) |
| 1633 | (let ((posn (event-start click)) | 1597 | (let* ((posn (event-start click)) |
| 1634 | (click-posn (posn-point (event-start click))) | 1598 | (click-pt (posn-point posn)) |
| 1635 | ;; Don't let a subsequent kill command append to this one: | 1599 | (window (posn-window posn)) |
| 1636 | ;; prevent setting this-command to kill-region. | 1600 | (buf (window-buffer window)) |
| 1637 | (this-command this-command)) | 1601 | ;; Don't let a subsequent kill command append to this one. |
| 1638 | (or (eq (window-buffer (posn-window posn)) | 1602 | (this-command this-command) |
| 1639 | (or (overlay-buffer mouse-secondary-overlay) | 1603 | ;; Check if the user has multi-clicked to select words/lines. |
| 1640 | (if mouse-secondary-start | 1604 | (click-count |
| 1641 | (marker-buffer mouse-secondary-start)))) | 1605 | (if (eq (overlay-buffer mouse-secondary-overlay) buf) |
| 1642 | (error "Wrong buffer")) | 1606 | mouse-secondary-click-count |
| 1643 | (with-current-buffer (window-buffer (posn-window posn)) | 1607 | 0)) |
| 1644 | (if (> (mod mouse-secondary-click-count 3) 0) | 1608 | (beg (overlay-start mouse-secondary-overlay)) |
| 1645 | (if (not (and (eq last-command 'mouse-secondary-save-then-kill) | 1609 | (end (overlay-end mouse-secondary-overlay))) |
| 1646 | (equal click-posn | 1610 | |
| 1647 | (car (cdr-safe (cdr-safe mouse-save-then-kill-posn)))))) | 1611 | (cond |
| 1648 | ;; Find both ends of the object selected by this click. | 1612 | ((not (numberp click-pt)) nil) |
| 1649 | (let* ((range | 1613 | |
| 1650 | (mouse-start-end click-posn click-posn | 1614 | ;; If the secondary selection is not active in BUF, activate it. |
| 1651 | mouse-secondary-click-count))) | 1615 | ((not (eq buf (or (overlay-buffer mouse-secondary-overlay) |
| 1652 | ;; Move whichever end is closer to the click. | 1616 | (if mouse-secondary-start |
| 1653 | ;; That's what xterm does, and it seems reasonable. | 1617 | (marker-buffer mouse-secondary-start))))) |
| 1654 | (if (< (abs (- click-posn (overlay-start mouse-secondary-overlay))) | 1618 | (select-window window) |
| 1655 | (abs (- click-posn (overlay-end mouse-secondary-overlay)))) | 1619 | (setq mouse-secondary-start (make-marker)) |
| 1656 | (move-overlay mouse-secondary-overlay (car range) | 1620 | (move-marker mouse-secondary-start (point)) |
| 1657 | (overlay-end mouse-secondary-overlay)) | 1621 | (move-overlay mouse-secondary-overlay (point) click-pt buf) |
| 1658 | (move-overlay mouse-secondary-overlay | 1622 | (kill-ring-save (point) click-pt)) |
| 1659 | (overlay-start mouse-secondary-overlay) | 1623 | |
| 1660 | (nth 1 range))) | 1624 | ;; If the user clicked without moving point, delete the secondary |
| 1661 | ;; We have already put the old region in the kill ring. | 1625 | ;; selection. This also resets `mouse-secondary-click-count'. |
| 1662 | ;; Replace it with the extended region. | 1626 | ((and (eq last-command 'mouse-secondary-save-then-kill) |
| 1663 | ;; (It would be annoying to make a separate entry.) | 1627 | (eq click-pt mouse-save-then-kill-posn) |
| 1664 | (kill-new (buffer-substring | 1628 | (eq window (selected-window))) |
| 1665 | (overlay-start mouse-secondary-overlay) | 1629 | (mouse-save-then-kill-delete-region beg end) |
| 1666 | (overlay-end mouse-secondary-overlay)) t) | 1630 | (delete-overlay mouse-secondary-overlay) |
| 1667 | ;; Arrange for a repeated mouse-3 to kill this region. | 1631 | (setq mouse-secondary-click-count 0) |
| 1668 | (setq mouse-save-then-kill-posn | 1632 | (setq mouse-save-then-kill-posn nil)) |
| 1669 | (list (car kill-ring) (point) click-posn))) | 1633 | |
| 1670 | ;; If we click this button again without moving it, | 1634 | ;; Otherwise, if there is a suitable secondary selection overlay, |
| 1671 | ;; that time kill. | 1635 | ;; adjust it by moving one end (whichever is closer) to CLICK-PT. |
| 1672 | (progn | 1636 | ((and beg (eq buf (overlay-buffer mouse-secondary-overlay))) |
| 1673 | (mouse-save-then-kill-delete-region | 1637 | (let* ((range (mouse-start-end click-pt click-pt click-count))) |
| 1674 | (overlay-start mouse-secondary-overlay) | 1638 | (if (< (abs (- click-pt beg)) |
| 1675 | (overlay-end mouse-secondary-overlay)) | 1639 | (abs (- click-pt end))) |
| 1676 | (setq mouse-save-then-kill-posn nil) | 1640 | (move-overlay mouse-secondary-overlay (car range) end) |
| 1677 | (setq mouse-secondary-click-count 0) | 1641 | (move-overlay mouse-secondary-overlay beg (nth 1 range)))) |
| 1678 | (delete-overlay mouse-secondary-overlay))) | 1642 | (setq deactivate-mark nil) |
| 1679 | (if (and (eq last-command 'mouse-secondary-save-then-kill) | 1643 | (if (eq last-command 'mouse-secondary-save-then-kill) |
| 1680 | mouse-save-then-kill-posn | 1644 | ;; If the front of the kill ring comes from an immediately |
| 1681 | (eq (car mouse-save-then-kill-posn) (car kill-ring)) | 1645 | ;; previous use of this command, replace the entry. |
| 1682 | (equal (cdr mouse-save-then-kill-posn) (list (point) click-posn))) | 1646 | (kill-new |
| 1683 | ;; If this is the second time we've called | 1647 | (buffer-substring (overlay-start mouse-secondary-overlay) |
| 1684 | ;; mouse-secondary-save-then-kill, delete the text from the buffer. | 1648 | (overlay-end mouse-secondary-overlay)) |
| 1685 | (progn | 1649 | t) |
| 1686 | (mouse-save-then-kill-delete-region | 1650 | (let (deactivate-mark) |
| 1687 | (overlay-start mouse-secondary-overlay) | 1651 | (copy-region-as-kill (overlay-start mouse-secondary-overlay) |
| 1688 | (overlay-end mouse-secondary-overlay)) | 1652 | (overlay-end mouse-secondary-overlay)))) |
| 1689 | (setq mouse-save-then-kill-posn nil) | 1653 | (setq mouse-save-then-kill-posn click-pt)) |
| 1690 | (delete-overlay mouse-secondary-overlay)) | 1654 | |
| 1691 | (if (overlay-start mouse-secondary-overlay) | 1655 | ;; Otherwise, set the secondary selection overlay. |
| 1692 | ;; We have a selection, so adjust it. | 1656 | (t |
| 1693 | (progn | 1657 | (select-window window) |
| 1694 | (if (numberp click-posn) | 1658 | (if mouse-secondary-start |
| 1695 | (progn | 1659 | ;; All we have is one end of a selection, so put the other |
| 1696 | ;; Move whichever end of the region is closer to the click. | 1660 | ;; end here. |
| 1697 | ;; That is what xterm does, and it seems reasonable. | 1661 | (let ((start (+ 0 mouse-secondary-start))) |
| 1698 | (if (< (abs (- click-posn (overlay-start mouse-secondary-overlay))) | 1662 | (kill-ring-save start click-pt) |
| 1699 | (abs (- click-posn (overlay-end mouse-secondary-overlay)))) | 1663 | (move-overlay mouse-secondary-overlay start click-pt))) |
| 1700 | (move-overlay mouse-secondary-overlay click-posn | 1664 | (setq mouse-save-then-kill-posn click-pt)))) |
| 1701 | (overlay-end mouse-secondary-overlay)) | 1665 | |
| 1702 | (move-overlay mouse-secondary-overlay | 1666 | ;; Finally, set the window system's secondary selection. |
| 1703 | (overlay-start mouse-secondary-overlay) | 1667 | (let (str) |
| 1704 | click-posn)) | 1668 | (and (overlay-buffer mouse-secondary-overlay) |
| 1705 | (setq deactivate-mark nil))) | 1669 | (setq str (buffer-substring (overlay-start mouse-secondary-overlay) |
| 1706 | (if (eq last-command 'mouse-secondary-save-then-kill) | 1670 | (overlay-end mouse-secondary-overlay))) |
| 1707 | ;; If the front of the kill ring comes from | 1671 | (> (length str) 0) |
| 1708 | ;; an immediately previous use of this command, | 1672 | (x-set-selection 'SECONDARY str)))) |
| 1709 | ;; replace it with the extended region. | 1673 | |
| 1710 | ;; (It would be annoying to make a separate entry.) | ||
| 1711 | (kill-new (buffer-substring | ||
| 1712 | (overlay-start mouse-secondary-overlay) | ||
| 1713 | (overlay-end mouse-secondary-overlay)) t) | ||
| 1714 | (let (deactivate-mark) | ||
| 1715 | (copy-region-as-kill (overlay-start mouse-secondary-overlay) | ||
| 1716 | (overlay-end mouse-secondary-overlay))))) | ||
| 1717 | (if mouse-secondary-start | ||
| 1718 | ;; All we have is one end of a selection, | ||
| 1719 | ;; so put the other end here. | ||
| 1720 | (let ((start (+ 0 mouse-secondary-start))) | ||
| 1721 | (kill-ring-save start click-posn) | ||
| 1722 | (move-overlay mouse-secondary-overlay start click-posn)))) | ||
| 1723 | (setq mouse-save-then-kill-posn | ||
| 1724 | (list (car kill-ring) (point) click-posn)))) | ||
| 1725 | (if (overlay-buffer mouse-secondary-overlay) | ||
| 1726 | (x-set-selection 'SECONDARY | ||
| 1727 | (buffer-substring | ||
| 1728 | (overlay-start mouse-secondary-overlay) | ||
| 1729 | (overlay-end mouse-secondary-overlay))))))) | ||
| 1730 | 1674 | ||
| 1731 | (defcustom mouse-buffer-menu-maxlen 20 | 1675 | (defcustom mouse-buffer-menu-maxlen 20 |
| 1732 | "Number of buffers in one pane (submenu) of the buffer menu. | 1676 | "Number of buffers in one pane (submenu) of the buffer menu. |
| @@ -1907,332 +1851,6 @@ and selects that window." | |||
| 1907 | ;; Few buffers--put them all in one pane. | 1851 | ;; Few buffers--put them all in one pane. |
| 1908 | (list (cons title alist)))) | 1852 | (list (cons title alist)))) |
| 1909 | 1853 | ||
| 1910 | ;; These need to be rewritten for the new scroll bar implementation. | ||
| 1911 | |||
| 1912 | ;;!! ;; Commands for the scroll bar. | ||
| 1913 | ;;!! | ||
| 1914 | ;;!! (defun mouse-scroll-down (click) | ||
| 1915 | ;;!! (interactive "@e") | ||
| 1916 | ;;!! (scroll-down (1+ (cdr (mouse-coords click))))) | ||
| 1917 | ;;!! | ||
| 1918 | ;;!! (defun mouse-scroll-up (click) | ||
| 1919 | ;;!! (interactive "@e") | ||
| 1920 | ;;!! (scroll-up (1+ (cdr (mouse-coords click))))) | ||
| 1921 | ;;!! | ||
| 1922 | ;;!! (defun mouse-scroll-down-full () | ||
| 1923 | ;;!! (interactive "@") | ||
| 1924 | ;;!! (scroll-down nil)) | ||
| 1925 | ;;!! | ||
| 1926 | ;;!! (defun mouse-scroll-up-full () | ||
| 1927 | ;;!! (interactive "@") | ||
| 1928 | ;;!! (scroll-up nil)) | ||
| 1929 | ;;!! | ||
| 1930 | ;;!! (defun mouse-scroll-move-cursor (click) | ||
| 1931 | ;;!! (interactive "@e") | ||
| 1932 | ;;!! (move-to-window-line (1+ (cdr (mouse-coords click))))) | ||
| 1933 | ;;!! | ||
| 1934 | ;;!! (defun mouse-scroll-absolute (event) | ||
| 1935 | ;;!! (interactive "@e") | ||
| 1936 | ;;!! (let* ((pos (car event)) | ||
| 1937 | ;;!! (position (car pos)) | ||
| 1938 | ;;!! (length (car (cdr pos)))) | ||
| 1939 | ;;!! (if (<= length 0) (setq length 1)) | ||
| 1940 | ;;!! (let* ((scale-factor (max 1 (/ length (/ 8000000 (buffer-size))))) | ||
| 1941 | ;;!! (newpos (* (/ (* (/ (buffer-size) scale-factor) | ||
| 1942 | ;;!! position) | ||
| 1943 | ;;!! length) | ||
| 1944 | ;;!! scale-factor))) | ||
| 1945 | ;;!! (goto-char newpos) | ||
| 1946 | ;;!! (recenter '(4))))) | ||
| 1947 | ;;!! | ||
| 1948 | ;;!! (defun mouse-scroll-left (click) | ||
| 1949 | ;;!! (interactive "@e") | ||
| 1950 | ;;!! (scroll-left (1+ (car (mouse-coords click))))) | ||
| 1951 | ;;!! | ||
| 1952 | ;;!! (defun mouse-scroll-right (click) | ||
| 1953 | ;;!! (interactive "@e") | ||
| 1954 | ;;!! (scroll-right (1+ (car (mouse-coords click))))) | ||
| 1955 | ;;!! | ||
| 1956 | ;;!! (defun mouse-scroll-left-full () | ||
| 1957 | ;;!! (interactive "@") | ||
| 1958 | ;;!! (scroll-left nil)) | ||
| 1959 | ;;!! | ||
| 1960 | ;;!! (defun mouse-scroll-right-full () | ||
| 1961 | ;;!! (interactive "@") | ||
| 1962 | ;;!! (scroll-right nil)) | ||
| 1963 | ;;!! | ||
| 1964 | ;;!! (defun mouse-scroll-move-cursor-horizontally (click) | ||
| 1965 | ;;!! (interactive "@e") | ||
| 1966 | ;;!! (move-to-column (1+ (car (mouse-coords click))))) | ||
| 1967 | ;;!! | ||
| 1968 | ;;!! (defun mouse-scroll-absolute-horizontally (event) | ||
| 1969 | ;;!! (interactive "@e") | ||
| 1970 | ;;!! (let* ((pos (car event)) | ||
| 1971 | ;;!! (position (car pos)) | ||
| 1972 | ;;!! (length (car (cdr pos)))) | ||
| 1973 | ;;!! (set-window-hscroll (selected-window) 33))) | ||
| 1974 | ;;!! | ||
| 1975 | ;;!! (global-set-key [scroll-bar mouse-1] 'mouse-scroll-up) | ||
| 1976 | ;;!! (global-set-key [scroll-bar mouse-2] 'mouse-scroll-absolute) | ||
| 1977 | ;;!! (global-set-key [scroll-bar mouse-3] 'mouse-scroll-down) | ||
| 1978 | ;;!! | ||
| 1979 | ;;!! (global-set-key [vertical-slider mouse-1] 'mouse-scroll-move-cursor) | ||
| 1980 | ;;!! (global-set-key [vertical-slider mouse-2] 'mouse-scroll-move-cursor) | ||
| 1981 | ;;!! (global-set-key [vertical-slider mouse-3] 'mouse-scroll-move-cursor) | ||
| 1982 | ;;!! | ||
| 1983 | ;;!! (global-set-key [thumbup mouse-1] 'mouse-scroll-up-full) | ||
| 1984 | ;;!! (global-set-key [thumbup mouse-2] 'mouse-scroll-up-full) | ||
| 1985 | ;;!! (global-set-key [thumbup mouse-3] 'mouse-scroll-up-full) | ||
| 1986 | ;;!! | ||
| 1987 | ;;!! (global-set-key [thumbdown mouse-1] 'mouse-scroll-down-full) | ||
| 1988 | ;;!! (global-set-key [thumbdown mouse-2] 'mouse-scroll-down-full) | ||
| 1989 | ;;!! (global-set-key [thumbdown mouse-3] 'mouse-scroll-down-full) | ||
| 1990 | ;;!! | ||
| 1991 | ;;!! (global-set-key [horizontal-scroll-bar mouse-1] 'mouse-scroll-left) | ||
| 1992 | ;;!! (global-set-key [horizontal-scroll-bar mouse-2] | ||
| 1993 | ;;!! 'mouse-scroll-absolute-horizontally) | ||
| 1994 | ;;!! (global-set-key [horizontal-scroll-bar mouse-3] 'mouse-scroll-right) | ||
| 1995 | ;;!! | ||
| 1996 | ;;!! (global-set-key [horizontal-slider mouse-1] | ||
| 1997 | ;;!! 'mouse-scroll-move-cursor-horizontally) | ||
| 1998 | ;;!! (global-set-key [horizontal-slider mouse-2] | ||
| 1999 | ;;!! 'mouse-scroll-move-cursor-horizontally) | ||
| 2000 | ;;!! (global-set-key [horizontal-slider mouse-3] | ||
| 2001 | ;;!! 'mouse-scroll-move-cursor-horizontally) | ||
| 2002 | ;;!! | ||
| 2003 | ;;!! (global-set-key [thumbleft mouse-1] 'mouse-scroll-left-full) | ||
| 2004 | ;;!! (global-set-key [thumbleft mouse-2] 'mouse-scroll-left-full) | ||
| 2005 | ;;!! (global-set-key [thumbleft mouse-3] 'mouse-scroll-left-full) | ||
| 2006 | ;;!! | ||
| 2007 | ;;!! (global-set-key [thumbright mouse-1] 'mouse-scroll-right-full) | ||
| 2008 | ;;!! (global-set-key [thumbright mouse-2] 'mouse-scroll-right-full) | ||
| 2009 | ;;!! (global-set-key [thumbright mouse-3] 'mouse-scroll-right-full) | ||
| 2010 | ;;!! | ||
| 2011 | ;;!! (global-set-key [horizontal-scroll-bar S-mouse-2] | ||
| 2012 | ;;!! 'mouse-split-window-horizontally) | ||
| 2013 | ;;!! (global-set-key [mode-line S-mouse-2] | ||
| 2014 | ;;!! 'mouse-split-window-horizontally) | ||
| 2015 | ;;!! (global-set-key [vertical-scroll-bar S-mouse-2] | ||
| 2016 | ;;!! 'mouse-split-window) | ||
| 2017 | |||
| 2018 | ;;!! ;;;; | ||
| 2019 | ;;!! ;;;; Here are experimental things being tested. Mouse events | ||
| 2020 | ;;!! ;;;; are of the form: | ||
| 2021 | ;;!! ;;;; ((x y) window screen-part key-sequence timestamp) | ||
| 2022 | ;;!! ;; | ||
| 2023 | ;;!! ;;;; | ||
| 2024 | ;;!! ;;;; Dynamically track mouse coordinates | ||
| 2025 | ;;!! ;;;; | ||
| 2026 | ;;!! ;; | ||
| 2027 | ;;!! ;;(defun track-mouse (event) | ||
| 2028 | ;;!! ;; "Track the coordinates, absolute and relative, of the mouse." | ||
| 2029 | ;;!! ;; (interactive "@e") | ||
| 2030 | ;;!! ;; (while mouse-grabbed | ||
| 2031 | ;;!! ;; (let* ((pos (read-mouse-position (selected-screen))) | ||
| 2032 | ;;!! ;; (abs-x (car pos)) | ||
| 2033 | ;;!! ;; (abs-y (cdr pos)) | ||
| 2034 | ;;!! ;; (relative-coordinate (coordinates-in-window-p | ||
| 2035 | ;;!! ;; (list (car pos) (cdr pos)) | ||
| 2036 | ;;!! ;; (selected-window)))) | ||
| 2037 | ;;!! ;; (if (consp relative-coordinate) | ||
| 2038 | ;;!! ;; (message "mouse: [%d %d], (%d %d)" abs-x abs-y | ||
| 2039 | ;;!! ;; (car relative-coordinate) | ||
| 2040 | ;;!! ;; (car (cdr relative-coordinate))) | ||
| 2041 | ;;!! ;; (message "mouse: [%d %d]" abs-x abs-y))))) | ||
| 2042 | ;;!! | ||
| 2043 | ;;!! ;; | ||
| 2044 | ;;!! ;; Dynamically put a box around the line indicated by point | ||
| 2045 | ;;!! ;; | ||
| 2046 | ;;!! ;; | ||
| 2047 | ;;!! ;;(require 'backquote) | ||
| 2048 | ;;!! ;; | ||
| 2049 | ;;!! ;;(defun mouse-select-buffer-line (event) | ||
| 2050 | ;;!! ;; (interactive "@e") | ||
| 2051 | ;;!! ;; (let ((relative-coordinate | ||
| 2052 | ;;!! ;; (coordinates-in-window-p (car event) (selected-window))) | ||
| 2053 | ;;!! ;; (abs-y (car (cdr (car event))))) | ||
| 2054 | ;;!! ;; (if (consp relative-coordinate) | ||
| 2055 | ;;!! ;; (progn | ||
| 2056 | ;;!! ;; (save-excursion | ||
| 2057 | ;;!! ;; (move-to-window-line (car (cdr relative-coordinate))) | ||
| 2058 | ;;!! ;; (x-draw-rectangle | ||
| 2059 | ;;!! ;; (selected-screen) | ||
| 2060 | ;;!! ;; abs-y 0 | ||
| 2061 | ;;!! ;; (save-excursion | ||
| 2062 | ;;!! ;; (move-to-window-line (car (cdr relative-coordinate))) | ||
| 2063 | ;;!! ;; (end-of-line) | ||
| 2064 | ;;!! ;; (push-mark nil t) | ||
| 2065 | ;;!! ;; (beginning-of-line) | ||
| 2066 | ;;!! ;; (- (region-end) (region-beginning))) 1)) | ||
| 2067 | ;;!! ;; (sit-for 1) | ||
| 2068 | ;;!! ;; (x-erase-rectangle (selected-screen)))))) | ||
| 2069 | ;;!! ;; | ||
| 2070 | ;;!! ;;(defvar last-line-drawn nil) | ||
| 2071 | ;;!! ;;(defvar begin-delim "[^ \t]") | ||
| 2072 | ;;!! ;;(defvar end-delim "[^ \t]") | ||
| 2073 | ;;!! ;; | ||
| 2074 | ;;!! ;;(defun mouse-boxing (event) | ||
| 2075 | ;;!! ;; (interactive "@e") | ||
| 2076 | ;;!! ;; (save-excursion | ||
| 2077 | ;;!! ;; (let ((screen (selected-screen))) | ||
| 2078 | ;;!! ;; (while (= (x-mouse-events) 0) | ||
| 2079 | ;;!! ;; (let* ((pos (read-mouse-position screen)) | ||
| 2080 | ;;!! ;; (abs-x (car pos)) | ||
| 2081 | ;;!! ;; (abs-y (cdr pos)) | ||
| 2082 | ;;!! ;; (relative-coordinate | ||
| 2083 | ;;!! ;; (coordinates-in-window-p `(,abs-x ,abs-y) | ||
| 2084 | ;;!! ;; (selected-window))) | ||
| 2085 | ;;!! ;; (begin-reg nil) | ||
| 2086 | ;;!! ;; (end-reg nil) | ||
| 2087 | ;;!! ;; (end-column nil) | ||
| 2088 | ;;!! ;; (begin-column nil)) | ||
| 2089 | ;;!! ;; (if (and (consp relative-coordinate) | ||
| 2090 | ;;!! ;; (or (not last-line-drawn) | ||
| 2091 | ;;!! ;; (not (= last-line-drawn abs-y)))) | ||
| 2092 | ;;!! ;; (progn | ||
| 2093 | ;;!! ;; (move-to-window-line (car (cdr relative-coordinate))) | ||
| 2094 | ;;!! ;; (if (= (following-char) 10) | ||
| 2095 | ;;!! ;; () | ||
| 2096 | ;;!! ;; (progn | ||
| 2097 | ;;!! ;; (setq begin-reg (1- (re-search-forward end-delim))) | ||
| 2098 | ;;!! ;; (setq begin-column (1- (current-column))) | ||
| 2099 | ;;!! ;; (end-of-line) | ||
| 2100 | ;;!! ;; (setq end-reg (1+ (re-search-backward begin-delim))) | ||
| 2101 | ;;!! ;; (setq end-column (1+ (current-column))) | ||
| 2102 | ;;!! ;; (message "%s" (buffer-substring begin-reg end-reg)) | ||
| 2103 | ;;!! ;; (x-draw-rectangle screen | ||
| 2104 | ;;!! ;; (setq last-line-drawn abs-y) | ||
| 2105 | ;;!! ;; begin-column | ||
| 2106 | ;;!! ;; (- end-column begin-column) 1)))))))))) | ||
| 2107 | ;;!! ;; | ||
| 2108 | ;;!! ;;(defun mouse-erase-box () | ||
| 2109 | ;;!! ;; (interactive) | ||
| 2110 | ;;!! ;; (if last-line-drawn | ||
| 2111 | ;;!! ;; (progn | ||
| 2112 | ;;!! ;; (x-erase-rectangle (selected-screen)) | ||
| 2113 | ;;!! ;; (setq last-line-drawn nil)))) | ||
| 2114 | ;;!! | ||
| 2115 | ;;!! ;;; (defun test-x-rectangle () | ||
| 2116 | ;;!! ;;; (use-local-mouse-map (setq rectangle-test-map (make-sparse-keymap))) | ||
| 2117 | ;;!! ;;; (define-key rectangle-test-map mouse-motion-button-left 'mouse-boxing) | ||
| 2118 | ;;!! ;;; (define-key rectangle-test-map mouse-button-left-up 'mouse-erase-box)) | ||
| 2119 | ;;!! | ||
| 2120 | ;;!! ;; | ||
| 2121 | ;;!! ;; Here is how to do double clicking in lisp. About to change. | ||
| 2122 | ;;!! ;; | ||
| 2123 | ;;!! | ||
| 2124 | ;;!! (defvar double-start nil) | ||
| 2125 | ;;!! (defconst double-click-interval 300 | ||
| 2126 | ;;!! "Max ticks between clicks") | ||
| 2127 | ;;!! | ||
| 2128 | ;;!! (defun double-down (event) | ||
| 2129 | ;;!! (interactive "@e") | ||
| 2130 | ;;!! (if double-start | ||
| 2131 | ;;!! (let ((interval (- (nth 4 event) double-start))) | ||
| 2132 | ;;!! (if (< interval double-click-interval) | ||
| 2133 | ;;!! (progn | ||
| 2134 | ;;!! (backward-up-list 1) | ||
| 2135 | ;;!! ;; (message "Interval %d" interval) | ||
| 2136 | ;;!! (sleep-for 1))) | ||
| 2137 | ;;!! (setq double-start nil)) | ||
| 2138 | ;;!! (setq double-start (nth 4 event)))) | ||
| 2139 | ;;!! | ||
| 2140 | ;;!! (defun double-up (event) | ||
| 2141 | ;;!! (interactive "@e") | ||
| 2142 | ;;!! (and double-start | ||
| 2143 | ;;!! (> (- (nth 4 event ) double-start) double-click-interval) | ||
| 2144 | ;;!! (setq double-start nil))) | ||
| 2145 | ;;!! | ||
| 2146 | ;;!! ;;; (defun x-test-doubleclick () | ||
| 2147 | ;;!! ;;; (use-local-mouse-map (setq doubleclick-test-map (make-sparse-keymap))) | ||
| 2148 | ;;!! ;;; (define-key doubleclick-test-map mouse-button-left 'double-down) | ||
| 2149 | ;;!! ;;; (define-key doubleclick-test-map mouse-button-left-up 'double-up)) | ||
| 2150 | ;;!! | ||
| 2151 | ;;!! ;; | ||
| 2152 | ;;!! ;; This scrolls while button is depressed. Use preferable in scroll bar. | ||
| 2153 | ;;!! ;; | ||
| 2154 | ;;!! | ||
| 2155 | ;;!! (defvar scrolled-lines 0) | ||
| 2156 | ;;!! (defconst scroll-speed 1) | ||
| 2157 | ;;!! | ||
| 2158 | ;;!! (defun incr-scroll-down (event) | ||
| 2159 | ;;!! (interactive "@e") | ||
| 2160 | ;;!! (setq scrolled-lines 0) | ||
| 2161 | ;;!! (incremental-scroll scroll-speed)) | ||
| 2162 | ;;!! | ||
| 2163 | ;;!! (defun incr-scroll-up (event) | ||
| 2164 | ;;!! (interactive "@e") | ||
| 2165 | ;;!! (setq scrolled-lines 0) | ||
| 2166 | ;;!! (incremental-scroll (- scroll-speed))) | ||
| 2167 | ;;!! | ||
| 2168 | ;;!! (defun incremental-scroll (n) | ||
| 2169 | ;;!! (while (= (x-mouse-events) 0) | ||
| 2170 | ;;!! (setq scrolled-lines (1+ (* scroll-speed scrolled-lines))) | ||
| 2171 | ;;!! (scroll-down n) | ||
| 2172 | ;;!! (sit-for 300 t))) | ||
| 2173 | ;;!! | ||
| 2174 | ;;!! (defun incr-scroll-stop (event) | ||
| 2175 | ;;!! (interactive "@e") | ||
| 2176 | ;;!! (message "Scrolled %d lines" scrolled-lines) | ||
| 2177 | ;;!! (setq scrolled-lines 0) | ||
| 2178 | ;;!! (sleep-for 1)) | ||
| 2179 | ;;!! | ||
| 2180 | ;;!! ;;; (defun x-testing-scroll () | ||
| 2181 | ;;!! ;;; (let ((scrolling-map (function mouse-vertical-scroll-bar-prefix))) | ||
| 2182 | ;;!! ;;; (define-key scrolling-map mouse-button-left 'incr-scroll-down) | ||
| 2183 | ;;!! ;;; (define-key scrolling-map mouse-button-right 'incr-scroll-up) | ||
| 2184 | ;;!! ;;; (define-key scrolling-map mouse-button-left-up 'incr-scroll-stop) | ||
| 2185 | ;;!! ;;; (define-key scrolling-map mouse-button-right-up 'incr-scroll-stop))) | ||
| 2186 | ;;!! | ||
| 2187 | ;;!! ;; | ||
| 2188 | ;;!! ;; Some playthings suitable for picture mode? They need work. | ||
| 2189 | ;;!! ;; | ||
| 2190 | ;;!! | ||
| 2191 | ;;!! (defun mouse-kill-rectangle (event) | ||
| 2192 | ;;!! "Kill the rectangle between point and the mouse cursor." | ||
| 2193 | ;;!! (interactive "@e") | ||
| 2194 | ;;!! (let ((point-save (point))) | ||
| 2195 | ;;!! (save-excursion | ||
| 2196 | ;;!! (mouse-set-point event) | ||
| 2197 | ;;!! (push-mark nil t) | ||
| 2198 | ;;!! (if (> point-save (point)) | ||
| 2199 | ;;!! (kill-rectangle (point) point-save) | ||
| 2200 | ;;!! (kill-rectangle point-save (point)))))) | ||
| 2201 | ;;!! | ||
| 2202 | ;;!! (defun mouse-open-rectangle (event) | ||
| 2203 | ;;!! "Kill the rectangle between point and the mouse cursor." | ||
| 2204 | ;;!! (interactive "@e") | ||
| 2205 | ;;!! (let ((point-save (point))) | ||
| 2206 | ;;!! (save-excursion | ||
| 2207 | ;;!! (mouse-set-point event) | ||
| 2208 | ;;!! (push-mark nil t) | ||
| 2209 | ;;!! (if (> point-save (point)) | ||
| 2210 | ;;!! (open-rectangle (point) point-save) | ||
| 2211 | ;;!! (open-rectangle point-save (point)))))) | ||
| 2212 | ;;!! | ||
| 2213 | ;;!! ;; Must be a better way to do this. | ||
| 2214 | ;;!! | ||
| 2215 | ;;!! (defun mouse-multiple-insert (n char) | ||
| 2216 | ;;!! (while (> n 0) | ||
| 2217 | ;;!! (insert char) | ||
| 2218 | ;;!! (setq n (1- n)))) | ||
| 2219 | ;;!! | ||
| 2220 | ;;!! ;; What this could do is not finalize until button was released. | ||
| 2221 | ;;!! | ||
| 2222 | ;;!! (defun mouse-move-text (event) | ||
| 2223 | ;;!! "Move text from point to cursor position, inserting spaces." | ||
| 2224 | ;;!! (interactive "@e") | ||
| 2225 | ;;!! (let* ((relative-coordinate | ||
| 2226 | ;;!! (coordinates-in-window-p (car event) (selected-window)))) | ||
| 2227 | ;;!! (if (consp relative-coordinate) | ||
| 2228 | ;;!! (cond ((> (current-column) (car relative-coordinate)) | ||
| 2229 | ;;!! (delete-char | ||
| 2230 | ;;!! (- (car relative-coordinate) (current-column)))) | ||
| 2231 | ;;!! ((< (current-column) (car relative-coordinate)) | ||
| 2232 | ;;!! (mouse-multiple-insert | ||
| 2233 | ;;!! (- (car relative-coordinate) (current-column)) " ")) | ||
| 2234 | ;;!! ((= (current-column) (car relative-coordinate)) (ding)))))) | ||
| 2235 | |||
| 2236 | (define-obsolete-function-alias | 1854 | (define-obsolete-function-alias |
| 2237 | 'mouse-choose-completion 'choose-completion "23.2") | 1855 | 'mouse-choose-completion 'choose-completion "23.2") |
| 2238 | 1856 | ||
| @@ -2475,10 +2093,6 @@ choose a font." | |||
| 2475 | (mouse-menu-bar-map) | 2093 | (mouse-menu-bar-map) |
| 2476 | (mouse-menu-major-mode-map))))) | 2094 | (mouse-menu-major-mode-map))))) |
| 2477 | 2095 | ||
| 2478 | |||
| 2479 | ;; Replaced with dragging mouse-1 | ||
| 2480 | ;; (global-set-key [S-mouse-1] 'mouse-set-mark) | ||
| 2481 | |||
| 2482 | ;; Binding mouse-1 to mouse-select-window when on mode-, header-, or | 2096 | ;; Binding mouse-1 to mouse-select-window when on mode-, header-, or |
| 2483 | ;; vertical-line prevents Emacs from signaling an error when the mouse | 2097 | ;; vertical-line prevents Emacs from signaling an error when the mouse |
| 2484 | ;; button is released after dragging these lines, on non-toolkit | 2098 | ;; button is released after dragging these lines, on non-toolkit |
diff --git a/lisp/net/dbus.el b/lisp/net/dbus.el index 870bd2e313d..ee876e04190 100644 --- a/lisp/net/dbus.el +++ b/lisp/net/dbus.el | |||
| @@ -108,15 +108,12 @@ catched in `condition-case' by `dbus-error'.") | |||
| 108 | 108 | ||
| 109 | ;;; Hash table of registered functions. | 109 | ;;; Hash table of registered functions. |
| 110 | 110 | ||
| 111 | ;; We create it here. So we have a simple test in dbusbind.c, whether | ||
| 112 | ;; the Lisp code has been loaded. | ||
| 113 | (setq dbus-registered-objects-table (make-hash-table :test 'equal)) | ||
| 114 | |||
| 115 | (defvar dbus-return-values-table (make-hash-table :test 'equal) | 111 | (defvar dbus-return-values-table (make-hash-table :test 'equal) |
| 116 | "Hash table for temporary storing arguments of reply messages. | 112 | "Hash table for temporary storing arguments of reply messages. |
| 117 | A key in this hash table is a list (BUS SERIAL). BUS is either the | 113 | A key in this hash table is a list (BUS SERIAL). BUS is either a |
| 118 | symbol `:system' or the symbol `:session'. SERIAL is the serial number | 114 | Lisp symbol, `:system' or `:session', or a string denoting the |
| 119 | of the reply message. See `dbus-call-method-non-blocking-handler' and | 115 | bus address. SERIAL is the serial number of the reply message. |
| 116 | See `dbus-call-method-non-blocking-handler' and | ||
| 120 | `dbus-call-method-non-blocking'.") | 117 | `dbus-call-method-non-blocking'.") |
| 121 | 118 | ||
| 122 | (defun dbus-list-hash-table () | 119 | (defun dbus-list-hash-table () |
| @@ -187,8 +184,8 @@ association to the service from D-Bus." | |||
| 187 | 184 | ||
| 188 | (defun dbus-unregister-service (bus service) | 185 | (defun dbus-unregister-service (bus service) |
| 189 | "Unregister all objects related to SERVICE from D-Bus BUS. | 186 | "Unregister all objects related to SERVICE from D-Bus BUS. |
| 190 | BUS must be either the symbol `:system' or the symbol `:session'. | 187 | BUS is either a Lisp symbol, `:system' or `:session', or a string |
| 191 | SERVICE must be a known service name." | 188 | denoting the bus address. SERVICE must be a known service name." |
| 192 | (maphash | 189 | (maphash |
| 193 | (lambda (key value) | 190 | (lambda (key value) |
| 194 | (dolist (elt value) | 191 | (dolist (elt value) |
| @@ -353,15 +350,15 @@ EVENT is a list which starts with symbol `dbus-event': | |||
| 353 | (dbus-event BUS TYPE SERIAL SERVICE PATH INTERFACE MEMBER HANDLER &rest ARGS) | 350 | (dbus-event BUS TYPE SERIAL SERVICE PATH INTERFACE MEMBER HANDLER &rest ARGS) |
| 354 | 351 | ||
| 355 | BUS identifies the D-Bus the message is coming from. It is | 352 | BUS identifies the D-Bus the message is coming from. It is |
| 356 | either the symbol `:system' or the symbol `:session'. TYPE is | 353 | either a Lisp symbol, `:system' or `:session', or a string |
| 357 | the D-Bus message type which has caused the event, SERIAL is the | 354 | denoting the bus address. TYPE is the D-Bus message type which |
| 358 | serial number of the received D-Bus message. SERVICE and PATH | 355 | has caused the event, SERIAL is the serial number of the received |
| 359 | are the unique name and the object path of the D-Bus object | 356 | D-Bus message. SERVICE and PATH are the unique name and the |
| 360 | emitting the message. INTERFACE and MEMBER denote the message | 357 | object path of the D-Bus object emitting the message. INTERFACE |
| 361 | which has been sent. HANDLER is the function which has been | 358 | and MEMBER denote the message which has been sent. HANDLER is |
| 362 | registered for this message. ARGS are the arguments passed to | 359 | the function which has been registered for this message. ARGS |
| 363 | HANDLER, when it is called during event handling in | 360 | are the arguments passed to HANDLER, when it is called during |
| 364 | `dbus-handle-event'. | 361 | event handling in `dbus-handle-event'. |
| 365 | 362 | ||
| 366 | This function raises a `dbus-error' signal in case the event is | 363 | This function raises a `dbus-error' signal in case the event is |
| 367 | not well formed." | 364 | not well formed." |
| @@ -369,7 +366,8 @@ not well formed." | |||
| 369 | (unless (and (listp event) | 366 | (unless (and (listp event) |
| 370 | (eq (car event) 'dbus-event) | 367 | (eq (car event) 'dbus-event) |
| 371 | ;; Bus symbol. | 368 | ;; Bus symbol. |
| 372 | (symbolp (nth 1 event)) | 369 | (or (symbolp (nth 1 event)) |
| 370 | (stringp (nth 1 event))) | ||
| 373 | ;; Type. | 371 | ;; Type. |
| 374 | (and (natnump (nth 2 event)) | 372 | (and (natnump (nth 2 event)) |
| 375 | (< dbus-message-type-invalid (nth 2 event))) | 373 | (< dbus-message-type-invalid (nth 2 event))) |
| @@ -434,9 +432,10 @@ If the HANDLER returns a `dbus-error', it is propagated as return message." | |||
| 434 | 432 | ||
| 435 | (defun dbus-event-bus-name (event) | 433 | (defun dbus-event-bus-name (event) |
| 436 | "Return the bus name the event is coming from. | 434 | "Return the bus name the event is coming from. |
| 437 | The result is either the symbol `:system' or the symbol `:session'. | 435 | The result is either a Lisp symbol, `:system' or `:session', or a |
| 438 | EVENT is a D-Bus event, see `dbus-check-event'. This function | 436 | string denoting the bus address. EVENT is a D-Bus event, see |
| 439 | raises a `dbus-error' signal in case the event is not well formed." | 437 | `dbus-check-event'. This function raises a `dbus-error' signal |
| 438 | in case the event is not well formed." | ||
| 440 | (dbus-check-event event) | 439 | (dbus-check-event event) |
| 441 | (nth 1 event)) | 440 | (nth 1 event)) |
| 442 | 441 | ||
| @@ -566,10 +565,11 @@ apply | |||
| 566 | "Return all interfaces and sub-nodes of SERVICE, | 565 | "Return all interfaces and sub-nodes of SERVICE, |
| 567 | registered at object path PATH at bus BUS. | 566 | registered at object path PATH at bus BUS. |
| 568 | 567 | ||
| 569 | BUS must be either the symbol `:system' or the symbol `:session'. | 568 | BUS is either a Lisp symbol, `:system' or `:session', or a string |
| 570 | SERVICE must be a known service name, and PATH must be a valid | 569 | denoting the bus address. SERVICE must be a known service name, |
| 571 | object path. The last two parameters are strings. The result, | 570 | and PATH must be a valid object path. The last two parameters |
| 572 | the introspection data, is a string in XML format." | 571 | are strings. The result, the introspection data, is a string in |
| 572 | XML format." | ||
| 573 | ;; We don't want to raise errors. `dbus-call-method-non-blocking' | 573 | ;; We don't want to raise errors. `dbus-call-method-non-blocking' |
| 574 | ;; is used, because the handler can be registered in our Emacs | 574 | ;; is used, because the handler can be registered in our Emacs |
| 575 | ;; instance; caller an callee would block each other. | 575 | ;; instance; caller an callee would block each other. |
| @@ -873,7 +873,8 @@ name of the property, and its value. If there are no properties, | |||
| 873 | (bus service path interface property access value &optional emits-signal) | 873 | (bus service path interface property access value &optional emits-signal) |
| 874 | "Register property PROPERTY on the D-Bus BUS. | 874 | "Register property PROPERTY on the D-Bus BUS. |
| 875 | 875 | ||
| 876 | BUS is either the symbol `:system' or the symbol `:session'. | 876 | BUS is either a Lisp symbol, `:system' or `:session', or a string |
| 877 | denoting the bus address. | ||
| 877 | 878 | ||
| 878 | SERVICE is the D-Bus service name of the D-Bus. It must be a | 879 | SERVICE is the D-Bus service name of the D-Bus. It must be a |
| 879 | known name. | 880 | known name. |
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 2a198215536..712af6fd288 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el | |||
| @@ -1152,7 +1152,8 @@ For the format of LINE-ERR-INFO, see `flymake-ler-make-ler'." | |||
| 1152 | (when dir | 1152 | (when dir |
| 1153 | (let ((default-directory dir)) | 1153 | (let ((default-directory dir)) |
| 1154 | (flymake-log 3 "starting process on dir %s" default-directory))) | 1154 | (flymake-log 3 "starting process on dir %s" default-directory))) |
| 1155 | (setq process (apply 'start-process "flymake-proc" (current-buffer) cmd args)) | 1155 | (setq process (apply 'start-file-process |
| 1156 | "flymake-proc" (current-buffer) cmd args)) | ||
| 1156 | (set-process-sentinel process 'flymake-process-sentinel) | 1157 | (set-process-sentinel process 'flymake-process-sentinel) |
| 1157 | (set-process-filter process 'flymake-process-filter) | 1158 | (set-process-filter process 'flymake-process-filter) |
| 1158 | (push process flymake-processes) | 1159 | (push process flymake-processes) |
diff --git a/lisp/progmodes/make-mode.el b/lisp/progmodes/make-mode.el index 15664c8e56d..362a1db6c10 100644 --- a/lisp/progmodes/make-mode.el +++ b/lisp/progmodes/make-mode.el | |||
| @@ -1300,7 +1300,9 @@ definition and conveniently use this command." | |||
| 1300 | (save-restriction | 1300 | (save-restriction |
| 1301 | (narrow-to-region beginning end) | 1301 | (narrow-to-region beginning end) |
| 1302 | (makefile-backslash-region (point-min) (point-max) t) | 1302 | (makefile-backslash-region (point-min) (point-max) t) |
| 1303 | (let ((fill-paragraph-function nil)) | 1303 | (let ((fill-paragraph-function nil) |
| 1304 | ;; Adjust fill-column to allow space for the backslash. | ||
| 1305 | (fill-column (- fill-column 1))) | ||
| 1304 | (fill-paragraph nil)) | 1306 | (fill-paragraph nil)) |
| 1305 | (makefile-backslash-region (point-min) (point-max) nil) | 1307 | (makefile-backslash-region (point-min) (point-max) nil) |
| 1306 | (goto-char (point-max)) | 1308 | (goto-char (point-max)) |
| @@ -1314,7 +1316,9 @@ definition and conveniently use this command." | |||
| 1314 | ;; resulting region. | 1316 | ;; resulting region. |
| 1315 | (save-restriction | 1317 | (save-restriction |
| 1316 | (narrow-to-region (point) (line-beginning-position 2)) | 1318 | (narrow-to-region (point) (line-beginning-position 2)) |
| 1317 | (let ((fill-paragraph-function nil)) | 1319 | (let ((fill-paragraph-function nil) |
| 1320 | ;; Adjust fill-column to allow space for the backslash. | ||
| 1321 | (fill-column (- fill-column 1))) | ||
| 1318 | (fill-paragraph nil)) | 1322 | (fill-paragraph nil)) |
| 1319 | (makefile-backslash-region (point-min) (point-max) nil)) | 1323 | (makefile-backslash-region (point-min) (point-max) nil)) |
| 1320 | ;; Return non-nil to indicate it's been filled. | 1324 | ;; Return non-nil to indicate it's been filled. |
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 2b09e346331..849951a633a 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -579,6 +579,33 @@ having to restart the program." | |||
| 579 | "Queue of Python temp files awaiting execution. | 579 | "Queue of Python temp files awaiting execution. |
| 580 | Currently-active file is at the head of the list.") | 580 | Currently-active file is at the head of the list.") |
| 581 | 581 | ||
| 582 | (defcustom python-shell-prompt-alist | ||
| 583 | '(("ipython" . "^In \\[[0-9]+\\]: *") | ||
| 584 | (t . "^>>> ")) | ||
| 585 | "Alist of Python input prompts. | ||
| 586 | Each element has the form (PROGRAM . REGEXP), where PROGRAM is | ||
| 587 | the value of `python-python-command' for the python process and | ||
| 588 | REGEXP is a regular expression matching the Python prompt. | ||
| 589 | PROGRAM can also be t, which specifies the default when no other | ||
| 590 | element matches `python-python-command'." | ||
| 591 | :type 'string | ||
| 592 | :group 'python | ||
| 593 | :version "24.1") | ||
| 594 | |||
| 595 | (defcustom python-shell-continuation-prompt-alist | ||
| 596 | '(("ipython" . "^ [.][.][.]+: *") | ||
| 597 | (t . "^[.][.][.] ")) | ||
| 598 | "Alist of Python continued-line prompts. | ||
| 599 | Each element has the form (PROGRAM . REGEXP), where PROGRAM is | ||
| 600 | the value of `python-python-command' for the python process and | ||
| 601 | REGEXP is a regular expression matching the Python prompt for | ||
| 602 | continued lines. | ||
| 603 | PROGRAM can also be t, which specifies the default when no other | ||
| 604 | element matches `python-python-command'." | ||
| 605 | :type 'string | ||
| 606 | :group 'python | ||
| 607 | :version "24.1") | ||
| 608 | |||
| 582 | (defvar python-pdbtrack-is-tracking-p nil) | 609 | (defvar python-pdbtrack-is-tracking-p nil) |
| 583 | 610 | ||
| 584 | (defconst python-pdbtrack-stack-entry-regexp | 611 | (defconst python-pdbtrack-stack-entry-regexp |
| @@ -1311,13 +1338,9 @@ See `python-check-command' for the default." | |||
| 1311 | 1338 | ||
| 1312 | ;;;; Inferior mode stuff (following cmuscheme). | 1339 | ;;;; Inferior mode stuff (following cmuscheme). |
| 1313 | 1340 | ||
| 1314 | ;; Fixme: Make sure we can work with IPython. | ||
| 1315 | |||
| 1316 | (defcustom python-python-command "python" | 1341 | (defcustom python-python-command "python" |
| 1317 | "Shell command to run Python interpreter. | 1342 | "Shell command to run Python interpreter. |
| 1318 | Any arguments can't contain whitespace. | 1343 | Any arguments can't contain whitespace." |
| 1319 | Note that IPython may not work properly; it must at least be used | ||
| 1320 | with the `-cl' flag, i.e. use `ipython -cl'." | ||
| 1321 | :group 'python | 1344 | :group 'python |
| 1322 | :type 'string) | 1345 | :type 'string) |
| 1323 | 1346 | ||
| @@ -1395,6 +1418,23 @@ local value.") | |||
| 1395 | ;; Autoloaded. | 1418 | ;; Autoloaded. |
| 1396 | (declare-function compilation-shell-minor-mode "compile" (&optional arg)) | 1419 | (declare-function compilation-shell-minor-mode "compile" (&optional arg)) |
| 1397 | 1420 | ||
| 1421 | (defvar python--prompt-regexp nil) | ||
| 1422 | |||
| 1423 | (defun python--set-prompt-regexp () | ||
| 1424 | (let ((prompt (cdr-safe (or (assoc python-python-command | ||
| 1425 | python-shell-prompt-alist) | ||
| 1426 | (assq t python-shell-prompt-alist)))) | ||
| 1427 | (cprompt (cdr-safe (or (assoc python-python-command | ||
| 1428 | python-shell-continuation-prompt-alist) | ||
| 1429 | (assq t python-shell-continuation-prompt-alist))))) | ||
| 1430 | (set (make-local-variable 'comint-prompt-regexp) | ||
| 1431 | (concat "\\(" | ||
| 1432 | (mapconcat 'identity | ||
| 1433 | (delq nil (list prompt cprompt "^([Pp]db) ")) | ||
| 1434 | "\\|") | ||
| 1435 | "\\)")) | ||
| 1436 | (set (make-local-variable 'python--prompt-regexp) prompt))) | ||
| 1437 | |||
| 1398 | ;; Fixme: This should inherit some stuff from `python-mode', but I'm | 1438 | ;; Fixme: This should inherit some stuff from `python-mode', but I'm |
| 1399 | ;; not sure how much: at least some keybindings, like C-c C-f; | 1439 | ;; not sure how much: at least some keybindings, like C-c C-f; |
| 1400 | ;; syntax?; font-locking, e.g. for triple-quoted strings? | 1440 | ;; syntax?; font-locking, e.g. for triple-quoted strings? |
| @@ -1417,14 +1457,12 @@ For running multiple processes in multiple buffers, see `run-python' and | |||
| 1417 | 1457 | ||
| 1418 | \\{inferior-python-mode-map}" | 1458 | \\{inferior-python-mode-map}" |
| 1419 | :group 'python | 1459 | :group 'python |
| 1460 | (require 'ansi-color) ; for ipython | ||
| 1420 | (setq mode-line-process '(":%s")) | 1461 | (setq mode-line-process '(":%s")) |
| 1421 | (set (make-local-variable 'comint-input-filter) 'python-input-filter) | 1462 | (set (make-local-variable 'comint-input-filter) 'python-input-filter) |
| 1422 | (add-hook 'comint-preoutput-filter-functions #'python-preoutput-filter | 1463 | (add-hook 'comint-preoutput-filter-functions #'python-preoutput-filter |
| 1423 | nil t) | 1464 | nil t) |
| 1424 | ;; Still required by `comint-redirect-send-command', for instance | 1465 | (python--set-prompt-regexp) |
| 1425 | ;; (and we need to match things like `>>> ... >>> '): | ||
| 1426 | (set (make-local-variable 'comint-prompt-regexp) | ||
| 1427 | (rx line-start (1+ (and (or (repeat 3 (any ">.")) "(Pdb)") " ")))) | ||
| 1428 | (set (make-local-variable 'compilation-error-regexp-alist) | 1466 | (set (make-local-variable 'compilation-error-regexp-alist) |
| 1429 | python-compilation-regexp-alist) | 1467 | python-compilation-regexp-alist) |
| 1430 | (compilation-shell-minor-mode 1)) | 1468 | (compilation-shell-minor-mode 1)) |
| @@ -1521,12 +1559,12 @@ Don't save anything for STR matching `inferior-python-filter-regexp'." | |||
| 1521 | cmd))) | 1559 | cmd))) |
| 1522 | (unless (shell-command-to-string cmd) | 1560 | (unless (shell-command-to-string cmd) |
| 1523 | (error "Can't run Python command `%s'" cmd)) | 1561 | (error "Can't run Python command `%s'" cmd)) |
| 1524 | (let* ((res (shell-command-to-string (concat cmd " --version")))) | 1562 | (let* ((res (shell-command-to-string |
| 1525 | (string-match "Python \\([0-9]\\)\\.\\([0-9]\\)" res) | 1563 | (concat cmd |
| 1526 | (unless (and (equal "2" (match-string 1 res)) | 1564 | " -c \"from sys import version_info;\ |
| 1527 | (match-beginning 2) | 1565 | print version_info >= (2, 2) and version_info < (3, 0)\"")))) |
| 1528 | (>= (string-to-number (match-string 2 res)) 2)) | 1566 | (unless (string-match "True" res) |
| 1529 | (error "Only Python versions >= 2.2 and < 3.0 supported"))) | 1567 | (error "Only Python versions >= 2.2 and < 3.0 are supported"))) |
| 1530 | (setq python-version-checked t))) | 1568 | (setq python-version-checked t))) |
| 1531 | 1569 | ||
| 1532 | ;;;###autoload | 1570 | ;;;###autoload |
| @@ -1549,6 +1587,7 @@ buffer for a list of commands.)" | |||
| 1549 | (interactive (if current-prefix-arg | 1587 | (interactive (if current-prefix-arg |
| 1550 | (list (read-string "Run Python: " python-command) nil t) | 1588 | (list (read-string "Run Python: " python-command) nil t) |
| 1551 | (list python-command))) | 1589 | (list python-command))) |
| 1590 | (require 'ansi-color) ; for ipython | ||
| 1552 | (unless cmd (setq cmd python-command)) | 1591 | (unless cmd (setq cmd python-command)) |
| 1553 | (python-check-version cmd) | 1592 | (python-check-version cmd) |
| 1554 | (setq python-command cmd) | 1593 | (setq python-command cmd) |
| @@ -1566,8 +1605,10 @@ buffer for a list of commands.)" | |||
| 1566 | (if path (concat path path-separator)) | 1605 | (if path (concat path path-separator)) |
| 1567 | data-directory) | 1606 | data-directory) |
| 1568 | process-environment)) | 1607 | process-environment)) |
| 1569 | ;; Suppress use of pager for help output: | 1608 | ;; If we use a pipe, unicode characters are not printed |
| 1570 | (process-connection-type nil)) | 1609 | ;; correctly (Bug#5794) and IPython does not work at |
| 1610 | ;; all (Bug#5390). | ||
| 1611 | (process-connection-type t)) | ||
| 1571 | (apply 'make-comint-in-buffer "Python" | 1612 | (apply 'make-comint-in-buffer "Python" |
| 1572 | (generate-new-buffer "*Python*") | 1613 | (generate-new-buffer "*Python*") |
| 1573 | (car cmdlist) nil (cdr cmdlist))) | 1614 | (car cmdlist) nil (cdr cmdlist))) |
| @@ -1623,7 +1664,12 @@ buffer for a list of commands.)" | |||
| 1623 | ;; non-ASCII. | 1664 | ;; non-ASCII. |
| 1624 | (interactive "r") | 1665 | (interactive "r") |
| 1625 | (let* ((f (make-temp-file "py")) | 1666 | (let* ((f (make-temp-file "py")) |
| 1626 | (command (format "emacs.eexecfile(%S)" f)) | 1667 | (command |
| 1668 | ;; IPython puts the FakeModule module into __main__ so | ||
| 1669 | ;; emacs.eexecfile becomes useless. | ||
| 1670 | (if (string-match "^ipython" python-command) | ||
| 1671 | (format "execfile %S" f) | ||
| 1672 | (format "emacs.eexecfile(%S)" f))) | ||
| 1627 | (orig-start (copy-marker start))) | 1673 | (orig-start (copy-marker start))) |
| 1628 | (when (save-excursion | 1674 | (when (save-excursion |
| 1629 | (goto-char start) | 1675 | (goto-char start) |
| @@ -1823,7 +1869,9 @@ If there isn't, it's probably not appropriate to send input to return Eldoc | |||
| 1823 | information etc. If PROC is non-nil, check the buffer for that process." | 1869 | information etc. If PROC is non-nil, check the buffer for that process." |
| 1824 | (with-current-buffer (process-buffer (or proc (python-proc))) | 1870 | (with-current-buffer (process-buffer (or proc (python-proc))) |
| 1825 | (save-excursion | 1871 | (save-excursion |
| 1826 | (save-match-data (re-search-backward ">>> \\=" nil t))))) | 1872 | (save-match-data |
| 1873 | (re-search-backward (concat python--prompt-regexp " *\\=") | ||
| 1874 | nil t))))) | ||
| 1827 | 1875 | ||
| 1828 | ;; Fixme: Is there anything reasonable we can do with random methods? | 1876 | ;; Fixme: Is there anything reasonable we can do with random methods? |
| 1829 | ;; (Currently only works with functions.) | 1877 | ;; (Currently only works with functions.) |
| @@ -2539,9 +2587,7 @@ Runs `jython-mode-hook' after `python-mode-hook'." | |||
| 2539 | "Watch output for Python prompt and exec next file waiting in queue. | 2587 | "Watch output for Python prompt and exec next file waiting in queue. |
| 2540 | This function is appropriate for `comint-output-filter-functions'." | 2588 | This function is appropriate for `comint-output-filter-functions'." |
| 2541 | ;; TBD: this should probably use split-string | 2589 | ;; TBD: this should probably use split-string |
| 2542 | (when (and (or (string-equal string ">>> ") | 2590 | (when (and (string-match python--prompt-regexp string) |
| 2543 | (and (>= (length string) 5) | ||
| 2544 | (string-equal (substring string -5) "\n>>> "))) | ||
| 2545 | python-file-queue) | 2591 | python-file-queue) |
| 2546 | (condition-case nil | 2592 | (condition-case nil |
| 2547 | (delete-file (car python-file-queue)) | 2593 | (delete-file (car python-file-queue)) |
| @@ -2753,6 +2799,7 @@ comint believe the user typed this string so that | |||
| 2753 | (funcall (process-filter proc) proc msg)) | 2799 | (funcall (process-filter proc) proc msg)) |
| 2754 | (set-buffer curbuf)) | 2800 | (set-buffer curbuf)) |
| 2755 | (process-send-string proc cmd))) | 2801 | (process-send-string proc cmd))) |
| 2802 | |||
| 2756 | ;;;###autoload | 2803 | ;;;###autoload |
| 2757 | (defun python-shell (&optional argprompt) | 2804 | (defun python-shell (&optional argprompt) |
| 2758 | "Start an interactive Python interpreter in another window. | 2805 | "Start an interactive Python interpreter in another window. |
| @@ -2792,6 +2839,7 @@ interaction between undo and process filters; the same problem exists in | |||
| 2792 | non-Python process buffers using the default (Emacs-supplied) process | 2839 | non-Python process buffers using the default (Emacs-supplied) process |
| 2793 | filter." | 2840 | filter." |
| 2794 | (interactive "P") | 2841 | (interactive "P") |
| 2842 | (require 'ansi-color) ; For ipython | ||
| 2795 | ;; Set the default shell if not already set | 2843 | ;; Set the default shell if not already set |
| 2796 | (when (null python-which-shell) | 2844 | (when (null python-which-shell) |
| 2797 | (python-toggle-shells python-default-interpreter)) | 2845 | (python-toggle-shells python-default-interpreter)) |
| @@ -2808,10 +2856,9 @@ filter." | |||
| 2808 | )))) | 2856 | )))) |
| 2809 | (switch-to-buffer-other-window | 2857 | (switch-to-buffer-other-window |
| 2810 | (apply 'make-comint python-which-bufname python-which-shell nil args)) | 2858 | (apply 'make-comint python-which-bufname python-which-shell nil args)) |
| 2811 | (make-local-variable 'comint-prompt-regexp) | ||
| 2812 | (set-process-sentinel (get-buffer-process (current-buffer)) | 2859 | (set-process-sentinel (get-buffer-process (current-buffer)) |
| 2813 | 'python-sentinel) | 2860 | 'python-sentinel) |
| 2814 | (setq comint-prompt-regexp "^>>> \\|^[.][.][.] \\|^(pdb) ") | 2861 | (python--set-prompt-regexp) |
| 2815 | (add-hook 'comint-output-filter-functions | 2862 | (add-hook 'comint-output-filter-functions |
| 2816 | 'python-comint-output-filter-function nil t) | 2863 | 'python-comint-output-filter-function nil t) |
| 2817 | ;; pdbtrack | 2864 | ;; pdbtrack |
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index a75c5b01bb8..0b92234bf1c 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el | |||
| @@ -43,6 +43,11 @@ | |||
| 43 | 43 | ||
| 44 | (eval-when-compile (require 'cl)) | 44 | (eval-when-compile (require 'cl)) |
| 45 | 45 | ||
| 46 | (defgroup ruby nil | ||
| 47 | "Major mode for editing Ruby code." | ||
| 48 | :prefix "ruby-" | ||
| 49 | :group 'languages) | ||
| 50 | |||
| 46 | (defconst ruby-keyword-end-re | 51 | (defconst ruby-keyword-end-re |
| 47 | (if (string-match "\\_>" "ruby") | 52 | (if (string-match "\\_>" "ruby") |
| 48 | "\\_>" | 53 | "\\_>" |
diff --git a/lisp/simple.el b/lisp/simple.el index 7c941fd63b9..c1ec78da7b9 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -1301,6 +1301,40 @@ to get different commands to edit and resubmit." | |||
| 1301 | (if command-history | 1301 | (if command-history |
| 1302 | (error "Argument %d is beyond length of command history" arg) | 1302 | (error "Argument %d is beyond length of command history" arg) |
| 1303 | (error "There are no previous complex commands to repeat"))))) | 1303 | (error "There are no previous complex commands to repeat"))))) |
| 1304 | |||
| 1305 | (defun read-extended-command () | ||
| 1306 | "Read command name to invoke in `execute-extended-command'." | ||
| 1307 | (minibuffer-with-setup-hook | ||
| 1308 | (lambda () | ||
| 1309 | (set (make-local-variable 'minibuffer-default-add-function) | ||
| 1310 | (lambda () | ||
| 1311 | ;; Get a command name at point in the original buffer | ||
| 1312 | ;; to propose it after M-n. | ||
| 1313 | (with-current-buffer (window-buffer (minibuffer-selected-window)) | ||
| 1314 | (and (commandp (function-called-at-point)) | ||
| 1315 | (format "%S" (function-called-at-point))))))) | ||
| 1316 | ;; Read a string, completing from and restricting to the set of | ||
| 1317 | ;; all defined commands. Don't provide any initial input. | ||
| 1318 | ;; Save the command read on the extended-command history list. | ||
| 1319 | (completing-read | ||
| 1320 | (concat (cond | ||
| 1321 | ((eq current-prefix-arg '-) "- ") | ||
| 1322 | ((and (consp current-prefix-arg) | ||
| 1323 | (eq (car current-prefix-arg) 4)) "C-u ") | ||
| 1324 | ((and (consp current-prefix-arg) | ||
| 1325 | (integerp (car current-prefix-arg))) | ||
| 1326 | (format "%d " (car current-prefix-arg))) | ||
| 1327 | ((integerp current-prefix-arg) | ||
| 1328 | (format "%d " current-prefix-arg))) | ||
| 1329 | ;; This isn't strictly correct if `execute-extended-command' | ||
| 1330 | ;; is bound to anything else (e.g. [menu]). | ||
| 1331 | ;; It could use (key-description (this-single-command-keys)), | ||
| 1332 | ;; but actually a prompt other than "M-x" would be confusing, | ||
| 1333 | ;; because "M-x" is a well-known prompt to read a command | ||
| 1334 | ;; and it serves as a shorthand for "Extended command: ". | ||
| 1335 | "M-x ") | ||
| 1336 | obarray 'commandp t nil 'extended-command-history))) | ||
| 1337 | |||
| 1304 | 1338 | ||
| 1305 | (defvar minibuffer-history nil | 1339 | (defvar minibuffer-history nil |
| 1306 | "Default minibuffer history list. | 1340 | "Default minibuffer history list. |
| @@ -3103,7 +3137,8 @@ If the buffer is read-only, Emacs will beep and refrain from deleting | |||
| 3103 | the text, but put the text in the kill ring anyway. This means that | 3137 | the text, but put the text in the kill ring anyway. This means that |
| 3104 | you can use the killing commands to copy text from a read-only buffer. | 3138 | you can use the killing commands to copy text from a read-only buffer. |
| 3105 | 3139 | ||
| 3106 | This is the primitive for programs to kill text (as opposed to deleting it). | 3140 | Lisp programs should use this function for killing text. |
| 3141 | (To delete text, use `delete-region'.) | ||
| 3107 | Supply two arguments, character positions indicating the stretch of text | 3142 | Supply two arguments, character positions indicating the stretch of text |
| 3108 | to be killed. | 3143 | to be killed. |
| 3109 | Any command that calls this function is a \"kill command\". | 3144 | Any command that calls this function is a \"kill command\". |
| @@ -5495,7 +5530,9 @@ it skips the contents of comments that end before point." | |||
| 5495 | (and parse-sexp-ignore-comments | 5530 | (and parse-sexp-ignore-comments |
| 5496 | (not blink-matching-paren-dont-ignore-comments)))) | 5531 | (not blink-matching-paren-dont-ignore-comments)))) |
| 5497 | (condition-case () | 5532 | (condition-case () |
| 5498 | (scan-sexps oldpos -1) | 5533 | (progn |
| 5534 | (forward-sexp -1) | ||
| 5535 | (point)) | ||
| 5499 | (error nil)))))) | 5536 | (error nil)))))) |
| 5500 | (matching-paren | 5537 | (matching-paren |
| 5501 | (and blinkpos | 5538 | (and blinkpos |
diff --git a/lisp/startup.el b/lisp/startup.el index 76e11491c0c..72169799acf 100644 --- a/lisp/startup.el +++ b/lisp/startup.el | |||
| @@ -785,15 +785,16 @@ opening the first frame (e.g. open a connection to an X server).") | |||
| 785 | argi (match-string 1 argi))) | 785 | argi (match-string 1 argi))) |
| 786 | (when (string-match "\\`--." orig-argi) | 786 | (when (string-match "\\`--." orig-argi) |
| 787 | (let ((completion (try-completion argi longopts))) | 787 | (let ((completion (try-completion argi longopts))) |
| 788 | (if (eq completion t) | 788 | (cond ((eq completion t) |
| 789 | (setq argi (substring argi 1)) | 789 | (setq argi (substring argi 1))) |
| 790 | (if (stringp completion) | 790 | ((stringp completion) |
| 791 | (let ((elt (assoc completion longopts))) | 791 | (let ((elt (assoc completion longopts))) |
| 792 | (or elt | 792 | (unless elt |
| 793 | (error "Option `%s' is ambiguous" argi)) | 793 | (error "Option `%s' is ambiguous" argi)) |
| 794 | (setq argi (substring (car elt) 1))) | 794 | (setq argi (substring (car elt) 1)))) |
| 795 | (setq argval nil | 795 | (t |
| 796 | argi orig-argi))))) | 796 | (setq argval nil |
| 797 | argi orig-argi))))) | ||
| 797 | (cond | 798 | (cond |
| 798 | ;; The --display arg is handled partly in C, partly in Lisp. | 799 | ;; The --display arg is handled partly in C, partly in Lisp. |
| 799 | ;; When it shows up here, we just put it back to be handled | 800 | ;; When it shows up here, we just put it back to be handled |
| @@ -2231,6 +2232,11 @@ A fancy display is used on graphic displays, normal otherwise." | |||
| 2231 | (move-to-column (1- cl1-column))) | 2232 | (move-to-column (1- cl1-column))) |
| 2232 | (setq cl1-column 0)) | 2233 | (setq cl1-column 0)) |
| 2233 | 2234 | ||
| 2235 | ;; These command lines now have no effect. | ||
| 2236 | ((string-match "\\`--?\\(no-\\)?\\(uni\\|multi\\)byte$" argi) | ||
| 2237 | (display-warning 'initialization | ||
| 2238 | (format "Ignoring obsolete arg %s" argi))) | ||
| 2239 | |||
| 2234 | ((equal argi "--") | 2240 | ((equal argi "--") |
| 2235 | (setq just-files t)) | 2241 | (setq just-files t)) |
| 2236 | (t | 2242 | (t |
diff --git a/lisp/subr.el b/lisp/subr.el index 9fb737fd038..90480ea0e7f 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -219,6 +219,7 @@ Treated as a declaration when used at the right place in a | |||
| 219 | (defmacro ignore-errors (&rest body) | 219 | (defmacro ignore-errors (&rest body) |
| 220 | "Execute BODY; if an error occurs, return nil. | 220 | "Execute BODY; if an error occurs, return nil. |
| 221 | Otherwise, return result of last form in BODY." | 221 | Otherwise, return result of last form in BODY." |
| 222 | (declare (debug t) (indent 0)) | ||
| 222 | `(condition-case nil (progn ,@body) (error nil))) | 223 | `(condition-case nil (progn ,@body) (error nil))) |
| 223 | 224 | ||
| 224 | ;;;; Basic Lisp functions. | 225 | ;;;; Basic Lisp functions. |
| @@ -1818,6 +1819,7 @@ When there's an ambiguity because the key looks like the prefix of | |||
| 1818 | some sort of escape sequence, the ambiguity is resolved via `read-key-delay'." | 1819 | some sort of escape sequence, the ambiguity is resolved via `read-key-delay'." |
| 1819 | (let ((overriding-terminal-local-map read-key-empty-map) | 1820 | (let ((overriding-terminal-local-map read-key-empty-map) |
| 1820 | (overriding-local-map nil) | 1821 | (overriding-local-map nil) |
| 1822 | (echo-keystrokes 0) | ||
| 1821 | (old-global-map (current-global-map)) | 1823 | (old-global-map (current-global-map)) |
| 1822 | (timer (run-with-idle-timer | 1824 | (timer (run-with-idle-timer |
| 1823 | ;; Wait long enough that Emacs has the time to receive and | 1825 | ;; Wait long enough that Emacs has the time to receive and |
| @@ -1842,7 +1844,12 @@ some sort of escape sequence, the ambiguity is resolved via `read-key-delay'." | |||
| 1842 | (throw 'read-key keys))))))) | 1844 | (throw 'read-key keys))))))) |
| 1843 | (unwind-protect | 1845 | (unwind-protect |
| 1844 | (progn | 1846 | (progn |
| 1845 | (use-global-map read-key-empty-map) | 1847 | (use-global-map |
| 1848 | (let ((map (make-sparse-keymap))) | ||
| 1849 | ;; Don't hide the menu-bar and tool-bar entries. | ||
| 1850 | (define-key map [menu-bar] (lookup-key global-map [menu-bar])) | ||
| 1851 | (define-key map [tool-bar] (lookup-key global-map [tool-bar])) | ||
| 1852 | map)) | ||
| 1846 | (aref (catch 'read-key (read-key-sequence-vector prompt nil t)) 0)) | 1853 | (aref (catch 'read-key (read-key-sequence-vector prompt nil t)) 0)) |
| 1847 | (cancel-timer timer) | 1854 | (cancel-timer timer) |
| 1848 | (use-global-map old-global-map)))) | 1855 | (use-global-map old-global-map)))) |
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el index e8a92b101ef..8a73a0f818e 100644 --- a/lisp/textmodes/flyspell.el +++ b/lisp/textmodes/flyspell.el | |||
| @@ -199,9 +199,9 @@ Ispell's ultimate default dictionary." | |||
| 199 | 199 | ||
| 200 | (defcustom flyspell-check-tex-math-command nil | 200 | (defcustom flyspell-check-tex-math-command nil |
| 201 | "Non-nil means check even inside TeX math environment. | 201 | "Non-nil means check even inside TeX math environment. |
| 202 | TeX math environments are discovered by the TEXMATHP that implemented | 202 | TeX math environments are discovered by `texmathp', implemented |
| 203 | inside the texmathp.el Emacs package. That package may be found at: | 203 | inside AUCTeX package. That package may be found at |
| 204 | http://strw.leidenuniv.nl/~dominik/Tools" | 204 | URL `http://www.gnu.org/software/auctex/'" |
| 205 | :group 'flyspell | 205 | :group 'flyspell |
| 206 | :type 'boolean) | 206 | :type 'boolean) |
| 207 | 207 | ||
diff --git a/lisp/vc/add-log.el b/lisp/vc/add-log.el index cf391b2f9ac..23f1e33f181 100644 --- a/lisp/vc/add-log.el +++ b/lisp/vc/add-log.el | |||
| @@ -755,7 +755,17 @@ Optional arg BUFFER-FILE overrides `buffer-file-name'." | |||
| 755 | (if add-log-file-name-function | 755 | (if add-log-file-name-function |
| 756 | (funcall add-log-file-name-function buffer-file) | 756 | (funcall add-log-file-name-function buffer-file) |
| 757 | (setq buffer-file | 757 | (setq buffer-file |
| 758 | (file-relative-name buffer-file (file-name-directory log-file))) | 758 | (let* ((dir (file-name-directory log-file)) |
| 759 | (rel (file-relative-name buffer-file dir))) | ||
| 760 | ;; Sometimes with symlinks, the two buffers may have names that | ||
| 761 | ;; appear to belong to different directory trees. So check the | ||
| 762 | ;; file-truenames, to see if we get a better result. | ||
| 763 | (if (not (string-match "\\`\\.\\./" rel)) | ||
| 764 | rel | ||
| 765 | (let ((new (file-relative-name (file-truename buffer-file) | ||
| 766 | (file-truename dir)))) | ||
| 767 | (if (< (length new) (length rel)) | ||
| 768 | new rel))))) | ||
| 759 | ;; If we have a backup file, it's presumably because we're | 769 | ;; If we have a backup file, it's presumably because we're |
| 760 | ;; comparing old and new versions (e.g. for deleted | 770 | ;; comparing old and new versions (e.g. for deleted |
| 761 | ;; functions) and we'll want to use the original name. | 771 | ;; functions) and we'll want to use the original name. |
diff --git a/lisp/whitespace.el b/lisp/whitespace.el index 79ce9a330d4..0ef41b5a002 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | ;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> | 6 | ;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> |
| 7 | ;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br> | 7 | ;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br> |
| 8 | ;; Keywords: data, wp | 8 | ;; Keywords: data, wp |
| 9 | ;; Version: 12.1 | 9 | ;; Version: 13.1 |
| 10 | ;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre | 10 | ;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre |
| 11 | 11 | ||
| 12 | ;; This file is part of GNU Emacs. | 12 | ;; This file is part of GNU Emacs. |
| @@ -382,19 +382,28 @@ | |||
| 382 | 382 | ||
| 383 | 383 | ||
| 384 | (defcustom whitespace-style | 384 | (defcustom whitespace-style |
| 385 | '(tabs spaces trailing lines space-before-tab newline | 385 | '(face |
| 386 | indentation empty space-after-tab | 386 | tabs spaces trailing lines space-before-tab newline |
| 387 | space-mark tab-mark newline-mark) | 387 | indentation empty space-after-tab |
| 388 | space-mark tab-mark newline-mark) | ||
| 388 | "Specify which kind of blank is visualized. | 389 | "Specify which kind of blank is visualized. |
| 389 | 390 | ||
| 390 | It's a list containing some or all of the following values: | 391 | It's a list containing some or all of the following values: |
| 391 | 392 | ||
| 393 | face enable all visualization via faces (see below). | ||
| 394 | |||
| 392 | trailing trailing blanks are visualized via faces. | 395 | trailing trailing blanks are visualized via faces. |
| 396 | It has effect only if `face' (see above) | ||
| 397 | is present in `whitespace-style'. | ||
| 393 | 398 | ||
| 394 | tabs TABs are visualized via faces. | 399 | tabs TABs are visualized via faces. |
| 400 | It has effect only if `face' (see above) | ||
| 401 | is present in `whitespace-style'. | ||
| 395 | 402 | ||
| 396 | spaces SPACEs and HARD SPACEs are visualized via | 403 | spaces SPACEs and HARD SPACEs are visualized via |
| 397 | faces. | 404 | faces. |
| 405 | It has effect only if `face' (see above) | ||
| 406 | is present in `whitespace-style'. | ||
| 398 | 407 | ||
| 399 | lines lines which have columns beyond | 408 | lines lines which have columns beyond |
| 400 | `whitespace-line-column' are highlighted via | 409 | `whitespace-line-column' are highlighted via |
| @@ -402,6 +411,8 @@ It's a list containing some or all of the following values: | |||
| 402 | Whole line is highlighted. | 411 | Whole line is highlighted. |
| 403 | It has precedence over `lines-tail' (see | 412 | It has precedence over `lines-tail' (see |
| 404 | below). | 413 | below). |
| 414 | It has effect only if `face' (see above) | ||
| 415 | is present in `whitespace-style'. | ||
| 405 | 416 | ||
| 406 | lines-tail lines which have columns beyond | 417 | lines-tail lines which have columns beyond |
| 407 | `whitespace-line-column' are highlighted via | 418 | `whitespace-line-column' are highlighted via |
| @@ -409,45 +420,69 @@ It's a list containing some or all of the following values: | |||
| 409 | But only the part of line which goes | 420 | But only the part of line which goes |
| 410 | beyond `whitespace-line-column' column. | 421 | beyond `whitespace-line-column' column. |
| 411 | It has effect only if `lines' (see above) | 422 | It has effect only if `lines' (see above) |
| 412 | is not present in `whitespace-style'. | 423 | is not present in `whitespace-style' |
| 424 | and if `face' (see above) is present in | ||
| 425 | `whitespace-style'. | ||
| 413 | 426 | ||
| 414 | newline NEWLINEs are visualized via faces. | 427 | newline NEWLINEs are visualized via faces. |
| 428 | It has effect only if `face' (see above) | ||
| 429 | is present in `whitespace-style'. | ||
| 415 | 430 | ||
| 416 | empty empty lines at beginning and/or end of buffer | 431 | empty empty lines at beginning and/or end of buffer |
| 417 | are visualized via faces. | 432 | are visualized via faces. |
| 433 | It has effect only if `face' (see above) | ||
| 434 | is present in `whitespace-style'. | ||
| 418 | 435 | ||
| 419 | indentation::tab 8 or more SPACEs at beginning of line are | 436 | indentation::tab 8 or more SPACEs at beginning of line are |
| 420 | visualized via faces. | 437 | visualized via faces. |
| 438 | It has effect only if `face' (see above) | ||
| 439 | is present in `whitespace-style'. | ||
| 421 | 440 | ||
| 422 | indentation::space TABs at beginning of line are visualized via | 441 | indentation::space TABs at beginning of line are visualized via |
| 423 | faces. | 442 | faces. |
| 443 | It has effect only if `face' (see above) | ||
| 444 | is present in `whitespace-style'. | ||
| 424 | 445 | ||
| 425 | indentation 8 or more SPACEs at beginning of line are | 446 | indentation 8 or more SPACEs at beginning of line are |
| 426 | visualized, if `indent-tabs-mode' (which see) | 447 | visualized, if `indent-tabs-mode' (which see) |
| 427 | is non-nil; otherwise, TABs at beginning of | 448 | is non-nil; otherwise, TABs at beginning of |
| 428 | line are visualized via faces. | 449 | line are visualized via faces. |
| 450 | It has effect only if `face' (see above) | ||
| 451 | is present in `whitespace-style'. | ||
| 429 | 452 | ||
| 430 | space-after-tab::tab 8 or more SPACEs after a TAB are | 453 | space-after-tab::tab 8 or more SPACEs after a TAB are |
| 431 | visualized via faces. | 454 | visualized via faces. |
| 455 | It has effect only if `face' (see above) | ||
| 456 | is present in `whitespace-style'. | ||
| 432 | 457 | ||
| 433 | space-after-tab::space TABs are visualized when 8 or more | 458 | space-after-tab::space TABs are visualized when 8 or more |
| 434 | SPACEs occur after a TAB, via faces. | 459 | SPACEs occur after a TAB, via faces. |
| 460 | It has effect only if `face' (see above) | ||
| 461 | is present in `whitespace-style'. | ||
| 435 | 462 | ||
| 436 | space-after-tab 8 or more SPACEs after a TAB are | 463 | space-after-tab 8 or more SPACEs after a TAB are |
| 437 | visualized, if `indent-tabs-mode' | 464 | visualized, if `indent-tabs-mode' |
| 438 | (which see) is non-nil; otherwise, | 465 | (which see) is non-nil; otherwise, |
| 439 | the TABs are visualized via faces. | 466 | the TABs are visualized via faces. |
| 467 | It has effect only if `face' (see above) | ||
| 468 | is present in `whitespace-style'. | ||
| 440 | 469 | ||
| 441 | space-before-tab::tab SPACEs before TAB are visualized via | 470 | space-before-tab::tab SPACEs before TAB are visualized via |
| 442 | faces. | 471 | faces. |
| 472 | It has effect only if `face' (see above) | ||
| 473 | is present in `whitespace-style'. | ||
| 443 | 474 | ||
| 444 | space-before-tab::space TABs are visualized when SPACEs occur | 475 | space-before-tab::space TABs are visualized when SPACEs occur |
| 445 | before TAB, via faces. | 476 | before TAB, via faces. |
| 477 | It has effect only if `face' (see above) | ||
| 478 | is present in `whitespace-style'. | ||
| 446 | 479 | ||
| 447 | space-before-tab SPACEs before TAB are visualized, if | 480 | space-before-tab SPACEs before TAB are visualized, if |
| 448 | `indent-tabs-mode' (which see) is | 481 | `indent-tabs-mode' (which see) is |
| 449 | non-nil; otherwise, the TABs are | 482 | non-nil; otherwise, the TABs are |
| 450 | visualized via faces. | 483 | visualized via faces. |
| 484 | It has effect only if `face' (see above) | ||
| 485 | is present in `whitespace-style'. | ||
| 451 | 486 | ||
| 452 | space-mark SPACEs and HARD SPACEs are visualized via | 487 | space-mark SPACEs and HARD SPACEs are visualized via |
| 453 | display table. | 488 | display table. |
| @@ -486,6 +521,11 @@ So, for example, if indentation and indentation::space are | |||
| 486 | included in `whitespace-style' list, the indentation value is | 521 | included in `whitespace-style' list, the indentation value is |
| 487 | evaluated instead of indentation::space value. | 522 | evaluated instead of indentation::space value. |
| 488 | 523 | ||
| 524 | One reason for not visualize spaces via faces (if `face' is not | ||
| 525 | included in `whitespace-style') is to use exclusively for | ||
| 526 | cleanning up a buffer. See `whitespace-cleanup' and | ||
| 527 | `whitespace-cleanup-region' for documentation. | ||
| 528 | |||
| 489 | See also `whitespace-display-mappings' for documentation." | 529 | See also `whitespace-display-mappings' for documentation." |
| 490 | :type '(repeat :tag "Kind of Blank" | 530 | :type '(repeat :tag "Kind of Blank" |
| 491 | (choice :tag "Kind of Blank Face" | 531 | (choice :tag "Kind of Blank Face" |
| @@ -521,9 +561,9 @@ Used when `whitespace-style' includes the value `spaces'." | |||
| 521 | 561 | ||
| 522 | (defface whitespace-space | 562 | (defface whitespace-space |
| 523 | '((((class color) (background dark)) | 563 | '((((class color) (background dark)) |
| 524 | (:background "grey20" :foreground "aquamarine3")) | 564 | (:background "grey20" :foreground "darkgray")) |
| 525 | (((class color) (background light)) | 565 | (((class color) (background light)) |
| 526 | (:background "LightYellow" :foreground "aquamarine3")) | 566 | (:background "LightYellow" :foreground "lightgray")) |
| 527 | (t (:inverse-video t))) | 567 | (t (:inverse-video t))) |
| 528 | "Face used to visualize SPACE." | 568 | "Face used to visualize SPACE." |
| 529 | :group 'whitespace) | 569 | :group 'whitespace) |
| @@ -539,9 +579,9 @@ Used when `whitespace-style' includes the value `spaces'." | |||
| 539 | 579 | ||
| 540 | (defface whitespace-hspace ; 'nobreak-space | 580 | (defface whitespace-hspace ; 'nobreak-space |
| 541 | '((((class color) (background dark)) | 581 | '((((class color) (background dark)) |
| 542 | (:background "grey24" :foreground "aquamarine3")) | 582 | (:background "grey24" :foreground "darkgray")) |
| 543 | (((class color) (background light)) | 583 | (((class color) (background light)) |
| 544 | (:background "LemonChiffon3" :foreground "aquamarine3")) | 584 | (:background "LemonChiffon3" :foreground "lightgray")) |
| 545 | (t (:inverse-video t))) | 585 | (t (:inverse-video t))) |
| 546 | "Face used to visualize HARD SPACE." | 586 | "Face used to visualize HARD SPACE." |
| 547 | :group 'whitespace) | 587 | :group 'whitespace) |
| @@ -557,9 +597,9 @@ Used when `whitespace-style' includes the value `tabs'." | |||
| 557 | 597 | ||
| 558 | (defface whitespace-tab | 598 | (defface whitespace-tab |
| 559 | '((((class color) (background dark)) | 599 | '((((class color) (background dark)) |
| 560 | (:background "grey22" :foreground "aquamarine3")) | 600 | (:background "grey22" :foreground "darkgray")) |
| 561 | (((class color) (background light)) | 601 | (((class color) (background light)) |
| 562 | (:background "beige" :foreground "aquamarine3")) | 602 | (:background "beige" :foreground "lightgray")) |
| 563 | (t (:inverse-video t))) | 603 | (t (:inverse-video t))) |
| 564 | "Face used to visualize TAB." | 604 | "Face used to visualize TAB." |
| 565 | :group 'whitespace) | 605 | :group 'whitespace) |
| @@ -812,7 +852,7 @@ Used when `whitespace-style' includes `indentation', | |||
| 812 | :group 'whitespace) | 852 | :group 'whitespace) |
| 813 | 853 | ||
| 814 | 854 | ||
| 815 | (defcustom whitespace-empty-at-bob-regexp "\\`\\(\\([ \t]*\n\\)+\\)" | 855 | (defcustom whitespace-empty-at-bob-regexp "^\\(\\([ \t]*\n\\)+\\)" |
| 816 | "Specify regexp for empty lines at beginning of buffer. | 856 | "Specify regexp for empty lines at beginning of buffer. |
| 817 | 857 | ||
| 818 | If you're using `mule' package, there may be other characters besides: | 858 | If you're using `mule' package, there may be other characters besides: |
| @@ -827,7 +867,7 @@ Used when `whitespace-style' includes `empty'." | |||
| 827 | :group 'whitespace) | 867 | :group 'whitespace) |
| 828 | 868 | ||
| 829 | 869 | ||
| 830 | (defcustom whitespace-empty-at-eob-regexp "^\\([ \t\n]+\\)\\'" | 870 | (defcustom whitespace-empty-at-eob-regexp "^\\([ \t\n]+\\)" |
| 831 | "Specify regexp for empty lines at end of buffer. | 871 | "Specify regexp for empty lines at end of buffer. |
| 832 | 872 | ||
| 833 | If you're using `mule' package, there may be other characters besides: | 873 | If you're using `mule' package, there may be other characters besides: |
| @@ -866,8 +906,13 @@ Used when `whitespace-style' includes `space-after-tab', | |||
| 866 | (defcustom whitespace-line-column 80 | 906 | (defcustom whitespace-line-column 80 |
| 867 | "Specify column beyond which the line is highlighted. | 907 | "Specify column beyond which the line is highlighted. |
| 868 | 908 | ||
| 909 | It must be an integer or nil. If nil, the `fill-column' variable value is | ||
| 910 | used. | ||
| 911 | |||
| 869 | Used when `whitespace-style' includes `lines' or `lines-tail'." | 912 | Used when `whitespace-style' includes `lines' or `lines-tail'." |
| 870 | :type '(integer :tag "Line Length") | 913 | :type '(choice :tag "Line Length Limit" |
| 914 | (integer :tag "Line Length") | ||
| 915 | (const :tag "Use fill-column" nil)) | ||
| 871 | :group 'whitespace) | 916 | :group 'whitespace) |
| 872 | 917 | ||
| 873 | 918 | ||
| @@ -1151,7 +1196,8 @@ See also `whitespace-newline' and `whitespace-display-mappings'." | |||
| 1151 | 1196 | ||
| 1152 | 1197 | ||
| 1153 | (defconst whitespace-style-value-list | 1198 | (defconst whitespace-style-value-list |
| 1154 | '(tabs | 1199 | '(face |
| 1200 | tabs | ||
| 1155 | spaces | 1201 | spaces |
| 1156 | trailing | 1202 | trailing |
| 1157 | lines | 1203 | lines |
| @@ -1176,7 +1222,8 @@ See also `whitespace-newline' and `whitespace-display-mappings'." | |||
| 1176 | 1222 | ||
| 1177 | 1223 | ||
| 1178 | (defconst whitespace-toggle-option-alist | 1224 | (defconst whitespace-toggle-option-alist |
| 1179 | '((?t . tabs) | 1225 | '((?f . face) |
| 1226 | (?t . tabs) | ||
| 1180 | (?s . spaces) | 1227 | (?s . spaces) |
| 1181 | (?r . trailing) | 1228 | (?r . trailing) |
| 1182 | (?l . lines) | 1229 | (?l . lines) |
| @@ -1228,6 +1275,19 @@ Used by `whitespace-trailing-regexp' function (which see).") | |||
| 1228 | "Used to save locally the font-lock refontify state. | 1275 | "Used to save locally the font-lock refontify state. |
| 1229 | Used by `whitespace-post-command-hook' function (which see).") | 1276 | Used by `whitespace-post-command-hook' function (which see).") |
| 1230 | 1277 | ||
| 1278 | (defvar whitespace-bob-marker nil | ||
| 1279 | "Used to save locally the bob marker value. | ||
| 1280 | Used by `whitespace-post-command-hook' function (which see).") | ||
| 1281 | |||
| 1282 | (defvar whitespace-eob-marker nil | ||
| 1283 | "Used to save locally the eob marker value. | ||
| 1284 | Used by `whitespace-post-command-hook' function (which see).") | ||
| 1285 | |||
| 1286 | (defvar whitespace-buffer-changed nil | ||
| 1287 | "Used to indicate locally if buffer changed. | ||
| 1288 | Used by `whitespace-post-command-hook' and `whitespace-buffer-changed' | ||
| 1289 | functions (which see).") | ||
| 1290 | |||
| 1231 | 1291 | ||
| 1232 | ;;;###autoload | 1292 | ;;;###autoload |
| 1233 | (defun whitespace-toggle-options (arg) | 1293 | (defun whitespace-toggle-options (arg) |
| @@ -1243,6 +1303,7 @@ Interactively, it reads one of the following chars: | |||
| 1243 | 1303 | ||
| 1244 | CHAR MEANING | 1304 | CHAR MEANING |
| 1245 | (VIA FACES) | 1305 | (VIA FACES) |
| 1306 | f toggle face visualization | ||
| 1246 | t toggle TAB visualization | 1307 | t toggle TAB visualization |
| 1247 | s toggle SPACE and HARD SPACE visualization | 1308 | s toggle SPACE and HARD SPACE visualization |
| 1248 | r toggle trailing blanks visualization | 1309 | r toggle trailing blanks visualization |
| @@ -1271,6 +1332,7 @@ Interactively, it reads one of the following chars: | |||
| 1271 | Non-interactively, ARG should be a symbol or a list of symbols. | 1332 | Non-interactively, ARG should be a symbol or a list of symbols. |
| 1272 | The valid symbols are: | 1333 | The valid symbols are: |
| 1273 | 1334 | ||
| 1335 | face toggle face visualization | ||
| 1274 | tabs toggle TAB visualization | 1336 | tabs toggle TAB visualization |
| 1275 | spaces toggle SPACE and HARD SPACE visualization | 1337 | spaces toggle SPACE and HARD SPACE visualization |
| 1276 | trailing toggle trailing blanks visualization | 1338 | trailing toggle trailing blanks visualization |
| @@ -1320,6 +1382,7 @@ Interactively, it accepts one of the following chars: | |||
| 1320 | 1382 | ||
| 1321 | CHAR MEANING | 1383 | CHAR MEANING |
| 1322 | (VIA FACES) | 1384 | (VIA FACES) |
| 1385 | f toggle face visualization | ||
| 1323 | t toggle TAB visualization | 1386 | t toggle TAB visualization |
| 1324 | s toggle SPACE and HARD SPACE visualization | 1387 | s toggle SPACE and HARD SPACE visualization |
| 1325 | r toggle trailing blanks visualization | 1388 | r toggle trailing blanks visualization |
| @@ -1348,6 +1411,7 @@ Interactively, it accepts one of the following chars: | |||
| 1348 | Non-interactively, ARG should be a symbol or a list of symbols. | 1411 | Non-interactively, ARG should be a symbol or a list of symbols. |
| 1349 | The valid symbols are: | 1412 | The valid symbols are: |
| 1350 | 1413 | ||
| 1414 | face toggle face visualization | ||
| 1351 | tabs toggle TAB visualization | 1415 | tabs toggle TAB visualization |
| 1352 | spaces toggle SPACE and HARD SPACE visualization | 1416 | spaces toggle SPACE and HARD SPACE visualization |
| 1353 | trailing toggle trailing blanks visualization | 1417 | trailing toggle trailing blanks visualization |
| @@ -1463,10 +1527,10 @@ documentation." | |||
| 1463 | (let (overwrite-mode) ; enforce no overwrite | 1527 | (let (overwrite-mode) ; enforce no overwrite |
| 1464 | (goto-char (point-min)) | 1528 | (goto-char (point-min)) |
| 1465 | (when (re-search-forward | 1529 | (when (re-search-forward |
| 1466 | whitespace-empty-at-bob-regexp nil t) | 1530 | (concat "\\`" whitespace-empty-at-bob-regexp) nil t) |
| 1467 | (delete-region (match-beginning 1) (match-end 1))) | 1531 | (delete-region (match-beginning 1) (match-end 1))) |
| 1468 | (when (re-search-forward | 1532 | (when (re-search-forward |
| 1469 | whitespace-empty-at-eob-regexp nil t) | 1533 | (concat whitespace-empty-at-eob-regexp "\\'") nil t) |
| 1470 | (delete-region (match-beginning 1) (match-end 1))))))) | 1534 | (delete-region (match-beginning 1) (match-end 1))))))) |
| 1471 | ;; PROBLEM 3: 8 or more SPACEs at bol | 1535 | ;; PROBLEM 3: 8 or more SPACEs at bol |
| 1472 | ;; PROBLEM 4: SPACEs before TAB | 1536 | ;; PROBLEM 4: SPACEs before TAB |
| @@ -1877,9 +1941,10 @@ cleaning up these problems." | |||
| 1877 | 1941 | ||
| 1878 | (defconst whitespace-help-text | 1942 | (defconst whitespace-help-text |
| 1879 | "\ | 1943 | "\ |
| 1880 | Whitespace Toggle Options | 1944 | Whitespace Toggle Options | scroll up : SPC or > | |
| 1881 | 1945 | | scroll down: M-SPC or < | | |
| 1882 | FACES | 1946 | FACES \\__________________________/ |
| 1947 | [] f - toggle face visualization | ||
| 1883 | [] t - toggle TAB visualization | 1948 | [] t - toggle TAB visualization |
| 1884 | [] s - toggle SPACE and HARD SPACE visualization | 1949 | [] s - toggle SPACE and HARD SPACE visualization |
| 1885 | [] r - toggle trailing blanks visualization | 1950 | [] r - toggle trailing blanks visualization |
| @@ -1953,15 +2018,13 @@ cleaning up these problems." | |||
| 1953 | "Display BUFFER in a new window." | 2018 | "Display BUFFER in a new window." |
| 1954 | (goto-char (point-min)) | 2019 | (goto-char (point-min)) |
| 1955 | (set-buffer-modified-p nil) | 2020 | (set-buffer-modified-p nil) |
| 1956 | (let ((size (- (window-height) | 2021 | (when (< (window-height) (* 2 window-min-height)) |
| 1957 | (max window-min-height | 2022 | (kill-buffer buffer) |
| 1958 | (1+ (count-lines (point-min) | 2023 | (error "Window height is too small; \ |
| 1959 | (point-max))))))) | ||
| 1960 | (when (<= size 0) | ||
| 1961 | (kill-buffer buffer) | ||
| 1962 | (error "Frame height is too small; \ | ||
| 1963 | can't split window to display whitespace toggle options")) | 2024 | can't split window to display whitespace toggle options")) |
| 1964 | (set-window-buffer (split-window nil size) buffer))) | 2025 | (let ((win (split-window))) |
| 2026 | (set-window-buffer win buffer) | ||
| 2027 | (shrink-window-if-larger-than-buffer win))) | ||
| 1965 | 2028 | ||
| 1966 | 2029 | ||
| 1967 | (defun whitespace-kill-buffer (buffer-name) | 2030 | (defun whitespace-kill-buffer (buffer-name) |
| @@ -1977,6 +2040,24 @@ can't split window to display whitespace toggle options")) | |||
| 1977 | (whitespace-kill-buffer whitespace-help-buffer-name)) | 2040 | (whitespace-kill-buffer whitespace-help-buffer-name)) |
| 1978 | 2041 | ||
| 1979 | 2042 | ||
| 2043 | (defun whitespace-help-scroll (&optional up) | ||
| 2044 | "Scroll help window, if it exists. | ||
| 2045 | |||
| 2046 | If UP is non-nil, scroll up; otherwise, scroll down." | ||
| 2047 | (condition-case data-help | ||
| 2048 | (let ((buffer (get-buffer whitespace-help-buffer-name))) | ||
| 2049 | (if buffer | ||
| 2050 | (with-selected-window (get-buffer-window buffer) | ||
| 2051 | (if up | ||
| 2052 | (scroll-up 3) | ||
| 2053 | (scroll-down 3))) | ||
| 2054 | (ding))) | ||
| 2055 | ;; handler | ||
| 2056 | ((error) | ||
| 2057 | ;; just ignore error | ||
| 2058 | ))) | ||
| 2059 | |||
| 2060 | |||
| 1980 | (defun whitespace-interactive-char (local-p) | 2061 | (defun whitespace-interactive-char (local-p) |
| 1981 | "Interactive function to read a char and return a symbol. | 2062 | "Interactive function to read a char and return a symbol. |
| 1982 | 2063 | ||
| @@ -1987,6 +2068,7 @@ It accepts one of the following chars: | |||
| 1987 | 2068 | ||
| 1988 | CHAR MEANING | 2069 | CHAR MEANING |
| 1989 | (VIA FACES) | 2070 | (VIA FACES) |
| 2071 | f toggle face visualization | ||
| 1990 | t toggle TAB visualization | 2072 | t toggle TAB visualization |
| 1991 | s toggle SPACE and HARD SPACE visualization | 2073 | s toggle SPACE and HARD SPACE visualization |
| 1992 | r toggle trailing blanks visualization | 2074 | r toggle trailing blanks visualization |
| @@ -2036,9 +2118,13 @@ See also `whitespace-toggle-option-alist'." | |||
| 2036 | (cdr | 2118 | (cdr |
| 2037 | (assq ch whitespace-toggle-option-alist))))) | 2119 | (assq ch whitespace-toggle-option-alist))))) |
| 2038 | ;; while body | 2120 | ;; while body |
| 2039 | (if (eq ch ?\?) | 2121 | (cond |
| 2040 | (whitespace-help-on style) | 2122 | ((eq ch ?\?) (whitespace-help-on style)) |
| 2041 | (ding))) | 2123 | ((eq ch ?\ ) (whitespace-help-scroll t)) |
| 2124 | ((eq ch ?\M- ) (whitespace-help-scroll)) | ||
| 2125 | ((eq ch ?>) (whitespace-help-scroll t)) | ||
| 2126 | ((eq ch ?<) (whitespace-help-scroll)) | ||
| 2127 | (t (ding)))) | ||
| 2042 | (whitespace-help-off) | 2128 | (whitespace-help-off) |
| 2043 | (message " ")) ; clean echo area | 2129 | (message " ")) ; clean echo area |
| 2044 | ;; handler | 2130 | ;; handler |
| @@ -2117,22 +2203,23 @@ resultant list will be returned." | |||
| 2117 | 2203 | ||
| 2118 | (defun whitespace-style-face-p () | 2204 | (defun whitespace-style-face-p () |
| 2119 | "Return t if there is some visualization via face." | 2205 | "Return t if there is some visualization via face." |
| 2120 | (or (memq 'tabs whitespace-active-style) | 2206 | (and (memq 'face whitespace-active-style) |
| 2121 | (memq 'spaces whitespace-active-style) | 2207 | (or (memq 'tabs whitespace-active-style) |
| 2122 | (memq 'trailing whitespace-active-style) | 2208 | (memq 'spaces whitespace-active-style) |
| 2123 | (memq 'lines whitespace-active-style) | 2209 | (memq 'trailing whitespace-active-style) |
| 2124 | (memq 'lines-tail whitespace-active-style) | 2210 | (memq 'lines whitespace-active-style) |
| 2125 | (memq 'newline whitespace-active-style) | 2211 | (memq 'lines-tail whitespace-active-style) |
| 2126 | (memq 'empty whitespace-active-style) | 2212 | (memq 'newline whitespace-active-style) |
| 2127 | (memq 'indentation whitespace-active-style) | 2213 | (memq 'empty whitespace-active-style) |
| 2128 | (memq 'indentation::tab whitespace-active-style) | 2214 | (memq 'indentation whitespace-active-style) |
| 2129 | (memq 'indentation::space whitespace-active-style) | 2215 | (memq 'indentation::tab whitespace-active-style) |
| 2130 | (memq 'space-after-tab whitespace-active-style) | 2216 | (memq 'indentation::space whitespace-active-style) |
| 2131 | (memq 'space-after-tab::tab whitespace-active-style) | 2217 | (memq 'space-after-tab whitespace-active-style) |
| 2132 | (memq 'space-after-tab::space whitespace-active-style) | 2218 | (memq 'space-after-tab::tab whitespace-active-style) |
| 2133 | (memq 'space-before-tab whitespace-active-style) | 2219 | (memq 'space-after-tab::space whitespace-active-style) |
| 2134 | (memq 'space-before-tab::tab whitespace-active-style) | 2220 | (memq 'space-before-tab whitespace-active-style) |
| 2135 | (memq 'space-before-tab::space whitespace-active-style))) | 2221 | (memq 'space-before-tab::tab whitespace-active-style) |
| 2222 | (memq 'space-before-tab::space whitespace-active-style)))) | ||
| 2136 | 2223 | ||
| 2137 | 2224 | ||
| 2138 | (defun whitespace-color-on () | 2225 | (defun whitespace-color-on () |
| @@ -2146,8 +2233,15 @@ resultant list will be returned." | |||
| 2146 | (set (make-local-variable 'whitespace-point) | 2233 | (set (make-local-variable 'whitespace-point) |
| 2147 | (point)) | 2234 | (point)) |
| 2148 | (set (make-local-variable 'whitespace-font-lock-refontify) | 2235 | (set (make-local-variable 'whitespace-font-lock-refontify) |
| 2236 | 0) | ||
| 2237 | (set (make-local-variable 'whitespace-bob-marker) | ||
| 2238 | (point-min-marker)) | ||
| 2239 | (set (make-local-variable 'whitespace-eob-marker) | ||
| 2240 | (point-max-marker)) | ||
| 2241 | (set (make-local-variable 'whitespace-buffer-changed) | ||
| 2149 | nil) | 2242 | nil) |
| 2150 | (add-hook 'post-command-hook #'whitespace-post-command-hook nil t) | 2243 | (add-hook 'post-command-hook #'whitespace-post-command-hook nil t) |
| 2244 | (add-hook 'before-change-functions #'whitespace-buffer-changed nil t) | ||
| 2151 | ;; turn off font lock | 2245 | ;; turn off font lock |
| 2152 | (set (make-local-variable 'whitespace-font-lock-mode) | 2246 | (set (make-local-variable 'whitespace-font-lock-mode) |
| 2153 | font-lock-mode) | 2247 | font-lock-mode) |
| @@ -2158,7 +2252,7 @@ resultant list will be returned." | |||
| 2158 | nil | 2252 | nil |
| 2159 | (list | 2253 | (list |
| 2160 | ;; Show SPACEs | 2254 | ;; Show SPACEs |
| 2161 | (list #'whitespace-space-regexp 1 whitespace-space t) | 2255 | (list whitespace-space-regexp 1 whitespace-space t) |
| 2162 | ;; Show HARD SPACEs | 2256 | ;; Show HARD SPACEs |
| 2163 | (list whitespace-hspace-regexp 1 whitespace-hspace t)) | 2257 | (list whitespace-hspace-regexp 1 whitespace-hspace t)) |
| 2164 | t)) | 2258 | t)) |
| @@ -2167,7 +2261,7 @@ resultant list will be returned." | |||
| 2167 | nil | 2261 | nil |
| 2168 | (list | 2262 | (list |
| 2169 | ;; Show TABs | 2263 | ;; Show TABs |
| 2170 | (list #'whitespace-tab-regexp 1 whitespace-tab t)) | 2264 | (list whitespace-tab-regexp 1 whitespace-tab t)) |
| 2171 | t)) | 2265 | t)) |
| 2172 | (when (memq 'trailing whitespace-active-style) | 2266 | (when (memq 'trailing whitespace-active-style) |
| 2173 | (font-lock-add-keywords | 2267 | (font-lock-add-keywords |
| @@ -2183,14 +2277,16 @@ resultant list will be returned." | |||
| 2183 | (list | 2277 | (list |
| 2184 | ;; Show "long" lines | 2278 | ;; Show "long" lines |
| 2185 | (list | 2279 | (list |
| 2186 | (format | 2280 | (let ((line-column (or whitespace-line-column fill-column))) |
| 2187 | "^\\([^\t\n]\\{%s\\}\\|[^\t\n]\\{0,%s\\}\t\\)\\{%d\\}%s\\(.+\\)$" | 2281 | (format |
| 2188 | whitespace-tab-width (1- whitespace-tab-width) | 2282 | "^\\([^\t\n]\\{%s\\}\\|[^\t\n]\\{0,%s\\}\t\\)\\{%d\\}%s\\(.+\\)$" |
| 2189 | (/ whitespace-line-column whitespace-tab-width) | 2283 | whitespace-tab-width |
| 2190 | (let ((rem (% whitespace-line-column whitespace-tab-width))) | 2284 | (1- whitespace-tab-width) |
| 2191 | (if (zerop rem) | 2285 | (/ line-column whitespace-tab-width) |
| 2192 | "" | 2286 | (let ((rem (% line-column whitespace-tab-width))) |
| 2193 | (format ".\\{%d\\}" rem)))) | 2287 | (if (zerop rem) |
| 2288 | "" | ||
| 2289 | (format ".\\{%d\\}" rem))))) | ||
| 2194 | (if (memq 'lines whitespace-active-style) | 2290 | (if (memq 'lines whitespace-active-style) |
| 2195 | 0 ; whole line | 2291 | 0 ; whole line |
| 2196 | 2) ; line tail | 2292 | 2) ; line tail |
| @@ -2296,7 +2392,8 @@ resultant list will be returned." | |||
| 2296 | ;; turn off font lock | 2392 | ;; turn off font lock |
| 2297 | (when (whitespace-style-face-p) | 2393 | (when (whitespace-style-face-p) |
| 2298 | (font-lock-mode 0) | 2394 | (font-lock-mode 0) |
| 2299 | (remove-hook 'post-command-hook #'whitespace-post-command-hook) | 2395 | (remove-hook 'post-command-hook #'whitespace-post-command-hook t) |
| 2396 | (remove-hook 'before-change-functions #'whitespace-buffer-changed t) | ||
| 2300 | (when whitespace-font-lock | 2397 | (when whitespace-font-lock |
| 2301 | (setq whitespace-font-lock nil | 2398 | (setq whitespace-font-lock nil |
| 2302 | font-lock-keywords whitespace-font-lock-keywords)) | 2399 | font-lock-keywords whitespace-font-lock-keywords)) |
| @@ -2317,37 +2414,128 @@ resultant list will be returned." | |||
| 2317 | (defun whitespace-empty-at-bob-regexp (limit) | 2414 | (defun whitespace-empty-at-bob-regexp (limit) |
| 2318 | "Match spaces at beginning of buffer which do not contain the point at \ | 2415 | "Match spaces at beginning of buffer which do not contain the point at \ |
| 2319 | beginning of buffer." | 2416 | beginning of buffer." |
| 2320 | (and (/= whitespace-point 1) | 2417 | (let ((b (point)) |
| 2321 | (re-search-forward whitespace-empty-at-bob-regexp limit t))) | 2418 | r) |
| 2419 | (cond | ||
| 2420 | ;; at bob | ||
| 2421 | ((= b 1) | ||
| 2422 | (setq r (and (/= whitespace-point 1) | ||
| 2423 | (looking-at whitespace-empty-at-bob-regexp))) | ||
| 2424 | (if r | ||
| 2425 | (set-marker whitespace-bob-marker (match-end 1)) | ||
| 2426 | (set-marker whitespace-bob-marker b))) | ||
| 2427 | ;; inside bob empty region | ||
| 2428 | ((<= limit whitespace-bob-marker) | ||
| 2429 | (setq r (looking-at whitespace-empty-at-bob-regexp)) | ||
| 2430 | (if r | ||
| 2431 | (when (< (match-end 1) limit) | ||
| 2432 | (set-marker whitespace-bob-marker (match-end 1))) | ||
| 2433 | (set-marker whitespace-bob-marker b))) | ||
| 2434 | ;; intersection with end of bob empty region | ||
| 2435 | ((<= b whitespace-bob-marker) | ||
| 2436 | (setq r (looking-at whitespace-empty-at-bob-regexp)) | ||
| 2437 | (if r | ||
| 2438 | (set-marker whitespace-bob-marker (match-end 1)) | ||
| 2439 | (set-marker whitespace-bob-marker b))) | ||
| 2440 | ;; it is not inside bob empty region | ||
| 2441 | (t | ||
| 2442 | (setq r nil))) | ||
| 2443 | ;; move to end of matching | ||
| 2444 | (and r (goto-char (match-end 1))) | ||
| 2445 | r)) | ||
| 2446 | |||
| 2447 | |||
| 2448 | (defsubst whitespace-looking-back (regexp limit) | ||
| 2449 | (save-excursion | ||
| 2450 | (when (/= 0 (skip-chars-backward " \t\n" limit)) | ||
| 2451 | (unless (bolp) | ||
| 2452 | (forward-line 1)) | ||
| 2453 | (looking-at regexp)))) | ||
| 2322 | 2454 | ||
| 2323 | 2455 | ||
| 2324 | (defun whitespace-empty-at-eob-regexp (limit) | 2456 | (defun whitespace-empty-at-eob-regexp (limit) |
| 2325 | "Match spaces at end of buffer which do not contain the point at end of \ | 2457 | "Match spaces at end of buffer which do not contain the point at end of \ |
| 2326 | buffer." | 2458 | buffer." |
| 2327 | (and (/= whitespace-point (1+ (buffer-size))) | 2459 | (let ((b (point)) |
| 2328 | (re-search-forward whitespace-empty-at-eob-regexp limit t))) | 2460 | (e (1+ (buffer-size))) |
| 2329 | 2461 | r) | |
| 2330 | 2462 | (cond | |
| 2331 | (defun whitespace-space-regexp (limit) | 2463 | ;; at eob |
| 2332 | "Match spaces." | 2464 | ((= limit e) |
| 2333 | (setq whitespace-font-lock-refontify t) | 2465 | (when (/= whitespace-point e) |
| 2334 | (re-search-forward whitespace-space-regexp limit t)) | 2466 | (goto-char limit) |
| 2335 | 2467 | (setq r (whitespace-looking-back whitespace-empty-at-eob-regexp b))) | |
| 2336 | 2468 | (if r | |
| 2337 | (defun whitespace-tab-regexp (limit) | 2469 | (set-marker whitespace-eob-marker (match-beginning 1)) |
| 2338 | "Match tabs." | 2470 | (set-marker whitespace-eob-marker limit) |
| 2339 | (setq whitespace-font-lock-refontify t) | 2471 | (goto-char b))) ; return back to initial position |
| 2340 | (re-search-forward whitespace-tab-regexp limit t)) | 2472 | ;; inside eob empty region |
| 2473 | ((>= b whitespace-eob-marker) | ||
| 2474 | (goto-char limit) | ||
| 2475 | (setq r (whitespace-looking-back whitespace-empty-at-eob-regexp b)) | ||
| 2476 | (if r | ||
| 2477 | (when (> (match-beginning 1) b) | ||
| 2478 | (set-marker whitespace-eob-marker (match-beginning 1))) | ||
| 2479 | (set-marker whitespace-eob-marker limit) | ||
| 2480 | (goto-char b))) ; return back to initial position | ||
| 2481 | ;; intersection with beginning of eob empty region | ||
| 2482 | ((>= limit whitespace-eob-marker) | ||
| 2483 | (goto-char limit) | ||
| 2484 | (setq r (whitespace-looking-back whitespace-empty-at-eob-regexp b)) | ||
| 2485 | (if r | ||
| 2486 | (set-marker whitespace-eob-marker (match-beginning 1)) | ||
| 2487 | (set-marker whitespace-eob-marker limit) | ||
| 2488 | (goto-char b))) ; return back to initial position | ||
| 2489 | ;; it is not inside eob empty region | ||
| 2490 | (t | ||
| 2491 | (setq r nil))) | ||
| 2492 | r)) | ||
| 2493 | |||
| 2494 | |||
| 2495 | (defun whitespace-buffer-changed (beg end) | ||
| 2496 | "Set `whitespace-buffer-changed' variable to t." | ||
| 2497 | (setq whitespace-buffer-changed t)) | ||
| 2341 | 2498 | ||
| 2342 | 2499 | ||
| 2343 | (defun whitespace-post-command-hook () | 2500 | (defun whitespace-post-command-hook () |
| 2344 | "Save current point into `whitespace-point' variable. | 2501 | "Save current point into `whitespace-point' variable. |
| 2345 | Also refontify when necessary." | 2502 | Also refontify when necessary." |
| 2346 | (setq whitespace-point (point)) | 2503 | (setq whitespace-point (point)) ; current point position |
| 2347 | (let ((refontify (or (eolp) ; end of line | 2504 | (let ((refontify |
| 2348 | (= whitespace-point 1)))) ; beginning of buffer | 2505 | (or |
| 2349 | (when (or whitespace-font-lock-refontify refontify) | 2506 | ;; it is at end of line ... |
| 2350 | (setq whitespace-font-lock-refontify refontify) | 2507 | (and (eolp) |
| 2508 | ;; ... with trailing SPACE or TAB | ||
| 2509 | (or (= (preceding-char) ?\ ) | ||
| 2510 | (= (preceding-char) ?\t))) | ||
| 2511 | ;; it is at beginning of buffer (bob) | ||
| 2512 | (= whitespace-point 1) | ||
| 2513 | ;; the buffer was modified and ... | ||
| 2514 | (and whitespace-buffer-changed | ||
| 2515 | (or | ||
| 2516 | ;; ... or inside bob whitespace region | ||
| 2517 | (<= whitespace-point whitespace-bob-marker) | ||
| 2518 | ;; ... or at bob whitespace region border | ||
| 2519 | (and (= whitespace-point (1+ whitespace-bob-marker)) | ||
| 2520 | (= (preceding-char) ?\n)))) | ||
| 2521 | ;; it is at end of buffer (eob) | ||
| 2522 | (= whitespace-point (1+ (buffer-size))) | ||
| 2523 | ;; the buffer was modified and ... | ||
| 2524 | (and whitespace-buffer-changed | ||
| 2525 | (or | ||
| 2526 | ;; ... or inside eob whitespace region | ||
| 2527 | (>= whitespace-point whitespace-eob-marker) | ||
| 2528 | ;; ... or at eob whitespace region border | ||
| 2529 | (and (= whitespace-point (1- whitespace-eob-marker)) | ||
| 2530 | (= (following-char) ?\n))))))) | ||
| 2531 | (when (or refontify (> whitespace-font-lock-refontify 0)) | ||
| 2532 | (setq whitespace-buffer-changed nil) | ||
| 2533 | ;; adjust refontify counter | ||
| 2534 | (setq whitespace-font-lock-refontify | ||
| 2535 | (if refontify | ||
| 2536 | 1 | ||
| 2537 | (1- whitespace-font-lock-refontify))) | ||
| 2538 | ;; refontify | ||
| 2351 | (jit-lock-refontify)))) | 2539 | (jit-lock-refontify)))) |
| 2352 | 2540 | ||
| 2353 | 2541 | ||
| @@ -2386,11 +2574,11 @@ Also refontify when necessary." | |||
| 2386 | (unless whitespace-display-table-was-local | 2574 | (unless whitespace-display-table-was-local |
| 2387 | (setq whitespace-display-table-was-local t | 2575 | (setq whitespace-display-table-was-local t |
| 2388 | whitespace-display-table | 2576 | whitespace-display-table |
| 2577 | (copy-sequence buffer-display-table)) | ||
| 2578 | ;; asure `buffer-display-table' is unique | ||
| 2579 | ;; when two or more windows are visible. | ||
| 2580 | (setq buffer-display-table | ||
| 2389 | (copy-sequence buffer-display-table))) | 2581 | (copy-sequence buffer-display-table))) |
| 2390 | ;; asure `buffer-display-table' is unique | ||
| 2391 | ;; when two or more windows are visible. | ||
| 2392 | (set (make-local-variable 'buffer-display-table) | ||
| 2393 | (copy-sequence buffer-display-table)) | ||
| 2394 | (unless buffer-display-table | 2582 | (unless buffer-display-table |
| 2395 | (setq buffer-display-table (make-display-table))) | 2583 | (setq buffer-display-table (make-display-table))) |
| 2396 | (dolist (entry whitespace-display-mappings) | 2584 | (dolist (entry whitespace-display-mappings) |
diff --git a/lisp/woman.el b/lisp/woman.el index 291ebcee740..1a9d512d302 100644 --- a/lisp/woman.el +++ b/lisp/woman.el | |||
| @@ -3388,7 +3388,10 @@ Format paragraphs upto TO. Supports special chars. | |||
| 3388 | "Translate up to marker TO. Do this last of all transformations." | 3388 | "Translate up to marker TO. Do this last of all transformations." |
| 3389 | (if translations | 3389 | (if translations |
| 3390 | (let ((matches (car translations)) | 3390 | (let ((matches (car translations)) |
| 3391 | (alist (cdr translations))) | 3391 | (alist (cdr translations)) |
| 3392 | ;; Translations are case-sensitive, eg ".tr ab" does not | ||
| 3393 | ;; affect "A" (bug#6849). | ||
| 3394 | (case-fold-search nil)) | ||
| 3392 | (while (re-search-forward matches to t) | 3395 | (while (re-search-forward matches to t) |
| 3393 | ;; Done like this to retain text properties and | 3396 | ;; Done like this to retain text properties and |
| 3394 | ;; support translation of special characters: | 3397 | ;; support translation of special characters: |